dsh-session-superagent 0.9.235 → 0.9.237
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 +85 -0
- package/README.md +3 -3
- package/client.js +1 -1
- package/lib/index.js +42 -9
- package/lib/watch.js +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,91 @@
|
|
|
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.237] - 2026-11-05 —— 剩下的错误文案:`undefined`、切掉建议、英文内部话
|
|
6
|
+
|
|
7
|
+
T33 一共给了 6 条必须修,0.9.236 修了前两条(假报错 / 丢下一步),这次是后四条。
|
|
8
|
+
|
|
9
|
+
### M4 推断仓库失败时把 `undefined` 当仓库名
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
[error: 仓库要写成 owner/name 或 gitee:owner/name,这些不对:undefined]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
空值现在显示成「(空)」,客户知道是「没填/没推断出来」,而不是看到一个编程符号。
|
|
16
|
+
|
|
17
|
+
### M5 `/diagnose` 把建议切掉了
|
|
18
|
+
|
|
19
|
+
`slice(0, 160)` —— 现象 180 字就把后面括号里的**下一步整段切没**。而项目约定是「建议必须完整」。
|
|
20
|
+
|
|
21
|
+
现在现象截 120、下一步完整保留。
|
|
22
|
+
|
|
23
|
+
### M6 HTTP 错误体直接当客户文案
|
|
24
|
+
|
|
25
|
+
面板 toast 里出现过 `watcher is paused` / `already polling` / `unknown watcher: a/b#s1` ——
|
|
26
|
+
英文、带内部 id、且没有下一步。三处改成中文 + 下一步:
|
|
27
|
+
|
|
28
|
+
| 以前 | 现在 |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `unknown watcher: a/b#s1` | 没有这条主理鱼(…)—— 刷新面板看看它还在不在;可能是别的窗口刚删掉 |
|
|
31
|
+
| `watcher is paused` | 这条主理鱼是暂停状态,先点「恢复」再试 |
|
|
32
|
+
| `already polling` | 上一轮轮询还没结束(网络慢或 GitHub 慢)—— 等十几秒再看 |
|
|
33
|
+
|
|
34
|
+
另外补了 `code` 字段,前端以后想按类型分支不用去匹配中文。
|
|
35
|
+
|
|
36
|
+
### 顺带修了一个我自己引入的 bug
|
|
37
|
+
|
|
38
|
+
`statusView` 里用了 `classifyGhError` 但没 import(它只在 `export { … } from` 的重导出里)——
|
|
39
|
+
`measure-state` 直接抛 `ReferenceError`,被「面板请求体积」门禁抓到。
|
|
40
|
+
|
|
41
|
+
### 证据
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
npm test → 379/379
|
|
45
|
+
ui-audit → 11/11(100 分)
|
|
46
|
+
面板请求体积 → 20 条守 38.6 KB ≤ 50 KB
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## [0.9.236] - 2026-11-05 —— 「number is required」是句假话
|
|
50
|
+
|
|
51
|
+
### ① 编号明明给了,报错说「没给」
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
rawNumber = '#14' // 从 issue 页面直接复制的形状
|
|
55
|
+
/^[A-Za-z0-9_-]+$/.test('#14') === false
|
|
56
|
+
→ '[error: number is required]' // ← 假话
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
模型唯一合理的推断是「我漏传了」→ **原样再传一次 `#14`** → 拿到同一句报错 → 死循环重试或转头问客户「你要处理哪个编号」。
|
|
60
|
+
|
|
61
|
+
而客户刚把编号给它。
|
|
62
|
+
|
|
63
|
+
**这条尤其贵**:`watch_ack` 是每条主理任务的**最后一步**(不打标签,下一轮还会叫醒)——
|
|
64
|
+
一次假报错就等于这条 issue **永远关不掉**。
|
|
65
|
+
|
|
66
|
+
改成说真话:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
[error: 编号要写成 14,不要带 # 号(收到的是「#14」)—— 去掉 # 再试一次]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### ② `watch_status` 把「下一步」整段切掉了
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
String(w.lastError).split('(')[0] // 不是截断,是**丢掉括号及其后全部内容**
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
而按项目约定(`docs/kb/error-must-have-next-step.md`),**下一步恒在末尾括号里**。
|
|
79
|
+
于是同一条 401:面板给「现象 + 建议 + 去填 token 按钮」,`watch_status` 只给现象 —— 模型**有现象、没动作**。
|
|
80
|
+
|
|
81
|
+
现在现象截断、下一步完整保留。另外 `statusView()` 补了 `lastErrorKind`(与 `/state` 同源),
|
|
82
|
+
模型可以像面板那样按 kind 选动作,不用读中文猜。
|
|
83
|
+
|
|
84
|
+
### 证据
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
npm test → 379/379(新增:编号带 # 时不能说「没给」)
|
|
88
|
+
```
|
|
89
|
+
|
|
5
90
|
## [0.9.235] - 2026-11-05 —— 时段写错会静默变成「全天有效」
|
|
6
91
|
|
|
7
92
|
### ① `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 # 379 项单测(带离线开关;裸 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 # 379 项单测(带离线开关,约 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.237'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
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.237'
|
|
48
48
|
export const inject = ['tools', 'agents', 'webServer']
|
|
49
49
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
50
50
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -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".
|
|
@@ -1105,6 +1105,9 @@ export function statusView(entries, options = {}) {
|
|
|
1105
1105
|
lastPoll: w.lastPoll || null,
|
|
1106
1106
|
lastWake: w.lastWake || null,
|
|
1107
1107
|
lastError: w.lastError || null,
|
|
1108
|
+
// 审核 T33 M2:`/state` 早就有 kind,`watch_status` 没有 —— 模型无法像面板那样按 kind 选动作。
|
|
1109
|
+
// 同源判定,避免两处各写一份。
|
|
1110
|
+
lastErrorKind: w.lastError ? classifyGhError(String(w.lastError)).kind : null,
|
|
1108
1111
|
})),
|
|
1109
1112
|
}
|
|
1110
1113
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.237",
|
|
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",
|