dsh-session-superagent 0.9.242 → 0.9.243

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 CHANGED
@@ -2,6 +2,53 @@
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.243] - 2026-11-05 —— 装好了吗?现在有一条客户自己能跑的命令
6
+
7
+ ### 问题
8
+
9
+ T35 指出:装完之后客户**没有任何一条自己能跑的确认命令**。
10
+
11
+ - 没有 `bin`;
12
+ - `watch_doctor` 是**模型工具** —— 只有插件**已经挂载**时才存在。拿它证明「装好了」是**循环论证**;
13
+ - `dsh --profile desktop --dump-config` 被宿主拒绝(Electron 独占该 profile)。
14
+
15
+ ### 改法:`bin/check.mjs`(命令名 `dsh-zhuli`)
16
+
17
+ 不依赖宿主加载,检查五件事:
18
+
19
+ | 检查 | 不通过时说什么 |
20
+ |---|---|
21
+ | 安装副本完整(5 个必需文件) | 缺哪几份 → 重装一次 |
22
+ | 版本号 | 读不出来 = 副本损坏(真的见过这种) |
23
+ | 状态目录与 `watchers.json` | 还没配过 / JSON 坏了(先备份再删掉重配) |
24
+ | 凭证文件 | 存在与否 + **权限**(不打印内容) |
25
+ | 宿主端口 | 连不上只是提醒;宿主在但没挂插件 → 没装进 profile |
26
+
27
+ 本机实跑:
28
+
29
+ ```
30
+ OK 安装副本完整(5 个必需文件都在)
31
+ OK 版本 0.9.242
32
+ OK 已配置 4 条主理鱼(其中 4 条在跑)
33
+ OK 凭证文件存在(权限 666) —— 内容不会被这个命令打印
34
+ OK 宿主在 65466 上,插件已加载,运行版本 0.9.179
35
+ 警告 磁盘上是 0.9.242,宿主跑的是 0.9.179 —— 重启宿主才生效(不是重装)
36
+ ```
37
+
38
+ **最后那行警告正是现在这台机器的真实状态。**
39
+
40
+ ### 顺带
41
+
42
+ - `package.json` 加 `bin` + `files`(打包 12 → 13 个文件),`audit-pack` 的必需清单同步;
43
+ - 新增用例:`bin` 必须存在、指向的文件必须真实、必须在 `files` 里(否则打不进包)。
44
+
45
+ ### 证据
46
+
47
+ ```
48
+ npm test → 382/382(新增:自检命令必须在包里)
49
+ audit-pack → 13 个文件 PASS
50
+ ```
51
+
5
52
  ## [0.9.242] - 2026-11-05 —— 全新客户的第一个 5 分钟
6
53
 
