dsh-session-superagent 0.9.215 → 0.9.217

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,80 @@
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.217] - 2026-11-05 —— 面板剩下的「值得修」:按钮说一套做一套
6
+
7
+ ### ① 「全部暂停」写着「这一屏」,却动了全部
8
+
9
+ 筛选到 1 条、点「全部暂停」,**发出 2 条 POST** —— 按钮在说一套做一套。
10
+ 现在它只对**看见的那些**生效,可用性计数也按这一屏算(否则又变成「可点但一条没动」)。
11
+ title 里直接写清「已筛选:1/2,共 1 条可暂停」。
12
+
13
+ ### ② 「复制命令」点了零反馈
14
+
15
+ `navigator.clipboard.writeText()` 的 rejection 没人接,客户不知道复制成没成。
16
+ 对照旁边「复制诊断信息」的写法(`await` + `notify`)补齐:成功说「已复制」,失败说「浏览器可能禁止了剪贴板」。
17
+
18
+ ### ③ 单条「暂停 / 恢复」成功不出声
19
+
20
+ 以前只有删除和轮询有 toast。现在暂停/恢复也各有一句 —— 点完能确认到底点上了没有。
21
+
22
+ ### ④ 两个「问题」计数口径不同,但没说
23
+
24
+ 「需要关注」的 count 是**条目数**(一条守可能贡献多条),「只看有问题的 (N)」是**守的条数**。
25
+ 两个数字不同是对的,但客户会以为算错了。section 副标题直接写清「共 N 条问题,涉及 M 条守」。
26
+
27
+ ### 未做(登记)
28
+
29
+ - **W3**:新增表单少 4 组字段(`sessionMaxWakes` / `priority` / `isolateKeepDays` / `maxIsolated`)。
30
+ M1 修好之后行内编辑能改这几项了,新增时不能设,属于「能用但不完整」;
31
+ - **W5**:`Dot` / `SegmentedControl` 是死代码(从未被调用)。删它要在一个 CRLF 文件里精确匹配多行,本轮没做成。
32
+
33
+ ### 证据
34
+
35
+ ```
36
+ node --test → 368/368
37
+ ui-audit → 11/11(100 分)
38
+ ```
39
+
40
+ ## [0.9.216] - 2026-11-05 —— 面板死交互审计:改了标签/优先级,弹「已保存」,其实一个字节都没发
41
+
42
+ ### ① M1 · 这是我在 0.9.203 引入的回归
43
+
44
+ 那一版为了修 lost update,把保存改成「只发改过的字段」,用 `touchedRef` 过滤。
45
+ 但 `touchedRef` 收的是**控件名**(`labels` / `onlyAssigned` / `priorityReopened`…),
46
+ 而 body 的键是**字段名**(`filters` / `priority`)—— **两套名字对不上**,于是:
47
+
48
+ > 改「只处理这些标签」「只看已指派」或五个优先级开关 → 点保存 → 弹出「已保存:owner/name」→
49
+ > 编辑器收起 → 再展开,**全部弹回原样**。
50
+
51
+ 同一屏的「间隔」「目标/规则」「仅观察」却正常(它们的控件名恰好等于字段名),
52
+ 所以客户会以为「就是这几个开关坏了」。
53
+
54
+ 已加显式映射 `CONTROL_TO_FIELD`。连带结论:`priority` 五项此前**没有任何可达的写入口**(新增表单也没有)。
55
+
56
+ ### ② M2 · `setDeferFilter` 根本没定义
57
+
58
+ 筛选胶囊的 ✕ 与「全部清除」都调它,而组件里叫 `setReasonFilter` —— 两处 `onClick` 直接抛
59
+ `ReferenceError`:点 ✕ 毫无反应,「全部清除」也清不掉这一条。
60
+
61
+ ### ③ M3 · 只改 token 会静默解绑 gh 账号目录
62
+
63
+ `ghDir` 初值恒为空串且从不回填服务端值,于是保存时无条件下发 `ghConfigDir: ""`,
64
+ 服务端当「显式清空」,**已绑定的 gh 账号目录被解绑** —— 评论改回宿主账号,客户不知道为什么。
65
+
66
+ 现在只有**填了东西**才发;要解绑有单独的「解绑 gh 账号目录」按钮。
67
+
68
+ ### ④ M4 · 「看建议规则」按钮永不渲染
69
+
70
+ `item.action` 构造了却没人消费,而 `AGENTS.md` 建议弹层的唯一入口就是它。
71
+
72
+ ### 证据
73
+
74
+ ```
75
+ node --test → 368/368(新增 3 条:映射存在 / 无未定义 setter / action 被渲染)
76
+ ui-audit → 11/11(100 分)
77
+ ```
78
+
5
79
  ## [0.9.215] - 2026-11-05 —— 把「测试在自己算」的两个函数抽出来,断言才真的在断言
