@amaster.ai/dsh-subagent-filesystem 0.1.27 → 0.1.28
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.md +1 -1
- package/lib/index.js +31 -14
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Enable the bundle in the profile's `cordis.patch.yml`:
|
|
|
23
23
|
|
|
24
24
|
Disabled by default. `root` defaults to `agents`, relative to the agent's initial workspace directory; sandbox deployments can explicitly select `/agents`. Discovery scans direct `*.md` children only. A missing root produces an empty catalog. Files are loaded when the agent is created; create a new agent to pick up changes. Watching and hot reload are outside the initial scope.
|
|
25
25
|
|
|
26
|
-
Requires the `fs`, `tools`, `subagents`, `systemPrompt`, and `sessionQuery` services, plus the native in-process provider registered as `spawn`. The standard headless profile supplies these capabilities. DSH peer floor: `>=0.2.
|
|
26
|
+
Requires the `fs`, `tools`, `subagents`, `systemPrompt`, and `sessionQuery` services, plus the native in-process provider registered as `spawn`. The standard headless profile supplies these capabilities. DSH peer floor: `>=0.2.1-rc.2`; tested DSH: `0.2.1-rc.2`; tested Cordis: `4.0.5`. This version uses managed activations and requires DSH 0.2.1-rc.2 or newer; use plugin v0.1.27 with DSH 0.2.0.
|
|
27
27
|
|
|
28
28
|
## Definition format
|
|
29
29
|
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
|
-
import { settleRun } from '@deepseek-ai/dsh-subagent';
|
|
4
3
|
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
5
4
|
import Schema from '@deepseek-ai/schemastery';
|
|
6
5
|
import { parseDocument } from 'yaml';
|
|
@@ -93,7 +92,7 @@ export function apply(ctx, config) {
|
|
|
93
92
|
ctx.effect(() => async () => {
|
|
94
93
|
lifecycle.abort();
|
|
95
94
|
await Promise.allSettled([...pending]);
|
|
96
|
-
const released = await Promise.allSettled([...children].map(([parent, ids]) => ctx.subagents.
|
|
95
|
+
const released = await Promise.allSettled([...children].map(([parent, ids]) => ctx.subagents.drainChildren(parent, ids)));
|
|
97
96
|
for (const result of released) {
|
|
98
97
|
if (result.status === 'rejected')
|
|
99
98
|
console.error('[dsh-subagent-filesystem] Child cleanup failed');
|
|
@@ -203,24 +202,42 @@ export function apply(ctx, config) {
|
|
|
203
202
|
prompt: [{ type: 'text', text: args.prompt }],
|
|
204
203
|
maxDepth: agent.ctx.get('subagents').resolveMaxDepth(),
|
|
205
204
|
};
|
|
205
|
+
const child = await agent.ctx.get('subagents').startActivation({
|
|
206
|
+
provider: 'spawn',
|
|
207
|
+
label: args.description,
|
|
208
|
+
request,
|
|
209
|
+
signal,
|
|
210
|
+
delivery: args.run_in_background ? 'parent' : 'caller',
|
|
211
|
+
});
|
|
206
212
|
if (args.run_in_background) {
|
|
207
|
-
|
|
208
|
-
provider: 'spawn',
|
|
209
|
-
label: args.description,
|
|
210
|
-
request,
|
|
211
|
-
signal,
|
|
212
|
-
});
|
|
213
|
+
void child.result.catch(() => { });
|
|
213
214
|
const ids = children.get(agent) ?? [];
|
|
214
215
|
ids.push(child.childId);
|
|
215
216
|
children.set(agent, ids);
|
|
216
217
|
return `started subagent ${child.childId}; use send_message to continue it`;
|
|
217
218
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
// Activation signals cover admission only; foreground calls own later cancellation.
|
|
220
|
+
let cleanup;
|
|
221
|
+
const dispose = () => (cleanup ??= child.dispose());
|
|
222
|
+
const cancel = () => {
|
|
223
|
+
void dispose().catch(() => { });
|
|
224
|
+
};
|
|
225
|
+
signal.addEventListener('abort', cancel, { once: true });
|
|
226
|
+
try {
|
|
227
|
+
if (signal.aborted)
|
|
228
|
+
cancel();
|
|
229
|
+
const outcome = await child.result;
|
|
230
|
+
if (outcome.stopReason !== 'completed')
|
|
231
|
+
throw new Error(outcome.diagnostic ?? `Subagent ${outcome.stopReason}`);
|
|
232
|
+
return outcome.output
|
|
233
|
+
.filter((block) => block.type === 'text')
|
|
234
|
+
.map((block) => block.text)
|
|
235
|
+
.join('');
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
signal.removeEventListener('abort', cancel);
|
|
239
|
+
await dispose();
|
|
240
|
+
}
|
|
224
241
|
}));
|
|
225
242
|
},
|
|
226
243
|
})));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amaster.ai/dsh-subagent-filesystem",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "Discover Markdown specialist roles through the DSH filesystem and delegate through native in-process subagents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
40
|
-
"@deepseek-ai/dsh-agent": ">=0.2.0-rc.1",
|
|
41
|
-
"@deepseek-ai/dsh-fs": ">=0.2.0-rc.1",
|
|
42
|
-
"@deepseek-ai/dsh-session": ">=0.2.0-rc.1",
|
|
43
|
-
"@deepseek-ai/dsh-session-query": ">=0.2.0-rc.1",
|
|
44
|
-
"@deepseek-ai/dsh-subagent": ">=0.2.
|
|
45
|
-
"@deepseek-ai/dsh-system-prompt": ">=0.2.0-rc.1",
|
|
46
|
-
"@deepseek-ai/dsh-tools": ">=0.2.0-rc.1"
|
|
40
|
+
"@deepseek-ai/dsh-agent": ">=0.2.0-rc.1 || >=0.2.1-rc.1",
|
|
41
|
+
"@deepseek-ai/dsh-fs": ">=0.2.0-rc.1 || >=0.2.1-rc.1",
|
|
42
|
+
"@deepseek-ai/dsh-session": ">=0.2.0-rc.1 || >=0.2.1-rc.1",
|
|
43
|
+
"@deepseek-ai/dsh-session-query": ">=0.2.0-rc.1 || >=0.2.1-rc.1",
|
|
44
|
+
"@deepseek-ai/dsh-subagent": ">=0.2.1-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.2.0-rc.1 || >=0.2.1-rc.1",
|
|
46
|
+
"@deepseek-ai/dsh-tools": ">=0.2.0-rc.1 || >=0.2.1-rc.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@deepseek-ai/cordis": "
|
|
50
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
51
|
-
"@deepseek-ai/dsh-fs": "0.2.
|
|
52
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
53
|
-
"@deepseek-ai/dsh-session-query": "0.2.
|
|
54
|
-
"@deepseek-ai/dsh-subagent": "0.2.
|
|
55
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
56
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
57
|
-
"@deepseek-ai/dsh-scope": "0.2.
|
|
49
|
+
"@deepseek-ai/cordis": "4.0.5",
|
|
50
|
+
"@deepseek-ai/dsh-agent": "0.2.1-rc.2",
|
|
51
|
+
"@deepseek-ai/dsh-fs": "0.2.1-rc.2",
|
|
52
|
+
"@deepseek-ai/dsh-session": "0.2.1-rc.2",
|
|
53
|
+
"@deepseek-ai/dsh-session-query": "0.2.1-rc.2",
|
|
54
|
+
"@deepseek-ai/dsh-subagent": "0.2.1-rc.2",
|
|
55
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
|
|
56
|
+
"@deepseek-ai/dsh-tools": "0.2.1-rc.2",
|
|
57
|
+
"@deepseek-ai/dsh-scope": "0.2.1-rc.2",
|
|
58
58
|
"@types/node": "^22.0.0",
|
|
59
59
|
"typescript": "^5.6.3",
|
|
60
60
|
"vitest": "^4.1.11"
|