@xiangyixie/dsh-superagent 0.14.4 → 0.14.5
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 +25 -0
- package/README.en.md +8 -8
- package/README.md +12 -9
- package/README.zh.md +12 -9
- package/lib/doctor.js +1 -0
- package/lib/index.js +198 -219
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,31 @@ along with the next code release. A doc-only version leaves `lib/` and `bin/`
|
|
|
8
8
|
byte-identical to the version before it, and the pinned install line in the
|
|
9
9
|
README is updated to the version being released.
|
|
10
10
|
|
|
11
|
+
## 0.14.5 — 2026-11-16
|
|
12
|
+
|
|
13
|
+
这次只做一件事:把插件自己占的地方变小,能力一个不少。
|
|
14
|
+
|
|
15
|
+
### 变化
|
|
16
|
+
|
|
17
|
+
- **常驻开销降了 77%。** 每次请求都会带上插件的工具说明和一句引导语,这部分
|
|
18
|
+
从约 4,923 token 降到约 1,139 token(同一宿主、同一模型实测)。工具描述不再
|
|
19
|
+
写长篇使用手册,只留"什么时候该用它";详细说明放到工具真正被调用时返回。
|
|
20
|
+
- **常用工具直接可见,冷门能力按需展开。** 默认只声明 8 个常用工具:起 run、
|
|
21
|
+
查状态、列表、取消、恢复、追加指令、回答提问,以及 `superagent_help`。长期
|
|
22
|
+
目标、定时任务、实时插话、跨 run 笔记、模板、审计这 6 个不常用工具不会一
|
|
23
|
+
直占着上下文;需要时先调一次 `superagent_help`,它们在下一步自动出现在工具
|
|
24
|
+
列表里,会话按需记住这个状态。
|
|
25
|
+
- **引导语每个会话只出现一次。** 以前每个 turn 都会再塞一份,长会话里越来越
|
|
26
|
+
占地方;现在只在会话开始时注入一次,内容也缩短了。
|
|
27
|
+
|
|
28
|
+
### 对使用者的影响
|
|
29
|
+
|
|
30
|
+
- 工具名、参数、行为都没有变;已经在用的工作流照常跑。
|
|
31
|
+
- 需要定时任务、长期目标这类能力时,模型会自己先调 `superagent_help`,不需要
|
|
32
|
+
你额外提示;展开后用法与之前一致。
|
|
33
|
+
- 新增回归测试钉住"一次请求固定带上的工具定义 + 引导语"的上限,超了测试就
|
|
34
|
+
失败,避免以后又把开销涨回去。
|
|
35
|
+
|
|
11
36
|
## 0.14.4 — 2026-11-16
|
|
12
37
|
|
|
13
38
|
This release gives a goal a life longer than one run, and fixes a check that
|
package/README.en.md
CHANGED
|
@@ -27,7 +27,7 @@ filesystem; this is not a sandbox.
|
|
|
27
27
|
in the environment:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.
|
|
30
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.5
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Then ask the session for a run — a real call, not a sketch:
|
|
@@ -40,8 +40,8 @@ covers the path from an empty machine, including the reason not to install npm's
|
|
|
40
40
|
unrelated `dsh` package by name.
|
|
41
41
|
|
|
42
42
|
It adds no in-host UI (the workspace panel and the conversation console are
|
|
43
|
-
loopback pages) and patches no host code: the
|
|
44
|
-
surface, plus six optional operator utilities (a terminal panel, an HTML report,
|
|
43
|
+
loopback pages) and patches no host code: the fourteen `superagent_*` tools are the
|
|
44
|
+
surface (eight declared by default, six more expanded on demand), plus six optional operator utilities (a terminal panel, an HTML report,
|
|
45
45
|
an install doctor, a run archive, git sync, and the workspace panel) that read the
|
|
46
46
|
same run files. Browser and desktop control is a separate layer: with
|
|
47
47
|
`runtime.enabled` set, fourteen more tools are registered, and with the default
|
|
@@ -80,7 +80,7 @@ your `PATH`, use `npx @deepseek-ai/dsh@0.2.2-rc.1` instead.
|
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
82
|
# 1. install the plugin into a profile (web, headless, ... whatever you run)
|
|
83
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.
|
|
83
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.5
|
|
84
84
|
|
|
85
85
|
# 2. confirm the bundle row exists in the merged config
|
|
86
86
|
dsh --profile web --dump-config
|
|
@@ -101,8 +101,8 @@ The desktop app's **Add plugin** dialog accepts the same three forms:
|
|
|
101
101
|
|
|
102
102
|
| Dialog input | Value | What it does |
|
|
103
103
|
| --- | --- | --- |
|
|
104
|
-
| Package name | `@xiangyixie/dsh-superagent@0.14.
|
|
105
|
-
| GitHub repository | `https://github.com/LittleChenLiya/dsh-superagent` | Installs from the repository. Add `#v0.14.
|
|
104
|
+
| Package name | `@xiangyixie/dsh-superagent@0.14.5` | Installs from npm. Name the version (see below). |
|
|
105
|
+
| GitHub repository | `https://github.com/LittleChenLiya/dsh-superagent` | Installs from the repository. Add `#v0.14.5` if you need a fixed release. |
|
|
106
106
|
| Local directory | `file:/absolute/path/to/dsh-superagent` | Copies the checkout. Re-add after changing the source. |
|
|
107
107
|
|
|
108
108
|
Upgrading is remove-then-add, not in-place: remove the old copy
|
|
@@ -1306,7 +1306,7 @@ records the command plus a zero-external-reference audit.
|
|
|
1306
1306
|
does. It reads only: no install, no mount, no edit to the profile. One block per
|
|
1307
1307
|
check — imported files against the `files` whitelist, declared files against
|
|
1308
1308
|
what is on disk, the installed copy against the published tarball for its
|
|
1309
|
-
version, the profile's bundle registration, and the
|
|
1309
|
+
version, the profile's bundle registration, and the fourteen registered tools — each
|
|
1310
1310
|
failure followed by the command that fixes it.
|
|
1311
1311
|
|
|
1312
1312
|
```bash
|
|
@@ -1790,7 +1790,7 @@ appears to "hang" until the ignored-abort child returns.
|
|
|
1790
1790
|
|
|
1791
1791
|
| What you see | What it means | What to do |
|
|
1792
1792
|
| --- | --- | --- |
|
|
1793
|
-
| `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.
|
|
1793
|
+
| `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.5` and read the host log for `[dsh-superagent]` lines. |
|
|
1794
1794
|
| `Cannot find module .../lib/control.js` (or `watch.js` / `report.js` / `wizard.js`), or `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` in the host log | The copy in that profile is incomplete — an `add` that was interrupted leaves a partial extraction. From 0.14.3 the entry point names the missing file itself. The published package is not the cause: every version ships all thirty-four `lib/` files. | Delete the plugin's directory under the profile's `node_modules` (scoped `@xiangyixie/dsh-superagent`, or unscoped `dsh-superagent` from an older tarball install) and run the same `add` command again, with the version number. Do not copy files in by hand. |
|
|
1795
1795
|
| `[error] the model provider rejected the API key` | The key env var is missing in the process that started the host. | Export `DEEPSEEK_API_KEY` (the default route) or the variable your route names, then restart `dsh`. |
|
|
1796
1796
|
| `MISSING_CREDENTIAL ... no API key for provider route "..."` | The profile's route has no credential in the environment. | Set the env var named for that route and restart. The error line names the route, so use that, not this page. |
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
**以下情况不要用它**:一次模型调用就能答完的时候——那样你只是在为 planner 和 aggregator 额外付钱。必须在一轮之内结束的工作、中间需要人工审批的步骤、需要嵌套委派的任务(子 agent 深度上限为 1)、以及想要宿主内嵌面板的人,也不适合;下文那个可选的工作区面板是回环地址上的网页,不是宿主 UI。子 agent 运行时用的是宿主的凭据和文件系统,这里不是沙箱。
|
|
12
12
|
|
|
13
|
-
它不添加宿主内 UI
|
|
13
|
+
它不添加宿主内 UI(工作区面板和对话控制台都是回环页面),也不修改宿主代码:对外的接口就是十四个 `superagent_*` 工具(默认只声明其中 8 个,其余 6 个按需展开),另外还有六个可选的运维工具(终端面板、HTML 报告、安装自检、run 归档、git 同步、工作区面板),它们读的是同一批 run 文件。浏览器与桌面控制是独立的一层:设置 `runtime.enabled` 后会再注册十四个工具;默认值是 `false`,此时这些工具一个都不存在。
|
|
14
14
|
|
|
15
15
|
个人项目,与 DeepSeek 及 harness 维护方无关。MIT 许可,© 2026 Admire (LittleChenLiya);详见[许可证](#许可证)。
|
|
16
16
|
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
|
|
19
19
|
三种安装方式,`dsh plugin add` 和桌面应用的 **Add plugin** 对话框都接受:
|
|
20
20
|
|
|
21
|
-
- **npm 包名**:`@xiangyixie/dsh-superagent@0.14.
|
|
22
|
-
- **GitHub 仓库**:`https://github.com/LittleChenLiya/dsh-superagent`,从仓库安装。需要固定版本时加 `#v0.14.
|
|
21
|
+
- **npm 包名**:`@xiangyixie/dsh-superagent@0.14.5`,从 npm 安装。请写明版本号,原因见下文。
|
|
22
|
+
- **GitHub 仓库**:`https://github.com/LittleChenLiya/dsh-superagent`,从仓库安装。需要固定版本时加 `#v0.14.5`。
|
|
23
23
|
- **本地目录**:`file:/absolute/path/to/dsh-superagent`,拷贝本地 checkout。改过源码之后要重新 add 一次。
|
|
24
24
|
|
|
25
25
|
最常用的一条命令:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.
|
|
28
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.5
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
### 从插件索引安装(可选)
|
|
@@ -85,7 +85,7 @@ npx @deepseek-ai/dsh@0.2.2-rc.1 --version
|
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
87
|
# 1. install the plugin into a profile (web, headless, ... whatever you run)
|
|
88
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.
|
|
88
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.5
|
|
89
89
|
|
|
90
90
|
# 2. confirm the bundle row exists in the merged config
|
|
91
91
|
dsh --profile web --dump-config
|
|
@@ -95,8 +95,8 @@ dsh --profile web --dump-config
|
|
|
95
95
|
|
|
96
96
|
| 对话框中的栏目 | 填写值 | 作用 |
|
|
97
97
|
| --- | --- | --- |
|
|
98
|
-
| 包名(Package name) | `@xiangyixie/dsh-superagent@0.14.
|
|
99
|
-
| GitHub 仓库(GitHub repository) | `https://github.com/LittleChenLiya/dsh-superagent` | 从仓库安装。需要固定版本时加 `#v0.14.
|
|
98
|
+
| 包名(Package name) | `@xiangyixie/dsh-superagent@0.14.5` | 从 npm 安装。要写明版本号(见上文)。 |
|
|
99
|
+
| GitHub 仓库(GitHub repository) | `https://github.com/LittleChenLiya/dsh-superagent` | 从仓库安装。需要固定版本时加 `#v0.14.5`。 |
|
|
100
100
|
| 本地目录(Local directory) | `file:/absolute/path/to/dsh-superagent` | 拷贝本地 checkout。改过源码后需重新 add 一次。 |
|
|
101
101
|
|
|
102
102
|
安装的三种形式和升级方式见上文的[安装](#安装)一节。查一下 dump 里有没有下面这一段。如果没有,说明插件装了但没挂载,任何 `superagent_*` 工具都不会存在:
|
|
@@ -493,8 +493,11 @@ cost: ¥0.0952 + $0.0248 (estimate; all models priced)
|
|
|
493
493
|
|
|
494
494
|
## 工具
|
|
495
495
|
|
|
496
|
-
如果目标有两个及以上可独立交付的产物,或含“先做 A 才能做 B”的前置依赖,就用 `superagent_start`,不要用宿主自带的 `subagent` 自己编排:只有 run
|
|
496
|
+
如果目标有两个及以上可独立交付的产物,或含“先做 A 才能做 B”的前置依赖,就用 `superagent_start`,不要用宿主自带的 `subagent` 自己编排:只有 run 会留下计划、并行时序和一份合并报告。每个会话开始时只会收到一次同样意思的简短提示(不再每个 turn 重复),子会话不会收到。单一动作(一次查询、一次编辑、一条命令、一段短文本)不必起 run,直接做。
|
|
497
497
|
|
|
498
|
+
默认只声明 8 个常用工具(`superagent_start` / `status` / `list` / `cancel` / `resume` / `followup` / `answer` / `help`),这样每次请求固定带的工具说明很小。长期目标、定时任务、实时插话、跨 run 笔记、模板、审计这 6 个工具按需展开:先调用一次 `superagent_help`,它们会在下一步自动出现在工具列表里,本会话之后一直可用。
|
|
499
|
+
|
|
500
|
+
- `superagent_help()` 列出另外 6 个按需工具以及各自适用的场景,并为本会话展开它们。需要定时、长期目标、记忆、模板、审计或实时插话时先调用它。
|
|
498
501
|
- `superagent_start(goal, mode?, queue?, max_subtasks?, max_parallel?, deadline_minutes?, allow_duplicate?, wait_seconds?)`
|
|
499
502
|
启动一次 run 并立刻返回 run id。`mode: "direct"` 让一个 worker 直接跑这个 goal,不要 planner 也不要 aggregator,并把该 worker 的回复原样作为报告返回——适合一次自成一体的查询、修改、检索或短写作,不适合可以并行拆开的目标。默认的 `mode: "planned"` 走完整的 planner → worker → 合并报告流程。计划中的子任务可以声明 `dependsOn` 另一个子任务:依赖方会等它,并在自己的 prompt 里拿到它的报告,而彼此独立的子任务仍然并行。依赖成环会在任何工作开始前否掉整个计划,依赖一个计划从未声明的任务则以原因跳过。两种模式产出相同的 run 记录、配额、deadline、取消和用量记账。`goal_mode: true` 增加一步验收,并在失败的轮次重新规划;见 [Goal 模式](#goal-模式)。
|
|
500
503
|
`queue: true` 让 `maxActiveRuns` 占满时的启动改为等空位而不是失败:它返回 `status: "queued"` 以及
|
|
@@ -1149,7 +1152,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
|
|
|
1149
1152
|
|
|
1150
1153
|
| 你看到的 | 含义 | 怎么办 |
|
|
1151
1154
|
| --- | --- | --- |
|
|
1152
|
-
| `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.
|
|
1155
|
+
| `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.5` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
|
|
1153
1156
|
| `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
|
|
1154
1157
|
| `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
|
|
1155
1158
|
| `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
|
package/README.zh.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
**以下情况不要用它**:一次模型调用就能答完的时候——那样你只是在为 planner 和 aggregator 额外付钱。必须在一轮之内结束的工作、中间需要人工审批的步骤、需要嵌套委派的任务(子 agent 深度上限为 1)、以及想要宿主内嵌面板的人,也不适合;下文那个可选的工作区面板是回环地址上的网页,不是宿主 UI。子 agent 运行时用的是宿主的凭据和文件系统,这里不是沙箱。
|
|
12
12
|
|
|
13
|
-
它不添加宿主内 UI
|
|
13
|
+
它不添加宿主内 UI(工作区面板和对话控制台都是回环页面),也不修改宿主代码:对外的接口就是十四个 `superagent_*` 工具(默认只声明其中 8 个,其余 6 个按需展开),另外还有六个可选的运维工具(终端面板、HTML 报告、安装自检、run 归档、git 同步、工作区面板),它们读的是同一批 run 文件。浏览器与桌面控制是独立的一层:设置 `runtime.enabled` 后会再注册十四个工具;默认值是 `false`,此时这些工具一个都不存在。
|
|
14
14
|
|
|
15
15
|
个人项目,与 DeepSeek 及 harness 维护方无关。MIT 许可,© 2026 Admire (LittleChenLiya);详见[许可证](#许可证)。
|
|
16
16
|
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
|
|
19
19
|
三种安装方式,`dsh plugin add` 和桌面应用的 **Add plugin** 对话框都接受:
|
|
20
20
|
|
|
21
|
-
- **npm 包名**:`@xiangyixie/dsh-superagent@0.14.
|
|
22
|
-
- **GitHub 仓库**:`https://github.com/LittleChenLiya/dsh-superagent`,从仓库安装。需要固定版本时加 `#v0.14.
|
|
21
|
+
- **npm 包名**:`@xiangyixie/dsh-superagent@0.14.5`,从 npm 安装。请写明版本号,原因见下文。
|
|
22
|
+
- **GitHub 仓库**:`https://github.com/LittleChenLiya/dsh-superagent`,从仓库安装。需要固定版本时加 `#v0.14.5`。
|
|
23
23
|
- **本地目录**:`file:/absolute/path/to/dsh-superagent`,拷贝本地 checkout。改过源码之后要重新 add 一次。
|
|
24
24
|
|
|
25
25
|
最常用的一条命令:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.
|
|
28
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.5
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
### 从插件索引安装(可选)
|
|
@@ -85,7 +85,7 @@ npx @deepseek-ai/dsh@0.2.2-rc.1 --version
|
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
87
|
# 1. install the plugin into a profile (web, headless, ... whatever you run)
|
|
88
|
-
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.
|
|
88
|
+
dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.5
|
|
89
89
|
|
|
90
90
|
# 2. confirm the bundle row exists in the merged config
|
|
91
91
|
dsh --profile web --dump-config
|
|
@@ -95,8 +95,8 @@ dsh --profile web --dump-config
|
|
|
95
95
|
|
|
96
96
|
| 对话框中的栏目 | 填写值 | 作用 |
|
|
97
97
|
| --- | --- | --- |
|
|
98
|
-
| 包名(Package name) | `@xiangyixie/dsh-superagent@0.14.
|
|
99
|
-
| GitHub 仓库(GitHub repository) | `https://github.com/LittleChenLiya/dsh-superagent` | 从仓库安装。需要固定版本时加 `#v0.14.
|
|
98
|
+
| 包名(Package name) | `@xiangyixie/dsh-superagent@0.14.5` | 从 npm 安装。要写明版本号(见上文)。 |
|
|
99
|
+
| GitHub 仓库(GitHub repository) | `https://github.com/LittleChenLiya/dsh-superagent` | 从仓库安装。需要固定版本时加 `#v0.14.5`。 |
|
|
100
100
|
| 本地目录(Local directory) | `file:/absolute/path/to/dsh-superagent` | 拷贝本地 checkout。改过源码后需重新 add 一次。 |
|
|
101
101
|
|
|
102
102
|
安装的三种形式和升级方式见上文的[安装](#安装)一节。查一下 dump 里有没有下面这一段。如果没有,说明插件装了但没挂载,任何 `superagent_*` 工具都不会存在:
|
|
@@ -493,8 +493,11 @@ cost: ¥0.0952 + $0.0248 (estimate; all models priced)
|
|
|
493
493
|
|
|
494
494
|
## 工具
|
|
495
495
|
|
|
496
|
-
如果目标有两个及以上可独立交付的产物,或含“先做 A 才能做 B”的前置依赖,就用 `superagent_start`,不要用宿主自带的 `subagent` 自己编排:只有 run
|
|
496
|
+
如果目标有两个及以上可独立交付的产物,或含“先做 A 才能做 B”的前置依赖,就用 `superagent_start`,不要用宿主自带的 `subagent` 自己编排:只有 run 会留下计划、并行时序和一份合并报告。每个会话开始时只会收到一次同样意思的简短提示(不再每个 turn 重复),子会话不会收到。单一动作(一次查询、一次编辑、一条命令、一段短文本)不必起 run,直接做。
|
|
497
497
|
|
|
498
|
+
默认只声明 8 个常用工具(`superagent_start` / `status` / `list` / `cancel` / `resume` / `followup` / `answer` / `help`),这样每次请求固定带的工具说明很小。长期目标、定时任务、实时插话、跨 run 笔记、模板、审计这 6 个工具按需展开:先调用一次 `superagent_help`,它们会在下一步自动出现在工具列表里,本会话之后一直可用。
|
|
499
|
+
|
|
500
|
+
- `superagent_help()` 列出另外 6 个按需工具以及各自适用的场景,并为本会话展开它们。需要定时、长期目标、记忆、模板、审计或实时插话时先调用它。
|
|
498
501
|
- `superagent_start(goal, mode?, queue?, max_subtasks?, max_parallel?, deadline_minutes?, allow_duplicate?, wait_seconds?)`
|
|
499
502
|
启动一次 run 并立刻返回 run id。`mode: "direct"` 让一个 worker 直接跑这个 goal,不要 planner 也不要 aggregator,并把该 worker 的回复原样作为报告返回——适合一次自成一体的查询、修改、检索或短写作,不适合可以并行拆开的目标。默认的 `mode: "planned"` 走完整的 planner → worker → 合并报告流程。计划中的子任务可以声明 `dependsOn` 另一个子任务:依赖方会等它,并在自己的 prompt 里拿到它的报告,而彼此独立的子任务仍然并行。依赖成环会在任何工作开始前否掉整个计划,依赖一个计划从未声明的任务则以原因跳过。两种模式产出相同的 run 记录、配额、deadline、取消和用量记账。`goal_mode: true` 增加一步验收,并在失败的轮次重新规划;见 [Goal 模式](#goal-模式)。
|
|
500
503
|
`queue: true` 让 `maxActiveRuns` 占满时的启动改为等空位而不是失败:它返回 `status: "queued"` 以及
|
|
@@ -1149,7 +1152,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
|
|
|
1149
1152
|
|
|
1150
1153
|
| 你看到的 | 含义 | 怎么办 |
|
|
1151
1154
|
| --- | --- | --- |
|
|
1152
|
-
| `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.
|
|
1155
|
+
| `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.5` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
|
|
1153
1156
|
| `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
|
|
1154
1157
|
| `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
|
|
1155
1158
|
| `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
|
package/lib/doctor.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1255,16 +1255,19 @@ export function apply(ctx, config) {
|
|
|
1255
1255
|
// `superagent_start` next to the host's `subagent` tool can hand-orchestrate
|
|
1256
1256
|
// the work with the latter — three children, three report fragments, and no
|
|
1257
1257
|
// run, no plan, no merged report, and nothing in the run list to look at.
|
|
1258
|
-
// This nudge is the only thing that states the policy, so it is injected
|
|
1259
|
-
//
|
|
1258
|
+
// This nudge is the only thing that states the policy, so it is injected once
|
|
1259
|
+
// per session, at the first step of a top-level session: repeating it every
|
|
1260
|
+
// turn would put another copy in the history each time.
|
|
1260
1261
|
const GUIDANCE_SOURCE = { kind: 'superagent-guidance', form: 'notice', summary: '多步目标先起 run' }
|
|
1261
1262
|
const GUIDANCE_TEXT = [
|
|
1262
|
-
'
|
|
1263
|
-
'
|
|
1264
|
-
'
|
|
1265
|
-
'
|
|
1266
|
-
'只有单一动作(一次查找、一次编辑、一条命令、一段短文本)才直接做,不必起 run。',
|
|
1263
|
+
'多步目标(两个及以上可独立交付物,或含“先 A 后 B”的前置依赖)先用 superagent_start(mode="planned") 起 run,',
|
|
1264
|
+
'之后用 superagent_followup 续、superagent_status 读报告;不要用内置 subagent 自己编排,那样没有计划与合并报告。',
|
|
1265
|
+
'直接调用,先不要确认工具是否存在;只有返回不存在时才退回 subagent。单一动作直接做,不必起 run。',
|
|
1266
|
+
'长期目标、定时、跨 run 记忆、模板、审计、实时插话:先调 superagent_help 展开这些工具。',
|
|
1267
1267
|
].join('')
|
|
1268
|
+
// Session ids that already carry the notice in their history. Bounded so a
|
|
1269
|
+
// long-lived host cannot accumulate them without limit.
|
|
1270
|
+
const guidedSessions = new Set()
|
|
1268
1271
|
if (typeof ctx.on === 'function') {
|
|
1269
1272
|
ctx.on('agent/pre-step', async ({ agent, step }, next) => {
|
|
1270
1273
|
const decision = await next()
|
|
@@ -1273,6 +1276,12 @@ export function apply(ctx, config) {
|
|
|
1273
1276
|
if (!header) return decision
|
|
1274
1277
|
if ((header.delegationDepth ?? 0) > 0 || header.origin === 'subagent') return decision
|
|
1275
1278
|
if (decision.messages.some(message => message?.source?.kind === GUIDANCE_SOURCE.kind)) return decision
|
|
1279
|
+
const sessionId = sessionKey(agent)
|
|
1280
|
+
if (sessionId && guidedSessions.has(sessionId)) return decision
|
|
1281
|
+
if (sessionId) {
|
|
1282
|
+
if (guidedSessions.size >= 2000) guidedSessions.clear()
|
|
1283
|
+
guidedSessions.add(sessionId)
|
|
1284
|
+
}
|
|
1276
1285
|
const guidance = {
|
|
1277
1286
|
id: randomUUID(),
|
|
1278
1287
|
role: 'user',
|
|
@@ -1283,6 +1292,20 @@ export function apply(ctx, config) {
|
|
|
1283
1292
|
})
|
|
1284
1293
|
}
|
|
1285
1294
|
|
|
1295
|
+
// Every declaration is paid for on every request, so the capabilities most
|
|
1296
|
+
// sessions never touch are registered with a per-session activation
|
|
1297
|
+
// condition (see EXTRA_TOOLS): `superagent_help` names them and turns them on.
|
|
1298
|
+
const expandedSessions = new Set()
|
|
1299
|
+
const sessionKey = agent => {
|
|
1300
|
+
const header = agent?.session?.header
|
|
1301
|
+
return agent?.id ?? header?.id ?? header?.sessionId
|
|
1302
|
+
}
|
|
1303
|
+
const isExpanded = agent => Boolean(expandedSessions.has(sessionKey(agent)))
|
|
1304
|
+
// The host's contract is `tools.register(definition, { when })`: `when` is
|
|
1305
|
+
// evaluated for every step, and false keeps the tool out of that step's
|
|
1306
|
+
// declarations and dispatch.
|
|
1307
|
+
const EXTRA_TOOLS = { when: context => isExpanded(context?.agent) }
|
|
1308
|
+
|
|
1286
1309
|
// Runtime control is opt-in. With `runtime.enabled` false nothing below is
|
|
1287
1310
|
// registered, which is why a profile that never asked for browser or desktop
|
|
1288
1311
|
// access sees exactly the same tool list as before this layer existed.
|
|
@@ -2005,61 +2028,43 @@ export function apply(ctx, config) {
|
|
|
2005
2028
|
ctx.tools.register(defineTool({
|
|
2006
2029
|
name: 'superagent_start',
|
|
2007
2030
|
description:
|
|
2008
|
-
'Start
|
|
2009
|
-
+ '
|
|
2010
|
-
+ '
|
|
2011
|
-
+ '
|
|
2012
|
-
+ 'or aggregator, and its reply is the report verbatim — use it for one lookup, one edit, one query, or '
|
|
2013
|
-
+ 'one short piece of writing, not for a goal with parts that can be worked in parallel. '
|
|
2014
|
-
+ 'Prefer this over the built-in subagent tool whenever the goal has several deliverables or a '
|
|
2015
|
-
+ 'declared prerequisite step: only a run keeps the plan, the parallel timing, and one merged report. '
|
|
2016
|
-
+ 'The call returns immediately with a run id; poll it with superagent_status. Runs are persisted, '
|
|
2017
|
-
+ 'so they survive a host restart and can be resumed or cancelled.',
|
|
2031
|
+
'Start an autonomous run: a planner splits the goal into subtasks, independent ones run in parallel, and their '
|
|
2032
|
+
+ 'reports merge into one. Use it instead of the host subagent tool for goals with several deliverables or an '
|
|
2033
|
+
+ 'ordered prerequisite. Returns a run id; poll with superagent_status or pass wait_seconds. '
|
|
2034
|
+
+ 'mode "direct" runs one worker with no plan or merge.',
|
|
2018
2035
|
properties: {
|
|
2019
|
-
goal: { type: 'string', description: 'The complete goal
|
|
2036
|
+
goal: { type: 'string', description: 'The complete goal; be specific about the expected outcome.' },
|
|
2020
2037
|
mode: {
|
|
2021
2038
|
type: 'string',
|
|
2022
2039
|
enum: ['planned', 'direct'],
|
|
2023
|
-
description: 'planned (default):
|
|
2024
|
-
+ 'goal, with no planning or aggregation, and its reply is returned unchanged. Choose direct only when the '
|
|
2025
|
-
+ 'task is one self-contained pass that gains nothing from splitting.',
|
|
2040
|
+
description: 'planned (default): plan, parallel workers, merged report. direct: one worker, reply as-is.',
|
|
2026
2041
|
},
|
|
2027
2042
|
queue: {
|
|
2028
2043
|
type: 'boolean',
|
|
2029
|
-
description: '
|
|
2030
|
-
+ `status "queued" with its position, starts automatically when another run finishes, and gives up after `
|
|
2031
|
-
+ `queueTimeoutMinutes (default ${DEFAULTS.queueTimeoutMinutes}). Off by default; at most maxQueuedRuns `
|
|
2032
|
-
+ `(default ${DEFAULTS.maxQueuedRuns}) may wait.`,
|
|
2044
|
+
description: 'Wait for a free slot when the concurrency cap is reached, instead of failing.',
|
|
2033
2045
|
},
|
|
2034
2046
|
goal_mode: {
|
|
2035
2047
|
type: 'boolean',
|
|
2036
|
-
description: '
|
|
2037
|
-
+ 'acceptance step checks the acceptance conditions, and a failed round starts another one with what is '
|
|
2038
|
-
+ 'missing instead of repeating the same work. It stops when the goal is met, when max_rounds, '
|
|
2039
|
-
+ 'max_wall_clock_minutes or the budget is reached, or when consecutive rounds stop making progress. Off by '
|
|
2040
|
-
+ 'default, so a start without this flag behaves exactly as before.',
|
|
2048
|
+
description: 'Check acceptance conditions and start another round with what is missing until they hold.',
|
|
2041
2049
|
},
|
|
2042
2050
|
acceptance: {
|
|
2043
2051
|
type: 'array',
|
|
2044
|
-
description: '
|
|
2045
|
-
+ 'check is {"type":"command","command":"npm test"} (real exit code) or {"type":"file","path":"dist/app.js"} '
|
|
2046
|
-
+ '(existence); the plugin runs it, so the verdict is not the model\'s opinion. A condition without a check '
|
|
2047
|
-
+ 'is judged by an independent acceptance model, and status names the source of every verdict.',
|
|
2052
|
+
description: 'Required with goal_mode: conditions that decide whether the goal is met.',
|
|
2048
2053
|
items: {
|
|
2049
2054
|
type: 'object',
|
|
2050
2055
|
properties: {
|
|
2051
|
-
id: { type: 'string', description: 'Short id used in reports
|
|
2052
|
-
text: { type: 'string', description: 'What must hold
|
|
2056
|
+
id: { type: 'string', description: 'Short id used in reports.' },
|
|
2057
|
+
text: { type: 'string', description: 'What must hold.' },
|
|
2053
2058
|
check: {
|
|
2054
2059
|
type: 'object',
|
|
2055
|
-
description: 'Machine
|
|
2060
|
+
description: 'Machine check; omit to let an independent model judge it.',
|
|
2056
2061
|
properties: {
|
|
2057
2062
|
type: { type: 'string', enum: ['command', 'file'] },
|
|
2058
|
-
command: { type: 'string', description: 'Shell command
|
|
2059
|
-
cwd: { type: 'string', description: '
|
|
2063
|
+
command: { type: 'string', description: 'Shell command; exit code is the verdict.' },
|
|
2064
|
+
cwd: { type: 'string', description: 'Working directory, relative to the goal workspace.' },
|
|
2060
2065
|
timeout_seconds: { type: 'number', description: 'Command timeout (default 120, max 900).' },
|
|
2061
|
-
path: { type: 'string', description: 'File path
|
|
2062
|
-
must_exist: { type: 'boolean', description: '
|
|
2066
|
+
path: { type: 'string', description: 'File path, relative to the goal workspace.' },
|
|
2067
|
+
must_exist: { type: 'boolean', description: 'true (default) requires the file, false its absence.' },
|
|
2063
2068
|
},
|
|
2064
2069
|
required: ['type'],
|
|
2065
2070
|
},
|
|
@@ -2067,38 +2072,32 @@ export function apply(ctx, config) {
|
|
|
2067
2072
|
required: ['text'],
|
|
2068
2073
|
},
|
|
2069
2074
|
},
|
|
2070
|
-
max_rounds: { type: 'number', description: 'Goal mode: rounds
|
|
2071
|
-
max_wall_clock_minutes: {
|
|
2072
|
-
type: 'number',
|
|
2073
|
-
description: 'Goal mode: wall-clock budget for the rounds (default 60; a resume restarts it).',
|
|
2074
|
-
},
|
|
2075
|
+
max_rounds: { type: 'number', description: 'Goal mode: rounds before stopping (default 5, max 20).' },
|
|
2076
|
+
max_wall_clock_minutes: { type: 'number', description: 'Goal mode: wall-clock budget (default 60).' },
|
|
2075
2077
|
no_progress_rounds: {
|
|
2076
2078
|
type: 'number',
|
|
2077
|
-
description: 'Goal mode:
|
|
2078
|
-
+ 'the acceptance has a machine check, a round that changed no file stops immediately instead.',
|
|
2079
|
+
description: 'Goal mode: identical failing rounds before stopping (default 2).',
|
|
2079
2080
|
},
|
|
2080
2081
|
budget: {
|
|
2081
2082
|
type: 'object',
|
|
2082
|
-
description: 'Goal mode budget,
|
|
2083
|
+
description: 'Goal mode budget, inside the operator cap.',
|
|
2083
2084
|
properties: {
|
|
2084
2085
|
max_model_calls: { type: 'number' },
|
|
2085
2086
|
max_tokens: { type: 'number' },
|
|
2086
2087
|
},
|
|
2087
2088
|
},
|
|
2088
|
-
max_subtasks: { type: 'number', description: `
|
|
2089
|
-
max_parallel: { type: 'number', description: `Subtasks
|
|
2089
|
+
max_subtasks: { type: 'number', description: `Planned subtasks cap (default ${DEFAULTS.maxSubtasks}, max 16).` },
|
|
2090
|
+
max_parallel: { type: 'number', description: `Subtasks at once (default ${DEFAULTS.maxParallel}, max 8).` },
|
|
2090
2091
|
deadline_minutes: { type: 'number', description: `Wall-clock budget in minutes (default ${DEFAULTS.deadlineMinutes}).` },
|
|
2091
2092
|
allow_duplicate: {
|
|
2092
2093
|
type: 'boolean',
|
|
2093
|
-
description: 'Start a second run for the same goal
|
|
2094
|
-
+ 'By default the active run id is returned instead, so a retry cannot double the spend.',
|
|
2094
|
+
description: 'Start a second run for the same goal; default returns the active run id instead.',
|
|
2095
2095
|
},
|
|
2096
2096
|
approve_policy: {
|
|
2097
2097
|
type: 'boolean',
|
|
2098
|
-
description: 'Release a start
|
|
2099
|
-
+ 'recorded in the audit trail. It cannot override a policy that denies the start.',
|
|
2098
|
+
description: 'Release a start the permission policy holds for confirmation; it cannot override a deny.',
|
|
2100
2099
|
},
|
|
2101
|
-
wait_seconds: { type: 'number', description: 'Block up to this
|
|
2100
|
+
wait_seconds: { type: 'number', description: 'Block up to this long for a terminal status (default 0).' },
|
|
2102
2101
|
},
|
|
2103
2102
|
required: ['goal'],
|
|
2104
2103
|
async execute(args = {}, exec) {
|
|
@@ -2155,40 +2154,33 @@ export function apply(ctx, config) {
|
|
|
2155
2154
|
ctx.tools.register(defineTool({
|
|
2156
2155
|
name: 'superagent_goal',
|
|
2157
2156
|
description:
|
|
2158
|
-
'Run a long-term goal as
|
|
2159
|
-
+ '
|
|
2160
|
-
+ '
|
|
2161
|
-
+ 'persisted, so after a host restart it resumes the interrupted phase instead of starting over. A phase that '
|
|
2162
|
-
+ 'keeps failing, or a goal that stops making progress, opens a decision that a person answers with action '
|
|
2163
|
-
+ '"answer" — no goal-level question is guessed by the model. Per-phase and whole-goal model budgets are hard '
|
|
2164
|
-
+ 'stops. Use superagent_status/superagent_cancel on the phase run ids it reports. Prefer this over '
|
|
2165
|
-
+ 'superagent_start when the work has milestones that must happen in order over a long horizon.',
|
|
2157
|
+
'Run a long-term goal as ordered phases: each phase is its own run with planner and parallel workers, and later '
|
|
2158
|
+
+ 'phases receive earlier reports. A phase that keeps failing opens a decision a person answers with action '
|
|
2159
|
+
+ '"answer". Use it over superagent_start when milestones must happen in order over a long horizon.',
|
|
2166
2160
|
properties: {
|
|
2167
2161
|
action: {
|
|
2168
2162
|
type: 'string',
|
|
2169
2163
|
enum: ['create', 'status', 'list', 'answer', 'resume', 'pause', 'cancel'],
|
|
2170
|
-
description: 'create
|
|
2164
|
+
description: 'create, read one, list, answer an open decision, resume/pause/cancel.',
|
|
2171
2165
|
},
|
|
2172
|
-
goal_id: { type: 'string', description: '
|
|
2166
|
+
goal_id: { type: 'string', description: 'From action=create; required except for create/list.' },
|
|
2173
2167
|
goal: {
|
|
2174
2168
|
type: 'string',
|
|
2175
|
-
description: 'create: the complete long-term outcome
|
|
2169
|
+
description: 'create: the complete long-term outcome, concrete about the finished state.',
|
|
2176
2170
|
},
|
|
2177
2171
|
phases: {
|
|
2178
2172
|
type: 'array',
|
|
2179
|
-
description: 'create:
|
|
2180
|
-
+ '{id?, title, objective, depends_on?, acceptance?, max_rounds?, max_wall_clock_minutes?, deliverables?}. '
|
|
2181
|
-
+ 'acceptance uses the same {text, check?} shape as superagent_start; at least one condition per phase.',
|
|
2173
|
+
description: 'create: explicit phases; omit to let the phase planner split the goal.',
|
|
2182
2174
|
items: {
|
|
2183
2175
|
type: 'object',
|
|
2184
2176
|
properties: {
|
|
2185
|
-
id: { type: 'string', description: 'Short id, e.g. "p1";
|
|
2177
|
+
id: { type: 'string', description: 'Short id, e.g. "p1"; referenced by depends_on.' },
|
|
2186
2178
|
title: { type: 'string', description: 'Short name shown in the phase table.' },
|
|
2187
|
-
objective: { type: 'string', description: 'What this phase must produce
|
|
2179
|
+
objective: { type: 'string', description: 'What this phase must produce.' },
|
|
2188
2180
|
depends_on: {
|
|
2189
2181
|
type: 'array',
|
|
2190
2182
|
items: { type: 'string' },
|
|
2191
|
-
description: 'Phase ids that must complete
|
|
2183
|
+
description: 'Phase ids that must complete first; omit for independent phases.',
|
|
2192
2184
|
},
|
|
2193
2185
|
acceptance: {
|
|
2194
2186
|
type: 'array',
|
|
@@ -2213,25 +2205,24 @@ export function apply(ctx, config) {
|
|
|
2213
2205
|
required: ['text'],
|
|
2214
2206
|
},
|
|
2215
2207
|
},
|
|
2216
|
-
max_rounds: { type: 'number', description: '
|
|
2217
|
-
max_wall_clock_minutes: { type: 'number', description: 'Wall-clock cap
|
|
2218
|
-
deliverables: { type: 'array', items: { type: 'string' }, description: '
|
|
2208
|
+
max_rounds: { type: 'number', description: 'Retries before the phase stops (default 3).' },
|
|
2209
|
+
max_wall_clock_minutes: { type: 'number', description: 'Wall-clock cap (default 120).' },
|
|
2210
|
+
deliverables: { type: 'array', items: { type: 'string' }, description: 'Paths to report.' },
|
|
2219
2211
|
},
|
|
2220
2212
|
required: ['objective'],
|
|
2221
2213
|
},
|
|
2222
2214
|
},
|
|
2223
|
-
cwd: { type: 'string', description: 'Workspace every phase and
|
|
2224
|
-
max_parallel_phases: { type: 'number', description: 'Phases
|
|
2215
|
+
cwd: { type: 'string', description: 'Workspace for every phase and machine check (default cwd).' },
|
|
2216
|
+
max_parallel_phases: { type: 'number', description: 'Phases in flight at once (default 2, max 8).' },
|
|
2225
2217
|
max_attempts_per_phase: {
|
|
2226
2218
|
type: 'number',
|
|
2227
|
-
description: 'Attempts per phase before
|
|
2228
|
-
+ 'failure signature; an identical no-change failure stops earlier.',
|
|
2219
|
+
description: 'Attempts per phase before asking a person (default 2).',
|
|
2229
2220
|
},
|
|
2230
|
-
max_rounds_per_phase: { type: 'number', description: 'Default goal-mode rounds
|
|
2231
|
-
no_progress_rounds: { type: 'number', description: '
|
|
2221
|
+
max_rounds_per_phase: { type: 'number', description: 'Default goal-mode rounds per phase (default 3).' },
|
|
2222
|
+
no_progress_rounds: { type: 'number', description: 'Identical failing rounds before a phase stops (default 2).' },
|
|
2232
2223
|
phase_budget: {
|
|
2233
2224
|
type: 'object',
|
|
2234
|
-
description: 'Per-phase
|
|
2225
|
+
description: 'Per-phase hard cap, inside what remains of the goal budget.',
|
|
2235
2226
|
properties: {
|
|
2236
2227
|
max_model_calls: { type: 'number' },
|
|
2237
2228
|
max_tokens: { type: 'number' },
|
|
@@ -2239,30 +2230,29 @@ export function apply(ctx, config) {
|
|
|
2239
2230
|
},
|
|
2240
2231
|
budget: {
|
|
2241
2232
|
type: 'object',
|
|
2242
|
-
description: 'Whole-goal hard cap
|
|
2233
|
+
description: 'Whole-goal hard cap; reaching it stops the goal.',
|
|
2243
2234
|
properties: {
|
|
2244
2235
|
max_model_calls: { type: 'number' },
|
|
2245
2236
|
max_tokens: { type: 'number' },
|
|
2246
2237
|
},
|
|
2247
2238
|
},
|
|
2248
|
-
max_wall_clock_minutes: { type: 'number', description: 'Whole-goal wall-clock cap
|
|
2239
|
+
max_wall_clock_minutes: { type: 'number', description: 'Whole-goal wall-clock cap (default 1440).' },
|
|
2249
2240
|
stall_after_minutes: {
|
|
2250
2241
|
type: 'number',
|
|
2251
2242
|
description: 'No completed phase for this long opens a stall decision (default 180).',
|
|
2252
2243
|
},
|
|
2253
2244
|
auto_resume: {
|
|
2254
2245
|
type: 'boolean',
|
|
2255
|
-
description: 'Continue
|
|
2246
|
+
description: 'Continue after a host restart (default true); false leaves it paused.',
|
|
2256
2247
|
},
|
|
2257
|
-
decision_id: { type: 'string', description: 'answer:
|
|
2248
|
+
decision_id: { type: 'string', description: 'answer: id shown in action=status.' },
|
|
2258
2249
|
answer: {
|
|
2259
2250
|
type: 'string',
|
|
2260
|
-
description: 'answer:
|
|
2261
|
-
+ 'to dependents; stop ends the goal; continue resets a stall; answer (worker question) needs note.',
|
|
2251
|
+
description: 'answer: retry, skip, stop, continue, or answer (worker question, needs note).',
|
|
2262
2252
|
},
|
|
2263
2253
|
note: {
|
|
2264
2254
|
type: 'string',
|
|
2265
|
-
description: 'answer:
|
|
2255
|
+
description: 'answer: new instruction for retry, or the text for a worker question.',
|
|
2266
2256
|
},
|
|
2267
2257
|
limit: { type: 'number', description: 'list: maximum rows (default 20).' },
|
|
2268
2258
|
},
|
|
@@ -2356,7 +2346,7 @@ export function apply(ctx, config) {
|
|
|
2356
2346
|
return describeError(error)
|
|
2357
2347
|
}
|
|
2358
2348
|
},
|
|
2359
|
-
}))
|
|
2349
|
+
}), EXTRA_TOOLS)
|
|
2360
2350
|
|
|
2361
2351
|
// Files on disk can be newer than the code this host loaded: a package update
|
|
2362
2352
|
// only takes effect after DSH restarts. Surface the mismatch instead of
|
|
@@ -2377,11 +2367,11 @@ export function apply(ctx, config) {
|
|
|
2377
2367
|
ctx.tools.register(defineTool({
|
|
2378
2368
|
name: 'superagent_status',
|
|
2379
2369
|
description:
|
|
2380
|
-
'Read one
|
|
2381
|
-
+ '
|
|
2370
|
+
'Read one run: status, subtask outcomes, measured token usage, and the final report. wait_seconds blocks for a '
|
|
2371
|
+
+ 'terminal state.',
|
|
2382
2372
|
properties: {
|
|
2383
2373
|
run_id: { type: 'string', description: 'Run id returned by superagent_start.' },
|
|
2384
|
-
wait_seconds: { type: 'number', description: 'Block up to this
|
|
2374
|
+
wait_seconds: { type: 'number', description: 'Block up to this long for a terminal state (default 0).' },
|
|
2385
2375
|
},
|
|
2386
2376
|
required: ['run_id'],
|
|
2387
2377
|
async execute(args = {}) {
|
|
@@ -2399,9 +2389,9 @@ export function apply(ctx, config) {
|
|
|
2399
2389
|
|
|
2400
2390
|
ctx.tools.register(defineTool({
|
|
2401
2391
|
name: 'superagent_list',
|
|
2402
|
-
description: 'List recorded
|
|
2392
|
+
description: 'List recorded runs, newest first, with status and progress.',
|
|
2403
2393
|
properties: {
|
|
2404
|
-
limit: { type: 'number', description: 'Maximum rows
|
|
2394
|
+
limit: { type: 'number', description: 'Maximum rows (default 20).' },
|
|
2405
2395
|
},
|
|
2406
2396
|
async execute(args = {}) {
|
|
2407
2397
|
try {
|
|
@@ -2434,11 +2424,40 @@ export function apply(ctx, config) {
|
|
|
2434
2424
|
},
|
|
2435
2425
|
}))
|
|
2436
2426
|
|
|
2427
|
+
// Every declaration is paid for on every request, so the capabilities most
|
|
2428
|
+
// sessions never touch are registered behind a per-session activation
|
|
2429
|
+
// condition: `superagent_help` names them and turns them on for that session.
|
|
2430
|
+
ctx.tools.register(defineTool({
|
|
2431
|
+
name: 'superagent_help',
|
|
2432
|
+
description:
|
|
2433
|
+
'Show the extra superagent tools and when each applies: long-term goals, cron schedules, live steering, '
|
|
2434
|
+
+ 'cross-run memory, workflow templates, audit export. Call this before using any of them.',
|
|
2435
|
+
properties: {},
|
|
2436
|
+
async execute(_args, exec) {
|
|
2437
|
+
const check = requireAgent(exec)
|
|
2438
|
+
if (check.error) return check.error
|
|
2439
|
+
const id = sessionKey(check.agent)
|
|
2440
|
+
if (id) {
|
|
2441
|
+
if (expandedSessions.size >= 2000) expandedSessions.clear()
|
|
2442
|
+
expandedSessions.add(id)
|
|
2443
|
+
}
|
|
2444
|
+
return [
|
|
2445
|
+
'已展开,下一步起可用(参数见各自 schema):',
|
|
2446
|
+
'- superagent_goal: 长期目标按阶段推进,多里程碑或必须按序时用;action=create/status/list/answer/resume/pause/cancel',
|
|
2447
|
+
'- superagent_schedule: 定时或按间隔自动起 run;action=create/list/pause/resume/delete/run-now',
|
|
2448
|
+
'- superagent_inject: 给正在跑的 worker 立刻发指令;不着急就用 superagent_followup',
|
|
2449
|
+
'- superagent_memory: 跨 run 笔记;action=list/search/set/forget,layer="user" 读写用户级事实',
|
|
2450
|
+
'- superagent_template: 工作流模板;action=list/show/expand/save/delete,expand 出 goal 再 start',
|
|
2451
|
+
'- superagent_audit: 查询或导出审计流水(tool.call、path.write、blocked、审批等)',
|
|
2452
|
+
'不确定就先 action=list 或 superagent_status 看现状。',
|
|
2453
|
+
].join('\n')
|
|
2454
|
+
},
|
|
2455
|
+
}))
|
|
2456
|
+
|
|
2437
2457
|
ctx.tools.register(defineTool({
|
|
2438
2458
|
name: 'superagent_cancel',
|
|
2439
2459
|
description:
|
|
2440
|
-
'Cancel a
|
|
2441
|
-
+ 'so the partial work stays inspectable.',
|
|
2460
|
+
'Cancel a run: stops its subtasks and marks it cancelled; the state file stays inspectable.',
|
|
2442
2461
|
properties: {
|
|
2443
2462
|
run_id: { type: 'string', description: 'Run id to cancel.' },
|
|
2444
2463
|
},
|
|
@@ -2466,20 +2485,18 @@ export function apply(ctx, config) {
|
|
|
2466
2485
|
ctx.tools.register(defineTool({
|
|
2467
2486
|
name: 'superagent_resume',
|
|
2468
2487
|
description:
|
|
2469
|
-
'Resume
|
|
2470
|
-
+ '
|
|
2471
|
-
+ 'holds an answer that never reached a prompt, so its aggregation can apply the decision.',
|
|
2488
|
+
'Resume an interrupted, timed-out, or failed run: completed subtasks are kept, pending and failed ones run '
|
|
2489
|
+
+ 'again.',
|
|
2472
2490
|
properties: {
|
|
2473
2491
|
run_id: { type: 'string', description: 'Run id to resume.' },
|
|
2474
|
-
wait_seconds: { type: 'number', description: 'Block up to this
|
|
2492
|
+
wait_seconds: { type: 'number', description: 'Block up to this long for a terminal state (default 0).' },
|
|
2475
2493
|
force: {
|
|
2476
2494
|
type: 'boolean',
|
|
2477
|
-
description: '
|
|
2495
|
+
description: 'Ignored; kept so older callers still validate.',
|
|
2478
2496
|
},
|
|
2479
2497
|
approve_policy: {
|
|
2480
2498
|
type: 'boolean',
|
|
2481
|
-
description: 'Release a resume
|
|
2482
|
-
+ 'recorded in the audit trail. It cannot override a policy that denies the resume.',
|
|
2499
|
+
description: 'Release a resume the permission policy holds for confirmation.',
|
|
2483
2500
|
},
|
|
2484
2501
|
},
|
|
2485
2502
|
required: ['run_id'],
|
|
@@ -2513,11 +2530,8 @@ export function apply(ctx, config) {
|
|
|
2513
2530
|
ctx.tools.register(defineTool({
|
|
2514
2531
|
name: 'superagent_followup',
|
|
2515
2532
|
description:
|
|
2516
|
-
'Add an instruction to a run that is already executing
|
|
2517
|
-
+ '
|
|
2518
|
-
+ 'instruction is queued on the run and carried by the next prompt built for it — the next worker spawn or the '
|
|
2519
|
-
+ 'aggregation, whichever comes first. Subtasks that are already running or finished keep their results. The '
|
|
2520
|
-
+ 'reply states exactly which boundary it will reach.',
|
|
2533
|
+
'Add an instruction to a run that is already executing instead of starting a second one. It is queued and '
|
|
2534
|
+
+ 'carried by the next prompt built for the run; children already running are not interrupted.',
|
|
2521
2535
|
properties: {
|
|
2522
2536
|
run_id: { type: 'string', description: 'Run id returned by superagent_start.' },
|
|
2523
2537
|
message: { type: 'string', description: 'The instruction or constraint to add.' },
|
|
@@ -2550,23 +2564,18 @@ export function apply(ctx, config) {
|
|
|
2550
2564
|
ctx.tools.register(defineTool({
|
|
2551
2565
|
name: 'superagent_inject',
|
|
2552
2566
|
description:
|
|
2553
|
-
'Deliver an instruction into the workers
|
|
2554
|
-
+ '
|
|
2555
|
-
+ 'model request: it never interrupts a model call already in flight, and it arrives only after the current step '
|
|
2556
|
-
+ '(the model response plus its tool batch) finishes. A live child that had already decided to stop runs one more '
|
|
2557
|
-
+ 'turn to read it. The reply reports the measured delay from acceptance to the child\'s next request; a message '
|
|
2558
|
-
+ 'the child never claimed is reported as missed, never as delivered. Use superagent_followup when no worker is '
|
|
2559
|
-
+ 'running or the instruction can wait for the next prompt.',
|
|
2567
|
+
'Deliver an instruction into the workers running right now: it becomes part of each child\'s next model request, '
|
|
2568
|
+
+ 'at its next step boundary. Use superagent_followup when no worker is running.',
|
|
2560
2569
|
properties: {
|
|
2561
2570
|
run_id: { type: 'string', description: 'Run id returned by superagent_start.' },
|
|
2562
|
-
message: { type: 'string', description: 'The instruction
|
|
2571
|
+
message: { type: 'string', description: 'The instruction the running workers should read next.' },
|
|
2563
2572
|
subtask_index: {
|
|
2564
2573
|
type: 'number',
|
|
2565
|
-
description: '
|
|
2574
|
+
description: 'One worker, by its index from superagent_status; omit to reach every running worker.',
|
|
2566
2575
|
},
|
|
2567
2576
|
wait_seconds: {
|
|
2568
2577
|
type: 'number',
|
|
2569
|
-
description: 'Block up to this
|
|
2578
|
+
description: 'Block up to this long for the children to claim it, so the delay can be measured (default 0).',
|
|
2570
2579
|
},
|
|
2571
2580
|
},
|
|
2572
2581
|
required: ['run_id', 'message'],
|
|
@@ -2588,24 +2597,21 @@ export function apply(ctx, config) {
|
|
|
2588
2597
|
return describeError(error)
|
|
2589
2598
|
}
|
|
2590
2599
|
},
|
|
2591
|
-
}))
|
|
2600
|
+
}), EXTRA_TOOLS)
|
|
2592
2601
|
|
|
2593
2602
|
ctx.tools.register(defineTool({
|
|
2594
2603
|
name: 'superagent_answer',
|
|
2595
2604
|
description:
|
|
2596
|
-
'Answer
|
|
2597
|
-
+ '
|
|
2598
|
-
+ 'is reopened and only its aggregation runs again, now with the answer. The answer is matched to one specific '
|
|
2599
|
-
+ 'question: an unknown, already answered, or expired question is refused instead of being attached to whatever '
|
|
2600
|
-
+ 'is open.',
|
|
2605
|
+
'Answer the question a run asked (the qN item in superagent_status), so that run continues instead of a new one '
|
|
2606
|
+
+ 'starting. An active run applies it at its next boundary; a finished run is reopened for aggregation.',
|
|
2601
2607
|
properties: {
|
|
2602
2608
|
run_id: { type: 'string', description: 'Run id returned by superagent_start.' },
|
|
2603
2609
|
attention_id: {
|
|
2604
2610
|
type: 'string',
|
|
2605
|
-
description: 'Question id from superagent_status, e.g. q1
|
|
2611
|
+
description: 'Question id from superagent_status, e.g. q1; required when several are open.',
|
|
2606
2612
|
},
|
|
2607
|
-
answer: { type: 'string', description: 'The decision
|
|
2608
|
-
wait_seconds: { type: 'number', description: 'Block up to this
|
|
2613
|
+
answer: { type: 'string', description: 'The decision; a listed option or free text.' },
|
|
2614
|
+
wait_seconds: { type: 'number', description: 'Block up to this long for the run to settle (default 0).' },
|
|
2609
2615
|
},
|
|
2610
2616
|
required: ['run_id', 'answer'],
|
|
2611
2617
|
async execute(args = {}, exec) {
|
|
@@ -2641,60 +2647,57 @@ export function apply(ctx, config) {
|
|
|
2641
2647
|
ctx.tools.register(defineTool({
|
|
2642
2648
|
name: 'superagent_memory',
|
|
2643
2649
|
description:
|
|
2644
|
-
'Read or correct the cross-run notebook: short notes
|
|
2645
|
-
+ '
|
|
2646
|
-
+ 'With layer="user" (when the user-level profile is enabled) the same actions address durable facts, '
|
|
2647
|
-
+ 'preferences, and decisions with their rationale; forgetting there deletes instead of retracting.',
|
|
2650
|
+
'Read or correct the cross-run notebook: short notes earlier runs left for the next one, or (layer="user") '
|
|
2651
|
+
+ 'durable facts, preferences, and decisions.',
|
|
2648
2652
|
properties: {
|
|
2649
2653
|
action: {
|
|
2650
2654
|
type: 'string',
|
|
2651
2655
|
enum: ['list', 'search', 'set', 'forget'],
|
|
2652
|
-
description: 'List notes, search
|
|
2656
|
+
description: 'List notes, search by keyword or tag, set one, or forget one.',
|
|
2653
2657
|
},
|
|
2654
2658
|
layer: {
|
|
2655
2659
|
type: 'string',
|
|
2656
2660
|
enum: ['run', 'user'],
|
|
2657
|
-
description: 'run (default)
|
|
2661
|
+
description: 'run (default): task notebook. user: cross-task profile.',
|
|
2658
2662
|
},
|
|
2659
2663
|
category: {
|
|
2660
2664
|
type: 'string',
|
|
2661
2665
|
enum: [...USER_MEMORY_CATEGORIES],
|
|
2662
2666
|
description: 'User layer only: fact, preference, or decision.',
|
|
2663
2667
|
},
|
|
2664
|
-
key: { type: 'string', description: 'Short topic key
|
|
2668
|
+
key: { type: 'string', description: 'Short topic key; a new note with the same key replaces it.' },
|
|
2665
2669
|
kind: { type: 'string', enum: [...MEMORY_KINDS], description: 'decision, pitfall, next, dispatch, or note.' },
|
|
2666
|
-
text: { type: 'string', description: 'The durable fact to record
|
|
2667
|
-
choice: { type: 'string', description: 'User decision
|
|
2668
|
-
rejected: { type: 'string', description: 'User decision
|
|
2669
|
-
reason: { type: 'string', description: 'User decision
|
|
2670
|
-
rollback: { type: 'string', description: 'User decision
|
|
2670
|
+
text: { type: 'string', description: 'The durable fact to record.' },
|
|
2671
|
+
choice: { type: 'string', description: 'User decision: what was chosen.' },
|
|
2672
|
+
rejected: { type: 'string', description: 'User decision: the alternative given up.' },
|
|
2673
|
+
reason: { type: 'string', description: 'User decision: why.' },
|
|
2674
|
+
rollback: { type: 'string', description: 'User decision: how to undo it.' },
|
|
2671
2675
|
query: {
|
|
2672
2676
|
type: 'string',
|
|
2673
|
-
description: '
|
|
2677
|
+
description: 'Search: keywords to rank notes by.',
|
|
2674
2678
|
},
|
|
2675
2679
|
tags: {
|
|
2676
2680
|
type: 'array',
|
|
2677
2681
|
items: { type: 'string' },
|
|
2678
|
-
description: '
|
|
2682
|
+
description: 'Match exactly (search) or attach (set).',
|
|
2679
2683
|
},
|
|
2680
2684
|
scope: {
|
|
2681
2685
|
type: 'string',
|
|
2682
|
-
description: 'Notebook scope: "rules"
|
|
2683
|
-
+ 'or the run scope (default) that earlier runs write to.',
|
|
2686
|
+
description: 'Notebook scope: "rules", "profile", or the run scope (default).',
|
|
2684
2687
|
},
|
|
2685
2688
|
run_id: {
|
|
2686
2689
|
type: 'string',
|
|
2687
|
-
description: 'User layer forget
|
|
2690
|
+
description: 'User layer forget: delete every record from this run.',
|
|
2688
2691
|
},
|
|
2689
2692
|
before: {
|
|
2690
2693
|
type: 'string',
|
|
2691
|
-
description: 'User layer forget
|
|
2694
|
+
description: 'User layer forget: delete records at or before this date.',
|
|
2692
2695
|
},
|
|
2693
2696
|
after: {
|
|
2694
2697
|
type: 'string',
|
|
2695
|
-
description: 'User layer forget
|
|
2698
|
+
description: 'User layer forget: delete records at or after this date.',
|
|
2696
2699
|
},
|
|
2697
|
-
limit: { type: 'number', description: 'Maximum notes
|
|
2700
|
+
limit: { type: 'number', description: 'Maximum notes (default 20).' },
|
|
2698
2701
|
},
|
|
2699
2702
|
required: ['action'],
|
|
2700
2703
|
async execute(args = {}, exec) {
|
|
@@ -2852,7 +2855,7 @@ export function apply(ctx, config) {
|
|
|
2852
2855
|
return describeError(error)
|
|
2853
2856
|
}
|
|
2854
2857
|
},
|
|
2855
|
-
}))
|
|
2858
|
+
}), EXTRA_TOOLS)
|
|
2856
2859
|
|
|
2857
2860
|
/**
|
|
2858
2861
|
* A template failure already names the concrete problem (which parameters
|
|
@@ -2876,28 +2879,24 @@ export function apply(ctx, config) {
|
|
|
2876
2879
|
ctx.tools.register(defineTool({
|
|
2877
2880
|
name: 'superagent_template',
|
|
2878
2881
|
description:
|
|
2879
|
-
'List, show, expand, save, or delete a workflow template: a fixed goal skeleton with required parameters
|
|
2880
|
-
+ '
|
|
2881
|
-
+ 'superagent_start plans exactly like a goal typed by the user. A template cannot set limits, budgets, a '
|
|
2882
|
-
+ 'mode, or an override, so using one never widens what a run may do.',
|
|
2882
|
+
'List, show, expand, save, or delete a workflow template: a fixed goal skeleton with required parameters. '
|
|
2883
|
+
+ 'expand returns one goal string for superagent_start; a template never sets limits, budgets, or overrides.',
|
|
2883
2884
|
properties: {
|
|
2884
2885
|
action: {
|
|
2885
2886
|
type: 'string',
|
|
2886
2887
|
enum: ['list', 'show', 'expand', 'save', 'delete'],
|
|
2887
|
-
description: 'List
|
|
2888
|
+
description: 'List, show one, expand into a goal, save a custom one, or delete a custom one.',
|
|
2888
2889
|
},
|
|
2889
|
-
id: { type: 'string', description: 'Template id from action="list"
|
|
2890
|
+
id: { type: 'string', description: 'Template id from action="list"; built-in ids are read-only.' },
|
|
2890
2891
|
params: {
|
|
2891
2892
|
type: 'object',
|
|
2892
|
-
description: '
|
|
2893
|
-
+ 'empty value is refused with its name instead of being given a default.',
|
|
2893
|
+
description: 'expand: a value for every declared parameter; missing ones are refused, not defaulted.',
|
|
2894
2894
|
additionalProperties: { type: 'string' },
|
|
2895
2895
|
},
|
|
2896
2896
|
template: {
|
|
2897
2897
|
type: 'object',
|
|
2898
|
-
description: '
|
|
2899
|
-
+ '
|
|
2900
|
-
+ 'refused so a template cannot carry limits or overrides.',
|
|
2898
|
+
description: 'save: id, title, whenToUse, whenNotToUse, variables [{name, description}], '
|
|
2899
|
+
+ 'skeleton with {{name}} placeholders.',
|
|
2901
2900
|
},
|
|
2902
2901
|
limit: { type: 'number', description: 'Maximum templates to list (default 50).' },
|
|
2903
2902
|
},
|
|
@@ -2959,80 +2958,66 @@ export function apply(ctx, config) {
|
|
|
2959
2958
|
return describeError(error)
|
|
2960
2959
|
}
|
|
2961
2960
|
},
|
|
2962
|
-
}))
|
|
2961
|
+
}), EXTRA_TOOLS)
|
|
2963
2962
|
|
|
2964
2963
|
ctx.tools.register(defineTool({
|
|
2965
2964
|
name: 'superagent_schedule',
|
|
2966
2965
|
description:
|
|
2967
|
-
'Create and manage scheduled runs
|
|
2968
|
-
+ '
|
|
2969
|
-
+ '
|
|
2970
|
-
+ '
|
|
2971
|
-
+ 'Missed windows are not replayed: the default miss policy "latest" runs only the newest due window and marks '
|
|
2972
|
-
+ 'the rest missed with a reason; "none" skips due windows while the host is down. '
|
|
2973
|
-
+ 'A plan never overlaps itself: if its previous run is still active, that window is recorded as '
|
|
2974
|
-
+ '"skipped: previous run still active". Scheduled runs share the concurrency quota with manual runs, and by '
|
|
2975
|
-
+ 'default one slot stays reserved for manual starts. Notifications are limited to achieved, first failure, '
|
|
2976
|
-
+ 'budget stop, and a needed decision; a plan that fails 3 times in a row pauses and says so once. '
|
|
2977
|
-
+ 'Cron support is zero-dependency: 5 fields, *, */n, ranges, lists, month/weekday names, 0 or 7 for Sunday. '
|
|
2978
|
-
+ 'Seconds, @macros, L, W, # and ? are refused when the plan is created, with the field number. '
|
|
2979
|
-
+ 'Nothing runs until a plan is created; an install with no plans behaves exactly as before.',
|
|
2966
|
+
'Create and manage scheduled runs that start on a cron expression or fixed interval without anyone calling '
|
|
2967
|
+
+ 'superagent_start. Actions: create, list, pause, resume, delete, run-now. Plans survive restarts, never overlap '
|
|
2968
|
+
+ 'themselves, and pause after 3 consecutive failures. Cron is 5 fields (*, */n, ranges, lists, names, 0/7 '
|
|
2969
|
+
+ 'Sunday); seconds and macros are refused.',
|
|
2980
2970
|
properties: {
|
|
2981
2971
|
action: {
|
|
2982
2972
|
type: 'string',
|
|
2983
2973
|
enum: ['create', 'list', 'pause', 'resume', 'delete', 'run-now'],
|
|
2984
|
-
description: 'create
|
|
2985
|
-
+ 'next planned window.',
|
|
2974
|
+
description: 'create, list, pause/resume, delete, or start one run now without moving the next window.',
|
|
2986
2975
|
},
|
|
2987
|
-
id: { type: 'string', description: 'Schedule id (sch-...)
|
|
2988
|
-
name: { type: 'string', description: '
|
|
2976
|
+
id: { type: 'string', description: 'Schedule id (sch-...); required for pause, resume, delete, run-now.' },
|
|
2977
|
+
name: { type: 'string', description: 'create: short name used in list and notifications.' },
|
|
2989
2978
|
goal: {
|
|
2990
2979
|
type: 'string',
|
|
2991
|
-
description: '
|
|
2980
|
+
description: 'create: the complete goal the scheduled run starts. Give goal or template_id, not both.',
|
|
2992
2981
|
},
|
|
2993
2982
|
template_id: {
|
|
2994
2983
|
type: 'string',
|
|
2995
|
-
description: '
|
|
2996
|
-
+ 'goal is the expanded text, so a later template edit does not change the plan.',
|
|
2984
|
+
description: 'create: expand this template into the goal at create time.',
|
|
2997
2985
|
},
|
|
2998
2986
|
params: {
|
|
2999
2987
|
type: 'object',
|
|
3000
|
-
description: '
|
|
2988
|
+
description: 'create with template_id: values for the placeholders.',
|
|
3001
2989
|
additionalProperties: { type: 'string' },
|
|
3002
2990
|
},
|
|
3003
2991
|
cron: {
|
|
3004
2992
|
type: 'string',
|
|
3005
|
-
description: '
|
|
3006
|
-
+ '
|
|
2993
|
+
description: 'create: 5-field cron (minute hour day month weekday) in timezone, e.g. "0 9 * * MON-FRI". '
|
|
2994
|
+
+ 'Give cron or every_minutes, not both.',
|
|
3007
2995
|
},
|
|
3008
2996
|
every_minutes: {
|
|
3009
2997
|
type: 'number',
|
|
3010
|
-
description: '
|
|
3011
|
-
+ 'later runs are one interval after the previous planned window.',
|
|
2998
|
+
description: 'create: fixed interval instead of cron; first run one interval from now.',
|
|
3012
2999
|
},
|
|
3013
3000
|
timezone: {
|
|
3014
3001
|
type: 'string',
|
|
3015
|
-
description: '
|
|
3016
|
-
+ 'clock is not used as an implicit zone.',
|
|
3002
|
+
description: 'create: IANA zone the cron is written in (default UTC), e.g. "Asia/Shanghai".',
|
|
3017
3003
|
},
|
|
3018
3004
|
miss_policy: {
|
|
3019
3005
|
type: 'string',
|
|
3020
3006
|
enum: ['latest', 'none'],
|
|
3021
|
-
description: '
|
|
3022
|
-
+ 'the others missed; none skips all due windows and advances to the next one.',
|
|
3007
|
+
description: 'create: after downtime, latest (default) runs the newest missed window; none skips them.',
|
|
3023
3008
|
},
|
|
3024
3009
|
mode: {
|
|
3025
3010
|
type: 'string',
|
|
3026
3011
|
enum: ['planned', 'direct'],
|
|
3027
|
-
description: '
|
|
3012
|
+
description: 'create: run mode per execution, as in superagent_start.',
|
|
3028
3013
|
},
|
|
3029
3014
|
goal_mode: {
|
|
3030
3015
|
type: 'boolean',
|
|
3031
|
-
description: '
|
|
3016
|
+
description: 'create: run each execution in goal mode with acceptance checking.',
|
|
3032
3017
|
},
|
|
3033
3018
|
acceptance: {
|
|
3034
3019
|
type: 'array',
|
|
3035
|
-
description: '
|
|
3020
|
+
description: 'create with goal_mode: conditions, same shape as superagent_start.',
|
|
3036
3021
|
items: {
|
|
3037
3022
|
type: 'object',
|
|
3038
3023
|
properties: {
|
|
@@ -3054,14 +3039,13 @@ export function apply(ctx, config) {
|
|
|
3054
3039
|
required: ['text'],
|
|
3055
3040
|
},
|
|
3056
3041
|
},
|
|
3057
|
-
max_rounds: { type: 'number', description: '
|
|
3058
|
-
max_wall_clock_minutes: { type: 'number', description: '
|
|
3059
|
-
no_progress_rounds: { type: 'number', description: '
|
|
3042
|
+
max_rounds: { type: 'number', description: 'create with goal_mode: rounds per execution (default 5, max 20).' },
|
|
3043
|
+
max_wall_clock_minutes: { type: 'number', description: 'create with goal_mode: wall-clock budget per execution.' },
|
|
3044
|
+
no_progress_rounds: { type: 'number', description: 'create with goal_mode: no-progress rounds before stopping.' },
|
|
3060
3045
|
budget: {
|
|
3061
3046
|
type: 'object',
|
|
3062
|
-
description: '
|
|
3063
|
-
+ 'max_total_model_calls, max_total_tokens
|
|
3064
|
-
+ 'total pauses the plan and records the reason.',
|
|
3047
|
+
description: 'create: per-execution caps (max_model_calls, max_tokens) and whole-plan caps '
|
|
3048
|
+
+ '(max_total_model_calls, max_total_tokens, max_total_runs).',
|
|
3065
3049
|
properties: {
|
|
3066
3050
|
max_model_calls: { type: 'number' },
|
|
3067
3051
|
max_tokens: { type: 'number' },
|
|
@@ -3072,15 +3056,11 @@ export function apply(ctx, config) {
|
|
|
3072
3056
|
},
|
|
3073
3057
|
human_priority: {
|
|
3074
3058
|
type: 'boolean',
|
|
3075
|
-
description: '
|
|
3076
|
-
+ 'manual superagent_start at the same moment still finds room.',
|
|
3059
|
+
description: 'create: when true (default), a scheduled run cannot take the last slot a manual start needs.',
|
|
3077
3060
|
},
|
|
3078
3061
|
session_id: {
|
|
3079
3062
|
type: 'string',
|
|
3080
|
-
description: '
|
|
3081
|
-
+ 'the calling session. After a host restart the plugin asks the Host Session API to reopen that session, '
|
|
3082
|
-
+ 'and creates a replacement if it was deleted, so a plan does not depend on the original process staying '
|
|
3083
|
-
+ 'alive. On a host without that API the plan is marked at create time as requiring a resident session.',
|
|
3063
|
+
description: 'create: session that owns the runs and receives notifications (default: this session).',
|
|
3084
3064
|
},
|
|
3085
3065
|
},
|
|
3086
3066
|
required: ['action'],
|
|
@@ -3166,7 +3146,7 @@ export function apply(ctx, config) {
|
|
|
3166
3146
|
return describeError(error)
|
|
3167
3147
|
}
|
|
3168
3148
|
},
|
|
3169
|
-
}))
|
|
3149
|
+
}), EXTRA_TOOLS)
|
|
3170
3150
|
|
|
3171
3151
|
// The embedding surface is opt-in: mounting the plugin must not open a port
|
|
3172
3152
|
// unasked. When it is on, every request goes through the same orchestrator as
|
|
@@ -3175,22 +3155,21 @@ export function apply(ctx, config) {
|
|
|
3175
3155
|
ctx.tools.register(defineTool({
|
|
3176
3156
|
name: 'superagent_audit',
|
|
3177
3157
|
description:
|
|
3178
|
-
'Query the append-only audit trail (tool calls, path writes, commands, blocks, approvals,
|
|
3179
|
-
+ '
|
|
3180
|
-
+ 'JSONL or CSV file.',
|
|
3158
|
+
'Query the append-only audit trail (tool calls, path writes, commands, blocks, approvals, decisions, run '
|
|
3159
|
+
+ 'lifecycle) for one run or a time window, or export the matching events as JSONL or CSV.',
|
|
3181
3160
|
properties: {
|
|
3182
3161
|
run_id: { type: 'string', description: 'Only events for this run id.' },
|
|
3183
3162
|
subtask_id: { type: 'string', description: 'Only events for one subtask, e.g. "subtask-2" or "aggregator".' },
|
|
3184
3163
|
kind: { type: 'string', description: 'Event kind, e.g. tool.call, path.write, command.exec, blocked, approved, attention.' },
|
|
3185
|
-
decision: { type: 'string', description: '
|
|
3186
|
-
result: { type: 'string', description: '
|
|
3187
|
-
target: { type: 'string', description: 'Substring of the path, command, or question
|
|
3188
|
-
since: { type: 'string', description: 'ISO timestamp; events
|
|
3189
|
-
until: { type: 'string', description: 'ISO timestamp; events
|
|
3190
|
-
limit: { type: 'number', description: 'Maximum events
|
|
3164
|
+
decision: { type: 'string', description: 'allow, confirm, or deny.' },
|
|
3165
|
+
result: { type: 'string', description: 'e.g. ok, blocked, pending, approved, failed.' },
|
|
3166
|
+
target: { type: 'string', description: 'Substring of the path, command, or question.' },
|
|
3167
|
+
since: { type: 'string', description: 'ISO timestamp; earlier events are skipped.' },
|
|
3168
|
+
until: { type: 'string', description: 'ISO timestamp; later events are skipped.' },
|
|
3169
|
+
limit: { type: 'number', description: 'Maximum events read or rows printed (default 8 for summary, all for export).' },
|
|
3191
3170
|
order: { type: 'string', description: 'asc (oldest first, default) or desc.' },
|
|
3192
|
-
format: { type: 'string', description: 'summary (default), jsonl, or csv
|
|
3193
|
-
out_path: { type: 'string', description: 'File
|
|
3171
|
+
format: { type: 'string', description: 'summary (default), jsonl, or csv; the last two write a file and return its path.' },
|
|
3172
|
+
out_path: { type: 'string', description: 'File for jsonl/csv; defaults to <stateDir>/audit/audit-export-<time>.<ext>.' },
|
|
3194
3173
|
},
|
|
3195
3174
|
async execute(args = {}) {
|
|
3196
3175
|
try {
|
|
@@ -3226,7 +3205,7 @@ export function apply(ctx, config) {
|
|
|
3226
3205
|
return describeError(error)
|
|
3227
3206
|
}
|
|
3228
3207
|
},
|
|
3229
|
-
}))
|
|
3208
|
+
}), EXTRA_TOOLS)
|
|
3230
3209
|
}
|
|
3231
3210
|
|
|
3232
3211
|
if (cfg.controlPort !== null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiangyixie/dsh-superagent",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.5",
|
|
4
4
|
"description": "长周期自主执行插件:一个目标拆成可并行的子任务,交付一份合并报告,重启后仍可继续。",
|
|
5
5
|
"author": "Admire (LittleChenLiya)",
|
|
6
6
|
"type": "module",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"dsh": ">=0.2.2-rc.1 <0.3.0-0"
|
|
99
99
|
},
|
|
100
100
|
"scripts": {
|
|
101
|
-
"test": "node --test test/orchestrator.test.mjs test/direct-and-queue.test.mjs test/dialog.test.mjs test/workspace.test.mjs test/store.test.mjs test/errors.test.mjs test/plugin.test.mjs test/guard.test.mjs test/goal.test.mjs test/cron.test.mjs test/schedule.test.mjs test/audit.test.mjs test/inject.test.mjs test/sync.test.mjs test/workbench.test.mjs test/usage.test.mjs test/cost.test.mjs test/ledger.test.mjs test/control.test.mjs test/watch.test.mjs test/report.test.mjs test/memory.test.mjs test/user-memory.test.mjs test/notify.test.mjs test/templates.test.mjs test/archive.test.mjs test/doctor.test.mjs test/pack.test.mjs test/runtime-control.test.mjs test/console.test.mjs test/client-bundle.test.mjs test/wizard.test.mjs test/board.test.mjs test/long-goal.test.mjs",
|
|
101
|
+
"test": "node --test test/orchestrator.test.mjs test/direct-and-queue.test.mjs test/dialog.test.mjs test/workspace.test.mjs test/store.test.mjs test/errors.test.mjs test/plugin.test.mjs test/overhead.test.mjs test/guard.test.mjs test/goal.test.mjs test/cron.test.mjs test/schedule.test.mjs test/audit.test.mjs test/inject.test.mjs test/sync.test.mjs test/workbench.test.mjs test/usage.test.mjs test/cost.test.mjs test/ledger.test.mjs test/control.test.mjs test/watch.test.mjs test/report.test.mjs test/memory.test.mjs test/user-memory.test.mjs test/notify.test.mjs test/templates.test.mjs test/archive.test.mjs test/doctor.test.mjs test/pack.test.mjs test/runtime-control.test.mjs test/console.test.mjs test/client-bundle.test.mjs test/wizard.test.mjs test/board.test.mjs test/long-goal.test.mjs",
|
|
102
102
|
"check-pack": "node scripts/check-pack.mjs"
|
|
103
103
|
},
|
|
104
104
|
"keywords": [
|