dsh-session-superagent 0.9.90 → 0.9.92
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 +35 -0
- package/README.md +2 -2
- package/client.js +2 -2
- package/lib/index.js +19 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
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.92] - 2026-11-02 —— 一条会话最多 20 条守(批量请求整批校验)
|
|
6
|
+
|
|
7
|
+
### 为什么
|
|
8
|
+
之前没有上限:客户可以给一条会话挂 200 条守 —— 每条每 60 秒轮询,
|
|
9
|
+
`/state` 再压缩也挡不住真实的请求量与上下文压力。
|
|
10
|
+
|
|
11
|
+
### 改法
|
|
12
|
+
- `MAX_WATCHERS_PER_SESSION = 20`;
|
|
13
|
+
- 第 21 条被拒绝:`一条会话最多挂 20 条守(现在 20 条)—— 先 watch_stop 停掉不用的,或把多个仓库合成一条规则`;
|
|
14
|
+
- **批量请求整批校验**:19 条时一次加 2 条 → 整批拒绝并说明"这次要新增 2 条",不会只写进去第一条;
|
|
15
|
+
- 更新已有守不受上限影响。
|
|
16
|
+
|
|
17
|
+
### 过程中两次自我修正
|
|
18
|
+
1. 第一版只在"单条写入前"检查 → 批量时会出现**部分写入**;补了整批预校验;
|
|
19
|
+
2. 补丁把 `const applied = []` 和 `for` 挤到一行 → `SyntaxError`,`node --check` 当场拦下。
|
|
20
|
+
|
|
21
|
+
### 测试
|
|
22
|
+
- 新增 1 例:20 条为止、第 21 条被拦、19+2 整批拒绝且不写入、更新已有守不受影响。合计 **204 例**。
|
|
23
|
+
|
|
24
|
+
## [0.9.91] - 2026-11-02 —— 「最近 5 次唤醒」其实早就有,只是名字看不出来
|
|
25
|
+
|
|
26
|
+
### 先确认(结果和预期相反)
|
|
27
|
+
我准备给每条守加一个「最近 5 次唤醒」折叠区,写到一半发现**判定页的「判定日志」已经在显示这些**:
|
|
28
|
+
每轮的结果、跳过原因、条目编号全都在(`history` 取最近 5 条)。
|
|
29
|
+
|
|
30
|
+
所以:**这不是能力缺失,是命名问题** —— 标题写着"判定日志",客户不知道那就是"最近几次唤醒"。
|
|
31
|
+
|
|
32
|
+
### 改法
|
|
33
|
+
- 撤掉我刚加的重复区块(不留两份实现);
|
|
34
|
+
- 标题改成 **`判定日志(最近 5 次唤醒)`**;
|
|
35
|
+
- 用例改成锁"标题能看出这是最近几次",并继续断言条目与失败原因可见。
|
|
36
|
+
|
|
37
|
+
### 测试
|
|
38
|
+
新增 1 例。合计 **203 例**。
|
|
39
|
+
|
|
5
40
|
## [0.9.90] - 2026-11-02 —— 之前叫醒过的条目,消息里标出来
|
|
6
41
|
|
|
7
42
|
### 为什么
|
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
|
|
|
@@ -121,7 +121,7 @@ dsh plugin install /path/to/dsh-session-superagent
|
|
|
121
121
|
## 开发
|
|
122
122
|
|
|
123
123
|
```sh
|
|
124
|
-
node --test #
|
|
124
|
+
node --test # 204 项单测
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
### 工具输出:文本给人和 agent,JSON 给程序
|
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.
|
|
17
|
+
const CLIENT_VERSION = '0.9.92'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -1253,7 +1253,7 @@ window.__ModuleLoader__.load({
|
|
|
1253
1253
|
return Object.entries(merged).sort((a, b) => b[1] - a[1]).slice(0, 8)
|
|
1254
1254
|
})()
|
|
1255
1255
|
const judge = h(Section, {
|
|
1256
|
-
title: '
|
|
1256
|
+
title: '判定日志(最近 5 次唤醒)',
|
|
1257
1257
|
count: watchers.reduce((n, w) => n + (w.history || []).length, 0),
|
|
1258
1258
|
action: h(InfoTip, { text: '每轮判定都会记一条:唤醒、仅观察,或跳过及其原因。只存最近若干条。' }),
|
|
1259
1259
|
},
|
package/lib/index.js
CHANGED
|
@@ -40,10 +40,12 @@ import {
|
|
|
40
40
|
|
|
41
41
|
export const name = 'dsh-session-superagent'
|
|
42
42
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
43
|
-
export const SERVER_VERSION = '0.9.
|
|
43
|
+
export const SERVER_VERSION = '0.9.92'
|
|
44
44
|
export const inject = ['tools', 'agents', 'webServer']
|
|
45
45
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
46
46
|
const DEFAULT_SESSION_WAKES = 12
|
|
47
|
+
// 一条会话最多挂多少守:再多轮询压力与上下文都会失控(20 条 × 每 60 秒已很密)
|
|
48
|
+
const MAX_WATCHERS_PER_SESSION = 20
|
|
47
49
|
/** 隔离区回收的最小间隔:没有超额时不必每次唤醒都跑 git。 */
|
|
48
50
|
const CLEANUP_INTERVAL_MS = 10 * 60 * 1000
|
|
49
51
|
|
|
@@ -2075,6 +2077,12 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2075
2077
|
if (typeof args.maxIsolated === 'number') entry.maxIsolated = Math.max(1, Math.min(50, Math.round(args.maxIsolated)))
|
|
2076
2078
|
entry.enabled = true
|
|
2077
2079
|
state.watchers = state.watchers || {}
|
|
2080
|
+
if (!existing) {
|
|
2081
|
+
const mine = Object.values(state.watchers).filter((w) => w && w.sessionId === sessionId)
|
|
2082
|
+
if (mine.length >= MAX_WATCHERS_PER_SESSION) {
|
|
2083
|
+
return '一条会话最多挂 ' + MAX_WATCHERS_PER_SESSION + ' 条守(现在 ' + mine.length + ' 条)—— 先 watch_stop 停掉不用的,或把多个仓库合成一条规则'
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2078
2086
|
state.watchers[id] = entry
|
|
2079
2087
|
writeState(state)
|
|
2080
2088
|
stopWatcher(id)
|
|
@@ -2090,6 +2098,16 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2090
2098
|
if (entry.goal) flags.push('goal=' + JSON.stringify(entry.goal.slice(0, 40)))
|
|
2091
2099
|
return { entry, existing, flags, id, repo }
|
|
2092
2100
|
|
|
2101
|
+
}
|
|
2102
|
+
// 批量要整批校验:19 条时一次加 2 条,不能只加进去第一条
|
|
2103
|
+
{
|
|
2104
|
+
const snapshot = readState()
|
|
2105
|
+
const mine = Object.values(snapshot.watchers || {}).filter((w) => w && w.sessionId === sessionId)
|
|
2106
|
+
const incoming = repoList.filter((name) => !(snapshot.watchers || {})[name + '#' + sessionId])
|
|
2107
|
+
const room = MAX_WATCHERS_PER_SESSION - mine.length
|
|
2108
|
+
if (incoming.length > room) {
|
|
2109
|
+
return '一条会话最多挂 ' + MAX_WATCHERS_PER_SESSION + ' 条守(现在 ' + mine.length + ' 条,这次要新增 ' + incoming.length + ' 条)—— 先 watch_stop 停掉不用的,或把多个仓库合成一条规则'
|
|
2110
|
+
}
|
|
2093
2111
|
}
|
|
2094
2112
|
const applied = []
|
|
2095
2113
|
for (const name of repoList) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.92",
|
|
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",
|