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.
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/commands/swarm.md +714 -16
- package/claude-plugin/dist/index.js +380 -262
- package/claude-plugin/dist/utils/adapter-cache.d.ts +36 -0
- package/claude-plugin/dist/utils/adapter-cache.d.ts.map +1 -0
- package/claude-plugin/dist/utils/event-utils.d.ts +31 -0
- package/claude-plugin/dist/utils/event-utils.d.ts.map +1 -0
- package/claude-plugin/skills/swarm-coordination/SKILL.md +42 -8
- package/dist/bin/swarm.js +783 -596
- package/dist/cass-tools.d.ts.map +1 -1
- package/dist/hive.d.ts.map +1 -1
- package/dist/hive.js +75 -97
- package/dist/hivemind-tools.d.ts.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +396 -295
- package/dist/marketplace/index.js +380 -262
- package/dist/memory-tools.d.ts.map +1 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/plugin.js +395 -293
- package/dist/swarm-mail.d.ts +2 -2
- package/dist/swarm-mail.d.ts.map +1 -1
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts +1 -1
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm-prompts.js +347 -259
- package/dist/swarm-verify.d.ts +100 -0
- package/dist/swarm-verify.d.ts.map +1 -0
- package/dist/swarm.d.ts +13 -1
- package/dist/swarm.d.ts.map +1 -1
- package/dist/utils/adapter-cache.d.ts +36 -0
- package/dist/utils/adapter-cache.d.ts.map +1 -0
- package/dist/utils/event-utils.d.ts +31 -0
- package/dist/utils/event-utils.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -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"}
|
|
@@ -17,14 +17,19 @@ related_skills:
|
|
|
17
17
|
|
|
18
18
|
This skill guides multi-agent coordination for OpenCode swarm workflows.
|
|
19
19
|
|
|
20
|
-
## When to
|
|
20
|
+
## When to Swarm
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
- Parallelizable work (frontend/backend/tests)
|
|
24
|
-
- Work requiring specialized agents
|
|
25
|
-
- Time-to-completion matters
|
|
22
|
+
**Always swarm when `/swarm` is invoked.** The user's explicit invocation overrides any heuristics.
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
Swarming serves multiple purposes beyond parallelization:
|
|
25
|
+
- **Context preservation** - workers offload work from coordinator
|
|
26
|
+
- **Session resilience** - workers persist if coordinator compacts
|
|
27
|
+
- **Progress tracking** - hive cells track completion state
|
|
28
|
+
- **Learning capture** - hivemind stores discoveries per subtask
|
|
29
|
+
|
|
30
|
+
Even small tasks (1-2 files) benefit from swarming when context is precious.
|
|
31
|
+
|
|
32
|
+
For sequential work, use dependencies between subtasks rather than refusing to swarm.
|
|
28
33
|
|
|
29
34
|
## Tool Access (Wildcard)
|
|
30
35
|
|
|
@@ -44,18 +49,47 @@ Claude Code auto-launches MCP servers from `mcpServers` configuration. Do **not*
|
|
|
44
49
|
## Coordinator Protocol (High-Level)
|
|
45
50
|
|
|
46
51
|
1. Initialize Swarm Mail (`swarmmail_init`).
|
|
47
|
-
2. Query past learnings (`hivemind_find`).
|
|
52
|
+
2. **Query past learnings** (`hivemind_find`) - MANDATORY before decomposition.
|
|
48
53
|
3. Decompose (`swarm_plan_prompt` + `swarm_validate_decomposition`).
|
|
49
54
|
4. Spawn workers with explicit file lists.
|
|
50
55
|
5. Review worker output (`swarm_review` + `swarm_review_feedback`).
|
|
51
56
|
6. Record outcomes (`swarm_complete`).
|
|
57
|
+
7. **Store learnings** (`hivemind_store`) - MANDATORY after swarm completion.
|
|
52
58
|
|
|
53
59
|
## Worker Protocol (High-Level)
|
|
54
60
|
|
|
55
61
|
1. Initialize Swarm Mail (`swarmmail_init`).
|
|
56
62
|
2. Reserve files (`swarmmail_reserve`).
|
|
57
63
|
3. Work within scope and report progress.
|
|
58
|
-
4.
|
|
64
|
+
4. **Store discoveries** (`hivemind_store`) - any gotchas, patterns, or decisions made.
|
|
65
|
+
5. Complete with `swarm_complete`.
|
|
66
|
+
|
|
67
|
+
## Hivemind Usage (MANDATORY)
|
|
68
|
+
|
|
69
|
+
Agents MUST use hivemind to build collective memory:
|
|
70
|
+
|
|
71
|
+
**Before work:**
|
|
72
|
+
```
|
|
73
|
+
hivemind_find({ query: "relevant topic or codebase pattern" })
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**During work (when discovering something):**
|
|
77
|
+
```
|
|
78
|
+
hivemind_store({
|
|
79
|
+
information: "The auth module requires X before Y",
|
|
80
|
+
tags: "auth,gotcha,codebase-name"
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**After work:**
|
|
85
|
+
```
|
|
86
|
+
hivemind_store({
|
|
87
|
+
information: "Completed task X. Key learnings: ...",
|
|
88
|
+
tags: "swarm,completion,epic-id"
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Store liberally. Memory is cheap; re-discovering gotchas is expensive.
|
|
59
93
|
|
|
60
94
|
## File Reservations
|
|
61
95
|
|