opencode-swarm-plugin 0.23.4 → 0.23.6

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.
@@ -1,9 +1,9 @@
1
1
  $ bun build ./src/index.ts --outdir ./dist --target node --external @electric-sql/pglite --external swarm-mail && bun build ./src/plugin.ts --outfile ./dist/plugin.js --target node --external @electric-sql/pglite --external swarm-mail && tsc
2
- Bundled 195 modules in 33ms
2
+ Bundled 195 modules in 36ms
3
3
 
4
4
  index.js 1.14 MB (entry point)
5
5
 
6
- Bundled 196 modules in 31ms
6
+ Bundled 196 modules in 34ms
7
7
 
8
8
  plugin.js 1.12 MB (entry point)
9
9
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # opencode-swarm-plugin
2
2
 
3
+ ## 0.23.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`22befbf`](https://github.com/joelhooks/opencode-swarm-plugin/commit/22befbfa120a37a585cfec0709597172efda92a4)]:
8
+ - swarm-mail@0.1.3
9
+
10
+ ## 0.23.5
11
+
12
+ ### Patch Changes
13
+
14
+ - [`3826c6d`](https://github.com/joelhooks/opencode-swarm-plugin/commit/3826c6d887f937ccb201b7c4322cbc7b46823658) Thanks [@joelhooks](https://github.com/joelhooks)! - Fix workspace:\* resolution by running bun install before pack
15
+
16
+ The lockfile was stale, causing bun pack to resolve workspace:\* to old versions.
17
+ Now runs bun install first to ensure lockfile matches current package.json versions.
18
+
3
19
  ## 0.23.4
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -12675,7 +12675,7 @@ var init_zod = __esm(() => {
12675
12675
  init_external();
12676
12676
  });
12677
12677
 
12678
- // ../../node_modules/.bun/@opencode-ai+plugin@1.0.134/node_modules/@opencode-ai/plugin/dist/tool.js
12678
+ // ../../node_modules/.bun/@opencode-ai+plugin@1.0.153/node_modules/@opencode-ai/plugin/dist/tool.js
12679
12679
  function tool(input) {
12680
12680
  return input;
12681
12681
  }
@@ -12684,7 +12684,7 @@ var init_tool = __esm(() => {
12684
12684
  tool.schema = exports_external;
12685
12685
  });
12686
12686
 
12687
- // ../../node_modules/.bun/@opencode-ai+plugin@1.0.134/node_modules/@opencode-ai/plugin/dist/index.js
12687
+ // ../../node_modules/.bun/@opencode-ai+plugin@1.0.153/node_modules/@opencode-ai/plugin/dist/index.js
12688
12688
  var init_dist = __esm(() => {
12689
12689
  init_tool();
12690
12690
  });
@@ -31853,7 +31853,23 @@ Continuing with completion, but this should be fixed for future subtasks.`;
31853
31853
  }
31854
31854
  const closeResult = await Bun.$`bd close ${args.bead_id} --reason ${args.summary} --json`.quiet().nothrow();
31855
31855
  if (closeResult.exitCode !== 0) {
31856
- throw new Error(`Failed to close bead because bd close command failed: ${closeResult.stderr.toString()}. Try: Verify bead exists and is not already closed with 'bd show ${args.bead_id}', check if bead ID is correct with 'beads_query()', or use beads_close tool directly.`);
31856
+ const stderrOutput = closeResult.stderr.toString().trim();
31857
+ return JSON.stringify({
31858
+ success: false,
31859
+ error: "Failed to close bead",
31860
+ failed_step: "bd close",
31861
+ details: stderrOutput || "Unknown error from bd close command",
31862
+ bead_id: args.bead_id,
31863
+ recovery: {
31864
+ steps: [
31865
+ `1. Check bead exists: bd show ${args.bead_id}`,
31866
+ `2. Check bead status (might already be closed): beads_query()`,
31867
+ `3. If bead is blocked, unblock first: beads_update(id="${args.bead_id}", status="in_progress")`,
31868
+ `4. Try closing directly: beads_close(id="${args.bead_id}", reason="...")`
31869
+ ],
31870
+ hint: "If bead is in 'blocked' status, you must change it to 'in_progress' or 'open' before closing."
31871
+ }
31872
+ }, null, 2);
31857
31873
  }
31858
31874
  try {
31859
31875
  const epicId3 = args.bead_id.includes(".") ? args.bead_id.split(".")[0] : args.bead_id;
@@ -32026,6 +32042,7 @@ ${errorStack.slice(0, 1000)}
32026
32042
  "4. Retry swarm_complete after fixing"
32027
32043
  ].filter(Boolean).join(`
32028
32044
  `);
32045
+ let notificationSent = false;
32029
32046
  try {
32030
32047
  await sendSwarmMessage2({
32031
32048
  projectPath: args.project_key,
@@ -32036,11 +32053,40 @@ ${errorStack.slice(0, 1000)}
32036
32053
  threadId: epicId,
32037
32054
  importance: "urgent"
32038
32055
  });
32056
+ notificationSent = true;
32039
32057
  } catch (mailError) {
32040
32058
  console.error(`[swarm_complete] CRITICAL: Failed to notify coordinator of failure for ${args.bead_id}:`, mailError);
32041
32059
  console.error(`[swarm_complete] Original error:`, error45);
32042
32060
  }
32043
- throw error45;
32061
+ return JSON.stringify({
32062
+ success: false,
32063
+ error: errorMessage,
32064
+ failed_step: failedStep,
32065
+ bead_id: args.bead_id,
32066
+ agent_name: args.agent_name,
32067
+ coordinator_notified: notificationSent,
32068
+ stack_trace: errorStack?.slice(0, 500),
32069
+ context: {
32070
+ summary: args.summary,
32071
+ files_touched: args.files_touched || [],
32072
+ skip_ubs_scan: args.skip_ubs_scan ?? false,
32073
+ skip_verification: args.skip_verification ?? false
32074
+ },
32075
+ recovery: {
32076
+ steps: [
32077
+ "1. Check the error message above for specific issue",
32078
+ `2. Review failed step: ${failedStep}`,
32079
+ "3. Fix underlying issue or use skip flags if appropriate",
32080
+ "4. Retry swarm_complete after fixing"
32081
+ ],
32082
+ common_fixes: {
32083
+ "Verification Gate": "Use skip_verification=true to bypass (not recommended)",
32084
+ "UBS scan": "Use skip_ubs_scan=true to bypass",
32085
+ "Bead close": "Check bead status with beads_query(), may need beads_update() first",
32086
+ "Self-evaluation": "Check evaluation JSON format matches EvaluationSchema"
32087
+ }
32088
+ }
32089
+ }, null, 2);
32044
32090
  }
32045
32091
  }
32046
32092
  });
package/dist/plugin.js CHANGED
@@ -12675,7 +12675,7 @@ var init_zod = __esm(() => {
12675
12675
  init_external();
12676
12676
  });
12677
12677
 
12678
- // ../../node_modules/.bun/@opencode-ai+plugin@1.0.134/node_modules/@opencode-ai/plugin/dist/tool.js
12678
+ // ../../node_modules/.bun/@opencode-ai+plugin@1.0.153/node_modules/@opencode-ai/plugin/dist/tool.js
12679
12679
  function tool(input) {
12680
12680
  return input;
12681
12681
  }
@@ -12684,7 +12684,7 @@ var init_tool = __esm(() => {
12684
12684
  tool.schema = exports_external;
12685
12685
  });
12686
12686
 
12687
- // ../../node_modules/.bun/@opencode-ai+plugin@1.0.134/node_modules/@opencode-ai/plugin/dist/index.js
12687
+ // ../../node_modules/.bun/@opencode-ai+plugin@1.0.153/node_modules/@opencode-ai/plugin/dist/index.js
12688
12688
  var init_dist = __esm(() => {
12689
12689
  init_tool();
12690
12690
  });
@@ -31689,7 +31689,23 @@ Continuing with completion, but this should be fixed for future subtasks.`;
31689
31689
  }
