opencode-swarm-plugin 0.28.2 → 0.29.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +62 -0
- package/dist/compaction-hook.d.ts +20 -2
- package/dist/compaction-hook.d.ts.map +1 -1
- package/dist/index.js +174 -71
- package/dist/plugin.js +63 -62
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/tool-availability.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/compaction-hook.test.ts +110 -0
- package/src/compaction-hook.ts +183 -29
- package/src/learning.integration.test.ts +11 -3
- package/src/swarm-orchestrate.ts +76 -79
- package/src/swarm.integration.test.ts +88 -2
- package/src/tool-availability.ts +6 -24
|
@@ -1085,7 +1085,7 @@ describe("Tool Availability", () => {
|
|
|
1085
1085
|
|
|
1086
1086
|
it("checks all tools at once", async () => {
|
|
1087
1087
|
const availability = await checkAllTools();
|
|
1088
|
-
expect(availability.size).toBe(
|
|
1088
|
+
expect(availability.size).toBe(7); // semantic-memory, cass, ubs, hive, beads, swarm-mail, agent-mail
|
|
1089
1089
|
expect(availability.has("semantic-memory")).toBe(true);
|
|
1090
1090
|
expect(availability.has("cass")).toBe(true);
|
|
1091
1091
|
expect(availability.has("ubs")).toBe(true);
|
|
@@ -1420,7 +1420,7 @@ describe("Swarm Prompt V2 (with Swarm Mail/Beads)", () => {
|
|
|
1420
1420
|
it("enforces swarm_complete over manual hive_close", () => {
|
|
1421
1421
|
// Step 9: Use swarm_complete, not hive_close
|
|
1422
1422
|
expect(SUBTASK_PROMPT_V2).toContain("swarm_complete");
|
|
1423
|
-
expect(SUBTASK_PROMPT_V2).toContain("DO NOT manually close the
|
|
1423
|
+
expect(SUBTASK_PROMPT_V2).toContain("DO NOT manually close the cell");
|
|
1424
1424
|
expect(SUBTASK_PROMPT_V2).toContain("Use swarm_complete");
|
|
1425
1425
|
});
|
|
1426
1426
|
});
|
|
@@ -1583,6 +1583,92 @@ describe("Swarm Prompt V2 (with Swarm Mail/Beads)", () => {
|
|
|
1583
1583
|
},
|
|
1584
1584
|
);
|
|
1585
1585
|
|
|
1586
|
+
it.skipIf(!beadsAvailable)(
|
|
1587
|
+
"returns specific error message when bead_id not found",
|
|
1588
|
+
async () => {
|
|
1589
|
+
// Try to complete with a non-existent bead ID
|
|
1590
|
+
const result = await swarm_complete.execute(
|
|
1591
|
+
{
|
|
1592
|
+
project_key: "/tmp/test-bead-not-found",
|
|
1593
|
+
agent_name: "test-agent",
|
|
1594
|
+
bead_id: "bd-totally-fake-xyz123",
|
|
1595
|
+
summary: "This should fail with specific error",
|
|
1596
|
+
skip_verification: true,
|
|
1597
|
+
},
|
|
1598
|
+
mockContext,
|
|
1599
|
+
);
|
|
1600
|
+
|
|
1601
|
+
const parsed = JSON.parse(result);
|
|
1602
|
+
|
|
1603
|
+
// Should return structured error with specific message
|
|
1604
|
+
expect(parsed.success).toBe(false);
|
|
1605
|
+
expect(parsed.error).toBeDefined();
|
|
1606
|
+
// RED: This will fail - we currently get generic "Tool execution failed"
|
|
1607
|
+
// We want the error message to specifically mention the bead was not found
|
|
1608
|
+
expect(
|
|
1609
|
+
parsed.error.toLowerCase().includes("bead not found") ||
|
|
1610
|
+
parsed.error.toLowerCase().includes("not found"),
|
|
1611
|
+
).toBe(true);
|
|
1612
|
+
expect(parsed.bead_id).toBe("bd-totally-fake-xyz123");
|
|
1613
|
+
},
|
|
1614
|
+
);
|
|
1615
|
+
|
|
1616
|
+
it.skipIf(!beadsAvailable)(
|
|
1617
|
+
"returns specific error when project_key is invalid/mismatched",
|
|
1618
|
+
async () => {
|
|
1619
|
+
// Create a real bead first
|
|
1620
|
+
const createResult =
|
|
1621
|
+
await Bun.$`bd create "Test project mismatch" -t task --json`
|
|
1622
|
+
.quiet()
|
|
1623
|
+
.nothrow();
|
|
1624
|
+
|
|
1625
|
+
if (createResult.exitCode !== 0) {
|
|
1626
|
+
console.warn(
|
|
1627
|
+
"Could not create bead:",
|
|
1628
|
+
createResult.stderr.toString(),
|
|
1629
|
+
);
|
|
1630
|
+
return;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
const bead = JSON.parse(createResult.stdout.toString());
|
|
1634
|
+
|
|
1635
|
+
try {
|
|
1636
|
+
// Try to complete with mismatched project_key
|
|
1637
|
+
const result = await swarm_complete.execute(
|
|
1638
|
+
{
|
|
1639
|
+
project_key: "/totally/wrong/project/path",
|
|
1640
|
+
agent_name: "test-agent",
|
|
1641
|
+
bead_id: bead.id,
|
|
1642
|
+
summary: "This should fail with project mismatch",
|
|
1643
|
+
skip_verification: true,
|
|
1644
|
+
},
|
|
1645
|
+
mockContext,
|
|
1646
|
+
);
|
|
1647
|
+
|
|
1648
|
+
const parsed = JSON.parse(result);
|
|
1649
|
+
|
|
1650
|
+
// Should return structured error with specific message about project mismatch
|
|
1651
|
+
expect(parsed.success).toBe(false);
|
|
1652
|
+
expect(parsed.error).toBeDefined();
|
|
1653
|
+
// RED: This will fail - we want specific validation error
|
|
1654
|
+
// Error should mention project mismatch or validation failure
|
|
1655
|
+
const errorLower = parsed.error.toLowerCase();
|
|
1656
|
+
expect(
|
|
1657
|
+
(errorLower.includes("project") &&
|
|
1658
|
+
(errorLower.includes("mismatch") ||
|
|
1659
|
+
errorLower.includes("invalid") ||
|
|
1660
|
+
errorLower.includes("not found"))) ||
|
|
1661
|
+
errorLower.includes("validation"),
|
|
1662
|
+
).toBe(true);
|
|
1663
|
+
} finally {
|
|
1664
|
+
// Clean up
|
|
1665
|
+
await Bun.$`bd close ${bead.id} --reason "Test cleanup"`
|
|
1666
|
+
.quiet()
|
|
1667
|
+
.nothrow();
|
|
1668
|
+
}
|
|
1669
|
+
},
|
|
1670
|
+
);
|
|
1671
|
+
|
|
1586
1672
|
it.skipIf(!beadsAvailable)(
|
|
1587
1673
|
"includes message_sent status in response",
|
|
1588
1674
|
async () => {
|
package/src/tool-availability.ts
CHANGED
|
@@ -214,31 +214,13 @@ const toolCheckers: Record<ToolName, () => Promise<ToolStatus>> = {
|
|
|
214
214
|
},
|
|
215
215
|
|
|
216
216
|
// DEPRECATED: Use hive instead
|
|
217
|
-
//
|
|
217
|
+
// bd CLI is deprecated - always return false, use HiveAdapter instead
|
|
218
218
|
beads: async () => {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
error: "bd command not found",
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
try {
|
|
229
|
-
// Just check if bd can run - don't require a repo
|
|
230
|
-
const result = await Bun.$`bd --version`.quiet().nothrow();
|
|
231
|
-
return {
|
|
232
|
-
available: result.exitCode === 0,
|
|
233
|
-
checkedAt: new Date().toISOString(),
|
|
234
|
-
};
|
|
235
|
-
} catch (e) {
|
|
236
|
-
return {
|
|
237
|
-
available: false,
|
|
238
|
-
checkedAt: new Date().toISOString(),
|
|
239
|
-
error: String(e),
|
|
240
|
-
};
|
|
241
|
-
}
|
|
219
|
+
return {
|
|
220
|
+
available: false,
|
|
221
|
+
checkedAt: new Date().toISOString(),
|
|
222
|
+
error: "bd CLI is deprecated - use hive_* tools with HiveAdapter instead",
|
|
223
|
+
};
|
|
242
224
|
},
|
|
243
225
|
|
|
244
226
|
"swarm-mail": async () => {
|