dsh-session-superagent 0.8.30 → 0.8.31
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 +20 -0
- package/README.md +1 -1
- package/client.js +1 -1
- package/lib/index.js +9 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
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.31] - 2026-11-02 —— 上下文已释放时,别再默默造一条死守
|
|
6
|
+
|
|
7
|
+
0.8.30 之后真机仍在报 `inactive context`(`server.at` 已经更新到 20:08,说明新实例挂上了),
|
|
8
|
+
结论是:**宿主重载后旧实例的 handler 仍然在吃 HTTP 请求**,而那条路径跑在已 dispose 的 ctx 里。
|
|
9
|
+
插件侧摘不掉它(这正是宿主的路由表行为,不是我们能改的)。
|
|
10
|
+
|
|
11
|
+
那就换一个策略:**别再装作成功**。
|
|
12
|
+
|
|
13
|
+
### 新增
|
|
14
|
+
`POST /watch` 在创建前先检查这个实例还能不能摸到 `agents` 服务;摸不到就返回
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
503 {"ok":false,"error":"插件实例已失效(当前 handler 跑在已释放的上下文里):请重载 DSH 后再添加"}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
用户会立刻看到"要重载",而不是加了一条守、第二天发现它从没跑过。
|
|
21
|
+
|
|
22
|
+
### 测试
|
|
23
|
+
- 新增用例:ctx 读 `agents` 就抛且 `get('agents')` 也取不到时,`POST /watch` 必须返回 503 且提示重载。合计 **93 例**。
|
|
24
|
+
|
|
5
25
|
## [0.8.30] - 2026-11-02 —— 0.8.28 没修好:宿主重载是「重新 import 一份模块」
|
|
6
26
|
|
|
7
27
|
### 真机判定实验(20:00 重载后,routes 6 / failed [])
|
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.31'
|
|
18
18
|
const BASE = '/session-superagent'
|
|
19
19
|
const ENDPOINT = BASE + '/state'
|
|
20
20
|
const POLL_MS = 5000
|
package/lib/index.js
CHANGED
|
@@ -763,6 +763,15 @@ export function apply(ctx) {
|
|
|
763
763
|
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo)) return json(res, 400, { error: 'repo must be owner/name' })
|
|
764
764
|
const sessionId = String(body.sessionId || '').trim()
|
|
765
765
|
if (!sessionId) return json(res, 400, { error: 'sessionId is required (open the panel in the session that should be woken)' })
|
|
766
|
+
// 若这个实例的 ctx 已经 dispose(宿主重载后旧 handler 仍在服务请求),
|
|
767
|
+
// 建出来的 watcher 一定跑不起来(定时器一 tick 就 inactive context)。
|
|
768
|
+
// 与其静默造一条死守,不如直接拒绝并让用户重载宿主。
|
|
769
|
+
const agentsHere = agentsService(ctx)
|
|
770
|
+
const canReachSessions = agentsHere && typeof agentsHere.get === 'function'
|
|
771
|
+
if (!canReachSessions) {
|
|
772
|
+
json(res, 503, { ok: false, error: '插件实例已失效(当前 handler 跑在已释放的上下文里):请重载 DSH 后再添加' })
|
|
773
|
+
return
|
|
774
|
+
}
|
|
766
775
|
const intervalSec = Math.max(30, Math.min(3600, Number(body.intervalSec) || 60))
|
|
767
776
|
const state = readState()
|
|
768
777
|
state.watchers = state.watchers || {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.31",
|
|
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",
|