dsh-session-superagent 0.9.126 → 0.9.127
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 +31 -0
- package/README.md +2 -2
- package/client.js +5 -3
- package/lib/index.js +8 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
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.127] - 2026-11-03 —— 面板里的「默认值提示」改成从 `/state` 读
|
|
6
|
+
|
|
7
|
+
### 学到什么(出处)
|
|
8
|
+
JSON Schema 对 `default` 的定义正好是这个用法:
|
|
9
|
+
|
|
10
|
+
> The `default` keyword specifies a default value. … **Non-validation tools such as documentation generators
|
|
11
|
+
> or form generators may use this value to give hints to users about how to use a value.**
|
|
12
|
+
|
|
13
|
+
<https://json-schema.org/understanding-json-schema/reference/annotations>
|
|
14
|
+
|
|
15
|
+
也就是说:**默认值应当在数据里声明一次,由表单/文档去渲染,而不是两边各写一遍。**
|
|
16
|
+
|
|
17
|
+
### 现场(本轮扫描)
|
|
18
|
+
`client.js` 里写死的默认值有 3 处:
|
|
19
|
+
- 会话上限占位符 `12(1-60)`;
|
|
20
|
+
- 隔离保留天数占位符 `3(1-30)` 与提示"留空用默认 3 天";
|
|
21
|
+
- 术语表里「单条守每小时最多 **6** 次、整条会话 **12** 次」。
|
|
22
|
+
|
|
23
|
+
而真实默认值在 `lib/index.js`(`DEFAULT_SESSION_WAKES = 12`、`?? 6`、`?? 3`)。
|
|
24
|
+
改任一个,面板就开始说谎 —— 这正是 0.9.123 修过的那类问题,只是换了个位置。
|
|
25
|
+
|
|
26
|
+
### 改法
|
|
27
|
+
1. `lib/index.js` 抽出 `DEFAULT_WAKES_PER_HOUR = 6` / `DEFAULT_ISOLATE_KEEP_DAYS = 3`,并让读状态处复用它们;
|
|
28
|
+
2. `/state` 顶层新增 `defaults: { sessionMaxWakes, maxWakesPerHour, isolateKeepDays }`;
|
|
29
|
+
3. 面板三处提示改成读 `body.defaults`,缺省时才回落到 12/6/3。
|
|
30
|
+
|
|
31
|
+
### 测试
|
|
32
|
+
- 新增 1 例(服务端):`/state.defaults` 精确等于 `{ 12, 6, 3 }`;
|
|
33
|
+
- 新增 1 例(面板):defaults 缺省时也不能渲染出 `undefined`。
|
|
34
|
+
合计 **238 例**。
|
|
35
|
+
|
|
5
36
|
## [0.9.126] - 2026-11-03 —— 断路器下沉到 `run()`:一处生效,所有调用点都覆盖
|
|
6
37
|
|
|
7
38
|
### 为什么
|
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
|
|
|
@@ -123,7 +123,7 @@ dsh plugin install /path/to/dsh-session-superagent
|
|
|
123
123
|
## 开发
|
|
124
124
|
|
|
125
125
|
```sh
|
|
126
|
-
node --test #
|
|
126
|
+
node --test # 239 项单测
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
### 工具输出:文本给人和 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.127'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -905,6 +905,8 @@ window.__ModuleLoader__.load({
|
|
|
905
905
|
usePoll(load, POLL_MS)
|
|
906
906
|
|
|
907
907
|
const body = snap.body || {}
|
|
908
|
+
// 默认值提示从后端读:写死 12/3/6 会在常量变化后变成谎话(JSON Schema 的 default 也是这个用法)
|
|
909
|
+
const DEFAULTS = body.defaults || {}
|
|
908
910
|
const watchers = body.watchers || []
|
|
909
911
|
const sessionGoal = body.sessionGoal || null
|
|
910
912
|
const credentials = body.credentials || { token: 'none', sshKeyPath: 'none' }
|
|
@@ -1152,7 +1154,7 @@ window.__ModuleLoader__.load({
|
|
|
1152
1154
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.onlyAssigned, onChange: (v) => setDraft({ ...draft, onlyAssigned: v }), label: '只看已指派' }), '只处理已指派给人的条目'),
|
|
1153
1155
|
field('单次最多唤醒条数', h(Input, { value: draft.batchLimit || '', placeholder: '5(1-20)', onChange: (e) => setDraft({ ...draft, batchLimit: e.target.value }) })),
|
|
1154
1156
|
field('每小时最多唤醒次数', h(Input, { value: draft.maxWakesPerHour || '', placeholder: '6(1-60)', onChange: (e) => setDraft({ ...draft, maxWakesPerHour: e.target.value }) })),
|
|
1155
|
-
field('这条会话每小时最多被唤醒', h(Input, { value: draft.sessionMaxWakes || '', placeholder: '
|
|
1157
|
+
field('这条会话每小时最多被唤醒', h(Input, { value: draft.sessionMaxWakes || '', placeholder: String(DEFAULTS.sessionMaxWakes || 12) + '(1-60)', onChange: (e) => setDraft({ ...draft, sessionMaxWakes: e.target.value }) }), '跨所有守累计:守 5 个仓库时,光有单守上限挡不住叠加'),
|
|
1156
1158
|
field('优先级(一次只处理 N 条时先挑谁)', h('div', { className: 'dt-actions' },
|
|
1157
1159
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityReopened !== false, onChange: (v) => setDraft({ ...draft, priorityReopened: v }), label: '重开优先' }), '被重开的排最前'),
|
|
1158
1160
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: draft.priorityComments !== false, onChange: (v) => setDraft({ ...draft, priorityComments: v }), label: '评论优先' }), '有人在等回应的靠前'),
|
|
@@ -1162,7 +1164,7 @@ window.__ModuleLoader__.load({
|
|
|
1162
1164
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.observe, onChange: (v) => setDraft({ ...draft, observe: v }), label: '仅观察' }), '仅观察(只记录不唤醒)'),
|
|
1163
1165
|
h('label', { className: 'dt-switch-row' }, h(Toggle, { checked: !!draft.isolated, onChange: (v) => setDraft({ ...draft, isolated: v }), label: '隔离执行' }), ISOLATED_HINT),
|
|
1164
1166
|
draft.isolated ? field('隔离工作目录', h(Input, { value: draft.workdir || '', placeholder: '绝对路径,留空 = 当前工作目录', onChange: (e) => setDraft({ ...draft, workdir: e.target.value }) })) : null,
|
|
1165
|
-
draft.isolated ? field('隔离区保留天数', h(Input, { value: draft.isolateKeepDays || '', placeholder: '
|
|
1167
|
+
draft.isolated ? field('隔离区保留天数', h(Input, { value: draft.isolateKeepDays || '', placeholder: String(DEFAULTS.isolateKeepDays || 3) + '(1-30)', onChange: (e) => setDraft({ ...draft, isolateKeepDays: e.target.value }) }), '每次唤醒前回收这个天数之前的一次性工作区;留空用默认 ' + (DEFAULTS.isolateKeepDays || 3) + ' 天') : null,
|
|
1166
1168
|
draft.isolated ? field('最多保留几个隔离区', h(Input, { value: draft.maxIsolated || '', placeholder: '5(1-50)', onChange: (e) => setDraft({ ...draft, maxIsolated: e.target.value }) }), '天数之外的第二道线:超出就回收最旧的(不影响正在用的那个)') : null,
|
|
1167
1169
|
h('div', { className: 'dt-actions' },
|
|
1168
1170
|
h(Btn, { size: 'sm', variant: 'primary', onClick: () => saveEdit(watcher) }, '保存'),
|
package/lib/index.js
CHANGED
|
@@ -40,7 +40,7 @@ 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.127'
|
|
44
44
|
export const inject = ['tools', 'agents', 'webServer']
|
|
45
45
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
46
46
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -56,6 +56,10 @@ const UNCHANGED_TEXT = '未变化(304,不计入速率限制)'
|
|
|
56
56
|
const noTraceText = (number, scope) => '#' + number + ' 在' + (scope || '所有守') + ' 里都没有痕迹 —— 可能还没被轮询到,或者编号写错了。'
|
|
57
57
|
|
|
58
58
|
const DEFAULT_SESSION_WAKES = 12
|
|
59
|
+
// 面板里的「默认值提示」也要从这里来:JSON Schema 的 default 就是给表单做提示用的
|
|
60
|
+
// 出处:https://json-schema.org/understanding-json-schema/reference/annotations
|
|
61
|
+
const DEFAULT_WAKES_PER_HOUR = 6
|
|
62
|
+
const DEFAULT_ISOLATE_KEEP_DAYS = 3
|
|
59
63
|
// 一条会话最多挂多少守:再多轮询压力与上下文都会失控(20 条 × 每 60 秒已很密)
|
|
60
64
|
const MAX_WATCHERS_PER_SESSION = 20
|
|
61
65
|
/** 隔离区回收的最小间隔:没有超额时不必每次唤醒都跑 git。 */
|
|
@@ -1386,7 +1390,7 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
1386
1390
|
lastError: w.lastError ?? null,
|
|
1387
1391
|
filters: w.filters ?? null,
|
|
1388
1392
|
batchLimit: w.batchLimit ?? 5,
|
|
1389
|
-
maxWakesPerHour: w.maxWakesPerHour ??
|
|
1393
|
+
maxWakesPerHour: w.maxWakesPerHour ?? DEFAULT_WAKES_PER_HOUR,
|
|
1390
1394
|
sessionMaxWakes: w.sessionMaxWakes ?? 12,
|
|
1391
1395
|
consecutiveFailures: w.consecutiveFailures ?? 0,
|
|
1392
1396
|
nextAt: w.nextAt ?? null,
|
|
@@ -1401,7 +1405,7 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
1401
1405
|
workdir: w.workdir ?? null,
|
|
1402
1406
|
lastWorktree: w.lastWorktree ?? null,
|
|
1403
1407
|
activeHours: w.activeHours ?? null,
|
|
1404
|
-
isolateKeepDays: w.isolateKeepDays ??
|
|
1408
|
+
isolateKeepDays: w.isolateKeepDays ?? DEFAULT_ISOLATE_KEEP_DAYS,
|
|
1405
1409
|
maxIsolated: w.maxIsolated ?? 5,
|
|
1406
1410
|
history: (w.history ?? []).slice(-5),
|
|
1407
1411
|
events: (w.events ?? []).slice(-perWatcherEvents),
|
|
@@ -1444,6 +1448,7 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
1444
1448
|
isolation: isolationReport(Object.values(state.watchers || {})),
|
|
1445
1449
|
sessionTitle: sessionTitle(focusSession),
|
|
1446
1450
|
retryPolicy: { budgetAttempts: RETRY_BUDGET_ATTEMPTS, slowCapMinutes: RETRY_SLOW_CAP_MINUTES },
|
|
1451
|
+
defaults: { sessionMaxWakes: DEFAULT_SESSION_WAKES, maxWakesPerHour: DEFAULT_WAKES_PER_HOUR, isolateKeepDays: DEFAULT_ISOLATE_KEEP_DAYS },
|
|
1447
1452
|
watchers: watchers.map((w) => ({ ...w, goal: goalView(ctx, w.sessionId) })),
|
|
1448
1453
|
}
|
|
1449
1454
|
// ETag/304:面板每 5 秒拉一次 /state,没变化时没必要重传整份 JSON ——
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.127",
|
|
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",
|