opencode-swarm 7.88.3 → 7.89.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/dist/agents/agent-output-schema.d.ts +1 -1
- package/dist/agents/curator-agent.d.ts +1 -1
- package/dist/agents/explorer.d.ts +1 -0
- package/dist/cli/{config-doctor-jzbgpbdh.js → config-doctor-g04wdz19.js} +2 -2
- package/dist/cli/{explorer-gz70sm9b.js → explorer-h2fnj343.js} +4 -2
- package/dist/cli/{guardrail-explain-eqypvw60.js → guardrail-explain-hy0zz0p6.js} +8 -8
- package/dist/cli/{guardrail-log-c7egm5km.js → guardrail-log-m3285thy.js} +3 -3
- package/dist/cli/{index-0asbrmdx.js → index-123s7kjc.js} +88 -2
- package/dist/cli/{index-32axfg6h.js → index-1ccnwh54.js} +98 -25
- package/dist/cli/{index-ds057q5k.js → index-6k31ysgd.js} +2 -2
- package/dist/cli/{index-g00qm2gf.js → index-6tnmt41c.js} +1 -1
- package/dist/cli/{index-g6f4tt38.js → index-9w07ye9b.js} +906 -431
- package/dist/cli/{index-e8pk68cc.js → index-axwxkbdd.js} +166 -23
- package/dist/cli/{index-yhsmmv2z.js → index-bm4f0nme.js} +25 -1
- package/dist/cli/{index-819xp49y.js → index-bywt2171.js} +1 -1
- package/dist/cli/{index-0rt5aamg.js → index-dprk5c5f.js} +13 -9
- package/dist/cli/{index-vjsr9bqt.js → index-gg589mfw.js} +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/{knowledge-store-n4x6zyk7.js → knowledge-store-gsy6p46z.js} +1 -1
- package/dist/cli/{schema-vb6jkxgg.js → schema-t9th7frq.js} +1 -1
- package/dist/cli/{skill-generator-kz4q8e49.js → skill-generator-1hzfyhth.js} +2 -2
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/link.d.ts +19 -0
- package/dist/commands/memory.d.ts +1 -0
- package/dist/commands/registry.d.ts +31 -0
- package/dist/commands/unlink.d.ts +13 -0
- package/dist/config/agent-names.d.ts +2 -2
- package/dist/config/schema.d.ts +60 -0
- package/dist/hooks/curator-llm-factory.d.ts +1 -1
- package/dist/hooks/knowledge-events.d.ts +3 -3
- package/dist/hooks/knowledge-link.d.ts +82 -0
- package/dist/hooks/knowledge-validator.d.ts +1 -1
- package/dist/index.js +3177 -1765
- package/dist/knowledge/identity.d.ts +9 -0
- package/dist/memory/config.d.ts +35 -0
- package/dist/memory/consolidation-log.d.ts +29 -0
- package/dist/memory/consolidation.d.ts +124 -0
- package/dist/memory/decay.d.ts +24 -0
- package/dist/memory/gateway.d.ts +14 -2
- package/dist/memory/maintenance.d.ts +18 -0
- package/dist/memory/run-log.d.ts +8 -1
- package/dist/memory/schema.d.ts +3 -3
- package/dist/memory/scoring.d.ts +45 -0
- package/dist/memory/sentinel.d.ts +15 -0
- package/dist/services/memory-consolidation.d.ts +32 -0
- package/dist/services/skill-generator.d.ts +8 -1
- package/dist/session/worktree-link-suggestion.d.ts +27 -0
- package/dist/state.d.ts +4 -2
- package/package.json +1 -1
|
@@ -14,51 +14,194 @@ import {
|
|
|
14
14
|
|
|
15
15
|
// src/hooks/knowledge-store.ts
|
|
16
16
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
17
|
-
import { existsSync } from "fs";
|
|
17
|
+
import { existsSync as existsSync2 } from "fs";
|
|
18
18
|
import { appendFile, mkdir, readFile } from "fs/promises";
|
|
19
|
+
import * as os2 from "os";
|
|
20
|
+
import * as path2 from "path";
|
|
21
|
+
|
|
22
|
+
// src/hooks/knowledge-link.ts
|
|
23
|
+
import { existsSync, mkdirSync, readFileSync, rmSync } from "fs";
|
|
19
24
|
import * as os from "os";
|
|
20
25
|
import * as path from "path";
|
|
21
|
-
var
|
|
22
|
-
|
|
26
|
+
var LINK_POINTER_FILENAME = "link.json";
|
|
27
|
+
var MAX_LINK_ID_LENGTH = 64;
|
|
28
|
+
var WINDOWS_RESERVED_NAMES = new Set([
|
|
29
|
+
"con",
|
|
30
|
+
"prn",
|
|
31
|
+
"aux",
|
|
32
|
+
"nul",
|
|
33
|
+
"com0",
|
|
34
|
+
"com1",
|
|
35
|
+
"com2",
|
|
36
|
+
"com3",
|
|
37
|
+
"com4",
|
|
38
|
+
"com5",
|
|
39
|
+
"com6",
|
|
40
|
+
"com7",
|
|
41
|
+
"com8",
|
|
42
|
+
"com9",
|
|
43
|
+
"lpt0",
|
|
44
|
+
"lpt1",
|
|
45
|
+
"lpt2",
|
|
46
|
+
"lpt3",
|
|
47
|
+
"lpt4",
|
|
48
|
+
"lpt5",
|
|
49
|
+
"lpt6",
|
|
50
|
+
"lpt7",
|
|
51
|
+
"lpt8",
|
|
52
|
+
"lpt9"
|
|
53
|
+
]);
|
|
54
|
+
var CACHE_TTL_MS = 2000;
|
|
55
|
+
var MAX_CACHE_ENTRIES = 500;
|
|
56
|
+
function resolveDataDir() {
|
|
23
57
|
const platform = process.platform;
|
|
24
58
|
const home = process.env.HOME || os.homedir();
|
|
25
59
|
if (platform === "win32") {
|
|
26
|
-
return path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "opencode-swarm", "
|
|
60
|
+
return path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "opencode-swarm", "Data");
|
|
27
61
|
} else if (platform === "darwin") {
|
|
28
62
|
return path.join(home, "Library", "Application Support", "opencode-swarm");
|
|
63
|
+
}
|
|
64
|
+
return path.join(process.env.XDG_DATA_HOME || path.join(home, ".local", "share"), "opencode-swarm");
|
|
65
|
+
}
|
|
66
|
+
function resolveLinkBaseDir() {
|
|
67
|
+
return path.join(resolveDataDir(), "links");
|
|
68
|
+
}
|
|
69
|
+
function resolveLinkDir(linkId) {
|
|
70
|
+
return path.join(resolveLinkBaseDir(), linkId);
|
|
71
|
+
}
|
|
72
|
+
function sanitizeLinkId(name) {
|
|
73
|
+
if (typeof name !== "string")
|
|
74
|
+
return null;
|
|
75
|
+
const cleaned = name.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, MAX_LINK_ID_LENGTH).replace(/[-.]+$/g, "");
|
|
76
|
+
if (cleaned.length === 0)
|
|
77
|
+
return null;
|
|
78
|
+
const base = cleaned.split(".")[0];
|
|
79
|
+
if (WINDOWS_RESERVED_NAMES.has(base))
|
|
80
|
+
return null;
|
|
81
|
+
return cleaned;
|
|
82
|
+
}
|
|
83
|
+
function resolveLinkPointerPath(directory) {
|
|
84
|
+
return path.join(directory, ".swarm", LINK_POINTER_FILENAME);
|
|
85
|
+
}
|
|
86
|
+
function readLinkPointer(directory) {
|
|
87
|
+
const pointerPath = resolveLinkPointerPath(directory);
|
|
88
|
+
if (!existsSync(pointerPath))
|
|
89
|
+
return null;
|
|
90
|
+
try {
|
|
91
|
+
const raw = JSON.parse(readFileSync(pointerPath, "utf-8"));
|
|
92
|
+
if (!raw || typeof raw !== "object")
|
|
93
|
+
return null;
|
|
94
|
+
const obj = raw;
|
|
95
|
+
const linkId = obj.linkId;
|
|
96
|
+
if (typeof linkId !== "string" || linkId.length === 0)
|
|
97
|
+
return null;
|
|
98
|
+
const safeId = sanitizeLinkId(linkId);
|
|
99
|
+
if (!safeId)
|
|
100
|
+
return null;
|
|
101
|
+
return {
|
|
102
|
+
version: 1,
|
|
103
|
+
linkId: safeId,
|
|
104
|
+
name: typeof obj.name === "string" ? obj.name : undefined,
|
|
105
|
+
createdAt: typeof obj.createdAt === "string" ? obj.createdAt : new Date(0).toISOString(),
|
|
106
|
+
source: obj.source === "auto" ? "auto" : "manual"
|
|
107
|
+
};
|
|
108
|
+
} catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function writeLinkPointer(directory, pointer) {
|
|
113
|
+
const swarmDir = path.join(directory, ".swarm");
|
|
114
|
+
mkdirSync(swarmDir, { recursive: true });
|
|
115
|
+
const pointerPath = resolveLinkPointerPath(directory);
|
|
116
|
+
await atomicWriteFile(pointerPath, JSON.stringify(pointer, null, 2));
|
|
117
|
+
invalidateKnowledgeStoreDirCache(directory);
|
|
118
|
+
}
|
|
119
|
+
async function removeLinkPointer(directory) {
|
|
120
|
+
const pointerPath = resolveLinkPointerPath(directory);
|
|
121
|
+
try {
|
|
122
|
+
rmSync(pointerPath, { force: true });
|
|
123
|
+
} finally {
|
|
124
|
+
invalidateKnowledgeStoreDirCache(directory);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
var _resolutionCache = new Map;
|
|
128
|
+
function resolveKnowledgeStoreDir(directory) {
|
|
129
|
+
const localSwarm = path.join(directory, ".swarm");
|
|
130
|
+
const now = Date.now();
|
|
131
|
+
const cached = _resolutionCache.get(directory);
|
|
132
|
+
if (cached && now < cached.expires) {
|
|
133
|
+
return cached.linkDir ?? localSwarm;
|
|
134
|
+
}
|
|
135
|
+
let linkDir = null;
|
|
136
|
+
try {
|
|
137
|
+
const pointer = readLinkPointer(directory);
|
|
138
|
+
if (pointer) {
|
|
139
|
+
linkDir = path.resolve(resolveLinkDir(pointer.linkId));
|
|
140
|
+
}
|
|
141
|
+
} catch {
|
|
142
|
+
linkDir = null;
|
|
143
|
+
}
|
|
144
|
+
if (!_resolutionCache.has(directory) && _resolutionCache.size >= MAX_CACHE_ENTRIES) {
|
|
145
|
+
const oldest = _resolutionCache.keys().next().value;
|
|
146
|
+
if (oldest !== undefined)
|
|
147
|
+
_resolutionCache.delete(oldest);
|
|
148
|
+
}
|
|
149
|
+
_resolutionCache.set(directory, { linkDir, expires: now + CACHE_TTL_MS });
|
|
150
|
+
return linkDir ?? localSwarm;
|
|
151
|
+
}
|
|
152
|
+
function invalidateKnowledgeStoreDirCache(directory) {
|
|
153
|
+
if (directory === undefined) {
|
|
154
|
+
_resolutionCache.clear();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
_resolutionCache.delete(directory);
|
|
158
|
+
}
|
|
159
|
+
function isLinked(directory) {
|
|
160
|
+
return readLinkPointer(directory) !== null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// src/hooks/knowledge-store.ts
|
|
164
|
+
var KNOWLEDGE_JSONL_CACHE_NAMESPACE = "knowledge-jsonl:normalized:v1";
|
|
165
|
+
function getPlatformConfigDir() {
|
|
166
|
+
const platform = process.platform;
|
|
167
|
+
const home = process.env.HOME || os2.homedir();
|
|
168
|
+
if (platform === "win32") {
|
|
169
|
+
return path2.join(process.env.LOCALAPPDATA || path2.join(home, "AppData", "Local"), "opencode-swarm", "config");
|
|
170
|
+
} else if (platform === "darwin") {
|
|
171
|
+
return path2.join(home, "Library", "Application Support", "opencode-swarm");
|
|
29
172
|
} else {
|
|
30
|
-
return
|
|
173
|
+
return path2.join(process.env.XDG_CONFIG_HOME || path2.join(home, ".config"), "opencode-swarm");
|
|
31
174
|
}
|
|
32
175
|
}
|
|
33
176
|
function resolveSwarmKnowledgePath(directory) {
|
|
34
|
-
return
|
|
177
|
+
return path2.join(resolveKnowledgeStoreDir(directory), "knowledge.jsonl");
|
|
35
178
|
}
|
|
36
179
|
function resolveSwarmRejectedPath(directory) {
|
|
37
|
-
return
|
|
180
|
+
return path2.join(resolveKnowledgeStoreDir(directory), "knowledge-rejected.jsonl");
|
|
38
181
|
}
|
|
39
182
|
function resolveSwarmRetractionsPath(directory) {
|
|
40
|
-
return
|
|
183
|
+
return path2.join(resolveKnowledgeStoreDir(directory), "knowledge-retractions.jsonl");
|
|
41
184
|
}
|
|
42
185
|
function resolveHiveKnowledgePath() {
|
|
43
186
|
const platform = process.platform;
|
|
44
|
-
const home = process.env.HOME ||
|
|
187
|
+
const home = process.env.HOME || os2.homedir();
|
|
45
188
|
let dataDir;
|
|
46
189
|
if (platform === "win32") {
|
|
47
|
-
dataDir =
|
|
190
|
+
dataDir = path2.join(process.env.LOCALAPPDATA || path2.join(home, "AppData", "Local"), "opencode-swarm", "Data");
|
|
48
191
|
} else if (platform === "darwin") {
|
|
49
|
-
dataDir =
|
|
192
|
+
dataDir = path2.join(home, "Library", "Application Support", "opencode-swarm");
|
|
50
193
|
} else {
|
|
51
|
-
dataDir =
|
|
194
|
+
dataDir = path2.join(process.env.XDG_DATA_HOME || path2.join(home, ".local", "share"), "opencode-swarm");
|
|
52
195
|
}
|
|
53
|
-
return
|
|
196
|
+
return path2.join(dataDir, "shared-learnings.jsonl");
|
|
54
197
|
}
|
|
55
198
|
function resolveHiveRejectedPath() {
|
|
56
199
|
const hivePath = resolveHiveKnowledgePath();
|
|
57
|
-
return
|
|
200
|
+
return path2.join(path2.dirname(hivePath), "shared-learnings-rejected.jsonl");
|
|
58
201
|
}
|
|
59
202
|
function resolveHiveEventsPath() {
|
|
60
203
|
const hivePath = resolveHiveKnowledgePath();
|
|
61
|
-
return
|
|
204
|
+
return path2.join(path2.dirname(hivePath), "shared-knowledge-events.jsonl");
|
|
62
205
|
}
|
|
63
206
|
function parseKnowledgeContent(content, max) {
|
|
64
207
|
const results = [];
|
|
@@ -78,16 +221,16 @@ function parseKnowledgeContent(content, max) {
|
|
|
78
221
|
return results;
|
|
79
222
|
}
|
|
80
223
|
async function readKnowledge(filePath, maxEntries) {
|
|
81
|
-
const resolvedPath =
|
|
224
|
+
const resolvedPath = path2.resolve(filePath);
|
|
82
225
|
const cap = maxEntries !== undefined && maxEntries > 0 ? maxEntries : undefined;
|
|
83
226
|
if (cap !== undefined) {
|
|
84
|
-
if (!
|
|
227
|
+
if (!existsSync2(resolvedPath))
|
|
85
228
|
return [];
|
|
86
229
|
const content = await readFile(resolvedPath, "utf-8");
|
|
87
230
|
return parseKnowledgeContent(content, cap);
|
|
88
231
|
}
|
|
89
232
|
const entries = await readCachedParsedFile(resolvedPath, KNOWLEDGE_JSONL_CACHE_NAMESPACE, async () => {
|
|
90
|
-
if (!
|
|
233
|
+
if (!existsSync2(resolvedPath))
|
|
91
234
|
return null;
|
|
92
235
|
return await readFile(resolvedPath, "utf-8");
|
|
93
236
|
}, (content) => parseKnowledgeContent(content, Infinity));
|
|
@@ -169,7 +312,7 @@ async function appendRetractionRecord(directory, record) {
|
|
|
169
312
|
await appendKnowledge(resolveSwarmRetractionsPath(directory), record);
|
|
170
313
|
}
|
|
171
314
|
async function appendKnowledge(filePath, entry) {
|
|
172
|
-
const dir =
|
|
315
|
+
const dir = path2.dirname(filePath);
|
|
173
316
|
await mkdir(dir, { recursive: true });
|
|
174
317
|
let release = null;
|
|
175
318
|
try {
|
|
@@ -188,7 +331,7 @@ async function appendKnowledge(filePath, entry) {
|
|
|
188
331
|
}
|
|
189
332
|
}
|
|
190
333
|
async function rewriteKnowledge(filePath, entries) {
|
|
191
|
-
const dir =
|
|
334
|
+
const dir = path2.dirname(filePath);
|
|
192
335
|
await mkdir(dir, { recursive: true });
|
|
193
336
|
let release = null;
|
|
194
337
|
try {
|
|
@@ -209,7 +352,7 @@ async function rewriteKnowledge(filePath, entries) {
|
|
|
209
352
|
}
|
|
210
353
|
}
|
|
211
354
|
async function transactFile(filePath, read, write, mutate) {
|
|
212
|
-
const dir =
|
|
355
|
+
const dir = path2.dirname(filePath);
|
|
213
356
|
try {
|
|
214
357
|
await mkdir(dir, { recursive: true });
|
|
215
358
|
} catch {
|
|
@@ -474,7 +617,7 @@ async function applyConfidenceDeltas(filePath, deltas) {
|
|
|
474
617
|
}
|
|
475
618
|
let release = null;
|
|
476
619
|
try {
|
|
477
|
-
const dir =
|
|
620
|
+
const dir = path2.dirname(filePath);
|
|
478
621
|
await mkdir(dir, { recursive: true });
|
|
479
622
|
release = await import_proper_lockfile.default.lock(dir, {
|
|
480
623
|
retries: { retries: 5, minTimeout: 100, maxTimeout: 500 },
|
|
@@ -537,4 +680,4 @@ var _internals = {
|
|
|
537
680
|
bumpKnowledgeConfidenceBatch
|
|
538
681
|
};
|
|
539
682
|
|
|
540
|
-
export { getPlatformConfigDir, resolveSwarmKnowledgePath, resolveSwarmRejectedPath, resolveSwarmRetractionsPath, resolveHiveKnowledgePath, resolveHiveRejectedPath, resolveHiveEventsPath, readKnowledge, normalizeEntry, readRejectedLessons, readRetractionRecords, appendRetractionRecord, appendKnowledge, rewriteKnowledge, transactFile, transactKnowledge, appendKnowledgeWithCapEnforcement, enforceKnowledgeCap, sweepAgedEntries, sweepStaleTodos, appendRejectedLesson, normalize, wordBigrams, jaccardBigram, findNearDuplicate, computeConfidence, OUTCOME_SIGNAL_SMOOTHING, computeOutcomeSignal, inferTags, bumpKnowledgeConfidenceBatch, _internals };
|
|
683
|
+
export { resolveLinkDir, sanitizeLinkId, readLinkPointer, writeLinkPointer, removeLinkPointer, resolveKnowledgeStoreDir, isLinked, getPlatformConfigDir, resolveSwarmKnowledgePath, resolveSwarmRejectedPath, resolveSwarmRetractionsPath, resolveHiveKnowledgePath, resolveHiveRejectedPath, resolveHiveEventsPath, readKnowledge, normalizeEntry, readRejectedLessons, readRetractionRecords, appendRetractionRecord, appendKnowledge, rewriteKnowledge, transactFile, transactKnowledge, appendKnowledgeWithCapEnforcement, enforceKnowledgeCap, sweepAgedEntries, sweepStaleTodos, appendRejectedLesson, normalize, wordBigrams, jaccardBigram, findNearDuplicate, computeConfidence, OUTCOME_SIGNAL_SMOOTHING, computeOutcomeSignal, inferTags, bumpKnowledgeConfidenceBatch, _internals };
|
|
@@ -311,6 +311,30 @@ LEARNING_METRICS:
|
|
|
311
311
|
SUMMARY:
|
|
312
312
|
[3-line executive summary for architect briefing]
|
|
313
313
|
`;
|
|
314
|
+
var CURATOR_CONSOLIDATION_PROMPT = `## IDENTITY
|
|
315
|
+
You are Curator in CONSOLIDATION mode. You distill clusters of raw episodic memory into a small set of durable semantic facts.
|
|
316
|
+
DO NOT use the Task tool to delegate. You ARE the agent that does the work.
|
|
317
|
+
DO NOT scan raw source code \u2014 work only from the episodic events and existing memories provided in the prompt.
|
|
318
|
+
|
|
319
|
+
INPUT FORMAT:
|
|
320
|
+
- A cluster of verbatim episodic events.
|
|
321
|
+
- A list of existing durable memories (each prefixed with its mem_ id) for dedup and contradiction detection.
|
|
322
|
+
|
|
323
|
+
ACTIONS:
|
|
324
|
+
1. Identify durable, reusable facts that are DIRECTLY supported by the cited episodic evidence.
|
|
325
|
+
2. Detect contradictions with the listed existing memories; when a new fact conflicts with one, set contradictsMemoryId to that memory's id.
|
|
326
|
+
3. Skip anything speculative, transient, or already captured by an existing memory.
|
|
327
|
+
|
|
328
|
+
RULES:
|
|
329
|
+
- Only emit facts directly supported by the cited evidence. If uncertain, omit the fact (fewer facts, or an empty array, is correct).
|
|
330
|
+
- Use durable kinds only (user_preference, project_fact, architecture_decision, repo_convention, code_pattern, test_pattern, failure_pattern, security_note).
|
|
331
|
+
- Keep each fact concise (under 500 characters).
|
|
332
|
+
- Never include the literal text "## Retrieved Swarm Memory".
|
|
333
|
+
- Output STRICT JSON only, no prose.
|
|
334
|
+
|
|
335
|
+
OUTPUT FORMAT:
|
|
336
|
+
{"facts":[{"text":"...","kind":"project_fact","confidence":0.8,"contradictsMemoryId":"mem_0123456789abcdef"}]}
|
|
337
|
+
`;
|
|
314
338
|
function createExplorerAgent(model, customPrompt, customAppendPrompt) {
|
|
315
339
|
let prompt = EXPLORER_PROMPT;
|
|
316
340
|
if (customPrompt) {
|
|
@@ -336,4 +360,4 @@ ${customAppendPrompt}`;
|
|
|
336
360
|
};
|
|
337
361
|
}
|
|
338
362
|
|
|
339
|
-
export { EXPLORER_PROMPT, CURATOR_INIT_PROMPT, CURATOR_PHASE_PROMPT, CURATOR_POSTMORTEM_PROMPT, createExplorerAgent };
|
|
363
|
+
export { EXPLORER_PROMPT, CURATOR_INIT_PROMPT, CURATOR_PHASE_PROMPT, CURATOR_POSTMORTEM_PROMPT, CURATOR_CONSOLIDATION_PROMPT, createExplorerAgent };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-6k31ysgd.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-gg589mfw.js";
|
|
8
8
|
import {
|
|
9
9
|
COMMAND_REGISTRY,
|
|
10
10
|
SWARM_COMMAND_TOOL_ALLOWLIST,
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
handleKnowledgeRetryHardeningCommand,
|
|
52
52
|
handleKnowledgeUnactionableCommand,
|
|
53
53
|
handleLearningCommand,
|
|
54
|
+
handleLinkCommand,
|
|
54
55
|
handleMemoryCommand,
|
|
55
56
|
handleMemoryExportCommand,
|
|
56
57
|
handleMemoryImportCommand,
|
|
@@ -73,20 +74,21 @@ import {
|
|
|
73
74
|
handleStatusCommand,
|
|
74
75
|
handleSyncPlanCommand,
|
|
75
76
|
handleTurboCommand,
|
|
77
|
+
handleUnlinkCommand,
|
|
76
78
|
handleWriteRetroCommand,
|
|
77
79
|
normalizeSwarmCommandInput,
|
|
78
80
|
resolveCommand
|
|
79
|
-
} from "./index-
|
|
80
|
-
import"./index-
|
|
81
|
-
import"./index-
|
|
82
|
-
import"./index-
|
|
83
|
-
import"./index-
|
|
84
|
-
import"./index-
|
|
81
|
+
} from "./index-9w07ye9b.js";
|
|
82
|
+
import"./index-6tnmt41c.js";
|
|
83
|
+
import"./index-bm4f0nme.js";
|
|
84
|
+
import"./index-1ccnwh54.js";
|
|
85
|
+
import"./index-axwxkbdd.js";
|
|
86
|
+
import"./index-bywt2171.js";
|
|
85
87
|
import {
|
|
86
88
|
AGENT_TOOL_MAP,
|
|
87
89
|
ORCHESTRATOR_NAME,
|
|
88
90
|
stripKnownSwarmPrefix
|
|
89
|
-
} from "./index-
|
|
91
|
+
} from "./index-123s7kjc.js";
|
|
90
92
|
import"./index-8y7qetpg.js";
|
|
91
93
|
import"./index-adz3nk9b.js";
|
|
92
94
|
import"./index-v4fcn4tr.js";
|
|
@@ -337,6 +339,7 @@ export {
|
|
|
337
339
|
resolveCommand,
|
|
338
340
|
normalizeSwarmCommandInput,
|
|
339
341
|
handleWriteRetroCommand,
|
|
342
|
+
handleUnlinkCommand,
|
|
340
343
|
handleTurboCommand,
|
|
341
344
|
handleSyncPlanCommand,
|
|
342
345
|
handleStatusCommand,
|
|
@@ -359,6 +362,7 @@ export {
|
|
|
359
362
|
handleMemoryImportCommand,
|
|
360
363
|
handleMemoryExportCommand,
|
|
361
364
|
handleMemoryCommand,
|
|
365
|
+
handleLinkCommand,
|
|
362
366
|
handleLearningCommand,
|
|
363
367
|
handleKnowledgeUnactionableCommand,
|
|
364
368
|
handleKnowledgeRetryHardeningCommand,
|
package/dist/cli/index.js
CHANGED
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
getPluginLockFilePaths,
|
|
8
8
|
package_default,
|
|
9
9
|
resolveCommand
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
15
|
-
import"./index-
|
|
10
|
+
} from "./index-9w07ye9b.js";
|
|
11
|
+
import"./index-6tnmt41c.js";
|
|
12
|
+
import"./index-bm4f0nme.js";
|
|
13
|
+
import"./index-1ccnwh54.js";
|
|
14
|
+
import"./index-axwxkbdd.js";
|
|
15
|
+
import"./index-bywt2171.js";
|
|
16
16
|
import {
|
|
17
17
|
DEFAULT_AGENT_CONFIGS
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-123s7kjc.js";
|
|
19
19
|
import"./index-8y7qetpg.js";
|
|
20
20
|
import"./index-adz3nk9b.js";
|
|
21
21
|
import"./index-v4fcn4tr.js";
|
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
retireSkill,
|
|
23
23
|
sanitizeSlug,
|
|
24
24
|
selectCandidateEntries
|
|
25
|
-
} from "./index-
|
|
26
|
-
import"./index-
|
|
25
|
+
} from "./index-1ccnwh54.js";
|
|
26
|
+
import"./index-axwxkbdd.js";
|
|
27
27
|
import"./index-fjwwrwr5.js";
|
|
28
28
|
import"./index-jtqkh8jf.js";
|
|
29
29
|
import"./index-zgwm4ryv.js";
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { handleHandoffCommand } from './handoff';
|
|
|
32
32
|
export { handleHistoryCommand } from './history';
|
|
33
33
|
export { handleKnowledgeListCommand, handleKnowledgeMigrateCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeRetryHardeningCommand, handleKnowledgeUnactionableCommand, } from './knowledge';
|
|
34
34
|
export { handleLearningCommand } from './learning';
|
|
35
|
+
export { handleLinkCommand } from './link';
|
|
35
36
|
export { handleMemoryCommand, handleMemoryExportCommand, handleMemoryImportCommand, handleMemoryMigrateCommand, handleMemoryStatusCommand, } from './memory';
|
|
36
37
|
export { handlePlanCommand } from './plan';
|
|
37
38
|
export { handlePreflightCommand } from './preflight';
|
|
@@ -51,6 +52,7 @@ export { handleStatusCommand } from './status';
|
|
|
51
52
|
export { handleSyncPlanCommand } from './sync-plan';
|
|
52
53
|
export { classifySwarmCommandChatFallbackUse, classifySwarmCommandToolUse, SWARM_COMMAND_TOOL_ALLOWLIST, SWARM_COMMAND_TOOL_COMMANDS, } from './tool-policy.js';
|
|
53
54
|
export { handleTurboCommand } from './turbo';
|
|
55
|
+
export { handleUnlinkCommand } from './unlink';
|
|
54
56
|
export { handleWriteRetroCommand } from './write-retro';
|
|
55
57
|
export declare function buildHelpText(): string;
|
|
56
58
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles the `/swarm link` command.
|
|
3
|
+
*
|
|
4
|
+
* Ties this worktree's swarm knowledge store to a shared "link" store so that
|
|
5
|
+
* several swarms working on the same project (typically separate git worktrees)
|
|
6
|
+
* — or on deliberately "similar" projects — pool their lessons instead of each
|
|
7
|
+
* keeping an isolated `.swarm/knowledge.jsonl`.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* - /swarm link — link using the project hash (ties all worktrees
|
|
11
|
+
* of the same repo to one shared store).
|
|
12
|
+
* - /swarm link <name> — link using an explicit shared name (use the same
|
|
13
|
+
* name in each worktree/repo to tie them together).
|
|
14
|
+
* - /swarm link status — show the current link state for this worktree.
|
|
15
|
+
*
|
|
16
|
+
* On link, this worktree's existing local lessons are merged (deduplicated) into
|
|
17
|
+
* the shared store so nothing already learned is lost.
|
|
18
|
+
*/
|
|
19
|
+
export declare function handleLinkCommand(directory: string, args: string[]): Promise<string>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function handleMemoryCommand(_directory: string, _args: string[]): Promise<string>;
|
|
2
|
+
export declare function handleMemoryConsolidationLogCommand(directory: string, args: string[]): Promise<string>;
|
|
2
3
|
export declare function handleMemoryStatusCommand(directory: string, _args: string[]): Promise<string>;
|
|
3
4
|
export declare function handleMemoryPendingCommand(directory: string, args: string[]): Promise<string>;
|
|
4
5
|
export declare function handleMemoryRecallLogCommand(directory: string, args: string[]): Promise<string>;
|
|
@@ -609,6 +609,29 @@ export declare const COMMAND_REGISTRY: {
|
|
|
609
609
|
readonly category: "config";
|
|
610
610
|
readonly toolPolicy: "none";
|
|
611
611
|
};
|
|
612
|
+
readonly link: {
|
|
613
|
+
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
614
|
+
readonly description: "Tie this worktree to a shared swarm knowledge store [name]";
|
|
615
|
+
readonly details: "Links the current worktree to a shared knowledge store so multiple swarms working on the same project (e.g. separate git worktrees) pool their lessons instead of each keeping an isolated .swarm/knowledge.jsonl. With no name, ties all worktrees of the same repo via the project hash; with a name, ties any worktrees/repos that use the same name. Existing local lessons are merged (deduped) into the shared store. Use `/swarm link status` to inspect.";
|
|
616
|
+
readonly args: "[<name> | status]";
|
|
617
|
+
readonly category: "utility";
|
|
618
|
+
readonly toolPolicy: "none";
|
|
619
|
+
};
|
|
620
|
+
readonly 'link status': {
|
|
621
|
+
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
622
|
+
readonly description: "Show whether this worktree shares knowledge via a link";
|
|
623
|
+
readonly subcommandOf: "link";
|
|
624
|
+
readonly category: "utility";
|
|
625
|
+
readonly toolPolicy: "none";
|
|
626
|
+
};
|
|
627
|
+
readonly unlink: {
|
|
628
|
+
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
629
|
+
readonly description: "Stop sharing swarm knowledge for this worktree [--no-copy]";
|
|
630
|
+
readonly details: "Unlinks the current worktree from its shared knowledge store and returns it to a local .swarm/knowledge.jsonl. By default the shared lessons are copied back into the local store (deduped) so nothing is lost; pass --no-copy to skip the copy-back.";
|
|
631
|
+
readonly args: "[--no-copy]";
|
|
632
|
+
readonly category: "utility";
|
|
633
|
+
readonly toolPolicy: "none";
|
|
634
|
+
};
|
|
612
635
|
readonly promote: {
|
|
613
636
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
614
637
|
readonly description: "Manually promote lesson to hive knowledge";
|
|
@@ -816,6 +839,14 @@ export declare const COMMAND_REGISTRY: {
|
|
|
816
839
|
readonly category: "utility";
|
|
817
840
|
readonly toolPolicy: "human-only";
|
|
818
841
|
};
|
|
842
|
+
readonly 'memory consolidation-log': {
|
|
843
|
+
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
844
|
+
readonly description: "Summarize recent memory consolidation passes and metrics";
|
|
845
|
+
readonly subcommandOf: "memory";
|
|
846
|
+
readonly args: "--limit <n>";
|
|
847
|
+
readonly category: "diagnostics";
|
|
848
|
+
readonly toolPolicy: "agent";
|
|
849
|
+
};
|
|
819
850
|
readonly 'memory-status': {
|
|
820
851
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
821
852
|
readonly description: "Show Swarm memory provider, JSONL, and migration status";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles the `/swarm unlink` command.
|
|
3
|
+
*
|
|
4
|
+
* Stops sharing this worktree's swarm knowledge with its link store and returns
|
|
5
|
+
* it to a local `.swarm/knowledge.jsonl`. By default the shared lessons are
|
|
6
|
+
* copied back into the local store (deduplicated) so the worktree keeps the
|
|
7
|
+
* pooled knowledge it had access to; pass `--no-copy` to skip the copy-back.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* - /swarm unlink — unlink and copy shared lessons back to local.
|
|
11
|
+
* - /swarm unlink --no-copy — unlink without copying shared lessons back.
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleUnlinkCommand(directory: string, args: string[]): Promise<string>;
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
export declare const QA_AGENTS: readonly ["reviewer", "critic", "critic_oversight"];
|
|
13
13
|
export declare const PIPELINE_AGENTS: readonly ["explorer", "coder", "test_engineer"];
|
|
14
14
|
export declare const ORCHESTRATOR_NAME: "architect";
|
|
15
|
-
export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "researcher", "docs", "docs_design", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "critic_architecture_supervisor", "curator_init", "curator_phase", "curator_postmortem", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
|
|
16
|
-
export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "researcher", "docs", "docs_design", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "critic_architecture_supervisor", "curator_init", "curator_phase", "curator_postmortem", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
|
|
15
|
+
export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "researcher", "docs", "docs_design", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "critic_architecture_supervisor", "curator_init", "curator_phase", "curator_postmortem", "curator_consolidation", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
|
|
16
|
+
export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "researcher", "docs", "docs_design", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "critic_architecture_supervisor", "curator_init", "curator_phase", "curator_postmortem", "curator_consolidation", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
|
|
17
17
|
export type QAAgentName = (typeof QA_AGENTS)[number];
|
|
18
18
|
export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
|
|
19
19
|
export type AgentName = (typeof ALL_AGENT_NAMES)[number];
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -632,6 +632,36 @@ export declare const MemoryConfigSchema: z.ZodObject<{
|
|
|
632
632
|
maintenance: z.ZodDefault<z.ZodObject<{
|
|
633
633
|
lowUtilityMaxConfidence: z.ZodDefault<z.ZodNumber>;
|
|
634
634
|
lowUtilityMinAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
635
|
+
importance: z.ZodDefault<z.ZodObject<{
|
|
636
|
+
wRecency: z.ZodDefault<z.ZodNumber>;
|
|
637
|
+
wFrequency: z.ZodDefault<z.ZodNumber>;
|
|
638
|
+
wFreshness: z.ZodDefault<z.ZodNumber>;
|
|
639
|
+
wConfidence: z.ZodDefault<z.ZodNumber>;
|
|
640
|
+
lambda: z.ZodDefault<z.ZodNumber>;
|
|
641
|
+
mu: z.ZodDefault<z.ZodNumber>;
|
|
642
|
+
n: z.ZodDefault<z.ZodNumber>;
|
|
643
|
+
threshold: z.ZodDefault<z.ZodNumber>;
|
|
644
|
+
}, z.core.$strip>>;
|
|
645
|
+
}, z.core.$strip>>;
|
|
646
|
+
consolidation: z.ZodDefault<z.ZodObject<{
|
|
647
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
648
|
+
maxClustersPerPass: z.ZodDefault<z.ZodNumber>;
|
|
649
|
+
jaccardThreshold: z.ZodDefault<z.ZodNumber>;
|
|
650
|
+
autoApplyMinConfidence: z.ZodDefault<z.ZodNumber>;
|
|
651
|
+
decayHalfLifeDays: z.ZodDefault<z.ZodObject<{
|
|
652
|
+
user_preference: z.ZodDefault<z.ZodNumber>;
|
|
653
|
+
project_fact: z.ZodDefault<z.ZodNumber>;
|
|
654
|
+
architecture_decision: z.ZodDefault<z.ZodNumber>;
|
|
655
|
+
repo_convention: z.ZodDefault<z.ZodNumber>;
|
|
656
|
+
api_finding: z.ZodDefault<z.ZodNumber>;
|
|
657
|
+
code_pattern: z.ZodDefault<z.ZodNumber>;
|
|
658
|
+
test_pattern: z.ZodDefault<z.ZodNumber>;
|
|
659
|
+
failure_pattern: z.ZodDefault<z.ZodNumber>;
|
|
660
|
+
security_note: z.ZodDefault<z.ZodNumber>;
|
|
661
|
+
evidence: z.ZodDefault<z.ZodNumber>;
|
|
662
|
+
todo: z.ZodDefault<z.ZodNumber>;
|
|
663
|
+
scratch: z.ZodDefault<z.ZodNumber>;
|
|
664
|
+
}, z.core.$strip>>;
|
|
635
665
|
}, z.core.$strip>>;
|
|
636
666
|
hardDelete: z.ZodDefault<z.ZodBoolean>;
|
|
637
667
|
}, z.core.$strip>;
|
|
@@ -1747,6 +1777,36 @@ export declare const PluginConfigSchema: z.ZodObject<{
|
|
|
1747
1777
|
maintenance: z.ZodDefault<z.ZodObject<{
|
|
1748
1778
|
lowUtilityMaxConfidence: z.ZodDefault<z.ZodNumber>;
|
|
1749
1779
|
lowUtilityMinAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
1780
|
+
importance: z.ZodDefault<z.ZodObject<{
|
|
1781
|
+
wRecency: z.ZodDefault<z.ZodNumber>;
|
|
1782
|
+
wFrequency: z.ZodDefault<z.ZodNumber>;
|
|
1783
|
+
wFreshness: z.ZodDefault<z.ZodNumber>;
|
|
1784
|
+
wConfidence: z.ZodDefault<z.ZodNumber>;
|
|
1785
|
+
lambda: z.ZodDefault<z.ZodNumber>;
|
|
1786
|
+
mu: z.ZodDefault<z.ZodNumber>;
|
|
1787
|
+
n: z.ZodDefault<z.ZodNumber>;
|
|
1788
|
+
threshold: z.ZodDefault<z.ZodNumber>;
|
|
1789
|
+
}, z.core.$strip>>;
|
|
1790
|
+
}, z.core.$strip>>;
|
|
1791
|
+
consolidation: z.ZodDefault<z.ZodObject<{
|
|
1792
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1793
|
+
maxClustersPerPass: z.ZodDefault<z.ZodNumber>;
|
|
1794
|
+
jaccardThreshold: z.ZodDefault<z.ZodNumber>;
|
|
1795
|
+
autoApplyMinConfidence: z.ZodDefault<z.ZodNumber>;
|
|
1796
|
+
decayHalfLifeDays: z.ZodDefault<z.ZodObject<{
|
|
1797
|
+
user_preference: z.ZodDefault<z.ZodNumber>;
|
|
1798
|
+
project_fact: z.ZodDefault<z.ZodNumber>;
|
|
1799
|
+
architecture_decision: z.ZodDefault<z.ZodNumber>;
|
|
1800
|
+
repo_convention: z.ZodDefault<z.ZodNumber>;
|
|
1801
|
+
api_finding: z.ZodDefault<z.ZodNumber>;
|
|
1802
|
+
code_pattern: z.ZodDefault<z.ZodNumber>;
|
|
1803
|
+
test_pattern: z.ZodDefault<z.ZodNumber>;
|
|
1804
|
+
failure_pattern: z.ZodDefault<z.ZodNumber>;
|
|
1805
|
+
security_note: z.ZodDefault<z.ZodNumber>;
|
|
1806
|
+
evidence: z.ZodDefault<z.ZodNumber>;
|
|
1807
|
+
todo: z.ZodDefault<z.ZodNumber>;
|
|
1808
|
+
scratch: z.ZodDefault<z.ZodNumber>;
|
|
1809
|
+
}, z.core.$strip>>;
|
|
1750
1810
|
}, z.core.$strip>>;
|
|
1751
1811
|
hardDelete: z.ZodDefault<z.ZodBoolean>;
|
|
1752
1812
|
}, z.core.$strip>>;
|
|
@@ -18,4 +18,4 @@ import type { CuratorLLMDelegate } from './curator.js';
|
|
|
18
18
|
*
|
|
19
19
|
* Returns undefined if swarmState.opencodeClient is not set (e.g. in unit tests).
|
|
20
20
|
*/
|
|
21
|
-
export declare function createCuratorLLMDelegate(directory: string, mode?: 'init' | 'phase' | 'postmortem', sessionId?: string): CuratorLLMDelegate | undefined;
|
|
21
|
+
export declare function createCuratorLLMDelegate(directory: string, mode?: 'init' | 'phase' | 'postmortem' | 'consolidation', sessionId?: string): CuratorLLMDelegate | undefined;
|