@deepseek-ai/dsh-tool-subagent-control 0.2.3-alpha.1 → 0.2.3-alpha.3
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/lib/index.js +6 -9
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/package.json +29 -29
- package/src/index.ts +9 -14
package/lib/index.js
CHANGED
|
@@ -234,7 +234,7 @@ const Config = z.object({ interrupt: z.boolean().default(true) });
|
|
|
234
234
|
*/
|
|
235
235
|
function apply(ctx, config = {}) {
|
|
236
236
|
const interrupt = config.interrupt !== false;
|
|
237
|
-
|
|
237
|
+
registerListAgents(ctx);
|
|
238
238
|
registerWaitAgent(ctx);
|
|
239
239
|
const sendMessage = defineTool({
|
|
240
240
|
name: "send_message",
|
|
@@ -282,18 +282,15 @@ function apply(ctx, config = {}) {
|
|
|
282
282
|
order: ctx.systemPrompt.getContextOrder("SUBAGENT_DELEGATION"),
|
|
283
283
|
required: true,
|
|
284
284
|
interpolate: false,
|
|
285
|
-
text: ({ agent
|
|
285
|
+
text: ({ agent }) => {
|
|
286
286
|
if (agent === void 0) return "";
|
|
287
287
|
try {
|
|
288
288
|
const names = ctx.subagents.namesOf(agent);
|
|
289
289
|
let identity = names.parent === void 0 ? `You are the root agent. Your name is ${JSON.stringify(names.self)}.` : `You are a subagent delegated by agent ${JSON.stringify(names.parent)}.\nYour name is ${JSON.stringify(names.self)}.\nThe root agent of your collaboration tree is ${JSON.stringify(ROOT_AGENT_NAME)}.`;
|
|
290
|
-
const guidance = [];
|
|
291
|
-
if (ctx.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
if (ctx.tools.get(listAgents.name, scope, toolSet) === listAgents) guidance.push("Use list_agents({}) to find your collaborator agents and their names.");
|
|
296
|
-
if (guidance.length > 0) identity += "\n\n" + guidance.join("\n");
|
|
290
|
+
const guidance = ["To message other agents, use send_message({ agent: \"<agent-name>\", message: \"...\" })."];
|
|
291
|
+
if (names.parent !== void 0 && ctx.get("agentTeams")?.isEnabled(agent) !== true) guidance.push("When you finish, use send_message to send a self-contained result to the agent that delegated you. Message any agent as soon as a finding changes what it should do next; sending a message does not end your turn.");
|
|
292
|
+
guidance.push("Use list_agents({}) to find your collaborator agents and their names.");
|
|
293
|
+
identity += "\n\n" + guidance.join("\n");
|
|
297
294
|
return identity;
|
|
298
295
|
} catch (error) {
|
|
299
296
|
if (!(typeof error === "object" && error !== null && "name" in error && error.name === "SubagentError" && "code" in error && error.code === "UNAUTHORIZED")) throw error;
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AASxC,eAAO,MAAM,IAAI,0BAA0B,CAAA;AAC3C,eAAO,MAAM,MAAM,UAAmD,CAAA;AAEtE,uCAAuC;AACvC,MAAM,WAAW,MAAM;IACrB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,yDAAyD;AACzD,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAE3B,CAAA;AAEF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AASxC,eAAO,MAAM,IAAI,0BAA0B,CAAA;AAC3C,eAAO,MAAM,MAAM,UAAmD,CAAA;AAEtE,uCAAuC;AACvC,MAAM,WAAW,MAAM;IACrB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,yDAAyD;AACzD,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAE3B,CAAA;AAEF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAuH7D"}
|
package/lib/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAA;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAG3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD,MAAM,CAAC,MAAM,IAAI,GAAG,uBAAuB,CAAA;AAC3C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAA;AAQtE,yDAAyD;AACzD,MAAM,CAAC,MAAM,MAAM,GAAc,CAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACrC,CAAC,CAAA;AAEF;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,SAAiB,EAAE;IACrD,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,KAAK,KAAK,CAAA;IAC5C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CA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AC,CAAA;YACtE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;QAC3B,CAAC;KACF,CAAC,CAAC,CAAA;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-tool-subagent-control",
|
|
3
3
|
"description": "Shared messaging, interruption, and child discovery tools for subagents",
|
|
4
|
-
"version": "0.2.3-alpha.
|
|
4
|
+
"version": "0.2.3-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/cordis": "~4.
|
|
36
|
-
"@deepseek-ai/dsh-llm": "0.2.3-alpha.
|
|
37
|
-
"@deepseek-ai/dsh-session": "0.2.3-alpha.
|
|
38
|
-
"@deepseek-ai/dsh-subagent": "0.2.3-alpha.
|
|
39
|
-
"@deepseek-ai/dsh-tools": "0.2.3-alpha.
|
|
40
|
-
"@deepseek-ai/dsh-agent": "0.2.3-alpha.
|
|
41
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.
|
|
42
|
-
"@deepseek-ai/dsh-agent-team": "0.2.3-alpha.
|
|
35
|
+
"@deepseek-ai/cordis": "~4.2.0-alpha.2",
|
|
36
|
+
"@deepseek-ai/dsh-llm": "0.2.3-alpha.3",
|
|
37
|
+
"@deepseek-ai/dsh-session": "0.2.3-alpha.3",
|
|
38
|
+
"@deepseek-ai/dsh-subagent": "0.2.3-alpha.3",
|
|
39
|
+
"@deepseek-ai/dsh-tools": "0.2.3-alpha.3",
|
|
40
|
+
"@deepseek-ai/dsh-agent": "0.2.3-alpha.3",
|
|
41
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.3",
|
|
42
|
+
"@deepseek-ai/dsh-agent-team": "0.2.3-alpha.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@deepseek-ai/dsh-agent-team": {
|
|
@@ -47,27 +47,27 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@deepseek-ai/dsh-agent-team": "0.2.3-alpha.
|
|
51
|
-
"@deepseek-ai/dsh-brand": "0.2.3-alpha.
|
|
52
|
-
"@deepseek-ai/cordis": "~4.
|
|
53
|
-
"@deepseek-ai/dsh-agent": "0.2.3-alpha.
|
|
54
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.3-alpha.
|
|
55
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.3-alpha.
|
|
56
|
-
"@deepseek-ai/dsh-llm": "0.2.3-alpha.
|
|
57
|
-
"@deepseek-ai/dsh-session": "0.2.3-alpha.
|
|
58
|
-
"@deepseek-ai/dsh-session-persistence": "0.2.3-alpha.
|
|
59
|
-
"@deepseek-ai/dsh-session-persistence-jsonl": "0.2.3-alpha.
|
|
60
|
-
"@deepseek-ai/dsh-session-projection": "0.2.3-alpha.
|
|
61
|
-
"@deepseek-ai/dsh-session-query": "0.2.3-alpha.
|
|
62
|
-
"@deepseek-ai/dsh-subagent": "0.2.3-alpha.
|
|
63
|
-
"@deepseek-ai/dsh-subagent-fork-in-process": "0.2.3-alpha.
|
|
64
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.3-alpha.
|
|
65
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.
|
|
66
|
-
"@deepseek-ai/dsh-tool-testkit": "0.2.3-alpha.
|
|
67
|
-
"@deepseek-ai/dsh-tools": "0.2.3-alpha.
|
|
50
|
+
"@deepseek-ai/dsh-agent-team": "0.2.3-alpha.3",
|
|
51
|
+
"@deepseek-ai/dsh-brand": "0.2.3-alpha.3",
|
|
52
|
+
"@deepseek-ai/cordis": "~4.2.0-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-agent": "0.2.3-alpha.3",
|
|
54
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.3-alpha.3",
|
|
55
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.3-alpha.3",
|
|
56
|
+
"@deepseek-ai/dsh-llm": "0.2.3-alpha.3",
|
|
57
|
+
"@deepseek-ai/dsh-session": "0.2.3-alpha.3",
|
|
58
|
+
"@deepseek-ai/dsh-session-persistence": "0.2.3-alpha.3",
|
|
59
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.2.3-alpha.3",
|
|
60
|
+
"@deepseek-ai/dsh-session-projection": "0.2.3-alpha.3",
|
|
61
|
+
"@deepseek-ai/dsh-session-query": "0.2.3-alpha.3",
|
|
62
|
+
"@deepseek-ai/dsh-subagent": "0.2.3-alpha.3",
|
|
63
|
+
"@deepseek-ai/dsh-subagent-fork-in-process": "0.2.3-alpha.3",
|
|
64
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.2.3-alpha.3",
|
|
65
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.3",
|
|
66
|
+
"@deepseek-ai/dsh-tool-testkit": "0.2.3-alpha.3",
|
|
67
|
+
"@deepseek-ai/dsh-tools": "0.2.3-alpha.3"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@deepseek-ai/schemastery": "~3.
|
|
71
|
-
"@deepseek-ai/dsh-util-values": "0.2.3-alpha.
|
|
70
|
+
"@deepseek-ai/schemastery": "~3.20.0-alpha.2",
|
|
71
|
+
"@deepseek-ai/dsh-util-values": "0.2.3-alpha.3"
|
|
72
72
|
}
|
|
73
73
|
}
|
package/src/index.ts
CHANGED
|
@@ -39,7 +39,7 @@ export const Config: z<Config> = z.object({
|
|
|
39
39
|
*/
|
|
40
40
|
export function apply(ctx: Context, config: Config = {}): void {
|
|
41
41
|
const interrupt = config.interrupt !== false
|
|
42
|
-
|
|
42
|
+
registerListAgents(ctx)
|
|
43
43
|
registerWaitAgent(ctx)
|
|
44
44
|
const sendMessage = defineTool({
|
|
45
45
|
name: 'send_message',
|
|
@@ -88,7 +88,7 @@ export function apply(ctx: Context, config: Config = {}): void {
|
|
|
88
88
|
order: ctx.systemPrompt.getContextOrder('SUBAGENT_DELEGATION'),
|
|
89
89
|
required: true,
|
|
90
90
|
interpolate: false,
|
|
91
|
-
text: ({ agent
|
|
91
|
+
text: ({ agent }) => {
|
|
92
92
|
if (agent === undefined) return ''
|
|
93
93
|
try {
|
|
94
94
|
const names = ctx.subagents.namesOf(agent)
|
|
@@ -97,19 +97,14 @@ export function apply(ctx: Context, config: Config = {}): void {
|
|
|
97
97
|
: `You are a subagent delegated by agent ${JSON.stringify(names.parent)}.\n`
|
|
98
98
|
+ `Your name is ${JSON.stringify(names.self)}.\n`
|
|
99
99
|
+ `The root agent of your collaboration tree is ${JSON.stringify(ROOT_AGENT_NAME)}.`
|
|
100
|
-
const guidance
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
guidance.push('When you finish, use send_message to send a self-contained result to the agent that delegated you. '
|
|
106
|
-
+ 'Message any agent as soon as a finding changes what it should do next; sending a message does not end your turn.')
|
|
107
|
-
}
|
|
100
|
+
const guidance = ['To message other agents, use send_message({ agent: "<agent-name>", message: "..." }).']
|
|
101
|
+
// Team mode coordinates results through shared tasks, so only plain delegation asks for a report.
|
|
102
|
+
if (names.parent !== undefined && ctx.get('agentTeams')?.isEnabled(agent) !== true) {
|
|
103
|
+
guidance.push('When you finish, use send_message to send a self-contained result to the agent that delegated you. '
|
|
104
|
+
+ 'Message any agent as soon as a finding changes what it should do next; sending a message does not end your turn.')
|
|
108
105
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
if (guidance.length > 0) identity += '\n\n' + guidance.join('\n')
|
|
106
|
+
guidance.push('Use list_agents({}) to find your collaborator agents and their names.')
|
|
107
|
+
identity += '\n\n' + guidance.join('\n')
|
|
113
108
|
return identity
|
|
114
109
|
} catch (error: unknown) {
|
|
115
110
|
const rootUnavailable = typeof error === 'object' && error !== null
|