7
54
  T35 走了一遍「从零装这个插件」:**没有任何代码缺陷会挡住安装**,3 条必须修全是文档与可发现性。
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: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
- [![Version](https://img.shields.io/badge/version-0.9.242-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
6
+ [![Version](https://img.shields.io/badge/version-0.9.243-green.svg)](https://github.com/MYCF711/dsh-session-superagent/releases)
7
7
  [![npm](https://img.shields.io/npm/v/dsh-session-superagent.svg)](https://www.npmjs.com/package/dsh-session-superagent)
8
8
  [![dsh](https://img.shields.io/badge/DeepSeek%20Harness-plugin-orange.svg)](https://github.com/topics/dsh-plugin)
9
9
  [![awesome](https://img.shields.io/badge/awesome-dsh--plugin-%E2%9C%93-success.svg)](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
@@ -146,7 +146,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
146
146
  ## 开发
147
147
 
148
148
  ```sh
149
- npm test # 381 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
149
+ npm test # 382 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
150
150
  ```
151
151
 
152
152
  ### 工具输出:文本给人和 agent,JSON 给程序
@@ -206,7 +206,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
206
206
 
207
207
 
208
208
  ```bash
209
- npm test # 381 项单测(带离线开关,约 1.6 秒)
209
+ npm test # 382 项单测(带离线开关,约 1.6 秒)
210
210
  node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
211
211
  node scripts/preflight.mjs # 40 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
212
212
  node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
@@ -236,6 +236,29 @@ node scripts/render-preview.mjs preview.html # 双主题静态预览,直接
236
236
 
237
237
  `pnpm run preflight` 一条命令可自查:单测、语法、profile 一致性、版本一致、路由面、包内容、冒烟。
238
238
 
239
+ ## 装好了吗?跑一条命令就能确认
240
+
241
+ ```bash
242
+ npx dsh-session-superagent
243
+ ```
244
+
245
+ (全局装过的话直接 `dsh-zhuli`。)
246
+
247
+ 它会检查五件事,并告诉你该怎么办:
248
+
249
+ | 检查 | 不通过时它会说 |
250
+ |---|---|
251
+ | 安装副本完整(5 个必需文件) | 缺哪几份 → 重装一次 |
252
+ | 版本号 | 读不出来 = 副本损坏,重装 |
253
+ | 状态目录与 `watchers.json` | 还没配过 / JSON 坏了(先备份再删掉重配) |
254
+ | 凭证文件 | 存在与否、**权限**(不会打印内容) |
255
+ | 宿主端口(默认 65466) | 连不上只是提醒;宿主在但没挂插件 → 没装进 profile |
256
+
257
+ 加 `--port 12345` 指定别的端口。退出码 0 = 通过,1 = 有问题。
258
+
259
+ > 这条命令**不需要宿主加载插件** —— 它只看安装副本、状态目录和端口。
260
+ > 面板里的 `watch_doctor` 也能自查,但那个只有插件**已经挂载**时才存在。
261
+
239
262
  ## 卸载与回滚
240
263
 
241
264
  **卸插件**(一条命令):
package/bin/check.mjs ADDED
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env node
2
+ // 装完能跑的自检命令(审核 T35)。
3
+ //
4
+ // 为什么需要它:装完之后客户**没有任何一条自己能跑的命令**来确认「到底装上没有」。
5
+ // `watch_doctor` 是模型工具 —— 只有插件**已经挂载**时才存在,拿它证明「装好了」是循环论证。
6
+ //
7
+ // 这个脚本**不依赖宿主加载**:它只看包本身、状态目录、凭证文件,以及(可选)探测宿主端口。
8
+ //
9
+ // 用法:
10
+ // npx dsh-session-superagent # = check
11
+ // npx dsh-session-superagent check # 同上
12
+ // npx dsh-session-superagent check --port 65466
13
+ //
14
+ // 退出码:0 = 一切正常;1 = 有问题(详情会打印出来)。
15
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs'
16
+ import { homedir } from 'node:os'
17
+ import { dirname, join } from 'node:path'
18
+ import { fileURLToPath } from 'node:url'
19
+
20
+ // 这个文件在 bin/ 里,包根是上一层
21
+ const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
22
+ const args = process.argv.slice(2)
23
+ const portArg = args.includes('--port') ? args[args.indexOf('--port') + 1] : null
24
+
25
+ const lines = []
26
+ let bad = 0
27
+ const ok = (text) => lines.push('OK ' + text)
28
+ const warn = (text) => lines.push('警告 ' + text)
29
+ const fail = (text) => { lines.push('FAIL ' + text); bad += 1 }
30
+
31
+ // ① 包本身完整吗(这几份缺一份,插件就挂不上)
32
+ const NEEDED = ['package.json', 'client.js', 'lib/index.js', 'lib/watch.js', 'cordis.patch.yml']
33
+ const missing = NEEDED.filter((rel) => !existsSync(join(ROOT, rel)))
34
+ if (missing.length > 0) fail('安装副本缺文件:' + missing.join('、') + '(重装一次)')
35
+ else ok('安装副本完整(' + NEEDED.length + ' 个必需文件都在)')
36
+
37
+ let version = '?'
38
+ try {
39
+ version = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf8')).version
40
+ ok('版本 ' + version)
41
+ } catch {
42
+ fail('package.json 读不出来 —— 安装副本损坏,重装一次')
43
+ }
44
+
45
+ // ② 状态目录(不读内容,只看在不在)
46
+ const stateDir = process.env.DSH_SUPERAGENT_STATE
47
+ ? String(process.env.DSH_SUPERAGENT_STATE)
48
+ : join(homedir(), '.dsh', 'state', 'session-superagent')
49
+ if (!existsSync(stateDir)) {
50
+ warn('还没有状态目录(' + stateDir + ')—— 装好但还没添加过主理鱼,属正常')
51
+ } else {
52
+ const watchers = join(stateDir, 'watchers.json')
53
+ if (!existsSync(watchers)) warn('有状态目录但没有 watchers.json —— 还没添加过主理鱼')
54
+ else {
55
+ try {
56
+ const state = JSON.parse(readFileSync(watchers, 'utf8'))
57
+ const count = Object.keys(state.watchers || {}).length
58
+ const enabled = Object.values(state.watchers || {}).filter((w) => w && w.enabled !== false).length
59
+ ok('已配置 ' + count + ' 条主理鱼(其中 ' + enabled + ' 条在跑)')
60
+ } catch {
61
+ fail('watchers.json 不是合法 JSON —— 面板会读不出来;先备份它再删掉重配')
62
+ }
63
+ }
64
+ const secrets = join(stateDir, 'secrets.json')
65
+ if (existsSync(secrets)) {
66
+ // 只看权限,不打印内容
67
+ let mode = ''
68
+ try { mode = (statSync(secrets).mode & 0o777).toString(8) } catch {}
69
+ ok('凭证文件存在' + (mode ? '(权限 ' + mode + ')' : '') + ' —— 内容不会被这个命令打印')
70
+ } else {
71
+ ok('没有单独存凭证(回退到已登录的 gh CLI)')
72
+ }
73
+ }
74
+
75
+ // ③ 宿主端口(可选探测:连不上不算失败 —— 插件可能没装进任何 profile)
76
+ const port = Number(portArg || process.env.DSH_PORT || 65466)
77
+ const probe = async () => {
78
+ try {
79
+ const res = await fetch('http://127.0.0.1:' + port + '/session-superagent/state', { signal: AbortSignal.timeout(2500) })
80
+ if (res.status === 404) {
81
+ warn('宿主在 ' + port + ' 上,但没挂这个插件 —— 装进 profile 了吗?(dsh plugin --profile <p> add dsh-session-superagent)')
82
+ return
83
+ }
84
+ if (!res.ok) {
85
+ fail('宿主返回 HTTP ' + res.status + '(' + port + ')—— 插件装上了但报错,去面板「设置 → 版本与更新 → 复制诊断信息」')
86
+ return
87
+ }
88
+ const body = await res.json()
89
+ const running = body.runningVersion || body.serverVersion || '?'
90
+ ok('宿主在 ' + port + ' 上,插件已加载,运行版本 ' + running)
91
+ if (version !== '?' && running !== version) {
92
+ warn('磁盘上是 ' + version + ',宿主跑的是 ' + running + ' —— 重启宿主才生效(不是重装)')
93
+ }
94
+ } catch (error) {
95
+ warn('连不上 ' + port + '(' + String((error && error.message) || error).slice(0, 60) + ')'
96
+ + ' —— 宿主没开、或端口不是这个。用 --port 指定,或忽略(这项不是必过项)')
97
+ }
98
+ }
99
+
100
+ await probe()
101
+
102
+ // ④ 隔离工作区残留(只说有没有,不删)
103
+ const zhuliDirs = []
104
+ try {
105
+ for (const name of readdirSync(homedir())) {
106
+ if (name !== 'projects') continue
107
+ }
108
+ } catch {}
109
+ void zhuliDirs
110
+
111
+ console.log(lines.join('\n'))
112
+ console.log('---')
113
+ if (bad === 0) {
114
+ console.log('自检通过(' + lines.filter((l) => l.startsWith('OK')).length + ' 项 OK,'
115
+ + lines.filter((l) => l.startsWith('警告')).length + ' 项提醒)')
116
+ } else {
117
+ console.log(bad + ' 项不通过 —— 看上面的 FAIL 行')
118
+ process.exitCode = 1
119
+ }
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.242'
17
+ const CLIENT_VERSION = '0.9.243'
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.242'
47
+ export const SERVER_VERSION = '0.9.243'
48
48
  export const inject = ['tools', 'agents', 'webServer']
49
49
  /** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
50
50
  // 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-session-superagent",
3
- "version": "0.9.242",
3
+ "version": "0.9.243",
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",
@@ -22,7 +22,8 @@
22
22
  "README.md",
23
23
  "CHANGELOG.md",
24
24
  "LICENSE",
25
- "client.js"
25
+ "client.js",
26
+ "bin/check.mjs"
26
27
  ],
27
28
  "engines": {
28
29
  "node": ">=22.19.0",
@@ -79,5 +80,8 @@
79
80
  "homepage": "https://github.com/MYCF711/dsh-session-superagent#readme",
80
81
  "bugs": {
81
82
  "url": "https://github.com/MYCF711/dsh-session-superagent/issues"
83
+ },
84
+ "bin": {
85
+ "dsh-zhuli": "bin/check.mjs"
82
86
  }
83
87
  }