dsh-session-superagent 0.8.95 → 0.8.97
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 +55 -0
- package/README.md +2 -2
- package/client.js +23 -2
- package/lib/gh-format.js +5 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,61 @@
|
|
|
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.8.97] - 2026-11-02 —— 错误提示要回答"我该做什么"
|
|
6
|
+
|
|
7
|
+
### 学到的(知识库第 46 条)
|
|
8
|
+
NN/g《Error-Message Guidelines》:用平实语言说明问题**并给出建设性解决方案**,不要只显示系统错误码。
|
|
9
|
+
<https://www.nngroup.com/articles/error-message-guidelines/>
|
|
10
|
+
|
|
11
|
+
### 拿真机见过的 12 条错误串去测,只命中 8 条
|
|
12
|
+
```
|
|
13
|
+
other | (无提示)| error: unable to get local issuer certificate
|
|
14
|
+
other | (无提示)| HTTP 502 Bad Gateway
|
|
15
|
+
other | (无提示)| repository "o/r" not found
|
|
16
|
+
other | (无提示)| context deadline exceeded
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 补齐到 12/12
|
|
20
|
+
- `notfound`:补 `repository "x" not found` 这类(但不能把 `command not found` 误判进来);
|
|
21
|
+
- `network`:补证书 / `context deadline exceeded` / x509;
|
|
22
|
+
- 新增 `gateway`:GitHub 或本地代理短暂故障 —— 这类最容易被误当成"我的仓库有问题"。
|
|
23
|
+
|
|
24
|
+
### 面板自己的错误也要人话
|
|
25
|
+
面板拉自己接口失败**不经过**上面那套,以前直接显示 `Failed to fetch`。
|
|
26
|
+
现在:连不上宿主 / 5xx / 404 / 超时 各有对应说明 + 动作(去诊断、重启、或"会自动重试不用管")。
|
|
27
|
+
|
|
28
|
+
### 测试
|
|
29
|
+
- 新增 2 例(12 种错误的归类与 hint、面板 `Failed to fetch` 必须翻译且提到「诊断」)。合计 **140 例**。
|
|
30
|
+
|
|
31
|
+
## [0.8.96] - 2026-11-02 —— index.js 量完不拆;顺手加文档体检
|
|
32
|
+
|
|
33
|
+
### 一、为什么**不**拆 index.js(知识库第 45 条)
|
|
34
|
+
用拆 watch.js 的同一套方法量化:
|
|
35
|
+
```
|
|
36
|
+
基建区 1000 行 / 注册区 796 行
|
|
37
|
+
注册区用到的基建名字:25 个(占 46 个定义)
|
|
38
|
+
每条路由平均跨度:53 行
|
|
39
|
+
```
|
|
40
|
+
对比 watch.js 那次是**零依赖单向关系**,这边是 25 个共享符号 ——
|
|
41
|
+
拆开等于给每条路由传一大包依赖或造"上帝对象",复杂度从一维变两维。
|
|
42
|
+
它已是"上基建、下注册"的纵向结构,**不拆**。
|
|
43
|
+
|
|
44
|
+
### 二、顺手加的:文档体检
|
|
45
|
+
45+ 篇文档互相引用,写错的链接没人会发现。新增 `scripts/check-docs.mjs`:
|
|
46
|
+
- 扫全部 Markdown,只查仓库内相对链接;
|
|
47
|
+
- 额外查**孤儿文档**(`docs/kb/*.md` 没被索引 = 客户永远看不到)。
|
|
48
|
+
|
|
49
|
+
首跑结果:
|
|
50
|
+
```
|
|
51
|
+
扫描 66 篇 Markdown,63 个内部链接目标
|
|
52
|
+
PASS 所有内部链接都能解析
|
|
53
|
+
PASS 知识库文档全部被索引
|
|
54
|
+
```
|
|
55
|
+
都健康 —— 但**这是运气不是保证**。已接入 preflight(第 10 项)。
|
|
56
|
+
|
|
57
|
+
### 测试
|
|
58
|
+
- 138 例全过;preflight **10 项**全过。
|
|
59
|
+
|
|
5
60
|
## [0.8.95] - 2026-11-02 —— 按「改动轴」拆开 watch.js(883 → 486 行)
|
|
6
61
|
|
|
7
62
|
### 学到的(知识库第 44 条)
|
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
|
|
|
@@ -143,7 +143,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
|
|
|
143
143
|
```bash
|
|
144
144
|
node --test # 103 例单测
|
|
145
145
|
node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
|
|
146
|
-
node scripts/preflight.mjs #
|
|
146
|
+
node scripts/preflight.mjs # 10 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
|
|
147
147
|
node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
|
|
148
148
|
```
|
|
149
149
|
|
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.8.
|
|
17
|
+
const CLIENT_VERSION = '0.8.97'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -1356,6 +1356,27 @@ window.__ModuleLoader__.load({
|
|
|
1356
1356
|
return () => { alive = false }
|
|
1357
1357
|
}, [])
|
|
1358
1358
|
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* 面板自己遇到的错误也要说人话。
|
|
1362
|
+
*
|
|
1363
|
+
* 服务端那边的 gh 错误已经由 classifyGhError 归类(并附了 hint);
|
|
1364
|
+
* 但**面板拉自己接口失败**(宿主正在重启、端口变了、fetch 被拒)不会经过那套,
|
|
1365
|
+
* 以前界面上就是一行 "Failed to fetch" —— 客户看不懂,也不知道要做什么。
|
|
1366
|
+
*/
|
|
1367
|
+
function humanizeError(text) {
|
|
1368
|
+
const raw = String(text == null ? '' : text)
|
|
1369
|
+
if (!raw) return ''
|
|
1370
|
+
if (/Failed to fetch|NetworkError|Load failed/i.test(raw)) {
|
|
1371
|
+
return '连不上宿主:DSH 可能正在重启,或插件刚被重载。稍等几秒会自动重试;一直这样就去「设置 → 诊断」复制信息。'
|
|
1372
|
+
}
|
|
1373
|
+
if (/HTTP 401|HTTP 403/i.test(raw)) return '宿主拒绝了请求(401/403):面板接口可能需要重新挂载,重启宿主即可。'
|
|
1374
|
+
if (/HTTP 5\d\d/.test(raw)) return '宿主内部报错(5xx):先把「设置 → 诊断」里的信息复制出来,再重启宿主试试。'
|
|
1375
|
+
if (/HTTP 404/.test(raw)) return '接口不存在(404):多半还在跑旧版本代码,重启宿主。'
|
|
1376
|
+
if (/timeout|timed out|ETIMEDOUT/i.test(raw)) return '请求超时:宿主可能正忙(比如同时在建隔离 worktree),稍后自动重试。'
|
|
1377
|
+
return raw
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1359
1380
|
/** 仓库能力徽章(与服务端 watch.js:repoBadges 同语义)。 */
|
|
1360
1381
|
function repoBadges(access) {
|
|
1361
1382
|
if (!access || typeof access !== 'object') return []
|
|
@@ -1428,7 +1449,7 @@ window.__ModuleLoader__.load({
|
|
|
1428
1449
|
h('a', { className: 'dt-btn dt-btn-sm dt-btn-outline', href: '#', onClick: (e) => { e.preventDefault(); setTab('settings') } }, '看升级命令'))
|
|
1429
1450
|
: null,
|
|
1430
1451
|
toastView,
|
|
1431
|
-
snap.error ? h('div', { className: 'dt-banner dt-danger' }, '读取失败:' + snap.error) : null,
|
|
1452
|
+
snap.error ? h('div', { className: 'dt-banner dt-danger' }, '读取失败:' + humanizeError(snap.error)) : null,
|
|
1432
1453
|
snap.loading && !snap.body ? h(Hint, null, '正在读取…') : null,
|
|
1433
1454
|
tab === 'overview' ? overview : null,
|
|
1434
1455
|
tab === 'judge' ? judge : null,
|
package/lib/gh-format.js
CHANGED
|
@@ -20,13 +20,16 @@ export function classifyGhError(detail) {
|
|
|
20
20
|
if (/HTTP 403|rate limit|API rate limit exceeded/i.test(text)) {
|
|
21
21
|
return { kind: 'ratelimit', short, hint: '(被 GitHub 限流:等几分钟,或换成带 token 的凭证)' }
|
|
22
22
|
}
|
|
23
|
+
if (/HTTP 50[0234]|Bad Gateway|Service Unavailable|Gateway Time-?out/i.test(text)) {
|
|
24
|
+
return { kind: 'gateway', short, hint: '(GitHub 或本地代理短暂故障:已按退避自动重试,不需要手动处理;持续出现就检查代理)' }
|
|
25
|
+
}
|
|
23
26
|
if (/ENOENT|not found.*gh|gh: command not found/i.test(text)) {
|
|
24
27
|
return { kind: 'nogh', short, hint: '(找不到 gh 命令:确认已安装且在 PATH)' }
|
|
25
28
|
}
|
|
26
|
-
if (/HTTP 404|
|
|
29
|
+
if (/HTTP 404|Not Found|not found/i.test(text) && !/command not found/i.test(text)) {
|
|
27
30
|
return { kind: 'notfound', short, hint: '(仓库不存在或没权限:检查 owner/name)' }
|
|
28
31
|
}
|
|
29
|
-
if (/EOF|i\/o timeout|connection reset|dial tcp|TLS handshake|no such host|proxyconnect|timeout/i.test(text)) {
|
|
32
|
+
if (/EOF|i\/o timeout|connection reset|dial tcp|TLS handshake|no such host|proxyconnect|timeout|context deadline exceeded|certificate|x509|self.signed|unable to get local issuer/i.test(text)) {
|
|
30
33
|
return { kind: 'network', short, hint: '(网络抖动:这一轮没连上 GitHub,已按退避自动重试,不需要手动处理)' }
|
|
31
34
|
}
|
|
32
35
|
return { kind: 'other', short, hint: '' }
|
package/lib/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
|
|
32
32
|
export const name = 'dsh-session-superagent'
|
|
33
33
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
34
|
-
export const SERVER_VERSION = '0.8.
|
|
34
|
+
export const SERVER_VERSION = '0.8.97'
|
|
35
35
|
export const inject = ['tools', 'agents', 'webServer']
|
|
36
36
|
|
|
37
37
|
/** 仅供测试:读写状态文件(生产代码不要用)。 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.97",
|
|
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",
|