opencode-swarm-plugin 0.56.1 → 0.57.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/README.md +21 -0
- package/claude-plugin/agents/background-worker.md +1 -0
- package/claude-plugin/agents/coordinator.md +1 -0
- package/claude-plugin/agents/worker.md +1 -0
- package/claude-plugin/bin/swarm-mcp-server.ts +47 -8
- package/claude-plugin/dist/agent-mail.d.ts +480 -0
- package/claude-plugin/dist/agent-mail.d.ts.map +1 -0
- package/claude-plugin/dist/anti-patterns.d.ts +257 -0
- package/claude-plugin/dist/anti-patterns.d.ts.map +1 -0
- package/claude-plugin/dist/bin/swarm.js +373128 -0
- package/claude-plugin/dist/cass-tools.d.ts +74 -0
- package/claude-plugin/dist/cass-tools.d.ts.map +1 -0
- package/claude-plugin/dist/claude-plugin/claude-plugin-assets.d.ts +10 -0
- package/claude-plugin/dist/claude-plugin/claude-plugin-assets.d.ts.map +1 -0
- package/claude-plugin/dist/compaction-hook.d.ts +178 -0
- package/claude-plugin/dist/compaction-hook.d.ts.map +1 -0
- package/claude-plugin/dist/compaction-observability.d.ts +173 -0
- package/claude-plugin/dist/compaction-observability.d.ts.map +1 -0
- package/claude-plugin/dist/compaction-prompt-scoring.d.ts +125 -0
- package/claude-plugin/dist/compaction-prompt-scoring.d.ts.map +1 -0
- package/claude-plugin/dist/compaction-prompt-scoring.js +139 -0
- package/claude-plugin/dist/contributor-tools.d.ts +42 -0
- package/claude-plugin/dist/contributor-tools.d.ts.map +1 -0
- package/claude-plugin/dist/coordinator-guard.d.ts +79 -0
- package/claude-plugin/dist/coordinator-guard.d.ts.map +1 -0
- package/claude-plugin/dist/dashboard.d.ts +82 -0
- package/claude-plugin/dist/dashboard.d.ts.map +1 -0
- package/claude-plugin/dist/decision-trace-integration.d.ts +204 -0
- package/claude-plugin/dist/decision-trace-integration.d.ts.map +1 -0
- package/claude-plugin/dist/error-enrichment.d.ts +49 -0
- package/claude-plugin/dist/error-enrichment.d.ts.map +1 -0
- package/claude-plugin/dist/eval-capture.d.ts +494 -0
- package/claude-plugin/dist/eval-capture.d.ts.map +1 -0
- package/claude-plugin/dist/eval-capture.js +12844 -0
- package/claude-plugin/dist/eval-gates.d.ts +84 -0
- package/claude-plugin/dist/eval-gates.d.ts.map +1 -0
- package/claude-plugin/dist/eval-history.d.ts +117 -0
- package/claude-plugin/dist/eval-history.d.ts.map +1 -0
- package/claude-plugin/dist/eval-learning.d.ts +216 -0
- package/claude-plugin/dist/eval-learning.d.ts.map +1 -0
- package/claude-plugin/dist/eval-runner.d.ts +134 -0
- package/claude-plugin/dist/eval-runner.d.ts.map +1 -0
- package/claude-plugin/dist/examples/plugin-wrapper-template.ts +3341 -0
- package/claude-plugin/dist/export-tools.d.ts +76 -0
- package/claude-plugin/dist/export-tools.d.ts.map +1 -0
- package/claude-plugin/dist/hive.d.ts +949 -0
- package/claude-plugin/dist/hive.d.ts.map +1 -0
- package/claude-plugin/dist/hive.js +15009 -0
- package/claude-plugin/dist/hivemind-tools.d.ts +479 -0
- package/claude-plugin/dist/hivemind-tools.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/atomic-write.d.ts +21 -0
- package/claude-plugin/dist/hooks/atomic-write.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/constants.d.ts +28 -0
- package/claude-plugin/dist/hooks/constants.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/index.d.ts +16 -0
- package/claude-plugin/dist/hooks/index.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/session-start.d.ts +30 -0
- package/claude-plugin/dist/hooks/session-start.d.ts.map +1 -0
- package/claude-plugin/dist/hooks/tool-complete.d.ts +54 -0
- package/claude-plugin/dist/hooks/tool-complete.d.ts.map +1 -0
- package/claude-plugin/dist/index.d.ts +2017 -0
- package/claude-plugin/dist/index.d.ts.map +1 -0
- package/claude-plugin/dist/index.js +73453 -0
- package/claude-plugin/dist/learning.d.ts +700 -0
- package/claude-plugin/dist/learning.d.ts.map +1 -0
- package/claude-plugin/dist/logger.d.ts +38 -0
- package/claude-plugin/dist/logger.d.ts.map +1 -0
- package/claude-plugin/dist/mandate-promotion.d.ts +93 -0
- package/claude-plugin/dist/mandate-promotion.d.ts.map +1 -0
- package/claude-plugin/dist/mandate-storage.d.ts +209 -0
- package/claude-plugin/dist/mandate-storage.d.ts.map +1 -0
- package/claude-plugin/dist/mandates.d.ts +230 -0
- package/claude-plugin/dist/mandates.d.ts.map +1 -0
- package/claude-plugin/dist/memory-tools.d.ts +281 -0
- package/claude-plugin/dist/memory-tools.d.ts.map +1 -0
- package/claude-plugin/dist/memory.d.ts +164 -0
- package/claude-plugin/dist/memory.d.ts.map +1 -0
- package/claude-plugin/dist/model-selection.d.ts +37 -0
- package/claude-plugin/dist/model-selection.d.ts.map +1 -0
- package/claude-plugin/dist/observability-health.d.ts +87 -0
- package/claude-plugin/dist/observability-health.d.ts.map +1 -0
- package/claude-plugin/dist/observability-tools.d.ts +184 -0
- package/claude-plugin/dist/observability-tools.d.ts.map +1 -0
- package/claude-plugin/dist/output-guardrails.d.ts +125 -0
- package/claude-plugin/dist/output-guardrails.d.ts.map +1 -0
- package/claude-plugin/dist/pattern-maturity.d.ts +246 -0
- package/claude-plugin/dist/pattern-maturity.d.ts.map +1 -0
- package/claude-plugin/dist/planning-guardrails.d.ts +183 -0
- package/claude-plugin/dist/planning-guardrails.d.ts.map +1 -0
- package/claude-plugin/dist/plugin.d.ts +22 -0
- package/claude-plugin/dist/plugin.d.ts.map +1 -0
- package/claude-plugin/dist/plugin.js +72295 -0
- package/claude-plugin/dist/post-compaction-tracker.d.ts +133 -0
- package/claude-plugin/dist/post-compaction-tracker.d.ts.map +1 -0
- package/claude-plugin/dist/query-tools.d.ts +90 -0
- package/claude-plugin/dist/query-tools.d.ts.map +1 -0
- package/claude-plugin/dist/rate-limiter.d.ts +218 -0
- package/claude-plugin/dist/rate-limiter.d.ts.map +1 -0
- package/claude-plugin/dist/regression-detection.d.ts +58 -0
- package/claude-plugin/dist/regression-detection.d.ts.map +1 -0
- package/claude-plugin/dist/replay-tools.d.ts +28 -0
- package/claude-plugin/dist/replay-tools.d.ts.map +1 -0
- package/claude-plugin/dist/repo-crawl.d.ts +146 -0
- package/claude-plugin/dist/repo-crawl.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/cell-events.d.ts +1352 -0
- package/claude-plugin/dist/schemas/cell-events.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/cell.d.ts +413 -0
- package/claude-plugin/dist/schemas/cell.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/evaluation.d.ts +161 -0
- package/claude-plugin/dist/schemas/evaluation.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/index.d.ts +46 -0
- package/claude-plugin/dist/schemas/index.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/mandate.d.ts +336 -0
- package/claude-plugin/dist/schemas/mandate.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/swarm-context.d.ts +131 -0
- package/claude-plugin/dist/schemas/swarm-context.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/task.d.ts +189 -0
- package/claude-plugin/dist/schemas/task.d.ts.map +1 -0
- package/claude-plugin/dist/schemas/worker-handoff.d.ts +78 -0
- package/claude-plugin/dist/schemas/worker-handoff.d.ts.map +1 -0
- package/claude-plugin/dist/sessions/agent-discovery.d.ts +59 -0
- package/claude-plugin/dist/sessions/agent-discovery.d.ts.map +1 -0
- package/claude-plugin/dist/sessions/index.d.ts +10 -0
- package/claude-plugin/dist/sessions/index.d.ts.map +1 -0
- package/claude-plugin/dist/skills.d.ts +490 -0
- package/claude-plugin/dist/skills.d.ts.map +1 -0
- package/claude-plugin/dist/storage.d.ts +260 -0
- package/claude-plugin/dist/storage.d.ts.map +1 -0
- package/claude-plugin/dist/structured.d.ts +206 -0
- package/claude-plugin/dist/structured.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-adversarial-review.d.ts +104 -0
- package/claude-plugin/dist/swarm-adversarial-review.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-decompose.d.ts +297 -0
- package/claude-plugin/dist/swarm-decompose.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-insights.d.ts +390 -0
- package/claude-plugin/dist/swarm-insights.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-mail.d.ts +274 -0
- package/claude-plugin/dist/swarm-mail.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-orchestrate.d.ts +924 -0
- package/claude-plugin/dist/swarm-orchestrate.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-prompts.d.ts +467 -0
- package/claude-plugin/dist/swarm-prompts.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-prompts.js +45283 -0
- package/claude-plugin/dist/swarm-research.d.ts +125 -0
- package/claude-plugin/dist/swarm-research.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-review.d.ts +214 -0
- package/claude-plugin/dist/swarm-review.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-signature.d.ts +106 -0
- package/claude-plugin/dist/swarm-signature.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-strategies.d.ts +113 -0
- package/claude-plugin/dist/swarm-strategies.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-validation.d.ts +127 -0
- package/claude-plugin/dist/swarm-validation.d.ts.map +1 -0
- package/claude-plugin/dist/swarm-worktree.d.ts +185 -0
- package/claude-plugin/dist/swarm-worktree.d.ts.map +1 -0
- package/claude-plugin/dist/swarm.d.ts +590 -0
- package/claude-plugin/dist/swarm.d.ts.map +1 -0
- package/claude-plugin/dist/tool-availability.d.ts +91 -0
- package/claude-plugin/dist/tool-availability.d.ts.map +1 -0
- package/claude-plugin/dist/utils/tree-renderer.d.ts +61 -0
- package/claude-plugin/dist/utils/tree-renderer.d.ts.map +1 -0
- package/claude-plugin/dist/validators/index.d.ts +7 -0
- package/claude-plugin/dist/validators/index.d.ts.map +1 -0
- package/claude-plugin/dist/validators/schema-validator.d.ts +58 -0
- package/claude-plugin/dist/validators/schema-validator.d.ts.map +1 -0
- package/claude-plugin/skills/always-on-guidance/SKILL.md +44 -0
- package/dist/agent-mail.d.ts +4 -4
- package/dist/agent-mail.d.ts.map +1 -1
- package/dist/bin/swarm.js +467 -12
- package/dist/claude-plugin/claude-plugin-assets.d.ts +10 -0
- package/dist/claude-plugin/claude-plugin-assets.d.ts.map +1 -0
- package/dist/compaction-hook.d.ts +1 -1
- package/dist/compaction-hook.d.ts.map +1 -1
- package/dist/index.js +370 -260
- package/dist/plugin.js +369 -259
- package/dist/skills.d.ts +15 -0
- package/dist/skills.d.ts.map +1 -1
- package/dist/swarm-mail.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts +3 -1
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm-prompts.js +79 -2
- package/package.json +2 -1
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic Memory Plugin Tools - Embedded implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides semantic memory operations using swarm-mail's MemoryStore + Ollama.
|
|
5
|
+
* Replaces external MCP-based semantic-memory calls with embedded storage.
|
|
6
|
+
*
|
|
7
|
+
* Key features:
|
|
8
|
+
* - Vector similarity search with Ollama embeddings
|
|
9
|
+
* - Full-text search fallback
|
|
10
|
+
* - Memory decay tracking (TODO: implement in MemoryStore)
|
|
11
|
+
* - Collection-based organization
|
|
12
|
+
*
|
|
13
|
+
* Tool signatures maintained for backward compatibility with existing prompts.
|
|
14
|
+
*/
|
|
15
|
+
import { createMemoryAdapter, type MemoryAdapter } from "./memory";
|
|
16
|
+
export type { MemoryAdapter, StoreArgs, FindArgs, IdArgs, ListArgs, StoreResult, FindResult, StatsResult, HealthResult, OperationResult, UpsertArgs, UpsertResult, AutoTags, } from "./memory";
|
|
17
|
+
/**
|
|
18
|
+
* Get or create memory adapter for the current project
|
|
19
|
+
*
|
|
20
|
+
* @param projectPath - Project path (uses CWD if not provided)
|
|
21
|
+
* @returns Memory adapter instance
|
|
22
|
+
*/
|
|
23
|
+
export declare function getMemoryAdapter(projectPath?: string): Promise<MemoryAdapter>;
|
|
24
|
+
/**
|
|
25
|
+
* Reset adapter cache (for testing)
|
|
26
|
+
*/
|
|
27
|
+
export declare function resetMemoryCache(): void;
|
|
28
|
+
export { createMemoryAdapter };
|
|
29
|
+
/**
|
|
30
|
+
* Store a memory with semantic embedding
|
|
31
|
+
*/
|
|
32
|
+
export declare const semantic_memory_store: {
|
|
33
|
+
description: string;
|
|
34
|
+
args: {
|
|
35
|
+
information: import("zod").ZodString;
|
|
36
|
+
collection: import("zod").ZodOptional<import("zod").ZodString>;
|
|
37
|
+
tags: import("zod").ZodOptional<import("zod").ZodString>;
|
|
38
|
+
metadata: import("zod").ZodOptional<import("zod").ZodString>;
|
|
39
|
+
confidence: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
40
|
+
autoTag: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
41
|
+
autoLink: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
42
|
+
extractEntities: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
43
|
+
};
|
|
44
|
+
execute(args: {
|
|
45
|
+
information: string;
|
|
46
|
+
collection?: string | undefined;
|
|
47
|
+
tags?: string | undefined;
|
|
48
|
+
metadata?: string | undefined;
|
|
49
|
+
confidence?: number | undefined;
|
|
50
|
+
autoTag?: boolean | undefined;
|
|
51
|
+
autoLink?: boolean | undefined;
|
|
52
|
+
extractEntities?: boolean | undefined;
|
|
53
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Find memories by semantic similarity or full-text search
|
|
57
|
+
*/
|
|
58
|
+
export declare const semantic_memory_find: {
|
|
59
|
+
description: string;
|
|
60
|
+
args: {
|
|
61
|
+
query: import("zod").ZodString;
|
|
62
|
+
limit: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
63
|
+
collection: import("zod").ZodOptional<import("zod").ZodString>;
|
|
64
|
+
expand: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
65
|
+
fts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
66
|
+
};
|
|
67
|
+
execute(args: {
|
|
68
|
+
query: string;
|
|
69
|
+
limit?: number | undefined;
|
|
70
|
+
collection?: string | undefined;
|
|
71
|
+
expand?: boolean | undefined;
|
|
72
|
+
fts?: boolean | undefined;
|
|
73
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Get a single memory by ID
|
|
77
|
+
*/
|
|
78
|
+
export declare const semantic_memory_get: {
|
|
79
|
+
description: string;
|
|
80
|
+
args: {
|
|
81
|
+
id: import("zod").ZodString;
|
|
82
|
+
};
|
|
83
|
+
execute(args: {
|
|
84
|
+
id: string;
|
|
85
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Remove a memory
|
|
89
|
+
*/
|
|
90
|
+
export declare const semantic_memory_remove: {
|
|
91
|
+
description: string;
|
|
92
|
+
args: {
|
|
93
|
+
id: import("zod").ZodString;
|
|
94
|
+
};
|
|
95
|
+
execute(args: {
|
|
96
|
+
id: string;
|
|
97
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Validate a memory (reset decay timer)
|
|
101
|
+
*/
|
|
102
|
+
export declare const semantic_memory_validate: {
|
|
103
|
+
description: string;
|
|
104
|
+
args: {
|
|
105
|
+
id: import("zod").ZodString;
|
|
106
|
+
};
|
|
107
|
+
execute(args: {
|
|
108
|
+
id: string;
|
|
109
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* List memories
|
|
113
|
+
*/
|
|
114
|
+
export declare const semantic_memory_list: {
|
|
115
|
+
description: string;
|
|
116
|
+
args: {
|
|
117
|
+
collection: import("zod").ZodOptional<import("zod").ZodString>;
|
|
118
|
+
};
|
|
119
|
+
execute(args: {
|
|
120
|
+
collection?: string | undefined;
|
|
121
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Get memory statistics
|
|
125
|
+
*/
|
|
126
|
+
export declare const semantic_memory_stats: {
|
|
127
|
+
description: string;
|
|
128
|
+
args: {};
|
|
129
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Check Ollama health
|
|
133
|
+
*/
|
|
134
|
+
export declare const semantic_memory_check: {
|
|
135
|
+
description: string;
|
|
136
|
+
args: {};
|
|
137
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Smart upsert - ADD, UPDATE, DELETE, or NOOP based on existing memories
|
|
141
|
+
*/
|
|
142
|
+
export declare const semantic_memory_upsert: {
|
|
143
|
+
description: string;
|
|
144
|
+
args: {
|
|
145
|
+
information: import("zod").ZodString;
|
|
146
|
+
collection: import("zod").ZodOptional<import("zod").ZodString>;
|
|
147
|
+
tags: import("zod").ZodOptional<import("zod").ZodString>;
|
|
148
|
+
metadata: import("zod").ZodOptional<import("zod").ZodString>;
|
|
149
|
+
confidence: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
150
|
+
autoTag: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
151
|
+
autoLink: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
152
|
+
extractEntities: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
153
|
+
};
|
|
154
|
+
execute(args: {
|
|
155
|
+
information: string;
|
|
156
|
+
collection?: string | undefined;
|
|
157
|
+
tags?: string | undefined;
|
|
158
|
+
metadata?: string | undefined;
|
|
159
|
+
confidence?: number | undefined;
|
|
160
|
+
autoTag?: boolean | undefined;
|
|
161
|
+
autoLink?: boolean | undefined;
|
|
162
|
+
extractEntities?: boolean | undefined;
|
|
163
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* All semantic memory tools
|
|
167
|
+
*
|
|
168
|
+
* Register these in the plugin with spread operator: { ...memoryTools }
|
|
169
|
+
*/
|
|
170
|
+
export declare const memoryTools: {
|
|
171
|
+
readonly "semantic-memory_store": {
|
|
172
|
+
description: string;
|
|
173
|
+
args: {
|
|
174
|
+
information: import("zod").ZodString;
|
|
175
|
+
collection: import("zod").ZodOptional<import("zod").ZodString>;
|
|
176
|
+
tags: import("zod").ZodOptional<import("zod").ZodString>;
|
|
177
|
+
metadata: import("zod").ZodOptional<import("zod").ZodString>;
|
|
178
|
+
confidence: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
179
|
+
autoTag: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
180
|
+
autoLink: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
181
|
+
extractEntities: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
182
|
+
};
|
|
183
|
+
execute(args: {
|
|
184
|
+
information: string;
|
|
185
|
+
collection?: string | undefined;
|
|
186
|
+
tags?: string | undefined;
|
|
187
|
+
metadata?: string | undefined;
|
|
188
|
+
confidence?: number | undefined;
|
|
189
|
+
autoTag?: boolean | undefined;
|
|
190
|
+
autoLink?: boolean | undefined;
|
|
191
|
+
extractEntities?: boolean | undefined;
|
|
192
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
193
|
+
};
|
|
194
|
+
readonly "semantic-memory_find": {
|
|
195
|
+
description: string;
|
|
196
|
+
args: {
|
|
197
|
+
query: import("zod").ZodString;
|
|
198
|
+
limit: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
199
|
+
collection: import("zod").ZodOptional<import("zod").ZodString>;
|
|
200
|
+
expand: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
201
|
+
fts: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
202
|
+
};
|
|
203
|
+
execute(args: {
|
|
204
|
+
query: string;
|
|
205
|
+
limit?: number | undefined;
|
|
206
|
+
collection?: string | undefined;
|
|
207
|
+
expand?: boolean | undefined;
|
|
208
|
+
fts?: boolean | undefined;
|
|
209
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
210
|
+
};
|
|
211
|
+
readonly "semantic-memory_get": {
|
|
212
|
+
description: string;
|
|
213
|
+
args: {
|
|
214
|
+
id: import("zod").ZodString;
|
|
215
|
+
};
|
|
216
|
+
execute(args: {
|
|
217
|
+
id: string;
|
|
218
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
219
|
+
};
|
|
220
|
+
readonly "semantic-memory_remove": {
|
|
221
|
+
description: string;
|
|
222
|
+
args: {
|
|
223
|
+
id: import("zod").ZodString;
|
|
224
|
+
};
|
|
225
|
+
execute(args: {
|
|
226
|
+
id: string;
|
|
227
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
228
|
+
};
|
|
229
|
+
readonly "semantic-memory_validate": {
|
|
230
|
+
description: string;
|
|
231
|
+
args: {
|
|
232
|
+
id: import("zod").ZodString;
|
|
233
|
+
};
|
|
234
|
+
execute(args: {
|
|
235
|
+
id: string;
|
|
236
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
237
|
+
};
|
|
238
|
+
readonly "semantic-memory_list": {
|
|
239
|
+
description: string;
|
|
240
|
+
args: {
|
|
241
|
+
collection: import("zod").ZodOptional<import("zod").ZodString>;
|
|
242
|
+
};
|
|
243
|
+
execute(args: {
|
|
244
|
+
collection?: string | undefined;
|
|
245
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
246
|
+
};
|
|
247
|
+
readonly "semantic-memory_stats": {
|
|
248
|
+
description: string;
|
|
249
|
+
args: {};
|
|
250
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
251
|
+
};
|
|
252
|
+
readonly "semantic-memory_check": {
|
|
253
|
+
description: string;
|
|
254
|
+
args: {};
|
|
255
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
256
|
+
};
|
|
257
|
+
readonly "semantic-memory_upsert": {
|
|
258
|
+
description: string;
|
|
259
|
+
args: {
|
|
260
|
+
information: import("zod").ZodString;
|
|
261
|
+
collection: import("zod").ZodOptional<import("zod").ZodString>;
|
|
262
|
+
tags: import("zod").ZodOptional<import("zod").ZodString>;
|
|
263
|
+
metadata: import("zod").ZodOptional<import("zod").ZodString>;
|
|
264
|
+
confidence: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
265
|
+
autoTag: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
266
|
+
autoLink: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
267
|
+
extractEntities: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
268
|
+
};
|
|
269
|
+
execute(args: {
|
|
270
|
+
information: string;
|
|
271
|
+
collection?: string | undefined;
|
|
272
|
+
tags?: string | undefined;
|
|
273
|
+
metadata?: string | undefined;
|
|
274
|
+
confidence?: number | undefined;
|
|
275
|
+
autoTag?: boolean | undefined;
|
|
276
|
+
autoLink?: boolean | undefined;
|
|
277
|
+
extractEntities?: boolean | undefined;
|
|
278
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
//# sourceMappingURL=memory-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-tools.d.ts","sourceRoot":"","sources":["../src/memory-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EACN,mBAAmB,EACnB,KAAK,aAAa,EAalB,MAAM,U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adapter
|
|
3
|
+
*
|
|
4
|
+
* Provides a high-level adapter around swarm-mail's MemoryStore + Ollama.
|
|
5
|
+
* Used by semantic-memory_* tools in the plugin.
|
|
6
|
+
*
|
|
7
|
+
* ## Design
|
|
8
|
+
* - Wraps MemoryStore (vector storage) + Ollama (embeddings)
|
|
9
|
+
* - Handles ID generation, metadata parsing, error handling
|
|
10
|
+
* - Tool-friendly API (string inputs/outputs, no Effect-TS in signatures)
|
|
11
|
+
*
|
|
12
|
+
* ## Usage
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const adapter = await createMemoryAdapter(swarmMail.db);
|
|
15
|
+
*
|
|
16
|
+
* // Store memory
|
|
17
|
+
* const { id } = await adapter.store({
|
|
18
|
+
* information: "OAuth tokens need 5min buffer",
|
|
19
|
+
* tags: "auth,tokens",
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Search memories
|
|
23
|
+
* const results = await adapter.find({
|
|
24
|
+
* query: "token refresh",
|
|
25
|
+
* limit: 5,
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
import { type DatabaseAdapter, type Memory } from "swarm-mail";
|
|
30
|
+
/**
|
|
31
|
+
* Reset migration check flag (for testing)
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export declare function resetMigrationCheck(): void;
|
|
35
|
+
/** Arguments for store operation */
|
|
36
|
+
export interface StoreArgs {
|
|
37
|
+
readonly information: string;
|
|
38
|
+
readonly collection?: string;
|
|
39
|
+
readonly tags?: string;
|
|
40
|
+
readonly metadata?: string;
|
|
41
|
+
/** Confidence level (0.0-1.0) affecting decay rate. Higher = slower decay. Default 0.7 */
|
|
42
|
+
readonly confidence?: number;
|
|
43
|
+
/** Auto-generate tags using LLM. Default false */
|
|
44
|
+
readonly autoTag?: boolean;
|
|
45
|
+
/** Auto-link to related memories. Default false */
|
|
46
|
+
readonly autoLink?: boolean;
|
|
47
|
+
/** Extract entities (people, places, technologies). Default false */
|
|
48
|
+
readonly extractEntities?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Arguments for find operation */
|
|
51
|
+
export interface FindArgs {
|
|
52
|
+
readonly query: string;
|
|
53
|
+
readonly limit?: number;
|
|
54
|
+
readonly collection?: string;
|
|
55
|
+
readonly expand?: boolean;
|
|
56
|
+
readonly fts?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** Arguments for get/remove/validate operations */
|
|
59
|
+
export interface IdArgs {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
}
|
|
62
|
+
/** Arguments for list operation */
|
|
63
|
+
export interface ListArgs {
|
|
64
|
+
readonly collection?: string;
|
|
65
|
+
}
|
|
66
|
+
/** Result from store operation */
|
|
67
|
+
export interface StoreResult {
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly message: string;
|
|
70
|
+
}
|
|
71
|
+
/** Result from find operation */
|
|
72
|
+
export interface FindResult {
|
|
73
|
+
readonly results: Array<{
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly content: string;
|
|
76
|
+
readonly score: number;
|
|
77
|
+
readonly collection: string;
|
|
78
|
+
readonly metadata: Record<string, unknown>;
|
|
79
|
+
readonly createdAt: string;
|
|
80
|
+
}>;
|
|
81
|
+
readonly count: number;
|
|
82
|
+
}
|
|
83
|
+
/** Result from stats operation */
|
|
84
|
+
export interface StatsResult {
|
|
85
|
+
readonly memories: number;
|
|
86
|
+
readonly embeddings: number;
|
|
87
|
+
}
|
|
88
|
+
/** Result from health check */
|
|
89
|
+
export interface HealthResult {
|
|
90
|
+
readonly ollama: boolean;
|
|
91
|
+
readonly message?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Result from validate/remove operations */
|
|
94
|
+
export interface OperationResult {
|
|
95
|
+
readonly success: boolean;
|
|
96
|
+
readonly message?: string;
|
|
97
|
+
}
|
|
98
|
+
/** Arguments for upsert operation */
|
|
99
|
+
export interface UpsertArgs {
|
|
100
|
+
readonly information: string;
|
|
101
|
+
readonly collection?: string;
|
|
102
|
+
readonly tags?: string;
|
|
103
|
+
readonly metadata?: string;
|
|
104
|
+
readonly confidence?: number;
|
|
105
|
+
/** Auto-generate tags using LLM. Default true */
|
|
106
|
+
readonly autoTag?: boolean;
|
|
107
|
+
/** Auto-link to related memories. Default true */
|
|
108
|
+
readonly autoLink?: boolean;
|
|
109
|
+
/** Extract entities (people, places, technologies). Default false */
|
|
110
|
+
readonly extractEntities?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/** Auto-generated tags result */
|
|
113
|
+
export interface AutoTags {
|
|
114
|
+
readonly tags: string[];
|
|
115
|
+
readonly keywords: string[];
|
|
116
|
+
readonly category: string;
|
|
117
|
+
}
|
|
118
|
+
/** Result from upsert operation */
|
|
119
|
+
export interface UpsertResult {
|
|
120
|
+
readonly operation: "ADD" | "UPDATE" | "DELETE" | "NOOP";
|
|
121
|
+
readonly reason: string;
|
|
122
|
+
readonly memoryId?: string;
|
|
123
|
+
readonly affectedMemoryIds?: string[];
|
|
124
|
+
readonly autoTags?: AutoTags;
|
|
125
|
+
readonly linksCreated?: number;
|
|
126
|
+
readonly entitiesExtracted?: number;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Memory Adapter Interface
|
|
130
|
+
*
|
|
131
|
+
* High-level API for semantic memory operations.
|
|
132
|
+
*/
|
|
133
|
+
export interface MemoryAdapter {
|
|
134
|
+
readonly store: (args: StoreArgs) => Promise<StoreResult>;
|
|
135
|
+
readonly find: (args: FindArgs) => Promise<FindResult>;
|
|
136
|
+
readonly get: (args: IdArgs) => Promise<Memory | null>;
|
|
137
|
+
readonly remove: (args: IdArgs) => Promise<OperationResult>;
|
|
138
|
+
readonly validate: (args: IdArgs) => Promise<OperationResult>;
|
|
139
|
+
readonly list: (args: ListArgs) => Promise<Memory[]>;
|
|
140
|
+
readonly stats: () => Promise<StatsResult>;
|
|
141
|
+
readonly checkHealth: () => Promise<HealthResult>;
|
|
142
|
+
readonly upsert: (args: UpsertArgs) => Promise<UpsertResult>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create Memory Adapter
|
|
146
|
+
*
|
|
147
|
+
* @param db - DatabaseAdapter from swarm-mail's getDatabase()
|
|
148
|
+
* @returns Memory adapter with high-level operations
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* import { getSwarmMailLibSQL } from 'swarm-mail';
|
|
153
|
+
* import { createMemoryAdapter } from './memory';
|
|
154
|
+
*
|
|
155
|
+
* const swarmMail = await getSwarmMailLibSQL('/path/to/project');
|
|
156
|
+
* const db = await swarmMail.getDatabase();
|
|
157
|
+
* const adapter = await createMemoryAdapter(db);
|
|
158
|
+
*
|
|
159
|
+
* await adapter.store({ information: "Learning X" });
|
|
160
|
+
* const results = await adapter.find({ query: "X" });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export declare function createMemoryAdapter(db: DatabaseAdapter): Promise<MemoryAdapter>;
|
|
164
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EACN,KAAK,eAAe,EAKpB,KAAK,MAAM,EAOX,MAAM,YAAY,CAAC;AAYpB;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAMD,oCAAoC;AACpC,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,0FAA0F;IAC1F,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,kDAAkD;IAClD,QAAQ,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AC,CAoRxB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Selection Module
|
|
3
|
+
*
|
|
4
|
+
* Determines which model a worker agent should use based on subtask
|
|
5
|
+
* characteristics like file types and complexity.
|
|
6
|
+
*
|
|
7
|
+
* Priority:
|
|
8
|
+
* 1. Explicit model field in subtask
|
|
9
|
+
* 2. File-type inference (docs/tests → lite model)
|
|
10
|
+
* 3. Default to primary model
|
|
11
|
+
*/
|
|
12
|
+
import type { DecomposedSubtask } from "./schemas/task";
|
|
13
|
+
/**
|
|
14
|
+
* Configuration interface for swarm models
|
|
15
|
+
*/
|
|
16
|
+
export interface SwarmConfig {
|
|
17
|
+
primaryModel: string;
|
|
18
|
+
liteModel?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Select the appropriate model for a worker agent based on subtask characteristics
|
|
22
|
+
*
|
|
23
|
+
* Priority order:
|
|
24
|
+
* 1. Explicit `model` field in subtask (if present)
|
|
25
|
+
* 2. File-type inference:
|
|
26
|
+
* - All .md/.mdx files → liteModel
|
|
27
|
+
* - All .test./.spec. files → liteModel
|
|
28
|
+
* 3. Mixed files or implementation → primaryModel
|
|
29
|
+
*
|
|
30
|
+
* @param subtask - The subtask to evaluate
|
|
31
|
+
* @param config - Swarm configuration with model preferences
|
|
32
|
+
* @returns Model identifier string
|
|
33
|
+
*/
|
|
34
|
+
export declare function selectWorkerModel(subtask: DecomposedSubtask & {
|
|
35
|
+
model?: string;
|
|
36
|
+
}, config: SwarmConfig): string;
|
|
37
|
+
//# sourceMappingURL=model-selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-selection.d.ts","sourceRoot":"","sources":["../src/model-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,iBAAiB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC/C,MAAM,EAAE,WAAW,GAClB,MAAM,CA4BR"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observability Health - CLI health dashboard
|
|
3
|
+
*
|
|
4
|
+
* Shows what's being captured vs what's missing.
|
|
5
|
+
* Helps identify coverage gaps in observability instrumentation.
|
|
6
|
+
*/
|
|
7
|
+
export interface HookCoverageResult {
|
|
8
|
+
percentage: number;
|
|
9
|
+
wired: number;
|
|
10
|
+
total: number;
|
|
11
|
+
hooks: Array<{
|
|
12
|
+
name: string;
|
|
13
|
+
wired: boolean;
|
|
14
|
+
captures: number;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export interface EventCaptureStats {
|
|
18
|
+
days: number;
|
|
19
|
+
DECISION: number;
|
|
20
|
+
VIOLATION: number;
|
|
21
|
+
OUTCOME: number;
|
|
22
|
+
COMPACTION: number;
|
|
23
|
+
}
|
|
24
|
+
export interface SessionQualityResult {
|
|
25
|
+
totalSessions: number;
|
|
26
|
+
qualitySessions: number;
|
|
27
|
+
ghostSessions: number;
|
|
28
|
+
qualityPercentage: number;
|
|
29
|
+
warning: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface RegressionStatus {
|
|
32
|
+
detected: boolean;
|
|
33
|
+
count: number;
|
|
34
|
+
details?: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface ObservabilityHealth {
|
|
37
|
+
hookCoverage: HookCoverageResult;
|
|
38
|
+
eventStats: EventCaptureStats;
|
|
39
|
+
sessionQuality: SessionQualityResult;
|
|
40
|
+
regressions: RegressionStatus;
|
|
41
|
+
}
|
|
42
|
+
export interface HookCoverageInput {
|
|
43
|
+
wiredHooks: readonly string[];
|
|
44
|
+
expectedHooks: readonly string[];
|
|
45
|
+
captureCounts?: Record<string, number>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Calculate hook coverage - what % of expected hooks are wired
|
|
49
|
+
*/
|
|
50
|
+
export declare function calculateHookCoverage(input: HookCoverageInput): HookCoverageResult;
|
|
51
|
+
/**
|
|
52
|
+
* Query event counts by type from database
|
|
53
|
+
*/
|
|
54
|
+
export declare function getEventCaptureStats(projectPath: string, options: {
|
|
55
|
+
days: number;
|
|
56
|
+
}): Promise<EventCaptureStats>;
|
|
57
|
+
export interface SessionQualityInput {
|
|
58
|
+
totalSessions: number;
|
|
59
|
+
qualitySessions: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Calculate session quality metrics
|
|
63
|
+
* Warning threshold: <50% quality sessions
|
|
64
|
+
*/
|
|
65
|
+
export declare function calculateSessionQuality(input: SessionQualityInput): SessionQualityResult;
|
|
66
|
+
/**
|
|
67
|
+
* Query actual session quality from session files
|
|
68
|
+
* Quality session = has DECISION events (spawns, reviews, etc.)
|
|
69
|
+
*/
|
|
70
|
+
export declare function querySessionQuality(options: {
|
|
71
|
+
days: number;
|
|
72
|
+
}): SessionQualityInput;
|
|
73
|
+
/**
|
|
74
|
+
* Check for eval regressions
|
|
75
|
+
*/
|
|
76
|
+
export declare function checkRegressions(projectPath: string): Promise<RegressionStatus>;
|
|
77
|
+
/**
|
|
78
|
+
* Format health dashboard with box-drawing characters
|
|
79
|
+
*/
|
|
80
|
+
export declare function formatHealthDashboard(health: ObservabilityHealth): string;
|
|
81
|
+
/**
|
|
82
|
+
* Get full observability health report
|
|
83
|
+
*/
|
|
84
|
+
export declare function getObservabilityHealth(projectPath: string, options?: {
|
|
85
|
+
days?: number;
|
|
86
|
+
}): Promise<ObservabilityHealth>;
|
|
87
|
+
//# sourceMappingURL=observability-health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observability-health.d.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