dsh-session-superagent 0.9.169 → 0.9.171
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 +65 -0
- package/MAINTENANCE.md +9 -6
- package/README.md +1 -1
- package/UPDATING.md +11 -6
- package/client.js +3 -1
- package/lib/gh-format.js +10 -1
- package/lib/index.js +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,71 @@
|
|
|
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.171] - 2026-11-04 —— 本地解析错误不该被说成「可能是代理干扰」
|
|
6
|
+
|
|
7
|
+
### 为什么(这是 PR #2 那句判断的落地)
|
|
8
|
+
@Betsy20 在 PR #2 里写了一句:
|
|
9
|
+
|
|
10
|
+
> 这是**本地解析错误,却被报成了网络问题**,把人往代理和上游带,实际一行都不用查。
|
|
11
|
+
|
|
12
|
+
0.9.167 修了那一处 CRLF,但**诊断逻辑本身没改** —— 正文不是 JSON 时的兜底仍是
|
|
13
|
+
「可能是代理干扰」。下次换个行尾、换个 gh 版本,同一个误导会再来一次。
|
|
14
|
+
|
|
15
|
+
### 改法
|
|
16
|
+
`diagnoseBadBody()` 新增一档:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
正文以 HTTP 状态行开头(/^HTTP\/[0-9.]+\s+[0-9]{3}/)
|
|
20
|
+
→ kind: local-parse
|
|
21
|
+
→ 「这是本地解析问题,不是网络问题 —— 请升级插件并把这段贴到 issue」
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- 只有**确诊是网关页**(`<!doctype html>` / `Bad Gateway` / `Gateway Time-out`)才提代理;
|
|
25
|
+
- 兜底文案从「可能是代理干扰」改成「先跑 watch_doctor;确认不是凭证问题就带上这段提 issue」;
|
|
26
|
+
- 面板给 `local-parse` 配了「看诊断」按钮(重试没用,只能把这段贴出来)。
|
|
27
|
+
|
|
28
|
+
### 踩到的坑(记下来)
|
|
29
|
+
写正则时 `` 经 python 落盘变成了 **0x08 退格符** → `[0-9]{3}` 永远匹配不到,
|
|
30
|
+
探针五秒就发现(`od -c` 看到 `` 是控制字符)。本仓库以前在 `ui-audit` 里踩过同一个坑。
|
|
31
|
+
|
|
32
|
+
### 证据
|
|
33
|
+
```
|
|
34
|
+
探针:状态行开头 → local-parse | HTTP/1.1 变体 → local-parse
|
|
35
|
+
代理网页 → gateway | 正常 JSON → null | 空正文 → empty
|
|
36
|
+
node --test → 267/267(原有用例里补了三条断言:kind 与「不得再说代理」)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## [0.9.170] - 2026-11-04 —— 建立本仓库的维护标准(对照成熟开源项目的 55 条基准)
|
|
40
|
+
|
|
41
|
+
### 为什么
|
|
42
|
+
另一个会话把「成熟开源仓库的维护标准」调研做完了(55 条 / 十道分水岭 / 三处「标准悬空」)。
|
|
43
|
+
本仓库对照下来,**不是缺文件,是几处标准悬在半空**:
|
|
44
|
+
|
|
45
|
+
| 悬空形态 | 本仓库原状 | 现在 |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| 脚本写好了没人跑 | `ci.yml` 只跑 `preflight --fast`,ui-audit / check-docs / check-maintenance 从不执行 | CI 三步补齐 |
|
|
48
|
+
| 权限过度 | `ci.yml` 没有 `permissions:`(默认可能 write) | `contents: read` |
|
|
49
|
+
| 依赖更新无制度 | 无 dependabot(`actions/checkout@v4` 已落后) | `.github/dependabot.yml`(actions 周更) |
|
|
50
|
+
| 漏洞没有私密入口 | 无 `SECURITY.md` | 新增(含本插件的安全模型与已知边界) |
|
|
51
|
+
| 协作面为零 | 无 issue / PR 模板 | 三个 issue 表单 + PR 模板(bug 表单强制填版本/宿主/**是否重启**) |
|
|
52
|
+
| 分支保护 | **无**(`Branch not protected`) | 开 required check(`test (22)` / `test (24)`)+ 禁强推禁删;`enforce_admins=false` 是写明的取舍 |
|
|
53
|
+
| 标准没有文档 | — | [docs/维护标准.md](docs/维护标准.md):七条底线 + 20 项必备对照 + 十道分水岭 + **故意不做**的清单 |
|
|
54
|
+
|
|
55
|
+
### 落地物
|
|
56
|
+
- `.github/workflows/ci.yml`(权限最小化 + concurrency 取消旧跑 + fetch-depth 0 + 三步检查)
|
|
57
|
+
- `.github/ISSUE_TEMPLATE/{bug_report,feature_request,config}.yml`、`.github/PULL_REQUEST_TEMPLATE.md`
|
|
58
|
+
- `.github/dependabot.yml`、`SECURITY.md`、`docs/维护标准.md`
|
|
59
|
+
- 知识库第 178 条:[标准悬空:写好了没人调用 = 没写](docs/kb/standards-suspended-in-air.md)
|
|
60
|
+
|
|
61
|
+
### 证据
|
|
62
|
+
```
|
|
63
|
+
node --test → 267/267
|
|
64
|
+
preflight 全量 → 37/37
|
|
65
|
+
check-docs → 五项 PASS(178 篇)
|
|
66
|
+
check-maintenance → 6 项通过
|
|
67
|
+
gh api …/branches/main/protection → required_status_checks: ["test (22)","test (24)"], allow_force_pushes: false
|
|
68
|
+
```
|
|
69
|
+
|
|
5
70
|
## [0.9.169] - 2026-11-04 —— 发布通道补齐 + 维护标准本地化(取自 magpie 脚手架)
|
|
6
71
|
|
|
7
72
|
### 你指出的两件事
|
package/MAINTENANCE.md
CHANGED
|
@@ -26,17 +26,18 @@
|
|
|
26
26
|
| 资产 | 数量 |
|
|
27
27
|
|---|---:|
|
|
28
28
|
| `node --test` | 267 例全过 |
|
|
29
|
-
| `scripts/preflight.mjs` |
|
|
29
|
+
| `scripts/preflight.mjs` | 37 项全 PASS(`--fast` 36 项) |
|
|
30
30
|
| `scripts/ui-audit.mjs` | 11/11,100 分(写死颜色 0 / 自造 token 0) |
|
|
31
|
-
| `docs/kb` |
|
|
31
|
+
| `docs/kb` | 177 篇 / 9 板块(`check-docs` 五项 PASS,含总数校验) |
|
|
32
32
|
| `scripts/` | 52 个门禁与工装脚本 |
|
|
33
|
-
| GitHub Release |
|
|
33
|
+
| GitHub Release | 35 个(v0.9.136–v0.9.170 已补,其余待按批次回填) |
|
|
34
|
+
| CI / 分支保护 | `ci`(Node 22/24,actions 已到 v7);main 已开 required check + 禁强推禁删;dependabot PR #8 已走通合并 |
|
|
34
35
|
|
|
35
36
|
已验证(本轮实测):
|
|
36
37
|
|
|
37
|
-
- `node --test` → 267/267;preflight 全量
|
|
38
|
-
- `sync-profile --check` → 缺失 0 / 断链 0 / 陈旧 0;安装副本 `package.json` = 0.9.
|
|
39
|
-
- `npm publish` → `+ dsh-session-superagent@0.9.
|
|
38
|
+
- `node --test` → 267/267;preflight 全量 37/37;ui-audit 11/11 = 100;`check-docs` 五项 PASS;
|
|
39
|
+
- `sync-profile --check` → 缺失 0 / 断链 0 / 陈旧 0;安装副本 `package.json` = 0.9.169;
|
|
40
|
+
- `npm publish` → `+ dsh-session-superagent@0.9.169`;`git push` → 见 `git log --oneline -1`;
|
|
40
41
|
- 外部 PR:#2 / #3 / #5 / #6 已处理(#2 #3 → 0.9.167,#6 → 0.9.168,#5 按重复关闭);
|
|
41
42
|
#7(`ghConfigDir`)留在 open 等作者按三条意见改完。
|
|
42
43
|
|
|
@@ -65,6 +66,8 @@
|
|
|
65
66
|
5. **发布三处必须一致**:`package.json` / `lib/index.js` / `client.js` / README 徽章 / CHANGELOG
|
|
66
67
|
(`test/meta.test.mjs` 会拦),外加 **tag 与 Release 标题只写版本号**。
|
|
67
68
|
6. **不代改他人 PR**:给意见让对方改,改完我复核合入。
|
|
69
|
+
7. **标准写在文档里不算数**:新加的检查必须接进 `preflight` 或 CI,否则就是「标准悬空」
|
|
70
|
+
(写好了没人调用 = 没写)。见 [docs/维护标准.md](./docs/维护标准.md)。
|
|
68
71
|
|
|
69
72
|
## 五、给接手者的最短路径
|
|
70
73
|
|
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
|
|
package/UPDATING.md
CHANGED
|
@@ -21,17 +21,22 @@ node scripts/check-maintenance.mjs # 会告诉你哪处没对齐
|
|
|
21
21
|
# 3) 全量门禁(不是 --fast)
|
|
22
22
|
node scripts/preflight.mjs
|
|
23
23
|
|
|
24
|
-
# 4)
|
|
25
|
-
|
|
24
|
+
# 4) 提交,**commit 与 tag 一起推**
|
|
25
|
+
# 先推 commit 再补 tag,CI 会在「维护一致性」那一步红(tag 还不存在)—— 实测过一次。
|
|
26
|
+
git add -A && git commit -m "fix: ..."
|
|
27
|
+
git tag v<版本> && git push origin main v<版本>
|
|
26
28
|
|
|
27
|
-
# 5)
|
|
28
|
-
npm publish
|
|
29
|
-
|
|
30
|
-
# 6) 打 tag + 建 Release(标题自动是纯版本号)
|
|
29
|
+
# 5) 建 Release(标题自动是纯版本号;tag 已在,只补 Release)
|
|
31
30
|
node scripts/release-gh.mjs --latest
|
|
32
31
|
|
|
32
|
+
# 6) 发 npm
|
|
33
|
+
npm publish
|
|
34
|
+
|
|
33
35
|
# 7) 同步到本机安装副本(用户重启后生效)
|
|
34
36
|
node scripts/sync-profile.mjs
|
|
37
|
+
|
|
38
|
+
# 8) 看 CI 有没有绿(PR 会跳过维护一致性,main 上必须绿)
|
|
39
|
+
gh run list --workflow ci --limit 3
|
|
35
40
|
```
|
|
36
41
|
|
|
37
42
|
历史遗留版本要补 Release 时用 `node scripts/release-gh.mjs`(不带 `--latest`),
|
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.171'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -1240,6 +1240,8 @@ window.__ModuleLoader__.load({
|
|
|
1240
1240
|
moved: { label: '改仓库地址', onClick: () => setTab('trigger') },
|
|
1241
1241
|
notfound: { label: '改仓库地址', onClick: () => setTab('trigger') },
|
|
1242
1242
|
permission: { label: '去填 token', onClick: () => setTab('settings') },
|
|
1243
|
+
// 本地解析错误:重试没用,只能让人把这段贴出来
|
|
1244
|
+
'local-parse': { label: '看诊断', onClick: () => setTab('settings') },
|
|
1243
1245
|
network: { label: '立刻重试', onClick: () => act(watcher, 'poll') },
|
|
1244
1246
|
ratelimit: { label: '立刻重试', onClick: () => act(watcher, 'poll') },
|
|
1245
1247
|
gateway: { label: '立刻重试', onClick: () => act(watcher, 'poll') },
|
package/lib/gh-format.js
CHANGED
|
@@ -20,8 +20,17 @@ export function isAuthBroken(authStatusText) {
|
|
|
20
20
|
}
|
|
21
21
|
export function diagnoseBadBody({ bodyText, authStatusText } = {}) {
|
|
22
22
|
const body = String(bodyText ?? '').trim()
|
|
23
|
-
// 有内容但不是 JSON
|
|
23
|
+
// 有内容但不是 JSON:先分清是「我们切错了」还是「上游/代理给的不是 JSON」
|
|
24
24
|
if (body.length > 0) {
|
|
25
|
+
// ① 本地切分错误:正文以 HTTP 状态行开头,说明头/体没切开(`gh --include` 的行尾差异就会这样)。
|
|
26
|
+
// 这一条最值钱 —— 以前它落到「可能是代理干扰」,把客户往网络上游带,实际一行都不用查。
|
|
27
|
+
// 真机来源:2026-11-03 Windows 上 CRLF 头体分隔(PR #2 修复);这里防的是"下次换个行尾再犯"。
|
|
28
|
+
if (/^HTTP\/[0-9.]+\s+[0-9]{3}\b/i.test(body)) {
|
|
29
|
+
return {
|
|
30
|
+
kind: 'local-parse',
|
|
31
|
+
hint: '(正文以 HTTP 状态行开头:这是本地解析问题,不是网络问题 —— 请升级插件并把这段贴到 issue)',
|
|
32
|
+
}
|
|
33
|
+
}
|
|
25
34
|
if (/^<(!doctype|html)|<body|Bad Gateway|Service Unavailable|Gateway Time-?out/i.test(body)) {
|
|
26
35
|
return { kind: 'gateway', hint: '(返回的是网页而不是 JSON:本地代理/网关拦了请求 —— 检查代理设置)' }
|
|
27
36
|
}
|
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.171'
|
|
44
44
|
export const inject = ['tools', 'agents', 'webServer']
|
|
45
45
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
46
46
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -1019,7 +1019,9 @@ async function pollOnce(ctx, entry, baseMs) {
|
|
|
1019
1019
|
const authText = await ghAuthStatusText()
|
|
1020
1020
|
const diag = diagnoseBadBody({ bodyText: parsed.body, authStatusText: authText })
|
|
1021
1021
|
if (diag && diag.kind === 'auth') entry.needsReauth = true
|
|
1022
|
-
|
|
1022
|
+
// 兜底不再默认「可能是代理干扰」:那会把客户往网络上游带。
|
|
1023
|
+
// 现在只有确诊是网关页才说代理;其余情况指向 watch_doctor 与本仓库 issue。
|
|
1024
|
+
setEntryError(entry, (diag ? diag.hint : '(返回内容不是合法 JSON:先跑 watch_doctor;确认不是凭证问题就带上这段提 issue)') + ' —— 已按退避自动重试')
|
|
1023
1025
|
bumpFailure(entry, diag && diag.kind === 'auth' ? baseMs : baseMs)
|
|
1024
1026
|
if (diag && diag.kind === 'auth') {
|
|
1025
1027
|
const wait = permanentBackoffMs('auth', baseMs)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.171",
|
|
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",
|