npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hiwork-automation

v0.1.4

Published

HiWork 定时任务插件:在独立 DSH Session 中按计划执行任务,支持设置页与 Agent 双入口管理。

Downloads

505

Readme

hiwork-automation

HiWork 定时任务插件(DSH 双半插件包):在独立 DSH Session 中按计划执行任务, 通过 HiWork Feature Center 的中央页管理(左侧 HiWork 菜单 → 中央内容区), 也允许 Agent 通过工具创建(用户确认后才落盘)。未安装 hiwork-core 时自动 降级为设置页 + 侧栏入口。

  • 设计:../hiwork-desktop/docs/superpowers/specs/2026-09-08-hiwork-automation-design.md
  • 实现计划:../hiwork-desktop/docs/superpowers/plans/2026-09-08-hiwork-automation.md
  • 对齐的 DSH 版本:0.1.2-rc.1(与 hiwork-desktopOFFICIAL_DSH_VERSION 一致)

快速开始

pnpm install
pnpm typecheck     # tsc --noEmit
pnpm test          # vitest run
pnpm build         # lib/index.js(Host)+ lib/client.js(Web)+ lib/types/**
pnpm check         # typecheck + test + build
pnpm verify        # typecheck + build + test(含产物纯度/打包契约门禁)

包结构