31690
31690
  const closeResult = await Bun.$`bd close ${args.bead_id} --reason ${args.summary} --json`.quiet().nothrow();
31691
31691
  if (closeResult.exitCode !== 0) {
31692
- throw new Error(`Failed to close bead because bd close command failed: ${closeResult.stderr.toString()}. Try: Verify bead exists and is not already closed with 'bd show ${args.bead_id}', check if bead ID is correct with 'beads_query()', or use beads_close tool directly.`);
31692
+ const stderrOutput = closeResult.stderr.toString().trim();
31693
+ return JSON.stringify({
31694
+ success: false,
31695
+ error: "Failed to close bead",
31696
+ failed_step: "bd close",
31697
+ details: stderrOutput || "Unknown error from bd close command",
31698
+ bead_id: args.bead_id,
31699
+ recovery: {
31700
+ steps: [
31701
+ `1. Check bead exists: bd show ${args.bead_id}`,
31702
+ `2. Check bead status (might already be closed): beads_query()`,
31703
+ `3. If bead is blocked, unblock first: beads_update(id="${args.bead_id}", status="in_progress")`,
31704
+ `4. Try closing directly: beads_close(id="${args.bead_id}", reason="...")`
31705
+ ],
31706
+ hint: "If bead is in 'blocked' status, you must change it to 'in_progress' or 'open' before closing."
31707
+ }
31708
+ }, null, 2);
31693
31709
  }
