dsh-session-superagent 0.8.33 → 0.8.34
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 +13 -0
- package/README.md +1 -1
- package/client.js +18 -4
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
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.34] - 2026-11-02 —— 前缀失效后自动重探,面板不会卡死
|
|
6
|
+
|
|
7
|
+
真机时间线:客户端 22:42 加载(当时活着的是 `/r2`),22:45 服务端换到 `/r3` 并**释放了 `/r2`** ——
|
|
8
|
+
于是面板手里的前缀失效,后续请求全部打空,除非手动刷新页面。
|
|
9
|
+
|
|
10
|
+
### 改法
|
|
11
|
+
`call()` 遇到「请求抛错」或「404」时,**重新探一次前缀再试一遍**(只重试一次,避免打转)。
|
|
12
|
+
|
|
13
|
+
这样每一代被接管后,面板自己就跟到新一代,不需要刷新页面。
|
|
14
|
+
|
|
15
|
+
### 测试
|
|
16
|
+
- 合计 **94 例**(该分支靠真机验证,单测的假 fetch 不会产生 404)。
|
|
17
|
+
|
|
5
18
|
## [0.8.33] - 2026-11-02 —— 客户端按版本挑「最新的那个服务端实例」
|
|
6
19
|
|
|
7
20
|
### 背景
|
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.34'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -48,11 +48,25 @@ window.__ModuleLoader__.load({
|
|
|
48
48
|
|
|
49
49
|
const POLL_MS = 5000
|
|
50
50
|
|
|
51
|
-
async function call(path, options) {
|
|
52
|
-
const
|
|
51
|
+
async function call(path, options, retried) {
|
|
52
|
+
const init = {
|
|
53
53
|
...(options || {}),
|
|
54
54
|
headers: { 'content-type': 'application/json', accept: 'application/json', ...((options && options.headers) || {}) },
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
|
+
let res
|
|
57
|
+
try {
|
|
58
|
+
res = await fetch(BASE + path, init)
|
|
59
|
+
} catch (error) {
|
|
60
|
+
// 前缀失效(这一代被新实例接管并释放了):重新探一次再试,还不行就把错抛出去
|
|
61
|
+
if (retried) throw error
|
|
62
|
+
await discoverBase()
|
|
63
|
+
return call(path, options, true)
|
|
64
|
+
}
|
|
65
|
+
// 旧前缀被释放后宿主会 404:同样重探一次
|
|
66
|
+
if (res.status === 404 && !retried) {
|
|
67
|
+
await discoverBase()
|
|
68
|
+
return call(path, options, true)
|
|
69
|
+
}
|
|
56
70
|
const text = await res.text()
|
|
57
71
|
let body = null
|
|
58
72
|
try { body = text ? JSON.parse(text) : null } catch { body = { raw: text } }
|
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.34'
|
|
34
34
|
export const inject = ['tools', 'agents', 'webServer']
|
|
35
35
|
|
|
36
36
|
const STATE_DIR = process.env.DSH_SUPERAGENT_STATE
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.34",
|
|
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",
|