dsh-session-superagent 0.9.256 → 0.9.258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,85 @@
2
2
 
3
3
  格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [0.9.258] - 2026-11-05 —— 新建能一次设好,模型也能看见自己写了什么
6
+
7
+ 继续收 T40「两个入口能力不对等」的尾项,并用**真实点击 + 请求体断言**验收,而不是只查字段出现在源码里。
8
+
9
+ ### ① 新建表单:四个关键配置不再要求「先建再改」
10
+
11
+ 新建主理鱼时现在可以直接设置:
12
+
13
+ - 只理这些人提的(作者白名单,自动去掉 `@`);
14
+ - 这条会话每小时最多被唤醒;
15
+ - 隔离区保留天数;
16
+ - 最多保留几个隔离区。
17
+
18
+ 保存后只清空仓库相关内容,**限额与隔离策略保留**,连续添加多个仓库不用反复重填。
19
+
20
+ ### ② 编辑表单:看得到,也终于改得到
21
+
22
+ 补上「排除这些标签」和「只看指派给谁」两个控件。
23
+
24
+ `filters` 是整块提交的,所以保存体现在同时带上 `labels` / `ignoreLabels` / `assignee` / `allowAuthors`,
25
+ **改其中一项不会把另外几项静默清空**。控件名到 `filters` 的 touched 映射也同步补齐。
26
+
27
+ ### ③ HTTP 的间隔与工具同口径
28
+
29
+ `/watch` 以前把 `30.7` 原样存成 `30.7`,工具路径存 `31`。
30
+ 现在两边都是**先取整、再夹取到 30–3600 秒**。
31
+
32
+ ### ④ `watch_status` 补齐 11 个可写配置字段(T41)
33
+
34
+ 模型设完以后终于能自查:`batchLimit`、`maxWakesPerHour`、`sessionMaxWakes`、
35
+ `isolateKeepDays`、`maxIsolated`、`ackLabel`、`workdir`、`priority`、
36
+ `ignoreLabels`、`assignee`、`allowAuthors` 全部回传。
37
+
38
+ 数组与 `priority` 返回副本,避免调用方修改视图时反向污染状态;
39
+ 重复调用 JSON 完全一致,**不破坏 ETag**。
40
+ 字段已登记到 `test/fixtures/contract-stability.json`。
41
+
42
+ ### 证据
43
+
44
+ ```
45
+ npm test → 408/408(新增:新建真实点击核对请求体、编辑 filters 不丢旧值、HTTP 取整、statusView 4 条)
46
+ node scripts/measure-state.mjs → 20 条守 43.8 KB ≤ 50 KB
47
+ ```
48
+
49
+ ## [0.9.257] - 2026-11-05 —— 同一个字段,两条路径两种校验
50
+
51
+ T40 剩下的两条「值得修」落地。
52
+
53
+ ### ① HTTP 路径不校验 `activeHours`
54
+
55
+ 工具路径 0.9.235 就拒绝了非法格式,而 `/watch`(面板)一直**原样收下**。
56
+ 于是面板填 `9-23` → 静默变成「全天有效」,回执照样打 `[activeHours=9-23]`。
57
+
58
+ 现在两条路径走同一个 `validateActiveHours()`,非法格式直接 400 + 说明正确写法。
59
+
60
+ ### ② `watch_start` 恢复暂停的守,以前一句话都不说
61
+
62
+ 只想给一条暂停的守加个标签,`watch_start` 却把它**悄悄恢复**了。
63
+ 守恢复 = 又开始轮询、又开始叫醒 —— 这是个不该静默发生的状态变化。
64
+
65
+ 保留「幂等恢复」语义,但:
66
+
67
+ - 回执里必须写「这条之前是暂停的,这次调用已恢复」;
68
+ - 新增 `resume: false`:只改配置、**保持暂停**(回执也会说明)。
69
+
70
+ ### 用例踩到一个桩的坑
71
+
72
+ `makeReq()` 里 `Buffer.from(body)`:传**对象**会在 microtask 里抛异常,
73
+ `end` 事件永远不发 → handler 一直等请求体 → 整个用例**挂到超时**,
74
+ 而且报错只有一句 `'test failed'`,指不出是哪一条。
75
+
76
+ 排查用了「单独跑这一个用例 + 最小探针」两步定位。已改用 `JSON.stringify()`。
77
+
78
+ ### 证据
79
+
80
+ ```
81
+ npm test → 401/401(新增:面板非法时段要 400;恢复必须说 / resume:false 保持暂停)
82
+ ```
83
+
5
84
  ## [0.9.256] - 2026-11-05 —— 没有这三个数,「不打断」只是信念
