opencode-swarm-plugin 0.30.6 → 0.31.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.
@@ -1426,7 +1426,7 @@ describe("Swarm Prompt V2 (with Swarm Mail/Beads)", () => {
1426
1426
  expect(SUBTASK_PROMPT_V2).toContain("semantic-memory_find");
1427
1427
  expect(SUBTASK_PROMPT_V2).toContain("Query Past Learnings");
1428
1428
  expect(SUBTASK_PROMPT_V2).toContain("BEFORE starting work");
1429
- expect(SUBTASK_PROMPT_V2).toContain("Past learnings save time");
1429
+ expect(SUBTASK_PROMPT_V2).toContain("If you skip this step, you WILL waste time solving already-solved problems");
1430
1430
  });
1431
1431
 
1432
1432
  it("contains survival checklist: skills discovery and loading", () => {
@@ -1465,9 +1465,9 @@ describe("Swarm Prompt V2 (with Swarm Mail/Beads)", () => {
1465
1465
  it("contains survival checklist: semantic-memory_store for learnings", () => {
1466
1466
  // Step 8: Store discoveries and learnings
1467
1467
  expect(SUBTASK_PROMPT_V2).toContain("semantic-memory_store");
1468
- expect(SUBTASK_PROMPT_V2).toContain("Store Learnings");
1469
- expect(SUBTASK_PROMPT_V2).toContain("Tricky bugs you solved");
1470
- expect(SUBTASK_PROMPT_V2).toContain("Store the WHY, not just the WHAT");
1468
+ expect(SUBTASK_PROMPT_V2).toContain("STORE YOUR LEARNINGS");
1469
+ expect(SUBTASK_PROMPT_V2).toContain("Solved a tricky bug");
1470
+ expect(SUBTASK_PROMPT_V2).toContain("The WHY matters more than the WHAT");
1471
1471
  });
1472
1472
 
1473
1473
  it("does NOT mention coordinator reserving files", () => {
@@ -2341,4 +2341,74 @@ describe("Contract Validation", () => {
2341
2341
  expect(parsed.error).toBeUndefined();
2342
2342
  });
2343
2343
  });
2344
+
2345
+ describe("swarm_complete auto-sync", () => {
2346
+ it("calls hive_sync after closing cell on successful completion", async () => {
2347
+ const testProjectPath = "/tmp/swarm-auto-sync-test-" + Date.now();
2348
+ const { getHiveAdapter } = await import("./hive");
2349
+ const adapter = await getHiveAdapter(testProjectPath);
2350
+
2351
+ // Create a task cell directly
2352
+ const cell = await adapter.createCell(testProjectPath, {
2353
+ title: "Test task for auto-sync",
2354
+ type: "task",
2355
+ priority: 2,
2356
+ });
2357
+
2358
+ // Start the task
2359
+ await adapter.updateCell(testProjectPath, cell.id, {
2360
+ status: "in_progress",
2361
+ });
2362
+
2363
+ // Complete with skip_review and skip_verification
2364
+ const result = await swarm_complete.execute(
2365
+ {
2366
+ project_key: testProjectPath,
2367
+ agent_name: "TestAgent",
2368
+ bead_id: cell.id,
2369
+ summary: "Done - testing auto-sync",
2370
+ files_touched: [],
2371
+ skip_verification: true,
2372
+ skip_review: true,
2373
+ },
2374
+ mockContext,
2375
+ );
2376
+
2377
+ const parsed = JSON.parse(result);
2378
+
2379
+ // Should complete successfully
2380
+ expect(parsed.success).toBe(true);
2381
+ expect(parsed.closed).toBe(true);
2382
+
2383
+ // Check that cell is actually closed in database
2384
+ const closedCell = await adapter.getCell(testProjectPath, cell.id);
2385
+ expect(closedCell?.status).toBe("closed");
2386
+
2387
+ // The sync should have flushed the cell to .hive/issues.jsonl
2388
+ // We can verify the cell appears in the JSONL
2389
+ const hivePath = `${testProjectPath}/.hive/issues.jsonl`;
2390
+ const hiveFile = Bun.file(hivePath);
2391
+ const exists = await hiveFile.exists();
2392
+
2393
+ // The file should exist after sync
2394
+ expect(exists).toBe(true);
2395
+
2396
+ if (exists) {
2397
+ const content = await hiveFile.text();
2398
+ const lines = content.trim().split("\n");
2399
+
2400
+ // Should have at least one cell exported
2401
+ expect(lines.length).toBeGreaterThan(0);
2402
+
2403
+ // Parse the exported cells to find our closed cell
2404
+ const cells = lines.map((line) => JSON.parse(line));
2405
+ const exportedCell = cells.find((c) => c.id === cell.id);
2406
+
2407
+ // Our cell should be in the export
2408
+ expect(exportedCell).toBeDefined();
2409
+ expect(exportedCell.status).toBe("closed");
2410
+ expect(exportedCell.title).toBe("Test task for auto-sync");
2411
+ }
2412
+ });
2413
+ });
2344
2414
  });