@deepseek-ai/dsh-tool-subagent-control 0.2.1-rc.4 → 0.2.2-alpha.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 CHANGED
@@ -3,23 +3,23 @@
3
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
5
  /:
6
- en: 5413b8e52a0c8e3d
7
- zh: 9b6d0385209ff9bb
6
+ en: 2ed769ff79f88a4b
7
+ zh: 73fcdc6c2ec4334c
8
8
  /deepseek-ai-dsh-tool-subagent-control:
9
9
  en: 465d36925c792167
10
10
  zh: 269cac314f638827
11
11
  /deepseek-ai-dsh-tool-subagent-control/summary:
12
- en: 7464eb99b6f618eb
13
- zh: 8c7628c8e9f163ca
12
+ en: 49b8e317dae5d896
13
+ zh: dabe302587aacde2
14
14
  /deepseek-ai-dsh-tool-subagent-control/table-of-contents:
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
17
17
  /deepseek-ai-dsh-tool-subagent-control/use-this-package:
18
- en: 27c5bbe682f0b72b
19
- zh: b16aeb2c43f3692e
18
+ en: 8b2e49621394d15d
19
+ zh: eb235870eac36532
20
20
  /deepseek-ai-dsh-tool-subagent-control/use-this-package/minimal-configuration:
21
- en: 4a52c81317ec9001
22
- zh: ebd9f1ba920da50a
21
+ en: 4b4bf179ea0f1ecb
22
+ zh: f5cee3cb40710ace
23
23
  /deepseek-ai-dsh-tool-subagent-control/use-this-package/send-message:
24
24
  en: d80bb1df2eb740b7
25
25
  zh: e3203d9868a82910
@@ -42,11 +42,11 @@
42
42
  en: 70e344022e6e535e
43
43
  zh: 355488590648a82e
44
44
  /deepseek-ai-dsh-tool-subagent-control/understand-the-implementation/source-map:
45
- en: 95f73146f8735ab1
46
- zh: 9c67e064c4000613
45
+ en: fd6385e36c6b457b
46
+ zh: 8fe9a57b7e75dd82
47
47
  /deepseek-ai-dsh-tool-subagent-control/further-exploration:
48
- en: df2bf39d0ffffd43
49
- zh: 4cd02551f7433c90
48
+ en: 3d7732f704f4c6eb
49
+ zh: 824876825a8b9a71
50
50
  /deepseek-ai-dsh-tool-subagent-control/model-experience:
51
51
  en: 215e7ba838619b7b
52
52
  zh: a311da3843709f90
@@ -54,8 +54,8 @@
54
54
  en: e4c7376d4f29dbd5
55
55
  zh: 6b7a9eaf69c9ea53
56
56
  /deepseek-ai-dsh-tool-subagent-control/model-experience/tool-schema/what-the-model-sees:
57
- en: b32bc9bcb45a8c77
58
- zh: 4bd3eba1e8612da7
57
+ en: e7622a6166907d37
58
+ zh: 3acea46fe839cf5e
59
59
  /deepseek-ai-dsh-tool-subagent-control/model-experience/tool-schema/token-effect:
60
60
  en: db207dc8d5860684
61
61
  zh: ad2663b4967fbca9
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Global send_message, interrupt_agent, and list_agents tools for users and maintainers composing or debugging continuable-child control."
2
+ description: "Shared messaging, interruption, and child discovery tools for users and maintainers composing or debugging continuable-child control."
3
3
  kind: "package-reference"
4
4
  ---
5
5
 
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- `dsh-tool-subagent-control` adds the global control tools for continuable children: `send_message` steers between a direct parent and child, `interrupt_agent` stops a child's current turn while keeping its inbox and descendants intact, and `list_agents` (from the separately loadable `list-agents` plugin) lists continuable children by durable id and label. Parents and continuable children inherit the same `send_message` definition and ordering, so model communication adds no child-only tool schema. No tool's presence decides whether a delegation tool starts continuable work.
12
+ `dsh-tool-subagent-control` lets agents message and interrupt subagents and list continuable children. One plugin instance registers all three tools for a scope shared by multiple delegation backends. Parents and continuable children inherit the same messaging definition and ordering. Tool presence does not select the delegation lifecycle.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -25,11 +25,11 @@ English | [中文](README.zh.md)
25
25
  <a id="use-this-package"></a>
26
26
  ## Use this package
27
27
 
28
- Mount this package in any composition with continuable children the model should message, interrupt, or list. The root plugin needs only the subagent service; the list tool is a separate plugin a deployment can omit.
28
+ Mount this package once per tool scope. It requires `tools`, `subagents`, and `agents`.
29
29
 
