opencode-swarm 7.116.1 → 7.118.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/cli/{config-doctor-htzxe394.js → config-doctor-p73yfdz0.js} +2 -2
- package/dist/cli/{curator-yxmtp8py.js → curator-920swpnk.js} +10 -10
- package/dist/cli/{curator-llm-factory-9qn52fnv.js → curator-llm-factory-kqt1f4sw.js} +10 -10
- package/dist/cli/{guardrail-explain-xvyz2eag.js → guardrail-explain-bycz51b0.js} +11 -11
- package/dist/cli/{guardrail-log-dzbqcgz9.js → guardrail-log-qjqgg7pz.js} +3 -3
- package/dist/cli/{hive-promoter-ykqc60w1.js → hive-promoter-w9pgfs6w.js} +15 -10
- package/dist/cli/{index-m7hc7nn7.js → index-11q1t6g0.js} +1 -1
- package/dist/cli/{index-7kcpkm4y.js → index-34tsqvqb.js} +2527 -1354
- package/dist/cli/{index-efdyjgeh.js → index-470tykwx.js} +2 -2
- package/dist/cli/{index-g4p13g8t.js → index-5hze8ztj.js} +12 -22
- package/dist/cli/{index-m43zgtjn.js → index-bcg89pt8.js} +1 -1
- package/dist/cli/{index-8j5d3ytd.js → index-g2wrs7jy.js} +1 -1
- package/dist/cli/{index-wegc6xwr.js → index-jbdgpqpj.js} +3 -3
- package/dist/cli/{index-p9jf8gt8.js → index-k83hebh1.js} +12 -12
- package/dist/cli/{index-nvc0nsvg.js → index-pdk1n8yh.js} +2 -0
- package/dist/cli/{index-t5f01hnz.js → index-pjhfe7c3.js} +2 -2
- package/dist/cli/{index-5h7d37nf.js → index-qx5z58a7.js} +19 -31
- package/dist/cli/{index-wxkf3089.js → index-sb9x6xjj.js} +3 -3
- package/dist/cli/{index-34g1mv3c.js → index-wpgv6hht.js} +52 -6
- package/dist/cli/index.js +10 -10
- package/dist/cli/{knowledge-escalator-tthw6c9q.js → knowledge-escalator-gt1q632m.js} +4 -4
- package/dist/cli/{knowledge-events-hrbmwxxj.js → knowledge-events-0bjdtdsb.js} +2 -2
- package/dist/cli/{knowledge-store-5cns5sns.js → knowledge-store-fm2300xf.js} +7 -2
- package/dist/cli/{knowledge-validator-xre0s774.js → knowledge-validator-91kx3eqv.js} +3 -3
- package/dist/cli/{schema-bqn7g3ez.js → schema-7c484wjz.js} +1 -1
- package/dist/cli/{skill-generator-22nk6c6a.js → skill-generator-t47xyfps.js} +5 -5
- package/dist/commands/link.d.ts +7 -4
- package/dist/commands/promote.d.ts +3 -0
- package/dist/commands/registry.d.ts +2 -2
- package/dist/commands/unlink.d.ts +12 -5
- package/dist/config/schema.d.ts +8 -4
- package/dist/hooks/curator-postmortem.d.ts +1 -1
- package/dist/hooks/hive-policy.d.ts +81 -0
- package/dist/hooks/hive-promoter.d.ts +147 -28
- package/dist/hooks/hive-transaction.d.ts +113 -0
- package/dist/hooks/knowledge-events.d.ts +4 -1
- package/dist/hooks/knowledge-link.d.ts +31 -4
- package/dist/hooks/knowledge-store.d.ts +6 -5
- package/dist/hooks/knowledge-types.d.ts +87 -0
- package/dist/index.js +343 -325
- package/dist/knowledge/cohort-identity.d.ts +103 -0
- package/dist/knowledge/config-fingerprint.d.ts +57 -0
- package/dist/knowledge/family-manifest.d.ts +50 -0
- package/dist/knowledge/family-migration.d.ts +109 -0
- package/dist/knowledge/hive-paths.d.ts +51 -0
- package/dist/knowledge/identity.d.ts +12 -2
- package/dist/knowledge/index.d.ts +1 -0
- package/dist/services/knowledge-diagnostics.d.ts +45 -0
- package/dist/services/status-service.d.ts +13 -0
- package/package.json +1 -1
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
detectPosixWrites,
|
|
13
13
|
detectWindowsWrites,
|
|
14
14
|
resolveWriteTargets
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-34tsqvqb.js";
|
|
16
16
|
import {
|
|
17
17
|
checkFileAuthority,
|
|
18
18
|
classifyFile,
|
|
19
19
|
isInDeclaredScope,
|
|
20
20
|
redactPath,
|
|
21
21
|
redactShellCommand
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-g2wrs7jy.js";
|
|
23
23
|
|
|
24
24
|
// src/services/guardrail-explain-service.ts
|
|
25
25
|
import path from "path";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
+
resolveHiveEventsPath,
|
|
3
4
|
resolveKnowledgeStoreDir
|
|
4
|
-
} from "./index-
|
|
5
|
+
} from "./index-wpgv6hht.js";
|
|
5
6
|
import {
|
|
6
7
|
init_logger,
|
|
7
8
|
warn
|
|
@@ -22,7 +23,6 @@ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
|
22
23
|
import { randomUUID } from "crypto";
|
|
23
24
|
import { existsSync } from "fs";
|
|
24
25
|
import { appendFile, mkdir, readFile, stat } from "fs/promises";
|
|
25
|
-
import * as os from "os";
|
|
26
26
|
import * as path from "path";
|
|
27
27
|
init_logger();
|
|
28
28
|
var KNOWLEDGE_EVENT_SCHEMA_VERSION = 1;
|
|
@@ -44,19 +44,7 @@ function resolveKnowledgeEventsPath(directory) {
|
|
|
44
44
|
function resolveKnowledgeCounterBaselinePath(directory) {
|
|
45
45
|
return path.join(resolveKnowledgeStoreDir(directory), "knowledge-counter-baseline.json");
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
const platform = process.platform;
|
|
49
|
-
const home = process.env.HOME || os.homedir();
|
|
50
|
-
let dir;
|
|
51
|
-
if (platform === "win32") {
|
|
52
|
-
dir = path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "opencode-swarm", "Data");
|
|
53
|
-
} else if (platform === "darwin") {
|
|
54
|
-
dir = path.join(home, "Library", "Application Support", "opencode-swarm");
|
|
55
|
-
} else {
|
|
56
|
-
dir = path.join(process.env.XDG_DATA_HOME || path.join(home, ".local", "share"), "opencode-swarm");
|
|
57
|
-
}
|
|
58
|
-
return path.join(dir, "shared-knowledge-events.jsonl");
|
|
59
|
-
}
|
|
47
|
+
var resolveHiveEventsPath2 = resolveHiveEventsPath;
|
|
60
48
|
function resolveLegacyApplicationLogPath(directory) {
|
|
61
49
|
return path.join(resolveKnowledgeStoreDir(directory), "knowledge-application.jsonl");
|
|
62
50
|
}
|
|
@@ -117,13 +105,14 @@ async function recordKnowledgeEvent(directory, event) {
|
|
|
117
105
|
}
|
|
118
106
|
async function appendHiveKnowledgeEvent(event) {
|
|
119
107
|
const populated = withDefaults(event);
|
|
120
|
-
const filePath =
|
|
108
|
+
const filePath = resolveHiveEventsPath2();
|
|
121
109
|
const dirPath = path.dirname(filePath);
|
|
122
110
|
await mkdir(dirPath, { recursive: true });
|
|
123
111
|
let release;
|
|
124
112
|
try {
|
|
125
113
|
release = await import_proper_lockfile.default.lock(dirPath, {
|
|
126
|
-
retries: { retries: 200, minTimeout: 10, maxTimeout: 100 }
|
|
114
|
+
retries: { retries: 200, minTimeout: 10, maxTimeout: 100 },
|
|
115
|
+
stale: 5000
|
|
127
116
|
});
|
|
128
117
|
await appendFile(filePath, `${JSON.stringify(populated)}
|
|
129
118
|
`, "utf-8");
|
|
@@ -177,7 +166,7 @@ async function readKnowledgeEvents(directory, maxEvents) {
|
|
|
177
166
|
return out;
|
|
178
167
|
}
|
|
179
168
|
async function readHiveKnowledgeEvents() {
|
|
180
|
-
const filePath =
|
|
169
|
+
const filePath = resolveHiveEventsPath2();
|
|
181
170
|
if (!existsSync(filePath))
|
|
182
171
|
return [];
|
|
183
172
|
const content = await readFile(filePath, "utf-8");
|
|
@@ -594,7 +583,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
|
594
583
|
deltas.push({ id, delta });
|
|
595
584
|
}
|
|
596
585
|
if (deltas.length > 0) {
|
|
597
|
-
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-
|
|
586
|
+
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-fm2300xf.js");
|
|
598
587
|
await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
599
588
|
}
|
|
600
589
|
return {
|
|
@@ -622,10 +611,11 @@ var _internals = {
|
|
|
622
611
|
applyKnowledgeVerdictFeedback,
|
|
623
612
|
newTraceId,
|
|
624
613
|
newEventId,
|
|
625
|
-
resolveHiveEventsPath,
|
|
614
|
+
resolveHiveEventsPath: resolveHiveEventsPath2,
|
|
626
615
|
appendHiveKnowledgeEvent,
|
|
627
616
|
recordHiveKnowledgeEvent,
|
|
628
|
-
readHiveKnowledgeEvents
|
|
617
|
+
readHiveKnowledgeEvents,
|
|
618
|
+
mergeRollupInto
|
|
629
619
|
};
|
|
630
620
|
|
|
631
|
-
export { KNOWLEDGE_EVENT_SCHEMA_VERSION, MAX_EVENT_LOG_ENTRIES, RECEIPT_EVENT_TYPES, resolveKnowledgeEventsPath, resolveKnowledgeCounterBaselinePath, resolveHiveEventsPath, resolveLegacyApplicationLogPath, newTraceId, newEventId, appendKnowledgeEvent, recordKnowledgeEvent, appendHiveKnowledgeEvent, recordHiveKnowledgeEvent, readKnowledgeEvents, readHiveKnowledgeEvents, readLegacyApplicationRecords, MAX_VIOLATION_TIMESTAMPS, recomputeCounters, countViolationsInWindow, countEntryViolationsInWindow, countEntryContradictionsInWindow, readKnowledgeCounterRollups, effectiveRetrievalOutcomes, applyKnowledgeVerdictFeedback, _internals };
|
|
621
|
+
export { KNOWLEDGE_EVENT_SCHEMA_VERSION, MAX_EVENT_LOG_ENTRIES, RECEIPT_EVENT_TYPES, resolveKnowledgeEventsPath, resolveKnowledgeCounterBaselinePath, resolveHiveEventsPath2 as resolveHiveEventsPath, resolveLegacyApplicationLogPath, newTraceId, newEventId, appendKnowledgeEvent, recordKnowledgeEvent, appendHiveKnowledgeEvent, recordHiveKnowledgeEvent, readKnowledgeEvents, readHiveKnowledgeEvents, readLegacyApplicationRecords, MAX_VIOLATION_TIMESTAMPS, recomputeCounters, countViolationsInWindow, countEntryViolationsInWindow, countEntryContradictionsInWindow, readKnowledgeCounterRollups, effectiveRetrievalOutcomes, applyKnowledgeVerdictFeedback, _internals };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
countEntryViolationsInWindow,
|
|
5
5
|
readKnowledgeEvents,
|
|
6
6
|
recordKnowledgeEvent
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-5hze8ztj.js";
|
|
8
8
|
import {
|
|
9
9
|
jaccardBigram,
|
|
10
10
|
readKnowledge,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveSwarmKnowledgePath,
|
|
13
13
|
transactKnowledge,
|
|
14
14
|
wordBigrams
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-qx5z58a7.js";
|
|
16
16
|
import {
|
|
17
17
|
isActiveStatus
|
|
18
18
|
} from "./index-bfwt3abw.js";
|
|
@@ -188,7 +188,7 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
188
188
|
alreadyInactive: true
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
191
|
+
const { quarantineEntry } = await import("./knowledge-validator-91kx3eqv.js");
|
|
192
192
|
await quarantineEntry(directory, entryId, `repeat_contradiction: ${count} contradicted events in ${windowDays}d`, "auto");
|
|
193
193
|
return { quarantined: true, entryId, contradictionsInWindow: count };
|
|
194
194
|
} catch {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-470tykwx.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-bcg89pt8.js";
|
|
8
8
|
import {
|
|
9
9
|
COMMAND_REGISTRY,
|
|
10
10
|
SWARM_COMMAND_TOOL_ALLOWLIST,
|
|
@@ -83,27 +83,27 @@ import {
|
|
|
83
83
|
handleWriteRetroCommand,
|
|
84
84
|
normalizeSwarmCommandInput,
|
|
85
85
|
resolveCommand
|
|
86
|
-
} from "./index-
|
|
86
|
+
} from "./index-34tsqvqb.js";
|
|
87
87
|
import"./index-nprawcc0.js";
|
|
88
|
-
import"./index-
|
|
88
|
+
import"./index-g2wrs7jy.js";
|
|
89
89
|
import"./index-c8s9a3zh.js";
|
|
90
|
-
import"./index-
|
|
90
|
+
import"./index-11q1t6g0.js";
|
|
91
91
|
import {
|
|
92
92
|
AGENT_TOOL_MAP,
|
|
93
93
|
ORCHESTRATOR_NAME,
|
|
94
94
|
stripKnownSwarmPrefix
|
|
95
|
-
} from "./index-
|
|
95
|
+
} from "./index-pdk1n8yh.js";
|
|
96
96
|
import"./index-xdsd2hma.js";
|
|
97
97
|
import"./index-scww5b77.js";
|
|
98
98
|
import"./index-4905hd2m.js";
|
|
99
99
|
import"./index-5bcrp3bc.js";
|
|
100
|
-
import"./index-
|
|
101
|
-
import"./index-
|
|
102
|
-
import"./index-
|
|
103
|
-
import"./index-
|
|
104
|
-
import"./index-
|
|
100
|
+
import"./index-sb9x6xjj.js";
|
|
101
|
+
import"./index-pjhfe7c3.js";
|
|
102
|
+
import"./index-jbdgpqpj.js";
|
|
103
|
+
import"./index-5hze8ztj.js";
|
|
104
|
+
import"./index-qx5z58a7.js";
|
|
105
105
|
import"./index-bfwt3abw.js";
|
|
106
|
-
import"./index-
|
|
106
|
+
import"./index-wpgv6hht.js";
|
|
107
107
|
import"./index-vxv732ex.js";
|
|
108
108
|
import"./index-8fwhhayc.js";
|
|
109
109
|
import"./index-q1exe2b3.js";
|
|
@@ -1559,6 +1559,8 @@ var KnowledgeConfigSchema = exports_external.object({
|
|
|
1559
1559
|
contradiction_quarantine_window_days: exports_external.number().int().positive().default(30),
|
|
1560
1560
|
promoted_demotion_min_negative_phases: exports_external.number().int().positive().default(3),
|
|
1561
1561
|
promoted_demotion_signal_threshold: exports_external.number().min(-1).max(1).default(OUTCOME_BLOCK_THRESHOLD),
|
|
1562
|
+
promotion_min_terminal_applications: exports_external.number().min(0).max(100).default(0),
|
|
1563
|
+
promotion_min_distinct_cohorts: exports_external.number().min(0).max(50).default(0),
|
|
1562
1564
|
realtime_learning_nudge: exports_external.object({
|
|
1563
1565
|
enabled: exports_external.boolean().default(true),
|
|
1564
1566
|
first_after_tool_calls: exports_external.number().int().min(1).max(1000).default(10),
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
resolveSwarmKnowledgePath,
|
|
7
7
|
resolveSwarmRejectedPath,
|
|
8
8
|
transactKnowledge
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-qx5z58a7.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveKnowledgeStoreDir
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-wpgv6hht.js";
|
|
13
13
|
import {
|
|
14
14
|
init_logger,
|
|
15
15
|
warn
|
|
@@ -3,8 +3,11 @@ import {
|
|
|
3
3
|
isActiveStatus
|
|
4
4
|
} from "./index-bfwt3abw.js";
|
|
5
5
|
import {
|
|
6
|
+
resolveHiveEventsPath,
|
|
7
|
+
resolveHiveKnowledgePath,
|
|
8
|
+
resolveHiveRejectedPath,
|
|
6
9
|
resolveKnowledgeStoreDir
|
|
7
|
-
} from "./index-
|
|
10
|
+
} from "./index-wpgv6hht.js";
|
|
8
11
|
import {
|
|
9
12
|
init_logger,
|
|
10
13
|
log
|
|
@@ -87,27 +90,9 @@ function resolveSwarmRejectedPath(directory) {
|
|
|
87
90
|
function resolveSwarmRetractionsPath(directory) {
|
|
88
91
|
return path.join(resolveKnowledgeStoreDir(directory), "knowledge-retractions.jsonl");
|
|
89
92
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
let dataDir;
|
|
94
|
-
if (platform === "win32") {
|
|
95
|
-
dataDir = path.join(process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"), "opencode-swarm", "Data");
|
|
96
|
-
} else if (platform === "darwin") {
|
|
97
|
-
dataDir = path.join(home, "Library", "Application Support", "opencode-swarm");
|
|
98
|
-
} else {
|
|
99
|
-
dataDir = path.join(process.env.XDG_DATA_HOME || path.join(home, ".local", "share"), "opencode-swarm");
|
|
100
|
-
}
|
|
101
|
-
return path.join(dataDir, "shared-learnings.jsonl");
|
|
102
|
-
}
|
|
103
|
-
function resolveHiveRejectedPath() {
|
|
104
|
-
const hivePath = resolveHiveKnowledgePath();
|
|
105
|
-
return path.join(path.dirname(hivePath), "shared-learnings-rejected.jsonl");
|
|
106
|
-
}
|
|
107
|
-
function resolveHiveEventsPath() {
|
|
108
|
-
const hivePath = resolveHiveKnowledgePath();
|
|
109
|
-
return path.join(path.dirname(hivePath), "shared-knowledge-events.jsonl");
|
|
110
|
-
}
|
|
93
|
+
var resolveHiveKnowledgePath2 = resolveHiveKnowledgePath;
|
|
94
|
+
var resolveHiveRejectedPath2 = resolveHiveRejectedPath;
|
|
95
|
+
var resolveHiveEventsPath2 = resolveHiveEventsPath;
|
|
111
96
|
function parseKnowledgeContent(content, max) {
|
|
112
97
|
const results = [];
|
|
113
98
|
for (const line of content.split(`
|
|
@@ -189,6 +174,9 @@ function normalizeEntry(raw) {
|
|
|
189
174
|
if (typeof obj.recent_negative_phase_count !== "number") {
|
|
190
175
|
obj.recent_negative_phase_count = 0;
|
|
191
176
|
}
|
|
177
|
+
if (!Array.isArray(obj.confirmed_by)) {
|
|
178
|
+
obj.confirmed_by = [];
|
|
179
|
+
}
|
|
192
180
|
const arrayFields = [
|
|
193
181
|
"triggers",
|
|
194
182
|
"required_actions",
|
|
@@ -310,7 +298,7 @@ async function getArchivedKnowledgeIds(directory) {
|
|
|
310
298
|
} catch {}
|
|
311
299
|
}
|
|
312
300
|
} catch {}
|
|
313
|
-
const hivePath =
|
|
301
|
+
const hivePath = resolveHiveKnowledgePath2();
|
|
314
302
|
try {
|
|
315
303
|
const content = await readFile(hivePath, "utf-8");
|
|
316
304
|
const lines = content.split(`
|
|
@@ -567,7 +555,7 @@ async function bumpKnowledgeConfidenceBatch(directory, deltas, options) {
|
|
|
567
555
|
if (deltas.length === 0)
|
|
568
556
|
return;
|
|
569
557
|
const swarmPath = resolveSwarmKnowledgePath(directory);
|
|
570
|
-
const hivePath =
|
|
558
|
+
const hivePath = resolveHiveKnowledgePath2();
|
|
571
559
|
const touchedSwarm = [];
|
|
572
560
|
const touchedHive = [];
|
|
573
561
|
try {
|
|
@@ -595,7 +583,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
595
583
|
const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
|
|
596
584
|
if (atFloor.length === 0 && recovered.length === 0)
|
|
597
585
|
return;
|
|
598
|
-
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-
|
|
586
|
+
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-0bjdtdsb.js");
|
|
599
587
|
const rollups = await readKnowledgeCounterRollups(directory);
|
|
600
588
|
const flagIds = new Set;
|
|
601
589
|
for (const e of atFloor) {
|
|
@@ -611,7 +599,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
611
599
|
if (flagIds.size === 0)
|
|
612
600
|
return;
|
|
613
601
|
const swarmPath = resolveSwarmKnowledgePath(directory);
|
|
614
|
-
const hivePath =
|
|
602
|
+
const hivePath = resolveHiveKnowledgePath2();
|
|
615
603
|
const toQuarantine = [];
|
|
616
604
|
await transactKnowledge(swarmPath, (swarmEntries) => {
|
|
617
605
|
const now = new Date().toISOString();
|
|
@@ -662,7 +650,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
662
650
|
});
|
|
663
651
|
}
|
|
664
652
|
if (action === "quarantine" && toQuarantine.length > 0) {
|
|
665
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
653
|
+
const { quarantineEntry } = await import("./knowledge-validator-91kx3eqv.js");
|
|
666
654
|
for (const { id } of toQuarantine) {
|
|
667
655
|
await quarantineEntry(directory, id, "confidence_floor_negative_outcome", "auto").catch((err) => {
|
|
668
656
|
log("[knowledge-store] confidence-floor quarantine failed (best-effort):", err instanceof Error ? err.message : String(err));
|
|
@@ -720,9 +708,9 @@ var _internals = {
|
|
|
720
708
|
getPlatformConfigDir,
|
|
721
709
|
resolveSwarmKnowledgePath,
|
|
722
710
|
resolveSwarmRejectedPath,
|
|
723
|
-
resolveHiveKnowledgePath,
|
|
724
|
-
resolveHiveRejectedPath,
|
|
725
|
-
resolveHiveEventsPath,
|
|
711
|
+
resolveHiveKnowledgePath: resolveHiveKnowledgePath2,
|
|
712
|
+
resolveHiveRejectedPath: resolveHiveRejectedPath2,
|
|
713
|
+
resolveHiveEventsPath: resolveHiveEventsPath2,
|
|
726
714
|
readKnowledge,
|
|
727
715
|
parseKnowledgeContent,
|
|
728
716
|
readRejectedLessons,
|
|
@@ -745,4 +733,4 @@ var _internals = {
|
|
|
745
733
|
getArchivedKnowledgeIds
|
|
746
734
|
};
|
|
747
735
|
|
|
748
|
-
export { findActiveSwarmNearDuplicate, reinforceSwarmKnowledgeEntry, getPlatformConfigDir, resolveSwarmKnowledgePath, resolveSwarmRejectedPath, resolveSwarmRetractionsPath, resolveHiveKnowledgePath, resolveHiveRejectedPath, resolveHiveEventsPath, readKnowledge, normalizeEntry, readRejectedLessons, readRetractionRecords, appendRetractionRecord, appendKnowledge, rewriteKnowledge, transactFile, transactKnowledge, getArchivedKnowledgeIds, appendKnowledgeWithCapEnforcement, enforceKnowledgeCap, sweepAgedEntries, sweepStaleTodos, appendRejectedLesson, normalize, wordBigrams, jaccardBigram, findNearDuplicate, computeConfidence, MAX_CONFIRMED_BY, confirmEntriesPhase, OUTCOME_SIGNAL_SMOOTHING, computeOutcomeSignal, inferTags, bumpKnowledgeConfidenceBatch, _internals };
|
|
736
|
+
export { findActiveSwarmNearDuplicate, reinforceSwarmKnowledgeEntry, getPlatformConfigDir, resolveSwarmKnowledgePath, resolveSwarmRejectedPath, resolveSwarmRetractionsPath, resolveHiveKnowledgePath2 as resolveHiveKnowledgePath, resolveHiveRejectedPath2 as resolveHiveRejectedPath, resolveHiveEventsPath2 as resolveHiveEventsPath, readKnowledge, normalizeEntry, readRejectedLessons, readRetractionRecords, appendRetractionRecord, appendKnowledge, rewriteKnowledge, transactFile, transactKnowledge, getArchivedKnowledgeIds, appendKnowledgeWithCapEnforcement, enforceKnowledgeCap, selectKnowledgeCapSurvivors, sweepAgedEntries, sweepStaleTodos, appendRejectedLesson, normalize, wordBigrams, jaccardBigram, findNearDuplicate, computeConfidence, MAX_CONFIRMED_BY, confirmEntriesPhase, OUTCOME_SIGNAL_SMOOTHING, computeOutcomeSignal, inferTags, bumpKnowledgeConfidenceBatch, _internals };
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ALLOWED_SKILL_PATH_PREFIXES,
|
|
4
4
|
validateSkillPath
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-pjhfe7c3.js";
|
|
6
6
|
import {
|
|
7
7
|
effectiveRetrievalOutcomes,
|
|
8
8
|
readKnowledgeCounterRollups
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-5hze8ztj.js";
|
|
10
10
|
import {
|
|
11
11
|
computeOutcomeSignal,
|
|
12
12
|
readKnowledge,
|
|
13
13
|
resolveHiveKnowledgePath,
|
|
14
14
|
resolveSwarmKnowledgePath,
|
|
15
15
|
transactKnowledge
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-qx5z58a7.js";
|
|
17
17
|
import {
|
|
18
18
|
isActiveStatus
|
|
19
19
|
} from "./index-bfwt3abw.js";
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
lstatSync,
|
|
14
14
|
mkdirSync,
|
|
15
15
|
readFileSync,
|
|
16
|
-
rmSync
|
|
16
|
+
rmSync,
|
|
17
|
+
statSync
|
|
17
18
|
} from "fs";
|
|
18
19
|
import * as os from "os";
|
|
19
20
|
import * as path from "path";
|
|
@@ -93,12 +94,19 @@ function readLinkPointer(directory) {
|
|
|
93
94
|
const safeId = sanitizeLinkId(linkId);
|
|
94
95
|
if (!safeId)
|
|
95
96
|
return null;
|
|
97
|
+
const rawVersion = obj.version;
|
|
98
|
+
const version = rawVersion === 2 ? 2 : 1;
|
|
96
99
|
return {
|
|
97
|
-
version
|
|
100
|
+
version,
|
|
98
101
|
linkId: safeId,
|
|
99
102
|
name: typeof obj.name === "string" ? obj.name : undefined,
|
|
100
103
|
createdAt: typeof obj.createdAt === "string" ? obj.createdAt : new Date(0).toISOString(),
|
|
101
|
-
source: obj.source === "auto" ? "auto" : "manual"
|
|
104
|
+
source: obj.source === "auto" ? "auto" : "manual",
|
|
105
|
+
cohortId: typeof obj.cohortId === "string" ? obj.cohortId : undefined,
|
|
106
|
+
identitySource: obj.identitySource === "remote" || obj.identitySource === "git-common-dir" || obj.identitySource === "path" ? obj.identitySource : undefined,
|
|
107
|
+
degraded: typeof obj.degraded === "boolean" ? obj.degraded : undefined,
|
|
108
|
+
configFingerprint: typeof obj.configFingerprint === "string" ? obj.configFingerprint : undefined,
|
|
109
|
+
generation: typeof obj.generation === "number" ? obj.generation : undefined
|
|
102
110
|
};
|
|
103
111
|
} catch {
|
|
104
112
|
return null;
|
|
@@ -170,11 +178,21 @@ async function removeLinkPointer(directory) {
|
|
|
170
178
|
}
|
|
171
179
|
}
|
|
172
180
|
var _resolutionCache = new Map;
|
|
181
|
+
function pointerStatFingerprint(directory) {
|
|
182
|
+
const pointerPath = resolveLinkPointerPath(directory);
|
|
183
|
+
try {
|
|
184
|
+
const st = statSync(pointerPath);
|
|
185
|
+
return `${st.mtimeMs}:${st.ctimeMs}:${st.size}`;
|
|
186
|
+
} catch {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
173
190
|
function resolveKnowledgeStoreDir(directory) {
|
|
174
191
|
const localSwarm = path.join(directory, ".swarm");
|
|
175
192
|
const now = Date.now();
|
|
176
193
|
const cached = _resolutionCache.get(directory);
|
|
177
|
-
|
|
194
|
+
const currentStat = pointerStatFingerprint(directory);
|
|
195
|
+
if (cached && now < cached.expires && cached.pointerStat === currentStat) {
|
|
178
196
|
return cached.linkDir ?? localSwarm;
|
|
179
197
|
}
|
|
180
198
|
let linkDir = null;
|
|
@@ -198,7 +216,11 @@ function resolveKnowledgeStoreDir(directory) {
|
|
|
198
216
|
if (oldest !== undefined)
|
|
199
217
|
_resolutionCache.delete(oldest);
|
|
200
218
|
}
|
|
201
|
-
_resolutionCache.set(directory, {
|
|
219
|
+
_resolutionCache.set(directory, {
|
|
220
|
+
linkDir,
|
|
221
|
+
expires: now + CACHE_TTL_MS,
|
|
222
|
+
pointerStat: currentStat
|
|
223
|
+
});
|
|
202
224
|
return linkDir ?? localSwarm;
|
|
203
225
|
}
|
|
204
226
|
function invalidateKnowledgeStoreDirCache(directory) {
|
|
@@ -212,4 +234,28 @@ function isLinked(directory) {
|
|
|
212
234
|
return readLinkPointer(directory) !== null;
|
|
213
235
|
}
|
|
214
236
|
|
|
215
|
-
|
|
237
|
+
// src/knowledge/hive-paths.ts
|
|
238
|
+
import * as os2 from "os";
|
|
239
|
+
import * as path2 from "path";
|
|
240
|
+
function resolveHiveDataDir() {
|
|
241
|
+
const platform = process.platform;
|
|
242
|
+
const home = process.env.HOME || os2.homedir();
|
|
243
|
+
if (platform === "win32") {
|
|
244
|
+
return path2.join(process.env.LOCALAPPDATA || path2.join(home, "AppData", "Local"), "opencode-swarm", "Data");
|
|
245
|
+
}
|
|
246
|
+
if (platform === "darwin") {
|
|
247
|
+
return path2.join(home, "Library", "Application Support", "opencode-swarm");
|
|
248
|
+
}
|
|
249
|
+
return path2.join(process.env.XDG_DATA_HOME || path2.join(home, ".local", "share"), "opencode-swarm");
|
|
250
|
+
}
|
|
251
|
+
function resolveHiveKnowledgePath() {
|
|
252
|
+
return path2.join(resolveHiveDataDir(), "shared-learnings.jsonl");
|
|
253
|
+
}
|
|
254
|
+
function resolveHiveRejectedPath() {
|
|
255
|
+
return path2.join(resolveHiveDataDir(), "shared-learnings-rejected.jsonl");
|
|
256
|
+
}
|
|
257
|
+
function resolveHiveEventsPath() {
|
|
258
|
+
return path2.join(resolveHiveDataDir(), "shared-knowledge-events.jsonl");
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export { resolveLinkDir, sanitizeLinkId, readLinkPointer, getLinkedLocalKnowledgeStatus, writeLinkPointer, removeLinkPointer, resolveKnowledgeStoreDir, isLinked, resolveHiveDataDir, resolveHiveKnowledgePath, resolveHiveRejectedPath, resolveHiveEventsPath };
|
package/dist/cli/index.js
CHANGED
|
@@ -7,25 +7,25 @@ import {
|
|
|
7
7
|
getPluginLockFilePaths,
|
|
8
8
|
package_default,
|
|
9
9
|
resolveCommand
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-34tsqvqb.js";
|
|
11
11
|
import"./index-nprawcc0.js";
|
|
12
|
-
import"./index-
|
|
12
|
+
import"./index-g2wrs7jy.js";
|
|
13
13
|
import"./index-c8s9a3zh.js";
|
|
14
|
-
import"./index-
|
|
14
|
+
import"./index-11q1t6g0.js";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_AGENT_CONFIGS
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-pdk1n8yh.js";
|
|
18
18
|
import"./index-xdsd2hma.js";
|
|
19
19
|
import"./index-scww5b77.js";
|
|
20
20
|
import"./index-4905hd2m.js";
|
|
21
21
|
import"./index-5bcrp3bc.js";
|
|
22
|
-
import"./index-
|
|
23
|
-
import"./index-
|
|
24
|
-
import"./index-
|
|
25
|
-
import"./index-
|
|
26
|
-
import"./index-
|
|
22
|
+
import"./index-sb9x6xjj.js";
|
|
23
|
+
import"./index-pjhfe7c3.js";
|
|
24
|
+
import"./index-jbdgpqpj.js";
|
|
25
|
+
import"./index-5hze8ztj.js";
|
|
26
|
+
import"./index-qx5z58a7.js";
|
|
27
27
|
import"./index-bfwt3abw.js";
|
|
28
|
-
import"./index-
|
|
28
|
+
import"./index-wpgv6hht.js";
|
|
29
29
|
import"./index-vxv732ex.js";
|
|
30
30
|
import"./index-8fwhhayc.js";
|
|
31
31
|
import"./index-q1exe2b3.js";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
maybeEscalateOnViolation,
|
|
9
9
|
maybeQuarantineOnContradiction,
|
|
10
10
|
readRecentEscalations
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
11
|
+
} from "./index-jbdgpqpj.js";
|
|
12
|
+
import"./index-5hze8ztj.js";
|
|
13
|
+
import"./index-qx5z58a7.js";
|
|
14
14
|
import"./index-bfwt3abw.js";
|
|
15
|
-
import"./index-
|
|
15
|
+
import"./index-wpgv6hht.js";
|
|
16
16
|
import"./index-zgwm4ryv.js";
|
|
17
17
|
import"./index-0pfqcjp6.js";
|
|
18
18
|
import"./index-42cx6g2h.js";
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
resolveKnowledgeCounterBaselinePath,
|
|
26
26
|
resolveKnowledgeEventsPath,
|
|
27
27
|
resolveLegacyApplicationLogPath
|
|
28
|
-
} from "./index-
|
|
29
|
-
import"./index-
|
|
28
|
+
} from "./index-5hze8ztj.js";
|
|
29
|
+
import"./index-wpgv6hht.js";
|
|
30
30
|
import"./index-zgwm4ryv.js";
|
|
31
31
|
import"./index-0pfqcjp6.js";
|
|
32
32
|
import"./index-42cx6g2h.js";
|
|
@@ -29,14 +29,17 @@ import {
|
|
|
29
29
|
resolveSwarmRejectedPath,
|
|
30
30
|
resolveSwarmRetractionsPath,
|
|
31
31
|
rewriteKnowledge,
|
|
32
|
+
selectKnowledgeCapSurvivors,
|
|
32
33
|
sweepAgedEntries,
|
|
33
34
|
sweepStaleTodos,
|
|
34
35
|
transactFile,
|
|
35
36
|
transactKnowledge,
|
|
36
37
|
wordBigrams
|
|
37
|
-
} from "./index-
|
|
38
|
+
} from "./index-qx5z58a7.js";
|
|
38
39
|
import"./index-bfwt3abw.js";
|
|
39
|
-
import
|
|
40
|
+
import {
|
|
41
|
+
resolveHiveDataDir
|
|
42
|
+
} from "./index-wpgv6hht.js";
|
|
40
43
|
import"./index-zgwm4ryv.js";
|
|
41
44
|
import"./index-0pfqcjp6.js";
|
|
42
45
|
import"./index-42cx6g2h.js";
|
|
@@ -51,6 +54,7 @@ export {
|
|
|
51
54
|
transactFile,
|
|
52
55
|
sweepStaleTodos,
|
|
53
56
|
sweepAgedEntries,
|
|
57
|
+
selectKnowledgeCapSurvivors,
|
|
54
58
|
rewriteKnowledge,
|
|
55
59
|
resolveSwarmRetractionsPath,
|
|
56
60
|
resolveSwarmRejectedPath,
|
|
@@ -58,6 +62,7 @@ export {
|
|
|
58
62
|
resolveHiveRejectedPath,
|
|
59
63
|
resolveHiveKnowledgePath,
|
|
60
64
|
resolveHiveEventsPath,
|
|
65
|
+
resolveHiveDataDir,
|
|
61
66
|
readRetractionRecords,
|
|
62
67
|
readRejectedLessons,
|
|
63
68
|
readKnowledge,
|
|
@@ -23,10 +23,10 @@ import {
|
|
|
23
23
|
validateLesson,
|
|
24
24
|
validateSkillCandidatePath,
|
|
25
25
|
validateSkillPath
|
|
26
|
-
} from "./index-
|
|
27
|
-
import"./index-
|
|
26
|
+
} from "./index-pjhfe7c3.js";
|
|
27
|
+
import"./index-qx5z58a7.js";
|
|
28
28
|
import"./index-bfwt3abw.js";
|
|
29
|
-
import"./index-
|
|
29
|
+
import"./index-wpgv6hht.js";
|
|
30
30
|
import"./index-zgwm4ryv.js";
|
|
31
31
|
import"./index-0pfqcjp6.js";
|
|
32
32
|
import"./index-42cx6g2h.js";
|
|
@@ -33,12 +33,12 @@ import {
|
|
|
33
33
|
sanitizeSlug,
|
|
34
34
|
selectCandidateEntries,
|
|
35
35
|
writeEvalStub
|
|
36
|
-
} from "./index-
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
39
|
-
import"./index-
|
|
36
|
+
} from "./index-sb9x6xjj.js";
|
|
37
|
+
import"./index-pjhfe7c3.js";
|
|
38
|
+
import"./index-5hze8ztj.js";
|
|
39
|
+
import"./index-qx5z58a7.js";
|
|
40
40
|
import"./index-bfwt3abw.js";
|
|
41
|
-
import"./index-
|
|
41
|
+
import"./index-wpgv6hht.js";
|
|
42
42
|
import"./index-zgwm4ryv.js";
|
|
43
43
|
import"./index-0pfqcjp6.js";
|
|
44
44
|
import"./index-42cx6g2h.js";
|
package/dist/commands/link.d.ts
CHANGED
|
@@ -7,13 +7,16 @@
|
|
|
7
7
|
* keeping an isolated `.swarm/knowledge.jsonl`.
|
|
8
8
|
*
|
|
9
9
|
* Usage:
|
|
10
|
-
* - /swarm link — link using the
|
|
11
|
-
* of the same repo to one shared store).
|
|
10
|
+
* - /swarm link — link using the canonical cohort id (ties all
|
|
11
|
+
* worktrees of the same repo to one shared store).
|
|
12
12
|
* - /swarm link <name> — link using an explicit shared name (use the same
|
|
13
13
|
* name in each worktree/repo to tie them together).
|
|
14
14
|
* - /swarm link status — show the current link state for this worktree.
|
|
15
15
|
*
|
|
16
|
-
* On link, this worktree's existing local
|
|
17
|
-
*
|
|
16
|
+
* On link, this worktree's existing local knowledge *family* (store, events,
|
|
17
|
+
* rejected, retractions, counters, quarantine, unactionable, application-legacy)
|
|
18
|
+
* is migrated into the shared store per the family manifest, with each member
|
|
19
|
+
* merged according to its strategy (issue #1846). The pointer is flipped only
|
|
20
|
+
* after the migration commits.
|
|
18
21
|
*/
|
|
19
22
|
export declare function handleLinkCommand(directory: string, args: string[]): Promise<string>;
|
|
@@ -6,5 +6,8 @@
|
|
|
6
6
|
* - /swarm promote "<lesson text>" — Promote direct text
|
|
7
7
|
* - /swarm promote --category <category> "<lesson text>" — Promote with category
|
|
8
8
|
* - /swarm promote --from-swarm <lesson-id> — Promote from existing swarm lesson
|
|
9
|
+
* - /swarm promote --force --reason "<why>" ... — Override failed policy gates
|
|
10
|
+
* with a durable, audited override record (issue #1847 §4). An exact entry id
|
|
11
|
+
* alone is NEVER authorization to bypass policy; an explicit override is.
|
|
9
12
|
*/
|
|
10
13
|
export declare function handlePromoteCommand(directory: string, args: string[]): Promise<string>;
|
|
@@ -689,8 +689,8 @@ export declare const COMMAND_REGISTRY: {
|
|
|
689
689
|
};
|
|
690
690
|
readonly promote: {
|
|
691
691
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
692
|
-
readonly description: "Manually promote lesson to hive knowledge";
|
|
693
|
-
readonly details: "Promotes a lesson directly to hive knowledge (--category flag sets category) or references an existing swarm lesson by ID (--from-swarm).
|
|
692
|
+
readonly description: "Manually promote lesson to hive knowledge (policy-gated; --force --reason overrides with audit)";
|
|
693
|
+
readonly details: "Promotes a lesson directly to hive knowledge (--category flag sets category) or references an existing swarm lesson by ID (--from-swarm). Promotion runs the one policy evaluator inside a single cross-process transaction (#1847). A policy failure blocks promotion unless --force --reason \"<why>\" is supplied, which records a durable, audited override. An exact entry id alone is never authorization to bypass policy. Either direct text or --from-swarm ID is required.";
|
|
694
694
|
readonly args: "--category <category>, --from-swarm <lesson-id>, <lesson-text>";
|
|
695
695
|
readonly category: "utility";
|
|
696
696
|
readonly toolPolicy: "none";
|