opencode-swarm-plugin 0.59.1 → 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.
@@ -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"}