30
30
  ### Minimal configuration
31
31
 
32
- Load the subagent service, a backend, the delegation tool, and this package. Adding the separate list plugin exposes all three tools:
32
+ With the required services available, load the subagent service, a backend, the delegation tool, and this package to expose all three control and discovery tools:
33
33
 
34
34
  ```yaml
35
35
  - name: '@deepseek-ai/dsh-subagent'
@@ -38,10 +38,9 @@ Load the subagent service, a backend, the delegation tool, and this package. Add
38
38
  config:
39
39
  provider: spawn
40
40
  - name: '@deepseek-ai/dsh-tool-subagent-control'
41
- - name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
42
41
  ```
43
42
 
44
- This package takes no configuration: the root plugin provides `send_message` and `interrupt_agent`, and the list plugin provides `list_agents`.
43
+ This package takes no configuration. Its main entry registers `send_message`, `interrupt_agent`, and `list_agents` together; existing tool restrictions can hide individual tools.
45
44
 
46
45
  ### send_message
47
46
 
@@ -81,7 +80,7 @@ The tool forwards its execution signal, which owns admission only until inbox ac
81
80
 
82
81
  | File | Role |
83
82
  |---|---|
84
- | [`src/index.ts`](src/index.ts) | `send_message` and `interrupt_agent` registration |
83
+ | [`src/index.ts`](src/index.ts) | Shared registration of all three tools |
85
84
  | [`src/list-agents.ts`](src/list-agents.ts) | `list_agents` registration: direct-child discovery and status refinement |
86
85
 
87
86
  </details>
@@ -95,7 +94,7 @@ Read these pages when the package-level contract is not enough; they move from t
95
94
 
96
95
  - [Subagent subsystem](../../../docs/subsystems/subagent.md) — continuable children, activations, inbox, interrupt, and follow-up authority.
97
96
  - [dsh-tool-subagent](../tool-subagent/README.md) — the delegation tool that starts continuable children.
98
- - [Generated tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent-control) — the three tool schemas.
97
+ - [Generated tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent-control) — the tool schemas.
99
98
 
100
99
  -----
101
100
 
@@ -106,7 +105,7 @@ Read these pages when the package-level contract is not enough; they move from t
106
105
 
107
106
  #### What the model sees
108
107
 
