@x1a0f3n9/dsh-tool-subagent-control 0.1.5-rc.5 → 0.1.7-rc.2
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/README.i18n.yaml +105 -5
- package/README.md +6 -6
- package/README.zh.md +6 -6
- package/lib/index.js +3 -3
- package/lib/types/index.js +6 -11
- package/lib/types/list-agents.js +10 -28
- package/package.json +22 -22
package/README.i18n.yaml
CHANGED
|
@@ -1,6 +1,106 @@
|
|
|
1
|
-
# Bilingual-pair consistency record (docs/i18n/README.md):
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/subagent/tool-subagent-control/README.md
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/:
|
|
6
|
+
en: 5413b8e52a0c8e3d
|
|
7
|
+
zh: 9b6d0385209ff9bb
|
|
8
|
+
/x1a0f3n9-dsh-tool-subagent-control:
|
|
9
|
+
en: 455b7977c281c623
|
|
10
|
+
zh: 5ad1de3bab0ec299
|
|
11
|
+
/x1a0f3n9-dsh-tool-subagent-control/summary:
|
|
12
|
+
en: 7464eb99b6f618eb
|
|
13
|
+
zh: 8c7628c8e9f163ca
|
|
14
|
+
/x1a0f3n9-dsh-tool-subagent-control/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 09388d293f9be9cb
|
|
17
|
+
/x1a0f3n9-dsh-tool-subagent-control/use-this-package:
|
|
18
|
+
en: 27c5bbe682f0b72b
|
|
19
|
+
zh: b16aeb2c43f3692e
|
|
20
|
+
/x1a0f3n9-dsh-tool-subagent-control/use-this-package/minimal-configuration:
|
|
21
|
+
en: 4a52c81317ec9001
|
|
22
|
+
zh: ebd9f1ba920da50a
|
|
23
|
+
/x1a0f3n9-dsh-tool-subagent-control/use-this-package/send-message:
|
|
24
|
+
en: d80bb1df2eb740b7
|
|
25
|
+
zh: e3203d9868a82910
|
|
26
|
+
/x1a0f3n9-dsh-tool-subagent-control/use-this-package/interrupt-agent:
|
|
27
|
+
en: 01dd41fe11f294d7
|
|
28
|
+
zh: f45a2e4073c0b206
|
|
29
|
+
/x1a0f3n9-dsh-tool-subagent-control/use-this-package/list-agents:
|
|
30
|
+
en: b777ad75f0eb7a59
|
|
31
|
+
zh: 19275aba6573a917
|
|
32
|
+
/x1a0f3n9-dsh-tool-subagent-control/understand-the-implementation:
|
|
33
|
+
en: c5cdf01a78c990f2
|
|
34
|
+
zh: 53c180d726ce4502
|
|
35
|
+
/x1a0f3n9-dsh-tool-subagent-control/understand-the-implementation/design-concept:
|
|
36
|
+
en: 0af7238c690ee8d6
|
|
37
|
+
zh: 5049eea23770ffed
|
|
38
|
+
/x1a0f3n9-dsh-tool-subagent-control/understand-the-implementation/delivery-and-signal-ownership:
|
|
39
|
+
en: 4c7698ccea49a60b
|
|
40
|
+
zh: fbf129ff583e6ab9
|
|
41
|
+
/x1a0f3n9-dsh-tool-subagent-control/understand-the-implementation/listing-projection:
|
|
42
|
+
en: 70e344022e6e535e
|
|
43
|
+
zh: 355488590648a82e
|
|
44
|
+
/x1a0f3n9-dsh-tool-subagent-control/understand-the-implementation/source-map:
|
|
45
|
+
en: a2a918cbad1a8313
|
|
46
|
+
zh: 5bcddba1b2bdd26e
|
|
47
|
+
/x1a0f3n9-dsh-tool-subagent-control/further-exploration:
|
|
48
|
+
en: df2bf39d0ffffd43
|
|
49
|
+
zh: 4cd02551f7433c90
|
|
50
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience:
|
|
51
|
+
en: 215e7ba838619b7b
|
|
52
|
+
zh: a311da3843709f90
|
|
53
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/tool-schema:
|
|
54
|
+
en: e4c7376d4f29dbd5
|
|
55
|
+
zh: 6b7a9eaf69c9ea53
|
|
56
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/tool-schema/what-the-model-sees:
|
|
57
|
+
en: a63be096ee9c4873
|
|
58
|
+
zh: cd1bd116ccc66318
|
|
59
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/tool-schema/token-effect:
|
|
60
|
+
en: db207dc8d5860684
|
|
61
|
+
zh: ad2663b4967fbca9
|
|
62
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/tool-schema/kv-cache-effect:
|
|
63
|
+
en: 4b77d42b96b3519d
|
|
64
|
+
zh: dd393d8f0f6536c1
|
|
65
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/interrupt-result:
|
|
66
|
+
en: d64e936e83e89a2b
|
|
67
|
+
zh: b9905c33af6cca45
|
|
68
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/interrupt-result/what-the-model-sees:
|
|
69
|
+
en: 89305619897680ba
|
|
70
|
+
zh: e610a844fc09c53f
|
|
71
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/interrupt-result/token-effect:
|
|
72
|
+
en: 5d1bcef28b5f18da
|
|
73
|
+
zh: 027d67d93d660e76
|
|
74
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/interrupt-result/kv-cache-effect:
|
|
75
|
+
en: 4a629edb36a17e32
|
|
76
|
+
zh: 5a7539cfbf404c54
|
|
77
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/delivery-result:
|
|
78
|
+
en: ab964e307bd37dca
|
|
79
|
+
zh: 03f975252f838a42
|
|
80
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/delivery-result/what-the-model-sees:
|
|
81
|
+
en: 4a0a4955589012ae
|
|
82
|
+
zh: 2bbbb5196a8aa4fd
|
|
83
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/delivery-result/token-effect:
|
|
84
|
+
en: 0f134e37e4bd9965
|
|
85
|
+
zh: ceb858d01266e976
|
|
86
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/delivery-result/kv-cache-effect:
|
|
87
|
+
en: f5d5f97a153f7c70
|
|
88
|
+
zh: 3d6bc05b9eadfbc2
|
|
89
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/listing-result:
|
|
90
|
+
en: 094e55d258f2ec2e
|
|
91
|
+
zh: f364bc9046530bff
|
|
92
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/listing-result/what-the-model-sees:
|
|
93
|
+
en: efbbd1e36c7b2edd
|
|
94
|
+
zh: a8a95475666ed1dc
|
|
95
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/listing-result/token-effect:
|
|
96
|
+
en: 4688e849b3143dfc
|
|
97
|
+
zh: f22b5520c454f9e7
|
|
98
|
+
/x1a0f3n9-dsh-tool-subagent-control/model-experience/listing-result/kv-cache-effect:
|
|
99
|
+
en: 4a629edb36a17e32
|
|
100
|
+
zh: 5a7539cfbf404c54
|
|
101
|
+
/x1a0f3n9-dsh-tool-subagent-control/known-limitations-and-deferred-work:
|
|
102
|
+
en: 31cd8a1934cf0093
|
|
103
|
+
zh: 2fd07e05c8e58e9a
|
|
104
|
+
/x1a0f3n9-dsh-tool-subagent-control/known-limitations-and-deferred-work/dev-note:
|
|
105
|
+
en: e67f633dc6fe7773
|
|
106
|
+
zh: 3bb0c20c93f16f98
|
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ This package takes no configuration: the root plugin provides `send_message` and
|
|
|
46
46
|
|
|
47
47
|
### send_message
|
|
48
48
|
|
|
49
|
-
Sends a message to an Agent named by `agent_id`: any exact live Agent may target its direct continuable child, while a resident continuable child may also target its direct parent. A working target receives the message at its nearest step boundary through Steer; an
|
|
49
|
+
Sends a message to an Agent named by `agent_id`: any exact live Agent may target its direct continuable child, while a resident continuable child may also target its direct parent. A working target receives the message at its nearest step boundary through Steer; an inactive target starts or resumes a turn through the continuation lifecycle. The call returns only acceptance (the accepted message's stable `messageId`), never a reply. A failure — an unsupported target, unavailable parent, unknown child, descriptor-less child that cannot be resumed, or rejected admission — states the message was not delivered.
|
|
50
50
|
|
|
51
51
|
### interrupt_agent
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ Stops only the target's current turn: queued messages stay parked until a later
|
|
|
54
54
|
|
|
55
55
|
### list_agents
|
|
56
56
|
|
|
57
|
-
Lists the continuable children below the calling agent: `children` (default)
|
|
57
|
+
Lists the continuable children below the calling agent: `children` (default) reads direct children from the parent catalog without opening child logs; `descendants` recursively reads child catalogs in stable pre-order, annotating each entry with its durable direct-parent session id and depth. Status comes from the live Agent registry — `running` or `inactive`. Readable one-shot children are omitted from output but their catalogs remain traversal nodes. Unknown modes and unreadable child catalogs, including one-shot children, appear as diagnostics only in `descendants` scope. Ordinary Session forks are not catalog entries, so neither those forks nor their descendants are listed from the source Session.
|
|
58
58
|
|
|
59
59
|
-----
|
|
60
60
|
|
|
@@ -76,7 +76,7 @@ The tool forwards its execution signal, which owns admission only until inbox ac
|
|
|
76
76
|
|
|
77
77
|
### Listing projection
|
|
78
78
|
|
|
79
|
-
`list_agents` derives the root id from the calling agent, reads the service catalog without a cursor, refines each candidate's status through the live Agent registry, and omits one-shot children because they cannot accept `send_message`.
|
|
79
|
+
`list_agents` derives the root id from the calling agent, reads the service catalog without a cursor, refines each candidate's status through the live Agent registry, and omits one-shot children because they cannot accept `send_message`. Descendant traversal preserves each parent catalog's event order. Unknown modes produce diagnostics while their catalogs remain traversable; unreadable catalogs produce diagnostics and stop that branch. Descendants absent from reachable catalogs cannot be discovered.
|
|
80
80
|
|
|
81
81
|
### Source map
|
|
82
82
|
|
|
@@ -150,11 +150,11 @@ Append-only; newly visible content follows the reusable request prefix and does
|
|
|
150
150
|
|
|
151
151
|
#### What the model sees
|
|
152
152
|
|
|
153
|
-
One line per continuable child in stable catalog order: `<id> [<status>] — <label>` (`running` =
|
|
153
|
+
One line per continuable child in stable catalog order: `<id> [<status>] — <label>` (`running` = executing a turn; `inactive` = no turn executing, whether loaded or stored; neither status describes task completion or outcome). Only `descendants` scope adds `<id> [diagnostic: <reason>]` for an unknown mode or unreadable child catalog, including an unreadable one-shot child. The `descendants` scope inserts ` parent=<id> depth=<n>` before the label dash on every line, in pre-order. Readable one-shot children are omitted; `(no subagents)` means no continuable child or diagnostic survived the projection.
|
|
154
154
|
|
|
155
155
|
#### Token effect
|
|
156
156
|
|
|
157
|
-
Grows linearly with the listed continuable children —
|
|
157
|
+
Grows linearly with the listed continuable children and diagnostics — reachable catalog descendants under the `descendants` scope; there is no cursor or cap, so long-lived parents with many persisted children pay the full list each call.
|
|
158
158
|
|
|
159
159
|
#### KV Cache effect
|
|
160
160
|
|
|
@@ -169,7 +169,7 @@ These limits define what the control tools cannot observe or steer; they are cur
|
|
|
169
169
|
|
|
170
170
|
- **A delivered message has no independent result** — acceptance returns only its inbox `messageId`; later target work lands in that target's durable Session and is never collected through this tool. A reply is another explicitly addressed `send_message`, not this call's result.
|
|
171
171
|
- **Only supported adjacent Agents can communicate** — every sender may target a direct continuable child, only a sender with a resident continuable Activation may target its direct parent, and that parent must remain live; siblings and deeper descendants are not message targets, and only direct-child delivery supports cold activation.
|
|
172
|
-
- **Listing is a snapshot, not a delivery promise** — it may race publication, disposal, or a later message, and another process may activate a child this process reports as `
|
|
172
|
+
- **Listing is a snapshot, not a delivery promise** — it may race publication, disposal, or a later message, and another process may activate a child this process reports as `inactive`; cross-process accuracy requires a shared lease. `interrupt_agent` performs the authoritative live-lineage check itself, so discovery staleness cannot grant authority.
|
|
173
173
|
- **No pagination or deletion** — the complete stably ordered set is returned, and persisted children remain listed for as long as their sessions remain in persistence; a service-level bound or delete operation is a later product decision.
|
|
174
174
|
|
|
175
175
|
<a id="dev-note"></a>
|
package/README.zh.md
CHANGED
|
@@ -46,7 +46,7 @@ kind: "package-reference"
|
|
|
46
46
|
|
|
47
47
|
### send_message
|
|
48
48
|
|
|
49
|
-
向 `agent_id` 指定的 Agent 发送消息:任何确切在线 Agent 都可以向自己的直接可继续子级发送消息,驻留的可继续子级还可以向自己的直接父级发送消息。正在工作的目标通过 Steer
|
|
49
|
+
向 `agent_id` 指定的 Agent 发送消息:任何确切在线 Agent 都可以向自己的直接可继续子级发送消息,驻留的可继续子级还可以向自己的直接父级发送消息。正在工作的目标通过 Steer 在最近的步骤边界接收消息;非活跃目标会通过继续执行生命周期启动或恢复一个轮次。调用只返回接受结果(被接受消息的稳定 `messageId`),绝不返回回复。失败——不受支持的目标、不可用的父级、未知子级、缺少描述符而无法恢复的子级,或准入被拒——会明确说明消息未送达。
|
|
50
50
|
|
|
51
51
|
### interrupt_agent
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ kind: "package-reference"
|
|
|
54
54
|
|
|
55
55
|
### list_agents
|
|
56
56
|
|
|
57
|
-
列出调用方 agent 下方的可继续子级:`children
|
|
57
|
+
列出调用方 agent 下方的可继续子级:`children`(默认)从父目录读取直接子级,不打开子日志;`descendants` 按稳定前序递归读取子级目录,并为每个条目标注其持久化直接父级会话 ID 与深度。状态来自在线 Agent 注册表——`running` 或 `inactive`。可读取的一次性子级不出现在输出中,但其目录仍是遍历节点。未知模式与无法读取的子级目录(包括一次性子级)仅在 `descendants` 作用域中以诊断信息呈现。普通 Session fork 不是目录条目,因此从源 Session 列表中既无法发现这些 fork,也无法发现其后代。
|
|
58
58
|
|
|
59
59
|
-----
|
|
60
60
|
|
|
@@ -76,7 +76,7 @@ kind: "package-reference"
|
|
|
76
76
|
|
|
77
77
|
### 列表投影
|
|
78
78
|
|
|
79
|
-
`list_agents` 从调用 agent 推导根 id,不使用 cursor 读取服务目录,通过在线 Agent 注册表细化每个候选的状态,并省略无法接受 `send_message`
|
|
79
|
+
`list_agents` 从调用 agent 推导根 id,不使用 cursor 读取服务目录,通过在线 Agent 注册表细化每个候选的状态,并省略无法接受 `send_message` 的一次性子级。后代遍历保留每个父目录的事件顺序。未知模式产生诊断,但其目录仍可遍历;无法读取的目录产生诊断,并停止该分支。可达目录中不存在的后代无法被发现。
|
|
80
80
|
|
|
81
81
|
### 源码地图
|
|
82
82
|
|
|
@@ -150,11 +150,11 @@ kind: "package-reference"
|
|
|
150
150
|
|
|
151
151
|
#### 模型看到什么
|
|
152
152
|
|
|
153
|
-
按稳定目录顺序,每个可继续子级占一行:`<id> [<status>] — <label>`(`running`
|
|
153
|
+
按稳定目录顺序,每个可继续子级占一行:`<id> [<status>] — <label>`(`running` 表示正在执行轮次;`inactive` 表示没有轮次在执行,包括已加载和仅存于存储的情况;两种状态均不表示任务完成或结果)。仅 `descendants` 作用域会为未知模式或无法读取的子级目录添加 `<id> [diagnostic: <reason>]`,包括无法读取的一次性子级。`descendants` 作用域会在每行标签的破折号之前按前序插入 ` parent=<id> depth=<n>`。可读取的一次性子级会被省略;`(no subagents)` 表示投影后没有留下可继续子级或诊断信息。
|
|
154
154
|
|
|
155
155
|
#### Token 影响
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
随所列可继续子级和诊断数量线性增长——`descendants` 作用域下为目录可达后代;没有游标或上限,因此长期存活且有许多持久化子级的父级每次调用都会承担完整列表成本。
|
|
158
158
|
|
|
159
159
|
#### KV Cache 影响
|
|
160
160
|
|
|
@@ -169,7 +169,7 @@ kind: "package-reference"
|
|
|
169
169
|
|
|
170
170
|
- **已投递消息没有独立结果**——接受时只返回其 inbox `messageId`;目标后续工作会落入该目标的持久化会话,绝不会通过本工具收集。回复是另一条显式指定地址的 `send_message`,而非本次调用的结果。
|
|
171
171
|
- **只有受支持的相邻 Agent 可以通信**——每个发送方都可以向直接可继续子级发送消息;只有具备驻留可继续 Activation 的发送方可以向自己的直接父级发送消息,且该父级必须仍在线;同级与更深的后代不能作为消息目标,只有向直接子级投递才支持冷激活。
|
|
172
|
-
- **列表是快照,而非投递承诺**——它可能与发布、dispose(资源释放)或后续消息发生竞态,另一个进程也可能激活当前进程报告为 `
|
|
172
|
+
- **列表是快照,而非投递承诺**——它可能与发布、dispose(资源释放)或后续消息发生竞态,另一个进程也可能激活当前进程报告为 `inactive` 的子级;跨进程准确性需要共享租约。`interrupt_agent` 自己执行权威的在线 lineage 检查,因此过期的发现结果不会授予权限。
|
|
173
173
|
- **没有分页或删除**——系统返回完整且稳定排序的集合;只要子级会话仍在持久化存储中,它就会继续出现在列表中,服务级上限或删除操作留待后续产品决策。
|
|
174
174
|
|
|
175
175
|
<a id="dev-note"></a>
|
package/lib/index.js
CHANGED
|
@@ -21,7 +21,7 @@ const inject = ["tools", "subagents"];
|
|
|
21
21
|
function apply(ctx) {
|
|
22
22
|
ctx.tools.register(markAdjacentAgentSendMessageTool(defineTool({
|
|
23
23
|
name: "send_message",
|
|
24
|
-
description: "Send a message to
|
|
24
|
+
description: "Send a message to an agent. A working agent receives it at its next step; an idle agent starts a new turn with it. Returns delivery confirmation, not the agent's answer.",
|
|
25
25
|
parameters: {
|
|
26
26
|
agent_id: {
|
|
27
27
|
type: "string",
|
|
@@ -60,11 +60,11 @@ function apply(ctx) {
|
|
|
60
60
|
})));
|
|
61
61
|
ctx.tools.register(defineTool({
|
|
62
62
|
name: "interrupt_agent",
|
|
63
|
-
description: "
|
|
63
|
+
description: "Ask a subagent to stop its current work. This call returns without waiting for it to stop. You can continue a direct child's conversation later with send_message. Subagents it started will keep running.",
|
|
64
64
|
parameters: { agent_id: {
|
|
65
65
|
type: "string",
|
|
66
66
|
required: true,
|
|
67
|
-
description: "The
|
|
67
|
+
description: "The id of an agent created under you: your direct child or a deeper descendant."
|
|
68
68
|
} },
|
|
69
69
|
output: {
|
|
70
70
|
schema: {
|
package/lib/types/index.js
CHANGED
|
@@ -20,10 +20,8 @@ export const inject = ['tools', 'subagents'];
|
|
|
20
20
|
export function apply(ctx) {
|
|
21
21
|
ctx.tools.register(markAdjacentAgentSendMessageTool(defineTool({
|
|
22
22
|
name: 'send_message',
|
|
23
|
-
description: 'Send a message to
|
|
24
|
-
+ '
|
|
25
|
-
+ 'if it is idle, the message starts a turn. This call returns no answer from the agent — only confirmation '
|
|
26
|
-
+ 'that the message was delivered. A failure means the message was NOT delivered.',
|
|
23
|
+
description: 'Send a message to an agent. A working agent receives it at its next step; an idle agent starts a new turn with it. '
|
|
24
|
+
+ 'Returns delivery confirmation, not the agent\'s answer.',
|
|
27
25
|
parameters: {
|
|
28
26
|
agent_id: {
|
|
29
27
|
type: 'string',
|
|
@@ -61,17 +59,14 @@ export function apply(ctx) {
|
|
|
61
59
|
})));
|
|
62
60
|
ctx.tools.register(defineTool({
|
|
63
61
|
name: 'interrupt_agent',
|
|
64
|
-
description: '
|
|
65
|
-
+ '
|
|
66
|
-
+ '
|
|
67
|
-
+ 'the agent itself stays available for follow-ups. This call returns as soon as the stop request is '
|
|
68
|
-
+ 'accepted, so the target may keep running briefly; interrupting an agent that already finished is '
|
|
69
|
-
+ 'an accepted no-op.',
|
|
62
|
+
description: 'Ask a subagent to stop its current work. This call returns without waiting for it to stop. '
|
|
63
|
+
+ 'You can continue a direct child\'s conversation later with send_message. '
|
|
64
|
+
+ 'Subagents it started will keep running.',
|
|
70
65
|
parameters: {
|
|
71
66
|
agent_id: {
|
|
72
67
|
type: 'string',
|
|
73
68
|
required: true,
|
|
74
|
-
description: 'The
|
|
69
|
+
description: 'The id of an agent created under you: your direct child or a deeper descendant.',
|
|
75
70
|
},
|
|
76
71
|
},
|
|
77
72
|
output: {
|
package/lib/types/list-agents.js
CHANGED
|
@@ -14,23 +14,14 @@ export const inject = ['tools', 'subagents', 'agents'];
|
|
|
14
14
|
function resolveListAgentsRequest(request) {
|
|
15
15
|
return { scope: request.scope ?? 'children' };
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Refine one candidate's status through the live Agent registry: `running`
|
|
19
|
-
* for an active driver, `idle` for a resident Agent between turns (possibly
|
|
20
|
-
* waiting on agents it started), and `ready` when no live Agent remains.
|
|
21
|
-
* `ready` preserves resumability without presenting an inactive conversation
|
|
22
|
-
* as a terminal result to collect.
|
|
23
|
-
*/
|
|
17
|
+
/** Report turn activity without exposing whether the child is loaded. */
|
|
24
18
|
function statusOf(agents, id) {
|
|
25
|
-
|
|
26
|
-
if (agent === undefined)
|
|
27
|
-
return 'ready';
|
|
28
|
-
return agent.status === 'running' ? 'running' : 'idle';
|
|
19
|
+
return agents.get(id)?.status === 'running' ? 'running' : 'inactive';
|
|
29
20
|
}
|
|
30
21
|
/** Project one service row into the model-facing entry, or omit a one-shot child. */
|
|
31
22
|
function project(agents, entry, position) {
|
|
32
23
|
const at = position === undefined ? {} : { parent: position.parentId, depth: position.depth };
|
|
33
|
-
if (entry.kind === 'diagnostic') {
|
|
24
|
+
if ('kind' in entry && entry.kind === 'diagnostic') {
|
|
34
25
|
return { kind: 'diagnostic', id: entry.id, reason: entry.reason, ...at };
|
|
35
26
|
}
|
|
36
27
|
// One-shot children cannot be continued by send_message, so the model
|
|
@@ -52,23 +43,16 @@ function project(agents, entry, position) {
|
|
|
52
43
|
export function apply(ctx) {
|
|
53
44
|
ctx.tools.register(defineTool({
|
|
54
45
|
name: 'list_agents',
|
|
55
|
-
description: 'List
|
|
56
|
-
+ '
|
|
57
|
-
+ '
|
|
58
|
-
+ '
|
|
59
|
-
+ 'terminal, and not a result waiting to be collected; a `send_message` steers a running child at its nearest '
|
|
60
|
-
+ 'step boundary or starts a turn for an idle or ready child, and a direct child remains a `send_message` '
|
|
61
|
-
+ 'candidate in every status. The snapshot is not a delivery '
|
|
62
|
-
+ 'promise — `send_message` performs the authoritative check and may still fail. Children that could '
|
|
63
|
-
+ 'not be read are reported as diagnostics instead of being silently dropped. Scope `descendants` '
|
|
64
|
-
+ 'walks the whole tree below you in stable pre-order, annotating each entry with its durable direct-parent '
|
|
65
|
-
+ 'session id and depth. You may use `send_message` only for depth-1 entries; deeper entries are '
|
|
66
|
-
+ 'candidates for `interrupt_agent` only.',
|
|
46
|
+
description: 'List subagents you started, with their ids, labels, and status. '
|
|
47
|
+
+ 'running means it is working; inactive means it is not currently working. '
|
|
48
|
+
+ 'You will be notified when a subagent finishes; there is no need to keep checking its status. '
|
|
49
|
+
+ 'Use send_message to continue the conversation.',
|
|
67
50
|
parameters: {
|
|
68
51
|
scope: {
|
|
69
52
|
type: 'string',
|
|
70
53
|
enum: ['children', 'descendants'],
|
|
71
|
-
description: 'children (default) lists direct children
|
|
54
|
+
description: 'children (default) lists direct children, which accept send_message in any status. '
|
|
55
|
+
+ 'descendants lists the whole tree below you with each entry\'s parent session id and depth; entries deeper than 1 accept only interrupt_agent.',
|
|
72
56
|
},
|
|
73
57
|
},
|
|
74
58
|
output: {
|
|
@@ -83,7 +67,7 @@ export function apply(ctx) {
|
|
|
83
67
|
kind: { type: 'string', required: true, enum: ['child'] },
|
|
84
68
|
id: { type: 'string', required: true },
|
|
85
69
|
label: { type: 'string', required: true },
|
|
86
|
-
status: { type: 'string', required: true, enum: ['running', '
|
|
70
|
+
status: { type: 'string', required: true, enum: ['running', 'inactive'] },
|
|
87
71
|
parent: { type: 'string' },
|
|
88
72
|
depth: { type: 'number' },
|
|
89
73
|
},
|
|
@@ -129,8 +113,6 @@ export function apply(ctx) {
|
|
|
129
113
|
throw new Error('list_agents requires a calling agent (exec.agent was undefined)');
|
|
130
114
|
}
|
|
131
115
|
const request = resolveListAgentsRequest(args);
|
|
132
|
-
// The registry drains started tool bodies, so the scan must observe the
|
|
133
|
-
// call's signal rather than finish a slow catalog after cancellation.
|
|
134
116
|
switch (request.scope) {
|
|
135
117
|
case 'children': {
|
|
136
118
|
const entries = await ctx.subagents.listChildren(parent.id, exec.signal);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x1a0f3n9/dsh-tool-subagent-control",
|
|
3
3
|
"description": "Globally named send_message, interrupt_agent, and list_agents tools over ctx.subagents continuations",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,30 +32,30 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/cordis": "
|
|
36
|
-
"@x1a0f3n9/dsh-llm": "
|
|
37
|
-
"@x1a0f3n9/dsh-session": "
|
|
38
|
-
"@x1a0f3n9/dsh-subagent": "
|
|
39
|
-
"@x1a0f3n9/dsh-tools": "
|
|
35
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
36
|
+
"@x1a0f3n9/dsh-llm": "0.1.7-rc.2",
|
|
37
|
+
"@x1a0f3n9/dsh-session": "0.1.7-rc.2",
|
|
38
|
+
"@x1a0f3n9/dsh-subagent": "0.1.7-rc.2",
|
|
39
|
+
"@x1a0f3n9/dsh-tools": "0.1.7-rc.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@deepseek-ai/cordis": "
|
|
43
|
-
"@x1a0f3n9/dsh-agent": "
|
|
44
|
-
"@x1a0f3n9/dsh-agent-loop": "
|
|
45
|
-
"@x1a0f3n9/dsh-agent
|
|
46
|
-
"@x1a0f3n9/dsh-llm": "
|
|
47
|
-
"@x1a0f3n9/dsh-session": "
|
|
48
|
-
"@x1a0f3n9/dsh-session-persistence": "
|
|
49
|
-
"@x1a0f3n9/dsh-session-persistence-jsonl": "
|
|
50
|
-
"@x1a0f3n9/dsh-session-projection": "
|
|
51
|
-
"@x1a0f3n9/dsh-
|
|
52
|
-
"@x1a0f3n9/dsh-
|
|
53
|
-
"@x1a0f3n9/dsh-subagent-
|
|
54
|
-
"@x1a0f3n9/dsh-
|
|
55
|
-
"@x1a0f3n9/dsh-
|
|
42
|
+
"@deepseek-ai/cordis": "~4.0.4",
|
|
43
|
+
"@x1a0f3n9/dsh-agent-loop": "0.1.7-rc.2",
|
|
44
|
+
"@x1a0f3n9/dsh-agent-loop-testkit": "0.1.7-rc.2",
|
|
45
|
+
"@x1a0f3n9/dsh-agent": "0.1.7-rc.2",
|
|
46
|
+
"@x1a0f3n9/dsh-llm": "0.1.7-rc.2",
|
|
47
|
+
"@x1a0f3n9/dsh-session": "0.1.7-rc.2",
|
|
48
|
+
"@x1a0f3n9/dsh-session-persistence": "0.1.7-rc.2",
|
|
49
|
+
"@x1a0f3n9/dsh-session-persistence-jsonl": "0.1.7-rc.2",
|
|
50
|
+
"@x1a0f3n9/dsh-session-projection": "0.1.7-rc.2",
|
|
51
|
+
"@x1a0f3n9/dsh-subagent-fork-in-process": "0.1.7-rc.2",
|
|
52
|
+
"@x1a0f3n9/dsh-session-query": "0.1.7-rc.2",
|
|
53
|
+
"@x1a0f3n9/dsh-subagent-spawn-in-process": "0.1.7-rc.2",
|
|
54
|
+
"@x1a0f3n9/dsh-tools": "0.1.7-rc.2",
|
|
55
|
+
"@x1a0f3n9/dsh-subagent": "0.1.7-rc.2"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@x1a0f3n9/dsh-brand": "
|
|
59
|
-
"@x1a0f3n9/dsh-util-values": "
|
|
58
|
+
"@x1a0f3n9/dsh-brand": "0.1.7-rc.2",
|
|
59
|
+
"@x1a0f3n9/dsh-util-values": "0.1.7-rc.2"
|
|
60
60
|
}
|
|
61
61
|
}
|