dsh-session-superagent 0.8.45 → 0.8.47
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 +42 -0
- package/README.md +1 -1
- package/client.js +19 -1
- package/lib/index.js +35 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
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.47] - 2026-11-02 —— 客户报障:面板里一键复制诊断
|
|
6
|
+
|
|
7
|
+
客户在别的电脑上用我们的插件,我们看不到他的状态文件。以前报障只能靠来回问
|
|
8
|
+
「你装的哪一版」「面板显示什么」「错误原文是什么」—— 一轮就是半天。
|
|
9
|
+
|
|
10
|
+
### 做法
|
|
11
|
+
- 新增只读接口 `GET /session-superagent/diagnose`,返回一段**已脱敏**的纯文本:
|
|
12
|
+
插件版本、宿主 node 版本、挂载状态(routes/failed/base/at)、每条值守的
|
|
13
|
+
仓库 / 启用状态 / 间隔 / 会话 / 上次轮询 / 连续失败数 / 最近错误;
|
|
14
|
+
- 面板「设置 → 诊断」一键复制这段(`navigator.clipboard`),复制成功会提示行数;
|
|
15
|
+
- 文本出厂前过一遍 `redact()`:token、私钥、Authorization 头都不会带出去。
|
|
16
|
+
|
|
17
|
+
### 测试
|
|
18
|
+
- 路由面 7 → **8 条**,测试与 `preflight` 里的断言同步(含跨实例接管、整组重放、卸载幂等三条)
|
|
19
|
+
- 客户端契约测试逼我改了变量名(`body.text` 会被当成 `/state` 的字段 —— 那是 `/diagnose` 的),
|
|
20
|
+
这条测试挺管用:它保证客户端引用的 `/state` 字段服务端真的回传。
|
|
21
|
+
- UI 体检里「图标按钮缺可读名字」的检测器从「固定 420 字符窗口」改成**花括号配对**:
|
|
22
|
+
长 `onClick` 的按钮之前会被误判成没名字(一次误报 16 个)。顺手给 `ConfirmBtn` 补了 `aria-label`。
|
|
23
|
+
- 合计 **102 例**;UI 体检 11/11。
|
|
24
|
+
|
|
25
|
+
## [0.8.46] - 2026-11-02 —— 双主题预览 + 「自造 token」守门
|
|
26
|
+
|
|
27
|
+
### ① 预览脚本终于能看两套主题
|
|
28
|
+
`node scripts/render-preview.mjs out.html` 现在一次输出 **浅色 + 深色**两套(9 个场景 × 2 = 18 块),
|
|
29
|
+
覆盖:总览 / 判定 / 触发 / 设置(来源)/ 设置(版本与更新)/ 新版本横幅 / 两种 Toast / 术语表。
|
|
30
|
+
|
|
31
|
+
顺手修掉一个长期误导:预览的兜底 token 用的是
|
|
32
|
+
`--dsw-alias-border-default`、`--dsw-alias-success-500`、`--dsw-alias-accent-primary` ——
|
|
33
|
+
**宿主机上根本没有这些变量**,所以以前预览一直"没上色",看起来像样式没移植对。
|
|
34
|
+
现在全部换成真实变量名(`--dsw-alias-border-l3`、`--dsw-alias-state-success-primary`、`--dsw-alias-brand-primary` …)。
|
|
35
|
+
|
|
36
|
+
### ② 新增守门:自造 token
|
|
37
|
+
`ui-audit` 第 11 项 —— 我们自己代码里引用的 `--dsw-*` 必须都在官方 CSS 里出现过。
|
|
38
|
+
当前 0 处自造(引用 20 个变量,全部有出处)。这条能防住「变量名拼错→样式静默失效」。
|
|
39
|
+
|
|
40
|
+
### 指标
|
|
41
|
+
```
|
|
42
|
+
11/11 通过(100 分)
|
|
43
|
+
写死颜色(样式块)0 · 写死颜色(inline/JS)0 · 自造 token 0
|
|
44
|
+
官方结构 8/8 · 弹层键盘 3/3 · 裸 button 5/17 · 死代码 0
|
|
45
|
+
```
|
|
46
|
+
|
|
5
47
|
## [0.8.45] - 2026-11-02 —— 表单字段补齐官方 Field,状态色全部 token 化
|
|
6
48
|
|
|
7
49
|
### ① 表单字段用官方 `Field`(带 hint / note)
|
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/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.47'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -392,6 +392,7 @@ window.__ModuleLoader__.load({
|
|
|
392
392
|
size,
|
|
393
393
|
className: armed ? 'dt-danger' : undefined,
|
|
394
394
|
icon,
|
|
395
|
+
'aria-label': armed ? confirmLabel : label,
|
|
395
396
|
onClick: () => {
|
|
396
397
|
if (!armed) { setArmed(true); return }
|
|
397
398
|
setArmed(false)
|
|
@@ -1140,6 +1141,22 @@ window.__ModuleLoader__.load({
|
|
|
1140
1141
|
h('div', { className: 'dt-actions' },
|
|
1141
1142
|
h(Btn, { size: 'sm', variant: 'ghost', onClick: () => checkUpdate(true), disabled: checking }, checking ? '检查中…' : '重新检查')),
|
|
1142
1143
|
h(Hint, null, '升级要改 profile,装完需要重载一次宿主才会用上新版本 —— 所以这里只给命令,不替你执行。')),
|
|
1144
|
+
h(Section, { key: 'diagnose', title: '诊断' },
|
|
1145
|
+
h(Hint, null, '反馈问题时把这段贴给对方:里面有版本、挂载状态和每条值守的最近错误(凭证已脱敏)。'),
|
|
1146
|
+
h('div', { className: 'dt-actions' },
|
|
1147
|
+
h(Btn, {
|
|
1148
|
+
size: 'sm', variant: 'outline',
|
|
1149
|
+
onClick: async () => {
|
|
1150
|
+
try {
|
|
1151
|
+
const payload = await call('/diagnose')
|
|
1152
|
+
const text = String((payload && payload.text) || '')
|
|
1153
|
+
try { await navigator.clipboard.writeText(text) } catch {}
|
|
1154
|
+
notify('诊断信息已复制(' + text.split(String.fromCharCode(10)).length + ' 行)', 'info')
|
|
1155
|
+
} catch (error) {
|
|
1156
|
+
notify('生成诊断失败:' + String((error && error.message) || error), 'error')
|
|
1157
|
+
}
|
|
1158
|
+
},
|
|
1159
|
+
}, '复制诊断信息'))),
|
|
1143
1160
|
h(Section, { key: 'goal', title: '会话 goal' },
|
|
1144
1161
|
h('textarea', {
|
|
1145
1162
|
className: 'dt-textarea', rows: 3, value: goalDraft,
|
|
@@ -1156,6 +1173,7 @@ window.__ModuleLoader__.load({
|
|
|
1156
1173
|
{ key: 'source', title: '来源' },
|
|
1157
1174
|
{ key: 'creds', title: '凭证' },
|
|
1158
1175
|
{ key: 'update', title: '版本与更新' },
|
|
1176
|
+
{ key: 'diagnose', title: '诊断' },
|
|
1159
1177
|
{ key: 'goal', title: '会话 goal' },
|
|
1160
1178
|
]
|
|
1161
1179
|
const settingsBody = settingsSections.find((node) => node && node.props && node.props.key === settingsSection)
|
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
|
|
31
31
|
export const name = 'dsh-session-superagent'
|
|
32
32
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
33
|
-
export const SERVER_VERSION = '0.8.
|
|
33
|
+
export const SERVER_VERSION = '0.8.47'
|
|
34
34
|
export const inject = ['tools', 'agents', 'webServer']
|
|
35
35
|
|
|
36
36
|
/** 仅供测试:读写状态文件(生产代码不要用)。 */
|
|
@@ -906,6 +906,40 @@ export function apply(ctx) {
|
|
|
906
906
|
},
|
|
907
907
|
})
|
|
908
908
|
|
|
909
|
+
// 客户报障用:把「版本 / 挂载状态 / 每条守的最近错误」拼成一段可直接粘贴的文本。
|
|
910
|
+
// 客户在别的电脑上,我们看不到他的状态文件 —— 让他一键复制这段就够了。
|
|
911
|
+
addRoute({
|
|
912
|
+
kind: 'exact',
|
|
913
|
+
path: '/session-superagent/diagnose',
|
|
914
|
+
handler: (req, res) => {
|
|
915
|
+
if (req.method !== 'GET') return json(res, 405, { error: 'method not allowed' })
|
|
916
|
+
const state = readState()
|
|
917
|
+
const mounted = state.server || {}
|
|
918
|
+
const lines = []
|
|
919
|
+
lines.push('主理鱼诊断 · ' + new Date().toISOString())
|
|
920
|
+
lines.push('插件版本: ' + SERVER_VERSION)
|
|
921
|
+
lines.push('宿主: DSH / node ' + String(process.version || ''))
|
|
922
|
+
lines.push('挂载: routes=' + String(mounted.routes ?? '?')
|
|
923
|
+
+ ' failed=' + String((mounted.failed || []).length)
|
|
924
|
+
+ ' base=' + String(mounted.base || '-')
|
|
925
|
+
+ ' at=' + String(mounted.at || '-'))
|
|
926
|
+
if ((mounted.failed || []).length > 0) lines.push('挂载失败: ' + mounted.failed.join('; '))
|
|
927
|
+
const entries = Object.values(state.watchers || {})
|
|
928
|
+
lines.push('值守: ' + entries.length + ' 条')
|
|
929
|
+
for (const entry of entries) {
|
|
930
|
+
lines.push('- ' + entry.repo
|
|
931
|
+
+ ' | ' + (entry.enabled === false ? '已暂停' : '启用')
|
|
932
|
+
+ ' | 间隔 ' + entry.intervalSec + 's'
|
|
933
|
+
+ ' | 会话 ' + String(entry.sessionId || '').slice(0, 20)
|
|
934
|
+
+ ' | 上次轮询 ' + String(entry.lastPoll || '-')
|
|
935
|
+
+ ' | 失败 ' + (entry.consecutiveFailures || 0)
|
|
936
|
+
+ (entry.lastError ? ' | 错误: ' + String(entry.lastError).slice(0, 160) : ''))
|
|
937
|
+
}
|
|
938
|
+
const text = redact(lines.join(String.fromCharCode(10)))
|
|
939
|
+
json(res, 200, { ok: true, text })
|
|
940
|
+
},
|
|
941
|
+
})
|
|
942
|
+
|
|
909
943
|
// 版本检查(只读;面板「设置」页那一行「有新版本」靠它)
|
|
910
944
|
addRoute({
|
|
911
945
|
kind: 'exact',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.47",
|
|
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",
|