6
85
 
7
86
  《为什么做这个产品》里写了「怎么算成功」,但**一个数都没测**。没有它们,
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <img src="assets/icon-180.png" width="88" height="88" alt="">
4
4
 
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
- [![Version](https://img.shields.io/badge/version-0.9.256-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.258-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
7
7
  [![npm](https://img.shields.io/npm/v/dsh-session-superagent.svg)](https://www.npmjs.com/package/dsh-session-superagent)
8
8
  [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-plugin-orange.svg)](https://github.com/topics/dsh-plugin)
9
9
  [![awesome](https://img.shields.io/badge/awesome-dsh--plugin-%E2%9C%93-success.svg)](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
@@ -146,7 +146,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
146
146
  ## 开发
147
147
 
148
148
  ```sh
149
- npm test # 399 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
149
+ npm test # 408 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
150
150
  ```
151
151
 
152
152
  ### 工具输出:文本给人和 agent,JSON 给程序
@@ -206,9 +206,9 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
206
206
 
207
207
 
208
208
  ```bash
209
- npm test # 399 项单测(带离线开关,约 1.6 秒)
209
+ npm test # 408 项单测(带离线开关,约 1.6 秒)
210
210
  node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
211
- node scripts/preflight.mjs # 40 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
211
+ node scripts/preflight.mjs # 41 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
212
212
  node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
213
213
  ```
214
214
 
package/client.js CHANGED
@@ -14,7 +14,7 @@ window.__ModuleLoader__.load({
14
14
  const { useCallback, useEffect, useRef, useState } = React
15
15
 
16
16
  // 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
17
- const CLIENT_VERSION = '0.9.256'
17
+ const CLIENT_VERSION = '0.9.258'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -979,6 +979,8 @@ window.__ModuleLoader__.load({
979
979
  'cap-watcher': '撞单守上限',
980
980
  busy: '会话忙',
981
981
  }
982
+ // 新建与编辑共用:同一个输入提示写两份,改一处忘另一处就会漂移(文案门禁会拦)。
983
+ const AUTHOR_LIST_PLACEHOLDER = 'GitHub 登录名,逗号分隔,留空 = 谁都算'
982
984
 
983
985
  const [snap, setSnap] = useState({ loading: true, error: null, body: null })
984
986
  const [tab, setTab] = useState('overview')
@@ -986,6 +988,8 @@ window.__ModuleLoader__.load({
986
988
  const [form, setForm] = useState({
987
989
  repo: '', intervalSec: '60', goal: '', labels: '', onlyAssigned: false,
988
990
  activeHours: '', isolated: false, workdir: '',
991
+ // 新建时就要能定:先建再改会多一步,尤其隔离区天数/数量不该先用默认值跑一轮。
992
+ allowAuthors: '', sessionMaxWakes: '', isolateKeepDays: '', maxIsolated: '',
989
993
  })
990
994
  const [token, setToken] = useState('')
991
995
  const [goalDraft, setGoalDraft] = useState('')
@@ -1106,8 +1110,10 @@ window.__ModuleLoader__.load({
1106
1110
  intervalSec: Number(draft.intervalSec) || watcher.intervalSec,
1107
1111
  filters: {
1108
1112
  labels: String(draft.labels || '').split(',').map((v) => v.trim()).filter(Boolean),
1113
+ // filters 整块发送,三个名单都必须带上,否则改标签会顺带清空另外两项。
1114
+ ignoreLabels: String(draft.ignoreLabels || '').split(',').map((v) => v.trim()).filter(Boolean),
1109
1115
  onlyAssigned: !!draft.onlyAssigned,
1110
- // 必须带上:filters 是**整块**发出去的,漏了它会把作者名单清空
1116
+ assignee: String(draft.assignee || '').trim().replace(/^@/, '') || null,
1111
1117
  allowAuthors: String(draft.allowAuthors || '').split(',').map((v) => v.trim().replace(/^@/, '')).filter(Boolean),
1112
1118
  },
1113
1119
  activeHours: draft.activeHours || '',
@@ -1133,7 +1139,9 @@ window.__ModuleLoader__.load({
1133
1139
  // 而 Toast 照样说「已保存」。这里显式做一次「控件名 → 字段名」的映射。
1134
1140
  const CONTROL_TO_FIELD = {
1135
1141
  labels: "filters",
1142
+ ignoreLabels: "filters",
1136
1143
  onlyAssigned: "filters",
1144
+ assignee: "filters",
1137
1145
  allowAuthors: "filters",
1138
1146
  priorityReopened: "priority",
1139
1147
  priorityComments: "priority",
@@ -1185,6 +1193,7 @@ window.__ModuleLoader__.load({
1185
1193
  filters: {
1186
1194
  labels: String(form.labels || '').split(',').map((v) => v.trim()).filter(Boolean),
1187
1195
  onlyAssigned: !!form.onlyAssigned,
1196
+ allowAuthors: String(form.allowAuthors || '').split(',').map((v) => v.trim().replace(/^@/, '')).filter(Boolean),
1188
1197
  },
1189
1198
  activeHours: form.activeHours || '',
1190
1199
  isolated: !!form.isolated,
@@ -1192,9 +1201,13 @@ window.__ModuleLoader__.load({
1192
1201
  observe: !!form.observe,
1193
1202
  batchLimit: Number(form.batchLimit) || undefined,
1194
1203
  maxWakesPerHour: Number(form.maxWakesPerHour) || undefined,
1204
+ sessionMaxWakes: Number(form.sessionMaxWakes) || undefined,
1205
+ isolateKeepDays: Number(form.isolateKeepDays) || undefined,
1206
+ maxIsolated: Number(form.maxIsolated) || undefined,
1195
1207
  }),
1196
1208
  })
1197
- setForm({ repo: '', intervalSec: form.intervalSec, goal: '', labels: '', onlyAssigned: false, activeHours: form.activeHours, isolated: form.isolated, workdir: form.workdir, observe: form.observe })
1209
+ // 只清仓库相关的内容;限额、隔离策略保留,连续添加多个仓库时不用重填。
1210
+ setForm({ ...form, repo: '', goal: '', labels: '', onlyAssigned: false, allowAuthors: '' })
1198
1211
  // 添加前体检的警告直接说出来:填错仓库名 / 只读 / 归档,这一刻讲最省事
1199
1212
  const warnings = (created && Array.isArray(created.warnings)) ? created.warnings : []
1200
1213
  if (warnings.length > 0) notify('已添加,但注意:' + warnings.join(' / '), 'error')
@@ -1278,6 +1291,8 @@ window.__ModuleLoader__.load({
1278
1291
  setDraft({
1279
1292
  intervalSec: String(watcher.intervalSec ?? 60),
1280
1293
  labels: (watcher.filters && watcher.filters.labels ? watcher.filters.labels : []).join(','),
1294
+ ignoreLabels: (watcher.filters && watcher.filters.ignoreLabels ? watcher.filters.ignoreLabels : []).join(','),
1295
+ assignee: (watcher.filters && watcher.filters.assignee) || '',
1281
1296
  activeHours: watcher.activeHours || '',
1282
1297
  // 审核 T26 M2:`watcher.goal` 是**对象**(goalView),当字符串塞进输入框会显示
1283
1298
  // [object Object];保存时后端只收 string,于是静默无效而 Toast 说「已保存」。
@@ -1387,11 +1402,13 @@ window.__ModuleLoader__.load({
1387
1402
  ? h('div', { className: 'dt-fieldset' },
1388
1403
  field('间隔(秒)', h(Input, { value: draft.intervalSec, onChange: (e) => setField({ ...draft, intervalSec: e.target.value }) }), '多长时间检查一次这个仓库,最小 30 秒'),
1389
1404
  field('只处理这些标签', h(Input, { value: draft.labels, placeholder: '逗号分隔,留空 = 全部', onChange: (e) => setField({ ...draft, labels: e.target.value }) })),
1405
+ field('排除这些标签', h(Input, { value: draft.ignoreLabels || '', placeholder: '逗号分隔,留空 = 不排除', onChange: (e) => setField({ ...draft, ignoreLabels: e.target.value }) }), '命中任意一个就跳过,优先级高于上面的白名单'),
1390
1406
  field('活跃时段', h(HoursField, { value: draft.activeHours, onChange: (next) => setField({ ...draft, activeHours: next }) }), '只在这个时间段内唤醒;窗口外只攒条目,不打扰'),
1391
1407
  // 官方原型的 Policy 第一件事是「谁可以给你派活」。单人场景也要:别人随手提的 issue 不该叫醒你。
1392
- field('只理这些人提的', h(Input, { value: draft.allowAuthors || '', placeholder: 'GitHub 登录名,逗号分隔,留空 = 谁都算', onChange: (e) => setField({ ...draft, allowAuthors: e.target.value }) }), '不在名单里的人提的 issue/PR 不会叫醒你(Gitee 也可以填)'),
1408
+ field('只理这些人提的', h(Input, { value: draft.allowAuthors || '', placeholder: AUTHOR_LIST_PLACEHOLDER, onChange: (e) => setField({ ...draft, allowAuthors: e.target.value }) }), '不在名单里的人提的 issue/PR 不会叫醒你(Gitee 也可以填)'),
1393
1409
  field('目标/规则', h(Input, { value: draft.goal || '', placeholder: '可选,会附在唤醒消息里', onChange: (e) => setField({ ...draft, goal: e.target.value }) })),
1394
1410
  h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.onlyAssigned, onChange: (v) => setField({ ...draft, onlyAssigned: v }), label: '只看已指派' }), '只处理已指派给人的条目'),
1411
+ draft.onlyAssigned ? field('只看指派给谁', h(Input, { value: draft.assignee || '', placeholder: 'GitHub 登录名,留空 = 只要有指派就行', onChange: (e) => setField({ ...draft, assignee: e.target.value }) })) : null,
1395
1412
  field('单次最多唤醒条数', h(Input, { value: draft.batchLimit || '', placeholder: String(DEFAULTS.batchLimit || 5) + '(1-20)', onChange: (e) => setField({ ...draft, batchLimit: e.target.value }) })),
1396
1413
  field('每小时最多唤醒次数', h(Input, { value: draft.maxWakesPerHour || '', placeholder: String(DEFAULTS.maxWakesPerHour || 6) + '(1-60)', onChange: (e) => setField({ ...draft, maxWakesPerHour: e.target.value }) })),
1397
1414
  field('这条会话每小时最多被唤醒', h(Input, { value: draft.sessionMaxWakes || '', placeholder: String(DEFAULTS.sessionMaxWakes || 12) + '(1-60)', onChange: (e) => setField({ ...draft, sessionMaxWakes: e.target.value }) }), '跨所有守累计:守 5 个仓库时,光有单守上限挡不住叠加'),
@@ -1835,13 +1852,17 @@ window.__ModuleLoader__.load({
1835
1852
  field('间隔(秒)', h(Input, { value: form.intervalSec, onChange: (e) => setForm({ ...form, intervalSec: e.target.value }) })),
1836
1853
  field('单次最多唤醒条数', h(Input, { value: form.batchLimit || '', placeholder: String(DEFAULTS.batchLimit || 5) + '(1-20)', onChange: (e) => setForm({ ...form, batchLimit: e.target.value }) })),
1837
1854
  field('每小时最多唤醒次数', h(Input, { value: form.maxWakesPerHour || '', placeholder: String(DEFAULTS.maxWakesPerHour || 6) + '(1-60)', onChange: (e) => setForm({ ...form, maxWakesPerHour: e.target.value }) })),
1855
+ field('这条会话每小时最多被唤醒', h(Input, { value: form.sessionMaxWakes || '', placeholder: String(DEFAULTS.sessionMaxWakes || 12) + '(1-60)', onChange: (e) => setForm({ ...form, sessionMaxWakes: e.target.value }) }), '跨所有主理鱼累计,守多个仓库时尤其要设'),
1838
1856
  field('只处理这些标签', h(Input, { value: form.labels, placeholder: '逗号分隔,留空 = 全部', onChange: (e) => setForm({ ...form, labels: e.target.value }) })),
1857
+ field('只理这些人提的', h(Input, { value: form.allowAuthors || '', placeholder: AUTHOR_LIST_PLACEHOLDER, onChange: (e) => setForm({ ...form, allowAuthors: e.target.value }) }), '不在名单里的人提的 issue/PR 不会叫醒你'),
1839
1858
  field('活跃时段', h(HoursField, { value: form.activeHours, onChange: (next) => setForm({ ...form, activeHours: next }) }), '只在这个时间段内唤醒;不填 = 全天'),
1840
1859
  field('目标/规则', h(Input, { value: form.goal || '', placeholder: '可选,会附在唤醒消息里', onChange: (e) => setForm({ ...form, goal: e.target.value }) })),
1841
1860
  h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: form.onlyAssigned, onChange: (v) => setForm({ ...form, onlyAssigned: v }), label: '只看已指派' }), '只处理已指派给人的条目'),
1842
1861
  h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!form.observe, onChange: (v) => setForm({ ...form, observe: v }), label: '仅观察' }), '仅观察(只记录本会唤醒哪几条,不真唤醒)'),
1843
1862
  h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: form.isolated, onChange: (v) => setForm({ ...form, isolated: v }), label: '隔离执行' }), ISOLATED_HINT),
1844
1863
  form.isolated ? field('隔离工作目录', h(Input, { value: form.workdir, placeholder: '绝对路径,留空 = 当前工作目录', onChange: (e) => setForm({ ...form, workdir: e.target.value }) })) : null,
1864
+ form.isolated ? field('隔离区保留天数', h(Input, { value: form.isolateKeepDays || '', placeholder: String(DEFAULTS.isolateKeepDays || 3) + '(1-30)', onChange: (e) => setForm({ ...form, isolateKeepDays: e.target.value }) }), '每次唤醒前回收这个天数之前的一次性工作区') : null,
1865
+ form.isolated ? field('最多保留几个隔离区', h(Input, { value: form.maxIsolated || '', placeholder: '5(1-50)', onChange: (e) => setForm({ ...form, maxIsolated: e.target.value }) }), '超出就回收最旧的,不影响正在使用的那个') : null,
1845
1866
  h('div', { className: 'dt-actions' },
1846
1867
  h(Btn, { variant: 'primary', icon: h(Icon, { name: 'plus' }), onClick: addWatcher, disabled: !sessionId || !form.repo.trim() },
1847
1868
  sessionId ? '添加到当前会话' : '先打开一个会话'))))
@@ -38,6 +38,17 @@
38
38
  | `activeHours` | 稳定 |
39
39
  | `labels` | 稳定 |
40
40
  | `onlyAssigned` | 稳定 |
41
+ | `batchLimit` | 稳定 |
42
+ | `maxWakesPerHour` | 稳定 |
43
+ | `sessionMaxWakes` | 稳定 |
44
+ | `isolateKeepDays` | 稳定 |
45
+ | `maxIsolated` | 稳定 |
46
+ | `ackLabel` | 稳定 |
47
+ | `workdir` | 稳定 |
48
+ | `priority` | 稳定 |
49
+ | `ignoreLabels` | 稳定 |
50
+ | `assignee` | 稳定 |
51
+ | `allowAuthors` | 稳定 |
41
52
  | `deferReason` | 稳定 |
42
53
  | `lastDeferred` | 实验 |
43
54
  | `silentWakes` | 稳定 |
package/lib/index.js CHANGED
@@ -46,7 +46,7 @@ import {
46
46
 
47
47
  export const name = 'dsh-session-superagent'
48
48
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
49
- export const SERVER_VERSION = '0.9.256'
49
+ export const SERVER_VERSION = '0.9.258'
50
50
  export const inject = ['tools', 'agents', 'webServer']
51
51
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
52
52
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
@@ -1997,7 +1997,8 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
1997
1997
  json(res, 503, { ok: false, error: '插件实例已失效(当前 handler 跑在已释放的上下文里):请重载 DSH 后再添加' })
1998
1998
  return
1999
1999
  }
2000
- const intervalSec = Math.max(30, Math.min(3600, Number(body.intervalSec) || 60))
2000
+ // 与 watch_start 同口径:先取整再夹取。否则面板存 30.7、工具存 31,同一设置两种结果。
2001
+ const intervalSec = Math.max(30, Math.min(3600, Math.round(Number(body.intervalSec) || 60)))
2001
2002
  const state = readState()
2002
2003
  state.watchers = state.watchers || {}
2003
2004
  // id 里带 provider:同一个 owner/name 在两家可能都存在,混在一起会互相覆盖
@@ -2051,7 +2052,13 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2051
2052
  if (body.isolateKeepDays != null) entry.isolateKeepDays = Math.max(1, Math.min(30, Number(body.isolateKeepDays) || 3))
2052
2053
  // 同时最多留几个隔离区(越界回收最旧的)—— 1~50
2053
2054
  if (body.maxIsolated != null) entry.maxIsolated = Math.max(1, Math.min(50, Number(body.maxIsolated) || 5))
2054
- if (typeof body.activeHours === 'string') entry.activeHours = body.activeHours.trim().slice(0, 20) || null
2055
+ if (typeof body.activeHours === 'string') {
2056
+ // 审核 T40:工具路径 0.9.235 就拒绝了非法格式,HTTP 路径却一直**原样收下** ——
2057
+ // 于是面板填 `9-23` 会静默变成「全天有效」,而回执还打着 [activeHours=9-23]。
2058
+ const hoursCheck = validateActiveHours(body.activeHours)
2059
+ if (!hoursCheck.ok) return json(res, 400, { error: hoursCheck.reason })
2060
+ entry.activeHours = hoursCheck.normalized || null
2061
+ }
2055
2062
  if (typeof body.workdir === 'string' && body.workdir.trim()) {
2056
2063
  const workdir = body.workdir.trim()
2057
2064
  if (!isAbsolute(workdir)) return json(res, 400, { error: 'workdir must be an absolute path' })
@@ -2785,6 +2792,7 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2785
2792
  isolated: { type: 'boolean', description: 'Run each wake in a throwaway git worktree.' },
2786
2793
  workdir: { type: 'string', description: 'Repository used for isolation worktrees (absolute path).' },
2787
2794
  activeHours: { type: 'string', description: 'Wake only inside this window, e.g. "09:00-23:00" (supports overnight).' },
2795
+ resume: { type: 'boolean', description: 'Only when the watcher is paused: resume it (default true). Pass false to change config while keeping it paused.' },
2788
2796
  format: { type: 'string', description: "'text' (default) or 'json'." },
2789
2797
  batchLimit: { type: 'number', description: 'Max items listed per wake (1-20, default 5).' },
2790
2798
  maxWakesPerHour: { type: 'number', description: 'Max wakes per hour per watcher (1-60, default 6).' },
@@ -2868,7 +2876,13 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2868
2876
  if (typeof args.isolateKeepDays === 'number') entry.isolateKeepDays = Math.max(1, Math.min(30, Math.round(args.isolateKeepDays)))
2869
2877
  if (typeof args.maxIsolated === 'number') entry.maxIsolated = Math.max(1, Math.min(50, Math.round(args.maxIsolated)))
2870
2878
  if (typeof args.ackLabel === 'string' && args.ackLabel.trim()) entry.ackLabel = args.ackLabel.trim().slice(0, 60)
2871
- entry.enabled = true
2879
+ // 审核 T40 W12:`watch_start` 的语义是「开始看」,但**静默恢复**一条暂停的守是意外行为。
2880
+ // 保留恢复语义(幂等),但两件事必须做到:
2881
+ // ① 如果调用方显式传了 resume:false,就保持原暂停状态(只改配置);
2882
+ // ② 回执里必须说明「这条之前是暂停的,这次恢复了」—— 不许静默。
2883
+ const wasPaused = existing && existing.enabled === false
2884
+ const keepPaused = args.resume === false && wasPaused
2885
+ entry.enabled = !keepPaused
2872
2886
  state.watchers = state.watchers || {}
2873
2887
  if (!existing) {
2874
2888
  // 审核 T32 M3:以前数**全部**守(含已停用的),于是报错让用户「先 watch_stop」,
@@ -2884,6 +2898,8 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
2884
2898
  stopWatcher(id)
2885
2899
  startWatcher(entry)
2886
2900
  const flags = []
2901
+ if (wasPaused && entry.enabled) flags.push('这条之前是暂停的,这次调用已恢复(只想改配置请传 resume: false)')
2902
+ if (wasPaused && !entry.enabled) flags.push('仍保持暂停(resume: false)')
2887
2903
  if (entry.observe === true) flags.push('observe-only(只记录不唤醒)')
2888
2904
  if (entry.isolated === true) flags.push('isolated')
2889
2905
  if (entry.activeHours) flags.push('activeHours=' + entry.activeHours)
package/lib/watch.js CHANGED
@@ -1151,8 +1151,21 @@ export function statusView(entries, options = {}) {
1151
1151
  observe: w.observe === true,
1152
1152
  isolated: w.isolated === true,
1153
1153
  activeHours: w.activeHours || null,
1154
- labels: (w.filters && Array.isArray(w.filters.labels)) ? w.filters.labels : [],
1154
+ labels: (w.filters && Array.isArray(w.filters.labels)) ? w.filters.labels.slice() : [],
1155
1155
  onlyAssigned: Boolean(w.filters && w.filters.onlyAssigned),
1156
+ // 可写配置必须回传,模型才能用 watch_status 自查 watch_start 是否真正生效。
1157
+ batchLimit: w.batchLimit ?? 5,
1158
+ maxWakesPerHour: w.maxWakesPerHour ?? 6,
1159
+ sessionMaxWakes: w.sessionMaxWakes ?? 12,
1160
+ isolateKeepDays: w.isolateKeepDays ?? 3,
1161
+ maxIsolated: w.maxIsolated ?? 5,
1162
+ ackLabel: w.ackLabel ?? DEFAULT_ACK_LABEL,
1163
+ workdir: w.workdir ?? null,
1164
+ // 补齐缺省开关,同时保留面板写入的 stale 等扩展项;拷贝对象避免共享引用。
1165
+ priority: { ...DEFAULT_PRIORITY, ...((w.priority && typeof w.priority === 'object' && !Array.isArray(w.priority)) ? w.priority : {}) },
1166
+ ignoreLabels: (w.filters && Array.isArray(w.filters.ignoreLabels)) ? w.filters.ignoreLabels.slice() : [],
1167
+ assignee: (w.filters && w.filters.assignee) || null,
1168
+ allowAuthors: (w.filters && Array.isArray(w.filters.allowAuthors)) ? w.filters.allowAuthors.slice() : [],
1156
1169
  deferReason: w.deferReason || null,
1157
1170
  lastDeferred: w.lastDeferred || null,
1158
1171
  silentWakes: Number(w.silentWakes) || 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.256",
3
+ "version": "0.9.258",
4
4
  "description": "Session-level superagent for DeepSeek Harness: watch a GitHub repository and wake a session when something needs doing. Credentials never reach the model.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",