opencode-swarm-plugin 0.32.0 → 0.34.0
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/.hive/issues.jsonl +12 -0
- package/.hive/memories.jsonl +255 -1
- package/.turbo/turbo-build.log +9 -10
- package/.turbo/turbo-test.log +343 -337
- package/CHANGELOG.md +358 -0
- package/README.md +152 -179
- package/bin/swarm.test.ts +303 -1
- package/bin/swarm.ts +473 -16
- package/dist/compaction-hook.d.ts +1 -1
- package/dist/compaction-hook.d.ts.map +1 -1
- package/dist/index.d.ts +112 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12380 -131
- package/dist/logger.d.ts +34 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/observability-tools.d.ts +116 -0
- package/dist/observability-tools.d.ts.map +1 -0
- package/dist/plugin.js +12254 -119
- package/dist/skills.d.ts.map +1 -1
- package/dist/swarm-orchestrate.d.ts +105 -0
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts +113 -2
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm-research.d.ts +127 -0
- package/dist/swarm-research.d.ts.map +1 -0
- package/dist/swarm-review.d.ts.map +1 -1
- package/dist/swarm.d.ts +73 -1
- package/dist/swarm.d.ts.map +1 -1
- package/evals/compaction-resumption.eval.ts +289 -0
- package/evals/coordinator-behavior.eval.ts +307 -0
- package/evals/fixtures/compaction-cases.ts +350 -0
- package/evals/scorers/compaction-scorers.ts +305 -0
- package/evals/scorers/index.ts +12 -0
- package/examples/plugin-wrapper-template.ts +297 -8
- package/package.json +6 -2
- package/src/compaction-hook.test.ts +617 -1
- package/src/compaction-hook.ts +291 -18
- package/src/index.ts +54 -1
- package/src/logger.test.ts +189 -0
- package/src/logger.ts +135 -0
- package/src/observability-tools.test.ts +346 -0
- package/src/observability-tools.ts +594 -0
- package/src/skills.integration.test.ts +137 -1
- package/src/skills.test.ts +42 -1
- package/src/skills.ts +8 -4
- package/src/swarm-orchestrate.test.ts +123 -0
- package/src/swarm-orchestrate.ts +183 -0
- package/src/swarm-prompts.test.ts +553 -1
- package/src/swarm-prompts.ts +406 -4
- package/src/swarm-research.integration.test.ts +544 -0
- package/src/swarm-research.test.ts +698 -0
- package/src/swarm-research.ts +472 -0
- package/src/swarm-review.test.ts +177 -0
- package/src/swarm-review.ts +12 -47
- package/src/swarm.ts +6 -3
package/dist/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAoBH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,kCAAkC;IAClC,QAAQ,EAAE,aAAa,CAAC;IACxB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,UAAU,EAAE,OAAO,CAAC;IACpB,kDAAkD;IAClD,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;CACrB;AAYD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAG3D;AAMD;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AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,qBAAqB,CA2FvB;AAwGD;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;CA6GxB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;CAyGxB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CA4CxB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;CAqE5B,CAAC;AAiGH;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;CA6ItB,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUvB,CAAC;AAMF;;;;;GAKG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,CAoBhE;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,MAAM,EAAE,CAAC,CA2BnB"}
|
|
@@ -297,6 +297,98 @@ export declare const swarm_record_outcome: {
|
|
|
297
297
|
failure_details?: string | undefined;
|
|
298
298
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
299
299
|
};
|
|
300
|
+
/**
|
|
301
|
+
* Extract technology stack from task description
|
|
302
|
+
*
|
|
303
|
+
* Searches for common framework/library mentions and returns
|
|
304
|
+
* a deduplicated array of normalized names.
|
|
305
|
+
*
|
|
306
|
+
* @param task - Task description
|
|
307
|
+
* @returns Array of detected technology names (normalized, lowercase)
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* extractTechStack("Add Next.js API routes with Zod validation")
|
|
312
|
+
* // => ["next", "zod"]
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
export declare function extractTechStack(task: string): string[];
|
|
316
|
+
/**
|
|
317
|
+
* Research result from documentation discovery phase
|
|
318
|
+
*/
|
|
319
|
+
export interface ResearchResult {
|
|
320
|
+
/** Technologies identified and researched */
|
|
321
|
+
tech_stack: string[];
|
|
322
|
+
/** Summaries keyed by technology name */
|
|
323
|
+
summaries: Record<string, string>;
|
|
324
|
+
/** Semantic-memory IDs where research is stored */
|
|
325
|
+
memory_ids: string[];
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Run research phase before task decomposition
|
|
329
|
+
*
|
|
330
|
+
* This is the INTEGRATION point that:
|
|
331
|
+
* 1. Analyzes task to identify technologies
|
|
332
|
+
* 2. Spawns researcher agents for each technology (parallel)
|
|
333
|
+
* 3. Waits for researchers to complete
|
|
334
|
+
* 4. Collects summaries from semantic-memory
|
|
335
|
+
* 5. Returns combined context for shared_context
|
|
336
|
+
*
|
|
337
|
+
* Flow:
|
|
338
|
+
* ```
|
|
339
|
+
* Task received
|
|
340
|
+
* ↓
|
|
341
|
+
* extractTechStack(task) → ["next", "zod"]
|
|
342
|
+
* ↓
|
|
343
|
+
* For each tech: swarm_spawn_researcher(tech_stack=[tech])
|
|
344
|
+
* ↓
|
|
345
|
+
* Spawn Task agents in parallel
|
|
346
|
+
* ↓
|
|
347
|
+
* Wait for all to complete
|
|
348
|
+
* ↓
|
|
349
|
+
* Collect summaries from swarm mail
|
|
350
|
+
* ↓
|
|
351
|
+
* Return ResearchResult → inject into shared_context
|
|
352
|
+
* ```
|
|
353
|
+
*
|
|
354
|
+
* @param task - Task description to analyze
|
|
355
|
+
* @param projectPath - Absolute path to project root
|
|
356
|
+
* @param options - Optional configuration
|
|
357
|
+
* @returns Research results with summaries and memory IDs
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```typescript
|
|
361
|
+
* const result = await runResearchPhase(
|
|
362
|
+
* "Add Next.js API routes with Zod validation",
|
|
363
|
+
* "/path/to/project"
|
|
364
|
+
* );
|
|
365
|
+
* // result.tech_stack => ["next", "zod"]
|
|
366
|
+
* // result.summaries => { next: "...", zod: "..." }
|
|
367
|
+
* // Use result as shared_context for decomposition
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
export declare function runResearchPhase(task: string, projectPath: string, options?: {
|
|
371
|
+
checkUpgrades?: boolean;
|
|
372
|
+
}): Promise<ResearchResult>;
|
|
373
|
+
/**
|
|
374
|
+
* Plugin tool for running research phase
|
|
375
|
+
*
|
|
376
|
+
* Exposes research phase as a tool for manual triggering or
|
|
377
|
+
* integration into orchestration flows.
|
|
378
|
+
*/
|
|
379
|
+
export declare const swarm_research_phase: {
|
|
380
|
+
description: string;
|
|
381
|
+
args: {
|
|
382
|
+
task: z.ZodString;
|
|
383
|
+
project_path: z.ZodString;
|
|
384
|
+
check_upgrades: z.ZodOptional<z.ZodBoolean>;
|
|
385
|
+
};
|
|
386
|
+
execute(args: {
|
|
387
|
+
task: string;
|
|
388
|
+
project_path: string;
|
|
389
|
+
check_upgrades?: boolean | undefined;
|
|
390
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
391
|
+
};
|
|
300
392
|
/**
|
|
301
393
|
* Record an error during subtask execution
|
|
302
394
|
*
|
|
@@ -653,6 +745,19 @@ export declare const orchestrateTools: {
|
|
|
653
745
|
failure_details?: string | undefined;
|
|
654
746
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
655
747
|
};
|
|
748
|
+
swarm_research_phase: {
|
|
749
|
+
description: string;
|
|
750
|
+
args: {
|
|
751
|
+
task: z.ZodString;
|
|
752
|
+
project_path: z.ZodString;
|
|
753
|
+
check_upgrades: z.ZodOptional<z.ZodBoolean>;
|
|
754
|
+
};
|
|
755
|
+
execute(args: {
|
|
756
|
+
task: string;
|
|
757
|
+
project_path: string;
|
|
758
|
+
check_upgrades?: boolean | undefined;
|
|
759
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
760
|
+
};
|
|
656
761
|
swarm_accumulate_error: {
|
|
657
762
|
description: string;
|
|
658
763
|
args: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swarm-orchestrate.d.ts","sourceRoot":"","sources":["../src/swarm-orchestrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAoDlC;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,aAAa,CA4BhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,EAAE,EACvB,WAAW,EAAE,MAAM,EAAE,GACpB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAqC1C;AAkaD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;CA8JrB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAe5B,CAAC"}
|
package/dist/swarm-prompts.d.ts
CHANGED
|
@@ -37,20 +37,39 @@ export declare const SUBTASK_PROMPT = "You are a swarm agent working on a subtas
|
|
|
37
37
|
*
|
|
38
38
|
* Supports {error_context} placeholder for retry prompts.
|
|
39
39
|
*/
|
|
40
|
-
export declare const SUBTASK_PROMPT_V2 = "You are a swarm agent working on: **{subtask_title}**\n\n## [IDENTITY]\nAgent: (assigned at spawn)\nCell: {bead_id}\nEpic: {epic_id}\n\n## [TASK]\n{subtask_description}\n\n## [FILES]\nReserved (exclusive):\n{file_list}\n\nOnly modify these files. Need others? Message the coordinator.\n\n## [CONTEXT]\n{shared_context}\n\n{compressed_context}\n\n{error_context}\n\n## [MANDATORY SURVIVAL CHECKLIST]\n\n**CRITICAL: Follow this checklist IN ORDER. Each step builds on the previous.**\n\n### Step 1: Initialize Coordination (REQUIRED - DO THIS FIRST)\n```\nswarmmail_init(project_path=\"{project_path}\", task_description=\"{bead_id}: {subtask_title}\")\n```\n\n**This registers you with the coordination system and enables:**\n- File reservation tracking\n- Inter-agent communication\n- Progress monitoring\n- Conflict detection\n\n**If you skip this step, your work will not be tracked and swarm_complete will fail.**\n\n### Step 2: \uD83E\uDDE0 Query Past Learnings (MANDATORY - BEFORE starting work)\n\n**\u26A0\uFE0F CRITICAL: ALWAYS query semantic memory BEFORE writing ANY code.**\n\n```\nsemantic-memory_find(query=\"<keywords from your task>\", limit=5, expand=true)\n```\n\n**Why this is MANDATORY:**\n- Past agents may have already solved your exact problem\n- Avoids repeating mistakes that wasted 30+ minutes before\n- Discovers project-specific patterns and gotchas\n- Finds known workarounds for tool/library quirks\n\n**Search Query Examples by Task Type:**\n\n- **Bug fix**: Use exact error message or \"<symptom> <component>\"\n- **New feature**: Search \"<domain concept> implementation pattern\"\n- **Refactor**: Query \"<pattern name> migration approach\"\n- **Integration**: Look for \"<library name> gotchas configuration\"\n- **Testing**: Find \"testing <component type> characterization tests\"\n- **Performance**: Search \"<technology> performance optimization\"\n\n**BEFORE you start coding:**\n1. Run semantic-memory_find with keywords from your task\n2. Read the results with expand=true for full content\n3. Check if any memory solves your problem or warns of pitfalls\n4. Adjust your approach based on past learnings\n\n**If you skip this step, you WILL waste time solving already-solved problems.**\n\n### Step 3: Load Relevant Skills (if available)\n```\nskills_list() # See what skills exist\nskills_use(name=\"<relevant-skill>\", context=\"<your task>\") # Load skill\n```\n\n**Common skill triggers:**\n- Writing tests? \u2192 `skills_use(name=\"testing-patterns\")`\n- Breaking dependencies? \u2192 `skills_use(name=\"testing-patterns\")`\n- Multi-agent coordination? \u2192 `skills_use(name=\"swarm-coordination\")`\n- Building a CLI? \u2192 `skills_use(name=\"cli-builder\")`\n\n### Step 4: Reserve Your Files (YOU reserve, not coordinator)\n```\nswarmmail_reserve(\n paths=[{file_list}],\n reason=\"{bead_id}: {subtask_title}\",\n exclusive=true\n)\n```\n\n**Workers reserve their own files.** This prevents edit conflicts with other agents.\n\n### Step 5: Do the Work (TDD MANDATORY)\n\n**Follow RED \u2192 GREEN \u2192 REFACTOR. No exceptions.**\n\n1. **RED**: Write a failing test that describes the expected behavior\n - Test MUST fail before you write implementation\n - If test passes immediately, your test is wrong\n \n2. **GREEN**: Write minimal code to make the test pass\n - Don't over-engineer - just make it green\n - Hardcode if needed, refactor later\n \n3. **REFACTOR**: Clean up while tests stay green\n - Run tests after every change\n - If tests break, undo and try again\n\n```bash\n# Run tests continuously\nbun test <your-test-file> --watch\n```\n\n**Why TDD?**\n- Catches bugs before they exist\n- Documents expected behavior\n- Enables fearless refactoring\n- Proves your code works\n\n### Step 6: Report Progress at Milestones\n```\nswarm_progress(\n project_key=\"{project_path}\",\n agent_name=\"<your-agent-name>\",\n bead_id=\"{bead_id}\",\n status=\"in_progress\",\n progress_percent=25, # or 50, 75\n message=\"<what you just completed>\"\n)\n```\n\n**Report at 25%, 50%, 75% completion.** This:\n- Triggers auto-checkpoint (saves context)\n- Keeps coordinator informed\n- Prevents silent failures\n\n### Step 7: Manual Checkpoint BEFORE Risky Operations\n```\nswarm_checkpoint(\n project_key=\"{project_path}\",\n agent_name=\"<your-agent-name>\",\n bead_id=\"{bead_id}\"\n)\n```\n\n**Call BEFORE:**\n- Large refactors\n- File deletions\n- Breaking API changes\n- Anything that might fail catastrophically\n\n**Checkpoints preserve context so you can recover if things go wrong.**\n\n### Step 8: \uD83D\uDCBE STORE YOUR LEARNINGS (if you discovered something)\n\n**If you learned it the hard way, STORE IT so the next agent doesn't have to.**\n\n```\nsemantic-memory_store(\n information=\"<what you learned, WHY it matters, how to apply it>\",\n tags=\"<domain, tech-stack, pattern-type>\"\n)\n```\n\n**MANDATORY Storage Triggers - Store when you:**\n- \uD83D\uDC1B **Solved a tricky bug** (>15min debugging) - include root cause + solution\n- \uD83D\uDCA1 **Discovered a project-specific pattern** - domain rules, business logic quirks\n- \u26A0\uFE0F **Found a tool/library gotcha** - API quirks, version-specific bugs, workarounds\n- \uD83D\uDEAB **Tried an approach that failed** - anti-patterns to avoid, why it didn't work\n- \uD83C\uDFD7\uFE0F **Made an architectural decision** - reasoning, alternatives considered, tradeoffs\n\n**What Makes a GOOD Memory:**\n\n\u2705 **GOOD** (actionable, explains WHY):\n```\n\"OAuth refresh tokens need 5min buffer before expiry to avoid race conditions.\nWithout buffer, token refresh can fail mid-request if expiry happens between\ncheck and use. Implemented with: if (expiresAt - Date.now() < 300000) refresh()\"\n```\n\n\u274C **BAD** (generic, no context):\n```\n\"Fixed the auth bug by adding a null check\"\n```\n\n**What NOT to Store:**\n- Generic knowledge that's in official documentation\n- Implementation details that change frequently\n- Vague descriptions without context (\"fixed the thing\")\n\n**The WHY matters more than the WHAT.** Future agents need context to apply your learning.\n\n### Step 9: Complete (REQUIRED - releases reservations)\n```\nswarm_complete(\n project_key=\"{project_path}\",\n agent_name=\"<your-agent-name>\",\n bead_id=\"{bead_id}\",\n summary=\"<what you accomplished>\",\n files_touched=[\"list\", \"of\", \"files\"]\n)\n```\n\n**This automatically:**\n- Runs UBS bug scan\n- Releases file reservations\n- Records learning signals\n- Notifies coordinator\n\n**DO NOT manually close the cell with hive_close.** Use swarm_complete.\n\n## [SWARM MAIL COMMUNICATION]\n\n### Check Inbox Regularly\n```\nswarmmail_inbox() # Check for coordinator messages\nswarmmail_read_message(message_id=N) # Read specific message\n```\n\n### When Blocked\n```\nswarmmail_send(\n to=[\"coordinator\"],\n subject=\"BLOCKED: {bead_id}\",\n body=\"<blocker description, what you need>\",\n importance=\"high\",\n thread_id=\"{epic_id}\"\n)\nhive_update(id=\"{bead_id}\", status=\"blocked\")\n```\n\n### Report Issues to Other Agents\n```\nswarmmail_send(\n to=[\"OtherAgent\", \"coordinator\"],\n subject=\"Issue in {bead_id}\",\n body=\"<describe problem, don't fix their code>\",\n thread_id=\"{epic_id}\"\n)\n```\n\n### Manual Release (if needed)\n```\nswarmmail_release() # Manually release reservations\n```\n\n**Note:** `swarm_complete` automatically releases reservations. Only use manual release if aborting work.\n\n## [OTHER TOOLS]\n### Hive - You Have Autonomy to File Issues\nYou can create new cells against this epic when you discover:\n- **Bugs**: Found a bug while working? File it.\n- **Tech debt**: Spotted something that needs cleanup? File it.\n- **Follow-up work**: Task needs more work than scoped? File a follow-up.\n- **Dependencies**: Need something from another agent? File and link it.\n\n```\nhive_create(\n title=\"<descriptive title>\",\n type=\"bug\", # or \"task\", \"chore\"\n priority=2,\n parent_id=\"{epic_id}\", # Links to this epic\n description=\"Found while working on {bead_id}: <details>\"\n)\n```\n\n**Don't silently ignore issues.** File them so they get tracked and addressed.\n\nOther cell operations:\n- hive_update(id, status) - Mark blocked if stuck\n- hive_query(status=\"open\") - See what else needs work\n\n### Skills\n- skills_list() - Discover available skills\n- skills_use(name) - Activate skill for specialized guidance\n- skills_create(name) - Create new skill (if you found a reusable pattern)\n\n## [CRITICAL REQUIREMENTS]\n\n**NON-NEGOTIABLE:**\n1. Step 1 (swarmmail_init) MUST be first - do it before anything else\n2. \uD83E\uDDE0 Step 2 (semantic-memory_find) MUST happen BEFORE starting work - query first, code second\n3. Step 4 (swarmmail_reserve) - YOU reserve files, not coordinator\n4. Step 6 (swarm_progress) - Report at milestones, don't work silently\n5. \uD83D\uDCBE Step 8 (semantic-memory_store) - If you learned something hard, STORE IT\n6. Step 9 (swarm_complete) - Use this to close, NOT hive_close\n\n**If you skip these steps:**\n- Your work won't be tracked (swarm_complete will fail)\n- \uD83D\uDD04 You'll waste time repeating already-solved problems (no semantic memory query)\n- Edit conflicts with other agents (no file reservation)\n- Lost work if you crash (no checkpoints)\n- \uD83D\uDD04 Future agents repeat YOUR mistakes (no learnings stored)\n\n**Memory is the swarm's collective intelligence. Query it. Feed it.**\n\nBegin now.";
|
|
40
|
+
export declare const SUBTASK_PROMPT_V2 = "You are a swarm agent working on: **{subtask_title}**\n\n## [IDENTITY]\nAgent: (assigned at spawn)\nCell: {bead_id}\nEpic: {epic_id}\n\n## [TASK]\n{subtask_description}\n\n## [FILES]\nReserved (exclusive):\n{file_list}\n\nOnly modify these files. Need others? Message the coordinator.\n\n## [CONTEXT]\n{shared_context}\n\n{compressed_context}\n\n{error_context}\n\n## [MANDATORY SURVIVAL CHECKLIST]\n\n**CRITICAL: Follow this checklist IN ORDER. Each step builds on the previous.**\n\n### Step 1: Initialize Coordination (REQUIRED - DO THIS FIRST)\n```\nswarmmail_init(project_path=\"{project_path}\", task_description=\"{bead_id}: {subtask_title}\")\n```\n\n**This registers you with the coordination system and enables:**\n- File reservation tracking\n- Inter-agent communication\n- Progress monitoring\n- Conflict detection\n\n**If you skip this step, your work will not be tracked and swarm_complete will fail.**\n\n### Step 2: \uD83E\uDDE0 Query Past Learnings (MANDATORY - BEFORE starting work)\n\n**\u26A0\uFE0F CRITICAL: ALWAYS query semantic memory BEFORE writing ANY code.**\n\n```\nsemantic-memory_find(query=\"<keywords from your task>\", limit=5, expand=true)\n```\n\n**Why this is MANDATORY:**\n- Past agents may have already solved your exact problem\n- Avoids repeating mistakes that wasted 30+ minutes before\n- Discovers project-specific patterns and gotchas\n- Finds known workarounds for tool/library quirks\n\n**Search Query Examples by Task Type:**\n\n- **Bug fix**: Use exact error message or \"<symptom> <component>\"\n- **New feature**: Search \"<domain concept> implementation pattern\"\n- **Refactor**: Query \"<pattern name> migration approach\"\n- **Integration**: Look for \"<library name> gotchas configuration\"\n- **Testing**: Find \"testing <component type> characterization tests\"\n- **Performance**: Search \"<technology> performance optimization\"\n\n**BEFORE you start coding:**\n1. Run semantic-memory_find with keywords from your task\n2. Read the results with expand=true for full content\n3. Check if any memory solves your problem or warns of pitfalls\n4. Adjust your approach based on past learnings\n\n**If you skip this step, you WILL waste time solving already-solved problems.**\n\n### Step 3: Load Relevant Skills (if available)\n```\nskills_list() # See what skills exist\nskills_use(name=\"<relevant-skill>\", context=\"<your task>\") # Load skill\n```\n\n**Common skill triggers:**\n- Writing tests? \u2192 `skills_use(name=\"testing-patterns\")`\n- Breaking dependencies? \u2192 `skills_use(name=\"testing-patterns\")`\n- Multi-agent coordination? \u2192 `skills_use(name=\"swarm-coordination\")`\n- Building a CLI? \u2192 `skills_use(name=\"cli-builder\")`\n\n### Step 4: Reserve Your Files (YOU reserve, not coordinator)\n```\nswarmmail_reserve(\n paths=[{file_list}],\n reason=\"{bead_id}: {subtask_title}\",\n exclusive=true\n)\n```\n\n**Workers reserve their own files.** This prevents edit conflicts with other agents.\n\n### Step 5: Do the Work (TDD MANDATORY)\n\n**Follow RED \u2192 GREEN \u2192 REFACTOR. No exceptions.**\n\n1. **RED**: Write a failing test that describes the expected behavior\n - Test MUST fail before you write implementation\n - If test passes immediately, your test is wrong\n \n2. **GREEN**: Write minimal code to make the test pass\n - Don't over-engineer - just make it green\n - Hardcode if needed, refactor later\n \n3. **REFACTOR**: Clean up while tests stay green\n - Run tests after every change\n - If tests break, undo and try again\n\n```bash\n# Run tests continuously\nbun test <your-test-file> --watch\n```\n\n**Why TDD?**\n- Catches bugs before they exist\n- Documents expected behavior\n- Enables fearless refactoring\n- Proves your code works\n\n### Step 6: Report Progress at Milestones\n```\nswarm_progress(\n project_key=\"{project_path}\",\n agent_name=\"<your-agent-name>\",\n bead_id=\"{bead_id}\",\n status=\"in_progress\",\n progress_percent=25, # or 50, 75\n message=\"<what you just completed>\"\n)\n```\n\n**Report at 25%, 50%, 75% completion.** This:\n- Triggers auto-checkpoint (saves context)\n- Keeps coordinator informed\n- Prevents silent failures\n\n### Step 7: Manual Checkpoint BEFORE Risky Operations\n```\nswarm_checkpoint(\n project_key=\"{project_path}\",\n agent_name=\"<your-agent-name>\",\n bead_id=\"{bead_id}\"\n)\n```\n\n**Call BEFORE:**\n- Large refactors\n- File deletions\n- Breaking API changes\n- Anything that might fail catastrophically\n\n**Checkpoints preserve context so you can recover if things go wrong.**\n\n### Step 8: \uD83D\uDCBE STORE YOUR LEARNINGS (if you discovered something)\n\n**If you learned it the hard way, STORE IT so the next agent doesn't have to.**\n\n```\nsemantic-memory_store(\n information=\"<what you learned, WHY it matters, how to apply it>\",\n tags=\"<domain, tech-stack, pattern-type>\"\n)\n```\n\n**MANDATORY Storage Triggers - Store when you:**\n- \uD83D\uDC1B **Solved a tricky bug** (>15min debugging) - include root cause + solution\n- \uD83D\uDCA1 **Discovered a project-specific pattern** - domain rules, business logic quirks\n- \u26A0\uFE0F **Found a tool/library gotcha** - API quirks, version-specific bugs, workarounds\n- \uD83D\uDEAB **Tried an approach that failed** - anti-patterns to avoid, why it didn't work\n- \uD83C\uDFD7\uFE0F **Made an architectural decision** - reasoning, alternatives considered, tradeoffs\n\n**What Makes a GOOD Memory:**\n\n\u2705 **GOOD** (actionable, explains WHY):\n```\n\"OAuth refresh tokens need 5min buffer before expiry to avoid race conditions.\nWithout buffer, token refresh can fail mid-request if expiry happens between\ncheck and use. Implemented with: if (expiresAt - Date.now() < 300000) refresh()\"\n```\n\n\u274C **BAD** (generic, no context):\n```\n\"Fixed the auth bug by adding a null check\"\n```\n\n**What NOT to Store:**\n- Generic knowledge that's in official documentation\n- Implementation details that change frequently\n- Vague descriptions without context (\"fixed the thing\")\n\n**The WHY matters more than the WHAT.** Future agents need context to apply your learning.\n\n### Step 9: Complete (REQUIRED - releases reservations)\n```\nswarm_complete(\n project_key=\"{project_path}\",\n agent_name=\"<your-agent-name>\",\n bead_id=\"{bead_id}\",\n summary=\"<what you accomplished>\",\n files_touched=[\"list\", \"of\", \"files\"]\n)\n```\n\n**This automatically:**\n- Runs UBS bug scan\n- Releases file reservations\n- Records learning signals\n- Notifies coordinator\n\n**DO NOT manually close the cell with hive_close.** Use swarm_complete.\n\n## [ON-DEMAND RESEARCH]\n\nIf you encounter unknown API behavior or version-specific issues:\n\n1. **Check semantic-memory first:**\n `semantic-memory_find(query=\"<library> <version> <topic>\", limit=3, expand=true)`\n\n2. **If not found, spawn researcher:**\n `swarm_spawn_researcher(research_id=\"{bead_id}-research\", epic_id=\"{epic_id}\", tech_stack=[\"<library>\"], project_path=\"{project_path}\")`\n Then spawn with Task tool: `Task(subagent_type=\"swarm/researcher\", prompt=\"<from above>\")`\n\n3. **Wait for research, then continue**\n\n**Research triggers:**\n- \"I'm not sure how this API works in version X\"\n- \"This might have breaking changes\"\n- \"The docs I remember might be outdated\"\n\n**Don't research:**\n- Standard patterns you're confident about\n- Well-documented, stable APIs\n- Obvious implementations\n\n## [SWARM MAIL COMMUNICATION]\n\n### Check Inbox Regularly\n```\nswarmmail_inbox() # Check for coordinator messages\nswarmmail_read_message(message_id=N) # Read specific message\n```\n\n### When Blocked\n```\nswarmmail_send(\n to=[\"coordinator\"],\n subject=\"BLOCKED: {bead_id}\",\n body=\"<blocker description, what you need>\",\n importance=\"high\",\n thread_id=\"{epic_id}\"\n)\nhive_update(id=\"{bead_id}\", status=\"blocked\")\n```\n\n### Report Issues to Other Agents\n```\nswarmmail_send(\n to=[\"OtherAgent\", \"coordinator\"],\n subject=\"Issue in {bead_id}\",\n body=\"<describe problem, don't fix their code>\",\n thread_id=\"{epic_id}\"\n)\n```\n\n### Manual Release (if needed)\n```\nswarmmail_release() # Manually release reservations\n```\n\n**Note:** `swarm_complete` automatically releases reservations. Only use manual release if aborting work.\n\n## [OTHER TOOLS]\n### Hive - You Have Autonomy to File Issues\nYou can create new cells against this epic when you discover:\n- **Bugs**: Found a bug while working? File it.\n- **Tech debt**: Spotted something that needs cleanup? File it.\n- **Follow-up work**: Task needs more work than scoped? File a follow-up.\n- **Dependencies**: Need something from another agent? File and link it.\n\n```\nhive_create(\n title=\"<descriptive title>\",\n type=\"bug\", # or \"task\", \"chore\"\n priority=2,\n parent_id=\"{epic_id}\", # Links to this epic\n description=\"Found while working on {bead_id}: <details>\"\n)\n```\n\n**Don't silently ignore issues.** File them so they get tracked and addressed.\n\nOther cell operations:\n- hive_update(id, status) - Mark blocked if stuck\n- hive_query(status=\"open\") - See what else needs work\n\n### Skills\n- skills_list() - Discover available skills\n- skills_use(name) - Activate skill for specialized guidance\n- skills_create(name) - Create new skill (if you found a reusable pattern)\n\n## [CRITICAL REQUIREMENTS]\n\n**NON-NEGOTIABLE:**\n1. Step 1 (swarmmail_init) MUST be first - do it before anything else\n2. \uD83E\uDDE0 Step 2 (semantic-memory_find) MUST happen BEFORE starting work - query first, code second\n3. Step 4 (swarmmail_reserve) - YOU reserve files, not coordinator\n4. Step 6 (swarm_progress) - Report at milestones, don't work silently\n5. \uD83D\uDCBE Step 8 (semantic-memory_store) - If you learned something hard, STORE IT\n6. Step 9 (swarm_complete) - Use this to close, NOT hive_close\n\n**If you skip these steps:**\n- Your work won't be tracked (swarm_complete will fail)\n- \uD83D\uDD04 You'll waste time repeating already-solved problems (no semantic memory query)\n- Edit conflicts with other agents (no file reservation)\n- Lost work if you crash (no checkpoints)\n- \uD83D\uDD04 Future agents repeat YOUR mistakes (no learnings stored)\n\n**Memory is the swarm's collective intelligence. Query it. Feed it.**\n\nBegin now.";
|
|
41
|
+
/**
|
|
42
|
+
* Researcher prompt template for documentation discovery
|
|
43
|
+
*
|
|
44
|
+
* Spawned BEFORE decomposition to gather technology documentation.
|
|
45
|
+
* Researchers receive an EXPLICIT list of technologies to research from the coordinator.
|
|
46
|
+
* They dynamically discover WHAT TOOLS are available to fetch docs.
|
|
47
|
+
* Output: condensed summary for shared_context + detailed findings in semantic-memory.
|
|
48
|
+
*/
|
|
49
|
+
export declare const RESEARCHER_PROMPT = "You are a swarm researcher gathering documentation for: **{research_id}**\n\n## [IDENTITY]\nAgent: (assigned at spawn)\nResearch Task: {research_id}\nEpic: {epic_id}\n\n## [MISSION]\nGather comprehensive documentation for the specified technologies to inform task decomposition.\n\n**COORDINATOR PROVIDED THESE TECHNOLOGIES TO RESEARCH:**\n{tech_stack}\n\nYou do NOT discover what to research - the coordinator already decided that.\nYou DO discover what TOOLS are available to fetch documentation.\n\n## [OUTPUT MODE]\n{check_upgrades}\n\n## [WORKFLOW]\n\n### Step 1: Initialize (MANDATORY FIRST)\n```\nswarmmail_init(project_path=\"{project_path}\", task_description=\"{research_id}: Documentation research\")\n```\n\n### Step 2: Discover Available Documentation Tools\nCheck what's available for fetching docs:\n- **next-devtools**: `nextjs_docs` for Next.js documentation\n- **context7**: Library documentation lookup (`use context7` in prompts)\n- **fetch**: General web fetching for official docs sites\n- **pdf-brain**: Internal knowledge base search\n\n**Don't assume** - check which tools exist in your environment.\n\n### Step 3: Read Installed Versions\nFor each technology in the tech stack:\n1. Check package.json (or equivalent) for installed version\n2. Record exact version numbers\n3. Note any version constraints (^, ~, etc.)\n\n### Step 4: Fetch Documentation\nFor EACH technology in the list:\n- Use the most appropriate tool (Next.js \u2192 nextjs_docs, libraries \u2192 context7, others \u2192 fetch)\n- Fetch documentation for the INSTALLED version (not latest, unless --check-upgrades)\n- Focus on: API changes, breaking changes, migration guides, best practices\n- Extract key patterns, gotchas, and compatibility notes\n\n**If --check-upgrades mode:**\n- ALSO fetch docs for the LATEST version\n- Compare installed vs latest\n- Note breaking changes, new features, migration complexity\n\n### Step 5: Store Detailed Findings\nFor EACH technology, store in semantic-memory:\n```\nsemantic-memory_store(\n information=\"<technology-name> <version>: <key patterns, gotchas, API changes, compatibility notes>\",\n tags=\"research, <tech-name>, documentation, {epic_id}\"\n)\n```\n\n**Why store individually?** Future agents can search by technology name.\n\n### Step 6: Broadcast Summary\nSend condensed findings to coordinator:\n```\nswarmmail_send(\n to=[\"coordinator\"],\n subject=\"Research Complete: {research_id}\",\n body=\"<brief summary - see semantic-memory for details>\",\n thread_id=\"{epic_id}\"\n)\n```\n\n### Step 7: Return Structured Output\nOutput JSON with:\n```json\n{\n \"technologies\": [\n {\n \"name\": \"string\",\n \"installed_version\": \"string\",\n \"latest_version\": \"string | null\", // Only if --check-upgrades\n \"key_patterns\": [\"string\"],\n \"gotchas\": [\"string\"],\n \"breaking_changes\": [\"string\"], // Only if --check-upgrades\n \"memory_id\": \"string\" // ID of semantic-memory entry\n }\n ],\n \"summary\": \"string\" // Condensed summary for shared_context\n}\n```\n\n## [CRITICAL REQUIREMENTS]\n\n**NON-NEGOTIABLE:**\n1. Step 1 (swarmmail_init) MUST be first\n2. Research ONLY the technologies the coordinator specified\n3. Fetch docs for INSTALLED versions (unless --check-upgrades)\n4. Store detailed findings in semantic-memory (one per technology)\n5. Return condensed summary for coordinator (full details in memory)\n6. Use appropriate doc tools (nextjs_docs for Next.js, context7 for libraries, etc.)\n\n**Output goes TWO places:**\n- **semantic-memory**: Detailed findings (searchable by future agents)\n- **Return JSON**: Condensed summary (for coordinator's shared_context)\n\nBegin research now.";
|
|
41
50
|
/**
|
|
42
51
|
* Coordinator post-worker checklist - MANDATORY review loop
|
|
43
52
|
*
|
|
44
53
|
* This checklist is returned to coordinators after spawning a worker.
|
|
45
54
|
* It ensures coordinators REVIEW worker output before spawning the next worker.
|
|
46
55
|
*/
|
|
47
|
-
export declare const COORDINATOR_POST_WORKER_CHECKLIST = "\n## \u26A0\uFE0F MANDATORY: Post-Worker Review (DO THIS IMMEDIATELY)\n\n**A worker just returned. Before doing ANYTHING else, complete this checklist:**\n\n### Step 1: Check Swarm Mail\n```\nswarmmail_inbox()\nswarmmail_read_message(message_id=N) // Read any messages from the worker\n```\n\n### Step 2: Review the Work\n```\nswarm_review(\n project_key=\"{project_key}\",\n epic_id=\"{epic_id}\",\n task_id=\"{task_id}\",\n files_touched=[{files_touched}]\n)\n```\n\nThis generates a review prompt with:\n- Epic context (what we're trying to achieve)\n- Subtask requirements\n- Git diff of changes\n- Dependency status\n\n### Step 3: Evaluate Against Criteria\n- Does the work fulfill the subtask requirements?\n- Does it serve the overall epic goal?\n- Does it enable downstream tasks?\n- Type safety, no obvious bugs?\n\n### Step 4: Send Feedback\n```\nswarm_review_feedback(\n project_key=\"{project_key}\",\n task_id=\"{task_id}\",\n worker_id=\"{worker_id}\",\n status=\"approved\", // or \"needs_changes\"\n summary=\"<brief summary>\",\n issues=\"[]\" // or \"[{file, line, issue, suggestion}]\"\n)\n```\n\n### Step 5:
|
|
56
|
+
export declare const COORDINATOR_POST_WORKER_CHECKLIST = "\n## \u26A0\uFE0F MANDATORY: Post-Worker Review (DO THIS IMMEDIATELY)\n\n**A worker just returned. Before doing ANYTHING else, complete this checklist:**\n\n### Step 1: Check Swarm Mail\n```\nswarmmail_inbox()\nswarmmail_read_message(message_id=N) // Read any messages from the worker\n```\n\n### Step 2: Review the Work\n```\nswarm_review(\n project_key=\"{project_key}\",\n epic_id=\"{epic_id}\",\n task_id=\"{task_id}\",\n files_touched=[{files_touched}]\n)\n```\n\nThis generates a review prompt with:\n- Epic context (what we're trying to achieve)\n- Subtask requirements\n- Git diff of changes\n- Dependency status\n\n### Step 3: Evaluate Against Criteria\n- Does the work fulfill the subtask requirements?\n- Does it serve the overall epic goal?\n- Does it enable downstream tasks?\n- Type safety, no obvious bugs?\n\n### Step 4: Send Feedback\n```\nswarm_review_feedback(\n project_key=\"{project_key}\",\n task_id=\"{task_id}\",\n worker_id=\"{worker_id}\",\n status=\"approved\", // or \"needs_changes\"\n summary=\"<brief summary>\",\n issues=\"[]\" // or \"[{file, line, issue, suggestion}]\"\n)\n```\n\n### Step 5: Take Action Based on Review\n\n**If APPROVED:**\n- Close the cell with hive_close\n- Spawn next worker (if any) using swarm_spawn_subtask\n\n**If NEEDS_CHANGES:**\n- Generate retry prompt:\n ```\n swarm_spawn_retry(\n bead_id=\"{task_id}\",\n epic_id=\"{epic_id}\",\n original_prompt=\"<original prompt>\",\n attempt=<current_attempt>,\n issues=\"<JSON from swarm_review_feedback>\",\n diff=\"<git diff of previous changes>\",\n files=[{files_touched}],\n project_path=\"{project_key}\"\n )\n ```\n- Spawn new worker with Task() using the retry prompt\n- Increment attempt counter (max 3 attempts)\n\n**If 3 FAILURES:**\n- Mark task as blocked: `hive_update(id=\"{task_id}\", status=\"blocked\")`\n- Escalate to human - likely an architectural problem, not execution issue\n\n**\u26A0\uFE0F DO NOT spawn the next worker until review is complete.**\n";
|
|
48
57
|
/**
|
|
49
58
|
* Prompt for self-evaluation before completing a subtask.
|
|
50
59
|
*
|
|
51
60
|
* Agents use this to assess their work quality before marking complete.
|
|
52
61
|
*/
|
|
53
62
|
export declare const EVALUATION_PROMPT = "Evaluate the work completed for this subtask.\n\n## Subtask\n**Cell ID**: {bead_id}\n**Title**: {subtask_title}\n\n## Files Modified\n{files_touched}\n\n## Evaluation Criteria\n\nFor each criterion, assess passed/failed and provide brief feedback:\n\n1. **type_safe**: Code compiles without TypeScript errors\n2. **no_bugs**: No obvious bugs, edge cases handled\n3. **patterns**: Follows existing codebase patterns and conventions\n4. **readable**: Code is clear and maintainable\n\n## Response Format\n\n```json\n{\n \"passed\": boolean, // Overall pass/fail\n \"criteria\": {\n \"type_safe\": { \"passed\": boolean, \"feedback\": string },\n \"no_bugs\": { \"passed\": boolean, \"feedback\": string },\n \"patterns\": { \"passed\": boolean, \"feedback\": string },\n \"readable\": { \"passed\": boolean, \"feedback\": string }\n },\n \"overall_feedback\": string,\n \"retry_suggestion\": string | null // If failed, what to fix\n}\n```\n\nIf any criterion fails, the overall evaluation fails and retry_suggestion \nshould describe what needs to be fixed.";
|
|
63
|
+
/**
|
|
64
|
+
* Format the researcher prompt for a documentation research task
|
|
65
|
+
*/
|
|
66
|
+
export declare function formatResearcherPrompt(params: {
|
|
67
|
+
research_id: string;
|
|
68
|
+
epic_id: string;
|
|
69
|
+
tech_stack: string[];
|
|
70
|
+
project_path: string;
|
|
71
|
+
check_upgrades: boolean;
|
|
72
|
+
}): string;
|
|
54
73
|
/**
|
|
55
74
|
* Format the V2 subtask prompt for a specific agent
|
|
56
75
|
*/
|
|
@@ -155,6 +174,58 @@ export declare const swarm_spawn_subtask: {
|
|
|
155
174
|
model?: string | undefined;
|
|
156
175
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
157
176
|
};
|
|
177
|
+
/**
|
|
178
|
+
* Prepare a researcher task for spawning with Task tool
|
|
179
|
+
*
|
|
180
|
+
* Generates a prompt that tells the researcher to fetch documentation for specific technologies.
|
|
181
|
+
* Returns JSON that can be directly used with Task tool.
|
|
182
|
+
*/
|
|
183
|
+
export declare const swarm_spawn_researcher: {
|
|
184
|
+
description: string;
|
|
185
|
+
args: {
|
|
186
|
+
research_id: import("zod").ZodString;
|
|
187
|
+
epic_id: import("zod").ZodString;
|
|
188
|
+
tech_stack: import("zod").ZodArray<import("zod").ZodString>;
|
|
189
|
+
project_path: import("zod").ZodString;
|
|
190
|
+
check_upgrades: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
191
|
+
};
|
|
192
|
+
execute(args: {
|
|
193
|
+
research_id: string;
|
|
194
|
+
epic_id: string;
|
|
195
|
+
tech_stack: string[];
|
|
196
|
+
project_path: string;
|
|
197
|
+
check_upgrades?: boolean | undefined;
|
|
198
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Generate retry prompt for a worker that needs to fix issues from review feedback
|
|
202
|
+
*
|
|
203
|
+
* Coordinators use this when swarm_review_feedback returns "needs_changes".
|
|
204
|
+
* Creates a new worker spawn with context about what went wrong and what to fix.
|
|
205
|
+
*/
|
|
206
|
+
export declare const swarm_spawn_retry: {
|
|
207
|
+
description: string;
|
|
208
|
+
args: {
|
|
209
|
+
bead_id: import("zod").ZodString;
|
|
210
|
+
epic_id: import("zod").ZodString;
|
|
211
|
+
original_prompt: import("zod").ZodString;
|
|
212
|
+
attempt: import("zod").ZodNumber;
|
|
213
|
+
issues: import("zod").ZodString;
|
|
214
|
+
diff: import("zod").ZodOptional<import("zod").ZodString>;
|
|
215
|
+
files: import("zod").ZodArray<import("zod").ZodString>;
|
|
216
|
+
project_path: import("zod").ZodOptional<import("zod").ZodString>;
|
|
217
|
+
};
|
|
218
|
+
execute(args: {
|
|
219
|
+
bead_id: string;
|
|
220
|
+
epic_id: string;
|
|
221
|
+
original_prompt: string;
|
|
222
|
+
attempt: number;
|
|
223
|
+
issues: string;
|
|
224
|
+
files: string[];
|
|
225
|
+
diff?: string | undefined;
|
|
226
|
+
project_path?: string | undefined;
|
|
227
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
228
|
+
};
|
|
158
229
|
/**
|
|
159
230
|
* Generate self-evaluation prompt
|
|
160
231
|
*/
|
|
@@ -260,6 +331,46 @@ export declare const promptTools: {
|
|
|
260
331
|
model?: string | undefined;
|
|
261
332
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
262
333
|
};
|
|
334
|
+
swarm_spawn_researcher: {
|
|
335
|
+
description: string;
|
|
336
|
+
args: {
|
|
337
|
+
research_id: import("zod").ZodString;
|
|
338
|
+
epic_id: import("zod").ZodString;
|
|
339
|
+
tech_stack: import("zod").ZodArray<import("zod").ZodString>;
|
|
340
|
+
project_path: import("zod").ZodString;
|
|
341
|
+
check_upgrades: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
342
|
+
};
|
|
343
|
+
execute(args: {
|
|
344
|
+
research_id: string;
|
|
345
|
+
epic_id: string;
|
|
346
|
+
tech_stack: string[];
|
|
347
|
+
project_path: string;
|
|
348
|
+
check_upgrades?: boolean | undefined;
|
|
349
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
350
|
+
};
|
|
351
|
+
swarm_spawn_retry: {
|
|
352
|
+
description: string;
|
|
353
|
+
args: {
|
|
354
|
+
bead_id: import("zod").ZodString;
|
|
355
|
+
epic_id: import("zod").ZodString;
|
|
356
|
+
original_prompt: import("zod").ZodString;
|
|
357
|
+
attempt: import("zod").ZodNumber;
|
|
358
|
+
issues: import("zod").ZodString;
|
|
359
|
+
diff: import("zod").ZodOptional<import("zod").ZodString>;
|
|
360
|
+
files: import("zod").ZodArray<import("zod").ZodString>;
|
|
361
|
+
project_path: import("zod").ZodOptional<import("zod").ZodString>;
|
|
362
|
+
};
|
|
363
|
+
execute(args: {
|
|
364
|
+
bead_id: string;
|
|
365
|
+
epic_id: string;
|
|
366
|
+
original_prompt: string;
|
|
367
|
+
attempt: number;
|
|
368
|
+
issues: string;
|
|
369
|
+
files: string[];
|
|
370
|
+
diff?: string | undefined;
|
|
371
|
+
project_path?: string | undefined;
|
|
372
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
373
|
+
};
|
|
263
374
|
swarm_evaluation_prompt: {
|
|
264
375
|
description: string;
|
|
265
376
|
args: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swarm-prompts.d.ts","sourceRoot":"","sources":["../src/swarm-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,s6EAkET,CAAC;AAEzB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOvB,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swarm Research Module - Tool discovery for documentation researchers
|
|
3
|
+
*
|
|
4
|
+
* Provides runtime detection of available documentation tools:
|
|
5
|
+
* - Skills (via skills_list)
|
|
6
|
+
* - MCP servers (next-devtools, context7, fetch, pdf-brain)
|
|
7
|
+
* - CLI tools (semantic-memory via ollama)
|
|
8
|
+
*
|
|
9
|
+
* Researchers use this to discover HOW to fetch docs.
|
|
10
|
+
* Coordinators provide WHAT to research (tech stack).
|
|
11
|
+
*
|
|
12
|
+
* @module swarm-research
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Version information for an installed package
|
|
16
|
+
*/
|
|
17
|
+
export interface VersionInfo {
|
|
18
|
+
/** Package name */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Installed version (semver) */
|
|
21
|
+
version: string;
|
|
22
|
+
/** Where version was discovered */
|
|
23
|
+
source: "lockfile" | "package.json";
|
|
24
|
+
/** Original constraint from package.json (e.g., "^1.2.3") */
|
|
25
|
+
constraint?: string;
|
|
26
|
+
/** Latest version from npm registry (only if checkUpgrades=true) */
|
|
27
|
+
latest?: string;
|
|
28
|
+
/** Whether an update is available (version !== latest) */
|
|
29
|
+
updateAvailable?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Discovered tool with capabilities
|
|
33
|
+
*/
|
|
34
|
+
export interface DiscoveredTool {
|
|
35
|
+
/** Tool name */
|
|
36
|
+
name: string;
|
|
37
|
+
/** Tool type: skill, MCP server, or CLI */
|
|
38
|
+
type: "skill" | "mcp" | "cli";
|
|
39
|
+
/** What this tool can do */
|
|
40
|
+
capabilities: string[];
|
|
41
|
+
/** Whether tool is available in this environment */
|
|
42
|
+
available: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Fetch latest version of a package from npm registry
|
|
46
|
+
*
|
|
47
|
+
* Uses npm registry API: https://registry.npmjs.org/{package}/latest
|
|
48
|
+
*
|
|
49
|
+
* @param packageName - Package name (supports scoped packages like @types/node)
|
|
50
|
+
* @returns Latest version string, or undefined if fetch fails
|
|
51
|
+
*/
|
|
52
|
+
export declare function getLatestVersion(packageName: string): Promise<string | undefined>;
|
|
53
|
+
/**
|
|
54
|
+
* Get installed versions of packages from lockfile (preferred) or package.json
|
|
55
|
+
*
|
|
56
|
+
* Detection order:
|
|
57
|
+
* 1. package-lock.json (npm)
|
|
58
|
+
* 2. pnpm-lock.yaml (pnpm)
|
|
59
|
+
* 3. yarn.lock (yarn)
|
|
60
|
+
* 4. bun.lock → fallback to package.json (bun lockfile is binary)
|
|
61
|
+
* 5. package.json (fallback)
|
|
62
|
+
*
|
|
63
|
+
* @param projectPath - Absolute path to project root
|
|
64
|
+
* @param packages - Package names to look up
|
|
65
|
+
* @param checkUpgrades - If true, fetch latest versions from npm registry and compare
|
|
66
|
+
* @returns Array of version info for found packages
|
|
67
|
+
*/
|
|
68
|
+
export declare function getInstalledVersions(projectPath: string, packages: string[], checkUpgrades?: boolean): Promise<VersionInfo[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Discover available documentation tools
|
|
71
|
+
*
|
|
72
|
+
* Checks for:
|
|
73
|
+
* - Skills (via skills discovery)
|
|
74
|
+
* - MCP servers (next-devtools, context7, fetch, pdf-brain)
|
|
75
|
+
* - CLI tools (semantic-memory)
|
|
76
|
+
*
|
|
77
|
+
* @returns List of discovered tools with availability status
|
|
78
|
+
*/
|
|
79
|
+
export declare function discoverDocTools(): Promise<DiscoveredTool[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Plugin tool for discovering available documentation tools
|
|
82
|
+
*/
|
|
83
|
+
export declare const swarm_discover_tools: {
|
|
84
|
+
description: string;
|
|
85
|
+
args: {};
|
|
86
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Plugin tool for getting installed package versions
|
|
90
|
+
*/
|
|
91
|
+
export declare const swarm_get_versions: {
|
|
92
|
+
description: string;
|
|
93
|
+
args: {
|
|
94
|
+
projectPath: import("zod").ZodString;
|
|
95
|
+
packages: import("zod").ZodArray<import("zod").ZodString>;
|
|
96
|
+
checkUpgrades: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
97
|
+
};
|
|
98
|
+
execute(args: {
|
|
99
|
+
projectPath: string;
|
|
100
|
+
packages: string[];
|
|
101
|
+
checkUpgrades?: boolean | undefined;
|
|
102
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Research tools for plugin registration
|
|
106
|
+
*/
|
|
107
|
+
export declare const researchTools: {
|
|
108
|
+
swarm_discover_tools: {
|
|
109
|
+
description: string;
|
|
110
|
+
args: {};
|
|
111
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
112
|
+
};
|
|
113
|
+
swarm_get_versions: {
|
|
114
|
+
description: string;
|
|
115
|
+
args: {
|
|
116
|
+
projectPath: import("zod").ZodString;
|
|
117
|
+
packages: import("zod").ZodArray<import("zod").ZodString>;
|
|
118
|
+
checkUpgrades: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
119
|
+
};
|
|
120
|
+
execute(args: {
|
|
121
|
+
projectPath: string;
|
|
122
|
+
packages: string[];
|
|
123
|
+
checkUpgrades?: boolean | undefined;
|
|
124
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=swarm-research.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swarm-research.d.ts","sourceRoot":"","sources":["../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@ export * from "./swarm-strategies";
|
|
|
14
14
|
export * from "./swarm-decompose";
|
|
15
15
|
export * from "./swarm-prompts";
|
|
16
16
|
export * from "./swarm-orchestrate";
|
|
17
|
+
export * from "./swarm-research";
|
|
17
18
|
/**
|
|
18
19
|
* Combined swarm tools for plugin registration.
|
|
19
|
-
* Includes all tools from strategy, decompose, prompt, and
|
|
20
|
+
* Includes all tools from strategy, decompose, prompt, orchestrate, and research modules.
|
|
20
21
|
*/
|
|
21
22
|
export declare const swarmTools: {
|
|
23
|
+
swarm_discover_tools: {
|
|
24
|
+
description: string;
|
|
25
|
+
args: {};
|
|
26
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
27
|
+
};
|
|
28
|
+
swarm_get_versions: {
|
|
29
|
+
description: string;
|
|
30
|
+
args: {
|
|
31
|
+
projectPath: import("zod").ZodString;
|
|
32
|
+
packages: import("zod").ZodArray<import("zod").ZodString>;
|
|
33
|
+
checkUpgrades: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
34
|
+
};
|
|
35
|
+
execute(args: {
|
|
36
|
+
projectPath: string;
|
|
37
|
+
packages: string[];
|
|
38
|
+
checkUpgrades?: boolean | undefined;
|
|
39
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
40
|
+
};
|
|
22
41
|
swarm_init: {
|
|
23
42
|
description: string;
|
|
24
43
|
args: {
|
|
@@ -165,6 +184,19 @@ export declare const swarmTools: {
|
|
|
165
184
|
failure_details?: string | undefined;
|
|
166
185
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
167
186
|
};
|
|
187
|
+
swarm_research_phase: {
|
|
188
|
+
description: string;
|
|
189
|
+
args: {
|
|
190
|
+
task: import("zod").ZodString;
|
|
191
|
+
project_path: import("zod").ZodString;
|
|
192
|
+
check_upgrades: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
193
|
+
};
|
|
194
|
+
execute(args: {
|
|
195
|
+
task: string;
|
|
196
|
+
project_path: string;
|
|
197
|
+
check_upgrades?: boolean | undefined;
|
|
198
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
199
|
+
};
|
|
168
200
|
swarm_accumulate_error: {
|
|
169
201
|
description: string;
|
|
170
202
|
args: {
|
|
@@ -360,6 +392,46 @@ export declare const swarmTools: {
|
|
|
360
392
|
model?: string | undefined;
|
|
361
393
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
362
394
|
};
|
|
395
|
+
swarm_spawn_researcher: {
|
|
396
|
+
description: string;
|
|
397
|
+
args: {
|
|
398
|
+
research_id: import("zod").ZodString;
|
|
399
|
+
epic_id: import("zod").ZodString;
|
|
400
|
+
tech_stack: import("zod").ZodArray<import("zod").ZodString>;
|
|
401
|
+
project_path: import("zod").ZodString;
|
|
402
|
+
check_upgrades: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
403
|
+
};
|
|
404
|
+
execute(args: {
|
|
405
|
+
research_id: string;
|
|
406
|
+
epic_id: string;
|
|
407
|
+
tech_stack: string[];
|
|
408
|
+
project_path: string;
|
|
409
|
+
check_upgrades?: boolean | undefined;
|
|
410
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
411
|
+
};
|
|
412
|
+
swarm_spawn_retry: {
|
|
413
|
+
description: string;
|
|
414
|
+
args: {
|
|
415
|
+
bead_id: import("zod").ZodString;
|
|
416
|
+
epic_id: import("zod").ZodString;
|
|
417
|
+
original_prompt: import("zod").ZodString;
|
|
418
|
+
attempt: import("zod").ZodNumber;
|
|
419
|
+
issues: import("zod").ZodString;
|
|
420
|
+
diff: import("zod").ZodOptional<import("zod").ZodString>;
|
|
421
|
+
files: import("zod").ZodArray<import("zod").ZodString>;
|
|
422
|
+
project_path: import("zod").ZodOptional<import("zod").ZodString>;
|
|
423
|
+
};
|
|
424
|
+
execute(args: {
|
|
425
|
+
bead_id: string;
|
|
426
|
+
epic_id: string;
|
|
427
|
+
original_prompt: string;
|
|
428
|
+
attempt: number;
|
|
429
|
+
issues: string;
|
|
430
|
+
files: string[];
|
|
431
|
+
diff?: string | undefined;
|
|
432
|
+
project_path?: string | undefined;
|
|
433
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
434
|
+
};
|
|
363
435
|
swarm_evaluation_prompt: {
|
|
364
436
|
description: string;
|
|
365
437
|
args: {
|
package/dist/swarm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../src/swarm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../src/swarm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AASjC;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMtB,CAAC"}
|