jack-chai-work/dsh-work-window--plugins-work-window ↗★ 0
@local/dsh-work-window
Work-window gate for DSH agents: pause agent work outside configured working windows, confirm tasks during pauses, and cache timor.tech holiday data locally.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add 'github:jack-chai-work/dsh-work-window#9fdc55be082ccf695f5066e0102f95c2652b01ab&path:plugins/work-window'说明文档
阅读完整 README ↗或使用 GUI:左侧栏「插件」→ 添加插件 → 填本目录绝对路径 → 安装 → 立即启用
& "\resources\runtime\cli\bin\dsh.cmd" plugin --profile add " "
## 配置(`cordis.patch.yml`)
```yaml
- id: work-window
name: '@local/dsh-work-window'
config:
timeZone: Asia/Hong_Kong
pauseWindows:
- { start: '09:00', end: '12:00' }
- { start: '14:00', end: '18:00' }
holidayApiUrl: 'https://timor.tech/api/holiday/year/{year}'
cacheTtlHours: 12
confirmDuringPause: true
confirmTimeoutMs: 600000 # 暂停时段确认弹窗最长等待时间,超时任务回队
cacheDir: C:\somewhere\work-window # 可选;注释掉则用默认 $DSH_HOME/cache/work-window
wakeNotice: '(工作时段已开始,暂停结束:继续执行队列中暂停的任务。)'
policyText: null # 可选:覆盖注入系统提示词的策略文本
pauseWindows 也接受 '09:00-12:00' 字符串写法。
节假日数据
- Host:
$DSH_HOME/cache/work-window/holidays-.json(每 6 小时检查一次 TTL,默认 12 小时刷新;11-12 月预取次年)。 - Client:
localStorage['dsh-work-window:holidays:']。 - 离线兜底:
shared/offline-holidays.json内置快照(含 2025/2026),随插件发布。 - timor.tech 返回:
holiday:true= 法定假日;holiday:false= 调休补班(算工作日);普通周末由本地日历计算。
开发
cd
node tools/build-client.mjs # 由 client.template.js + shared/status-client.mjs 生成 client.js
node tools/parity.test.mjs # 浏览器/Host 判定一致性(953 断言)
node tools/host.test.mjs # Host 门禁单测(32 断言,含 goal 挂起/回队/唤醒)
node tools/make-offline.mjs # 重新生成离线节假日快照(需要网络)
已知限制
- 「暂停前已开始的 turn」会允许其收尾;只有新 turn / 新 step 会被拦截。
- 若插件在 agent 已运行时才热加载,会给现有 agent 补装门禁(
ctx.agents.list())。 - 子 agent(subagent/teammate)同样受门禁约束;父 turn 在等待子结果期间会一并暂停。
- 没有在线 Web 客户端时不会弹确认,任务直接排队(避免审批永久 pending)。
配置(cordis.patch.yml)
- id: work-window
name: '@local/dsh-work-window'
config:
timeZone: Asia/Hong_Kong
pauseWindows:
- { start: '09:00', end: '12:00' }
- { start: '14:00', end: '18:00' }
holidayApiUrl: 'https://timor.tech/api/holiday/year/{year}'
cacheTtlHours: 12
confirmDuringPause: true
confirmTimeoutMs: 600000 # 暂停时段确认弹窗最长等待时间,超时任务回队
cacheDir: C:\somewhere\work-window # 可选;注释掉则用默认 $DSH_HOME/cache/work-window
wakeNotice: '(工作时段已开始,暂停结束:继续执行队列中暂停的任务。)'
policyText: null # 可选:覆盖注入系统提示词的策略文本
pauseWindows 也接受 '09:00-12:00' 字符串写法。