opencode-swarm-plugin 0.16.0 → 0.17.1

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.
@@ -383,7 +383,9 @@ export class SemanticMemoryMandateStorage implements MandateStorage {
383
383
  async update(id: string, updates: Partial<MandateEntry>): Promise<void> {
384
384
  const existing = await this.get(id);
385
385
  if (!existing) {
386
- throw new Error(`Mandate ${id} not found`);
386
+ throw new Error(
387
+ `Mandate '${id}' not found. Use list() to see available mandates.`,
388
+ );
387
389
  }
388
390
 
389
391
  const updated = { ...existing, ...updates };
@@ -399,7 +401,7 @@ export class SemanticMemoryMandateStorage implements MandateStorage {
399
401
  const existing = await this.hasVoted(vote.mandate_id, vote.agent_name);
400
402
  if (existing) {
401
403
  throw new Error(
402
- `Agent ${vote.agent_name} has already voted on mandate ${vote.mandate_id}`,
404
+ `Agent '${vote.agent_name}' has already voted on mandate '${vote.mandate_id}'. Each agent can vote once per mandate to ensure fair consensus.`,
403
405
  );
404
406
  }
405
407
 
@@ -540,7 +542,9 @@ export class InMemoryMandateStorage implements MandateStorage {
540
542
  async update(id: string, updates: Partial<MandateEntry>): Promise<void> {
541
543
  const existing = await this.get(id);
542
544
  if (!existing) {
543
- throw new Error(`Mandate ${id} not found`);
545
+ throw new Error(
546
+ `Mandate '${id}' not found. Use list() to see available mandates.`,
547
+ );
544
548
  }
545
549
 
546
550
  const updated = { ...existing, ...updates };
@@ -553,7 +557,7 @@ export class InMemoryMandateStorage implements MandateStorage {
553
557
  const existing = await this.hasVoted(vote.mandate_id, vote.agent_name);
554
558
  if (existing) {
555
559
  throw new Error(
556
- `Agent ${vote.agent_name} has already voted on mandate ${vote.mandate_id}`,
560
+ `Agent '${vote.agent_name}' has already voted on mandate '${vote.mandate_id}'. Each agent can vote once per mandate to ensure fair consensus.`,
557
561
  );
558
562
  }
559
563
 
@@ -662,7 +666,9 @@ export function createMandateStorage(
662
666
  case "memory":
663
667
  return new InMemoryMandateStorage(fullConfig);
664
668
  default:
665
- throw new Error(`Unknown storage backend: ${fullConfig.backend}`);
669
+ throw new Error(
670
+ `Unknown storage backend: '${fullConfig.backend}'. Valid backends are 'semantic-memory' or 'memory'.`,
671
+ );
666
672
  }
667
673
  }
668
674
 
@@ -689,7 +695,9 @@ export async function updateMandateStatus(
689
695
  ): Promise<ScoreCalculationResult> {
690
696
  const entry = await storage.get(mandateId);
691
697
  if (!entry) {
692
- throw new Error(`Mandate ${mandateId} not found`);
698
+ throw new Error(
699
+ `Mandate '${mandateId}' not found when calculating score. Use storage.list() to verify the mandate exists.`,
700
+ );
693
701
  }
694
702
 
695
703
  const score = await storage.calculateScore(mandateId);
package/src/mandates.ts CHANGED
@@ -177,7 +177,7 @@ export const mandate_vote = tool({
177
177
  const mandate = await storage.get(validated.mandate_id);
178
178
  if (!mandate) {
179
179
  throw new MandateError(
180
- `Mandate ${validated.mandate_id} not found`,
180
+ `Mandate '${validated.mandate_id}' not found. Use mandate_list() to see available mandates, or check the ID is correct.`,
181
181
  "mandate_vote",
182
182
  );
183
183
  }
@@ -189,7 +189,7 @@ export const mandate_vote = tool({
189
189
  );
190
190
  if (hasVoted) {
191
191
  throw new MandateError(
192
- `Agent ${args.agent_name} has already voted on mandate ${validated.mandate_id}`,
192
+ `Agent '${args.agent_name}' has already voted on mandate '${validated.mandate_id}'. Each agent can vote once per mandate. This is expected behavior to prevent vote manipulation.`,
193
193
  "mandate_vote",
194
194
  );
195
195
  }
@@ -447,7 +447,7 @@ export const mandate_stats = tool({
447
447
  const mandate = await storage.get(args.mandate_id);
448
448
  if (!mandate) {
449
449
  throw new MandateError(
450
- `Mandate ${args.mandate_id} not found`,
450
+ `Mandate '${args.mandate_id}' not found. Use mandate_list() to see available mandates, or check the ID is correct.`,
451
451
  "mandate_stats",
452
452
  );
453
453
  }
package/src/swarm.ts CHANGED
@@ -2039,7 +2039,9 @@ async function runVerificationGate(
2039
2039
 
2040
2040
  if (!ubsStep.passed) {
2041
2041
  ubsStep.error = `Found ${ubsResult.summary.critical} critical bugs`;
2042
- blockers.push(`UBS: ${ubsResult.summary.critical} critical bugs found`);
2042
+ blockers.push(
2043
+ `UBS found ${ubsResult.summary.critical} critical bug(s). Try: Run 'ubs scan ${filesTouched.join(" ")}' to see details, fix critical bugs in reported files, or use skip_ubs_scan=true to bypass (not recommended).`,
2044
+ );
2043
2045
  }
2044
2046
 
2045
2047
  steps.push(ubsStep);
@@ -2060,7 +2062,7 @@ async function runVerificationGate(
2060
2062
  steps.push(typecheckStep);
2061
2063
  if (!typecheckStep.passed && !typecheckStep.skipped) {
2062
2064
  blockers.push(
2063
- `Typecheck: ${typecheckStep.error?.slice(0, 100) || "failed"}`,
2065
+ `Typecheck failed: ${typecheckStep.error?.slice(0, 100) || "type errors found"}. Try: Run 'tsc --noEmit' to see full errors, check tsconfig.json configuration, or fix reported type errors in modified files.`,
2064
2066
  );
2065
2067
  }
2066
2068
 
@@ -2068,7 +2070,9 @@ async function runVerificationGate(
2068
2070
  const testStep = await runTestVerification(filesTouched);
2069
2071
  steps.push(testStep);
2070
2072
  if (!testStep.passed && !testStep.skipped) {
2071
- blockers.push(`Tests: ${testStep.error?.slice(0, 100) || "failed"}`);
2073
+ blockers.push(
2074
+ `Tests failed: ${testStep.error?.slice(0, 100) || "test failures"}. Try: Run 'bun test ${testStep.command.split(" ").slice(2).join(" ")}' to see full output, check test assertions, or fix failing tests in modified files.`,
2075
+ );
2072
2076
  }
2073
2077
 
2074
2078
  // Build summary
@@ -2150,10 +2154,12 @@ async function runUbsScan(files: string[]): Promise<UbsScanResult | null> {
2150
2154
  } catch (error) {
2151
2155
  // UBS output wasn't JSON - this is an error condition
2152
2156
  console.error(
2153
- `[swarm] CRITICAL: UBS scan failed to parse JSON output:`,
2157
+ `[swarm] CRITICAL: UBS scan failed to parse JSON output because output is malformed:`,
2154
2158
  error,
2155
2159
  );
2156
- console.error(`[swarm] Raw output:`, output);
2160
+ console.error(
2161
+ `[swarm] Raw output: ${output}. Try: Run 'ubs doctor' to check installation, verify UBS version with 'ubs --version' (need v1.0.0+), or check if UBS supports --json flag.`,
2162
+ );
2157
2163
  return {
2158
2164
  exitCode: result.exitCode,
2159
2165
  bugs: [],
@@ -2320,7 +2326,10 @@ export const swarm_complete = tool({
2320
2326
  error: s.error?.slice(0, 200),
2321
2327
  })),
2322
2328
  },
2323
- hint: "Fix the failing checks and try again. Use skip_verification=true only as last resort.",
2329
+ hint:
2330
+ verificationResult.blockers.length > 0
2331
+ ? `Fix these issues: ${verificationResult.blockers.map((b, i) => `${i + 1}. ${b}`).join(", ")}. Use skip_verification=true only as last resort.`
2332
+ : "Fix the failing checks and try again. Use skip_verification=true only as last resort.",
2324
2333
  gate_function:
2325
2334
  "IDENTIFY → RUN → READ → VERIFY → CLAIM (you are at VERIFY, claim blocked)",
2326
2335
  },
@@ -2345,12 +2354,18 @@ export const swarm_complete = tool({
2345
2354
  return JSON.stringify(
2346
2355
  {
2347
2356
  success: false,
2348
- error: "UBS found critical bugs - fix before completing",
2357
+ error: `UBS found ${ubsResult.summary.critical} critical bug(s) that must be fixed before completing`,
2349
2358
  ubs_scan: {
2350
2359
  critical_count: ubsResult.summary.critical,
2351
2360
  bugs: ubsResult.bugs.filter((b) => b.severity === "critical"),
2352
2361
  },
2353
- hint: "Fix the critical bugs and try again, or use skip_ubs_scan=true to bypass",
2362
+ hint: `Fix these critical bugs: ${ubsResult.bugs
2363
+ .filter((b) => b.severity === "critical")
2364
+ .map((b) => `${b.file}:${b.line} - ${b.message}`)
2365
+ .slice(0, 3)
2366
+ .join(
2367
+ "; ",
2368
+ )}. Try: Run 'ubs scan ${args.files_touched?.join(" ") || "."} --json' for full report, fix reported issues, or use skip_ubs_scan=true to bypass (not recommended).`,
2354
2369
  },
2355
2370
  null,
2356
2371
  2,
@@ -2398,7 +2413,7 @@ export const swarm_complete = tool({
2398
2413
 
2399
2414
  if (closeResult.exitCode !== 0) {
2400
2415
  throw new SwarmError(
2401
- `Failed to close bead: ${closeResult.stderr.toString()}`,
2416
+ `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.`,
2402
2417
  "complete",
2403
2418
  );
2404
2419
  }