dsh-session-superagent 0.9.256 → 0.9.257
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 +3 -3
- package/client.js +1 -1
- package/lib/index.js +18 -3
- 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.257] - 2026-11-05 —— 同一个字段,两条路径两种校验
|
|
6
|
+
|
|
7
|
+
T40 剩下的两条「值得修」落地。
|
|
8
|
+
|
|
9
|
+
### ① HTTP 路径不校验 `activeHours`
|
|
10
|
+
|
|
11
|
+
工具路径 0.9.235 就拒绝了非法格式,而 `/watch`(面板)一直**原样收下**。
|
|
12
|
+
于是面板填 `9-23` → 静默变成「全天有效」,回执照样打 `[activeHours=9-23]`。
|
|
13
|
+
|
|
14
|
+
现在两条路径走同一个 `validateActiveHours()`,非法格式直接 400 + 说明正确写法。
|
|
15
|
+
|
|
16
|
+
### ② `watch_start` 恢复暂停的守,以前一句话都不说
|
|
17
|
+
|
|
18
|
+
只想给一条暂停的守加个标签,`watch_start` 却把它**悄悄恢复**了。
|
|
19
|
+
守恢复 = 又开始轮询、又开始叫醒 —— 这是个不该静默发生的状态变化。
|
|
20
|
+
|
|
21
|
+
保留「幂等恢复」语义,但:
|
|
22
|
+
|
|
23
|
+
- 回执里必须写「这条之前是暂停的,这次调用已恢复」;
|
|
24
|
+
- 新增 `resume: false`:只改配置、**保持暂停**(回执也会说明)。
|
|
25
|
+
|
|
26
|
+
### 用例踩到一个桩的坑
|
|
27
|
+
|
|
28
|
+
`makeReq()` 里 `Buffer.from(body)`:传**对象**会在 microtask 里抛异常,
|
|
29
|
+
`end` 事件永远不发 → handler 一直等请求体 → 整个用例**挂到超时**,
|
|
30
|
+
而且报错只有一句 `'test failed'`,指不出是哪一条。
|
|
31
|
+
|
|
32
|
+
排查用了「单独跑这一个用例 + 最小探针」两步定位。已改用 `JSON.stringify()`。
|
|
33
|
+
|
|
34
|
+
### 证据
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
npm test → 401/401(新增:面板非法时段要 400;恢复必须说 / resume:false 保持暂停)
|
|
38
|
+
```
|
|
39
|
+
|
|
5
40
|
## [0.9.256] - 2026-11-05 —— 没有这三个数,「不打断」只是信念
|
|
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
|
[](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)
|
|
@@ -146,7 +146,7 @@ Gitee 私有仓库要在「设置 → 凭证」填私人令牌;公开仓库不
|
|
|
146
146
|
## 开发
|
|
147
147
|
|
|
148
148
|
```sh
|
|
149
|
-
npm test #
|
|
149
|
+
npm test # 401 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
### 工具输出:文本给人和 agent,JSON 给程序
|
|
@@ -206,7 +206,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
|
|
|
206
206
|
|
|
207
207
|
|
|
208
208
|
```bash
|
|
209
|
-
npm test #
|
|
209
|
+
npm test # 401 项单测(带离线开关,约 1.6 秒)
|
|
210
210
|
node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
|
|
211
211
|
node scripts/preflight.mjs # 40 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
|
|
212
212
|
node scripts/render-preview.mjs preview.html # 双主题静态预览,直接浏览器打开
|
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.257'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
package/lib/index.js
CHANGED
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
|
|
47
47
|
export const name = 'dsh-session-superagent'
|
|
48
48
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
49
|
-
export const SERVER_VERSION = '0.9.
|
|
49
|
+
export const SERVER_VERSION = '0.9.257'
|
|
50
50
|
export const inject = ['tools', 'agents', 'webServer']
|
|
51
51
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
52
52
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -2051,7 +2051,13 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2051
2051
|
if (body.isolateKeepDays != null) entry.isolateKeepDays = Math.max(1, Math.min(30, Number(body.isolateKeepDays) || 3))
|
|
2052
2052
|
// 同时最多留几个隔离区(越界回收最旧的)—— 1~50
|
|
2053
2053
|
if (body.maxIsolated != null) entry.maxIsolated = Math.max(1, Math.min(50, Number(body.maxIsolated) || 5))
|
|
2054
|
-
if (typeof body.activeHours === 'string')
|
|
2054
|
+
if (typeof body.activeHours === 'string') {
|
|
2055
|
+
// 审核 T40:工具路径 0.9.235 就拒绝了非法格式,HTTP 路径却一直**原样收下** ——
|
|
2056
|
+
// 于是面板填 `9-23` 会静默变成「全天有效」,而回执还打着 [activeHours=9-23]。
|
|
2057
|
+
const hoursCheck = validateActiveHours(body.activeHours)
|
|
2058
|
+
if (!hoursCheck.ok) return json(res, 400, { error: hoursCheck.reason })
|
|
2059
|
+
entry.activeHours = hoursCheck.normalized || null
|
|
2060
|
+
}
|
|
2055
2061
|
if (typeof body.workdir === 'string' && body.workdir.trim()) {
|
|
2056
2062
|
const workdir = body.workdir.trim()
|
|
2057
2063
|
if (!isAbsolute(workdir)) return json(res, 400, { error: 'workdir must be an absolute path' })
|
|
@@ -2785,6 +2791,7 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2785
2791
|
isolated: { type: 'boolean', description: 'Run each wake in a throwaway git worktree.' },
|
|
2786
2792
|
workdir: { type: 'string', description: 'Repository used for isolation worktrees (absolute path).' },
|
|
2787
2793
|
activeHours: { type: 'string', description: 'Wake only inside this window, e.g. "09:00-23:00" (supports overnight).' },
|
|
2794
|
+
resume: { type: 'boolean', description: 'Only when the watcher is paused: resume it (default true). Pass false to change config while keeping it paused.' },
|
|
2788
2795
|
format: { type: 'string', description: "'text' (default) or 'json'." },
|
|
2789
2796
|
batchLimit: { type: 'number', description: 'Max items listed per wake (1-20, default 5).' },
|
|
2790
2797
|
maxWakesPerHour: { type: 'number', description: 'Max wakes per hour per watcher (1-60, default 6).' },
|
|
@@ -2868,7 +2875,13 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2868
2875
|
if (typeof args.isolateKeepDays === 'number') entry.isolateKeepDays = Math.max(1, Math.min(30, Math.round(args.isolateKeepDays)))
|
|
2869
2876
|
if (typeof args.maxIsolated === 'number') entry.maxIsolated = Math.max(1, Math.min(50, Math.round(args.maxIsolated)))
|
|
2870
2877
|
if (typeof args.ackLabel === 'string' && args.ackLabel.trim()) entry.ackLabel = args.ackLabel.trim().slice(0, 60)
|
|
2871
|
-
|
|
2878
|
+
// 审核 T40 W12:`watch_start` 的语义是「开始看」,但**静默恢复**一条暂停的守是意外行为。
|
|
2879
|
+
// 保留恢复语义(幂等),但两件事必须做到:
|
|
2880
|
+
// ① 如果调用方显式传了 resume:false,就保持原暂停状态(只改配置);
|
|
2881
|
+
// ② 回执里必须说明「这条之前是暂停的,这次恢复了」—— 不许静默。
|
|
2882
|
+
const wasPaused = existing && existing.enabled === false
|
|
2883
|
+
const keepPaused = args.resume === false && wasPaused
|
|
2884
|
+
entry.enabled = !keepPaused
|
|
2872
2885
|
state.watchers = state.watchers || {}
|
|
2873
2886
|
if (!existing) {
|
|
2874
2887
|
// 审核 T32 M3:以前数**全部**守(含已停用的),于是报错让用户「先 watch_stop」,
|
|
@@ -2884,6 +2897,8 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2884
2897
|
stopWatcher(id)
|
|
2885
2898
|
startWatcher(entry)
|
|
2886
2899
|
const flags = []
|
|
2900
|
+
if (wasPaused && entry.enabled) flags.push('这条之前是暂停的,这次调用已恢复(只想改配置请传 resume: false)')
|
|
2901
|
+
if (wasPaused && !entry.enabled) flags.push('仍保持暂停(resume: false)')
|
|
2887
2902
|
if (entry.observe === true) flags.push('observe-only(只记录不唤醒)')
|
|
2888
2903
|
if (entry.isolated === true) flags.push('isolated')
|
|
2889
2904
|
if (entry.activeHours) flags.push('activeHours=' + entry.activeHours)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.257",
|
|
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",
|