dsh-session-superagent 0.9.41 → 0.9.42
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 +26 -0
- package/README.md +1 -1
- package/client.js +1 -1
- package/lib/index.js +16 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
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.42] - 2026-11-02 —— `watch_status` 带上诊断字段,agent 能自诊
|
|
6
|
+
|
|
7
|
+
### 学到的(知识库第 90 条)
|
|
8
|
+
可观测性对 agent 同样重要:机器能查的,别让人截屏。
|
|
9
|
+
|
|
10
|
+
### 缺口
|
|
11
|
+
| 信息 | 面板 | watch_status(改前) |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| 为什么暂停(`deferReason`) | ✅ | ❌ |
|
|
14
|
+
| 叫醒后没回音几次(`silentWakes`) | ✅ | ❌ |
|
|
15
|
+
| 会话用量 / 上限 / 建议值 | ✅ | ❌ |
|
|
16
|
+
|
|
17
|
+
### 改法
|
|
18
|
+
每条守多输出 `defer=<原因码>` `silent=N`,末尾加会话汇总行:
|
|
19
|
+
```
|
|
20
|
+
session: 12/12 wakes last hour,2 条守正因上限暂停,建议把会话上限调到 24
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 一个自己挖的坑
|
|
24
|
+
用模板字符串生成代码时 `'
|
|
25
|
+
'` 被写成真实换行,`node --check` 立刻报错。
|
|
26
|
+
**用脚本生成代码,生成后要马上 `node --check`。**
|
|
27
|
+
|
|
28
|
+
### 测试
|
|
29
|
+
- 新增 1 例(三个诊断字段 + 汇总行格式)。合计 **178 例**。
|
|
30
|
+
|
|
5
31
|
## [0.9.41] - 2026-11-02 —— `watch_start` 补齐面板已有的三项参数
|
|
6
32
|
|
|
7
33
|
### 学到的(知识库第 89 条)
|
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.9.
|
|
17
|
+
const CLIENT_VERSION = '0.9.42'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
package/lib/index.js
CHANGED
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
|
|
40
40
|
export const name = 'dsh-session-superagent'
|
|
41
41
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
42
|
-
export const SERVER_VERSION = '0.9.
|
|
42
|
+
export const SERVER_VERSION = '0.9.42'
|
|
43
43
|
export const inject = ['tools', 'agents', 'webServer']
|
|
44
44
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
45
45
|
const DEFAULT_SESSION_WAKES = 12
|
|
@@ -1991,13 +1991,17 @@ export function apply(ctx) {
|
|
|
1991
1991
|
|
|
1992
1992
|
ctx.tools.register(defineTool({
|
|
1993
1993
|
name: 'watch_status',
|
|
1994
|
-
description: 'Report active watchers with last poll, last wake and
|
|
1994
|
+
description: 'Report active watchers with last poll, last wake, last error, why a watcher is paused, and how much of the session wake budget is used. Read-only.',
|
|
1995
1995
|
parameters: {},
|
|
1996
1996
|
async execute() {
|
|
1997
1997
|
const state = readState()
|
|
1998
1998
|
const list = Object.values(state.watchers || {})
|
|
1999
1999
|
if (!list.length) return '(no watchers)'
|
|
2000
|
-
|
|
2000
|
+
const sessionId = list[0] && list[0].sessionId
|
|
2001
|
+
const sessionUsed = sessionWakesLastHour(list, sessionId)
|
|
2002
|
+
const cap = Number(list[0] && list[0].sessionMaxWakes) || DEFAULT_SESSION_WAKES
|
|
2003
|
+
const capped = countCapped(list)
|
|
2004
|
+
const body = list
|
|
2001
2005
|
.map((w) => {
|
|
2002
2006
|
const flags = []
|
|
2003
2007
|
if (w.observe === true) flags.push('observe')
|
|
@@ -2006,6 +2010,9 @@ export function apply(ctx) {
|
|
|
2006
2010
|
if (w.activeHours) flags.push('hours=' + w.activeHours)
|
|
2007
2011
|
if (w.filters && w.filters.labels && w.filters.labels.length) flags.push('labels=' + w.filters.labels.join(','))
|
|
2008
2012
|
if (w.filters && w.filters.onlyAssigned) flags.push('onlyAssigned')
|
|
2013
|
+
// 面板上有的诊断字段,工具输出也要有 —— agent 自诊时未必能看到面板
|
|
2014
|
+
if (w.deferReason) flags.push('defer=' + w.deferReason)
|
|
2015
|
+
if (Number(w.silentWakes) > 0) flags.push('silent=' + w.silentWakes)
|
|
2009
2016
|
if (w.lastDeferred) flags.push('deferred=' + JSON.stringify(String(w.lastDeferred).slice(0, 40)))
|
|
2010
2017
|
return [
|
|
2011
2018
|
w.repo, '→', w.sessionId,
|
|
@@ -2017,7 +2024,12 @@ export function apply(ctx) {
|
|
|
2017
2024
|
'| err=' + (w.lastError || '-'),
|
|
2018
2025
|
].filter(Boolean).join(' ')
|
|
2019
2026
|
})
|
|
2020
|
-
.join(
|
|
2027
|
+
.join(String.fromCharCode(10))
|
|
2028
|
+
const suggestion = suggestSessionCap({ used: sessionUsed, cap, capped })
|
|
2029
|
+
const summary = 'session: ' + sessionUsed + '/' + cap + ' wakes last hour'
|
|
2030
|
+
+ (capped > 0 ? ',' + capped + ' 条守正因上限暂停' : '')
|
|
2031
|
+
+ (suggestion ? ',建议把会话上限调到 ' + suggestion : '')
|
|
2032
|
+
return body + String.fromCharCode(10) + summary
|
|
2021
2033
|
},
|
|
2022
2034
|
}))
|
|
2023
2035
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.42",
|
|
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",
|