opencode-swarm-plugin 0.57.0 → 0.57.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.
Files changed (32) hide show
  1. package/claude-plugin/agents/coordinator.md +1 -0
  2. package/claude-plugin/bin/swarm-mcp-server.ts +12 -6
  3. package/claude-plugin/dist/bin/swarm.js +27 -8
  4. package/claude-plugin/dist/build/mcp-bundle.d.ts +16 -0
  5. package/claude-plugin/dist/build/mcp-bundle.d.ts.map +1 -0
  6. package/claude-plugin/dist/cache/claude-plugin-cache.d.ts +41 -0
  7. package/claude-plugin/dist/cache/claude-plugin-cache.d.ts.map +1 -0
  8. package/claude-plugin/dist/claude-plugin/claude-plugin-assets.d.ts.map +1 -1
  9. package/claude-plugin/dist/index.js +1 -0
  10. package/claude-plugin/dist/mcp/swarm-mcp-server.js +19675 -0
  11. package/claude-plugin/dist/plugin.js +1 -0
  12. package/claude-plugin/dist/skills.d.ts.map +1 -1
  13. package/claude-plugin/dist/swarm-prompts.d.ts +1 -1
  14. package/claude-plugin/dist/swarm-prompts.d.ts.map +1 -1
  15. package/claude-plugin/dist/swarm-prompts.js +24 -6
  16. package/claude-plugin/scripts/copyClaudePluginRuntimeAssets.ts +84 -0
  17. package/claude-plugin/skills/always-on-guidance/SKILL.md +1 -0
  18. package/claude-plugin/tests/mcp-runtime.test.ts +187 -0
  19. package/dist/bin/swarm.js +27 -8
  20. package/dist/build/mcp-bundle.d.ts +16 -0
  21. package/dist/build/mcp-bundle.d.ts.map +1 -0
  22. package/dist/cache/claude-plugin-cache.d.ts +41 -0
  23. package/dist/cache/claude-plugin-cache.d.ts.map +1 -0
  24. package/dist/claude-plugin/claude-plugin-assets.d.ts.map +1 -1
  25. package/dist/index.js +1 -0
  26. package/dist/mcp/swarm-mcp-server.js +19675 -0
  27. package/dist/plugin.js +1 -0
  28. package/dist/skills.d.ts.map +1 -1
  29. package/dist/swarm-prompts.d.ts +1 -1
  30. package/dist/swarm-prompts.d.ts.map +1 -1
  31. package/dist/swarm-prompts.js +24 -6
  32. package/package.json +4 -2
@@ -22,6 +22,7 @@ Orchestrates swarm work: decomposes tasks, spawns workers, monitors progress, an
22
22
  - **Never reserve files** as the coordinator. Workers reserve their own files.
23
23
  - **Decompose with intent** using `swarm_plan_prompt` + `swarm_validate_decomposition`.
24
24
  - **Review every worker completion** via `swarm_review` + `swarm_review_feedback`.
25
+ - **After every `swarm_spawn_subtask`, immediately call `Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")`.**
25
26
  - **Record outcomes** with `swarm_complete` for learning signals.
26
27
 
27
28
  ## Tool Access