31694
31710
  try {
31695
31711
  const epicId3 = args.bead_id.includes(".") ? args.bead_id.split(".")[0] : args.bead_id;
@@ -31862,6 +31878,7 @@ ${errorStack.slice(0, 1000)}
31862
31878
  "4. Retry swarm_complete after fixing"
31863
31879
  ].filter(Boolean).join(`
31864
31880
  `);
31881
+ let notificationSent = false;
31865
31882
  try {
31866
31883
  await sendSwarmMessage2({
31867
31884
  projectPath: args.project_key,
@@ -31872,11 +31889,40 @@ ${errorStack.slice(0, 1000)}
31872
31889
  threadId: epicId,
31873
31890
  importance: "urgent"
31874
31891
  });
31892
+ notificationSent = true;
31875
31893
  } catch (mailError) {
31876
31894
  console.error(`[swarm_complete] CRITICAL: Failed to notify coordinator of failure for ${args.bead_id}:`, mailError);
31877
31895
  console.error(`[swarm_complete] Original error:`, error45);
31878
31896
  }
31879
- throw error45;
31897
+ return JSON.stringify({
31898
+ success: false,
31899
+ error: errorMessage,
31900
+ failed_step: failedStep,
31901
+ bead_id: args.bead_id,
31902
+ agent_name: args.agent_name,
31903
+ coordinator_notified: notificationSent,
31904
+ stack_trace: errorStack?.slice(0, 500),
31905
+ context: {
31906
+ summary: args.summary,
31907
+ files_touched: args.files_touched || [],
31908
+ skip_ubs_scan: args.skip_ubs_scan ?? false,
31909
+ skip_verification: args.skip_verification ?? false
31910
+ },
31911
+ recovery: {
31912
+ steps: [
31913
+ "1. Check the error message above for specific issue",
31914
+ `2. Review failed step: ${failedStep}`,
31915
+ "3. Fix underlying issue or use skip flags if appropriate",
31916
+ "4. Retry swarm_complete after fixing"
31917
+ ],
31918
+ common_fixes: {
31919
+ "Verification Gate": "Use skip_verification=true to bypass (not recommended)",
31920
+ "UBS scan": "Use skip_ubs_scan=true to bypass",
31921
+ "Bead close": "Check bead status with beads_query(), may need beads_update() first",
31922
+ "Self-evaluation": "Check evaluation JSON format matches EvaluationSchema"
31923
+ }
31924
+ }
31925
+ }, null, 2);
31880
31926
  }
31881
31927
  }
31882
31928
  });
@@ -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;AAgi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;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyH3B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CAgGxB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgMtB,CAAC;AAMH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAc5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.23.4",
3
+ "version": "0.23.6",
4
4
  "description": "Multi-agent swarm coordination for OpenCode with learning capabilities, beads integration, and Agent Mail",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "@opencode-ai/plugin": "^1.0.134",
34
34
  "gray-matter": "^4.0.3",
35
35
  "ioredis": "^5.4.1",
36
- "swarm-mail": "0.1.0",
36
+ "swarm-mail": "0.1.3",
37
37
  "zod": "4.1.8"
38
38
  },