109
- The generated [schemas](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent-control): `send_message` takes `agent_id` and `message`; `interrupt_agent` takes `agent_id`; `list_agents` takes no parameters.
108
+ The generated [schemas](../../../docs/tool-catalog.md#deepseek-aidsh-tool-subagent-control): `send_message` takes `agent_id` and `message`; `interrupt_agent` takes `agent_id`; `list_agents` accepts an optional `scope`.
110
109
 
111
110
  #### Token effect
112
111
 
package/README.zh.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "供用户与维护者在组合或调试可继续子级控制功能时使用的全局 send_message、interrupt_agent 与 list_agents 工具。"
2
+ description: "供用户与维护者在组合或调试可继续子级控制功能时使用的共享消息、中断与子级发现工具。"
3
3
  kind: "package-reference"
4
4
  ---
5
5
 
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
11
 
12
- `dsh-tool-subagent-control` 为可继续子级添加全局控制工具:`send_message` 在直接父级与子级之间进行 steering(中途引导),`interrupt_agent` 停止子级当前轮次但保留其收件箱与后代,`list_agents`(来自可单独加载的 `list-agents` 插件)按持久化 ID 与标签列出可继续子级。父级与可继续子级继承相同的 `send_message` 定义和顺序,因此模型通信不会增加子级专属工具 schema。是否加载这些工具不会决定委派工具是否启动可继续工作。
12
+ `dsh-tool-subagent-control` 让 agent 向子智能体发消息、中断子智能体、列出可继续子级。一个插件实例为多个委派后端共享的作用域注册全部三个工具。父级与可继续子级继承相同的消息定义和顺序。工具存在不选择委派生命周期。
13
13
 
14
14
  ## 目录
15
15
 
@@ -25,11 +25,11 @@ kind: "package-reference"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
- 在模型需要对可继续子级发消息、中断或列出的任何组合中挂载本包。根插件只需要 subagent 服务;列表工具是独立插件,部署方可以省略。
28
+ 每个工具作用域挂载本包一次。它要求 `tools`、`subagents` 和 `agents`。
29
29
 
30
30
  ### 最小配置
31
31
 
32
- 先加载 subagent 服务、一个后端、委派工具与本包。加上独立的列表插件即可公开全部三个工具:
32
+ 在所需服务可用后,加载 subagent 服务、一个后端、委派工具与本包,即可公开全部三个控制和发现工具:
33
33
 
34
34
  ```yaml
35
35
  - name: '@deepseek-ai/dsh-subagent'
@@ -38,10 +38,9 @@ kind: "package-reference"
38
38
  config:
39
39
  provider: spawn
40
40
  - name: '@deepseek-ai/dsh-tool-subagent-control'
41
- - name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
42
41
  ```
43
42
 
44
- 本包不接收任何配置:根插件提供 `send_message` 与 `interrupt_agent`,列表插件提供 `list_agents`。
43
+ 本包不接收任何配置。主入口一起注册 `send_message`、`interrupt_agent` 和 `list_agents`;现有工具限制可以隐藏单个工具。
45
44
 
46
45
  ### send_message
47
46
 
@@ -81,7 +80,7 @@ kind: "package-reference"
81
80
 
82
81
  | 文件 | 职责 |
83
82
  |---|---|
84
- | [`src/index.ts`](src/index.ts) | `send_message` 与 `interrupt_agent` 注册 |
83
+ | [`src/index.ts`](src/index.ts) | 统一注册全部三个工具 |
85
84
  | [`src/list-agents.ts`](src/list-agents.ts) | `list_agents` 注册:直接子级发现与状态细化 |
86
85
 
87
86
  </details>
@@ -95,7 +94,7 @@ kind: "package-reference"
95
94
 
96
95
  - [Subagent 子系统](../../../docs/subsystems/subagent.zh.md)——可继续子级、Activation、inbox、中断与后续消息权限。
97
96
  - [dsh-tool-subagent](../tool-subagent/README.zh.md)——启动可继续子级的委派工具。
98
- - [生成工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-subagent-control)——三个工具的 schema。
97
+ - [生成工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-subagent-control)——工具 schema。
99
98
 
100
99
  -----
101
100
 
@@ -106,7 +105,7 @@ kind: "package-reference"
106
105
 
107
106
  #### 模型看到什么
108
107
 
109
- 已生成的 [schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-subagent-control):`send_message` 接受 `agent_id` 与 `message`;`interrupt_agent` 接受 `agent_id`;`list_agents` 不接受参数。
108
+ 已生成的 [schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-subagent-control):`send_message` 接受 `agent_id` 与 `message`;`interrupt_agent` 接受 `agent_id`;`list_agents` 接受可选的 `scope`。
110
109
 
111
110
  #### Token 影响
112
111
 
package/lib/index.js CHANGED
@@ -1,11 +1,140 @@
1
1
  import { brandString } from "@deepseek-ai/dsh-brand";
2
2
  import { defineTool } from "@deepseek-ai/dsh-tools";
3
3
  import { markAdjacentAgentSendMessageTool } from "@deepseek-ai/dsh-subagent/internal";
4
+ import { assertNever } from "@deepseek-ai/dsh-util-values";
5
+ //#region lib/types/list-agents.js
6
+ /**
7
+ * The globally named `list_agents` tool: a thin model-facing adapter over
8
+ * the continuable projection of `ctx.subagents.listChildren()` and, for the
9
+ * `descendants` scope, `ctx.subagents.listDescendants()`. The control plugin owns
10
+ * registration and disposal alongside messaging and interruption.
11
+ */
12
+ /** Resolve the optional model request into an internal required-scope spec. */
13
+ function resolveListAgentsRequest(request) {
14
+ return { scope: request.scope ?? "children" };
15
+ }
16
+ /** Report turn activity without exposing whether the child is loaded. */
17
+ function statusOf(agents, id) {
18
+ return agents.get(id)?.status === "running" ? "running" : "inactive";
19
+ }
20
+ /** Project one service row into the model-facing entry, or omit a one-shot child. */
21
+ function project(agents, entry, position) {
22
+ const at = position === void 0 ? {} : {
23
+ parent: position.parentId,
24
+ depth: position.depth
25
+ };
26
+ if ("kind" in entry && entry.kind === "diagnostic") return {
27
+ kind: "diagnostic",
28
+ id: entry.id,
29
+ reason: entry.reason,
30
+ ...at
31
+ };
32
+ if (entry.mode !== "continuable") return void 0;
33
+ return {
34
+ kind: "child",
35
+ id: entry.id,
36
+ label: entry.label,
37
+ status: statusOf(agents, entry.id),
38
+ ...at
39
+ };
40
+ }
41
+ /**
42
+ * Register the `list_agents` tool.
43
+ * @param ctx - context carrying the tool registry, subagent service, and live Agent registry.
44
+ */
45
+ function registerListAgents(ctx) {
46
+ ctx.tools.register(defineTool({
47
+ name: "list_agents",
48
+ description: "List subagents you started, with their ids, labels, and status. running means it is working; inactive means it is not currently working. You will be notified when a subagent finishes; there is no need to keep checking its status. Use send_message to continue the conversation.",
49
+ parameters: { scope: {
50
+ type: "string",
51
+ enum: ["children", "descendants"],
52
+ description: "children (default) lists direct children, which accept send_message in any status. descendants lists the whole tree below you with each entry's parent session id and depth; entries deeper than 1 accept only interrupt_agent."
53
+ } },
54
+ output: {
55
+ schema: {
56
+ type: "array",
57
+ items: { oneOf: [{
58
+ type: "object",
59
+ additionalProperties: false,
60
+ properties: {
61
+ kind: {
62
+ type: "string",
63
+ required: true,
64
+ enum: ["child"]
65
+ },
66
+ id: {
67
+ type: "string",
68
+ required: true
69
+ },
70
+ label: {
71
+ type: "string",
72
+ required: true
73
+ },
74
+ status: {
75
+ type: "string",
76
+ required: true,
77
+ enum: ["running", "inactive"]
78
+ },
79
+ parent: { type: "string" },
80
+ depth: { type: "number" }
81
+ }
82
+ }, {
83
+ type: "object",
84
+ additionalProperties: false,
85
+ properties: {
86
+ kind: {
87
+ type: "string",
88
+ required: true,
89
+ enum: ["diagnostic"]
90
+ },
91
+ id: {
92
+ type: "string",
93
+ required: true
94
+ },
95
+ reason: {
96
+ type: "string",
97
+ required: true,
98
+ enum: [
99
+ "corrupt",
100
+ "unsupported",
101
+ "unavailable"
102
+ ]
103
+ },
104
+ parent: { type: "string" },
105
+ depth: { type: "number" }
106
+ }
107
+ }] }
108
+ },
109
+ render: (args, entries) => {
110
+ const request = resolveListAgentsRequest(args);
111
+ return [{
112
+ type: "text",
113
+ text: entries.length === 0 ? "(no subagents)" : entries.map((entry) => {
114
+ const at = request.scope === "descendants" ? ` parent=${String(entry.parent)} depth=${String(entry.depth)}` : "";
115
+ return entry.kind === "child" ? `${entry.id} [${entry.status}]${at} — ${entry.label}` : `${entry.id} [diagnostic: ${entry.reason}]${at}`;
116
+ }).join("\n")
117
+ }];
118
+ }
119
+ },
120
+ async execute(args, exec) {
121
+ const parent = exec.agent;
122
+ if (!parent) throw new Error("list_agents requires a calling agent (exec.agent was undefined)");
123
+ const request = resolveListAgentsRequest(args);
124
+ switch (request.scope) {
125
+ case "children": return (await ctx.subagents.listChildren(parent.id, exec.signal)).map((entry) => project(ctx.agents, entry)).filter((entry) => entry !== void 0);
126
+ case "descendants": return (await ctx.subagents.listDescendants(parent.id, exec.signal)).map((entry) => project(ctx.agents, entry, entry)).filter((entry) => entry !== void 0);
127
+ /* v8 ignore next 2 -- the resolver normalizes the schema-validated closed scope before dispatch. */
128
+ default: return assertNever(request.scope, "list_agents scope");
129
+ }
130
+ }
131
+ }));
132
+ }
133
+ //#endregion
4
134
  //#region lib/types/index.js
5
135
  /**
6
- * The globally named `send_message` and `interrupt_agent` tools: thin
7
- * model-facing adapters over `ctx.subagents.sendMessage()` and
8
- * `ctx.subagents.interrupt()`. They perform no lifecycle routing of their own —
136
+ * Shared messaging, interruption, and child discovery tools.
137
+ * They perform no lifecycle routing of their own —
9
138
  * residency, cold resume, and interrupt authorization belong to the subagent
10
139
  * service — and they live apart from the provider-bound
11
140
  * `@deepseek-ai/dsh-tool-subagent` instances so multiple delegation tools share
@@ -13,12 +142,17 @@ import { markAdjacentAgentSendMessageTool } from "@deepseek-ai/dsh-subagent/inte
13
142
  * @module @deepseek-ai/dsh-tool-subagent-control
14
143
  */
15
144
  const name = "tool-subagent-control";
16
- const inject = ["tools", "subagents"];
145
+ const inject = [
146
+ "tools",
147
+ "subagents",
148
+ "agents"
149
+ ];
17
150
  /**
18
- * Register the `send_message` and `interrupt_agent` tools.
19
- * @param ctx - context carrying the tool registry and subagent service.
151
+ * Register the shared subagent control and discovery tools.
152
+ * @param ctx - context carrying tools, subagents, and live Agents.
20
153
  */
21
154
  function apply(ctx) {
155
+ registerListAgents(ctx);
22
156
  ctx.tools.register(markAdjacentAgentSendMessageTool(defineTool({
23
157
  name: "send_message",
24
158
  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.",
@@ -1,7 +1,6 @@
1
1
  /**
2
- * The globally named `send_message` and `interrupt_agent` tools: thin
3
- * model-facing adapters over `ctx.subagents.sendMessage()` and
4
- * `ctx.subagents.interrupt()`. They perform no lifecycle routing of their own —
2
+ * Shared messaging, interruption, and child discovery tools.
3
+ * They perform no lifecycle routing of their own —
5
4
  * residency, cold resume, and interrupt authorization belong to the subagent
6
5
  * service — and they live apart from the provider-bound
7
6
  * `@deepseek-ai/dsh-tool-subagent` instances so multiple delegation tools share
@@ -12,8 +11,8 @@ import type { Context } from '@deepseek-ai/cordis';
12
11
  export declare const name = "tool-subagent-control";
13
12
  export declare const inject: string[];
14
13
  /**
15
- * Register the `send_message` and `interrupt_agent` tools.
16
- * @param ctx - context carrying the tool registry and subagent service.
14
+ * Register the shared subagent control and discovery tools.
15
+ * @param ctx - context carrying tools, subagents, and live Agents.
17
16
  */
18
17
  export declare function apply(ctx: Context): void;
19
18
  //# sourceMappingURL=index.d.ts.map
@@ -1,17 +1,13 @@
1
1
  /**
2
2
  * The globally named `list_agents` tool: a thin model-facing adapter over
3
3
  * the continuable projection of `ctx.subagents.listChildren()` and, for the
4
- * `descendants` scope, `ctx.subagents.listDescendants()`. It stays separately
5
- * loadable from the root `send_message` plugin so a deployment can register
6
- * continuation delivery without exposing discovery.
7
- * @module @deepseek-ai/dsh-tool-subagent-control/list-agents
4
+ * `descendants` scope, `ctx.subagents.listDescendants()`. The control plugin owns
5
+ * registration and disposal alongside messaging and interruption.
8
6
  */
9
7
  import type { Context } from '@deepseek-ai/cordis';
10
- export declare const name = "tool-subagent-list-agents";
11
- export declare const inject: string[];
12
8
  /**
13
9
  * Register the `list_agents` tool.
14
10
  * @param ctx - context carrying the tool registry, subagent service, and live Agent registry.
15
11
  */
16
- export declare function apply(ctx: Context): void;
12
+ export declare function registerListAgents(ctx: Context): void;
17
13
  //# sourceMappingURL=list-agents.d.ts.map
package/locale/de.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Kontrolltools für Subagenten",
4
+ "description": "Lassen Sie die KI Nachrichten an Subagenten senden oder deren Betrieb unterbrechen."
5
+ }
6
+ }
package/locale/es.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Herramientas de control de subagentes",
4
+ "description": "Deje que la IA envíe mensajes a los subagentes o interrumpa su operación."
5
+ }
6
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Outils de contrôle des sous-agents",
4
+ "description": "Laissez l'IA envoyer des messages aux sous-agents ou interrompre leur fonctionnement."
5
+ }
6
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "サブエージェント制御ツール",
4
+ "description": "AI がサブエージェントにメッセージを送信し、その実行を中断できます。"
5
+ }
6
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Ferramentas de controle de subagentes",
4
+ "description": "Deixe a IA enviar mensagens aos subagentes ou interromper sua operação."
5
+ }
6
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Инструменты управления субагентами",
4
+ "description": "Позвольте ИИ отправлять сообщения субагентам или прерывать их работу."
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-tool-subagent-control",
3
- "description": "Globally named send_message, interrupt_agent, and list_agents tools over ctx.subagents continuations",
4
- "version": "0.2.1-rc.4",
3
+ "description": "Shared messaging, interruption, and child discovery tools for subagents",
4
+ "version": "0.2.2-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -18,48 +18,43 @@
18
18
  "types": "./lib/types/index.d.ts",