| 路径 | 半边 | 职责 | | --- | --- | --- | | src/types.ts | 共享 | 版本 1 持久化值、zod 校验、服务端口契约 | | src/domain.ts | Host | 定义/运行记录的构造与更新(revision、快照、确定性 runId) | | src/recurrence.ts | Host | 时区感知的计划归一化、下一次到期、rrule 摘要 | | src/permission-presets.ts | Host | 把持久化权限名收敛到 Host 当前注册列表 | | src/executor.ts | Host | 每次运行创建独立 Session、无人值守权限、终态结算 | | src/service.ts | Host | 存储、串行化、调度 tick、恢复、快照 | | src/rpc.ts | Host | /hiwork-automation loopback RPC | | src/protocol.ts | 共享 | RPC 通道、端点、请求/响应校验与视图模型 | | src/tools.ts | Host | Agent 管理工具(创建走确认卡片) | | src/prompt.ts | Host | 系统提示词片段 | | src/index.ts | Host | 插件入口:服务注入、RPC/工具注册、调度起停 | | src/client/** | Web | 快照运行时、设置页、定时侧栏、表单与样式 |

与桌面端集成

Host 产物自包含:桌面端补种插件时会清空 profile 的 node_modules/@deepseek-ai/*hiwork-desktop/src/plugin-seed.ts),因此 lib/index.js 内联了全部官方依赖, 插件只通过传入的 ctx 使用 Host 服务。与 hiwork-core 的打包约定一致。

client 产物是 rc.1 的 window.__ModuleLoader__.load({ id, factory }) 闭包工厂, 运行时 require 只允许落在 rc.1 模块表种子内(react×4 + dsh-client-store + dsh-client-ui-slots + dsh-client-ui-primitives 及已声明的 client 插件包)。 client bundle 纯度src/client/** 对官方包只允许 import type,运行时只 import react。

打包与发布

两条渠道并存:

  • npm:已发布为 hiwork-automation。注意 ~/.npmrc 默认指向淘宝镜像, 镜像不接受发布,npm publish 必须显式带 --registry=https://registry.npmjs.org/
  • 桌面端走 npm,按「本地 tarball + file: 说明符」随包分发。 离线仓库装配用的是随包 pnpm,store add <tgz> + name@version --offline 会报 ERR_PNPM_NO_OFFLINE_META(缺 registry 元数据),故只能 file:
# 在插件仓库:构建 → pnpm pack → 复制到桌面 vendor/ → 同步 bundled-plugins.ts 条目
node scripts/publish-to-desktop.mjs
node scripts/publish-to-desktop.mjs --desktop ../hiwork-desktop/.worktrees/hiwork-automation
node scripts/publish-to-desktop.mjs --version 0.1.1 --dry-run

桌面端侧(hiwork-desktop,feature 分支):

| 环节 | 位置 | 行为 | | --- | --- | --- | | 目录锁定 | src/bundled-plugins.ts | BundledPlugin.archive + bundledPluginSpecifier():有 archive 的条目生成 file:<vendor>/<tgz>,其余仍是 名字@版本 | | 首次补种 | src/plugin-seed.ts | SeedOptions.bundledArchiveDir(缺省 <store>/vendor)→ profile 里声明为 file:...profile-updates.ts 跳过本地协议依赖,不会改成 registry 版本 | | 离线仓库装配 | scripts/prepare-runtime.ts | staging 清单写绝对 file:<桌面>/vendor/<tgz>;安装成功后把 tarball 复制进 <store>/vendor/,随 store.tgz 分发(pruneStoreForPackaging 只删 v11/projects) | | 运行时补种 | src/main.ts | 传 bundledArchiveDir = join(pluginStoreDir, 'vendor'),首启按 file:<store>/vendor/<tgz> 离线安装 |

已验证(本机真实执行):staging 用随包 pnpm 装出 176 个包、<store>/vendor/hiwork-automation-0.1.0.tgz 存在;随后用 profile 脚手架 + --offline --store-dir <store> 复现首启补种, hiwork-automation 落地为 file: 依赖且 lib/index.jslib/client.jscordis.patch.yml 齐全; 第二次补种判定 already-installed,不重复安装。

发布新版本时:改 package.json 版本 → 跑 publish-to-desktop.mjs(会删除桌面 vendor/ 里的旧 tgz 并同步条目) → 在完整桌面检出里用随包 Node 24.19.0 执行 pnpm check && pnpm test && pnpm run prepare-runtime && pnpm run dist

入口

主入口是 hiwork-core 的 Feature Center:本插件在 client 半边探测 cordis 服务 hiworkFeatureCenter,存在时注册唯一一个 feature:

| 字段 | 值 | | --- | --- | | id | automation | | order | 20 | | label | t('view.title')(跟随语言切换) | | icon | 内联时钟 SVG(侧栏折叠成图标栏时只显示它) | | render | 复用现有 AutomationViewopenSession 走 core 的 openNativeSession |

render 拿到的是 FeatureRenderContext(只有 openNativeSession / openNativeHome), 任务数据仍来自本插件自己的 runtime 快照(Host 权威),registry 不持有业务状态。 feature 注销不删除任务数据、不影响 Host 调度。

本插件不在运行时 import hiwork-core(DSH client 模块表禁止 feature 插件之间 互相 runtime-import),只按服务名读取结构契约(src/client/contracts.ts)。

槽位(独立安装降级)

没有 hiwork-core(或它尚未加载)时,以下降级入口保证插件独立可用;hiwork-core 后到时立即全部撤下,同一功能不会同时出现两个主入口。

  • settings.section(id scheduled-tasks,order 10):定时任务 / 运行记录设置页。
  • sidebar.schedule(id hiwork-automation-schedule,order 10):定时侧栏, 按自动化定义分组显示运行记录,并提供「打开会话」入口。 DSH 0.1.2-rc.1 官方 ui-sidebar 未声明该槽位,它由侧栏宿主插件提供; 插件始终发起该槽位的注册意图(ctx.slots.inject),没有宿主时这份注册保持 休眠,既不报错也不占位。
  • 降级入口:挂载后 1 秒内若 sidebar.schedule 的注入回调仍未触发(说明没有宿主), 插件在官方 list 槽位 sidebar.footer.action 注册一个紧凑入口 (id hiwork-automation-schedule-fallback,order 10)。点开是一个小浮层, 里面托管同一个 ScheduleRail 组件(不是跳转设置页)。 两者互斥:宿主一旦出现,降级入口与它的定时器会立刻撤销;插件卸载时一并清理。