dsh-subagent-control 0.0.0-stage → 1.0.1
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 +21 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/cordis.patch.yml +3 -0
- package/icon.svg +13 -0
- package/index.js +214 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +58 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
- Documentation: bilingual README (English + 简体中文) with usage examples, the
|
|
6
|
+
security model, and the name-collision note.
|
|
7
|
+
- Release: publishing now runs on GitHub Actions with npm trusted publishing
|
|
8
|
+
(OIDC) and provenance. No npm token is stored in the repository.
|
|
9
|
+
- No runtime change: the three tools and their JSON Schemas are identical to
|
|
10
|
+
1.0.0.
|
|
11
|
+
|
|
12
|
+
## 1.0.0
|
|
13
|
+
|
|
14
|
+
First release.
|
|
15
|
+
|
|
16
|
+
- `list_subagents` — list the caller's direct children or its whole descendant tree, with `running` / `inactive` status.
|
|
17
|
+
- `send_subagent_message` — send a follow-up message to a subagent the caller started.
|
|
18
|
+
- `interrupt_subagent` — stop a subagent (or any descendant) the caller started.
|
|
19
|
+
- Registers three new global tool names instead of shadowing the team bundle's `list_agents` / `send_message` / `interrupt_agent`.
|
|
20
|
+
- No runtime or peer dependencies; the module imports nothing.
|
|
21
|
+
- Localized display metadata (zh / en) and an SVG icon.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-subagent-control contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,165 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-subagent-control
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** · [简体中文](#简体中文)
|
|
4
|
+
|
|
5
|
+
Three tools that let any DSH agent — **including a team member** — list, steer and stop the subagents it started.
|
|
6
|
+
|
|
7
|
+
`list_subagents` · `send_subagent_message` · `interrupt_subagent`
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## English
|
|
12
|
+
|
|
13
|
+
### The problem
|
|
14
|
+
|
|
15
|
+
The Harness ships `list_agents`, `send_message` and `interrupt_agent`. When the Agent Team bundle is active, it registers tools with **those same three names** in every team member's exact Agent scope, and the more specific registration wins. Inside a teammate scope the team versions take over: they resolve `target` against the team roster only, and interrupting is a Lead-only operation.
|
|
16
|
+
|
|
17
|
+
The result: a teammate can start a subagent with `subagent`, but cannot list it, follow up with it, or stop it — even though the subagent service (`ctx.subagents`) has supported all three for any live agent all along, and its authority rules already allow an ancestor to manage its own descendants.
|
|
18
|
+
|
|
19
|
+
This bundle does not fight over the taken names. It registers three **new** names, globally, so the Lead and every teammate get them at once.
|
|
20
|
+
|
|
21
|
+
### Tools
|
|
22
|
+
|
|
23
|
+
| Tool | Parameters | Underlying call |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| `list_subagents` | `scope?`: `"children"` \| `"descendants"` (default `children`) | `ctx.subagents.listChildren()` / `listDescendants()` |
|
|
26
|
+
| `send_subagent_message` | `subagent_id`, `message` (both required) | `ctx.subagents.sendMessage()` |
|
|
27
|
+
| `interrupt_subagent` | `subagent_id` (required) | `ctx.subagents.interrupt()` with ancestor authority |
|
|
28
|
+
|
|
29
|
+
### Usage
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
list_subagents
|
|
33
|
+
→ 3b0f9c1e running "review the patch" depth=1
|
|
34
|
+
|
|
35
|
+
list_subagents scope=descendants
|
|
36
|
+
→ 3b0f9c1e running "review the patch" depth=1
|
|
37
|
+
7d2a44b0 inactive "check the tests" depth=2
|
|
38
|
+
|
|
39
|
+
send_subagent_message subagent_id=3b0f9c1e message="also look at locale/zh.json"
|
|
40
|
+
→ messageId=...
|
|
41
|
+
|
|
42
|
+
interrupt_subagent subagent_id=3b0f9c1e
|
|
43
|
+
→ accepted=true
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Each listing line is `id status "label" depth=`. `status` is `running` or `inactive` — **inactive means no turn is executing, not that the subagent is gone**. Use `send_subagent_message` to wake it.
|
|
47
|
+
|
|
48
|
+
### Behaviour and limits
|
|
49
|
+
|
|
50
|
+
- **One-shot subagents are hidden.** They cannot accept a follow-up message, so listing them would only invite a call that is guaranteed to fail.
|
|
51
|
+
- **A broken record is reported, not thrown.** A child whose state cannot be read comes back as a diagnostic entry (`corrupt` / `unsupported` / `unavailable`) instead of turning the whole listing into an error.
|
|
52
|
+
- **`send_subagent_message` reaches direct children only.** That is the service's own rule; the plugin does not widen it.
|
|
53
|
+
- **`interrupt_subagent` reaches descendants**, so a team Lead can also stop a grandchild.
|
|
54
|
+
- **Every failure names its cause**: no calling agent, unknown id, or an id that is not yours.
|
|
55
|
+
- **No config, no storage.** The bundle writes nothing and reads nothing outside the three services.
|
|
56
|
+
|
|
57
|
+
### Install
|
|
58
|
+
|
|
59
|
+
Through the plugin panel / market, or by asking the agent:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
plugin_manager install_bundle target "dsh-subagent-control@1.0.0"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
From a checkout, pass the **directory path** instead of the npm spec. The bundle applies immediately — no restart needed. Afterwards the three tool names are visible and the plugin row is enabled.
|
|
66
|
+
|
|
67
|
+
### Compatibility
|
|
68
|
+
|
|
69
|
+
- DSH with the `tools`, `subagents` and `agents` services (0.2.x and later).
|
|
70
|
+
- Node `^22.19.0 || >=24.0.0`.
|
|
71
|
+
- **Zero dependencies** — no runtime dependency, no peer dependency, not a single `import`. The tools are plain tool-table objects with explicit JSON Schemas, so they install and behave identically from npm or from a linked checkout.
|
|
72
|
+
|
|
73
|
+
### Name collisions
|
|
74
|
+
|
|
75
|
+
`dsh-subagent-library` also registers a global `list_subagents` tool. Two global registrations of one name cannot both win: install one of them, or remember that the other may shadow this one.
|
|
76
|
+
|
|
77
|
+
The three new names were chosen precisely because they do **not** collide with the built-in `list_agents` / `send_message` / `interrupt_agent`.
|
|
78
|
+
|
|
79
|
+
### Uninstall
|
|
80
|
+
|
|
81
|
+
Remove or disable the bundle in the plugin panel. Nothing is left behind.
|
|
82
|
+
|
|
83
|
+
### License
|
|
84
|
+
|
|
85
|
+
MIT — see [LICENSE](./LICENSE). Issues and source live at
|
|
86
|
+
[github.com/SpaceRelay/dsh-subagent-control](https://github.com/SpaceRelay/dsh-subagent-control).
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 简体中文
|
|
91
|
+
|
|
92
|
+
### 它解决什么问题
|
|
93
|
+
|
|
94
|
+
Harness 自带 `list_agents`、`send_message`、`interrupt_agent`。开启 Agent Team 后,团队插件会把**同名的三个工具**注册进每个团队成员的精确作用域,而更具体的作用域优先。于是在成员作用域里生效的是团队版:`target` 只认队友名,打断只有组长能做。
|
|
95
|
+
|
|
96
|
+
结果是:团队成员能用 `subagent` 派出子代理,却列不出、追问不了、也打断不了它。而底层的子代理服务(`ctx.subagents`)本来就支持这三件事,权限规则也允许祖先管理自己的后代。
|
|
97
|
+
|
|
98
|
+
本插件不去抢那三个被占用的名字,而是全局注册三个**新名字**,组长和每个组员立刻都能用。
|
|
99
|
+
|
|
100
|
+
### 工具
|
|
101
|
+
|
|
102
|
+
| 工具 | 参数 | 底层调用 |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| `list_subagents` | `scope?`:`"children"` 或 `"descendants"`,默认 `children` | `ctx.subagents.listChildren()` / `listDescendants()` |
|
|
105
|
+
| `send_subagent_message` | `subagent_id`、`message`(均必填) | `ctx.subagents.sendMessage()` |
|
|
106
|
+
| `interrupt_subagent` | `subagent_id`(必填) | `ctx.subagents.interrupt()`(祖先权限) |
|
|
107
|
+
|
|
108
|
+
### 用法
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
list_subagents
|
|
112
|
+
→ 3b0f9c1e running "review the patch" depth=1
|
|
113
|
+
|
|
114
|
+
list_subagents scope=descendants
|
|
115
|
+
→ 3b0f9c1e running "review the patch" depth=1
|
|
116
|
+
7d2a44b0 inactive "check the tests" depth=2
|
|
117
|
+
|
|
118
|
+
send_subagent_message subagent_id=3b0f9c1e message="顺手看一下 locale/zh.json"
|
|
119
|
+
→ messageId=...
|
|
120
|
+
|
|
121
|
+
interrupt_subagent subagent_id=3b0f9c1e
|
|
122
|
+
→ accepted=true
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
每行格式是 `id status "label" depth=`。`status` 为 `running` 或 `inactive`——**inactive 表示当前没有在跑,不代表子代理已经消失**;用 `send_subagent_message` 可以把它叫醒。
|
|
126
|
+
|
|
127
|
+
### 行为与边界
|
|
128
|
+
|
|
129
|
+
- **一次性子代理不会被列出。** 它们无法接收后续消息,列出来只会诱导一次注定失败的调用。
|
|
130
|
+
- **记录损坏时报告,而不是抛错。** 某个子代理状态读不出来,会作为诊断条目(`corrupt` / `unsupported` / `unavailable`)返回,而不是让整个列表失败。
|
|
131
|
+
- **`send_subagent_message` 只能发给直接子代理。** 这是服务本身的规则,插件没有放宽。
|
|
132
|
+
- **`interrupt_subagent` 覆盖所有后代**,所以组长也能打断孙代。
|
|
133
|
+
- **任何失败都说明原因**:没有调用者、id 不存在、或者不是你的子代理。
|
|
134
|
+
- **不写配置、不落存储。** 除了这三个服务,插件不读写任何东西。
|
|
135
|
+
|
|
136
|
+
### 安装
|
|
137
|
+
|
|
138
|
+
在插件面板 / 市场中安装,或者让智能体执行:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
plugin_manager install_bundle target "dsh-subagent-control@1.0.0"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
从本地目录安装时,把 npm 规格换成**目录路径**。安装即时生效,无需重启;装完后三个工具名可见、插件行为已启用。
|
|
145
|
+
|
|
146
|
+
### 兼容性
|
|
147
|
+
|
|
148
|
+
- 具备 `tools`、`subagents`、`agents` 三个服务的 DSH(0.2.x 及以上)。
|
|
149
|
+
- Node `^22.19.0 || >=24.0.0`。
|
|
150
|
+
- **零依赖**:没有运行时依赖、没有 peer 依赖,模块里一行 `import` 都没有。工具是带显式 JSON Schema 的普通定义对象,所以 npm 安装与软链安装行为完全一致。
|
|
151
|
+
|
|
152
|
+
### 撞名
|
|
153
|
+
|
|
154
|
+
`dsh-subagent-library` 也注册了全局的 `list_subagents`。同一个名字的两个全局注册不可能同时生效——二选一安装,或记住其中一个可能被另一个覆盖。
|
|
155
|
+
|
|
156
|
+
这三个新名字是特意挑的,**不会**和内置的 `list_agents` / `send_message` / `interrupt_agent` 冲突。
|
|
157
|
+
|
|
158
|
+
### 卸载
|
|
159
|
+
|
|
160
|
+
在插件面板里移除或停用即可,不会留下任何残留。
|
|
161
|
+
|
|
162
|
+
### 许可
|
|
163
|
+
|
|
164
|
+
MIT,见 [LICENSE](./LICENSE)。源码与问题反馈:
|
|
165
|
+
[github.com/SpaceRelay/dsh-subagent-control](https://github.com/SpaceRelay/dsh-subagent-control)。
|
package/cordis.patch.yml
ADDED
package/icon.svg
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="Subagent control">
|
|
2
|
+
<rect x="2" y="2" width="60" height="60" rx="14" fill="#1f6feb"/>
|
|
3
|
+
<g fill="none" stroke="#ffffff" stroke-width="3.5" stroke-linecap="round">
|
|
4
|
+
<path d="M32 20v9"/>
|
|
5
|
+
<path d="M32 29H16v8"/>
|
|
6
|
+
<path d="M32 29h16v8"/>
|
|
7
|
+
<path d="M32 29v8"/>
|
|
8
|
+
</g>
|
|
9
|
+
<circle cx="32" cy="15" r="6" fill="#ffffff"/>
|
|
10
|
+
<circle cx="16" cy="43" r="5" fill="#ffffff"/>
|
|
11
|
+
<circle cx="32" cy="43" r="5" fill="#ffffff"/>
|
|
12
|
+
<circle cx="48" cy="43" r="5" fill="#ffffff"/>
|
|
13
|
+
</svg>
|
package/index.js
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subagent control tools.
|
|
3
|
+
*
|
|
4
|
+
* The Harness already registers `list_agents` / `send_message` /
|
|
5
|
+
* `interrupt_agent`, but the Agent Team plugin registers tools with those same
|
|
6
|
+
* three names in each team member's exact Agent scope, so inside a teammate
|
|
7
|
+
* scope the team versions win: they resolve `target` against the team roster
|
|
8
|
+
* only, and `interrupt_agent` is Lead-only. A team member therefore cannot
|
|
9
|
+
* list, steer, or stop the subagents it started, even though
|
|
10
|
+
* `ctx.subagents` already supports all three operations for any live agent.
|
|
11
|
+
*
|
|
12
|
+
* This plugin registers three differently named tools instead of fighting over
|
|
13
|
+
* the taken names. They are registered globally, so the Lead and every team
|
|
14
|
+
* member get them; the subagent service itself enforces that a caller can only
|
|
15
|
+
* reach its own direct children (`sendMessage`) or its own descendants
|
|
16
|
+
* (`interrupt`).
|
|
17
|
+
*
|
|
18
|
+
* This module deliberately imports nothing: the tool definitions below are
|
|
19
|
+
* plain registry-ready objects with explicit JSON Schemas, so the package has
|
|
20
|
+
* no runtime or peer dependencies and installs the same way from npm or from a
|
|
21
|
+
* linked checkout.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export const name = 'subagent-control'
|
|
25
|
+
|
|
26
|
+
export const inject = ['tools', 'subagents', 'agents']
|
|
27
|
+
|
|
28
|
+
/** Detail rows returned by the subagent catalog. */
|
|
29
|
+
const CHILD_ITEM = {
|
|
30
|
+
type: 'object',
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
required: ['kind', 'id', 'label', 'status'],
|
|
33
|
+
properties: {
|
|
34
|
+
kind: { type: 'string', enum: ['child'] },
|
|
35
|
+
id: { type: 'string' },
|
|
36
|
+
label: { type: 'string' },
|
|
37
|
+
status: { type: 'string', enum: ['running', 'inactive'] },
|
|
38
|
+
parent: { type: 'string' },
|
|
39
|
+
depth: { type: 'number' },
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const DIAGNOSTIC_ITEM = {
|
|
44
|
+
type: 'object',
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
required: ['kind', 'id', 'reason'],
|
|
47
|
+
properties: {
|
|
48
|
+
kind: { type: 'string', enum: ['diagnostic'] },
|
|
49
|
+
id: { type: 'string' },
|
|
50
|
+
reason: { type: 'string', enum: ['corrupt', 'unsupported', 'unavailable'] },
|
|
51
|
+
parent: { type: 'string' },
|
|
52
|
+
depth: { type: 'number' },
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** A tool needs a calling agent; a schedule or an external call has none. */
|
|
57
|
+
function requireAgent(exec, tool) {
|
|
58
|
+
const agent = exec.agent
|
|
59
|
+
if (agent === undefined) {
|
|
60
|
+
throw new Error(`${tool} requires a calling agent (exec.agent was undefined)`)
|
|
61
|
+
}
|
|
62
|
+
return agent
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Report only whether the subagent is working, never whether it is loaded. */
|
|
66
|
+
function statusOf(agents, id) {
|
|
67
|
+
return agents.get(id)?.status === 'running' ? 'running' : 'inactive'
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** One catalog row to one model-visible entry; one-shot children are omitted. */
|
|
71
|
+
function project(agents, entry, position) {
|
|
72
|
+
const at = position === undefined ? {} : { parent: position.parentId, depth: position.depth }
|
|
73
|
+
if (entry.kind === 'diagnostic') {
|
|
74
|
+
return { kind: 'diagnostic', id: entry.id, reason: entry.reason, ...at }
|
|
75
|
+
}
|
|
76
|
+
if (entry.mode !== 'continuable') return undefined
|
|
77
|
+
return {
|
|
78
|
+
kind: 'child',
|
|
79
|
+
id: entry.id,
|
|
80
|
+
label: entry.label,
|
|
81
|
+
status: statusOf(agents, entry.id),
|
|
82
|
+
...at,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function renderEntry(entry) {
|
|
87
|
+
if (entry.kind === 'diagnostic') {
|
|
88
|
+
const at = entry.parent === undefined ? '' : ` parent=${entry.parent}`
|
|
89
|
+
return `[${entry.reason}] ${entry.id}${at}`
|
|
90
|
+
}
|
|
91
|
+
const depth = entry.depth === undefined ? '' : ` depth=${entry.depth}`
|
|
92
|
+
return `${entry.id} ${entry.status} ${JSON.stringify(entry.label)}${depth}`
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function apply(ctx) {
|
|
96
|
+
/* ---------------------------------------------------------------- list */
|
|
97
|
+
|
|
98
|
+
ctx.tools.register({
|
|
99
|
+
name: 'list_subagents',
|
|
100
|
+
description:
|
|
101
|
+
'List the subagents you started, with their ids, labels and status. ' +
|
|
102
|
+
'running means it is working; inactive means it is not working right now, which does not mean it is gone. ' +
|
|
103
|
+
'You are notified when a subagent finishes, so there is no need to poll. ' +
|
|
104
|
+
'Use send_subagent_message to continue a conversation with one of them.',
|
|
105
|
+
parameters: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
additionalProperties: false,
|
|
108
|
+
properties: {
|
|
109
|
+
scope: {
|
|
110
|
+
type: 'string',
|
|
111
|
+
enum: ['children', 'descendants'],
|
|
112
|
+
description:
|
|
113
|
+
'children (default) lists your direct children, which accept send_subagent_message in any status. ' +
|
|
114
|
+
'descendants lists the whole tree below you with each entry parent and depth; ' +
|
|
115
|
+
'entries deeper than one level accept only interrupt_subagent.',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
output: {
|
|
120
|
+
schema: { type: 'array', items: { oneOf: [CHILD_ITEM, DIAGNOSTIC_ITEM] } },
|
|
121
|
+
render: (_args, entries) => [
|
|
122
|
+
{
|
|
123
|
+
type: 'text',
|
|
124
|
+
text: entries.length === 0 ? '(no subagents)' : entries.map(renderEntry).join('\n'),
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
async execute(args, exec) {
|
|
129
|
+
const caller = requireAgent(exec, 'list_subagents')
|
|
130
|
+
if ((args.scope ?? 'children') === 'descendants') {
|
|
131
|
+
const rows = await ctx.subagents.listDescendants(caller.id, exec.signal)
|
|
132
|
+
return rows.map((row) => project(ctx.agents, row, row)).filter(Boolean)
|
|
133
|
+
}
|
|
134
|
+
const rows = await ctx.subagents.listChildren(caller.id, exec.signal)
|
|
135
|
+
return rows.map((row) => project(ctx.agents, row)).filter(Boolean)
|
|
136
|
+
},
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
/* ---------------------------------------------------------------- send */
|
|
140
|
+
|
|
141
|
+
ctx.tools.register({
|
|
142
|
+
name: 'send_subagent_message',
|
|
143
|
+
description:
|
|
144
|
+
'Send a follow-up message to a subagent you started. ' +
|
|
145
|
+
'A running subagent receives it at its next step; a finished one is resumed with it. ' +
|
|
146
|
+
'Only a direct child accepts a message; use list_subagents to find its id. ' +
|
|
147
|
+
'This returns delivery confirmation, not the answer — the answer arrives as a new message.',
|
|
148
|
+
parameters: {
|
|
149
|
+
type: 'object',
|
|
150
|
+
additionalProperties: false,
|
|
151
|
+
required: ['subagent_id', 'message'],
|
|
152
|
+
properties: {
|
|
153
|
+
subagent_id: {
|
|
154
|
+
type: 'string',
|
|
155
|
+
description: 'The id of your direct subagent, from list_subagents.',
|
|
156
|
+
},
|
|
157
|
+
message: { type: 'string', description: 'The message to deliver.' },
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
output: {
|
|
161
|
+
schema: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
additionalProperties: false,
|
|
164
|
+
required: ['messageId'],
|
|
165
|
+
properties: { messageId: { type: 'string' } },
|
|
166
|
+
},
|
|
167
|
+
render: (args) => [{ type: 'text', text: `message delivered to subagent ${args.subagent_id}` }],
|
|
168
|
+
},
|
|
169
|
+
async execute(args, exec) {
|
|
170
|
+
const caller = requireAgent(exec, 'send_subagent_message')
|
|
171
|
+
const content = [{ type: 'text', text: args.message }]
|
|
172
|
+
const messageId = await ctx.subagents.sendMessage(caller, args.subagent_id, content, {
|
|
173
|
+
signal: exec.signal,
|
|
174
|
+
})
|
|
175
|
+
return { messageId }
|
|
176
|
+
},
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
/* ----------------------------------------------------------- interrupt */
|
|
180
|
+
|
|
181
|
+
ctx.tools.register({
|
|
182
|
+
name: 'interrupt_subagent',
|
|
183
|
+
description:
|
|
184
|
+
'Ask a subagent under you to stop its current work. Returns without waiting for it to stop. ' +
|
|
185
|
+
'A subagent that finished on its own is unaffected. ' +
|
|
186
|
+
'Subagents it started keep running; interrupt those separately with their own ids.',
|
|
187
|
+
parameters: {
|
|
188
|
+
type: 'object',
|
|
189
|
+
additionalProperties: false,
|
|
190
|
+
required: ['subagent_id'],
|
|
191
|
+
properties: {
|
|
192
|
+
subagent_id: {
|
|
193
|
+
type: 'string',
|
|
194
|
+
description:
|
|
195
|
+
'The id of a subagent created under you: a direct child or any deeper descendant.',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
output: {
|
|
200
|
+
schema: {
|
|
201
|
+
type: 'object',
|
|
202
|
+
additionalProperties: false,
|
|
203
|
+
required: ['accepted'],
|
|
204
|
+
properties: { accepted: { type: 'boolean' } },
|
|
205
|
+
},
|
|
206
|
+
render: (args) => [{ type: 'text', text: `interrupt requested for subagent ${args.subagent_id}` }],
|
|
207
|
+
},
|
|
208
|
+
execute(args, exec) {
|
|
209
|
+
const caller = requireAgent(exec, 'interrupt_subagent')
|
|
210
|
+
ctx.subagents.interrupt(args.subagent_id, { kind: 'ancestor', agent: caller })
|
|
211
|
+
return Promise.resolve({ accepted: true })
|
|
212
|
+
},
|
|
213
|
+
})
|
|
214
|
+
}
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-subagent-control",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Three tools — list_subagents, send_subagent_message, interrupt_subagent — that let any agent, including a team member, list, steer and stop the subagents it started.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "SpaceRelay",
|
|
8
|
+
"url": "https://github.com/SpaceRelay"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "index.js",
|
|
12
|
+
"icon": "./icon.svg",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": "./index.js",
|
|
15
|
+
"./package.json": "./package.json",
|
|
16
|
+
"./locale/*.json": "./locale/*.json",
|
|
17
|
+
"./icon": "./icon.svg"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js",
|
|
21
|
+
"cordis.patch.yml",
|
|
22
|
+
"locale/*.json",
|
|
23
|
+
"icon.svg",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"CHANGELOG.md"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"dsh",
|
|
30
|
+
"dsh-plugin",
|
|
31
|
+
"deepseek-harness",
|
|
32
|
+
"cordis-plugin",
|
|
33
|
+
"subagent",
|
|
34
|
+
"agents",
|
|
35
|
+
"agent-team",
|
|
36
|
+
"orchestration"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "node test/smoke.mjs"
|
|
43
|
+
},
|
|
44
|
+
"dsh": {
|
|
45
|
+
"bundle": {
|
|
46
|
+
"patch": "./cordis.patch.yml"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/SpaceRelay/dsh-subagent-control.git"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/SpaceRelay/dsh-subagent-control#readme",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/SpaceRelay/dsh-subagent-control/issues"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
}
|
|
60
|
+
}
|