@pify/swarm 0.6.0 → 0.6.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.
@@ -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: 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
- }),
212
+ resourceLoader: loader,
205
213
  });
206
214
  session = created.session;
207
215
  releaseLive = live.register(runId, session);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pify/swarm",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Coordinate multiple pi agents in parallel: swarm_run fan-out with per-item auto-routing, concurrency queue, aggregated reports",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: swarm
3
- description: Use when work splits into several independent items that can run in parallel - multi-file reviews, sweeps, parallel research - explains swarm_run fan-out, auto-routing, and how to slice items well
3
+ description: Use when work splits into several independent items that can run in parallel - multi-file reviews, sweeps, parallel research
4
4
  ---
5
5
 
6
6
  # Swarm