@pify/swarm 0.6.1 → 0.6.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/extensions/swarm.ts +24 -14
- package/package.json +1 -1
package/extensions/swarm.ts
CHANGED
|
@@ -182,26 +182,34 @@ export default function swarm(pi: ExtensionAPI) {
|
|
|
182
182
|
};
|
|
183
183
|
const promptOptions = promptHost.getSystemPromptOptions?.() ?? {};
|
|
184
184
|
|
|
185
|
+
// `reload()` is not optional. `createAgentSession` only loads a resource
|
|
186
|
+
// loader it builds itself; one passed in is used exactly as handed over,
|
|
187
|
+
// and a fresh DefaultResourceLoader resolves neither `systemPrompt` nor
|
|
188
|
+
// `appendSystemPrompt` until it loads. Without it the child ran with no
|
|
189
|
+
// instructions at all — the call succeeds, the model answers, and it
|
|
190
|
+
// answers as a generic assistant with nothing to say it went wrong.
|
|
191
|
+
const loader = new DefaultResourceLoader({
|
|
192
|
+
cwd: workDir ?? ctx.cwd,
|
|
193
|
+
agentDir: getAgentDir(),
|
|
194
|
+
noExtensions: true,
|
|
195
|
+
noPromptTemplates: true,
|
|
196
|
+
noThemes: true,
|
|
197
|
+
systemPrompt: promptOptions.customPrompt,
|
|
198
|
+
appendSystemPrompt: [
|
|
199
|
+
...(promptOptions.appendSystemPrompt ? [promptOptions.appendSystemPrompt] : []),
|
|
200
|
+
def.systemPrompt,
|
|
201
|
+
"You are one agent in a swarm, handling exactly one item. Your final assistant message is the deliverable — make it complete and self-contained.",
|
|
202
|
+
...(mailbox ? [mailboxPrompt(item.agent + "-" + item.index)] : []),
|
|
203
|
+
],
|
|
204
|
+
});
|
|
205
|
+
await loader.reload();
|
|
185
206
|
const created = await createAgentSession({
|
|
186
207
|
sessionManager: SessionManager.inMemory(workDir ?? ctx.cwd),
|
|
187
208
|
model,
|
|
188
209
|
thinkingLevel: (def.thinking ?? pi.getThinkingLevel()) as never,
|
|
189
210
|
tools: def.tools,
|
|
190
211
|
...(mailbox ? { customTools: mailboxTools(mailbox, item.agent + "-" + item.index) } : {}),
|
|
191
|
-
resourceLoader:
|
|
192
|
-
cwd: workDir ?? ctx.cwd,
|
|
193
|
-
agentDir: getAgentDir(),
|
|
194
|
-
noExtensions: true,
|
|
195
|
-
noPromptTemplates: true,
|
|
196
|
-
noThemes: true,
|
|
197
|
-
systemPrompt: promptOptions.customPrompt,
|
|
198
|
-
appendSystemPrompt: [
|
|
199
|
-
...(promptOptions.appendSystemPrompt ? [promptOptions.appendSystemPrompt] : []),
|
|
200
|
-
def.systemPrompt,
|
|
201
|
-
"You are one agent in a swarm, handling exactly one item. Your final assistant message is the deliverable — make it complete and self-contained.",
|
|
202
|
-
...(mailbox ? [mailboxPrompt(item.agent + "-" + item.index)] : []),
|
|
203
|
-
],
|
|
204
|
-
}),
|
|
212
|
+
resourceLoader: loader,
|
|
205
213
|
});
|
|
206
214
|
session = created.session;
|
|
207
215
|
releaseLive = live.register(runId, session);
|
|
@@ -324,6 +332,7 @@ export default function swarm(pi: ExtensionAPI) {
|
|
|
324
332
|
pi.registerTool({
|
|
325
333
|
name: "swarm_run",
|
|
326
334
|
label: "Run swarm",
|
|
335
|
+
promptSnippet: "Run many independent items through child agents at once",
|
|
327
336
|
description:
|
|
328
337
|
`Fan out 1-${MAX_ITEMS} independent task items to parallel child agents (concurrency ${DEFAULT_CONCURRENCY}). ` +
|
|
329
338
|
"Each item auto-routes to an agent type via its match_patterns/match_keywords, falling back to the " +
|
|
@@ -443,6 +452,7 @@ export default function swarm(pi: ExtensionAPI) {
|
|
|
443
452
|
pi.registerTool({
|
|
444
453
|
name: "swarm_status",
|
|
445
454
|
label: "Swarm status",
|
|
455
|
+
promptSnippet: "Progress of a running swarm",
|
|
446
456
|
description: "Progress of a swarm run (default: the latest). Returns the full report when finished.",
|
|
447
457
|
parameters: Type.Object({
|
|
448
458
|
runId: Type.Optional(Type.String()),
|
package/package.json
CHANGED