39
39
  "devDependencies": {
@@ -1218,8 +1218,26 @@ Continuing with completion, but this should be fixed for future subtasks.`;
1218
1218
  .nothrow();
1219
1219
 
1220
1220
  if (closeResult.exitCode !== 0) {
1221
- throw new Error(
1222
- `Failed to close bead because bd close command failed: ${closeResult.stderr.toString()}. Try: Verify bead exists and is not already closed with 'bd show ${args.bead_id}', check if bead ID is correct with 'beads_query()', or use beads_close tool directly.`,
1221
+ const stderrOutput = closeResult.stderr.toString().trim();
1222
+ return JSON.stringify(
1223
+ {
1224
+ success: false,
1225
+ error: "Failed to close bead",
1226
+ failed_step: "bd close",
1227
+ details: stderrOutput || "Unknown error from bd close command",
1228
+ bead_id: args.bead_id,
1229
+ recovery: {
1230
+ steps: [
1231
+ `1. Check bead exists: bd show ${args.bead_id}`,
1232
+ `2. Check bead status (might already be closed): beads_query()`,
1233
+ `3. If bead is blocked, unblock first: beads_update(id="${args.bead_id}", status="in_progress")`,
1234
+ `4. Try closing directly: beads_close(id="${args.bead_id}", reason="...")`,
1235
+ ],
1236
+ hint: "If bead is in 'blocked' status, you must change it to 'in_progress' or 'open' before closing.",
1237
+ },
1238
+ },
1239
+ null,
1240
+ 2,
1223
1241
  );
1224
1242
  }
1225
1243
 
@@ -1479,6 +1497,7 @@ Files touched: ${args.files_touched?.join(", ") || "none recorded"}`,
1479
1497
  .join("\n");
1480
1498
 
1481
1499
  // Send urgent notification to coordinator
1500
+ let notificationSent = false;
1482
1501
  try {
1483
1502
  await sendSwarmMessage({
1484
1503
  projectPath: args.project_key,
@@ -1489,6 +1508,7 @@ Files touched: ${args.files_touched?.join(", ") || "none recorded"}`,
1489
1508
  threadId: epicId,
1490
1509
  importance: "urgent",
1491
1510
  });
1511
+ notificationSent = true;
1492
1512
  } catch (mailError) {
1493
1513
  // Even swarm mail failed - log to console as last resort
1494
1514
  console.error(
@@ -1498,8 +1518,41 @@ Files touched: ${args.files_touched?.join(", ") || "none recorded"}`,
1498
1518
  console.error(`[swarm_complete] Original error:`, error);
1499
1519
  }
1500
1520
 
1501
- // Re-throw the original error after notifying
1502
- throw error;
1521
+ // Return structured error instead of throwing
1522
+ // This ensures the agent sees the actual error message
1523
+ return JSON.stringify(
1524
+ {
1525
+ success: false,
1526
+ error: errorMessage,
1527
+ failed_step: failedStep,
1528
+ bead_id: args.bead_id,
1529
+ agent_name: args.agent_name,
1530
+ coordinator_notified: notificationSent,
1531
+ stack_trace: errorStack?.slice(0, 500),
1532
+ context: {
1533
+ summary: args.summary,
1534
+ files_touched: args.files_touched || [],
1535
+ skip_ubs_scan: args.skip_ubs_scan ?? false,
1536
+ skip_verification: args.skip_verification ?? false,
1537
+ },
1538
+ recovery: {
1539
+ steps: [
1540
+ "1. Check the error message above for specific issue",
1541
+ `2. Review failed step: ${failedStep}`,
1542
+ "3. Fix underlying issue or use skip flags if appropriate",
1543
+ "4. Retry swarm_complete after fixing",
1544
+ ],
1545
+ common_fixes: {
1546
+ "Verification Gate": "Use skip_verification=true to bypass (not recommended)",
1547
+ "UBS scan": "Use skip_ubs_scan=true to bypass",
1548
+ "Bead close": "Check bead status with beads_query(), may need beads_update() first",
1549
+ "Self-evaluation": "Check evaluation JSON format matches EvaluationSchema",
1550
+ },
1551
+ },
1552
+ },
1553
+ null,
1554
+ 2,
1555
+ );
1503
1556
  }
1504
1557
  },
1505
1558
  });