opencode-swarm-plugin 0.59.0 → 0.59.5

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 (35) hide show
  1. package/claude-plugin/.claude-plugin/plugin.json +1 -1
  2. package/claude-plugin/commands/swarm.md +714 -16
  3. package/claude-plugin/dist/index.js +380 -262
  4. package/claude-plugin/dist/utils/adapter-cache.d.ts +36 -0
  5. package/claude-plugin/dist/utils/adapter-cache.d.ts.map +1 -0
  6. package/claude-plugin/dist/utils/event-utils.d.ts +31 -0
  7. package/claude-plugin/dist/utils/event-utils.d.ts.map +1 -0
  8. package/claude-plugin/skills/swarm-coordination/SKILL.md +42 -8
  9. package/dist/bin/swarm.js +783 -596
  10. package/dist/cass-tools.d.ts.map +1 -1
  11. package/dist/hive.d.ts.map +1 -1
  12. package/dist/hive.js +75 -97
  13. package/dist/hivemind-tools.d.ts.map +1 -1
  14. package/dist/index.d.ts +12 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +396 -295
  17. package/dist/marketplace/index.js +380 -262
  18. package/dist/memory-tools.d.ts.map +1 -1
  19. package/dist/memory.d.ts.map +1 -1
  20. package/dist/plugin.js +395 -293
  21. package/dist/swarm-mail.d.ts +2 -2
  22. package/dist/swarm-mail.d.ts.map +1 -1
  23. package/dist/swarm-orchestrate.d.ts.map +1 -1
  24. package/dist/swarm-prompts.d.ts +1 -1
  25. package/dist/swarm-prompts.d.ts.map +1 -1
  26. package/dist/swarm-prompts.js +347 -259
  27. package/dist/swarm-verify.d.ts +100 -0
  28. package/dist/swarm-verify.d.ts.map +1 -0
  29. package/dist/swarm.d.ts +13 -1
  30. package/dist/swarm.d.ts.map +1 -1
  31. package/dist/utils/adapter-cache.d.ts +36 -0
  32. package/dist/utils/adapter-cache.d.ts.map +1 -0
  33. package/dist/utils/event-utils.d.ts +31 -0
  34. package/dist/utils/event-utils.d.ts.map +1 -0
  35. package/package.json +1 -1
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Swarm Verify Module - Verification gate for worker completions
3
+ *
4
+ * Handles verification logic for swarm workers:
5
+ * - Typecheck verification (tsc --noEmit)
6
+ * - Test verification for touched files
7
+ * - Verification gate orchestration
8
+ *
9
+ * Implements the Gate Function (IDENTIFY → RUN → READ → VERIFY → CLAIM)
10
+ * from the superpowers pattern.
11
+ *
12
+ * @module swarm-verify
13
+ */
14
+ /**
15
+ * Verification Gate result - tracks each verification step
16
+ *
17
+ * Based on the Gate Function from superpowers:
18
+ * 1. IDENTIFY: What command proves this claim?
19
+ * 2. RUN: Execute the FULL command (fresh, complete)
20
+ * 3. READ: Full output, check exit code, count failures
21
+ * 4. VERIFY: Does output confirm the claim?
22
+ * 5. ONLY THEN: Make the claim
23
+ */
24
+ export interface VerificationStep {
25
+ name: string;
26
+ command: string;
27
+ passed: boolean;
28
+ exitCode: number;
29
+ output?: string;
30
+ error?: string;
31
+ skipped?: boolean;
32
+ skipReason?: string;
33
+ }
34
+ export interface VerificationGateResult {
35
+ passed: boolean;
36
+ steps: VerificationStep[];
37
+ summary: string;
38
+ blockers: string[];
39
+ }
40
+ /**
41
+ * Run typecheck verification
42
+ *
43
+ * Attempts to run TypeScript type checking on the project.
44
+ * Falls back gracefully if tsc is not available.
45
+ */
46
+ export declare function runTypecheckVerification(): Promise<VerificationStep>;
47
+ /**
48
+ * Run test verification for specific files
49
+ *
50
+ * Attempts to find and run tests related to the touched files.
51
+ * Uses common test patterns (*.test.ts, *.spec.ts, __tests__/).
52
+ */
53
+ export declare function runTestVerification(filesTouched: string[]): Promise<VerificationStep>;
54
+ /**
55
+ * Run the full Verification Gate
56
+ *
57
+ * Implements the Gate Function (IDENTIFY → RUN → READ → VERIFY → CLAIM):
58
+ * 1. Typecheck
59
+ * 2. Tests for touched files
60
+ *
61
+ * NOTE: Bug scanning was removed in v0.31 - it was slowing down completion
62
+ * without providing proportional value.
63
+ *
64
+ * All steps must pass (or be skipped with valid reason) to proceed.
65
+ */
66
+ export declare function runVerificationGate(filesTouched: string[], _skipUbs?: boolean): Promise<VerificationGateResult>;
67
+ /**
68
+ * Run verification gate for a set of files
69
+ *
70
+ * Delegates to the verification worker to run typecheck and tests.
71
+ * Returns structured verification results.
72
+ */
73
+ export declare const swarm_verify: {
74
+ description: string;
75
+ args: {
76
+ files_touched: import("zod").ZodArray<import("zod").ZodString>;
77
+ skip_verification: import("zod").ZodOptional<import("zod").ZodBoolean>;
78
+ };
79
+ execute(args: {
80
+ files_touched: string[];
81
+ skip_verification?: boolean | undefined;
82
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
83
+ };
84
+ /**
85
+ * Verification tools for plugin registration
86
+ */
87
+ export declare const verificationTools: {
88
+ swarm_verify: {
89
+ description: string;
90
+ args: {
91
+ files_touched: import("zod").ZodArray<import("zod").ZodString>;
92
+ skip_verification: import("zod").ZodOptional<import("zod").ZodBoolean>;
93
+ };
94
+ execute(args: {
95
+ files_touched: string[];
96
+ skip_verification?: boolean | undefined;
97
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
98
+ };
99
+ };
100
+ //# sourceMappingURL=swarm-verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swarm-verify.d.ts","sourceRoot":"","sources":["../src/swarm-verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAMD;;;;;GAKG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAiC1E;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAoE3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EAAE,EACtB,QAAQ,GAAE,OAAe,GACxB,OAAO,CAAC,sBAAsB,CAAC,CAsCjC;AAMD;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;CAsFvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;CAE7B,CAAC"}
package/dist/swarm.d.ts CHANGED
@@ -16,11 +16,23 @@ export * from "./swarm-prompts";
16
16
  export * from "./swarm-orchestrate";
17
17
  export * from "./swarm-research";
18
18
  export * from "./swarm-adversarial-review";
19
+ export * from "./swarm-verify";
19
20
  /**
20
21
  * Combined swarm tools for plugin registration.
21
- * Includes all tools from strategy, decompose, prompt, orchestrate, research, and adversarial-review modules.
22
+ * Includes all tools from strategy, decompose, prompt, orchestrate, research, adversarial-review, and verification modules.
22
23
  */
23
24
  export declare const swarmTools: {
25
+ swarm_verify: {
26
+ description: string;
27
+ args: {
28
+ files_touched: import("zod").ZodArray<import("zod").ZodString>;
29
+ skip_verification: import("zod").ZodOptional<import("zod").ZodBoolean>;
30
+ };
31
+ execute(args: {
32
+ files_touched: string[];
33
+ skip_verification?: boolean | undefined;
34
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
35
+ };
24
36
  swarm_adversarial_review: {
25
37
  description: string;
26
38
  args: {
@@ -1 +1 @@
1
- {"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../src/swarm.ts"],"names":[],"mappings":"AAAA;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQtB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Generic adapter cache for project-scoped singletons
3
+ *
4
+ * Caches expensive adapters (database connections, indexers, etc.)
5
+ * keyed by project path. Ensures one instance per project.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const memoryCache = new AdapterCache<MemoryAdapter>();
10
+ * const adapter = await memoryCache.get(projectPath, async (path) => {
11
+ * const db = await getDatabase(path);
12
+ * return createMemoryAdapter(db);
13
+ * });
14
+ * ```
15
+ */
16
+ export declare class AdapterCache<T> {
17
+ private cached;
18
+ private cachedPath;
19
+ /**
20
+ * Get cached adapter or create new one
21
+ *
22
+ * @param projectPath - Project path to scope the adapter to
23
+ * @param factory - Async factory function to create the adapter
24
+ * @returns Cached or newly created adapter instance
25
+ */
26
+ get(projectPath: string, factory: (path: string) => Promise<T>): Promise<T>;
27
+ /**
28
+ * Clear the cache (useful for testing)
29
+ */
30
+ clear(): void;
31
+ /**
32
+ * Get the currently cached project path
33
+ */
34
+ getCachedPath(): string | null;
35
+ }
36
+ //# sourceMappingURL=adapter-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-cache.d.ts","sourceRoot":"","sources":["../../src/utils/adapter-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAY,CAAC,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,UAAU,CAAuB;IAEzC;;;;;;OAMG;IACG,GAAG,CACR,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACnC,OAAO,CAAC,CAAC,CAAC;IAUb;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;CAG9B"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Event Utilities - Safe event emission for swarm-mail
3
+ *
4
+ * Provides a standardized way to emit events with error handling across all tools.
5
+ * Events are emitted to the swarm-mail event store for observability and learning.
6
+ *
7
+ * Pattern extracted from 21+ identical try-catch blocks across tool files.
8
+ */
9
+ /**
10
+ * Safely emit an event to the swarm-mail event store.
11
+ *
12
+ * Wraps event creation and emission in a try-catch to prevent tool failures
13
+ * from event system issues. Logs warnings on failure but continues execution.
14
+ *
15
+ * @param eventType - The type of event to emit (e.g., "cell_created", "memory_stored")
16
+ * @param data - Event data (project_key is added automatically if not present)
17
+ * @param toolName - Name of the calling tool for logging (e.g., "hive_create", "hivemind_store")
18
+ * @param projectPath - Project path for event storage (defaults to process.cwd())
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * await safeEmitEvent(
23
+ * "cell_created",
24
+ * { cell_id: cell.id, title: "Fix bug" },
25
+ * "hive_create",
26
+ * "/path/to/project"
27
+ * );
28
+ * ```
29
+ */
30
+ export declare function safeEmitEvent(eventType: string, data: Record<string, unknown>, toolName: string, projectPath?: string): Promise<void>;
31
+ //# sourceMappingURL=event-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-utils.d.ts","sourceRoot":"","sources":["../../src/utils/event-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAcf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.59.0",
3
+ "version": "0.59.5",
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",