dsh-session-superagent 0.9.234 → 0.9.235
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 +34 -0
- package/README.md +3 -3
- package/client.js +1 -1
- package/lib/index.js +11 -4
- package/lib/watch.js +24 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
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.235] - 2026-11-05 —— 时段写错会静默变成「全天有效」
|
|
6
|
+
|
|
7
|
+
### ① `activeHours` 格式不对时静默失效
|
|
8
|
+
|
|
9
|
+
`inActiveHours('9-23')` 的正则不匹配 → **直接 `return true`**(全天有效),
|
|
10
|
+
而 `watch_start` 的回执照样打 `[activeHours=9-23]`。
|
|
11
|
+
|
|
12
|
+
客户以为设了时段(晚上别叫我),实际**一直在叫**。这种错最难发现 —— 因为「看起来生效了」。
|
|
13
|
+
|
|
14
|
+
现在创建时先校验,不合法就拒绝并说清正确格式:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
watch_start({repo:'o/r', activeHours:'9-23'})
|
|
18
|
+
→ [error: activeHours 格式要写成 HH:MM-HH:MM(例如 09:00-23:00),收到的是「9-23」]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`9:00-25:00` 这类越界也拦,并说明「时要在 00-23」。
|
|
22
|
+
|
|
23
|
+
### ② `watch_start` 的描述只说 GitHub
|
|
24
|
+
|
|
25
|
+
实际支持 `gitee:` 前缀、gitee.com URL、以及用空格或逗号分隔的多个仓库。
|
|
26
|
+
描述里没写 = **模型永远不会用**。已补。
|
|
27
|
+
|
|
28
|
+
### ③ 文档里的 `batchLimit` 默认值写错了
|
|
29
|
+
|
|
30
|
+
`docs/competitive-analysis.md` 说默认 3,代码是 **5**(`DEFAULT_BATCH_LIMIT`)。已对齐。
|
|
31
|
+
|
|
32
|
+
### 证据
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
npm test → 378/378(新增:activeHours 格式校验 7 组输入)
|
|
36
|
+
check-docs → 5 项 PASS
|
|
37
|
+
```
|
|
38
|
+
|
|
5
39
|
## [0.9.234] - 2026-11-05 —— 多会话下报的是别人的额度;自称只读却写了文件
|
|
6
40
|
|
|
7
41
|
### ① `watch_status` 的 `session` 段取的是「第一条守的会话」
|
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 # 378 项单测(带离线开关;裸 node --test 会真去 spawn gh,两分半)
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
### 工具输出:文本给人和 agent,JSON 给程序
|
|
@@ -198,7 +198,7 @@ dsh plugin --profile <profile> add dsh-session-superagent@latest
|
|
|
198
198
|
## 验收(不用装宿主也能跑)
|
|
199
199
|
|
|
200
200
|
```bash
|
|
201
|
-
npm test #
|
|
201
|
+
npm test # 378 项单测(带离线开关,约 1.6 秒)
|
|
202
202
|
node scripts/ui-audit.mjs # 11 项 UI 指标(写死颜色 / 自造 token / 官方结构采用 …)
|
|
203
203
|
node scripts/preflight.mjs # 40 项门禁(含上面两条,外加 profile 一致性、路由面、包内容)
|
|
204
204
|
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.235'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
package/lib/index.js
CHANGED
|
@@ -39,11 +39,12 @@ import {
|
|
|
39
39
|
itemTrace,
|
|
40
40
|
splitBatch,
|
|
41
41
|
mergeFilters, mergePollResult, mergeWakeTexts, pushEvent, silentStreak, msUntilActiveWindow, nextWaketimeAt, pruneSeen, sessionWakesLastHour, pruneWakeTimes, pushHistory, recordReported, staleWorktrees, worktreePlan,
|
|
42
|
+
validateActiveHours,
|
|
42
43
|
} from './watch.js'
|
|
43
44
|
|
|
44
45
|
export const name = 'dsh-session-superagent'
|
|
45
46
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
46
|
-
export const SERVER_VERSION = '0.9.
|
|
47
|
+
export const SERVER_VERSION = '0.9.235'
|
|
47
48
|
export const inject = ['tools', 'agents', 'webServer']
|
|
48
49
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
49
50
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -2681,9 +2682,9 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2681
2682
|
|
|
2682
2683
|
ctx.tools.register(defineTool({
|
|
2683
2684
|
name: 'watch_start',
|
|
2684
|
-
description: 'Watch a
|
|
2685
|
+
description: 'Watch a repository and wake THIS session when its issues or pull requests change. Works with GitHub (owner/name) and Gitee (prefix with gitee:, e.g. gitee:owner/name; a gitee.com URL also works). Pass several repos in one call separated by spaces or commas to create several watchers at once. Idempotent per (repo, session). Default interval 60 s, minimum 30 s.',
|
|
2685
2686
|
parameters: {
|
|
2686
|
-
repo: { type: 'string', description: 'owner/name
|
|
2687
|
+
repo: { type: 'string', description: 'owner/name (GitHub) 或 gitee:owner/name(Gitee);多个用空格或逗号分隔。Omit to infer from the current working directory.' },
|
|
2687
2688
|
intervalSec: { type: 'number', description: 'Polling interval in seconds, clamped to 30-3600, default 60.' },
|
|
2688
2689
|
labels: { type: 'array', items: { type: 'string' }, description: 'Only handle items carrying one of these labels (whitelist).' },
|
|
2689
2690
|
ignoreLabels: { type: 'array', items: { type: 'string' }, description: 'Skip items carrying any of these labels.' },
|
|
@@ -2756,7 +2757,13 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2756
2757
|
if (!existsSync(workdir)) return toolError(args, 'workdir does not exist: ' + workdir)
|
|
2757
2758
|
entry.workdir = workdir
|
|
2758
2759
|
}
|
|
2759
|
-
|
|
2760
|
+
// 审核 T32:以前格式写错(`9-23`)会**静默变成全天有效**,回执照样打 [activeHours=9-23]。
|
|
2761
|
+
// 现在先校验,不合法就拒绝并说清正确格式 —— 宁可当场报错,也不要「以为设了其实没设」。
|
|
2762
|
+
if (typeof args.activeHours === 'string') {
|
|
2763
|
+
const hoursCheck = validateActiveHours(args.activeHours)
|
|
2764
|
+
if (!hoursCheck.ok) return toolError(args, 'activeHours ' + hoursCheck.reason)
|
|
2765
|
+
entry.activeHours = hoursCheck.normalized || null
|
|
2766
|
+
}
|
|
2760
2767
|
if (typeof args.batchLimit === 'number') entry.batchLimit = Math.max(1, Math.min(20, Math.round(args.batchLimit)))
|
|
2761
2768
|
if (typeof args.maxWakesPerHour === 'number') entry.maxWakesPerHour = Math.max(1, Math.min(60, Math.round(args.maxWakesPerHour)))
|
|
2762
2769
|
// 面板能改的三项,工具也要能改 —— 否则被问"把隔离区最多留 3 个"时 agent 无从下手
|
package/lib/watch.js
CHANGED
|
@@ -1281,3 +1281,27 @@ export function effectiveIntervalMs(entry, baseMs) {
|
|
|
1281
1281
|
const floor = (Number(entry && entry.minIntervalSec) || 0) * 1000
|
|
1282
1282
|
return Math.max(Number(baseMs) || 0, floor)
|
|
1283
1283
|
}
|
|
1284
|
+
|
|
1285
|
+
/**
|
|
1286
|
+
* `activeHours` 格式校验(审核 T32)。
|
|
1287
|
+
*
|
|
1288
|
+
* 以前格式写错(`9-23`、`09:00~23:00`、`9:00-25:00`)时 `inActiveHours` 直接 `return true` ——
|
|
1289
|
+
* **静默变成「全天有效」**,而工具回执照样打 `[activeHours=9-23]`。
|
|
1290
|
+
* 客户以为设了时段,实际一直开着。
|
|
1291
|
+
*
|
|
1292
|
+
* 现在创建时先校验:合法返回 `{ ok: true }`,不合法返回 `{ ok: false, reason }`,
|
|
1293
|
+
* 由调用方**拒绝**并说清正确格式。
|
|
1294
|
+
*/
|
|
1295
|
+
export function validateActiveHours(spec) {
|
|
1296
|
+
if (spec === null || spec === undefined || spec === '') return { ok: true, empty: true }
|
|
1297
|
+
const text = String(spec).trim()
|
|
1298
|
+
const m = text.match(/^(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})$/)
|
|
1299
|
+
if (!m) {
|
|
1300
|
+
return { ok: false, reason: '格式要写成 HH:MM-HH:MM(例如 09:00-23:00),收到的是「' + text + '」' }
|
|
1301
|
+
}
|
|
1302
|
+
const bad = [m[1], m[2], m[3], m[4]].map(Number)
|
|
1303
|
+
if (bad[0] > 23 || bad[2] > 23 || bad[1] > 59 || bad[3] > 59) {
|
|
1304
|
+
return { ok: false, reason: '时要在 00-23、分要在 00-59(格式 HH:MM-HH:MM,例如 09:00-23:00),收到的是「' + text + '」' }
|
|
1305
|
+
}
|
|
1306
|
+
return { ok: true, normalized: text }
|
|
1307
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.235",
|
|
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",
|