dsh-session-superagent 0.8.92 → 0.8.93
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 +21 -0
- package/README.md +1 -1
- package/client.js +1 -1
- package/lib/index.js +27 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.93] - 2026-11-02 —— 让 watch_doctor 自己说出"改了没重启"
|
|
6
|
+
|
|
7
|
+
### 背景
|
|
8
|
+
上一轮的 `verify-live` 是从**外面**看(HTTP);这一轮让**宿主内部**也能自己发现同一个问题:
|
|
9
|
+
`SERVER_VERSION` 是当前进程加载的代码版本,磁盘 `package.json` 是装好的版本 —— 两者不同就是
|
|
10
|
+
「文件换了但宿主还在跑老模块」。本机反复出现过这种情况(客户端热重载会生效,服务端不会)。
|
|
11
|
+
|
|
12
|
+
### 改了什么
|
|
13
|
+
`watch_doctor` 的第一行现在是版本检查:
|
|
14
|
+
```
|
|
15
|
+
WARN 代码已更新但未生效:磁盘 0.8.92 / 正在运行 0.8.93 —— 需要重启宿主(不是重装)
|
|
16
|
+
```
|
|
17
|
+
一致时输出 `OK 版本一致:0.8.93`。
|
|
18
|
+
|
|
19
|
+
### 实测
|
|
20
|
+
在真机上直接调 doctor(版本故意错开一版),确实输出了上面这行 WARN —— 检查有效。
|
|
21
|
+
|
|
22
|
+
### 测试
|
|
23
|
+
- 新增 1 例:源码里必须有 `installedVersion` 与提示文案;且 `package.json` 与 `SERVER_VERSION` 必须一致。
|
|
24
|
+
- 合计 **137 例**。
|
|
25
|
+
|
|
5
26
|
## [0.8.92] - 2026-11-02 —— 重启之后怎么确认"新代码真的在跑"
|
|
6
27
|
|
|
7
28
|
### 背景(这轮的核心事实)
|
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.93'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,8 @@ import { execFileSync, spawn } from 'node:child_process'
|
|
|
16
16
|
import { createHash, randomUUID } from 'node:crypto'
|
|
17
17
|
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from 'node:fs'
|
|
18
18
|
import os, { homedir } from 'node:os'
|
|
19
|
-
import { isAbsolute, join } from 'node:path'
|
|
19
|
+
import { dirname, isAbsolute, join } from 'node:path'
|
|
20
|
+
import { fileURLToPath } from 'node:url'
|
|
20
21
|
|
|
21
22
|
import { zstdDecompressSync } from 'node:zlib'
|
|
22
23
|
|
|
@@ -30,7 +31,7 @@ import {
|
|
|
30
31
|
|
|
31
32
|
export const name = 'dsh-session-superagent'
|
|
32
33
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
33
|
-
export const SERVER_VERSION = '0.8.
|
|
34
|
+
export const SERVER_VERSION = '0.8.93'
|
|
34
35
|
export const inject = ['tools', 'agents', 'webServer']
|
|
35
36
|
|
|
36
37
|
/** 仅供测试:读写状态文件(生产代码不要用)。 */
|
|
@@ -653,6 +654,22 @@ function dirSize(path, depth) {
|
|
|
653
654
|
* 多出来的 API 调用只在这几种条件下发生,别让它变成常态开销。
|
|
654
655
|
*/
|
|
655
656
|
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* 已安装版本 vs 已加载版本。
|
|
660
|
+
*
|
|
661
|
+
* `SERVER_VERSION` 是**当前进程里加载的代码**的版本;磁盘上 package.json 的 version 是
|
|
662
|
+
* **装好的**版本。两者不同 = 「文件换了,但宿主还在跑老模块」—— 这正是本机反复出现的情况
|
|
663
|
+
* (client 热重载会生效,服务端不会,界面上看不出来)。
|
|
664
|
+
*/
|
|
665
|
+
function installedVersion() {
|
|
666
|
+
try {
|
|
667
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
668
|
+
const pkg = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8'))
|
|
669
|
+
return typeof pkg.version === 'string' ? pkg.version : null
|
|
670
|
+
} catch { return null }
|
|
671
|
+
}
|
|
672
|
+
|
|
656
673
|
/** 当前 token 对应的账号(判断"最后一条评论是不是我们自己发的")。缓存 10 分钟。 */
|
|
657
674
|
let viewerCache = { at: 0, login: null }
|
|
658
675
|
async function viewerLogin() {
|
|
@@ -1533,6 +1550,14 @@ export function apply(ctx) {
|
|
|
1533
1550
|
const all = Object.values(state.watchers || {})
|
|
1534
1551
|
const wanted = args.repo ? all.filter((w) => w && w.repo === String(args.repo)) : all
|
|
1535
1552
|
|
|
1553
|
+
// -1. 版本一致性:文件换了但没重启时,服务端仍然跑老代码(客户端热重载会掩盖这件事)
|
|
1554
|
+
const installed = installedVersion()
|
|
1555
|
+
if (installed && installed !== SERVER_VERSION) {
|
|
1556
|
+
lines.push(`WARN 代码已更新但未生效:磁盘 ${installed} / 正在运行 ${SERVER_VERSION} —— 需要重启宿主(不是重装)`)
|
|
1557
|
+
} else if (installed) {
|
|
1558
|
+
lines.push(`OK 版本一致:${SERVER_VERSION}`)
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1536
1561
|
// 0. 挂载状态:面板/HTTP 靠路由,路由注册失败时工具仍然可用 —— 这种「半死」状态
|
|
1537
1562
|
// 光看工具是发现不了的(2026-11-02 真机踩过:duplicate exact route 让六条接口全灭)
|
|
1538
1563
|
if (state.server) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.93",
|
|
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",
|