@@ -21,20 +21,26 @@ type ToolDefinition = {
21
21
  /**
22
22
  * Resolve the tool registry entrypoint for the MCP server.
23
23
  */
24
- export function resolveToolRegistryPath(): string {
25
- const currentDir = dirname(fileURLToPath(import.meta.url));
24
+ export function resolveToolRegistryPath({
25
+ currentDir = dirname(fileURLToPath(import.meta.url)),
26
+ }: {
27
+ currentDir?: string;
28
+ } = {}): string {
26
29
  const pluginDistPath = resolve(currentDir, "../dist/index.js");
27
- const packageDistPath = resolve(currentDir, "../../dist/index.js");
28
30
 
29
31
  if (existsSync(pluginDistPath)) {
30
32
  return pluginDistPath;
31
33
  }
32
34
 
33
- if (existsSync(packageDistPath)) {
34
- return packageDistPath;
35
+ const sourcePath = resolve(currentDir, "../../src/index.ts");
36
+ if (existsSync(sourcePath)) {
37
+ return sourcePath;
35
38
  }
36
39
 
37
- return resolve(currentDir, "../../src/index.ts");
40
+ throw new Error(
41
+ `[swarm-mcp] Missing Claude plugin runtime bundle. Expected ${pluginDistPath}. ` +
42
+ "Rebuild the package so claude-plugin/dist is populated.",
43
+ );
38
44
  }
39
45
 
40
46
  /**
@@ -53267,7 +53267,7 @@ ${prefix}}`;
53267
53267
  return path22;
53268
53268
  }
53269
53269
  return sp2.join(cwd, path22);
53270
- }, EMPTY_SET, STAT_METHOD_F = "stat", STAT_METHOD_L = "lstat", FSWatcher, chokidar_default, FileWatcher, NormalizedMessageSchema, OpenCodeSwarmEventSchema, SWARM_MAIL_VERSION = "0.1.0";
53270
+ }, EMPTY_SET, STAT_METHOD_F = "stat", STAT_METHOD_L = "lstat", FSWatcher, chokidar_default, FileWatcher, NormalizedMessageSchema, OpenCodeSwarmEventSchema, SWARM_MAIL_VERSION = "1.10.0";
53271
53271
  var init_dist = __esm(() => {
53272
53272
  __create2 = Object.create;
53273
53273
  __getProtoOf2 = Object.getPrototypeOf;
@@ -169788,7 +169788,7 @@ ${prefix}}`;
169788
169788
  return path24;
169789
169789
  }
169790
169790
  return sp22.join(cwd, path24);
169791
- }, EMPTY_SET2, STAT_METHOD_F2 = "stat", STAT_METHOD_L2 = "lstat", FSWatcher2, chokidar_default2, FileWatcher2, NormalizedMessageSchema2, OpenCodeSwarmEventSchema2, SWARM_MAIL_VERSION2 = "0.1.0";
169791
+ }, EMPTY_SET2, STAT_METHOD_F2 = "stat", STAT_METHOD_L2 = "lstat", FSWatcher2, chokidar_default2, FileWatcher2, NormalizedMessageSchema2, OpenCodeSwarmEventSchema2, SWARM_MAIL_VERSION2 = "1.10.0";
169792
169792
  var init_dist9 = __esm(() => {
169793
169793
  __create4 = Object.create;
169794
169794
  __getProtoOf4 = Object.getPrototypeOf;
@@ -278091,6 +278091,7 @@ var init_skills2 = __esm(() => {
278091
278091
  coordinator: `### Coordinator Enforcement
278092
278092
  - Coordinator role: orchestrate, decompose, spawn workers
278093
278093
  - **Never** edit files or reserve locks directly
278094
+ - **After every \`swarm_spawn_subtask\`, immediately call \`Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")\`**
278094
278095
  - Coordinator override: use \`swarmmail_release_all\` only for stale/orphaned reservations (announce in Swarm Mail)
278095
278096
  - Review work with \`swarm_review\` before accepting`,
278096
278097
  worker: `### Worker Enforcement
@@ -324048,6 +324049,7 @@ var init_skills = __esm4(() => {
324048
324049
  coordinator: `### Coordinator Enforcement
324049
324050
  - Coordinator role: orchestrate, decompose, spawn workers
324050
324051
  - **Never** edit files or reserve locks directly
324052
+ - **After every \`swarm_spawn_subtask\`, immediately call \`Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")\`**
324051
324053
  - Coordinator override: use \`swarmmail_release_all\` only for stale/orphaned reservations (announce in Swarm Mail)
324052
324054
  - Review work with \`swarm_review\` before accepting`,
324053
324055
  worker: `### Worker Enforcement
@@ -352003,7 +352005,7 @@ Your role is **ONLY** to:
352003
352005
  ║ - Clarify task scope (ask questions, understand requirements) ║
352004
352006
  ║ - Read package.json/tsconfig.json for structure (metadata only) ║
352005
352007
  ║ - Decompose into subtasks (swarm_plan_prompt, validate_decomposition) ║
352006
- ║ - Spawn workers (swarm_spawn_subtask, Task(subagent_type="worker"))
352008
+ ║ - Spawn workers (swarm_spawn_subtask Task(subagent_type="swarm-worker", prompt=<from swarm_spawn_subtask>))
352007
352009
  ║ - Monitor progress (swarmmail_inbox, swarm_status) ║
352008
352010
  ║ - Review completed work (swarm_review, swarm_review_feedback) ║
352009
352011
  ║ - Verify final state (check all workers completed, hive_sync) ║
@@ -352047,7 +352049,7 @@ swarm_spawn_subtask(
352047
352049
  files=["src/auth/login.ts", "src/auth/login.test.ts"],
352048
352050
  shared_context="Bug: login fails when username is null"
352049
352051
  )
352050
- Task(subagent_type="swarm-worker", prompt="<from above>")
352052
+ Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")
352051
352053
  \`\`\`
352052
352054
 
352053
352055
  ### Coordinator Override: Release Stale Reservations
@@ -352130,6 +352132,21 @@ Check for flags in the task:
352130
352132
  - Offer concrete options - not open-ended
352131
352133
  - Lead with recommendation - save cognitive load
352132
352134
  - Wait for answer - don't assume
352135
+ - Ask only about **requirements and scope**, never repo file paths or implementation details
352136
+
352137
+ ### Path Discovery (DO NOT ASK USER FOR PATHS)
352138
+ If you don't know the correct file paths (or a worker reports missing files), **do NOT ask the user**. Instead, spawn a short-lived **path discovery** worker to locate the real paths via glob/grep/read, then respawn the main workers with correct files.
352139
+
352140
+ **Trigger conditions:**
352141
+ - File list is guessed or inferred
352142
+ - Worker reports missing files or incorrect paths
352143
+ - Repo structure is unknown or new to you
352144
+
352145
+ **Requirements:**
352146
+ - **Always** spawn a worker for path discovery
352147
+ - **Never** ask the user to locate files or paths
352148
+ - Use explicit wording: "path discovery" in the worker subtask title
352149
+ - Replace bad file lists before spawning main workers
352133
352150
 
352134
352151
  ### Phase 1: Initialize
352135
352152
  \`swarmmail_init(project_path="{project_path}", task_description="Swarm: {task}")\`
@@ -352204,24 +352221,26 @@ swarm_validate_decomposition(response="<CellTree JSON>")
352204
352221
  > - Parallel tasks: Spawn ALL in a single message
352205
352222
  > - Sequential tasks: Spawn one, wait for completion, spawn next
352206
352223
 
352224
+ **After every swarm_spawn_subtask, immediately call Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")**
352225
+
352207
352226
  **For parallel work:**
352208
352227
  \`\`\`
352209
352228
  // Single message with multiple Task calls
352210
352229
  swarm_spawn_subtask(bead_id_1, epic_id, title_1, files_1, shared_context, project_path="{project_path}")
352211
- Task(subagent_type="swarm-worker", prompt="<from above>")
352230
+ Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")
352212
352231
  swarm_spawn_subtask(bead_id_2, epic_id, title_2, files_2, shared_context, project_path="{project_path}")
352213
- Task(subagent_type="swarm-worker", prompt="<from above>")
352232
+ Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")
352214
352233
  \`\`\`
352215
352234
 
352216
352235
  **For sequential work:**
352217
352236
  \`\`\`
352218
352237
  // Spawn worker 1, wait for completion
352219
352238
  swarm_spawn_subtask(bead_id_1, ...)
352220
- const result1 = await Task(subagent_type="swarm-worker", prompt="<from above>")
352239
+ const result1 = await Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")
352221
352240
 
352222
352241
  // THEN spawn worker 2 with context from worker 1
352223
352242
  swarm_spawn_subtask(bead_id_2, ..., shared_context="Worker 1 completed: " + result1)
352224
- const result2 = await Task(subagent_type="swarm-worker", prompt="<from above>")
352243
+ const result2 = await Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")
352225
352244
  \`\`\`
352226
352245
 
352227
352246
  **NEVER do the work yourself.** Even if it seems faster, spawn a worker.
@@ -0,0 +1,16 @@
1
+ export declare const MCP_ENTRY_RELATIVE_PATH: string;
2
+ export declare const MCP_BUNDLE_RELATIVE_PATH: string;
3
+ export type McpBundlePaths = {
4
+ pluginRoot: string;
5
+ entryPath: string;
6
+ bundlePath: string;
7
+ bundleDir: string;
8
+ };
9
+ /**
10
+ * Resolve the entry + output paths for the bundled MCP server.
11
+ */
12
+ export declare function resolveMcpBundlePaths({ packageRoot, pluginRoot, }?: {
13
+ packageRoot?: string;
14
+ pluginRoot?: string;
15
+ }): McpBundlePaths;
16
+ //# sourceMappingURL=mcp-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-bundle.d.ts","sourceRoot":"","sources":["../../src/build/mcp-bundle.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,QAAqC,CAAC;AAC1E,eAAO,MAAM,wBAAwB,QAIpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,WAA2B,EAC3B,UAA+C,GAChD,GAAE;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,cAAc,CAUtB"}
@@ -0,0 +1,41 @@
1
+ export type McpServerConfig = {
2
+ command: string;
3
+ args: string[];
4
+ cwd?: string;
5
+ description?: string;
6
+ };
7
+ export type McpConfig = {
8
+ mcpServers: Record<string, McpServerConfig>;
9
+ };
10
+ export type ClaudePluginCachePaths = {
11
+ cacheRoot: string;
12
+ mcpServerPath: string;
13
+ mcpConfigPath: string;
14
+ };
15
+ export declare const CLAUDE_PLUGIN_ROOT_TOKEN = "${CLAUDE_PLUGIN_ROOT}";
16
+ export declare const SWARM_MCP_SERVER_NAME = "swarm-tools";
17
+ /**
18
+ * Resolve where cached Claude plugin assets should live.
19
+ */
20
+ export declare function resolveClaudePluginCachePaths({ cacheRoot, }?: {
21
+ cacheRoot?: string;
22
+ }): ClaudePluginCachePaths;
23
+ /**
24
+ * Create the MCP config for a cached Claude plugin bundle.
25
+ */
26
+ export declare function createClaudePluginCacheMcpConfig({ pluginRootToken, command, description, }?: {
27
+ pluginRootToken?: string;
28
+ command?: string;
29
+ description?: string;
30
+ }): McpConfig;
31
+ /**
32
+ * Describe the cached Claude plugin entrypoints for bundling.
33
+ */
34
+ export declare function resolveClaudePluginCacheBundleSpec({ cacheRoot, pluginRoot, }?: {
35
+ cacheRoot?: string;
36
+ pluginRoot?: string;
37
+ }): {
38
+ entryPath: string;
39
+ bundlePath: string;
40
+ };
41
+ //# sourceMappingURL=claude-plugin-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-plugin-cache.d.ts","sourceRoot":"","sources":["../../src/cache/claude-plugin-cache.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,wBAAwB,0BAA0B,CAAC;AAChE,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,SAAgD,GACjD,GAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,sBAAsB,CAS9B;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,EAC/C,eAA0C,EAC1C,OAAgB,EAChB,WAAoD,GACrD,GAAE;IACD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS,CAgBjB;AAED;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,EACjD,SAAgD,EAChD,UAAsB,GACvB,GAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAOjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"claude-plugin-assets.d.ts","sourceRoot":"","sources":["../../src/claude-plugin/claude-plugin-assets.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,WAAW,EACX,QAAoC,EACpC,UAA+C,GAChD,EAAE,4BAA4B,GAAG,IAAI,CAgBrC"}
1
+ {"version":3,"file":"claude-plugin-assets.d.ts","sourceRoot":"","sources":["../../src/claude-plugin/claude-plugin-assets.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,WAAW,EACX,QAAoC,EACpC,UAA+C,GAChD,EAAE,4BAA4B,GAAG,IAAI,CAqBrC"}
@@ -27412,6 +27412,7 @@ var init_skills = __esm(() => {
27412
27412
  coordinator: `### Coordinator Enforcement
27413
27413
  - Coordinator role: orchestrate, decompose, spawn workers
27414
27414
  - **Never** edit files or reserve locks directly
27415
+ - **After every \`swarm_spawn_subtask\`, immediately call \`Task(subagent_type="swarm-worker", prompt="<prompt returned by swarm_spawn_subtask>")\`**
27415
27416
  - Coordinator override: use \`swarmmail_release_all\` only for stale/orphaned reservations (announce in Swarm Mail)
27416
27417
  - Review work with \`swarm_review\` before accepting`,
27417
27418
  worker: `### Worker Enforcement