19
19
  "default": "./lib/index.js"
20
20
  },
21
- "./list-agents": {
22
- "types": "./lib/types/list-agents.d.ts",
23
- "default": "./lib/types/list-agents.js"
24
- },
25
21
  "./src/*": "./src/*",
26
22
  "./package.json": "./package.json",
27
- "./locale/*.json": "./locale/*.json",
28
- "./list-agents/locale/*.json": "./locale/list-agents/*.json"
23
+ "./locale/*.json": "./locale/*.json"
29
24
  },
30
25
  "files": [
31
26
  "locale/*.json",
32
- "locale/list-agents/*.json",
33
27
  "lib/index.js",
34
- "lib/types/**/*.js",
35
28
  "lib/types/**/*.d.ts"
36
29
  ],
37
30
  "license": "MIT",
38
31
  "peerDependencies": {
39
- "@deepseek-ai/cordis": "~4.0.5",
40
- "@deepseek-ai/dsh-llm": "0.2.1-rc.4",
41
- "@deepseek-ai/dsh-session": "0.2.1-rc.4",
42
- "@deepseek-ai/dsh-subagent": "0.2.1-rc.4",
43
- "@deepseek-ai/dsh-tools": "0.2.1-rc.4"
32
+ "@deepseek-ai/cordis": "~4.0.6-alpha.1",
33
+ "@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
34
+ "@deepseek-ai/dsh-session": "0.2.2-alpha.2",
35
+ "@deepseek-ai/dsh-subagent": "0.2.2-alpha.2",
36
+ "@deepseek-ai/dsh-tools": "0.2.2-alpha.2",
37
+ "@deepseek-ai/dsh-agent": "0.2.2-alpha.2"
44
38
  },
