dsh-session-superagent 0.9.237 → 0.9.239
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 +81 -0
- package/README.md +3 -3
- package/client.js +19 -3
- package/lib/index.js +4 -4
- package/lib/watch.js +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,87 @@
|
|
|
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.239] - 2026-11-05 —— 知识库里那条规则,从落地那天起就没成立过
|
|
6
|
+
|
|
7
|
+
### ① `attention-list-order-is-a-decision.md` 已失效
|
|
8
|
+
|
|
9
|
+
规则原文写着:「排序前先保证**同一条只出现一次**」。
|
|
10
|
+
|
|
11
|
+
`git show 9d6e146`(0.9.87)显示:当时只删掉了循环体内重复 `push` 的那一行,**从未做过按 key 去重**。
|
|
12
|
+
|
|
13
|
+
而面板拿到的是**全部会话**的守 —— 两个会话守同一仓库(`otherSessions` 证明这是明确支持的产品形态),
|
|
14
|
+
「需要关注」里就会出现两条一字不差的条目。
|
|
15
|
+
|
|
16
|
+
**一字不差的重复条目,比缺一条更伤信任** —— 客户会以为系统在乱推。
|
|
17
|
+
|
|
18
|
+
已修:排序前按 key 去重(保留第一条,先 push 的 rank 更高)+ 回归用例。
|
|
19
|
+
|
|
20
|
+
### ② 知识库里会过期的数字
|
|
21
|
+
|
|
22
|
+
`why-not-split-index` 写「1795 行」,实测 **2954 行(+65%)** —— 下一轮读到会严重低估规模。
|
|
23
|
+
已在那篇顶部加「数字会过期」提示,并把索引与相关引用里的具体数字去掉/更新。
|
|
24
|
+
|
|
25
|
+
### ③ 反查:182 条知识库里,生产代码只引用了 3 条
|
|
26
|
+
|
|
27
|
+
T34 把 182 个条目名当标识符在整个代码库里搜:
|
|
28
|
+
|
|
29
|
+
| 板块 | 条目数 | 被引用 | 引用率 |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| 工程与文档(门禁类) | 36 | 19 | **53%** |
|
|
32
|
+
| 调度 / 可靠性 / 性能 | 76 | 13 | 9–18% |
|
|
33
|
+
| 通知与消息设计 | 8 | 0 | **0%** |
|
|
34
|
+
| 判定与优先级 | 12 | 0 | **0%** |
|
|
35
|
+
| **合计** | **182** | **32** | **18%** |
|
|
36
|
+
|
|
37
|
+
而 `lib/` + `client.js`(撑起产品全部行为的那部分)**只引用了 3 条**,`client.js` 是 0 条。
|
|
38
|
+
|
|
39
|
+
**上面那个 bug 能烂 160 多个版本,土壤就是这里** —— 规则写在知识库里,代码里没有任何东西指着它。
|
|
40
|
+
|
|
41
|
+
### 证据
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
npm test → 381/381(新增:两会话守同一仓库时「需要关注」不能重复)
|
|
45
|
+
check-docs → 5 项 PASS
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## [0.9.238] - 2026-11-05 —— 「轮询失败」这个标签用错了地方
|
|
49
|
+
|
|
50
|
+
### M3 · 唤醒失败被说成「轮询失败」
|
|
51
|
+
|
|
52
|
+
面板显示:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
a/b 轮询失败:wake failed: session not live
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
三处都不对:
|
|
59
|
+
|
|
60
|
+
- **归错类** —— 轮询其实**成功了**(正常拉到数据、正常判断、正常决定叫醒),失败的是「叫醒」这一步;
|
|
61
|
+
- **英文内部话** —— `session not live`、`no followup/steer/inbox on agent`、`agent busy (running)`、`merged empty`;
|
|
62
|
+
- **没有下一步** —— 客户不知道该干什么。
|
|
63
|
+
|
|
64
|
+
客户看到「轮询失败」会去查网络、查 token —— 而真正的问题是宿主重启过、会话不在了。
|
|
65
|
+
|
|
66
|
+
### 改法
|
|
67
|
+
|
|
68
|
+
失败原因全部改成「现象 + 下一步」的中文(保留英文状态值便于排查):
|
|
69
|
+
|
|
70
|
+
| 以前 | 现在 |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `session not live` | 这个会话已经不在宿主里了 —— 宿主重启过,或这个会话被关掉了;面板里刷新一下,还在就重建这条主理鱼 |
|
|
73
|
+
| `agent busy (running)` | 会话正忙(agent busy: running)—— 等它空闲,这轮会自动顺延 |
|
|
74
|
+
| `no followup/steer/inbox on agent` | 宿主没给这个会话提供投递入口 —— 换个宿主版本,或直接在会话里 @ 它 |
|
|
75
|
+
| `merged empty` | 合并后没有内容可发(这几条都已被处理过)—— 不用管,下一轮会重新判断 |
|
|
76
|
+
|
|
77
|
+
错误文本加了 `wake:` 前缀,面板据此分开显示**「唤醒失败」**与**「轮询失败」**。
|
|
78
|
+
|
|
79
|
+
### 证据
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
npm test → 380/380(新增:唤醒原因要有中文 + 下一步 + 保留英文状态值)
|
|
83
|
+
ui-audit → 11/11(100 分)
|
|
84
|
+
```
|
|
85
|
+
|
|
5
86
|
## [0.9.237] - 2026-11-05 —— 剩下的错误文案:`undefined`、切掉建议、英文内部话
|
|
6
87
|
|
|
7
88
|
T33 一共给了 6 条必须修,0.9.236 修了前两条(假报错 / 丢下一步),这次是后四条。
|
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)
|
|
6
|
-
[](https://github.com/MYCF711/dsh-session-superagent/releases)
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-session-superagent)
|
|
8
8
|
[](https://github.com/topics/dsh-plugin)
|
|
9
9
|
[](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
|
|
@@ -146,7 +146,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
|
|
|
146
146
|
## 开发
|
|
147
147
|
|
|
148
148
|
```sh
|
|
149
|
-
npm test #
|
|
149
|
+
npm test # 381 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
### 工具输出:文本给人和 agent,JSON 给程序
|
|
@@ -198,7 +198,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
|
|
|
198
198
|
## 验收(不用装宿主也能跑)
|
|
199
199
|
|
|
200
200
|
```bash
|
|
201
|
-
npm test #
|
|
201
|
+
npm test # 381 项单测(带离线开关,约 1.6 秒)
|
|
202
202
|
node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
|
|
203
203
|
node scripts/preflight.mjs # 40 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
|
|
204
204
|
node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
|
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.
|
|
17
|
+
const CLIENT_VERSION = '0.9.239'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -680,6 +680,9 @@ window.__ModuleLoader__.load({
|
|
|
680
680
|
|
|
681
681
|
/** Dock entry: the machine-wide ring plus its click-through detail list. */
|
|
682
682
|
/** 把错误拆成「现象」和「建议」:服务端存的是 short +(hint),建议在末尾的括号里。 */
|
|
683
|
+
// 唤醒失败 vs 轮询失败:前者轮询是成功的,说成「轮询失败」会让客户去查网络
|
|
684
|
+
function isWakeFailure(text) { return /^wake:/.test(String(text || '')) }
|
|
685
|
+
|
|
683
686
|
function splitErrorText(text) {
|
|
684
687
|
const value = String(text || '')
|
|
685
688
|
const match = /([^()]*)\s*$/.exec(value)
|
|
@@ -1457,7 +1460,10 @@ window.__ModuleLoader__.load({
|
|
|
1457
1460
|
problems.push({
|
|
1458
1461
|
key: 'e-' + watcher.repo,
|
|
1459
1462
|
rank: 1, kind: 'error',
|
|
1460
|
-
|
|
1463
|
+
// 审核 T33 M3:以前一律写「轮询失败」—— 而唤醒失败时轮询是**成功的**,归错了类。
|
|
1464
|
+
// `wake:` 前缀由 lib/watch.js 的 planWakeSettlement 打上。
|
|
1465
|
+
text: watcher.repo + (isWakeFailure(watcher.lastError) ? ' 唤醒失败:' : ' 轮询失败:')
|
|
1466
|
+
+ parts.main.replace(/^wake:\s*/, '').slice(0, 120) + (parts.main.length > 120 ? '…' : '') + ' ' + parts.hint,
|
|
1461
1467
|
})
|
|
1462
1468
|
}
|
|
1463
1469
|
// 暂停原因不在「需要关注」里重复:卡片里已经有一行加粗警告色的「暂停唤醒:…」(见 pauseNote),
|
|
@@ -1557,7 +1563,17 @@ window.__ModuleLoader__.load({
|
|
|
1557
1563
|
}))
|
|
1558
1564
|
: null,
|
|
1559
1565
|
// 排序:会丢消息的(失败/没回音)排前面;静态提示(仓库归档、只读)排后面
|
|
1560
|
-
(() => {
|
|
1566
|
+
(() => {
|
|
1567
|
+
// 审核 T34:知识库那条「同一条只出现一次」从 0.9.87 落地起就**没成立过** ——
|
|
1568
|
+
// 当时只删掉了循环体内重复 push 的那一行,从未按 key 去重。
|
|
1569
|
+
// 而面板拿到的是**全部会话**的守:两个会话守同一仓库,就会出两条一字不差的条目。
|
|
1570
|
+
// 排序前按 key 去重(保留第一条:先 push 的 rank 更高)。
|
|
1571
|
+
const deduped = [...new Map(problems.map((item) => [item.key, item])).values()]
|
|
1572
|
+
problems.length = 0
|
|
1573
|
+
problems.push(...deduped)
|
|
1574
|
+
problems.sort((a, b) => ((a.rank ?? 9) - (b.rank ?? 9)) || String(a.text).localeCompare(String(b.text)))
|
|
1575
|
+
return problems.length > 0
|
|
1576
|
+
})()
|
|
1561
1577
|
// 审核 T24 W4:这里的 count 是**条目数**(一条守可能贡献多条),而「只看有问题的 (N)」是**守的条数**。
|
|
1562
1578
|
// 两个数字口径不同是对的,但要说清,否则客户会以为算错了。
|
|
1563
1579
|
? h(Section, { key: 'problems', title: '需要关注', count: problems.length, subtitle: '共 ' + problems.length + ' 条问题,涉及 ' + watchers.filter(hasProblem).length + ' 条守' },
|
package/lib/index.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
|
|
45
45
|
export const name = 'dsh-session-superagent'
|
|
46
46
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
47
|
-
export const SERVER_VERSION = '0.9.
|
|
47
|
+
export const SERVER_VERSION = '0.9.239'
|
|
48
48
|
export const inject = ['tools', 'agents', 'webServer']
|
|
49
49
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
50
50
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -716,7 +716,7 @@ function wakeMerged(ctx, sessionId, text, onSettled) {
|
|
|
716
716
|
if (buf.timer) return { ok: true, merged: true, pending: buf.parts.length }
|
|
717
717
|
buf.timer = setTimeout(() => {
|
|
718
718
|
wakeBuffers.delete(sessionId)
|
|
719
|
-
let result = { ok: false, reason: '
|
|
719
|
+
let result = { ok: false, reason: '合并后没有内容可发(这几条都已被处理过)—— 不用管,下一轮会重新判断' }
|
|
720
720
|
try {
|
|
721
721
|
const merged = mergeWakeTexts(buf.parts)
|
|
722
722
|
if (merged) result = wake(ctx, sessionId, merged)
|
|
@@ -736,7 +736,7 @@ function wakeMerged(ctx, sessionId, text, onSettled) {
|
|
|
736
736
|
function wake(ctx, sessionId, text) {
|
|
737
737
|
const agents = agentsService(ctx)
|
|
738
738
|
const agent = agents && typeof agents.get === 'function' ? agents.get(sessionId) : undefined
|
|
739
|
-
if (!agent) return { ok: false, reason: '
|
|
739
|
+
if (!agent) return { ok: false, reason: '这个会话已经不在宿主里了 —— 宿主重启过,或这个会话被关掉了;面板里刷新一下,还在就重建这条主理鱼' }
|
|
740
740
|
|
|
741
741
|
const allowed = decideWake(agent.status)
|
|
742
742
|
if (!allowed.ok) return allowed
|
|
@@ -765,7 +765,7 @@ function wake(ctx, sessionId, text) {
|
|
|
765
765
|
inbox.append('next-turn', message)
|
|
766
766
|
return { ok: true, via: 'inbox.append' }
|
|
767
767
|
}
|
|
768
|
-
return { ok: false, reason: '
|
|
768
|
+
return { ok: false, reason: '宿主没给这个会话提供投递入口(followup / steer / inbox 都没有)—— 换个宿主版本,或直接在会话里 @ 它' }
|
|
769
769
|
} catch (error) {
|
|
770
770
|
return { ok: false, reason: `throw: ${String((error && error.message) || error)}` }
|
|
771
771
|
}
|
package/lib/watch.js
CHANGED
|
@@ -77,7 +77,9 @@ export function recordReported(state, fresh, now = Date.now()) {
|
|
|
77
77
|
*/
|
|
78
78
|
export function decideWake(status) {
|
|
79
79
|
if (!status) return { ok: true }
|
|
80
|
-
|
|
80
|
+
// 审核 T33 M3:reason 会直接进面板/诊断/唤醒记录 —— 以前是英文内部话,客户读不懂。
|
|
81
|
+
// 这里保留英文状态值(便于排查),但整条话说成客户能懂的:现在是「忙」,不是「坏了」。
|
|
82
|
+
if (status !== 'idle') return { ok: false, reason: '会话正忙(agent busy: ' + status + ')—— 等它空闲,这轮会自动顺延' }
|
|
81
83
|
return { ok: true }
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -1236,7 +1238,10 @@ export function planWakeSettlement(entry, { ok, reason, fresh = [], firstSync =
|
|
|
1236
1238
|
lastDeferred: busy ? '会话正忙,下一轮重试' : (entry.lastDeferred || null),
|
|
1237
1239
|
bumpBackoff: !busy,
|
|
1238
1240
|
baseMs,
|
|
1239
|
-
|
|
1241
|
+
// 审核 T33 M3:以前是 `wake failed: session not live` —— 英文内部话,而且面板会把它
|
|
1242
|
+
// 显示成「轮询失败」(归错类:轮询其实成功了,失败的是唤醒)。
|
|
1243
|
+
// 加 `wake:` 前缀让下游能区分两类;reason 本身已经是客户能看懂的中文。
|
|
1244
|
+
error: 'wake: ' + String(reason || ''),
|
|
1240
1245
|
}
|
|
1241
1246
|
}
|
|
1242
1247
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.239",
|
|
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",
|