dsh-session-superagent 0.9.235 → 0.9.238
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 +123 -0
- package/README.md +3 -3
- package/client.js +8 -2
- package/lib/index.js +45 -12
- package/lib/watch.js +11 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,129 @@
|
|
|
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.238] - 2026-11-05 —— 「轮询失败」这个标签用错了地方
|
|
6
|
+
|
|
7
|
+
### M3 · 唤醒失败被说成「轮询失败」
|
|
8
|
+
|
|
9
|
+
面板显示:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
a/b 轮询失败:wake failed: session not live
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
三处都不对:
|
|
16
|
+
|
|
17
|
+
- **归错类** —— 轮询其实**成功了**(正常拉到数据、正常判断、正常决定叫醒),失败的是「叫醒」这一步;
|
|
18
|
+
- **英文内部话** —— `session not live`、`no followup/steer/inbox on agent`、`agent busy (running)`、`merged empty`;
|
|
19
|
+
- **没有下一步** —— 客户不知道该干什么。
|
|
20
|
+
|
|
21
|
+
客户看到「轮询失败」会去查网络、查 token —— 而真正的问题是宿主重启过、会话不在了。
|
|
22
|
+
|
|
23
|
+
### 改法
|
|
24
|
+
|
|
25
|
+
失败原因全部改成「现象 + 下一步」的中文(保留英文状态值便于排查):
|
|
26
|
+
|
|
27
|
+
| 以前 | 现在 |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `session not live` | 这个会话已经不在宿主里了 —— 宿主重启过,或这个会话被关掉了;面板里刷新一下,还在就重建这条主理鱼 |
|
|
30
|
+
| `agent busy (running)` | 会话正忙(agent busy: running)—— 等它空闲,这轮会自动顺延 |
|
|
31
|
+
| `no followup/steer/inbox on agent` | 宿主没给这个会话提供投递入口 —— 换个宿主版本,或直接在会话里 @ 它 |
|
|
32
|
+
| `merged empty` | 合并后没有内容可发(这几条都已被处理过)—— 不用管,下一轮会重新判断 |
|
|
33
|
+
|
|
34
|
+
错误文本加了 `wake:` 前缀,面板据此分开显示**「唤醒失败」**与**「轮询失败」**。
|
|
35
|
+
|
|
36
|
+
### 证据
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
npm test → 380/380(新增:唤醒原因要有中文 + 下一步 + 保留英文状态值)
|
|
40
|
+
ui-audit → 11/11(100 分)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## [0.9.237] - 2026-11-05 —— 剩下的错误文案:`undefined`、切掉建议、英文内部话
|
|
44
|
+
|
|
45
|
+
T33 一共给了 6 条必须修,0.9.236 修了前两条(假报错 / 丢下一步),这次是后四条。
|
|
46
|
+
|
|
47
|
+
### M4 推断仓库失败时把 `undefined` 当仓库名
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
[error: 仓库要写成 owner/name 或 gitee:owner/name,这些不对:undefined]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
空值现在显示成「(空)」,客户知道是「没填/没推断出来」,而不是看到一个编程符号。
|
|
54
|
+
|
|
55
|
+
### M5 `/diagnose` 把建议切掉了
|
|
56
|
+
|
|
57
|
+
`slice(0, 160)` —— 现象 180 字就把后面括号里的**下一步整段切没**。而项目约定是「建议必须完整」。
|
|
58
|
+
|
|
59
|
+
现在现象截 120、下一步完整保留。
|
|
60
|
+
|
|
61
|
+
### M6 HTTP 错误体直接当客户文案
|
|
62
|
+
|
|
63
|
+
面板 toast 里出现过 `watcher is paused` / `already polling` / `unknown watcher: a/b#s1` ——
|
|
64
|
+
英文、带内部 id、且没有下一步。三处改成中文 + 下一步:
|
|
65
|
+
|
|
66
|
+
| 以前 | 现在 |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `unknown watcher: a/b#s1` | 没有这条主理鱼(…)—— 刷新面板看看它还在不在;可能是别的窗口刚删掉 |
|
|
69
|
+
| `watcher is paused` | 这条主理鱼是暂停状态,先点「恢复」再试 |
|
|
70
|
+
| `already polling` | 上一轮轮询还没结束(网络慢或 GitHub 慢)—— 等十几秒再看 |
|
|
71
|
+
|
|
72
|
+
另外补了 `code` 字段,前端以后想按类型分支不用去匹配中文。
|
|
73
|
+
|
|
74
|
+
### 顺带修了一个我自己引入的 bug
|
|
75
|
+
|
|
76
|
+
`statusView` 里用了 `classifyGhError` 但没 import(它只在 `export { … } from` 的重导出里)——
|
|
77
|
+
`measure-state` 直接抛 `ReferenceError`,被「面板请求体积」门禁抓到。
|
|
78
|
+
|
|
79
|
+
### 证据
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
npm test → 379/379
|
|
83
|
+
ui-audit → 11/11(100 分)
|
|
84
|
+
面板请求体积 → 20 条守 38.6 KB ≤ 50 KB
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## [0.9.236] - 2026-11-05 —— 「number is required」是句假话
|
|
88
|
+
|
|
89
|
+
### ① 编号明明给了,报错说「没给」
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
rawNumber = '#14' // 从 issue 页面直接复制的形状
|
|
93
|
+
/^[A-Za-z0-9_-]+$/.test('#14') === false
|
|
94
|
+
→ '[error: number is required]' // ← 假话
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
模型唯一合理的推断是「我漏传了」→ **原样再传一次 `#14`** → 拿到同一句报错 → 死循环重试或转头问客户「你要处理哪个编号」。
|
|
98
|
+
|
|
99
|
+
而客户刚把编号给它。
|
|
100
|
+
|
|
101
|
+
**这条尤其贵**:`watch_ack` 是每条主理任务的**最后一步**(不打标签,下一轮还会叫醒)——
|
|
102
|
+
一次假报错就等于这条 issue **永远关不掉**。
|
|
103
|
+
|
|
104
|
+
改成说真话:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
[error: 编号要写成 14,不要带 # 号(收到的是「#14」)—— 去掉 # 再试一次]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### ② `watch_status` 把「下一步」整段切掉了
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
String(w.lastError).split('(')[0] // 不是截断,是**丢掉括号及其后全部内容**
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
而按项目约定(`docs/kb/error-must-have-next-step.md`),**下一步恒在末尾括号里**。
|
|
117
|
+
于是同一条 401:面板给「现象 + 建议 + 去填 token 按钮」,`watch_status` 只给现象 —— 模型**有现象、没动作**。
|
|
118
|
+
|
|
119
|
+
现在现象截断、下一步完整保留。另外 `statusView()` 补了 `lastErrorKind`(与 `/state` 同源),
|
|
120
|
+
模型可以像面板那样按 kind 选动作,不用读中文猜。
|
|
121
|
+
|
|
122
|
+
### 证据
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
npm test → 379/379(新增:编号带 # 时不能说「没给」)
|
|
126
|
+
```
|
|
127
|
+
|
|
5
128
|
## [0.9.235] - 2026-11-05 —— 时段写错会静默变成「全天有效」
|
|
6
129
|
|
|
7
130
|
### ① `activeHours` 格式不对时静默失效
|
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 # 380 项单测(带离线开关;裸 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 # 380 项单测(带离线开关,约 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.238'
|
|
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),
|
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.238'
|
|
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
|
}
|
|
@@ -1905,9 +1905,9 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
1905
1905
|
// 不等定时器,马上轮询一次;仍然受 filters / ack 标签约束。
|
|
1906
1906
|
if (action === 'poll') {
|
|
1907
1907
|
const entry = state.watchers && state.watchers[id]
|
|
1908
|
-
if (!entry) return json(res, 404, { error: '
|
|
1909
|
-
if (!isEnabled(entry)) return json(res, 409, { error: '
|
|
1910
|
-
if (inFlight.has(id)) return json(res, 409, { error: '
|
|
1908
|
+
if (!entry) return json(res, 404, { error: '没有这条主理鱼(' + id + ')—— 刷新面板看看它还在不在;可能是别的窗口刚删掉', code: 'unknown_watcher' })
|
|
1909
|
+
if (!isEnabled(entry)) return json(res, 409, { error: '这条主理鱼是暂停状态,先点「恢复」再试', code: 'paused' })
|
|
1910
|
+
if (inFlight.has(id)) return json(res, 409, { error: '上一轮轮询还没结束(网络慢或 GitHub 慢)—— 等十几秒再看', code: 'in_flight', id })
|
|
1911
1911
|
const every = Math.max(30, Number(entry.intervalSec) || 60) * 1000
|
|
1912
1912
|
inFlight.add(id)
|
|
1913
1913
|
pollOnce(ctx, entry, every)
|
|
@@ -2115,7 +2115,17 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2115
2115
|
+ ' | 会话 ' + String(entry.sessionId || '').slice(0, 20)
|
|
2116
2116
|
+ ' | 上次轮询 ' + String(entry.lastPoll || '-')
|
|
2117
2117
|
+ ' | 失败 ' + (entry.consecutiveFailures || 0)
|
|
2118
|
-
|
|
2118
|
+
// 审核 T33 M5:`slice(0,160)` 会把现象之后的**建议整段切掉** ——
|
|
2119
|
+
// 而项目约定(KB error-must-have-next-step)要求「建议必须完整」。
|
|
2120
|
+
// 现在现象截 120,括号里的下一步**完整保留**(最多再兜 200 字)。
|
|
2121
|
+
+ (entry.lastError ? ' | 错误: ' + (() => {
|
|
2122
|
+
const full = String(entry.lastError)
|
|
2123
|
+
const cut = full.indexOf('(')
|
|
2124
|
+
if (cut < 0) return full.slice(0, 160)
|
|
2125
|
+
const main = full.slice(0, cut).slice(0, 120)
|
|
2126
|
+
const hint = full.slice(cut).slice(0, 200)
|
|
2127
|
+
return main + hint
|
|
2128
|
+
})() : ''))
|
|
2119
2129
|
}
|
|
2120
2130
|
const text = redact(lines.join(String.fromCharCode(10)))
|
|
2121
2131
|
json(res, 200, { ok: true, text })
|
|
@@ -2302,7 +2312,13 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2302
2312
|
.split(',')
|
|
2303
2313
|
.map((v) => v.trim())
|
|
2304
2314
|
.filter((v) => /^[A-Za-z0-9_-]+$/.test(v))
|
|
2305
|
-
if (numbers.length === 0)
|
|
2315
|
+
if (numbers.length === 0) {
|
|
2316
|
+
// 审核 T33 M1:同上 —— 给了 `#14` 却报「必填」,是假话。
|
|
2317
|
+
const given = String(args.numbers || args.number || '').trim()
|
|
2318
|
+
return toolError(args, given
|
|
2319
|
+
? '编号要写成 14 或 12,13,不要带 # 号(收到的是「' + given + '」)—— 去掉 # 再试一次'
|
|
2320
|
+
: 'number (or numbers) is required(例如 14,或 12,13)')
|
|
2321
|
+
}
|
|
2306
2322
|
const state = readState()
|
|
2307
2323
|
const watchers = Object.values(state.watchers || {})
|
|
2308
2324
|
const entry = args.repo
|
|
@@ -2405,7 +2421,12 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2405
2421
|
// 统一转成字符串再比 —— 以前这里 Number('IKSQJH') = NaN,Gitee 的条目永远查不到。
|
|
2406
2422
|
const rawNumber = args.number == null ? '' : String(args.number).trim()
|
|
2407
2423
|
if (!/^[A-Za-z0-9_-]+$/.test(rawNumber)) {
|
|
2408
|
-
|
|
2424
|
+
// 审核 T33 M1:编号**给了**就别说「没给」—— `#14` 是从 issue 页面直接复制的形状。
|
|
2425
|
+
// 说「没给」会让模型原样再传一次,拿到同一句报错,然后死循环或转头问客户。
|
|
2426
|
+
const why = rawNumber
|
|
2427
|
+
? '编号要写成 14,不要带 # 号(收到的是「' + rawNumber + '」)—— 去掉 # 再试一次'
|
|
2428
|
+
: 'number is required(例如 14;Gitee 的编号是 IKSQJH 这种字符串)'
|
|
2429
|
+
return toolError(args, why)
|
|
2409
2430
|
}
|
|
2410
2431
|
const number = rawNumber
|
|
2411
2432
|
const lines = []
|
|
@@ -2720,7 +2741,11 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2720
2741
|
// 否则工具建出来的守没有 provider,Gitee 仓库会被当 GitHub 轮询,每轮 404。
|
|
2721
2742
|
const parsedSpecs = String(repo).split(/[,\s]+/).map((item) => item.trim()).filter(Boolean).map((item) => ({ item, spec: parseRepoSpec(item) }))
|
|
2722
2743
|
const bad = parsedSpecs.filter(({ spec }) => !spec.ok).map(({ item }) => item)
|
|
2723
|
-
if (bad.length > 0)
|
|
2744
|
+
if (bad.length > 0) {
|
|
2745
|
+
// 审核 T33 M4:以前坏值里可能混进 `undefined`(推断失败时),客户看到「这些不对:undefined」。
|
|
2746
|
+
const shown = bad.map((v) => (v === undefined || v === null || String(v).trim() === '' ? '(空)' : String(v))).join(', ')
|
|
2747
|
+
return toolError(args, '仓库要写成 owner/name 或 gitee:owner/name,这些不对:' + shown)
|
|
2748
|
+
}
|
|
2724
2749
|
if (parsedSpecs.length === 0) return toolError(args, '至少给一个仓库(owner/name)')
|
|
2725
2750
|
const repoList = parsedSpecs.map(({ item, spec }) => ({ repo: spec.repo, provider: spec.provider, label: item }))
|
|
2726
2751
|
const applyOne = ({ repo, provider }) => {
|
|
@@ -2865,7 +2890,15 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2865
2890
|
const problems = []
|
|
2866
2891
|
if (w.deferReason) problems.push('暂停:' + w.deferReason)
|
|
2867
2892
|
if (w.silentWakes >= 2) problems.push('叫醒 ' + w.silentWakes + ' 次没回音')
|
|
2868
|
-
|
|
2893
|
+
// 审核 T33 M2:`split('(')[0]` 不是截断,是把**括号及其后的下一步全部丢掉** ——
|
|
2894
|
+
// 而按项目的约定,下一步恒在末尾括号里。模型于是「有现象、没动作」。
|
|
2895
|
+
if (w.lastError) {
|
|
2896
|
+
const full = String(w.lastError)
|
|
2897
|
+
const cut = full.indexOf('(')
|
|
2898
|
+
const main = (cut >= 0 ? full.slice(0, cut) : full).slice(0, 60)
|
|
2899
|
+
const hint = cut >= 0 ? full.slice(cut) : ''
|
|
2900
|
+
problems.push('上次失败:' + main + hint)
|
|
2901
|
+
}
|
|
2869
2902
|
if (w.enabled && w.lastPoll) {
|
|
2870
2903
|
const age = Date.now() - Date.parse(w.lastPoll)
|
|
2871
2904
|
if (Number.isFinite(age) && age > Math.max(w.intervalSec * 3000, 300000)) {
|
package/lib/watch.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Kept separate so the behaviour that matters (what counts as news, when a wake
|
|
5
5
|
* is allowed, what the wake text says) is unit-testable without a DSH host.
|
|
6
6
|
*/
|
|
7
|
-
import { repoBadges } from './gh-format.js'
|
|
7
|
+
import { repoBadges, classifyGhError } from './gh-format.js'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Split items into "report now" and "absorb silently".
|
|
@@ -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
|
|
|
@@ -1105,6 +1107,9 @@ export function statusView(entries, options = {}) {
|
|
|
1105
1107
|
lastPoll: w.lastPoll || null,
|
|
1106
1108
|
lastWake: w.lastWake || null,
|
|
1107
1109
|
lastError: w.lastError || null,
|
|
1110
|
+
// 审核 T33 M2:`/state` 早就有 kind,`watch_status` 没有 —— 模型无法像面板那样按 kind 选动作。
|
|
1111
|
+
// 同源判定,避免两处各写一份。
|
|
1112
|
+
lastErrorKind: w.lastError ? classifyGhError(String(w.lastError)).kind : null,
|
|
1108
1113
|
})),
|
|
1109
1114
|
}
|
|
1110
1115
|
}
|
|
@@ -1233,7 +1238,10 @@ export function planWakeSettlement(entry, { ok, reason, fresh = [], firstSync =
|
|
|
1233
1238
|
lastDeferred: busy ? '会话正忙,下一轮重试' : (entry.lastDeferred || null),
|
|
1234
1239
|
bumpBackoff: !busy,
|
|
1235
1240
|
baseMs,
|
|
1236
|
-
|
|
1241
|
+
// 审核 T33 M3:以前是 `wake failed: session not live` —— 英文内部话,而且面板会把它
|
|
1242
|
+
// 显示成「轮询失败」(归错类:轮询其实成功了,失败的是唤醒)。
|
|
1243
|
+
// 加 `wake:` 前缀让下游能区分两类;reason 本身已经是客户能看懂的中文。
|
|
1244
|
+
error: 'wake: ' + String(reason || ''),
|
|
1237
1245
|
}
|
|
1238
1246
|
}
|
|
1239
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.238",
|
|
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",
|