45
39
  "devDependencies": {
46
- "@deepseek-ai/cordis": "~4.0.5",
47
- "@deepseek-ai/dsh-agent": "0.2.1-rc.4",
48
- "@deepseek-ai/dsh-agent-loop": "0.2.1-rc.4",
49
- "@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-rc.4",
50
- "@deepseek-ai/dsh-llm": "0.2.1-rc.4",
51
- "@deepseek-ai/dsh-session": "0.2.1-rc.4",
52
- "@deepseek-ai/dsh-session-persistence": "0.2.1-rc.4",
53
- "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-rc.4",
54
- "@deepseek-ai/dsh-session-projection": "0.2.1-rc.4",
55
- "@deepseek-ai/dsh-session-query": "0.2.1-rc.4",
56
- "@deepseek-ai/dsh-subagent": "0.2.1-rc.4",
57
- "@deepseek-ai/dsh-subagent-fork-in-process": "0.2.1-rc.4",
58
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.1-rc.4",
59
- "@deepseek-ai/dsh-tools": "0.2.1-rc.4"
40
+ "@deepseek-ai/cordis": "~4.0.6-alpha.1",
41
+ "@deepseek-ai/dsh-agent": "0.2.2-alpha.2",
42
+ "@deepseek-ai/dsh-agent-loop": "0.2.2-alpha.2",
43
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-alpha.2",
44
+ "@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
45
+ "@deepseek-ai/dsh-session": "0.2.2-alpha.2",
46
+ "@deepseek-ai/dsh-session-persistence": "0.2.2-alpha.2",
47
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.2-alpha.2",
48
+ "@deepseek-ai/dsh-session-projection": "0.2.2-alpha.2",
49
+ "@deepseek-ai/dsh-session-query": "0.2.2-alpha.2",
50
+ "@deepseek-ai/dsh-subagent": "0.2.2-alpha.2",
51
+ "@deepseek-ai/dsh-subagent-fork-in-process": "0.2.2-alpha.2",
52
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.2-alpha.2",
53
+ "@deepseek-ai/dsh-tool-testkit": "0.2.2-alpha.2",
54
+ "@deepseek-ai/dsh-tools": "0.2.2-alpha.2"
60
55
  },
