opencode-swarm 7.119.0 → 7.121.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-p73yfdz0.js → config-doctor-404c8mf8.js} +3 -3
- package/dist/cli/config-fingerprint-v22xh5a2.js +10 -0
- package/dist/cli/{core-gf1t2jmn.js → core-xnwasfpc.js} +1 -1
- package/dist/cli/curation-policy-re2kaysb.js +25 -0
- package/dist/cli/{curator-5xfkejsq.js → curator-8m0pf9cz.js} +30 -23
- package/dist/cli/{curator-drift-nn71xfz6.js → curator-drift-6b2fjsgr.js} +3 -2
- package/dist/cli/curator-llm-factory-jta9tggm.js +50 -0
- package/dist/cli/{evidence-summary-service-cy3k37je.js → evidence-summary-service-jtx5q3r6.js} +9 -7
- package/dist/cli/{gate-evidence-j2m4cd85.js → gate-evidence-tbpezk28.js} +5 -5
- package/dist/cli/guardrail-explain-nsfm5ksb.js +51 -0
- package/dist/cli/{guardrail-log-qjqgg7pz.js → guardrail-log-dhpp0kmn.js} +4 -4
- package/dist/cli/{hive-promoter-03m8pwg6.js → hive-promoter-8303gnfk.js} +30 -23
- package/dist/cli/index-0e1v02hq.js +343 -0
- package/dist/cli/{index-jbdgpqpj.js → index-0k4r8111.js} +28 -10
- package/dist/cli/index-0mbmfmt0.js +349 -0
- package/dist/cli/{index-5bcrp3bc.js → index-22e127jw.js} +3 -3
- package/dist/cli/{index-pjhfe7c3.js → index-3366gs26.js} +43 -7
- package/dist/cli/{index-7pspktns.js → index-3je67dcz.js} +2 -2
- package/dist/cli/{index-wpgv6hht.js → index-3jvqw5hy.js} +13 -26
- package/dist/cli/{index-05ee8pws.js → index-3ygv9535.js} +32 -25
- package/dist/cli/{index-bfwt3abw.js → index-4rhcth7a.js} +1 -1
- package/dist/cli/{index-n6fa2hhk.js → index-51gg9947.js} +1 -1
- package/dist/cli/index-69ms9ny1.js +261 -0
- package/dist/cli/{index-42cx6g2h.js → index-76kvm9z5.js} +1 -1
- package/dist/cli/{index-r2ysfdet.js → index-78b192v7.js} +7 -7
- package/dist/cli/{index-vwvkpg0d.js → index-816rkp4y.js} +3 -92
- package/dist/cli/index-89s4mhmw.js +6 -0
- package/dist/cli/index-9xpgytj9.js +386 -0
- package/dist/cli/index-ae75rja9.js +26 -0
- package/dist/cli/index-fndvr7fr.js +135 -0
- package/dist/cli/{index-mr3pnc4h.js → index-gmc34yzt.js} +1926 -2005
- package/dist/cli/index-gnp9x6se.js +93 -0
- package/dist/cli/{index-0pfqcjp6.js → index-h07wn84h.js} +1 -1
- package/dist/cli/{index-p45sshb5.js → index-j5xv8zbp.js} +17 -352
- package/dist/cli/{index-g2wrs7jy.js → index-kyvg2cmp.js} +1 -1
- package/dist/cli/{index-5hze8ztj.js → index-nhgw7de8.js} +7 -5
- package/dist/cli/{index-abjjn4yh.js → index-qg11yf8q.js} +4 -4
- package/dist/cli/index-rtry5xyf.js +27 -0
- package/dist/cli/{index-qx5z58a7.js → index-rywkdacj.js} +93 -11
- package/dist/cli/{index-pdk1n8yh.js → index-tftv9xh9.js} +44 -2
- package/dist/cli/{index-11q1t6g0.js → index-vqcgmy4y.js} +1 -1
- package/dist/cli/{index-q4kgsvdd.js → index-wtn8wf7h.js} +1 -1
- package/dist/cli/{index-bcg89pt8.js → index-zvae4m8g.js} +1 -1
- package/dist/cli/index.js +30 -23
- package/dist/cli/{knowledge-escalator-gt1q632m.js → knowledge-escalator-0ejqs8c9.js} +9 -8
- package/dist/cli/{knowledge-events-0bjdtdsb.js → knowledge-events-wx9e37ba.js} +6 -5
- package/dist/cli/knowledge-link-sy85fw3w.js +37 -0
- package/dist/cli/{knowledge-store-fm2300xf.js → knowledge-store-rnajx33a.js} +17 -6
- package/dist/cli/{knowledge-validator-91kx3eqv.js → knowledge-validator-1f4mkzmc.js} +11 -7
- package/dist/cli/{pending-delegations-9cn17983.js → pending-delegations-0z3znsec.js} +5 -5
- package/dist/cli/{pr-subscriptions-8a6jwek2.js → pr-subscriptions-x653151h.js} +4 -4
- package/dist/cli/scan-cursor-qapm0sxj.js +25 -0
- package/dist/cli/{schema-7c484wjz.js → schema-vwxpsk6j.js} +2 -2
- package/dist/cli/{scope-persistence-fm0gzhnk.js → scope-persistence-mfr36yc9.js} +2 -2
- package/dist/cli/{skill-generator-3f8dqjj2.js → skill-generator-tkv7s12g.js} +12 -9
- package/dist/config/schema.d.ts +8 -8
- package/dist/config/skill-mirrors.d.ts +1 -1
- package/dist/hooks/curator-postmortem.d.ts +6 -4
- package/dist/hooks/curator.d.ts +5 -1
- package/dist/hooks/hive-promoter.d.ts +3 -1
- package/dist/hooks/knowledge-store.d.ts +54 -1
- package/dist/hooks/knowledge-types.d.ts +107 -2
- package/dist/hooks/knowledge-validator.d.ts +25 -4
- package/dist/index.js +387 -384
- package/dist/knowledge/curation-policy.d.ts +125 -0
- package/dist/knowledge/family-manifest.d.ts +30 -2
- package/dist/knowledge/family-migration.d.ts +16 -4
- package/dist/knowledge/scan-cursor.d.ts +107 -0
- package/dist/knowledge/worktree-identity.d.ts +39 -0
- package/dist/memory/schema.d.ts +1 -1
- package/dist/services/knowledge-diagnostics.d.ts +29 -0
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-rwwnmdvk.js +0 -43
- package/dist/cli/guardrail-explain-kacpc2zm.js +0 -44
- /package/dist/cli/{index-vvk2g744.js → index-7g4c7s5r.js} +0 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
readKnowledge,
|
|
4
|
+
transactKnowledge
|
|
5
|
+
} from "./index-rywkdacj.js";
|
|
6
|
+
import {
|
|
7
|
+
resolveKnowledgeStoreDir
|
|
8
|
+
} from "./index-3jvqw5hy.js";
|
|
9
|
+
import {
|
|
10
|
+
isActiveStatus
|
|
11
|
+
} from "./index-4rhcth7a.js";
|
|
12
|
+
import {
|
|
13
|
+
init_logger,
|
|
14
|
+
log
|
|
15
|
+
} from "./index-zgwm4ryv.js";
|
|
16
|
+
import {
|
|
17
|
+
__require,
|
|
18
|
+
__toESM
|
|
19
|
+
} from "./index-a76rekgs.js";
|
|
20
|
+
|
|
21
|
+
// src/knowledge/scan-cursor.ts
|
|
22
|
+
import { existsSync } from "fs";
|
|
23
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
24
|
+
import * as path2 from "path";
|
|
25
|
+
init_logger();
|
|
26
|
+
|
|
27
|
+
// src/knowledge/cohort-identity.ts
|
|
28
|
+
import { execFile } from "child_process";
|
|
29
|
+
import { createHash } from "crypto";
|
|
30
|
+
import { realpathSync } from "fs";
|
|
31
|
+
import * as path from "path";
|
|
32
|
+
var GIT_TIMEOUT_MS = 1500;
|
|
33
|
+
var CASE_INSENSITIVE_HOSTS = new Set([
|
|
34
|
+
"github.com",
|
|
35
|
+
"gitlab.com",
|
|
36
|
+
"bitbucket.org",
|
|
37
|
+
"azure.com",
|
|
38
|
+
"visualstudio.com"
|
|
39
|
+
]);
|
|
40
|
+
function normalizeGitRemote(rawUrl) {
|
|
41
|
+
if (typeof rawUrl !== "string")
|
|
42
|
+
return null;
|
|
43
|
+
let url = rawUrl.trim();
|
|
44
|
+
if (url.length === 0)
|
|
45
|
+
return null;
|
|
46
|
+
url = url.normalize("NFC");
|
|
47
|
+
url = url.replace(/\\/g, "/");
|
|
48
|
+
let host = "";
|
|
49
|
+
let pathPart = "";
|
|
50
|
+
const lowerForScheme = url.toLowerCase();
|
|
51
|
+
if (lowerForScheme.startsWith("ssh://")) {
|
|
52
|
+
const rest = url.slice("ssh://".length);
|
|
53
|
+
const atIdx = rest.indexOf("@");
|
|
54
|
+
const hostStart = atIdx === -1 ? 0 : atIdx + 1;
|
|
55
|
+
const slashIdx = rest.indexOf("/", hostStart);
|
|
56
|
+
if (slashIdx === -1)
|
|
57
|
+
return null;
|
|
58
|
+
host = rest.slice(hostStart, slashIdx);
|
|
59
|
+
pathPart = rest.slice(slashIdx + 1);
|
|
60
|
+
} else if (/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9_.-]+:/.test(url)) {
|
|
61
|
+
const atIdx = url.indexOf("@");
|
|
62
|
+
const colonIdx = url.indexOf(":", atIdx);
|
|
63
|
+
host = url.slice(atIdx + 1, colonIdx);
|
|
64
|
+
pathPart = url.slice(colonIdx + 1);
|
|
65
|
+
} else if (lowerForScheme.startsWith("https://") || lowerForScheme.startsWith("http://")) {
|
|
66
|
+
const schemeEnd = url.indexOf("://");
|
|
67
|
+
const rest = url.slice(schemeEnd + 3);
|
|
68
|
+
const atIdx = rest.indexOf("@");
|
|
69
|
+
const hostStart = atIdx === -1 ? 0 : atIdx + 1;
|
|
70
|
+
const slashIdx = rest.indexOf("/", hostStart);
|
|
71
|
+
if (slashIdx === -1)
|
|
72
|
+
return null;
|
|
73
|
+
host = rest.slice(hostStart, slashIdx);
|
|
74
|
+
pathPart = rest.slice(slashIdx + 1);
|
|
75
|
+
} else if (/^[a-zA-Z0-9_.-]+:[^/]/.test(url) && !url.includes("://")) {
|
|
76
|
+
const colonIdx = url.indexOf(":");
|
|
77
|
+
host = url.slice(0, colonIdx);
|
|
78
|
+
pathPart = url.slice(colonIdx + 1);
|
|
79
|
+
} else if (lowerForScheme.startsWith("git://")) {
|
|
80
|
+
const rest = url.slice("git://".length);
|
|
81
|
+
const slashIdx = rest.indexOf("/");
|
|
82
|
+
if (slashIdx === -1)
|
|
83
|
+
return null;
|
|
84
|
+
host = rest.slice(0, slashIdx);
|
|
85
|
+
pathPart = rest.slice(slashIdx + 1);
|
|
86
|
+
} else {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
host = host.toLowerCase();
|
|
90
|
+
host = host.replace(/:443$/, "").replace(/:22$/, "").replace(/:80$/, "");
|
|
91
|
+
pathPart = pathPart.replace(/\.git$/, "").replace(/\/+$/, "");
|
|
92
|
+
try {
|
|
93
|
+
pathPart = pathPart.split("/").map((seg) => {
|
|
94
|
+
try {
|
|
95
|
+
return decodeURIComponent(seg);
|
|
96
|
+
} catch {
|
|
97
|
+
return seg;
|
|
98
|
+
}
|
|
99
|
+
}).join("/");
|
|
100
|
+
} catch {}
|
|
101
|
+
pathPart = pathPart.split("/").filter((seg, idx) => !(seg === "" && idx !== 0)).join("/");
|
|
102
|
+
pathPart = pathPart.replace(/^\/+/, "");
|
|
103
|
+
if (CASE_INSENSITIVE_HOSTS.has(host)) {
|
|
104
|
+
pathPart = pathPart.toLowerCase();
|
|
105
|
+
}
|
|
106
|
+
if (host.length === 0 || pathPart.length === 0)
|
|
107
|
+
return null;
|
|
108
|
+
if (!pathPart.includes("/"))
|
|
109
|
+
return null;
|
|
110
|
+
return `${host}/${pathPart}`;
|
|
111
|
+
}
|
|
112
|
+
function runGit(directory, args) {
|
|
113
|
+
return new Promise((resolve2) => {
|
|
114
|
+
try {
|
|
115
|
+
const child = execFile("git", ["-C", directory, ...args], {
|
|
116
|
+
timeout: GIT_TIMEOUT_MS,
|
|
117
|
+
windowsHide: true,
|
|
118
|
+
encoding: "utf-8",
|
|
119
|
+
maxBuffer: 1024 * 64
|
|
120
|
+
}, (err, stdout) => {
|
|
121
|
+
if (err || typeof stdout !== "string") {
|
|
122
|
+
resolve2(null);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
resolve2(stdout.trim());
|
|
126
|
+
});
|
|
127
|
+
try {
|
|
128
|
+
child.stdin?.end();
|
|
129
|
+
} catch {}
|
|
130
|
+
child.on("error", () => resolve2(null));
|
|
131
|
+
} catch {
|
|
132
|
+
resolve2(null);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function cohortHash(input) {
|
|
137
|
+
return createHash("sha256").update(input).digest("hex").slice(0, 12);
|
|
138
|
+
}
|
|
139
|
+
function stabilizePath(input) {
|
|
140
|
+
return input.replace(/\\/g, "/").replace(/^\/\/\?\//, "").replace(/\/+$/, "").toLowerCase();
|
|
141
|
+
}
|
|
142
|
+
async function resolveCohortId(directory) {
|
|
143
|
+
const remoteUrl = await _internals.runGit(directory, [
|
|
144
|
+
"remote",
|
|
145
|
+
"get-url",
|
|
146
|
+
"origin"
|
|
147
|
+
]);
|
|
148
|
+
if (remoteUrl && remoteUrl.length > 0) {
|
|
149
|
+
const normalized = normalizeGitRemote(remoteUrl);
|
|
150
|
+
if (normalized) {
|
|
151
|
+
return {
|
|
152
|
+
cohortId: cohortHash(normalized),
|
|
153
|
+
source: "remote",
|
|
154
|
+
normalizedRemote: normalized,
|
|
155
|
+
degraded: false
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
let commonDirRaw = await _internals.runGit(directory, [
|
|
160
|
+
"rev-parse",
|
|
161
|
+
"--path-format=absolute",
|
|
162
|
+
"--git-common-dir"
|
|
163
|
+
]);
|
|
164
|
+
if (!commonDirRaw || commonDirRaw.length === 0) {
|
|
165
|
+
commonDirRaw = await _internals.runGit(directory, [
|
|
166
|
+
"rev-parse",
|
|
167
|
+
"--git-common-dir"
|
|
168
|
+
]);
|
|
169
|
+
}
|
|
170
|
+
if (commonDirRaw && commonDirRaw.length > 0) {
|
|
171
|
+
try {
|
|
172
|
+
const resolved = path.resolve(directory, commonDirRaw);
|
|
173
|
+
const canonical = realpathSync(resolved);
|
|
174
|
+
return {
|
|
175
|
+
cohortId: cohortHash(stabilizePath(canonical)),
|
|
176
|
+
source: "git-common-dir",
|
|
177
|
+
degraded: true
|
|
178
|
+
};
|
|
179
|
+
} catch {}
|
|
180
|
+
}
|
|
181
|
+
let canonicalPath;
|
|
182
|
+
try {
|
|
183
|
+
canonicalPath = realpathSync(path.resolve(directory));
|
|
184
|
+
} catch {
|
|
185
|
+
canonicalPath = path.resolve(directory);
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
cohortId: cohortHash(stabilizePath(canonicalPath)),
|
|
189
|
+
source: "path",
|
|
190
|
+
degraded: true
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
var _internals = {
|
|
194
|
+
normalizeGitRemote,
|
|
195
|
+
runGit,
|
|
196
|
+
cohortHash,
|
|
197
|
+
stabilizePath,
|
|
198
|
+
GIT_TIMEOUT_MS
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// src/knowledge/scan-cursor.ts
|
|
202
|
+
var CURSOR_FILENAME = "curation-cursor.json";
|
|
203
|
+
var DEFAULT_BATCH_SIZE = 500;
|
|
204
|
+
var _internals2 = {
|
|
205
|
+
readFile,
|
|
206
|
+
writeFile,
|
|
207
|
+
existsSync,
|
|
208
|
+
mkdir,
|
|
209
|
+
readKnowledge,
|
|
210
|
+
transactKnowledge,
|
|
211
|
+
resolveCohortId,
|
|
212
|
+
resolveKnowledgeStoreDir
|
|
213
|
+
};
|
|
214
|
+
function resolveCursorPath(directory) {
|
|
215
|
+
const storeDir = _internals2.resolveKnowledgeStoreDir(directory);
|
|
216
|
+
return path2.join(storeDir, CURSOR_FILENAME);
|
|
217
|
+
}
|
|
218
|
+
function entrySortKey(entry) {
|
|
219
|
+
return `${entry.created_at ?? ""}|${entry.id}`;
|
|
220
|
+
}
|
|
221
|
+
async function readCursor(directory) {
|
|
222
|
+
const cursorPath = resolveCursorPath(directory);
|
|
223
|
+
try {
|
|
224
|
+
if (!_internals2.existsSync(cursorPath))
|
|
225
|
+
return null;
|
|
226
|
+
const raw = await _internals2.readFile(cursorPath, "utf-8");
|
|
227
|
+
return JSON.parse(raw);
|
|
228
|
+
} catch {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async function writeCursor(directory, state) {
|
|
233
|
+
const cursorPath = resolveCursorPath(directory);
|
|
234
|
+
const storeDir = path2.dirname(cursorPath);
|
|
235
|
+
try {
|
|
236
|
+
await _internals2.mkdir(storeDir, { recursive: true });
|
|
237
|
+
await _internals2.writeFile(cursorPath, JSON.stringify(state, null, 2), "utf-8");
|
|
238
|
+
} catch (err) {
|
|
239
|
+
log(`[scan-cursor] writeCursor failed (non-blocking): ${String(err)}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
async function claimNextScanBatch(directory, batchSize = DEFAULT_BATCH_SIZE) {
|
|
243
|
+
const knowledgePath = path2.join(_internals2.resolveKnowledgeStoreDir(directory), "knowledge.jsonl");
|
|
244
|
+
const allEntries = await _internals2.readKnowledge(knowledgePath);
|
|
245
|
+
const eligible = allEntries.filter((e) => isActiveStatus(e.status)).sort((a, b) => {
|
|
246
|
+
const ka = entrySortKey(a);
|
|
247
|
+
const kb = entrySortKey(b);
|
|
248
|
+
return ka < kb ? -1 : ka > kb ? 1 : 0;
|
|
249
|
+
});
|
|
250
|
+
let cohortId = "unknown";
|
|
251
|
+
try {
|
|
252
|
+
cohortId = (await _internals2.resolveCohortId(directory)).cohortId;
|
|
253
|
+
} catch {}
|
|
254
|
+
const lockfile = (await import("./index-89s4mhmw.js").then((m)=>__toESM(m.default,1))).default;
|
|
255
|
+
const storeDir = _internals2.resolveKnowledgeStoreDir(directory);
|
|
256
|
+
let batch = [];
|
|
257
|
+
let generation = 1;
|
|
258
|
+
let sweepCompleted = false;
|
|
259
|
+
let remainingAfter = 0;
|
|
260
|
+
let release;
|
|
261
|
+
try {
|
|
262
|
+
release = await lockfile.lock(storeDir, {
|
|
263
|
+
retries: { retries: 5, minTimeout: 100, maxTimeout: 500 },
|
|
264
|
+
stale: 5000
|
|
265
|
+
});
|
|
266
|
+
const now = new Date().toISOString();
|
|
267
|
+
let cursor = await readCursor(directory);
|
|
268
|
+
if (!cursor) {
|
|
269
|
+
cursor = {
|
|
270
|
+
cohort_id: cohortId,
|
|
271
|
+
last_visited_sort_key: "",
|
|
272
|
+
generation: 1,
|
|
273
|
+
completed: false,
|
|
274
|
+
remaining_estimate: eligible.length,
|
|
275
|
+
updated_at: now
|
|
276
|
+
};
|
|
277
|
+
} else if (cursor.completed) {
|
|
278
|
+
cursor = {
|
|
279
|
+
...cursor,
|
|
280
|
+
cohort_id: cohortId,
|
|
281
|
+
last_visited_sort_key: "",
|
|
282
|
+
generation: cursor.generation + 1,
|
|
283
|
+
completed: false,
|
|
284
|
+
remaining_estimate: eligible.length,
|
|
285
|
+
updated_at: now
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
const cursorKey = cursor.last_visited_sort_key;
|
|
289
|
+
const pending = eligible.filter((e) => entrySortKey(e) > cursorKey);
|
|
290
|
+
batch = pending.slice(0, batchSize);
|
|
291
|
+
remainingAfter = pending.length - batch.length;
|
|
292
|
+
const sweepDone = remainingAfter === 0;
|
|
293
|
+
const lastVisited = batch.length > 0 ? entrySortKey(batch[batch.length - 1]) : cursorKey;
|
|
294
|
+
const nextCursor = {
|
|
295
|
+
...cursor,
|
|
296
|
+
last_visited_sort_key: lastVisited,
|
|
297
|
+
completed: sweepDone,
|
|
298
|
+
remaining_estimate: remainingAfter,
|
|
299
|
+
updated_at: now
|
|
300
|
+
};
|
|
301
|
+
generation = nextCursor.generation;
|
|
302
|
+
sweepCompleted = sweepDone;
|
|
303
|
+
await writeCursor(directory, nextCursor);
|
|
304
|
+
} finally {
|
|
305
|
+
if (release) {
|
|
306
|
+
try {
|
|
307
|
+
await release();
|
|
308
|
+
} catch {}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
entries: batch,
|
|
313
|
+
generation,
|
|
314
|
+
sweepCompleted,
|
|
315
|
+
remaining_estimate: remainingAfter
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
async function getScanStatus(directory) {
|
|
319
|
+
let cohortId = "unknown";
|
|
320
|
+
try {
|
|
321
|
+
cohortId = (await _internals2.resolveCohortId(directory)).cohortId;
|
|
322
|
+
} catch {}
|
|
323
|
+
const cursor = await readCursor(directory);
|
|
324
|
+
if (!cursor) {
|
|
325
|
+
return {
|
|
326
|
+
generation: 0,
|
|
327
|
+
completed: false,
|
|
328
|
+
remaining_estimate: 0,
|
|
329
|
+
cohort_id: cohortId
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
return {
|
|
333
|
+
generation: cursor.generation,
|
|
334
|
+
completed: cursor.completed,
|
|
335
|
+
remaining_estimate: cursor.remaining_estimate,
|
|
336
|
+
cohort_id: cursor.cohort_id
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function alreadyCuratedThisGeneration(entry, generation) {
|
|
340
|
+
return entry.last_curated_generation === generation;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export { resolveCohortId, _internals2 as _internals, claimNextScanBatch, getScanStatus, alreadyCuratedThisGeneration };
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
countEntryContradictionsInWindow,
|
|
4
|
-
countEntryViolationsInWindow,
|
|
5
|
-
readKnowledgeEvents,
|
|
6
|
-
recordKnowledgeEvent
|
|
7
|
-
} from "./index-5hze8ztj.js";
|
|
8
2
|
import {
|
|
9
3
|
jaccardBigram,
|
|
10
4
|
readKnowledge,
|
|
@@ -12,10 +6,16 @@ import {
|
|
|
12
6
|
resolveSwarmKnowledgePath,
|
|
13
7
|
transactKnowledge,
|
|
14
8
|
wordBigrams
|
|
15
|
-
} from "./index-
|
|
9
|
+
} from "./index-rywkdacj.js";
|
|
10
|
+
import {
|
|
11
|
+
countEntryContradictionsInWindow,
|
|
12
|
+
countEntryViolationsInWindow,
|
|
13
|
+
readKnowledgeEvents,
|
|
14
|
+
recordKnowledgeEvent
|
|
15
|
+
} from "./index-nhgw7de8.js";
|
|
16
16
|
import {
|
|
17
17
|
isActiveStatus
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-4rhcth7a.js";
|
|
19
19
|
import {
|
|
20
20
|
__require
|
|
21
21
|
} from "./index-a76rekgs.js";
|
|
@@ -188,8 +188,26 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
188
188
|
alreadyInactive: true
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
192
|
-
|
|
191
|
+
const { quarantineEntry } = await import("./knowledge-validator-1f4mkzmc.js");
|
|
192
|
+
let policyConfig;
|
|
193
|
+
try {
|
|
194
|
+
const { KnowledgeConfigSchema } = await import("./schema-vwxpsk6j.js");
|
|
195
|
+
const { loadPluginConfigWithMeta } = await import("./index-fndvr7fr.js");
|
|
196
|
+
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
197
|
+
policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
198
|
+
} catch {
|
|
199
|
+
policyConfig = undefined;
|
|
200
|
+
}
|
|
201
|
+
await quarantineEntry(directory, entryId, `repeat_contradiction: ${count} contradicted events in ${windowDays}d`, "auto", {
|
|
202
|
+
input: {
|
|
203
|
+
directory,
|
|
204
|
+
action: "quarantine",
|
|
205
|
+
entryId,
|
|
206
|
+
reason: `repeat_contradiction: ${count} in ${windowDays}d`,
|
|
207
|
+
evidenceScope: "cohort-wide"
|
|
208
|
+
},
|
|
209
|
+
context: { config: policyConfig, entry }
|
|
210
|
+
});
|
|
193
211
|
return { quarantined: true, entryId, contradictionsInWindow: count };
|
|
194
212
|
} catch {
|
|
195
213
|
return { quarantined: false, entryId };
|