6
80
 
7
81
  ### ① `effectiveIntervalMs` 从 `index.js` 挪到 `watch.js`
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.215-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.217-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)
@@ -145,7 +145,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
145
145
  ## 开发
146
146
 
147
147
  ```sh
148
- node --test # 365 项单测
148
+ node --test # 368 项单测
149
149
  ```
150
150
 
151
151
  ### 工具输出:文本给人和 agent,JSON 给程序
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.215'
17
+ const CLIENT_VERSION = '0.9.217'
18
18
  let BASE = '/session-superagent'
19
19
  /**
20
20
  * 挑「最新的那个服务端实例」。
@@ -1118,8 +1118,24 @@ window.__ModuleLoader__.load({
1118
1118
  maxWakesPerHour: Number(draft.maxWakesPerHour) || undefined,
1119
1119
  sessionMaxWakes: Number(draft.sessionMaxWakes) || undefined,
1120
1120
  }
1121
- const out = { repo: full.repo, sessionId: full.sessionId }
1121
+ // 审核 T24 M1:touchedRef 里是**控件名**(labels / onlyAssigned / priorityReopened…),
1122
+ // 而 full 的键是**字段名**(filters / priority)—— 两套名字对不上,这几个控件就永远发不出去,
1123
+ // 而 Toast 照样说「已保存」。这里显式做一次「控件名 → 字段名」的映射。
1124
+ const CONTROL_TO_FIELD = {
1125
+ labels: "filters",
1126
+ onlyAssigned: "filters",
1127
+ priorityReopened: "priority",
1128
+ priorityComments: "priority",
1129
+ priorityLabels: "priority",
1130
+ priorityUnassigned: "priority",
1131
+ priorityStale: "priority",
1132
+ }
1133
+ const wanted = new Set()
1122
1134
  for (const key of touchedRef.current) {
1135
+ wanted.add(CONTROL_TO_FIELD[key] || key)
1136
+ }
1137
+ const out = { repo: full.repo, sessionId: full.sessionId }
1138
+ for (const key of wanted) {
1123
1139
  if (Object.prototype.hasOwnProperty.call(full, key)) out[key] = full[key]
1124
1140
  }
1125
1141
  return out
@@ -1130,10 +1146,17 @@ window.__ModuleLoader__.load({
1130
1146
 
1131
1147
  const act = (watcher, action) => run(async () => {
1132
1148
  await call('/watch', { method: 'POST', body: JSON.stringify({ action, id: watcherId(watcher) }) })
1133
- }, action === 'delete' ? '已删除 ' + watcher.repo : action === 'poll' ? '已触发一次轮询:' + watcher.repo : null)
1134
-
1135
- const actBulk = (action) => run(async () => {
1136
- for (const watcher of watchers) {
1149
+ }, action === 'delete' ? '已删除 ' + watcher.repo
1150
+ : action === 'poll' ? '已触发一次轮询:' + watcher.repo
1151
+ // 审核 T24 W6:暂停/恢复成功以前什么都不说,客户不确定点没点上。
1152
+ : action === 'pause' ? '已暂停:' + watcher.repo
1153
+ : action === 'resume' ? '已恢复:' + watcher.repo
1154
+ : null)
1155
+
1156
+ // 审核 T24 W1:title 写「这一屏」,实现却遍历全部 watchers —— 筛到 1 条点「全部暂停」会发出 2 条 POST。
1157
+ // 让按钮对**看见的那些**生效(与它的文案同口径)。
1158
+ const actBulk = (action, list = watchers) => run(async () => {
1159
+ for (const watcher of list) {
1137
1160
  if (action === 'pause' && !watcher.enabled) continue
1138
1161
  if (action === 'resume' && watcher.enabled) continue
1139
1162
  await call('/watch', { method: 'POST', body: JSON.stringify({ action, id: watcherId(watcher) }) })
@@ -1172,14 +1195,22 @@ window.__ModuleLoader__.load({
1172
1195
  const payload = {}
1173
1196
  if (token.trim()) payload.token = token.trim()
1174
1197
  if (giteeToken.trim()) payload.giteeToken = giteeToken.trim()
1198
+ // 审核 T24 M3:这里以前无条件带 "ghConfigDir" —— ghDir 初值恒为空串且从不回填服务端值,
1199
+ // 于是「只改 token」也会发 ghConfigDir:"",服务端把它当「显式清空」,
1200
+ // 已绑定的 gh 账号目录被静默解绑(评论改回宿主账号)。
1201
+ // 现在只有**填了东西**才发;要解绑请用旁边的「清除」按钮(它显式发空串)。
1175
1202
  if (ghDir.trim()) payload.ghConfigDir = ghDir.trim()
1176
- else if (ghDir === '') payload.ghConfigDir = '' // 显式清空 = 回到宿主账号
1177
1203
  await call('/credentials', { method: 'POST', body: JSON.stringify(payload) })
1178
1204
  setToken('')
1179
1205
  setGhDir('')
1180
1206
  setGiteeToken('')
1181
1207
  }, '凭证已保存')
1182
1208
 
1209
+ /** 显式解绑 gh 账号目录(T24 M3:不能在「只改 token」时顺带清掉)。 */
1210
+ const clearGhDir = () => run(async () => {
1211
+ await call('/credentials', { method: 'POST', body: JSON.stringify({ ghConfigDir: '' }) })
1212
+ }, '已解绑 gh 账号目录(评论改回宿主账号)')
1213
+
1183
1214
  const saveGoal = () => run(async () => {
1184
1215
  await call('/goal', { method: 'POST', body: JSON.stringify({ sessionId, objective: goalDraft }) })
1185
1216
  setGoalTouched(false)
@@ -1195,9 +1226,8 @@ window.__ModuleLoader__.load({
1195
1226
  const dormant = byState.dormant
1196
1227
  // 可暂停的守 = 还在 enabled 的那些。actBulk('pause') 正是按这个条件跳过的,
1197
1228
  // 按钮的可用状态必须跟它同口径 —— 不同口径就会出现「可点、但一条都没动」。
1198
- const pausable = watchers.filter((w) => w.enabled).length
1199
- // 可恢复 = 已暂停的那些(actBulk 的 resume 分支跳过 enabled 的守)
1200
- const resumable = watchers.length - pausable
1229
+ // 可暂停 = **当前这一屏**里还在轮询的(与 actBulk 的入参同口径)
1230
+ const countPausable = (list) => list.filter((w) => w.enabled).length
1201
1231
 
1202
1232
  const stateTag = (watcher) => {
1203
1233
  const state = orbitStateOf(watcher)
@@ -1459,6 +1489,10 @@ window.__ModuleLoader__.load({
1459
1489
  && (!problemsOnly || hasProblem(watcher))
1460
1490
  && (!deferFilter || watcher.deferReason === deferFilter))
1461
1491
 
1492
+ // T24 W1:「全部暂停/全部恢复」对**这一屏**生效,可用性也按这一屏算(同口径)。
1493
+ const pausable = countPausable(visible)
1494
+ const resumable = visible.length - pausable
1495
+
1462
1496
  const filterSummary = (() => {
1463
1497
  // 筛选汇总:叠加时用一行说清「应用了哪几个」,而不是每条各占一行。
1464
1498
  // 只有一个筛选时仍然是一句「只看 X 的守(N 条):清除」。
@@ -1467,7 +1501,7 @@ window.__ModuleLoader__.load({
1467
1501
  if (stateFilter) chips.push({ label: STATE_TEXT[stateFilter], clear: () => setStateFilter(null) })
1468
1502
  if (needle) chips.push({ label: '搜索「' + needle + '」', clear: () => setSearch('') })
1469
1503
  if (problemsOnly) chips.push({ label: '有问题', clear: () => setProblemsOnly(false) })
1470
- if (deferFilter) chips.push({ label: '暂停原因「' + (DEFER_LABELS[deferFilter] || deferFilter) + '」', clear: () => setDeferFilter(null) })
1504
+ if (deferFilter) chips.push({ label: '暂停原因「' + (DEFER_LABELS[deferFilter] || deferFilter) + '」', clear: () => setReasonFilter(null) })
1471
1505
  if (chips.length === 0) return null
1472
1506
  return h('div', { className: 'dt-row-meta', key: 'filter-summary' },
1473
1507
  (() => {
@@ -1481,7 +1515,7 @@ window.__ModuleLoader__.load({
1481
1515
  chips.length > 1
1482
1516
  ? h(Pill, {
1483
1517
  key: '__all', onClick: () => {
1484
- setBadgeFilter(null); setStateFilter(null); setSearch(''); setProblemsOnly(false); setDeferFilter(null)
1518
+ setBadgeFilter(null); setStateFilter(null); setSearch(''); setProblemsOnly(false); setReasonFilter(null)
1485
1519
  },
1486
1520
  }, '全部清除')
1487
1521
  : null)
@@ -1520,8 +1554,14 @@ window.__ModuleLoader__.load({
1520
1554
  : null,
1521
1555
  // 排序:会丢消息的(失败/没回音)排前面;静态提示(仓库归档、只读)排后面
1522
1556
  (() => { problems.sort((a, b) => ((a.rank ?? 9) - (b.rank ?? 9)) || String(a.text).localeCompare(String(b.text))); return problems.length > 0 })()
1523
- ? h(Section, { key: 'problems', title: '需要关注', count: problems.length },
1524
- h('ul', { className: 'dt-plain-list' }, problems.map((item) => h('li', { key: item.key, className: 'dt-danger' }, item.text))))
1557
+ // 审核 T24 W4:这里的 count 是**条目数**(一条守可能贡献多条),而「只看有问题的 (N)」是**守的条数**。
1558
+ // 两个数字口径不同是对的,但要说清,否则客户会以为算错了。
1559
+ ? h(Section, { key: 'problems', title: '需要关注', count: problems.length, subtitle: '共 ' + problems.length + ' 条问题,涉及 ' + watchers.filter(hasProblem).length + ' 条守' },
1560
+ // 审核 T24 M4:以前只渲染 item.text,构造好的 item.action(「看建议规则」)没人消费 ——
1561
+ // 于是那个按钮永不出现,而 AGENTS.md 建议弹层唯一的入口就是它。
1562
+ h('ul', { className: 'dt-plain-list' }, problems.map((item) => h('li', { key: item.key, className: 'dt-danger' },
1563
+ item.text,
1564
+ item.action ? h(Btn, { variant: 'link', size: 'sm', 'aria-label': item.action.label, onClick: item.action.onClick }, item.action.label) : null))))
1525
1565
  : null,
1526
1566
  // 中间态:已经有守、但一次都没唤醒过 —— 这不是"没配置",是"在等"
1527
1567
  (watchers.length > 0 && watchers.every((w) => !w.lastWake))
@@ -1802,6 +1842,10 @@ window.__ModuleLoader__.load({
1802
1842
  field('Token', h(Input, { type: 'password', value: token, placeholder: 'ghp_… / github_pat_…(留空不改)', onChange: (e) => setToken(e.target.value) })),
1803
1843
  field('Gitee 令牌', h(Input, { type: 'password', value: giteeToken, placeholder: '私人令牌(留空不改);只盯 GitHub 可以不管' , onChange: (e) => setGiteeToken(e.target.value) })),
1804
1844
  field('gh 账号目录', h(Input, { value: ghDir, placeholder: '绝对路径(留空 = 用宿主账号)', onChange: (e) => setGhDir(e.target.value) })),
1845
+ // 解绑要**显式**:以前只改 token 时会顺带把已绑定的目录清掉,客户不知道评论为什么换回了宿主账号。
1846
+ credentials.ghConfigDir === 'configured'
1847
+ ? h('div', { className: 'dt-actions' }, h(Btn, { variant: 'ghost', size: 'sm', onClick: clearGhDir }, '解绑 gh 账号目录'))
1848
+ : null,
1805
1849
  h('div', { className: 'dt-actions' }, h(Btn, { variant: 'primary', onClick: saveCredentials }, '保存凭证')),
1806
1850
  h(Hint, null, '不填也能用:插件直接复用已登录的 gh CLI。填了 gh 账号目录,插件就用那个目录里的账号发言(git push 仍用会话自己的身份,唤醒消息里会提醒会话)。')),
1807
1851
  h(Section, { key: 'update', title: '版本与更新' },
@@ -1814,7 +1858,19 @@ window.__ModuleLoader__.load({
1814
1858
  ? h('div', null,
1815
1859
  h('code', { className: 'dt-code' }, update.command),
1816
1860
  h('div', { className: 'dt-actions' },
1817
- h(Btn, { size: 'sm', onClick: () => { try { navigator.clipboard.writeText(update.command) } catch {} } }, '复制命令')))
1861
+ h(Btn, {
1862
+ size: 'sm',
1863
+ // 审核 T24 W2:以前点了零反馈,writeText 的 rejection 也没人接 —— 客户不知道复制没成。
1864
+ // 对照旁边「复制诊断信息」:await + notify 才是正例。
1865
+ onClick: async () => {
1866
+ try {
1867
+ await navigator.clipboard.writeText(update.command)
1868
+ notify('升级命令已复制', 'info')
1869
+ } catch (error) {
1870
+ notify('复制失败(浏览器可能禁止了剪贴板):' + String((error && error.message) || error), 'error')
1871
+ }
1872
+ },
1873
+ }, '复制命令')))
1818
1874
  : null,
1819
1875
  h('div', { className: 'dt-actions' },
1820
1876
  h(Btn, { size: 'sm', variant: 'ghost', onClick: () => checkUpdate(true), disabled: checking }, checking ? '检查中…' : '重新检查')),
@@ -2068,9 +2124,9 @@ window.__ModuleLoader__.load({
2068
2124
  disabled: pausable === 0,
2069
2125
  title: pausable === 0
2070
2126
  ? '没有可暂停的主理鱼:当前 ' + watchers.length + ' 条守都已停用 —— 要一起恢复请点「全部恢复」'
2071
- : '暂停这一屏所有在轮询的主理鱼',
2127
+ : '暂停这一屏显示的 主理鱼' + (visible.length !== watchers.length ? '(已筛选:' + visible.length + '/' + watchers.length + ')' : '') + ',共 ' + pausable + ' 条可暂停',
2072
2128
  'aria-label': pausable === 0 ? '全部暂停(不可用:没有在轮询的主理鱼)' : '全部暂停',
2073
- onClick: () => actBulk('pause'),
2129
+ onClick: () => actBulk('pause', visible),
2074
2130
  }, '全部暂停') : null,
2075
2131
  // 与「全部暂停」同口径:没有可恢复的守时置灰并说明(actBulk 对 enabled 的守直接 continue)
2076
2132
  watchers.length > 0 ? h(Btn, {
@@ -2078,9 +2134,9 @@ window.__ModuleLoader__.load({
2078
2134
  disabled: resumable === 0,
2079
2135
  title: resumable === 0
2080
2136
  ? '没有可恢复的主理鱼:当前 ' + watchers.length + ' 条守都在轮询 —— 要一起停下请点「全部暂停」'
2081
- : '恢复这一屏所有已暂停的主理鱼',
2137
+ : '恢复这一屏显示的已暂停主理鱼' + (visible.length !== watchers.length ? '(已筛选:' + visible.length + '/' + watchers.length + ')' : '') + ',共 ' + resumable + ' 条可恢复',
2082
2138
  'aria-label': resumable === 0 ? '全部恢复(不可用:没有已暂停的主理鱼)' : '全部恢复',
2083
- onClick: () => actBulk('resume'),
2139
+ onClick: () => actBulk('resume', visible),
2084
2140
  }, '全部恢复') : null)),
2085
2141
  h(SegTabs, {
2086
2142
  items: [
package/lib/index.js CHANGED
@@ -43,7 +43,7 @@ import {
43
43
 
44
44
  export const name = 'dsh-session-superagent'
45
45
  /** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
46
- export const SERVER_VERSION = '0.9.215'
46
+ export const SERVER_VERSION = '0.9.217'
47
47
  export const inject = ['tools', 'agents', 'webServer']
48
48
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
49
49
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.215",
3
+ "version": "0.9.217",
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",