dsh-session-superagent 0.9.128 → 0.9.130
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 +56 -0
- package/README.md +2 -2
- package/client.js +1 -1
- package/lib/gh-format.js +3 -1
- package/lib/index.js +17 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,62 @@
|
|
|
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.130] - 2026-11-03 —— 重启后真机复验:新代码生效了,但"暂停的守还挂着旧错误"
|
|
6
|
+
|
|
7
|
+
### 真机复验(重启后)
|
|
8
|
+
```
|
|
9
|
+
GET /state → serverVersion 0.9.129
|
|
10
|
+
defaults: { sessionMaxWakes: 12, maxWakesPerHour: 6, isolateKeepDays: 3 }
|
|
11
|
+
retryPolicy: { budgetAttempts: 6, slowCapMinutes: 120 }
|
|
12
|
+
```
|
|
13
|
+
说明 0.9.12x 的新字段与短路逻辑都已上线。`gh auth status` 也已恢复正常(`✓ Logged in`),
|
|
14
|
+
`gh api repos/MYCF711/dsh-go` 返回正常。
|
|
15
|
+
|
|
16
|
+
启用的那条守在 07:02:50Z 完成了一轮成功轮询:`lastError` 已清空、`nextAt` 归 null。
|
|
17
|
+
|
|
18
|
+
**但另一条(已暂停,来自更早的会话)仍然挂着**:
|
|
19
|
+
`lastError: 返回内容不是合法 JSON(可能是代理干扰)` + `consecutiveFailures: 1`。
|
|
20
|
+
|
|
21
|
+
### 根因
|
|
22
|
+
0.9.111 只在**暂停动作发生时**清错误。这条守是在那之前就暂停的,所以旧错误一直冻在状态文件里 ——
|
|
23
|
+
面板上永远显示「异常」,而它其实只是"停着"。
|
|
24
|
+
|
|
25
|
+
### 改法
|
|
26
|
+
`normalizePaused()`:`readState()` 读出来时,对 `enabled === false` 的条目清掉
|
|
27
|
+
`lastError` / `lastErrorAt` / `consecutiveFailures` / `needsReauth`(幂等、无副作用,下次写盘自然带走)。
|
|
28
|
+
|
|
29
|
+
### 测试
|
|
30
|
+
新增 1 例:手写一份"老版本留下的(暂停 + 旧错误)"状态,读出来后错误为空。合计 **245 例**。
|
|
31
|
+
|
|
32
|
+
## [0.9.129] - 2026-11-03 —— Windows 上找不到 gh 会说"不是命令",我们原来不认
|
|
33
|
+
|
|
34
|
+
### 学到什么(出处)
|
|
35
|
+
Node 的错误页把系统级错误码(`ENOENT`、`EACCES`…)列成一张表,指出**同一个失败在不同平台上措辞不同**:
|
|
36
|
+
|
|
37
|
+
> Common system errors … `ENOENT` (No such file or directory) …
|
|
38
|
+
|
|
39
|
+
<https://nodejs.org/api/errors.html#common-system-errors>
|
|
40
|
+
|
|
41
|
+
我们的 `classifyGhError` 只认 `ENOENT` / `gh: command not found`,**不认 Windows cmd 的措辞**:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
spawn gh ENOENT → nogh ✅
|
|
45
|
+
gh: command not found → nogh ✅
|
|
46
|
+
'gh' is not recognized as an internal or external ... → other ❌(提示"没归类的错误")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
也就是说:Windows 客户没装 gh 时,看到的是"没归类的错误",而不是"找不到 gh:确认已安装且在 PATH"。
|
|
50
|
+
|
|
51
|
+
### 改法
|
|
52
|
+
1. `classifyGhError` 认全三种措辞(补 `not recognized as an internal or external command`);
|
|
53
|
+
2. 顺手把 `watch_doctor` 里写死的「最多每 **2 小时**一次」改成从 `RETRY_SLOW_CAP_MINUTES` 算 ——
|
|
54
|
+
上一轮立的规矩(数字要能指回来源)还没覆盖到 `lib/` 自己的中文提示。
|
|
55
|
+
|
|
56
|
+
### 测试
|
|
57
|
+
- 新增 1 例:三种措辞都归 `nogh` 且提示指向 PATH;
|
|
58
|
+
- 更新 1 例:doctor 的"X 小时"改为按常量断言(常量改了用例自动跟随)。
|
|
59
|
+
合计 **244 例**。
|
|
60
|
+
|
|
5
61
|
## [0.9.128] - 2026-11-03 —— 面板上写死的四个数字,各自绑到真实来源
|
|
6
62
|
|
|
7
63
|
### 学到什么(出处)
|
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
|
|
|
@@ -123,7 +123,7 @@ dsh plugin install /path/to/dsh-session-superagent
|
|
|
123
123
|
## 开发
|
|
124
124
|
|
|
125
125
|
```sh
|
|
126
|
-
node --test #
|
|
126
|
+
node --test # 245 项单测
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
### 工具输出:文本给人和 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.
|
|
17
|
+
const CLIENT_VERSION = '0.9.130'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
package/lib/gh-format.js
CHANGED
|
@@ -66,7 +66,9 @@ export function classifyGhError(detail) {
|
|
|
66
66
|
if (/HTTP 50[0234]|Bad Gateway|Service Unavailable|Gateway Time-?out/i.test(text)) {
|
|
67
67
|
return { kind: 'gateway', short, hint: '(GitHub 或本地代理短暂故障:已按退避自动重试,不需要手动处理;持续出现就检查代理)' }
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
// Windows 的 cmd 报法不一样:'gh' is not recognized as an internal or external command
|
|
70
|
+
// 出处(Node 的错误码语义):https://nodejs.org/api/errors.html#common-system-errors
|
|
71
|
+
if (/ENOENT|not found.*gh|gh: command not found|not recognized as an internal or external command/i.test(text)) {
|
|
70
72
|
return { kind: 'nogh', short, hint: '(找不到 gh 命令:确认已安装且在 PATH)' }
|
|
71
73
|
}
|
|
72
74
|
// 条件请求命中:gh 把 304 当失败(非 2xx 就 exit 1),但语义是「没有变化」,不是错误
|
package/lib/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
|
|
41
41
|
export const name = 'dsh-session-superagent'
|
|
42
42
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
43
|
-
export const SERVER_VERSION = '0.9.
|
|
43
|
+
export const SERVER_VERSION = '0.9.130'
|
|
44
44
|
export const inject = ['tools', 'agents', 'webServer']
|
|
45
45
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
46
46
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -121,12 +121,14 @@ function readState() {
|
|
|
121
121
|
}
|
|
122
122
|
try {
|
|
123
123
|
const parsed = JSON.parse(raw)
|
|
124
|
+
for (const entry of Object.values(parsed.watchers || {})) normalizePaused(entry)
|
|
124
125
|
stateSource = 'ok'
|
|
125
126
|
return parsed
|
|
126
127
|
} catch {
|
|
127
128
|
// 主文件坏了:试试备份
|
|
128
129
|
try {
|
|
129
130
|
const backup = JSON.parse(readFileSync(STATE_FILE + '.bak', 'utf8'))
|
|
131
|
+
for (const entry of Object.values(backup.watchers || {})) normalizePaused(entry)
|
|
130
132
|
stateSource = 'backup'
|
|
131
133
|
// 把备份写回主文件,避免下次还走恢复路径
|
|
132
134
|
try { writeFileSync(STATE_FILE, JSON.stringify(backup, null, 2)) } catch {}
|
|
@@ -140,6 +142,19 @@ function readState() {
|
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
144
|
|
|
145
|
+
// 暂停的守不再轮询,它的 lastError 就不是「现在」的事实了。
|
|
146
|
+
// 真机现场:一条停在旧版本暂停的守,重启后仍显示「异常」,红点一直在。
|
|
147
|
+
// 依据同 KB paused-means-no-new-facts.md。读取时顺手归一,写盘时自然带走。
|
|
148
|
+
function normalizePaused(entry) {
|
|
149
|
+
if (!entry || entry.enabled !== false) return entry
|
|
150
|
+
if (entry.lastError || entry.lastErrorAt || entry.consecutiveFailures) {
|
|
151
|
+
entry.lastError = null
|
|
152
|
+
entry.lastErrorAt = null
|
|
153
|
+
entry.consecutiveFailures = 0
|
|
154
|
+
entry.needsReauth = false
|
|
155
|
+
}
|
|
156
|
+
return entry
|
|
157
|
+
}
|
|
143
158
|
function writeState(state) {
|
|
144
159
|
try {
|
|
145
160
|
mkdirSync(STATE_DIR, { recursive: true })
|
|
@@ -2110,7 +2125,7 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2110
2125
|
}
|
|
2111
2126
|
// 连续失败很多次时间隔已被拉长(retry budget):要解释清楚,别让人以为又卡住了
|
|
2112
2127
|
if (Number(entry.consecutiveFailures) >= 6) {
|
|
2113
|
-
lines.push(`INFO ${entry.repo} 已连续失败 ${entry.consecutiveFailures} 次,重试间隔已放慢到最多每
|
|
2128
|
+
lines.push(`INFO ${entry.repo} 已连续失败 ${entry.consecutiveFailures} 次,重试间隔已放慢到最多每 ${RETRY_SLOW_CAP_MINUTES / 60} 小时一次`)
|
|
2114
2129
|
}
|
|
2115
2130
|
}
|
|
2116
2131
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.130",
|
|
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",
|