61
56
  "dependencies": {
62
- "@deepseek-ai/dsh-brand": "0.2.1-rc.4",
63
- "@deepseek-ai/dsh-util-values": "0.2.1-rc.4"
57
+ "@deepseek-ai/dsh-brand": "0.2.2-alpha.2",
58
+ "@deepseek-ai/dsh-util-values": "0.2.2-alpha.2"
64
59
  }
65
60
  }
@@ -1,98 +0,0 @@
1
- /**
2
- * The globally named `send_message` and `interrupt_agent` tools: thin
3
- * model-facing adapters over `ctx.subagents.sendMessage()` and
4
- * `ctx.subagents.interrupt()`. They perform no lifecycle routing of their own —
5
- * residency, cold resume, and interrupt authorization belong to the subagent
6
- * service — and they live apart from the provider-bound
7
- * `@deepseek-ai/dsh-tool-subagent` instances so multiple delegation tools share
8
- * one control API.
9
- * @module @deepseek-ai/dsh-tool-subagent-control
10
- */
11
- import { brandString } from '@deepseek-ai/dsh-brand';
12
- import { defineTool } from '@deepseek-ai/dsh-tools';
13
- import { markAdjacentAgentSendMessageTool } from '@deepseek-ai/dsh-subagent/internal';
14
- export const name = 'tool-subagent-control';
15
- export const inject = ['tools', 'subagents'];
16
- /**
17
- * Register the `send_message` and `interrupt_agent` tools.
18
- * @param ctx - context carrying the tool registry and subagent service.
19
- */
20
- export function apply(ctx) {
21
- ctx.tools.register(markAdjacentAgentSendMessageTool(defineTool({
22
- name: 'send_message',
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.',
25
- parameters: {
26
- agent_id: {
27
- type: 'string',
28
- required: true,
29
- description: 'The agent id of your direct continuable child, or your direct parent when you are a resident continuable child.',
30
- },
31
- message: {
32
- type: 'string',
33
- required: true,
34
- description: 'The message to deliver to the agent.',
35
- },
36
- },
37
- output: {
38
- schema: {
39
- type: 'object',
40
- additionalProperties: false,
41
- properties: {
42
- messageId: { type: 'string', required: true },
43
- },
44
- },
45
- render: (args, _value) => [{
46
- type: 'text',
47
- text: `message delivered to agent ${args.agent_id}`,
48
- }],
49
- },
50
- async execute(args, exec) {
51
- const sender = exec.agent;
52
- if (!sender) {
53
- throw new Error('send_message requires a calling agent (exec.agent was undefined)');
54
- }
55
- const message = [{ type: 'text', text: args.message }];
56
- const messageId = await ctx.subagents.sendMessage(sender, brandString(args.agent_id), message, { signal: exec.signal });
57
- return { messageId };
58
- },
59
- })));
60
- ctx.tools.register(defineTool({
61
- name: 'interrupt_agent',
62
- description: 'Ask a subagent to stop its current work. This call returns without waiting for it to stop. '
63
- + 'You can continue a local direct child\'s conversation later with send_message. '
64
- + 'External executions stop permanently and cannot receive follow-ups. Subagents it started will keep running.',
65
- parameters: {
66
- agent_id: {
67
- type: 'string',
68
- required: true,
69
- description: 'The id of an agent created under you: your direct child or a deeper descendant.',
70
- },
71
- },
72
- output: {
73
- schema: {
74
- type: 'object',
75
- additionalProperties: false,
76
- properties: {
77
- accepted: { type: 'boolean', required: true },
78
- },
79
- },
80
- render: (args, _value) => [{
81
- type: 'text',
82
- text: `interrupt requested for agent ${args.agent_id}`,
83
- }],
84
- },
85
- execute(args, exec) {
86
- const caller = exec.agent;
87
- if (!caller) {
88
- // Ancestor authority requires an exact live calling agent.
89
- throw new Error('interrupt_agent requires a calling agent (exec.agent was undefined)');
90
- }
91
- // The service authorizes the exact live caller against the target's
92
- // recorded lineage; the tool adds no authority of its own.
93
- ctx.subagents.interrupt(brandString(args.agent_id), { kind: 'ancestor', agent: caller });
94
- return Promise.resolve({ accepted: true });
95
- },
96
- }));
97
- }
98
- //# sourceMappingURL=index.js.map
@@ -1,136 +0,0 @@
1
- /**
2
- * The globally named `list_agents` tool: a thin model-facing adapter over
3
- * the continuable projection of `ctx.subagents.listChildren()` and, for the
4
- * `descendants` scope, `ctx.subagents.listDescendants()`. It stays separately
5
- * loadable from the root `send_message` plugin so a deployment can register
6
- * continuation delivery without exposing discovery.
7
- * @module @deepseek-ai/dsh-tool-subagent-control/list-agents
8
- */
9
- import { defineTool } from '@deepseek-ai/dsh-tools';
10
- import { assertNever } from '@deepseek-ai/dsh-util-values';
11
- export const name = 'tool-subagent-list-agents';
12
- export const inject = ['tools', 'subagents', 'agents'];
13
- /** Resolve the optional model request into an internal required-scope spec. */
14
- function resolveListAgentsRequest(request) {
15
- return { scope: request.scope ?? 'children' };
16
- }
17
- /** Report turn activity without exposing whether the child is loaded. */
18
- function statusOf(agents, id) {
19
- return agents.get(id)?.status === 'running' ? 'running' : 'inactive';
20
- }
21
- /** Project one service row into the model-facing entry, or omit a one-shot child. */
22
- function project(agents, entry, position) {
23
- const at = position === undefined ? {} : { parent: position.parentId, depth: position.depth };
24
- if ('kind' in entry && entry.kind === 'diagnostic') {
25
- return { kind: 'diagnostic', id: entry.id, reason: entry.reason, ...at };
26
- }
27
- // One-shot children cannot be continued by send_message, so the model
28
- // never selects them; discovery still traversed them for descendants.
29
- if (entry.mode !== 'continuable')
30
- return undefined;
31
- return {
32
- kind: 'child',
33
- id: entry.id,
34
- label: entry.label,
35
- status: statusOf(agents, entry.id),
36
- ...at,
37
- };
38
- }
39
- /**
40
- * Register the `list_agents` tool.
41
- * @param ctx - context carrying the tool registry, subagent service, and live Agent registry.
42
- */
43
- export function apply(ctx) {
44
- ctx.tools.register(defineTool({
45
- name: 'list_agents',
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.',
50
- parameters: {
51
- scope: {
52
- type: 'string',
53
- enum: ['children', 'descendants'],
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.',
56
- },
57
- },
58
- output: {
59
- schema: {
60
- type: 'array',
61
- items: {
62
- oneOf: [
63
- {
64
- type: 'object',
65
- additionalProperties: false,
66
- properties: {
67
- kind: { type: 'string', required: true, enum: ['child'] },
68
- id: { type: 'string', required: true },
69
- label: { type: 'string', required: true },
70
- status: { type: 'string', required: true, enum: ['running', 'inactive'] },
71
- parent: { type: 'string' },
72
- depth: { type: 'number' },
73
- },
74
- },
75
- {
76
- type: 'object',
77
- additionalProperties: false,
78
- properties: {
79
- kind: { type: 'string', required: true, enum: ['diagnostic'] },
80
- id: { type: 'string', required: true },
81
- reason: { type: 'string', required: true, enum: ['corrupt', 'unsupported', 'unavailable'] },
82
- parent: { type: 'string' },
83
- depth: { type: 'number' },
84
- },
85
- },
86
- ],
87
- },
88
- },
89
- render: (args, entries) => {
90
- const request = resolveListAgentsRequest(args);
91
- return [{
92
- type: 'text',
93
- text: entries.length === 0
94
- ? '(no subagents)'
95
- : entries.map((entry) => {
96
- // A descendants row always carries its position; children rows
97
- // never render it. String() spans the schema-optional shape
98
- // without a dead fallback branch.
99
- const at = request.scope === 'descendants'
100
- ? ` parent=${String(entry.parent)} depth=${String(entry.depth)}`
101
- : '';
102
- return entry.kind === 'child'
103
- ? `${entry.id} [${entry.status}]${at} — ${entry.label}`
104
- : `${entry.id} [diagnostic: ${entry.reason}]${at}`;
105
- }).join('\n'),
106
- }];
107
- },
108
- },
109
- async execute(args, exec) {
110
- const parent = exec.agent;
111
- if (!parent) {
112
- // Non-agent callers have no session whose children could be listed.
113
- throw new Error('list_agents requires a calling agent (exec.agent was undefined)');
114
- }
115
- const request = resolveListAgentsRequest(args);
116
- switch (request.scope) {
117
- case 'children': {
118
- const entries = await ctx.subagents.listChildren(parent.id, exec.signal);
119
- return entries
120
- .map(entry => project(ctx.agents, entry))
121
- .filter(entry => entry !== undefined);
122
- }
123
- case 'descendants': {
124
- const entries = await ctx.subagents.listDescendants(parent.id, exec.signal);
125
- return entries
126
- .map(entry => project(ctx.agents, entry, entry))
127
- .filter(entry => entry !== undefined);
128
- }
129
- /* v8 ignore next 2 -- the resolver normalizes the schema-validated closed scope before dispatch. */
130
- default:
131
- return assertNever(request.scope, 'list_agents scope');
132
- }
133
- },
134
- }));
135
- }
136
- //# sourceMappingURL=list-agents.js.map
@@ -1,5 +0,0 @@
1
- {
2
- "meta": {
3
- "title": "tool-subagent-control/list-agents"
4
- }
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "meta": {
3
- "title": "子智能体列表工具"
4
- }
5
- }