opencode-swarm 7.136.3 → 7.136.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{config-doctor-g71mz50j.js → config-doctor-n3hatm9d.js} +2 -2
- package/dist/cli/{curation-policy-zhyttjpa.js → curation-policy-c4g08bg1.js} +2 -2
- package/dist/cli/{curator-36dxw38r.js → curator-jc5cc980.js} +12 -12
- package/dist/cli/{curator-llm-factory-k2a7cv41.js → curator-llm-factory-atfnhbn6.js} +12 -12
- package/dist/cli/{guardrail-explain-1k337z5d.js → guardrail-explain-v6f8efve.js} +13 -13
- package/dist/cli/{guardrail-log-xbc9bvdt.js → guardrail-log-0mrq14g9.js} +3 -3
- package/dist/cli/{hive-promoter-daxrn62p.js → hive-promoter-wyejhz8b.js} +12 -12
- package/dist/cli/{index-176zwqcq.js → index-6kd0ezgd.js} +1 -1
- package/dist/cli/{index-mgbpbs1f.js → index-84se71v1.js} +1 -1
- package/dist/cli/{index-zcrvn579.js → index-8f4346kf.js} +1 -1
- package/dist/cli/{index-pff46kfv.js → index-akc6rp3x.js} +2 -2
- package/dist/cli/{index-rtgqy0yg.js → index-bqan4y2y.js} +2 -2
- package/dist/cli/{index-0vq9gnqd.js → index-eeb35dnx.js} +1 -1
- package/dist/cli/{index-n89fdxwg.js → index-f5qs217h.js} +6 -1
- package/dist/cli/{index-brtg922w.js → index-hbzh7yyz.js} +669 -618
- package/dist/cli/{index-68tjkaqk.js → index-j7ja83v5.js} +1 -1
- package/dist/cli/{index-zwh5dewz.js → index-pyz1p8qv.js} +1 -1
- package/dist/cli/{index-wbdxmf1a.js → index-qhbr4h5n.js} +4 -4
- package/dist/cli/{index-kp5h245k.js → index-tr0ctbhq.js} +5 -5
- package/dist/cli/{index-79pgzj9a.js → index-vm05set2.js} +2 -2
- package/dist/cli/{index-g5rtcb1n.js → index-xp2pfbpq.js} +1 -1
- package/dist/cli/{index-g2kpqpvh.js → index-xvcctb2t.js} +14 -14
- package/dist/cli/{index-gj5jerzz.js → index-yj61bped.js} +3 -3
- package/dist/cli/index.js +12 -12
- package/dist/cli/{knowledge-escalator-h7fspgph.js → knowledge-escalator-2xe8z24p.js} +3 -3
- package/dist/cli/{knowledge-events-vkf7an5n.js → knowledge-events-wecrshsx.js} +1 -1
- package/dist/cli/{knowledge-store-s4976v9c.js → knowledge-store-9f74whxw.js} +1 -1
- package/dist/cli/{knowledge-validator-64ppqy4y.js → knowledge-validator-4ng7x9dr.js} +4 -4
- package/dist/cli/{scan-cursor-xbkae12h.js → scan-cursor-yzj9n225.js} +2 -2
- package/dist/cli/{schema-7jm70cab.js → schema-cr1nr1w0.js} +1 -1
- package/dist/cli/{skill-generator-8gtq1ajr.js → skill-generator-ybncj9et.js} +5 -5
- package/dist/hooks/context-budget.d.ts +8 -0
- package/dist/hooks/guardrails/file-authority.d.ts +20 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/message-priority.d.ts +62 -4
- package/dist/index.js +285 -286
- package/dist/memory/index.d.ts +1 -1
- package/dist/memory/local-jsonl-provider.d.ts +4 -1
- package/dist/memory/redaction.d.ts +91 -0
- package/dist/memory/sqlite-provider.d.ts +5 -1
- package/dist/utils/arg-hash.d.ts +113 -0
- package/dist/utils/stable-stringify.d.ts +47 -2
- package/package.json +1 -1
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
} from "./index-nfm9f10v.js";
|
|
16
16
|
import {
|
|
17
17
|
stableCanonicalStringify
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-f5qs217h.js";
|
|
19
19
|
import {
|
|
20
20
|
detectStraySwarmDirs,
|
|
21
21
|
readDoctorArtifact,
|
|
22
22
|
removeStraySwarmDir,
|
|
23
23
|
runConfigDoctor
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-j7ja83v5.js";
|
|
25
25
|
import {
|
|
26
26
|
MAX_TRANSIENT_RETRIES,
|
|
27
27
|
archiveEvidence,
|
|
@@ -113,15 +113,15 @@ import {
|
|
|
113
113
|
retireSkill,
|
|
114
114
|
selectCandidateEntries,
|
|
115
115
|
syncBundledProjectSkillsIfMissingAsync
|
|
116
|
-
} from "./index-
|
|
116
|
+
} from "./index-yj61bped.js";
|
|
117
117
|
import {
|
|
118
118
|
readRecentEscalations
|
|
119
|
-
} from "./index-
|
|
119
|
+
} from "./index-tr0ctbhq.js";
|
|
120
120
|
import {
|
|
121
121
|
alreadyCuratedThisGeneration,
|
|
122
122
|
claimNextScanBatch,
|
|
123
123
|
resolveCohortId
|
|
124
|
-
} from "./index-
|
|
124
|
+
} from "./index-8f4346kf.js";
|
|
125
125
|
import {
|
|
126
126
|
CURATOR_INIT_PROMPT,
|
|
127
127
|
CURATOR_PHASE_PROMPT,
|
|
@@ -174,11 +174,11 @@ import {
|
|
|
174
174
|
validateActionableFields,
|
|
175
175
|
validateLesson,
|
|
176
176
|
validateSkillPath
|
|
177
|
-
} from "./index-
|
|
177
|
+
} from "./index-vm05set2.js";
|
|
178
178
|
import {
|
|
179
179
|
authorizeCuration,
|
|
180
180
|
buildConfigFingerprintInput
|
|
181
|
-
} from "./index-
|
|
181
|
+
} from "./index-6kd0ezgd.js";
|
|
182
182
|
import {
|
|
183
183
|
cohortConfigFingerprint
|
|
184
184
|
} from "./index-rtry5xyf.js";
|
|
@@ -211,7 +211,7 @@ import {
|
|
|
211
211
|
transactFile,
|
|
212
212
|
transactKnowledge,
|
|
213
213
|
wordBigrams
|
|
214
|
-
} from "./index-
|
|
214
|
+
} from "./index-qhbr4h5n.js";
|
|
215
215
|
import {
|
|
216
216
|
MAX_EVENT_LOG_ENTRIES,
|
|
217
217
|
_internals,
|
|
@@ -221,7 +221,7 @@ import {
|
|
|
221
221
|
recordHiveKnowledgeEvent,
|
|
222
222
|
recordKnowledgeEvent,
|
|
223
223
|
resolveKnowledgeEventsPath
|
|
224
|
-
} from "./index-
|
|
224
|
+
} from "./index-84se71v1.js";
|
|
225
225
|
import {
|
|
226
226
|
resolveHiveDataDir,
|
|
227
227
|
resolveHiveEventsPath,
|
|
@@ -246,7 +246,7 @@ import {
|
|
|
246
246
|
init_loader,
|
|
247
247
|
loadPluginConfig,
|
|
248
248
|
loadPluginConfigWithMeta
|
|
249
|
-
} from "./index-
|
|
249
|
+
} from "./index-pyz1p8qv.js";
|
|
250
250
|
import {
|
|
251
251
|
RetrospectiveEvidenceSchema
|
|
252
252
|
} from "./index-k5jrywpr.js";
|
|
@@ -262,7 +262,7 @@ import {
|
|
|
262
262
|
package_default,
|
|
263
263
|
resolveAutoReviewConfig,
|
|
264
264
|
stripKnownSwarmPrefix
|
|
265
|
-
} from "./index-
|
|
265
|
+
} from "./index-eeb35dnx.js";
|
|
266
266
|
import {
|
|
267
267
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
268
268
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -6628,6 +6628,18 @@ var REDACTION_POLICY_SALT = 1;
|
|
|
6628
6628
|
function computeRedactionPolicyVersion(rejectDurableSecrets) {
|
|
6629
6629
|
return REDACTION_POLICY_SALT * 1e6 + SECRET_PATTERNS.length * 2 + (rejectDurableSecrets ? 1 : 0);
|
|
6630
6630
|
}
|
|
6631
|
+
var FINGERPRINT_ALGORITHM_VERSION = 1;
|
|
6632
|
+
var LEGACY_FINGERPRINT_ALGORITHM_VERSION = 1;
|
|
6633
|
+
var _internals11 = {
|
|
6634
|
+
currentAlgorithmVersion: FINGERPRINT_ALGORITHM_VERSION
|
|
6635
|
+
};
|
|
6636
|
+
function classifyStoredFingerprintAlgorithmVersion(rawStoredVersion, currentVersion = _internals11.currentAlgorithmVersion) {
|
|
6637
|
+
const storedVersion = rawStoredVersion === undefined ? LEGACY_FINGERPRINT_ALGORITHM_VERSION : rawStoredVersion;
|
|
6638
|
+
if (typeof storedVersion !== "number" || !Number.isFinite(storedVersion)) {
|
|
6639
|
+
return { status: "unknown" };
|
|
6640
|
+
}
|
|
6641
|
+
return storedVersion === currentVersion ? { status: "comparable" } : { status: "mismatch", storedVersion, currentVersion };
|
|
6642
|
+
}
|
|
6631
6643
|
function computeMemoryCohortFingerprint(input) {
|
|
6632
6644
|
const canonical = stableCanonicalStringify(input);
|
|
6633
6645
|
return createHash4("sha256").update(canonical).digest("hex").slice(0, 12);
|
|
@@ -7906,6 +7918,22 @@ class LocalJsonlMemoryProvider {
|
|
|
7906
7918
|
return;
|
|
7907
7919
|
try {
|
|
7908
7920
|
const stored = JSON.parse(readFileSync5(configPath, "utf-8"));
|
|
7921
|
+
const versionCheck = classifyStoredFingerprintAlgorithmVersion(stored.algorithm_version);
|
|
7922
|
+
if (versionCheck.status === "unknown") {
|
|
7923
|
+
warn("[memory-cohort] cohort config has a present but non-numeric `algorithm_version`, so its fingerprint cannot be attributed to a known algorithm and the config-coherence check was skipped. Run `/swarm memory link` to rewrite the cohort fingerprint.", {
|
|
7924
|
+
cohortRoot: this.cohortRoot,
|
|
7925
|
+
storedVersion: stored.algorithm_version
|
|
7926
|
+
});
|
|
7927
|
+
return;
|
|
7928
|
+
}
|
|
7929
|
+
if (versionCheck.status === "mismatch") {
|
|
7930
|
+
warn(`[memory-cohort] cohort config was fingerprinted with algorithm version ${versionCheck.storedVersion}, but this worktree computes version ${versionCheck.currentVersion}. Digests from different algorithm versions are not comparable, so the config-coherence check was skipped. Run \`/swarm memory link\` to refresh the cohort fingerprint.`, {
|
|
7931
|
+
cohortRoot: this.cohortRoot,
|
|
7932
|
+
storedVersion: versionCheck.storedVersion,
|
|
7933
|
+
expectedVersion: versionCheck.currentVersion
|
|
7934
|
+
});
|
|
7935
|
+
return;
|
|
7936
|
+
}
|
|
7909
7937
|
const storedFingerprint = stored.fingerprint;
|
|
7910
7938
|
if (typeof storedFingerprint !== "string")
|
|
7911
7939
|
return;
|
|
@@ -8217,7 +8245,7 @@ class EmbeddingVersionMismatchError extends Error {
|
|
|
8217
8245
|
}
|
|
8218
8246
|
|
|
8219
8247
|
// src/memory/embeddings/local-provider.ts
|
|
8220
|
-
var
|
|
8248
|
+
var _internals12 = {
|
|
8221
8249
|
resolveEmbeddingCacheDir() {
|
|
8222
8250
|
let base;
|
|
8223
8251
|
if (process.platform === "win32") {
|
|
@@ -8238,7 +8266,7 @@ var _internals11 = {
|
|
|
8238
8266
|
}
|
|
8239
8267
|
};
|
|
8240
8268
|
function resolveEmbeddingCacheDir() {
|
|
8241
|
-
return
|
|
8269
|
+
return _internals12.resolveEmbeddingCacheDir();
|
|
8242
8270
|
}
|
|
8243
8271
|
|
|
8244
8272
|
class LocalEmbeddingProvider {
|
|
@@ -9884,6 +9912,22 @@ class SQLiteMemoryProvider {
|
|
|
9884
9912
|
}
|
|
9885
9913
|
try {
|
|
9886
9914
|
const stored = JSON.parse(readFileSync6(configPath, "utf-8"));
|
|
9915
|
+
const versionCheck = classifyStoredFingerprintAlgorithmVersion(stored.algorithm_version);
|
|
9916
|
+
if (versionCheck.status === "unknown") {
|
|
9917
|
+
warn("[memory-cohort] cohort config has a present but non-numeric `algorithm_version`, so its fingerprint cannot be attributed to a known algorithm and the config-coherence check was skipped. Run `/swarm memory link` to rewrite the cohort fingerprint.", {
|
|
9918
|
+
cohortRoot: this.cohortRoot,
|
|
9919
|
+
storedVersion: stored.algorithm_version
|
|
9920
|
+
});
|
|
9921
|
+
return;
|
|
9922
|
+
}
|
|
9923
|
+
if (versionCheck.status === "mismatch") {
|
|
9924
|
+
warn(`[memory-cohort] cohort config was fingerprinted with algorithm version ${versionCheck.storedVersion}, but this worktree computes version ${versionCheck.currentVersion}. Digests from different algorithm versions are not comparable, so the config-coherence check was skipped. Run \`/swarm memory link\` to refresh the cohort fingerprint.`, {
|
|
9925
|
+
cohortRoot: this.cohortRoot,
|
|
9926
|
+
storedVersion: versionCheck.storedVersion,
|
|
9927
|
+
expectedVersion: versionCheck.currentVersion
|
|
9928
|
+
});
|
|
9929
|
+
return;
|
|
9930
|
+
}
|
|
9887
9931
|
const storedFingerprint = stored.fingerprint;
|
|
9888
9932
|
if (typeof storedFingerprint !== "string") {
|
|
9889
9933
|
warn("[memory-cohort] cohort config fingerprint file is malformed; config-coherence check skipped.", { cohortRoot: this.cohortRoot });
|
|
@@ -11683,7 +11727,7 @@ async function runGit2(directory, args, options) {
|
|
|
11683
11727
|
};
|
|
11684
11728
|
let proc;
|
|
11685
11729
|
try {
|
|
11686
|
-
proc =
|
|
11730
|
+
proc = _internals13.bunSpawn(["git", "-c", "core.quotepath=false", ...args], spawnOptions);
|
|
11687
11731
|
} catch (error2) {
|
|
11688
11732
|
return {
|
|
11689
11733
|
ok: false,
|
|
@@ -11766,8 +11810,8 @@ function sameCanonicalDirectory(left, right) {
|
|
|
11766
11810
|
if (samePath(left, right))
|
|
11767
11811
|
return true;
|
|
11768
11812
|
try {
|
|
11769
|
-
const leftStat =
|
|
11770
|
-
const rightStat =
|
|
11813
|
+
const leftStat = _internals13.lstatBigIntSync(left);
|
|
11814
|
+
const rightStat = _internals13.lstatBigIntSync(right);
|
|
11771
11815
|
return leftStat.isDirectory() && rightStat.isDirectory() && !leftStat.isSymbolicLink() && !rightStat.isSymbolicLink() && (leftStat.dev !== 0n || leftStat.ino !== 0n) && sameFileIdentity(leftStat, rightStat);
|
|
11772
11816
|
} catch {
|
|
11773
11817
|
return false;
|
|
@@ -11882,7 +11926,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
11882
11926
|
}
|
|
11883
11927
|
let handle;
|
|
11884
11928
|
try {
|
|
11885
|
-
const pathStat =
|
|
11929
|
+
const pathStat = _internals13.lstatBigIntSync(candidate);
|
|
11886
11930
|
if (pathStat.isSymbolicLink()) {
|
|
11887
11931
|
return {
|
|
11888
11932
|
truncated: false,
|
|
@@ -11903,7 +11947,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
11903
11947
|
}
|
|
11904
11948
|
};
|
|
11905
11949
|
}
|
|
11906
|
-
const canonicalBeforeOpen =
|
|
11950
|
+
const canonicalBeforeOpen = _internals13.realpathSync(candidate);
|
|
11907
11951
|
if (!isContained(root, canonicalBeforeOpen)) {
|
|
11908
11952
|
return {
|
|
11909
11953
|
truncated: false,
|
|
@@ -11914,9 +11958,9 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
11914
11958
|
}
|
|
11915
11959
|
};
|
|
11916
11960
|
}
|
|
11917
|
-
handle =
|
|
11918
|
-
const openedBeforeRead =
|
|
11919
|
-
const canonicalAfterOpen =
|
|
11961
|
+
handle = _internals13.openSync(canonicalBeforeOpen, "r");
|
|
11962
|
+
const openedBeforeRead = _internals13.fstatBigIntSync(handle);
|
|
11963
|
+
const canonicalAfterOpen = _internals13.realpathSync(candidate);
|
|
11920
11964
|
if (!openedBeforeRead.isFile() || !sameFileSnapshot(pathStat, openedBeforeRead) || !samePath(canonicalBeforeOpen, canonicalAfterOpen) || !isContained(root, canonicalAfterOpen)) {
|
|
11921
11965
|
return {
|
|
11922
11966
|
truncated: false,
|
|
@@ -11931,13 +11975,13 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
11931
11975
|
const bytes = Buffer.alloc(requested);
|
|
11932
11976
|
let count = 0;
|
|
11933
11977
|
while (count < requested) {
|
|
11934
|
-
const read =
|
|
11978
|
+
const read = _internals13.readSync(handle, bytes, count, requested - count, count);
|
|
11935
11979
|
if (read === 0)
|
|
11936
11980
|
break;
|
|
11937
11981
|
count += read;
|
|
11938
11982
|
}
|
|
11939
|
-
const openedAfterRead =
|
|
11940
|
-
const canonicalAfterRead =
|
|
11983
|
+
const openedAfterRead = _internals13.fstatBigIntSync(handle);
|
|
11984
|
+
const canonicalAfterRead = _internals13.realpathSync(candidate);
|
|
11941
11985
|
if (!sameFileSnapshot(openedBeforeRead, openedAfterRead) || !samePath(canonicalBeforeOpen, canonicalAfterRead) || !isContained(root, canonicalAfterRead) || openedBeforeRead.size <= BigInt(maxFileBytes) && BigInt(count) !== openedBeforeRead.size) {
|
|
11942
11986
|
return {
|
|
11943
11987
|
truncated: false,
|
|
@@ -11989,7 +12033,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
11989
12033
|
} finally {
|
|
11990
12034
|
if (handle !== undefined) {
|
|
11991
12035
|
try {
|
|
11992
|
-
|
|
12036
|
+
_internals13.closeSync(handle);
|
|
11993
12037
|
} catch {}
|
|
11994
12038
|
}
|
|
11995
12039
|
}
|
|
@@ -12027,7 +12071,7 @@ async function collectReviewDiff(options) {
|
|
|
12027
12071
|
const maxUntrackedFileBytes = boundedPositiveInteger(options.maxUntrackedFileBytes, DEFAULT_MAX_UNTRACKED_FILE_BYTES, MAX_UNTRACKED_FILE_BYTES);
|
|
12028
12072
|
let root;
|
|
12029
12073
|
try {
|
|
12030
|
-
root =
|
|
12074
|
+
root = _internals13.realpathSync(options.directory);
|
|
12031
12075
|
} catch (error2) {
|
|
12032
12076
|
return {
|
|
12033
12077
|
status: "error",
|
|
@@ -12050,7 +12094,7 @@ async function collectReviewDiff(options) {
|
|
|
12050
12094
|
}
|
|
12051
12095
|
let gitRoot;
|
|
12052
12096
|
try {
|
|
12053
|
-
gitRoot =
|
|
12097
|
+
gitRoot = _internals13.realpathSync(topLevel.stdout.trim());
|
|
12054
12098
|
} catch {
|
|
12055
12099
|
return {
|
|
12056
12100
|
status: "error",
|
|
@@ -12312,7 +12356,7 @@ async function collectReviewDiff(options) {
|
|
|
12312
12356
|
const clean = canonicalText.trim().length === 0 && untrackedCount === 0 && skipReasons.length === 0;
|
|
12313
12357
|
return { status: clean ? "clean" : "ok", ...scope };
|
|
12314
12358
|
}
|
|
12315
|
-
var
|
|
12359
|
+
var _internals13 = {
|
|
12316
12360
|
bunSpawn,
|
|
12317
12361
|
realpathSync: fs4.realpathSync,
|
|
12318
12362
|
lstatBigIntSync: (path19) => fs4.lstatSync(path19, { bigint: true }),
|
|
@@ -12347,7 +12391,7 @@ function formatCommandNotFound(tokens) {
|
|
|
12347
12391
|
const attemptedCommand = tokens[0] || "";
|
|
12348
12392
|
const MAX_DISPLAY = 100;
|
|
12349
12393
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
12350
|
-
const similar =
|
|
12394
|
+
const similar = _internals14.findSimilarCommands(attemptedCommand);
|
|
12351
12395
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
12352
12396
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
12353
12397
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -14268,7 +14312,7 @@ ${USAGE2}`;
|
|
|
14268
14312
|
|
|
14269
14313
|
// src/commands/archive.ts
|
|
14270
14314
|
init_loader();
|
|
14271
|
-
var
|
|
14315
|
+
var _internals17 = {
|
|
14272
14316
|
now: () => new Date
|
|
14273
14317
|
};
|
|
14274
14318
|
function artifactLabel(artifact) {
|
|
@@ -14324,7 +14368,7 @@ async function handleArchiveCommand(directory, args) {
|
|
|
14324
14368
|
const report = await archiveEvidence(directory, maxAgeDays, maxBundles, {
|
|
14325
14369
|
report: true,
|
|
14326
14370
|
dryRun,
|
|
14327
|
-
now:
|
|
14371
|
+
now: _internals17.now(),
|
|
14328
14372
|
cacheMaxBytes,
|
|
14329
14373
|
cacheMaxRecords
|
|
14330
14374
|
});
|
|
@@ -15922,7 +15966,7 @@ var IPV4_PRIVATE_192 = /^192\.168\./;
|
|
|
15922
15966
|
var IPV4_ZERO_NETWORK = /^0\./;
|
|
15923
15967
|
var IPV6_LINK_LOCAL = /^fe80:/i;
|
|
15924
15968
|
var IPV6_UNIQUE_LOCAL = /^f[cd][0-9a-f]{2}:/i;
|
|
15925
|
-
var
|
|
15969
|
+
var _internals18 = {
|
|
15926
15970
|
spawnSync: (cmd, args, options) => {
|
|
15927
15971
|
const mergedEnv = mergeEnvForChild(options?.env, options?.envOverrides);
|
|
15928
15972
|
return child_process2.spawnSync(cmd, args, {
|
|
@@ -16040,7 +16084,7 @@ function validateAndSanitizeGithubUrl(rawUrl, resource) {
|
|
|
16040
16084
|
}
|
|
16041
16085
|
function detectGitRemote(cwd, laneEnv) {
|
|
16042
16086
|
try {
|
|
16043
|
-
const result =
|
|
16087
|
+
const result = _internals18.spawnSync("git", ["remote", "get-url", "origin"], {
|
|
16044
16088
|
encoding: "utf-8",
|
|
16045
16089
|
stdio: ["ignore", "pipe", "pipe"],
|
|
16046
16090
|
timeout: 5000,
|
|
@@ -16208,7 +16252,7 @@ init_logger();
|
|
|
16208
16252
|
var GIT_TIMEOUT_MS4 = 30000;
|
|
16209
16253
|
var VALIDATION_TIMEOUT_MS = 5 * 60 * 1000;
|
|
16210
16254
|
var OUTPUT_LIMIT_BYTES = 12000;
|
|
16211
|
-
var
|
|
16255
|
+
var _internals19 = {
|
|
16212
16256
|
runExternalTool,
|
|
16213
16257
|
getDefaultBaseBranch,
|
|
16214
16258
|
platform: process.platform,
|
|
@@ -16219,7 +16263,7 @@ var _internals18 = {
|
|
|
16219
16263
|
}
|
|
16220
16264
|
};
|
|
16221
16265
|
async function runGit3(args, cwd, timeoutMs = GIT_TIMEOUT_MS4) {
|
|
16222
|
-
const result = await
|
|
16266
|
+
const result = await _internals19.runExternalTool({
|
|
16223
16267
|
executable: "git",
|
|
16224
16268
|
args,
|
|
16225
16269
|
cwd,
|
|
@@ -16237,7 +16281,7 @@ async function runGit3(args, cwd, timeoutMs = GIT_TIMEOUT_MS4) {
|
|
|
16237
16281
|
}
|
|
16238
16282
|
async function runValidationCommand(cmd, cwd, timeoutMs = VALIDATION_TIMEOUT_MS) {
|
|
16239
16283
|
const [executable, ...args] = cmd;
|
|
16240
|
-
const result = await
|
|
16284
|
+
const result = await _internals19.runExternalTool({
|
|
16241
16285
|
executable,
|
|
16242
16286
|
args,
|
|
16243
16287
|
cwd,
|
|
@@ -16265,7 +16309,7 @@ async function getCurrentBranchOrRef(directory) {
|
|
|
16265
16309
|
return hashResult.stdout.trim();
|
|
16266
16310
|
}
|
|
16267
16311
|
async function setupWorktree(projectRoot, prRef, baseBranch, onWorktreeCreated) {
|
|
16268
|
-
const worktreeBase = path25.join(
|
|
16312
|
+
const worktreeBase = path25.join(_internals19.osTmpdir(), "swarm-ci-simulate");
|
|
16269
16313
|
const worktreeName = `pr-${Date.now()}-${Math.floor(Math.random() * 1e6)}`;
|
|
16270
16314
|
const worktreePath = path25.join(worktreeBase, worktreeName);
|
|
16271
16315
|
await fsPromises2.mkdir(worktreeBase, { recursive: true });
|
|
@@ -16283,8 +16327,8 @@ async function setupWorktree(projectRoot, prRef, baseBranch, onWorktreeCreated)
|
|
|
16283
16327
|
async function cleanupWorktree(worktreePath, projectRoot) {
|
|
16284
16328
|
const removeResult = await runGit3(["worktree", "remove", "--force", worktreePath], projectRoot);
|
|
16285
16329
|
try {
|
|
16286
|
-
if (
|
|
16287
|
-
|
|
16330
|
+
if (_internals19.fs.existsSync(worktreePath)) {
|
|
16331
|
+
_internals19.fs.rmSync(worktreePath, { recursive: true, force: true });
|
|
16288
16332
|
}
|
|
16289
16333
|
} catch {}
|
|
16290
16334
|
if (removeResult.exitCode !== 0) {
|
|
@@ -16366,7 +16410,7 @@ async function handleCiSimulateCommand(directory, args) {
|
|
|
16366
16410
|
steps: []
|
|
16367
16411
|
};
|
|
16368
16412
|
try {
|
|
16369
|
-
const baseBranch =
|
|
16413
|
+
const baseBranch = _internals19.getDefaultBaseBranch(directory);
|
|
16370
16414
|
if (!isSafeGitRef(baseBranch)) {
|
|
16371
16415
|
throw new Error("Detected default branch is not a safe git reference.");
|
|
16372
16416
|
}
|
|
@@ -17058,7 +17102,7 @@ async function readLedgerForTransaction(filePath) {
|
|
|
17058
17102
|
}
|
|
17059
17103
|
}
|
|
17060
17104
|
async function readLedgerStrict(directory) {
|
|
17061
|
-
const filePath =
|
|
17105
|
+
const filePath = _internals20.resolveRecommendationLedgerPath(directory);
|
|
17062
17106
|
try {
|
|
17063
17107
|
return parseLedgerJsonl(await readFile7(filePath, "utf-8"));
|
|
17064
17108
|
} catch (err) {
|
|
@@ -17136,7 +17180,7 @@ async function checkRecommendations(directory, candidates) {
|
|
|
17136
17180
|
let ledgerKeys = new Set;
|
|
17137
17181
|
let degraded = false;
|
|
17138
17182
|
try {
|
|
17139
|
-
const entries = await
|
|
17183
|
+
const entries = await _internals20.readLedgerStrict(directory);
|
|
17140
17184
|
ledgerKeys = new Set(entries.map((entry) => entry.crossKey));
|
|
17141
17185
|
} catch (err) {
|
|
17142
17186
|
warn(`[recommendation-ledger] check failed (fail-open, emitting everything): ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -17198,13 +17242,13 @@ async function recordEmittedRecommendations(directory, candidates, options = {})
|
|
|
17198
17242
|
if (!candidates.some(hasIdentity)) {
|
|
17199
17243
|
return { recorded: 0, suppressed: 0, evicted: 0, degraded: false };
|
|
17200
17244
|
}
|
|
17201
|
-
const emittedAt = options.producedAt ??
|
|
17245
|
+
const emittedAt = options.producedAt ?? _internals20.now().toISOString();
|
|
17202
17246
|
let recorded = 0;
|
|
17203
17247
|
let suppressed = 0;
|
|
17204
17248
|
let evicted = 0;
|
|
17205
17249
|
try {
|
|
17206
|
-
const filePath =
|
|
17207
|
-
const wrote = await
|
|
17250
|
+
const filePath = _internals20.resolveRecommendationLedgerPath(directory);
|
|
17251
|
+
const wrote = await _internals20.transactFile(filePath, readLedgerForTransaction, async (target, data) => {
|
|
17208
17252
|
await atomicWriteFile(target, serializeLedger(data));
|
|
17209
17253
|
}, (existing) => {
|
|
17210
17254
|
const seen = new Set(existing.map((entry) => entry.crossKey));
|
|
@@ -17241,7 +17285,7 @@ async function recordEmittedRecommendations(directory, candidates, options = {})
|
|
|
17241
17285
|
return { recorded: 0, suppressed: 0, evicted: 0, degraded: true };
|
|
17242
17286
|
}
|
|
17243
17287
|
}
|
|
17244
|
-
var
|
|
17288
|
+
var _internals20 = {
|
|
17245
17289
|
now: () => new Date,
|
|
17246
17290
|
transactFile,
|
|
17247
17291
|
readLedgerStrict,
|
|
@@ -17607,7 +17651,7 @@ async function reviseSkill(params) {
|
|
|
17607
17651
|
}
|
|
17608
17652
|
if (!params.delegate) {
|
|
17609
17653
|
try {
|
|
17610
|
-
const revised =
|
|
17654
|
+
const revised = _internals21.buildDeterministicRevision(params.currentContent, params.currentVersion, params.violationContexts);
|
|
17611
17655
|
const validation = await validateRevisionCandidate(params, revised, "skill_reviser:deterministic");
|
|
17612
17656
|
if (!validation.passed) {
|
|
17613
17657
|
return {
|
|
@@ -17734,7 +17778,7 @@ async function reviseSkill(params) {
|
|
|
17734
17778
|
};
|
|
17735
17779
|
}
|
|
17736
17780
|
}
|
|
17737
|
-
var
|
|
17781
|
+
var _internals21 = {
|
|
17738
17782
|
reviseSkill,
|
|
17739
17783
|
getSkillVersion,
|
|
17740
17784
|
buildDeterministicRevision,
|
|
@@ -18113,7 +18157,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
18113
18157
|
};
|
|
18114
18158
|
}
|
|
18115
18159
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
18116
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
18160
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-bqan4y2y.js");
|
|
18117
18161
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
18118
18162
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
18119
18163
|
if (sweepConfig?.enabled === false)
|
|
@@ -18236,7 +18280,7 @@ function resolveLogPath(directory) {
|
|
|
18236
18280
|
function normalizeComplianceVerdict(verdict) {
|
|
18237
18281
|
return verdict === "violation" ? "violated" : verdict;
|
|
18238
18282
|
}
|
|
18239
|
-
var
|
|
18283
|
+
var _internals22 = {
|
|
18240
18284
|
generateId: () => crypto2.randomUUID(),
|
|
18241
18285
|
appendFileSync: fs10.appendFileSync.bind(fs10),
|
|
18242
18286
|
readFileSync: fs10.readFileSync.bind(fs10),
|
|
@@ -18306,9 +18350,9 @@ function parseFeedbackMarker(raw) {
|
|
|
18306
18350
|
function readFeedbackAppliedEntryIds(directory) {
|
|
18307
18351
|
const resolved = resolveLogPath(directory);
|
|
18308
18352
|
const processed = new Set;
|
|
18309
|
-
if (!
|
|
18353
|
+
if (!_internals22.existsSync(resolved))
|
|
18310
18354
|
return processed;
|
|
18311
|
-
const raw =
|
|
18355
|
+
const raw = _internals22.readFileSync(resolved, "utf-8");
|
|
18312
18356
|
for (const line of raw.split(`
|
|
18313
18357
|
`)) {
|
|
18314
18358
|
const trimmed = line.trim();
|
|
@@ -18329,15 +18373,15 @@ function appendFeedbackAppliedMarker(directory, processedEntryIds) {
|
|
|
18329
18373
|
return;
|
|
18330
18374
|
const resolved = resolveLogPath(directory);
|
|
18331
18375
|
const dir = path30.dirname(resolved);
|
|
18332
|
-
if (!
|
|
18333
|
-
|
|
18376
|
+
if (!_internals22.existsSync(dir)) {
|
|
18377
|
+
_internals22.mkdirSync(dir, { recursive: true });
|
|
18334
18378
|
}
|
|
18335
18379
|
const marker = {
|
|
18336
18380
|
type: "feedback_applied",
|
|
18337
18381
|
timestamp: new Date().toISOString(),
|
|
18338
18382
|
processedEntryIds: [...new Set(processedEntryIds)]
|
|
18339
18383
|
};
|
|
18340
|
-
|
|
18384
|
+
_internals22.appendFileSync(resolved, `${JSON.stringify(marker)}
|
|
18341
18385
|
`, "utf-8");
|
|
18342
18386
|
}
|
|
18343
18387
|
function appendSkillUsageEntry(directory, entry) {
|
|
@@ -18374,11 +18418,11 @@ function appendSkillUsageEntry(directory, entry) {
|
|
|
18374
18418
|
}
|
|
18375
18419
|
const resolved = validateSwarmPath(directory, "skill-usage.jsonl");
|
|
18376
18420
|
const dir = path30.dirname(resolved);
|
|
18377
|
-
if (!
|
|
18378
|
-
|
|
18421
|
+
if (!_internals22.existsSync(dir)) {
|
|
18422
|
+
_internals22.mkdirSync(dir, { recursive: true });
|
|
18379
18423
|
}
|
|
18380
18424
|
const fullEntry = {
|
|
18381
|
-
id:
|
|
18425
|
+
id: _internals22.generateId(),
|
|
18382
18426
|
skillPath,
|
|
18383
18427
|
agentName,
|
|
18384
18428
|
taskID,
|
|
@@ -18388,21 +18432,21 @@ function appendSkillUsageEntry(directory, entry) {
|
|
|
18388
18432
|
...reviewerNotes !== undefined && { reviewerNotes },
|
|
18389
18433
|
...skillVersion !== undefined && { skillVersion }
|
|
18390
18434
|
};
|
|
18391
|
-
|
|
18435
|
+
_internals22.appendFileSync(resolved, `${JSON.stringify(fullEntry)}
|
|
18392
18436
|
`, "utf-8");
|
|
18393
18437
|
try {
|
|
18394
|
-
const stat4 =
|
|
18438
|
+
const stat4 = _internals22.statSync(resolved);
|
|
18395
18439
|
if (stat4.size > SKILL_USAGE_LOG_ROTATE_BYTES) {
|
|
18396
|
-
|
|
18440
|
+
_internals22.pruneSkillUsageLog(directory, SKILL_USAGE_LOG_MAX_ENTRIES_PER_SKILL);
|
|
18397
18441
|
}
|
|
18398
18442
|
} catch {}
|
|
18399
18443
|
}
|
|
18400
18444
|
function readSkillUsageEntries(directory, options) {
|
|
18401
18445
|
const resolved = resolveLogPath(directory);
|
|
18402
|
-
if (!
|
|
18446
|
+
if (!_internals22.existsSync(resolved)) {
|
|
18403
18447
|
return [];
|
|
18404
18448
|
}
|
|
18405
|
-
const raw =
|
|
18449
|
+
const raw = _internals22.readFileSync(resolved, "utf-8");
|
|
18406
18450
|
const entries = [];
|
|
18407
18451
|
for (const line of raw.split(`
|
|
18408
18452
|
`)) {
|
|
@@ -18445,20 +18489,20 @@ var SKILL_USAGE_LOG_ROTATE_BYTES = 1024 * 1024;
|
|
|
18445
18489
|
var SKILL_USAGE_LOG_MAX_ENTRIES_PER_SKILL = 500;
|
|
18446
18490
|
function readSkillUsageEntriesTail(directory, filters, maxBytes = TAIL_BYTES_DEFAULT) {
|
|
18447
18491
|
const logPath = resolveLogPath(directory);
|
|
18448
|
-
if (!
|
|
18492
|
+
if (!_internals22.existsSync(logPath))
|
|
18449
18493
|
return [];
|
|
18450
18494
|
try {
|
|
18451
18495
|
const normalizedMaxBytes = Number.isFinite(maxBytes) ? maxBytes : TAIL_BYTES_DEFAULT;
|
|
18452
18496
|
const boundedMaxBytes = Math.min(Math.max(1, normalizedMaxBytes), MAX_TAIL_BYTES);
|
|
18453
|
-
const stat4 =
|
|
18497
|
+
const stat4 = _internals22.statSync(logPath);
|
|
18454
18498
|
const start = Math.max(0, stat4.size - boundedMaxBytes);
|
|
18455
|
-
const fd =
|
|
18499
|
+
const fd = _internals22.openSync(logPath, "r");
|
|
18456
18500
|
try {
|
|
18457
18501
|
const readLen = stat4.size - start;
|
|
18458
18502
|
if (readLen === 0)
|
|
18459
18503
|
return [];
|
|
18460
18504
|
const buf = Buffer.alloc(readLen);
|
|
18461
|
-
|
|
18505
|
+
_internals22.readSync(fd, buf, 0, buf.length, start);
|
|
18462
18506
|
const content = buf.toString("utf-8");
|
|
18463
18507
|
let usable;
|
|
18464
18508
|
if (start > 0) {
|
|
@@ -18485,7 +18529,7 @@ function readSkillUsageEntriesTail(directory, filters, maxBytes = TAIL_BYTES_DEF
|
|
|
18485
18529
|
}
|
|
18486
18530
|
return entries;
|
|
18487
18531
|
} finally {
|
|
18488
|
-
|
|
18532
|
+
_internals22.closeSync(fd);
|
|
18489
18533
|
}
|
|
18490
18534
|
} catch {
|
|
18491
18535
|
return [];
|
|
@@ -18522,10 +18566,10 @@ function computeComplianceByVersion(entries, skillPath) {
|
|
|
18522
18566
|
}
|
|
18523
18567
|
function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
|
|
18524
18568
|
const resolved = resolveLogPath(directory);
|
|
18525
|
-
if (!
|
|
18569
|
+
if (!_internals22.existsSync(resolved)) {
|
|
18526
18570
|
return { pruned: 0, remaining: 0 };
|
|
18527
18571
|
}
|
|
18528
|
-
const raw =
|
|
18572
|
+
const raw = _internals22.readFileSync(resolved, "utf-8");
|
|
18529
18573
|
const lines = raw.split(`
|
|
18530
18574
|
`);
|
|
18531
18575
|
const entries = [];
|
|
@@ -18555,13 +18599,13 @@ function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
|
|
|
18555
18599
|
`).concat(preservedMarkers.length > 0 ? `
|
|
18556
18600
|
` : "");
|
|
18557
18601
|
try {
|
|
18558
|
-
|
|
18559
|
-
|
|
18602
|
+
_internals22.writeFileSync(tmpPath2, content2, "utf-8");
|
|
18603
|
+
_internals22.renameSync(tmpPath2, resolved);
|
|
18560
18604
|
} catch (writeErr) {
|
|
18561
18605
|
const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
|
|
18562
18606
|
try {
|
|
18563
|
-
if (
|
|
18564
|
-
|
|
18607
|
+
if (_internals22.existsSync(tmpPath2)) {
|
|
18608
|
+
_internals22.writeFileSync(tmpPath2, "", "utf-8");
|
|
18565
18609
|
}
|
|
18566
18610
|
} catch {}
|
|
18567
18611
|
return { pruned: 0, remaining: 0, error: msg };
|
|
@@ -18600,13 +18644,13 @@ function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
|
|
|
18600
18644
|
`).concat(`
|
|
18601
18645
|
`);
|
|
18602
18646
|
try {
|
|
18603
|
-
|
|
18604
|
-
|
|
18647
|
+
_internals22.writeFileSync(tmpPath, content, "utf-8");
|
|
18648
|
+
_internals22.renameSync(tmpPath, resolved);
|
|
18605
18649
|
} catch (writeErr) {
|
|
18606
18650
|
const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
|
|
18607
18651
|
try {
|
|
18608
|
-
if (
|
|
18609
|
-
|
|
18652
|
+
if (_internals22.existsSync(tmpPath)) {
|
|
18653
|
+
_internals22.writeFileSync(tmpPath, "", "utf-8");
|
|
18610
18654
|
}
|
|
18611
18655
|
} catch {}
|
|
18612
18656
|
return { pruned: 0, remaining: entries.length, error: msg };
|
|
@@ -18628,10 +18672,10 @@ async function resolveSourceKnowledgeIds(directory, skillPath) {
|
|
|
18628
18672
|
if (!isContained2) {
|
|
18629
18673
|
return [];
|
|
18630
18674
|
}
|
|
18631
|
-
if (!
|
|
18675
|
+
if (!_internals22.existsSync(absolute)) {
|
|
18632
18676
|
return [];
|
|
18633
18677
|
}
|
|
18634
|
-
const content =
|
|
18678
|
+
const content = _internals22.readFileSync(absolute, "utf-8");
|
|
18635
18679
|
return parseGeneratedFromKnowledge(content);
|
|
18636
18680
|
} catch (err) {
|
|
18637
18681
|
log("[skill-usage-log] resolveSourceKnowledgeIds failed (fail-open):", err instanceof Error ? err.message : String(err));
|
|
@@ -18740,7 +18784,7 @@ var MAX_CURATOR_PHASE_DIGESTS = 50;
|
|
|
18740
18784
|
var MAX_CURATOR_COMPLIANCE_OBSERVATIONS = 200;
|
|
18741
18785
|
var MAX_CURATOR_RECOMMENDATIONS = 200;
|
|
18742
18786
|
var MAX_LESSON_CHARS = 280;
|
|
18743
|
-
var
|
|
18787
|
+
var _internals23 = {
|
|
18744
18788
|
parseKnowledgeRecommendations,
|
|
18745
18789
|
parseKnowledgeRecommendationsWithDiagnostics,
|
|
18746
18790
|
readCuratorSummary,
|
|
@@ -18848,9 +18892,9 @@ ${digest.summary}`).join(`
|
|
|
18848
18892
|
async function autoRetireSkills(directory, _curatorKnowledgePath, excludeSlugs) {
|
|
18849
18893
|
const observations = [];
|
|
18850
18894
|
try {
|
|
18851
|
-
const skillListResult = await
|
|
18852
|
-
const usageEntries =
|
|
18853
|
-
const allArchivedIds = await
|
|
18895
|
+
const skillListResult = await _internals23.listSkills(directory);
|
|
18896
|
+
const usageEntries = _internals23.readSkillUsageEntries(directory);
|
|
18897
|
+
const allArchivedIds = await _internals23.getArchivedKnowledgeIds(directory);
|
|
18854
18898
|
for (const active of skillListResult.active) {
|
|
18855
18899
|
if (excludeSlugs?.has(active.slug))
|
|
18856
18900
|
continue;
|
|
@@ -18872,7 +18916,7 @@ async function autoRetireSkills(directory, _curatorKnowledgePath, excludeSlugs)
|
|
|
18872
18916
|
const violationRate = skillUsage.length > 0 ? violations / skillUsage.length : 0;
|
|
18873
18917
|
if (violationRate > 0.3) {
|
|
18874
18918
|
const reason = `auto-retire: violation rate ${(violationRate * 100).toFixed(0)}% exceeds 30% threshold`;
|
|
18875
|
-
await
|
|
18919
|
+
await _internals23.retireSkill(directory, active.slug, reason);
|
|
18876
18920
|
observations.push(`Skill '${active.slug}' auto-retired: ${reason}`);
|
|
18877
18921
|
warn(`[curator] ${observations[observations.length - 1]}`);
|
|
18878
18922
|
continue;
|
|
@@ -18880,15 +18924,15 @@ async function autoRetireSkills(directory, _curatorKnowledgePath, excludeSlugs)
|
|
|
18880
18924
|
let archivedSourceMatched = false;
|
|
18881
18925
|
if (allArchivedIds.size > 0) {
|
|
18882
18926
|
try {
|
|
18883
|
-
const content = await
|
|
18884
|
-
const sourceIds =
|
|
18927
|
+
const content = await _internals23.readFileAsync(active.path, "utf-8");
|
|
18928
|
+
const sourceIds = _internals23.parseDraftFrontmatter(content)?.sourceKnowledgeIds ?? [];
|
|
18885
18929
|
archivedSourceMatched = sourceIds.some((id) => allArchivedIds.has(id));
|
|
18886
18930
|
} catch {
|
|
18887
18931
|
archivedSourceMatched = false;
|
|
18888
18932
|
}
|
|
18889
18933
|
}
|
|
18890
18934
|
if (archivedSourceMatched) {
|
|
18891
|
-
const result = await
|
|
18935
|
+
const result = await _internals23.retireOrMarkStale(directory, path31.dirname(active.path), allArchivedIds);
|
|
18892
18936
|
if (result.action === "retire") {
|
|
18893
18937
|
observations.push(`Skill '${active.slug}' auto-retired: all source knowledge entries archived`);
|
|
18894
18938
|
warn(`[curator] ${observations[observations.length - 1]}`);
|
|
@@ -19160,7 +19204,7 @@ async function transactCuratorSummary(directory, mutate) {
|
|
|
19160
19204
|
const resolvedPath = validateSwarmPath(directory, "curator-summary.json");
|
|
19161
19205
|
let invoked = false;
|
|
19162
19206
|
let mutationResult;
|
|
19163
|
-
await
|
|
19207
|
+
await _internals23.transactFile(resolvedPath, _internals23.readCuratorSummaryState, _internals23.writeCuratorSummaryState, (state) => {
|
|
19164
19208
|
invoked = true;
|
|
19165
19209
|
const mutation = mutate(state.summary);
|
|
19166
19210
|
mutationResult = mutation.result;
|
|
@@ -19309,8 +19353,8 @@ function checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, pha
|
|
|
19309
19353
|
const observations = [];
|
|
19310
19354
|
const timestamp = new Date().toISOString();
|
|
19311
19355
|
for (const agent of requiredAgents) {
|
|
19312
|
-
const normalizedAgent =
|
|
19313
|
-
const isDispatched = agentsDispatched.some((a) =>
|
|
19356
|
+
const normalizedAgent = _internals23.normalizeAgentName(agent);
|
|
19357
|
+
const isDispatched = agentsDispatched.some((a) => _internals23.normalizeAgentName(a) === normalizedAgent);
|
|
19314
19358
|
if (!isDispatched) {
|
|
19315
19359
|
observations.push({
|
|
19316
19360
|
phase,
|
|
@@ -19329,7 +19373,7 @@ function checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, pha
|
|
|
19329
19373
|
if (e.type === "agent.delegation") {
|
|
19330
19374
|
const agent = e.agent;
|
|
19331
19375
|
if (agent && typeof agent === "string") {
|
|
19332
|
-
const normalized =
|
|
19376
|
+
const normalized = _internals23.normalizeAgentName(agent);
|
|
19333
19377
|
if (normalized === "coder") {
|
|
19334
19378
|
coderDelegations.push({ event: e, index: i });
|
|
19335
19379
|
} else if (normalized === "reviewer") {
|
|
@@ -19386,7 +19430,7 @@ function checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, pha
|
|
|
19386
19430
|
if (e.type === "agent.delegation" && e.agent) {
|
|
19387
19431
|
const agent = e.agent;
|
|
19388
19432
|
if (agent && typeof agent === "string") {
|
|
19389
|
-
const normalized =
|
|
19433
|
+
const normalized = _internals23.normalizeAgentName(agent);
|
|
19390
19434
|
if (normalized === "sme") {
|
|
19391
19435
|
smeDelegations.push({ event: e, index: i });
|
|
19392
19436
|
}
|
|
@@ -19410,7 +19454,7 @@ function checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, pha
|
|
|
19410
19454
|
}
|
|
19411
19455
|
async function runCuratorInit(directory, config, llmDelegate) {
|
|
19412
19456
|
try {
|
|
19413
|
-
const priorSummary = await
|
|
19457
|
+
const priorSummary = await _internals23.readCuratorSummary(directory);
|
|
19414
19458
|
const knowledgePath = resolveSwarmKnowledgePath(directory);
|
|
19415
19459
|
const allEntries = await readKnowledge(knowledgePath);
|
|
19416
19460
|
const highConfidenceEntries = allEntries.filter((e) => typeof e.confidence === "number" && e.confidence >= config.min_knowledge_confidence);
|
|
@@ -19451,7 +19495,7 @@ async function runCuratorInit(directory, config, llmDelegate) {
|
|
|
19451
19495
|
const maxContextChars = config.max_summary_tokens * 2;
|
|
19452
19496
|
briefingParts.push(contextMd.slice(0, maxContextChars));
|
|
19453
19497
|
}
|
|
19454
|
-
const latestPostMortemDigest =
|
|
19498
|
+
const latestPostMortemDigest = _internals23.readLatestPostMortemDigest(directory);
|
|
19455
19499
|
if (latestPostMortemDigest) {
|
|
19456
19500
|
briefingParts.push(`
|
|
19457
19501
|
## Latest Post-Mortem`);
|
|
@@ -19538,7 +19582,7 @@ Could not load prior session context.`,
|
|
|
19538
19582
|
}
|
|
19539
19583
|
async function runCuratorPhase(directory, phase, agentsDispatched, config, knowledgeConfig, llmDelegate) {
|
|
19540
19584
|
try {
|
|
19541
|
-
const priorSummary = await
|
|
19585
|
+
const priorSummary = await _internals23.readCuratorSummary(directory);
|
|
19542
19586
|
if (priorSummary?.phase_digests.some((d) => d.phase === phase)) {
|
|
19543
19587
|
const existingDigest = priorSummary.phase_digests.find((d) => d.phase === phase);
|
|
19544
19588
|
return {
|
|
@@ -19551,10 +19595,10 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19551
19595
|
};
|
|
19552
19596
|
}
|
|
19553
19597
|
const eventsJsonlContent = await readSwarmFileAsync(directory, "events.jsonl");
|
|
19554
|
-
const phaseEvents = eventsJsonlContent ?
|
|
19598
|
+
const phaseEvents = eventsJsonlContent ? _internals23.filterPhaseEvents(eventsJsonlContent, phase) : [];
|
|
19555
19599
|
const contextMd = await readSwarmFileAsync(directory, "context.md");
|
|
19556
19600
|
const requiredAgents = ["reviewer", "test_engineer"];
|
|
19557
|
-
const complianceObservations =
|
|
19601
|
+
const complianceObservations = _internals23.checkPhaseCompliance(phaseEvents, agentsDispatched, requiredAgents, phase);
|
|
19558
19602
|
const plan = await loadPlanJsonOnly(directory);
|
|
19559
19603
|
const phaseData = plan?.phases.find((p) => p.id === phase);
|
|
19560
19604
|
const tasksCompleted = phaseData ? phaseData.tasks.filter((t) => t.status === "completed").length : 0;
|
|
@@ -19578,7 +19622,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19578
19622
|
timestamp: new Date().toISOString(),
|
|
19579
19623
|
summary: `Phase ${phase} completed. ${tasksCompleted}/${tasksTotal} tasks completed. ${complianceObservations.length} compliance observations.`,
|
|
19580
19624
|
agents_used: [
|
|
19581
|
-
...new Set(agentsDispatched.map((a) =>
|
|
19625
|
+
...new Set(agentsDispatched.map((a) => _internals23.normalizeAgentName(a)))
|
|
19582
19626
|
],
|
|
19583
19627
|
tasks_completed: tasksCompleted,
|
|
19584
19628
|
tasks_total: tasksTotal,
|
|
@@ -19630,7 +19674,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19630
19674
|
clearTimeout(timer);
|
|
19631
19675
|
}
|
|
19632
19676
|
if (llmOutput?.trim()) {
|
|
19633
|
-
const parsed =
|
|
19677
|
+
const parsed = _internals23.parseKnowledgeRecommendationsWithDiagnostics(llmOutput);
|
|
19634
19678
|
for (const diagnostic of parsed.diagnostics) {
|
|
19635
19679
|
warn("[curator] skipped malformed recommendation line", {
|
|
19636
19680
|
phase,
|
|
@@ -19675,7 +19719,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19675
19719
|
}
|
|
19676
19720
|
const sessionId = `session-${Date.now()}`;
|
|
19677
19721
|
const now = new Date().toISOString();
|
|
19678
|
-
const summaryUpdated = await
|
|
19722
|
+
const summaryUpdated = await _internals23.mergeCuratorPhaseSummary(directory, {
|
|
19679
19723
|
phase,
|
|
19680
19724
|
phaseDigest,
|
|
19681
19725
|
complianceObservations,
|
|
@@ -19706,7 +19750,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19706
19750
|
}
|
|
19707
19751
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
19708
19752
|
try {
|
|
19709
|
-
const skillModule = await import("./skill-generator-
|
|
19753
|
+
const skillModule = await import("./skill-generator-ybncj9et.js");
|
|
19710
19754
|
for (const cand of skillCandidates) {
|
|
19711
19755
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
19712
19756
|
continue;
|
|
@@ -19724,8 +19768,8 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19724
19768
|
}
|
|
19725
19769
|
const revisedSlugs = new Set;
|
|
19726
19770
|
try {
|
|
19727
|
-
const skillListResult = await
|
|
19728
|
-
const usageEntries =
|
|
19771
|
+
const skillListResult = await _internals23.listSkills(directory);
|
|
19772
|
+
const usageEntries = _internals23.readSkillUsageEntries(directory);
|
|
19729
19773
|
let revisionCallsThisPhase = 0;
|
|
19730
19774
|
for (const active of skillListResult.active) {
|
|
19731
19775
|
if (revisionCallsThisPhase >= MAX_REVISION_CALLS_PER_PHASE)
|
|
@@ -19749,8 +19793,8 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19749
19793
|
const violations = skillUsage.filter((e) => e.complianceVerdict === "violated").length;
|
|
19750
19794
|
const violationRate = violations / skillUsage.length;
|
|
19751
19795
|
if (violationRate > REVISION_VIOLATION_THRESHOLD && violationRate <= 0.3) {
|
|
19752
|
-
const content = await
|
|
19753
|
-
const fm =
|
|
19796
|
+
const content = await _internals23.readFileAsync(active.path, "utf-8");
|
|
19797
|
+
const fm = _internals23.parseDraftFrontmatter(content);
|
|
19754
19798
|
if (fm && fm.skillOrigin === "promoted_external")
|
|
19755
19799
|
continue;
|
|
19756
19800
|
const currentVersion = fm?.version ?? 1;
|
|
@@ -19761,7 +19805,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19761
19805
|
reviewerNotes: e.reviewerNotes,
|
|
19762
19806
|
timestamp: e.timestamp
|
|
19763
19807
|
}));
|
|
19764
|
-
const result2 = await
|
|
19808
|
+
const result2 = await _internals23.reviseSkill({
|
|
19765
19809
|
directory,
|
|
19766
19810
|
slug: active.slug,
|
|
19767
19811
|
skillPath: active.path,
|
|
@@ -19781,12 +19825,12 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19781
19825
|
warn(`[curator] skill revision check failed: ${revisionErr instanceof Error ? revisionErr.message : String(revisionErr)}`);
|
|
19782
19826
|
}
|
|
19783
19827
|
try {
|
|
19784
|
-
const peSkillList = await
|
|
19785
|
-
const peUsageEntries =
|
|
19828
|
+
const peSkillList = await _internals23.listSkills(directory);
|
|
19829
|
+
const peUsageEntries = _internals23.readSkillUsageEntries(directory);
|
|
19786
19830
|
const peRetirementMinAgeDays = 60;
|
|
19787
19831
|
for (const active of peSkillList.active) {
|
|
19788
|
-
const content = await
|
|
19789
|
-
const fm =
|
|
19832
|
+
const content = await _internals23.readFileAsync(active.path, "utf-8");
|
|
19833
|
+
const fm = _internals23.parseDraftFrontmatter(content);
|
|
19790
19834
|
if (!fm || fm.skillOrigin !== "promoted_external")
|
|
19791
19835
|
continue;
|
|
19792
19836
|
const skillUsage = peUsageEntries.filter((e) => {
|
|
@@ -19839,7 +19883,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19839
19883
|
} catch (peErr) {
|
|
19840
19884
|
warn(`[curator] promoted-external staleness check failed: ${peErr instanceof Error ? peErr.message : String(peErr)}`);
|
|
19841
19885
|
}
|
|
19842
|
-
const autoRetireObservations = await
|
|
19886
|
+
const autoRetireObservations = await _internals23.autoRetireSkills(directory, curatorKnowledgePath, revisedSlugs);
|
|
19843
19887
|
if (autoRetireObservations.length > 0) {
|
|
19844
19888
|
const retireNote = ` [${autoRetireObservations.length} skill(s) auto-retired]`;
|
|
19845
19889
|
phaseDigest.summary += retireNote;
|
|
@@ -19976,7 +20020,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
19976
20020
|
const authorizedRevisions = new Map;
|
|
19977
20021
|
let preSnapshot = [];
|
|
19978
20022
|
if (validRecommendations.length > 0) {
|
|
19979
|
-
preSnapshot = await
|
|
20023
|
+
preSnapshot = await _internals23.readKnowledge(knowledgePath);
|
|
19980
20024
|
const authorizedRecs = [];
|
|
19981
20025
|
for (const rec of validRecommendations) {
|
|
19982
20026
|
if (rec.action !== "archive" && rec.action !== "rewrite") {
|
|
@@ -20005,7 +20049,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
20005
20049
|
}
|
|
20006
20050
|
validRecommendations = authorizedRecs;
|
|
20007
20051
|
}
|
|
20008
|
-
const dedupCheck = await
|
|
20052
|
+
const dedupCheck = await _internals23.checkRecommendations(directory, validRecommendations.map((rec) => buildCuratorRecommendationCandidate(canonicalizeRecommendationEntryId(rec, preSnapshot))));
|
|
20009
20053
|
if (!dedupCheck.degraded) {
|
|
20010
20054
|
const keptRecommendations = [];
|
|
20011
20055
|
for (const decision of dedupCheck.decisions) {
|
|
@@ -20166,7 +20210,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
20166
20210
|
} catch {}
|
|
20167
20211
|
}
|
|
20168
20212
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
20169
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
20213
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-2xe8z24p.js");
|
|
20170
20214
|
for (const { id } of contradictedEntries) {
|
|
20171
20215
|
try {
|
|
20172
20216
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -20279,7 +20323,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
20279
20323
|
currentLessons.push(lesson);
|
|
20280
20324
|
emittedCandidates.push(buildCuratorRecommendationCandidate(rec));
|
|
20281
20325
|
}
|
|
20282
|
-
await
|
|
20326
|
+
await _internals23.recordEmittedRecommendations(directory, emittedCandidates);
|
|
20283
20327
|
return { applied, skipped };
|
|
20284
20328
|
}
|
|
20285
20329
|
|
|
@@ -20550,18 +20594,18 @@ async function executePostMortemActions(directory, parsed, options, generation)
|
|
|
20550
20594
|
proposals_rejected: 0,
|
|
20551
20595
|
proposals_skipped: 0
|
|
20552
20596
|
};
|
|
20553
|
-
const knowledgeConfig = options.knowledgeConfig ?? await
|
|
20597
|
+
const knowledgeConfig = options.knowledgeConfig ?? await _internals24.loadDefaultKnowledgeConfig(directory);
|
|
20554
20598
|
if (parsed.recommendations.length > 0) {
|
|
20555
20599
|
try {
|
|
20556
|
-
const knowledgeResult = await
|
|
20600
|
+
const knowledgeResult = await _internals24.applyCuratorKnowledgeUpdates(directory, parsed.recommendations, knowledgeConfig, generation);
|
|
20557
20601
|
result.knowledge_applied = knowledgeResult.applied;
|
|
20558
20602
|
result.knowledge_skipped = knowledgeResult.skipped;
|
|
20559
20603
|
} catch (err) {
|
|
20560
20604
|
warnings.push(`Post-mortem knowledge actions failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
20561
20605
|
}
|
|
20562
20606
|
try {
|
|
20563
|
-
const entries = await
|
|
20564
|
-
const hiveResult = await
|
|
20607
|
+
const entries = await _internals24.readSwarmKnowledge(directory);
|
|
20608
|
+
const hiveResult = await _internals24.checkHivePromotions(entries, knowledgeConfig, directory);
|
|
20565
20609
|
result.hive_promotions = hiveResult.new_promotions;
|
|
20566
20610
|
result.hive_encounters_incremented = hiveResult.encounters_incremented;
|
|
20567
20611
|
result.hive_advancements = hiveResult.advancements;
|
|
@@ -20571,7 +20615,7 @@ async function executePostMortemActions(directory, parsed, options, generation)
|
|
|
20571
20615
|
}
|
|
20572
20616
|
if (parsed.queueTriage.length > 0) {
|
|
20573
20617
|
try {
|
|
20574
|
-
const proposalResult = await
|
|
20618
|
+
const proposalResult = await _internals24.applyProposalTriage(directory, parsed.queueTriage);
|
|
20575
20619
|
result.proposals_approved = proposalResult.approved.length;
|
|
20576
20620
|
result.proposals_rejected = proposalResult.rejected.length;
|
|
20577
20621
|
result.proposals_skipped = proposalResult.skipped.length;
|
|
@@ -20584,7 +20628,7 @@ async function executePostMortemActions(directory, parsed, options, generation)
|
|
|
20584
20628
|
async function verifyPostMortemKnowledgeActions(directory, recommendations) {
|
|
20585
20629
|
if (recommendations.length === 0)
|
|
20586
20630
|
return [];
|
|
20587
|
-
const entries = await
|
|
20631
|
+
const entries = await _internals24.readSwarmKnowledge(directory);
|
|
20588
20632
|
const activeEntries = entries.filter((entry) => isActiveStatus(entry.status));
|
|
20589
20633
|
const exactIds = new Set(activeEntries.map((entry) => entry.id));
|
|
20590
20634
|
const prefixMatches = new Map;
|
|
@@ -20685,7 +20729,7 @@ async function repairPostMortemActions(llmOutput, diagnostics, options) {
|
|
|
20685
20729
|
].join(`
|
|
20686
20730
|
`);
|
|
20687
20731
|
const repaired = await options.llmDelegate("", repairPrompt, ac.signal);
|
|
20688
|
-
const parsed =
|
|
20732
|
+
const parsed = _internals24.parsePostMortemActions(repaired);
|
|
20689
20733
|
if (parsed.diagnostics.length === 0) {
|
|
20690
20734
|
return parsed;
|
|
20691
20735
|
}
|
|
@@ -20738,7 +20782,7 @@ function collectRetrospectives(directory) {
|
|
|
20738
20782
|
}
|
|
20739
20783
|
async function collectDriftReports(directory) {
|
|
20740
20784
|
try {
|
|
20741
|
-
const reports = await
|
|
20785
|
+
const reports = await _internals24.readPriorDriftReports(directory);
|
|
20742
20786
|
return reports.slice(-MAX_DRIFT_REPORTS).map((report) => JSON.stringify(report, null, 2));
|
|
20743
20787
|
} catch {
|
|
20744
20788
|
return [];
|
|
@@ -20963,7 +21007,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
20963
21007
|
warnings
|
|
20964
21008
|
};
|
|
20965
21009
|
}
|
|
20966
|
-
const lock = await
|
|
21010
|
+
const lock = await _internals24.acquirePostMortemLock(directory, effectivePlanId);
|
|
20967
21011
|
if (!lock.acquired) {
|
|
20968
21012
|
return {
|
|
20969
21013
|
success: false,
|
|
@@ -20985,7 +21029,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
20985
21029
|
warnings.push("Failed to collect knowledge summary.");
|
|
20986
21030
|
}
|
|
20987
21031
|
try {
|
|
20988
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
21032
|
+
const { getScanStatus } = await import("./scan-cursor-yzj9n225.js");
|
|
20989
21033
|
const scanStatus = await getScanStatus(directory);
|
|
20990
21034
|
if (scanStatus.remaining_estimate > 0) {
|
|
20991
21035
|
warnings.push(`Fair scan: reviewed ${knowledgeSummary.length} entries this sweep (generation ${scanStatus.generation}); ${scanStatus.remaining_estimate} more eligible entries will be visited in future curation sweeps.`);
|
|
@@ -21044,20 +21088,20 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
21044
21088
|
} finally {
|
|
21045
21089
|
clearTimeout(timer);
|
|
21046
21090
|
}
|
|
21047
|
-
let parsedActions =
|
|
21091
|
+
let parsedActions = _internals24.parsePostMortemActions(llmOutput);
|
|
21048
21092
|
if (parsedActions.diagnostics.length > 0) {
|
|
21049
21093
|
warnings.push(`Post-mortem structured action parse diagnostics: ${parsedActions.diagnostics.join("; ")}`);
|
|
21050
|
-
const repaired = await
|
|
21094
|
+
const repaired = await _internals24.repairPostMortemActions(llmOutput, parsedActions.diagnostics, options);
|
|
21051
21095
|
if (repaired) {
|
|
21052
21096
|
parsedActions = repaired;
|
|
21053
21097
|
warnings.push("Post-mortem structured actions repaired by LLM.");
|
|
21054
21098
|
}
|
|
21055
21099
|
}
|
|
21056
21100
|
llmSummary = parsedActions.summary;
|
|
21057
|
-
const executed = await
|
|
21101
|
+
const executed = await _internals24.executePostMortemActions(directory, parsedActions, options, scanCursor.generation);
|
|
21058
21102
|
actionResult = executed.result;
|
|
21059
21103
|
warnings.push(...executed.warnings);
|
|
21060
|
-
const knowledgeVerification = await
|
|
21104
|
+
const knowledgeVerification = await _internals24.verifyPostMortemKnowledgeActions(directory, parsedActions.recommendations);
|
|
21061
21105
|
for (const item of knowledgeVerification) {
|
|
21062
21106
|
if (item.status === "not_found" || item.status === "ambiguous_prefix" || item.status === "missing_entry_id") {
|
|
21063
21107
|
warnings.push(`Post-mortem knowledge action ${item.action} for '${item.input_entry_id ?? "new"}' ${item.status}: ${item.reason}`);
|
|
@@ -21096,10 +21140,10 @@ ${actionSummary}`;
|
|
|
21096
21140
|
} catch (err) {
|
|
21097
21141
|
const msg = err instanceof Error ? err.message : String(err);
|
|
21098
21142
|
warnings.push(`LLM delegate failed, falling back to data-only report: ${msg}`);
|
|
21099
|
-
reportContent =
|
|
21143
|
+
reportContent = _internals24.buildDataOnlyReport(effectivePlanId, planSummary, knowledgeSummary, curatorDigest, proposals, unactionable, retrospectives, driftReports, { scope, sessionID: options.sessionID, planLoaded });
|
|
21100
21144
|
}
|
|
21101
21145
|
} else {
|
|
21102
|
-
reportContent =
|
|
21146
|
+
reportContent = _internals24.buildDataOnlyReport(effectivePlanId, planSummary, knowledgeSummary, curatorDigest, proposals, unactionable, retrospectives, driftReports, { scope, sessionID: options.sessionID, planLoaded });
|
|
21103
21147
|
}
|
|
21104
21148
|
try {
|
|
21105
21149
|
const { mkdirSync: mkdirSync12 } = await import("fs");
|
|
@@ -21140,7 +21184,7 @@ ${actionSummary}`;
|
|
|
21140
21184
|
}
|
|
21141
21185
|
}
|
|
21142
21186
|
}
|
|
21143
|
-
var
|
|
21187
|
+
var _internals24 = {
|
|
21144
21188
|
acquirePostMortemLock,
|
|
21145
21189
|
collectKnowledgeSummary,
|
|
21146
21190
|
collectRetrospectives,
|
|
@@ -21157,9 +21201,9 @@ var _internals23 = {
|
|
|
21157
21201
|
verifyPostMortemKnowledgeActions,
|
|
21158
21202
|
repairPostMortemActions,
|
|
21159
21203
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
21160
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
21204
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-cr1nr1w0.js");
|
|
21161
21205
|
try {
|
|
21162
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
21206
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-bqan4y2y.js");
|
|
21163
21207
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
21164
21208
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
21165
21209
|
} catch {
|
|
@@ -21167,11 +21211,11 @@ var _internals23 = {
|
|
|
21167
21211
|
}
|
|
21168
21212
|
},
|
|
21169
21213
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
21170
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
21214
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-jc5cc980.js");
|
|
21171
21215
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
21172
21216
|
},
|
|
21173
21217
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
21174
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
21218
|
+
const { checkHivePromotions } = await import("./hive-promoter-wyejhz8b.js");
|
|
21175
21219
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
21176
21220
|
},
|
|
21177
21221
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -21180,7 +21224,7 @@ var _internals23 = {
|
|
|
21180
21224
|
activateProposal,
|
|
21181
21225
|
listSkills: listSkills2,
|
|
21182
21226
|
sanitizeSlug
|
|
21183
|
-
} = await import("./skill-generator-
|
|
21227
|
+
} = await import("./skill-generator-ybncj9et.js");
|
|
21184
21228
|
const result = {
|
|
21185
21229
|
approved: [],
|
|
21186
21230
|
rejected: [],
|
|
@@ -21328,10 +21372,10 @@ var HIVE_LOCK_RETRIES = {
|
|
|
21328
21372
|
retries: { retries: 5, minTimeout: 100, maxTimeout: 500 }
|
|
21329
21373
|
};
|
|
21330
21374
|
async function transactHiveStore(mutate) {
|
|
21331
|
-
const dataDir =
|
|
21332
|
-
const hivePath =
|
|
21333
|
-
const rejectedPath =
|
|
21334
|
-
const eventsPath =
|
|
21375
|
+
const dataDir = _internals25.resolveHiveDataDir();
|
|
21376
|
+
const hivePath = _internals25.resolveHiveKnowledgePath();
|
|
21377
|
+
const rejectedPath = _internals25.resolveHiveRejectedPath();
|
|
21378
|
+
const eventsPath = _internals25.resolveHiveEventsPath();
|
|
21335
21379
|
const diagnostics = [];
|
|
21336
21380
|
try {
|
|
21337
21381
|
await mkdir8(dataDir, { recursive: true });
|
|
@@ -21342,7 +21386,7 @@ async function transactHiveStore(mutate) {
|
|
|
21342
21386
|
let release = null;
|
|
21343
21387
|
try {
|
|
21344
21388
|
try {
|
|
21345
|
-
release = await
|
|
21389
|
+
release = await _internals25.lockfile.lock(dataDir, {
|
|
21346
21390
|
...HIVE_LOCK_RETRIES,
|
|
21347
21391
|
stale: HIVE_LOCK_STALE_MS
|
|
21348
21392
|
});
|
|
@@ -21350,7 +21394,7 @@ async function transactHiveStore(mutate) {
|
|
|
21350
21394
|
diagnostics.push(`hive lock acquire failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
21351
21395
|
return { committed: false, return: undefined, diagnostics };
|
|
21352
21396
|
}
|
|
21353
|
-
const entries = await
|
|
21397
|
+
const entries = await _internals25.readKnowledge(hivePath);
|
|
21354
21398
|
const outcome = await mutate({ entries });
|
|
21355
21399
|
if (outcome.kind === "noop") {
|
|
21356
21400
|
return { committed: false, return: outcome.return, diagnostics };
|
|
@@ -21371,12 +21415,12 @@ async function transactHiveStore(mutate) {
|
|
|
21371
21415
|
return { committed: false, return: undefined, diagnostics };
|
|
21372
21416
|
}
|
|
21373
21417
|
if (typeof outcome.maxEntries === "number" && committedEntries.length > outcome.maxEntries) {
|
|
21374
|
-
committedEntries =
|
|
21418
|
+
committedEntries = _internals25.selectKnowledgeCapSurvivors(committedEntries, outcome.maxEntries);
|
|
21375
21419
|
}
|
|
21376
21420
|
const content = committedEntries.map((e) => JSON.stringify(e)).join(`
|
|
21377
21421
|
`) + (committedEntries.length > 0 ? `
|
|
21378
21422
|
` : "");
|
|
21379
|
-
await
|
|
21423
|
+
await _internals25.atomicWriteFile(hivePath, content);
|
|
21380
21424
|
if (outcome.rejects && outcome.rejects.length > 0) {
|
|
21381
21425
|
const rejectBlock = `${outcome.rejects.map((r) => JSON.stringify(r)).join(`
|
|
21382
21426
|
`)}
|
|
@@ -21418,7 +21462,7 @@ async function trimHiveEventsUnderLock(eventsPath) {
|
|
|
21418
21462
|
`)}
|
|
21419
21463
|
`);
|
|
21420
21464
|
}
|
|
21421
|
-
var
|
|
21465
|
+
var _internals25 = {
|
|
21422
21466
|
lockfile: import_proper_lockfile3.default,
|
|
21423
21467
|
readKnowledge,
|
|
21424
21468
|
atomicWriteFile,
|
|
@@ -21588,8 +21632,8 @@ async function checkHivePromotions(swarmEntries, config, directory) {
|
|
|
21588
21632
|
if (config.hive_enabled === false) {
|
|
21589
21633
|
return empty;
|
|
21590
21634
|
}
|
|
21591
|
-
const sourceCohort = await
|
|
21592
|
-
const evidence2 = await
|
|
21635
|
+
const sourceCohort = await _internals26.resolveCohortId(directory);
|
|
21636
|
+
const evidence2 = await _internals26.loadPromotionEvidence(directory);
|
|
21593
21637
|
const diagnostics = [];
|
|
21594
21638
|
const activeSwarm = swarmEntries.filter((e) => isActiveStatus(e.status));
|
|
21595
21639
|
const activeSwarmBigrams = activeSwarm.map((e) => typeof e.lesson === "string" ? wordBigrams(e.lesson) : new Set);
|
|
@@ -21609,7 +21653,7 @@ async function checkHivePromotions(swarmEntries, config, directory) {
|
|
|
21609
21653
|
diagnostics.push(`skip promote '${swarmEntry.lesson.slice(0, 40)}\u2026': ${decision.reason}`);
|
|
21610
21654
|
continue;
|
|
21611
21655
|
}
|
|
21612
|
-
const validationResult =
|
|
21656
|
+
const validationResult = _internals26.validateLesson(swarmEntry.lesson, [], {
|
|
21613
21657
|
category: swarmEntry.category,
|
|
21614
21658
|
scope: swarmEntry.scope,
|
|
21615
21659
|
confidence: swarmEntry.confidence
|
|
@@ -21631,7 +21675,7 @@ async function checkHivePromotions(swarmEntries, config, directory) {
|
|
|
21631
21675
|
});
|
|
21632
21676
|
}
|
|
21633
21677
|
const hiveDir = resolveHiveDataDir();
|
|
21634
|
-
const result = await
|
|
21678
|
+
const result = await _internals26.transactHiveStore(async (ctx) => {
|
|
21635
21679
|
let newPromotions = 0;
|
|
21636
21680
|
let encounters = 0;
|
|
21637
21681
|
let advancements = 0;
|
|
@@ -21857,7 +21901,7 @@ async function authorizeAndRecordHiveMerge(args) {
|
|
|
21857
21901
|
let authorized = true;
|
|
21858
21902
|
let basis = "config-skipped-unlinked";
|
|
21859
21903
|
try {
|
|
21860
|
-
const decision = await
|
|
21904
|
+
const decision = await _internals26.authorizeCuration({
|
|
21861
21905
|
directory: hiveDir,
|
|
21862
21906
|
action: "merge",
|
|
21863
21907
|
entryId: survivingEntry.id,
|
|
@@ -21887,7 +21931,7 @@ async function authorizeAndRecordHiveMerge(args) {
|
|
|
21887
21931
|
authorizationBasis: basis
|
|
21888
21932
|
});
|
|
21889
21933
|
}
|
|
21890
|
-
var
|
|
21934
|
+
var _internals26 = {
|
|
21891
21935
|
readSwarmEntries: (directory) => readKnowledge(resolveSwarmKnowledgePath(directory)),
|
|
21892
21936
|
checkHivePromotions,
|
|
21893
21937
|
readCuratorSummary,
|
|
@@ -21901,15 +21945,15 @@ var _internals25 = {
|
|
|
21901
21945
|
};
|
|
21902
21946
|
function createHivePromoterHook(directory, config) {
|
|
21903
21947
|
const hook = async (_input, _output) => {
|
|
21904
|
-
const swarmEntries = await
|
|
21905
|
-
const promotionSummary = await
|
|
21906
|
-
const curatorSummary = await
|
|
21948
|
+
const swarmEntries = await _internals26.readSwarmEntries(directory);
|
|
21949
|
+
const promotionSummary = await _internals26.checkHivePromotions(swarmEntries, config, directory);
|
|
21950
|
+
const curatorSummary = await _internals26.readCuratorSummary(directory);
|
|
21907
21951
|
if (!curatorSummary)
|
|
21908
21952
|
return;
|
|
21909
21953
|
const hasActivity = promotionSummary.new_promotions > 0 || promotionSummary.encounters_incremented > 0 || promotionSummary.advancements > 0;
|
|
21910
21954
|
if (!hasActivity)
|
|
21911
21955
|
return;
|
|
21912
|
-
await
|
|
21956
|
+
await _internals26.appendCuratorRecommendation(directory, {
|
|
21913
21957
|
action: "promote",
|
|
21914
21958
|
lesson: `Hive promotion: ${promotionSummary.new_promotions} new, ${promotionSummary.encounters_incremented} encounters, ${promotionSummary.advancements} advancements, ${promotionSummary.total_hive_entries} total entries`,
|
|
21915
21959
|
reason: JSON.stringify({
|
|
@@ -21947,16 +21991,16 @@ function normalizeManualActionability(fields) {
|
|
|
21947
21991
|
async function promoteToHive(directory, lesson, category, options, config, actionable) {
|
|
21948
21992
|
const trimmedLesson = lesson.trim();
|
|
21949
21993
|
const actionableFields = normalizeManualActionability(actionable);
|
|
21950
|
-
const sourceCohort = await
|
|
21951
|
-
const policyConfig = config ??
|
|
21952
|
-
const result = await
|
|
21994
|
+
const sourceCohort = await _internals26.resolveCohortId(directory);
|
|
21995
|
+
const policyConfig = config ?? _internals26.loadDefaultKnowledgeConfig();
|
|
21996
|
+
const result = await _internals26.transactHiveStore(async (ctx) => {
|
|
21953
21997
|
if (findNearDuplicate(trimmedLesson, ctx.entries, policyConfig.dedup_threshold)) {
|
|
21954
21998
|
return {
|
|
21955
21999
|
kind: "noop",
|
|
21956
22000
|
return: `Lesson already exists in hive (near-duplicate).`
|
|
21957
22001
|
};
|
|
21958
22002
|
}
|
|
21959
|
-
const validationResult =
|
|
22003
|
+
const validationResult = _internals26.validateLesson(trimmedLesson, ctx.entries.map((e) => e.lesson), {
|
|
21960
22004
|
category: category || "process",
|
|
21961
22005
|
scope: "global",
|
|
21962
22006
|
confidence: 1
|
|
@@ -22067,16 +22111,16 @@ async function promoteFromSwarm(directory, lessonId, options, config) {
|
|
|
22067
22111
|
if (!swarmEntry) {
|
|
22068
22112
|
throw new Error(`Lesson ${lessonId} not found in .swarm/knowledge.jsonl`);
|
|
22069
22113
|
}
|
|
22070
|
-
const sourceCohort = await
|
|
22071
|
-
const policyConfig = config ??
|
|
22072
|
-
const result = await
|
|
22114
|
+
const sourceCohort = await _internals26.resolveCohortId(directory);
|
|
22115
|
+
const policyConfig = config ?? _internals26.loadDefaultKnowledgeConfig();
|
|
22116
|
+
const result = await _internals26.transactHiveStore(async (ctx) => {
|
|
22073
22117
|
if (findNearDuplicate(swarmEntry.lesson, ctx.entries, policyConfig.dedup_threshold)) {
|
|
22074
22118
|
return {
|
|
22075
22119
|
kind: "noop",
|
|
22076
22120
|
return: `Lesson already exists in hive (near-duplicate).`
|
|
22077
22121
|
};
|
|
22078
22122
|
}
|
|
22079
|
-
const validationResult =
|
|
22123
|
+
const validationResult = _internals26.validateLesson(swarmEntry.lesson, ctx.entries.map((e) => e.lesson), {
|
|
22080
22124
|
category: swarmEntry.category,
|
|
22081
22125
|
scope: swarmEntry.scope,
|
|
22082
22126
|
confidence: swarmEntry.confidence
|
|
@@ -22411,7 +22455,7 @@ var SKILL_AUDIENCE_RUNNER_PATTERN = /^runner:(opencode|claude|codex)$/;
|
|
|
22411
22455
|
var WORKFLOW_BOOST_MIN_CONTEXT = 0.05;
|
|
22412
22456
|
var RECENCY_DECAY_MS = 30 * 24 * 60 * 60 * 1000;
|
|
22413
22457
|
var SKILL_FRONTMATTER_READ_BYTES = 16 * 1024;
|
|
22414
|
-
var
|
|
22458
|
+
var _internals27 = {
|
|
22415
22459
|
computeSkillRelevanceScore: null,
|
|
22416
22460
|
rankSkillsForContext: null,
|
|
22417
22461
|
getSkillStats: null,
|
|
@@ -22778,7 +22822,7 @@ function rankSkillsForContext(skills, taskContext, directory) {
|
|
|
22778
22822
|
const results = [];
|
|
22779
22823
|
for (const skillPath of skills) {
|
|
22780
22824
|
const skillEntries = allEntries.filter((e) => e.skillPath === skillPath);
|
|
22781
|
-
const metadata =
|
|
22825
|
+
const metadata = _internals27.readSkillMetadata(skillPath, directory);
|
|
22782
22826
|
const score = computeSkillRelevanceScore(skillPath, taskContext, skillEntries, metadata);
|
|
22783
22827
|
const entriesWithVerdict = skillEntries.filter((e) => e.complianceVerdict !== undefined && e.complianceVerdict !== "not_checked");
|
|
22784
22828
|
const compliantCount = entriesWithVerdict.filter((e) => e.complianceVerdict === "compliant").length;
|
|
@@ -22837,7 +22881,7 @@ function formatSkillIndexWithContext(skills, directory, metadataBySkillPath) {
|
|
|
22837
22881
|
} catch {}
|
|
22838
22882
|
if (!hasHistory) {
|
|
22839
22883
|
return skills.map((sp) => {
|
|
22840
|
-
const meta = metadataBySkillPath?.get(sp) ??
|
|
22884
|
+
const meta = metadataBySkillPath?.get(sp) ?? _internals27.readSkillMetadata(sp, directory);
|
|
22841
22885
|
return ` - file:${meta.path} - ${meta.name}: ${meta.description}`;
|
|
22842
22886
|
}).join(`
|
|
22843
22887
|
`);
|
|
@@ -22845,7 +22889,7 @@ function formatSkillIndexWithContext(skills, directory, metadataBySkillPath) {
|
|
|
22845
22889
|
const lines = [];
|
|
22846
22890
|
for (const skillPath of skills) {
|
|
22847
22891
|
const stats = getSkillStats(skillPath, directory);
|
|
22848
|
-
const meta = metadataBySkillPath?.get(skillPath) ??
|
|
22892
|
+
const meta = metadataBySkillPath?.get(skillPath) ?? _internals27.readSkillMetadata(skillPath, directory);
|
|
22849
22893
|
const compliancePct = Math.round(stats.complianceRate * 100);
|
|
22850
22894
|
const topAgentNames = stats.topAgents.slice(0, 3).map((a) => a.agent).join(", ");
|
|
22851
22895
|
lines.push(` - file:${meta.path} - ${meta.name}: ${meta.description} (used: ${stats.totalUsage}, compliance: ${compliancePct}%)` + (stats.topAgents.length > 0 ? ` \u2192 ${topAgentNames}` : ""));
|
|
@@ -22853,16 +22897,16 @@ function formatSkillIndexWithContext(skills, directory, metadataBySkillPath) {
|
|
|
22853
22897
|
return lines.join(`
|
|
22854
22898
|
`);
|
|
22855
22899
|
}
|
|
22856
|
-
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22900
|
+
_internals27.computeSkillRelevanceScore = computeSkillRelevanceScore;
|
|
22901
|
+
_internals27.rankSkillsForContext = rankSkillsForContext;
|
|
22902
|
+
_internals27.getSkillStats = getSkillStats;
|
|
22903
|
+
_internals27.formatSkillIndexWithContext = formatSkillIndexWithContext;
|
|
22904
|
+
_internals27.parseSkillFrontmatter = parseSkillFrontmatter;
|
|
22905
|
+
_internals27.readSkillMetadata = readSkillMetadata;
|
|
22906
|
+
_internals27.extractSkillName = extractSkillName;
|
|
22907
|
+
_internals27.computeRecencyScore = computeRecencyScore;
|
|
22908
|
+
_internals27.computeContextMatchScore = computeContextMatchScore;
|
|
22909
|
+
_internals27.computeTriggerMatchBoost = computeTriggerMatchBoost;
|
|
22866
22910
|
|
|
22867
22911
|
// src/hooks/skill-propagation-gate.ts
|
|
22868
22912
|
function parseSimpleYaml(content) {
|
|
@@ -22964,10 +23008,10 @@ function parseYamlValue(value) {
|
|
|
22964
23008
|
}
|
|
22965
23009
|
function loadRoutingSkills(directory, targetAgent) {
|
|
22966
23010
|
const routingPath = path37.join(directory, ".opencode", "skill-routing.yaml");
|
|
22967
|
-
if (!
|
|
23011
|
+
if (!_internals28.existsSync(routingPath))
|
|
22968
23012
|
return [];
|
|
22969
23013
|
try {
|
|
22970
|
-
const content =
|
|
23014
|
+
const content = _internals28.readFileSync(routingPath, "utf-8");
|
|
22971
23015
|
const config = parseSimpleYaml(content);
|
|
22972
23016
|
if (!config?.routing)
|
|
22973
23017
|
return [];
|
|
@@ -22994,7 +23038,7 @@ var SKILL_SEARCH_ROOTS = [
|
|
|
22994
23038
|
".claude/skills"
|
|
22995
23039
|
];
|
|
22996
23040
|
var MAX_SCORING_SESSION_ENTRIES = 500;
|
|
22997
|
-
var
|
|
23041
|
+
var _internals28 = {
|
|
22998
23042
|
readdirSync: fs13.readdirSync.bind(fs13),
|
|
22999
23043
|
existsSync: fs13.existsSync.bind(fs13),
|
|
23000
23044
|
statSync: fs13.statSync.bind(fs13),
|
|
@@ -23027,11 +23071,11 @@ function discoverAvailableSkills(directory) {
|
|
|
23027
23071
|
const results = [];
|
|
23028
23072
|
for (const root of SKILL_SEARCH_ROOTS) {
|
|
23029
23073
|
const rootPath = path37.join(directory, root);
|
|
23030
|
-
if (!
|
|
23074
|
+
if (!_internals28.existsSync(rootPath))
|
|
23031
23075
|
continue;
|
|
23032
23076
|
let entries;
|
|
23033
23077
|
try {
|
|
23034
|
-
entries =
|
|
23078
|
+
entries = _internals28.readdirSync(rootPath);
|
|
23035
23079
|
} catch {
|
|
23036
23080
|
continue;
|
|
23037
23081
|
}
|
|
@@ -23039,11 +23083,11 @@ function discoverAvailableSkills(directory) {
|
|
|
23039
23083
|
if (entry.startsWith("."))
|
|
23040
23084
|
continue;
|
|
23041
23085
|
const skillDir = path37.join(rootPath, entry);
|
|
23042
|
-
if (
|
|
23086
|
+
if (_internals28.existsSync(path37.join(skillDir, "retired.marker")) || _internals28.existsSync(path37.join(skillDir, "stale.marker")))
|
|
23043
23087
|
continue;
|
|
23044
23088
|
const skillFile = path37.join(skillDir, "SKILL.md");
|
|
23045
23089
|
try {
|
|
23046
|
-
if (
|
|
23090
|
+
if (_internals28.statSync(skillDir).isDirectory() && _internals28.existsSync(skillFile)) {
|
|
23047
23091
|
results.push(path37.join(root, entry, "SKILL.md").replace(/\\/g, "/"));
|
|
23048
23092
|
}
|
|
23049
23093
|
} catch (err) {
|
|
@@ -23075,7 +23119,7 @@ function parseDelegationArgs(args) {
|
|
|
23075
23119
|
}
|
|
23076
23120
|
if (!targetAgent)
|
|
23077
23121
|
return null;
|
|
23078
|
-
const skillsField = prompt ?
|
|
23122
|
+
const skillsField = prompt ? _internals28.extractSkillsFieldFromPrompt(prompt) : "";
|
|
23079
23123
|
return { targetAgent, skillsField };
|
|
23080
23124
|
}
|
|
23081
23125
|
function extractSkillsFieldFromPrompt(prompt) {
|
|
@@ -23116,10 +23160,10 @@ function writeWarnEvent(directory, record) {
|
|
|
23116
23160
|
const filePath = path37.join(directory, ".swarm", "events.jsonl");
|
|
23117
23161
|
try {
|
|
23118
23162
|
const dir = path37.dirname(filePath);
|
|
23119
|
-
if (!
|
|
23120
|
-
|
|
23163
|
+
if (!_internals28.existsSync(dir)) {
|
|
23164
|
+
_internals28.mkdirSync(dir, { recursive: true });
|
|
23121
23165
|
}
|
|
23122
|
-
|
|
23166
|
+
_internals28.appendFileSync(filePath, `${JSON.stringify(record)}
|
|
23123
23167
|
`, "utf-8");
|
|
23124
23168
|
} catch (err) {
|
|
23125
23169
|
warn(`[skill-propagation-gate] failed to write warning event: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -23174,7 +23218,7 @@ function validateSkillReference(directory, reference, context, options) {
|
|
|
23174
23218
|
};
|
|
23175
23219
|
}
|
|
23176
23220
|
try {
|
|
23177
|
-
const root =
|
|
23221
|
+
const root = _internals28.realpathSync(directory);
|
|
23178
23222
|
const lexicalPath = path37.resolve(root, withoutPrefix);
|
|
23179
23223
|
if (!isWithinRoot(root, lexicalPath)) {
|
|
23180
23224
|
return {
|
|
@@ -23182,10 +23226,10 @@ function validateSkillReference(directory, reference, context, options) {
|
|
|
23182
23226
|
reason: "skill path resolves outside the project"
|
|
23183
23227
|
};
|
|
23184
23228
|
}
|
|
23185
|
-
if (!
|
|
23229
|
+
if (!_internals28.existsSync(lexicalPath) || !_internals28.statSync(lexicalPath).isFile()) {
|
|
23186
23230
|
return { valid: false, reason: "skill file does not exist" };
|
|
23187
23231
|
}
|
|
23188
|
-
const realPath =
|
|
23232
|
+
const realPath = _internals28.realpathSync(lexicalPath);
|
|
23189
23233
|
if (!isWithinRoot(root, realPath)) {
|
|
23190
23234
|
return {
|
|
23191
23235
|
valid: false,
|
|
@@ -23194,7 +23238,7 @@ function validateSkillReference(directory, reference, context, options) {
|
|
|
23194
23238
|
}
|
|
23195
23239
|
const normalizedPath = withoutPrefix.replace(/^\.\//, "");
|
|
23196
23240
|
const validatedMetadataPath = path37.relative(root, realPath).replace(/\\/g, "/");
|
|
23197
|
-
const metadata =
|
|
23241
|
+
const metadata = _internals28.readSkillMetadata(validatedMetadataPath, root);
|
|
23198
23242
|
if (metadata.frontmatterStatus !== "valid" && metadata.frontmatterStatus !== "absent") {
|
|
23199
23243
|
return {
|
|
23200
23244
|
valid: false,
|
|
@@ -23226,18 +23270,18 @@ async function validateExplicitSkillReferencesBefore(directory, input, config) {
|
|
|
23226
23270
|
if (!agentRaw || stripKnownSwarmPrefix(agentRaw) !== "architect") {
|
|
23227
23271
|
return { blocked: false, reason: null };
|
|
23228
23272
|
}
|
|
23229
|
-
const parsed =
|
|
23273
|
+
const parsed = _internals28.parseDelegationArgs(input.args);
|
|
23230
23274
|
if (!parsed)
|
|
23231
23275
|
return { blocked: false, reason: null };
|
|
23232
23276
|
const targetBase = stripKnownSwarmPrefix(parsed.targetAgent);
|
|
23233
|
-
if (!
|
|
23277
|
+
if (!_internals28.SKILL_CAPABLE_AGENTS.has(targetBase)) {
|
|
23234
23278
|
return { blocked: false, reason: null };
|
|
23235
23279
|
}
|
|
23236
23280
|
const skillsValue = parsed.skillsField.trim();
|
|
23237
23281
|
if (!skillsValue || skillsValue.toLowerCase() === "none") {
|
|
23238
23282
|
return { blocked: false, reason: null };
|
|
23239
23283
|
}
|
|
23240
|
-
const fileReferences =
|
|
23284
|
+
const fileReferences = _internals28.extractFileSkillReferences(skillsValue);
|
|
23241
23285
|
if (fileReferences.length === 0) {
|
|
23242
23286
|
return { blocked: false, reason: null, validatedSkillPaths: [] };
|
|
23243
23287
|
}
|
|
@@ -23250,7 +23294,7 @@ async function validateExplicitSkillReferencesBefore(directory, input, config) {
|
|
|
23250
23294
|
const context = resolveSkillAudienceContext(config);
|
|
23251
23295
|
const validatedSkillPaths = [];
|
|
23252
23296
|
for (const reference of fileReferences) {
|
|
23253
|
-
const result =
|
|
23297
|
+
const result = _internals28.validateSkillReference(directory, reference, context, {
|
|
23254
23298
|
enforceAudience: true
|
|
23255
23299
|
});
|
|
23256
23300
|
if (!result.valid) {
|
|
@@ -23295,18 +23339,18 @@ async function skillPropagationGateBefore(directory, input, config) {
|
|
|
23295
23339
|
const baseAgent = stripKnownSwarmPrefix(agentRaw);
|
|
23296
23340
|
if (baseAgent !== "architect")
|
|
23297
23341
|
return { blocked: false, reason: null, recommendedSkills: undefined };
|
|
23298
|
-
const parsed =
|
|
23342
|
+
const parsed = _internals28.parseDelegationArgs(input.args);
|
|
23299
23343
|
if (!parsed)
|
|
23300
23344
|
return { blocked: false, reason: null, recommendedSkills: undefined };
|
|
23301
23345
|
const targetBase = stripKnownSwarmPrefix(parsed.targetAgent);
|
|
23302
|
-
if (!
|
|
23346
|
+
if (!_internals28.SKILL_CAPABLE_AGENTS.has(targetBase))
|
|
23303
23347
|
return { blocked: false, reason: null, recommendedSkills: undefined };
|
|
23304
23348
|
const sessionID = typeof input.sessionID === "string" ? input.sessionID : "unknown";
|
|
23305
23349
|
const audienceContext = resolveSkillAudienceContext(config);
|
|
23306
23350
|
const availableSkills = [];
|
|
23307
23351
|
const metadataBySkillPath = new Map;
|
|
23308
|
-
for (const skillPath of
|
|
23309
|
-
const validation =
|
|
23352
|
+
for (const skillPath of _internals28.discoverAvailableSkills(directory)) {
|
|
23353
|
+
const validation = _internals28.validateSkillReference(directory, skillPath, audienceContext, { enforceAudience: true, requireFilePrefix: false });
|
|
23310
23354
|
if (!validation.valid || !validation.skillPath)
|
|
23311
23355
|
continue;
|
|
23312
23356
|
availableSkills.push(validation.skillPath);
|
|
@@ -23317,7 +23361,7 @@ async function skillPropagationGateBefore(directory, input, config) {
|
|
|
23317
23361
|
const skillsValue = parsed.skillsField.trim();
|
|
23318
23362
|
if (skillsValue && skillsValue.toLowerCase() !== "none") {
|
|
23319
23363
|
const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
|
|
23320
|
-
const taskId =
|
|
23364
|
+
const taskId = _internals28.extractTaskIdFromPrompt(prompt);
|
|
23321
23365
|
const skillPaths = explicitIntegrity.validatedSkillPaths ?? [];
|
|
23322
23366
|
let coderSkillPaths = [];
|
|
23323
23367
|
if (prompt) {
|
|
@@ -23326,19 +23370,19 @@ async function skillPropagationGateBefore(directory, input, config) {
|
|
|
23326
23370
|
const trimmed = line.trim();
|
|
23327
23371
|
if (trimmed.startsWith("SKILLS_USED_BY_CODER:")) {
|
|
23328
23372
|
const fieldVal = trimmed.slice("SKILLS_USED_BY_CODER:".length).trim();
|
|
23329
|
-
coderSkillPaths =
|
|
23373
|
+
coderSkillPaths = _internals28.parseSkillPaths(fieldVal);
|
|
23330
23374
|
break;
|
|
23331
23375
|
}
|
|
23332
23376
|
}
|
|
23333
23377
|
}
|
|
23334
23378
|
const safeCoderSkillPaths = coderSkillPaths.flatMap((skillPath) => {
|
|
23335
|
-
const validation =
|
|
23379
|
+
const validation = _internals28.validateSkillReference(directory, skillPath, audienceContext, { enforceAudience: false });
|
|
23336
23380
|
return validation.valid && validation.skillPath ? [validation.skillPath] : [];
|
|
23337
23381
|
});
|
|
23338
23382
|
const allPaths = [...new Set([...skillPaths, ...safeCoderSkillPaths])];
|
|
23339
23383
|
for (const skillPath of allPaths) {
|
|
23340
23384
|
try {
|
|
23341
|
-
|
|
23385
|
+
_internals28.appendSkillUsageEntry(directory, {
|
|
23342
23386
|
skillPath,
|
|
23343
23387
|
agentName: targetBase,
|
|
23344
23388
|
taskID: taskId,
|
|
@@ -23355,18 +23399,18 @@ async function skillPropagationGateBefore(directory, input, config) {
|
|
|
23355
23399
|
let scored = [];
|
|
23356
23400
|
if (skillsValue.toLowerCase() !== "none" && availableSkills.length > 0) {
|
|
23357
23401
|
try {
|
|
23358
|
-
const sessionEntries =
|
|
23402
|
+
const sessionEntries = _internals28.readSkillUsageEntriesTail(directory, {
|
|
23359
23403
|
sessionID
|
|
23360
23404
|
});
|
|
23361
|
-
if (sessionEntries.length >
|
|
23405
|
+
if (sessionEntries.length > _internals28.MAX_SCORING_SESSION_ENTRIES) {
|
|
23362
23406
|
scoringSkipped = true;
|
|
23363
|
-
warn(`[skill-propagation-gate] skipping scoring \u2014 tail window has ${sessionEntries.length} session entries (limit: ${
|
|
23407
|
+
warn(`[skill-propagation-gate] skipping scoring \u2014 tail window has ${sessionEntries.length} session entries (limit: ${_internals28.MAX_SCORING_SESSION_ENTRIES})`);
|
|
23364
23408
|
} else {
|
|
23365
23409
|
const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
|
|
23366
23410
|
scored = availableSkills.map((skillPath) => {
|
|
23367
23411
|
const skillEntries = sessionEntries.filter((e) => e.skillPath === skillPath);
|
|
23368
|
-
const metadata = metadataBySkillPath.get(skillPath) ??
|
|
23369
|
-
const score =
|
|
23412
|
+
const metadata = metadataBySkillPath.get(skillPath) ?? _internals28.readSkillMetadata(skillPath, directory);
|
|
23413
|
+
const score = _internals28.computeSkillRelevanceScore(skillPath, prompt, skillEntries, metadata);
|
|
23370
23414
|
return { skillPath, score, usageCount: skillEntries.length };
|
|
23371
23415
|
}).sort((a, b) => b.score - a.score || b.usageCount - a.usageCount);
|
|
23372
23416
|
if (scored.length > 0) {
|
|
@@ -23380,11 +23424,11 @@ async function skillPropagationGateBefore(directory, input, config) {
|
|
|
23380
23424
|
}
|
|
23381
23425
|
}
|
|
23382
23426
|
try {
|
|
23383
|
-
const routingPaths =
|
|
23427
|
+
const routingPaths = _internals28.loadRoutingSkills(directory, targetBase);
|
|
23384
23428
|
if (routingPaths.length > 0) {
|
|
23385
23429
|
const existingPaths = new Set(scored.map((s) => s.skillPath));
|
|
23386
23430
|
for (const routingPath of routingPaths) {
|
|
23387
|
-
const validation =
|
|
23431
|
+
const validation = _internals28.validateSkillReference(directory, routingPath, audienceContext, { enforceAudience: true, requireFilePrefix: false });
|
|
23388
23432
|
if (!validation.valid || !validation.skillPath)
|
|
23389
23433
|
continue;
|
|
23390
23434
|
const eligibleRoutingPath = validation.skillPath;
|
|
@@ -23392,7 +23436,7 @@ async function skillPropagationGateBefore(directory, input, config) {
|
|
|
23392
23436
|
metadataBySkillPath.set(eligibleRoutingPath, validation.metadata);
|
|
23393
23437
|
}
|
|
23394
23438
|
const routedSkillDir = path37.dirname(path37.join(directory, eligibleRoutingPath));
|
|
23395
|
-
if (
|
|
23439
|
+
if (_internals28.existsSync(path37.join(routedSkillDir, "retired.marker")) || _internals28.existsSync(path37.join(routedSkillDir, "stale.marker")))
|
|
23396
23440
|
continue;
|
|
23397
23441
|
if (!existingPaths.has(eligibleRoutingPath)) {
|
|
23398
23442
|
scored.push({
|
|
@@ -23418,12 +23462,12 @@ async function skillPropagationGateBefore(directory, input, config) {
|
|
|
23418
23462
|
} else if (typeof scored !== "undefined" && scored.length > 0) {
|
|
23419
23463
|
skillsForIndex = scored.map((r) => r.skillPath);
|
|
23420
23464
|
}
|
|
23421
|
-
const formattedIndex =
|
|
23465
|
+
const formattedIndex = _internals28.formatSkillIndexWithContext(skillsForIndex, directory, metadataBySkillPath);
|
|
23422
23466
|
if (formattedIndex.length > 0) {
|
|
23423
23467
|
const contextPath = path37.join(directory, ".swarm", "context.md");
|
|
23424
23468
|
let existingContent = "";
|
|
23425
|
-
if (
|
|
23426
|
-
existingContent =
|
|
23469
|
+
if (_internals28.existsSync(contextPath)) {
|
|
23470
|
+
existingContent = _internals28.readFileSync(contextPath, "utf-8");
|
|
23427
23471
|
}
|
|
23428
23472
|
const sectionHeader = "## Available Skills";
|
|
23429
23473
|
const newSection = `${sectionHeader}
|
|
@@ -23443,10 +23487,10 @@ ${newSection}`;
|
|
|
23443
23487
|
}
|
|
23444
23488
|
}
|
|
23445
23489
|
const swarmDir = path37.dirname(contextPath);
|
|
23446
|
-
if (!
|
|
23447
|
-
|
|
23490
|
+
if (!_internals28.existsSync(swarmDir)) {
|
|
23491
|
+
_internals28.mkdirSync(swarmDir, { recursive: true });
|
|
23448
23492
|
}
|
|
23449
|
-
|
|
23493
|
+
_internals28.writeFileSync(contextPath, updatedContent, "utf-8");
|
|
23450
23494
|
}
|
|
23451
23495
|
} catch (err) {
|
|
23452
23496
|
warn(`[skill-propagation-gate] failed to write skill index to context.md: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -23472,7 +23516,7 @@ ${newSection}`;
|
|
|
23472
23516
|
});
|
|
23473
23517
|
const warningMsg = `Skill propagation warning: Delegating to ${targetBase} without SKILLS field. ` + `Available skills: ${skillNames.join(", ")}`;
|
|
23474
23518
|
try {
|
|
23475
|
-
|
|
23519
|
+
_internals28.writeWarnEvent(directory, {
|
|
23476
23520
|
type: "skill_propagation_warn",
|
|
23477
23521
|
timestamp: new Date().toISOString(),
|
|
23478
23522
|
tool: toolName,
|
|
@@ -23504,17 +23548,17 @@ async function skillPropagationTransformScan(directory, output, sessionID, confi
|
|
|
23504
23548
|
const validatedProvenancePaths = (fieldValue) => {
|
|
23505
23549
|
if (remainingProvenanceValidationBudget <= 0)
|
|
23506
23550
|
return [];
|
|
23507
|
-
const references =
|
|
23551
|
+
const references = _internals28.parseSkillPaths(fieldValue).slice(0, remainingProvenanceValidationBudget);
|
|
23508
23552
|
remainingProvenanceValidationBudget -= references.length;
|
|
23509
23553
|
return references.flatMap((reference) => {
|
|
23510
|
-
const validation =
|
|
23554
|
+
const validation = _internals28.validateSkillReference(directory, reference, audienceContext, { enforceAudience: true });
|
|
23511
23555
|
return validation.valid && validation.skillPath ? [validation.skillPath] : [];
|
|
23512
23556
|
});
|
|
23513
23557
|
};
|
|
23514
23558
|
let dedupKeys = new Set;
|
|
23515
23559
|
let existingEntries = [];
|
|
23516
23560
|
try {
|
|
23517
|
-
existingEntries =
|
|
23561
|
+
existingEntries = _internals28.readSkillUsageEntriesTail(directory, {
|
|
23518
23562
|
sessionID
|
|
23519
23563
|
});
|
|
23520
23564
|
dedupKeys = new Set(existingEntries.map((e, i) => {
|
|
@@ -23585,7 +23629,7 @@ async function skillPropagationTransformScan(directory, output, sessionID, confi
|
|
|
23585
23629
|
if (isDuplicate(skillPath, "reviewer", resolvedTaskID))
|
|
23586
23630
|
continue;
|
|
23587
23631
|
try {
|
|
23588
|
-
|
|
23632
|
+
_internals28.appendSkillUsageEntry(directory, {
|
|
23589
23633
|
skillPath,
|
|
23590
23634
|
agentName: "reviewer",
|
|
23591
23635
|
taskID: resolvedTaskID,
|
|
@@ -23630,14 +23674,14 @@ async function skillPropagationTransformScan(directory, output, sessionID, confi
|
|
|
23630
23674
|
}
|
|
23631
23675
|
if (currentTargetAgent && skillsField && skillsField.toLowerCase() !== "none") {
|
|
23632
23676
|
const skillPaths = validatedProvenancePaths(skillsField);
|
|
23633
|
-
const taskId =
|
|
23677
|
+
const taskId = _internals28.extractTaskIdFromPrompt(text);
|
|
23634
23678
|
for (const skillPath of skillPaths) {
|
|
23635
23679
|
if (hadRecordingError)
|
|
23636
23680
|
break;
|
|
23637
23681
|
if (isDuplicate(skillPath, currentTargetAgent, taskId))
|
|
23638
23682
|
continue;
|
|
23639
23683
|
try {
|
|
23640
|
-
|
|
23684
|
+
_internals28.appendSkillUsageEntry(directory, {
|
|
23641
23685
|
skillPath,
|
|
23642
23686
|
agentName: currentTargetAgent,
|
|
23643
23687
|
taskID: taskId,
|
|
@@ -23657,18 +23701,18 @@ async function skillPropagationTransformScan(directory, output, sessionID, confi
|
|
|
23657
23701
|
break;
|
|
23658
23702
|
}
|
|
23659
23703
|
}
|
|
23660
|
-
|
|
23661
|
-
|
|
23662
|
-
|
|
23663
|
-
|
|
23664
|
-
|
|
23665
|
-
|
|
23666
|
-
|
|
23667
|
-
|
|
23668
|
-
|
|
23669
|
-
|
|
23670
|
-
|
|
23671
|
-
|
|
23704
|
+
_internals28.skillPropagationGateBefore = skillPropagationGateBefore;
|
|
23705
|
+
_internals28.skillPropagationTransformScan = skillPropagationTransformScan;
|
|
23706
|
+
_internals28.writeWarnEvent = writeWarnEvent;
|
|
23707
|
+
_internals28.discoverAvailableSkills = discoverAvailableSkills;
|
|
23708
|
+
_internals28.parseDelegationArgs = parseDelegationArgs;
|
|
23709
|
+
_internals28.parseSkillPaths = parseSkillPaths;
|
|
23710
|
+
_internals28.extractFileSkillReferences = extractFileSkillReferences;
|
|
23711
|
+
_internals28.validateSkillReference = validateSkillReference;
|
|
23712
|
+
_internals28.extractTaskIdFromPrompt = extractTaskIdFromPrompt;
|
|
23713
|
+
_internals28.extractSkillsFieldFromPrompt = extractSkillsFieldFromPrompt;
|
|
23714
|
+
_internals28.formatSkillIndexWithContext = formatSkillIndexWithContext;
|
|
23715
|
+
_internals28.loadRoutingSkills = loadRoutingSkills;
|
|
23672
23716
|
|
|
23673
23717
|
// src/hooks/micro-reflector.ts
|
|
23674
23718
|
var REFLECT_OUTCOMES = new Set([
|
|
@@ -23807,9 +23851,9 @@ function hashContent(content) {
|
|
|
23807
23851
|
return createHash9("sha1").update(content).digest("hex");
|
|
23808
23852
|
}
|
|
23809
23853
|
async function loadConfigForPolicyCurator(directory) {
|
|
23810
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
23854
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-cr1nr1w0.js");
|
|
23811
23855
|
try {
|
|
23812
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
23856
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-bqan4y2y.js");
|
|
23813
23857
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
23814
23858
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
23815
23859
|
} catch {
|
|
@@ -23819,7 +23863,7 @@ async function loadConfigForPolicyCurator(directory) {
|
|
|
23819
23863
|
async function canonicalExistingPath(candidate) {
|
|
23820
23864
|
let resolved = path39.resolve(candidate);
|
|
23821
23865
|
try {
|
|
23822
|
-
resolved = await
|
|
23866
|
+
resolved = await _internals29.realpath(resolved);
|
|
23823
23867
|
} catch {}
|
|
23824
23868
|
return resolved;
|
|
23825
23869
|
}
|
|
@@ -24654,9 +24698,9 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
|
|
|
24654
24698
|
} catch {}
|
|
24655
24699
|
}
|
|
24656
24700
|
if (!options?.skipAutoPromotion) {
|
|
24657
|
-
await
|
|
24701
|
+
await _internals29.runAutoPromotion(directory, config);
|
|
24658
24702
|
if (phaseInfo.phase_number > 0) {
|
|
24659
|
-
await
|
|
24703
|
+
await _internals29.runAutoDemotion(directory, config, phaseInfo.phase_number);
|
|
24660
24704
|
}
|
|
24661
24705
|
}
|
|
24662
24706
|
return { stored, reinforced, skipped, rejected, quarantined };
|
|
@@ -24771,7 +24815,7 @@ function createKnowledgeCuratorHook(directory, config, options = {}) {
|
|
|
24771
24815
|
}
|
|
24772
24816
|
inFlightEvidenceEntries.add(evidenceKey);
|
|
24773
24817
|
try {
|
|
24774
|
-
await
|
|
24818
|
+
await _internals29.curateAndStoreSwarm(batch.lessons, batch.projectName, { phase_number: batch.phaseNumber }, directory, config, {
|
|
24775
24819
|
llmDelegate: options.llmDelegateFactory?.(trigger.sessionID),
|
|
24776
24820
|
enrichmentQuota: options.enrichmentQuota
|
|
24777
24821
|
});
|
|
@@ -24803,14 +24847,14 @@ function createKnowledgeCuratorHook(directory, config, options = {}) {
|
|
|
24803
24847
|
const projectName = projectNameMatch ? projectNameMatch[1].trim() : "unknown";
|
|
24804
24848
|
const phaseMatch = /^Phase:\s*(\d+)/m.exec(planContent);
|
|
24805
24849
|
const phaseNumber = phaseMatch ? parseInt(phaseMatch[1], 10) : 1;
|
|
24806
|
-
await
|
|
24850
|
+
await _internals29.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config, {
|
|
24807
24851
|
llmDelegate: options.llmDelegateFactory?.(trigger.sessionID),
|
|
24808
24852
|
enrichmentQuota: options.enrichmentQuota
|
|
24809
24853
|
});
|
|
24810
24854
|
};
|
|
24811
24855
|
return safeHook(handler);
|
|
24812
24856
|
}
|
|
24813
|
-
var
|
|
24857
|
+
var _internals29 = {
|
|
24814
24858
|
isWriteToEvidenceFile,
|
|
24815
24859
|
curateAndStoreSwarm,
|
|
24816
24860
|
runAutoPromotion,
|
|
@@ -24850,7 +24894,7 @@ async function runFinalizeRewardSweep(args) {
|
|
|
24850
24894
|
}
|
|
24851
24895
|
const timestamp = args.timestamp ?? new Date().toISOString();
|
|
24852
24896
|
const vettedRoot = resolveVettedMemoryRoot(directory, memoryConfig);
|
|
24853
|
-
const provider =
|
|
24897
|
+
const provider = _internals30.createConfiguredMemoryProviderForRoot(vettedRoot, memoryConfig);
|
|
24854
24898
|
try {
|
|
24855
24899
|
result.swept = true;
|
|
24856
24900
|
for (const taskId of taskIds) {
|
|
@@ -24870,7 +24914,7 @@ async function runFinalizeRewardSweep(args) {
|
|
|
24870
24914
|
}
|
|
24871
24915
|
let taskRewarded = 0;
|
|
24872
24916
|
for (const runId of runIds) {
|
|
24873
|
-
const { memoriesRewarded } = await
|
|
24917
|
+
const { memoriesRewarded } = await _internals30.applyCouncilReward(provider, {
|
|
24874
24918
|
runId,
|
|
24875
24919
|
unitId: taskId,
|
|
24876
24920
|
reward: FINALIZE_NEGATIVE_TERMINAL_REWARD,
|
|
@@ -24896,7 +24940,7 @@ async function runFinalizeRewardSweep(args) {
|
|
|
24896
24940
|
}
|
|
24897
24941
|
return result;
|
|
24898
24942
|
}
|
|
24899
|
-
var
|
|
24943
|
+
var _internals30 = {
|
|
24900
24944
|
createConfiguredMemoryProvider,
|
|
24901
24945
|
createConfiguredMemoryProviderForRoot,
|
|
24902
24946
|
applyCouncilReward
|
|
@@ -25552,9 +25596,9 @@ async function writeMotifProposals(directory, opts = {}) {
|
|
|
25552
25596
|
return result;
|
|
25553
25597
|
const max = opts.maxProposals ?? 10;
|
|
25554
25598
|
const selected = motifs.slice(0, max);
|
|
25555
|
-
const producedAt =
|
|
25599
|
+
const producedAt = _internals31.now().toISOString();
|
|
25556
25600
|
const candidates = selected.map((motif) => buildMotifCandidate(motif, opts.sessionId));
|
|
25557
|
-
const dedupCheck = await
|
|
25601
|
+
const dedupCheck = await _internals31.checkRecommendations(directory, candidates);
|
|
25558
25602
|
const emitted = dedupCheck.decisions.filter((decision) => decision.emit);
|
|
25559
25603
|
result.duplicatesSuppressed = dedupCheck.decisions.length - emitted.length;
|
|
25560
25604
|
if (emitted.length === 0)
|
|
@@ -25576,7 +25620,7 @@ async function writeMotifProposals(directory, opts = {}) {
|
|
|
25576
25620
|
result.proposalsWritten.push(filePath);
|
|
25577
25621
|
written.push(candidate);
|
|
25578
25622
|
}
|
|
25579
|
-
await
|
|
25623
|
+
await _internals31.recordEmittedRecommendations(directory, written, {
|
|
25580
25624
|
producedAt
|
|
25581
25625
|
});
|
|
25582
25626
|
return result;
|
|
@@ -25742,9 +25786,9 @@ async function writeSuccessMotifProposals(directory, opts = {}) {
|
|
|
25742
25786
|
return result;
|
|
25743
25787
|
const max = opts.maxProposals ?? 10;
|
|
25744
25788
|
const selected = motifs.slice(0, max);
|
|
25745
|
-
const producedAt =
|
|
25789
|
+
const producedAt = _internals31.now().toISOString();
|
|
25746
25790
|
const candidates = selected.map((motif) => buildWorkflowCandidate(motif, opts.sessionId));
|
|
25747
|
-
const dedupCheck = await
|
|
25791
|
+
const dedupCheck = await _internals31.checkRecommendations(directory, candidates);
|
|
25748
25792
|
const emitted = dedupCheck.decisions.filter((decision) => decision.emit);
|
|
25749
25793
|
result.duplicatesSuppressed = dedupCheck.decisions.length - emitted.length;
|
|
25750
25794
|
if (emitted.length === 0)
|
|
@@ -25766,7 +25810,7 @@ async function writeSuccessMotifProposals(directory, opts = {}) {
|
|
|
25766
25810
|
result.proposalsWritten.push(filePath);
|
|
25767
25811
|
written.push(candidate);
|
|
25768
25812
|
}
|
|
25769
|
-
await
|
|
25813
|
+
await _internals31.recordEmittedRecommendations(directory, written, {
|
|
25770
25814
|
producedAt
|
|
25771
25815
|
});
|
|
25772
25816
|
return result;
|
|
@@ -25775,7 +25819,7 @@ async function writeSuccessMotifProposals(directory, opts = {}) {
|
|
|
25775
25819
|
return result;
|
|
25776
25820
|
}
|
|
25777
25821
|
}
|
|
25778
|
-
var
|
|
25822
|
+
var _internals31 = {
|
|
25779
25823
|
now: () => new Date,
|
|
25780
25824
|
checkRecommendations,
|
|
25781
25825
|
recordEmittedRecommendations
|
|
@@ -26104,7 +26148,7 @@ async function reconcileStaleActiveSkills(directory, options = {}) {
|
|
|
26104
26148
|
continue;
|
|
26105
26149
|
}
|
|
26106
26150
|
try {
|
|
26107
|
-
const regen = await
|
|
26151
|
+
const regen = await _internals32.regenerateSkill(directory, skill.slug, {
|
|
26108
26152
|
evaluate: false
|
|
26109
26153
|
});
|
|
26110
26154
|
if (regen.regenerated) {
|
|
@@ -26360,7 +26404,7 @@ async function runSkillImprover(req) {
|
|
|
26360
26404
|
autoApply
|
|
26361
26405
|
};
|
|
26362
26406
|
}
|
|
26363
|
-
var
|
|
26407
|
+
var _internals32 = {
|
|
26364
26408
|
runSkillImprover,
|
|
26365
26409
|
buildDeterministicProposal,
|
|
26366
26410
|
buildLLMProposalFrame,
|
|
@@ -26722,13 +26766,13 @@ var write_retro = createSwarmTool({
|
|
|
26722
26766
|
task_id: args.task_id !== undefined ? String(args.task_id) : undefined,
|
|
26723
26767
|
metadata: args.metadata
|
|
26724
26768
|
};
|
|
26725
|
-
return await
|
|
26769
|
+
return await _internals33.executeWriteRetro(writeRetroArgs, directory);
|
|
26726
26770
|
} catch {
|
|
26727
26771
|
return JSON.stringify({ success: false, phase: rawPhase, message: "Invalid arguments" }, null, 2);
|
|
26728
26772
|
}
|
|
26729
26773
|
}
|
|
26730
26774
|
});
|
|
26731
|
-
var
|
|
26775
|
+
var _internals33 = {
|
|
26732
26776
|
executeWriteRetro,
|
|
26733
26777
|
write_retro
|
|
26734
26778
|
};
|
|
@@ -27034,8 +27078,8 @@ async function runFinalizeStage(ctx) {
|
|
|
27034
27078
|
];
|
|
27035
27079
|
ctx.curationSucceeded = false;
|
|
27036
27080
|
try {
|
|
27037
|
-
ctx.curationResult = await
|
|
27038
|
-
llmDelegate:
|
|
27081
|
+
ctx.curationResult = await _internals34.curateAndStoreSwarm(ctx.allLessons, ctx.projectName, { phase_number: 0 }, ctx.directory, ctx.config, {
|
|
27082
|
+
llmDelegate: _internals34.createCuratorLLMDelegate(ctx.directory, "phase", ctx.options.sessionID),
|
|
27039
27083
|
enrichmentQuota: {
|
|
27040
27084
|
maxCalls: ctx.config.enrichment.max_calls_per_day,
|
|
27041
27085
|
window: ctx.config.enrichment.quota_window
|
|
@@ -27054,7 +27098,7 @@ async function runFinalizeStage(ctx) {
|
|
|
27054
27098
|
if (ctx.config.hive_enabled === false) {} else {
|
|
27055
27099
|
try {
|
|
27056
27100
|
const entries = await readKnowledge(resolveSwarmKnowledgePath(ctx.directory));
|
|
27057
|
-
const result = await
|
|
27101
|
+
const result = await _internals34.checkHivePromotions(entries, ctx.config, ctx.directory);
|
|
27058
27102
|
ctx.hivePromoted = result.new_promotions;
|
|
27059
27103
|
} catch (hiveErr) {
|
|
27060
27104
|
const msg = hiveErr instanceof Error ? hiveErr.message : String(hiveErr);
|
|
@@ -27075,7 +27119,7 @@ async function runFinalizeStage(ctx) {
|
|
|
27075
27119
|
ctx.knowledgeSkillHint = ctx.sessionKnowledgeCreated > 0 ? `${ctx.sessionKnowledgeCreated} knowledge entries created this session. Consider running skill_improve or skill_generate to compile mature entries into skills.` : "";
|
|
27076
27120
|
if (ctx.runSkillReview) {
|
|
27077
27121
|
try {
|
|
27078
|
-
const { config: loadedConfig } =
|
|
27122
|
+
const { config: loadedConfig } = _internals34.loadPluginConfigWithMeta(ctx.directory);
|
|
27079
27123
|
const skillImproverConfig = SkillImproverConfigSchema.parse(loadedConfig.skill_improver ?? {});
|
|
27080
27124
|
const skillReviewResult = await runAbortableSkillReview({
|
|
27081
27125
|
directory: ctx.directory,
|
|
@@ -27138,7 +27182,7 @@ async function runFinalizeStage(ctx) {
|
|
|
27138
27182
|
}
|
|
27139
27183
|
if (!ctx.planAlreadyDone || ctx.guaranteeResult.closedPhaseIds.length > 0 || ctx.guaranteeResult.closedTaskIds.length > 0) {
|
|
27140
27184
|
try {
|
|
27141
|
-
await
|
|
27185
|
+
await _internals34.closePlanTerminalState(ctx.directory, ctx.planData, {
|
|
27142
27186
|
closedPhaseIds: ctx.guaranteeResult.closedPhaseIds,
|
|
27143
27187
|
closedTaskIds: ctx.guaranteeResult.closedTaskIds,
|
|
27144
27188
|
originalStatuses: ctx.originalStatuses
|
|
@@ -27154,12 +27198,12 @@ async function runFinalizeStage(ctx) {
|
|
|
27154
27198
|
}
|
|
27155
27199
|
}
|
|
27156
27200
|
try {
|
|
27157
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
27158
|
-
const { config: pmLoadedConfig } =
|
|
27201
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-cr1nr1w0.js");
|
|
27202
|
+
const { config: pmLoadedConfig } = _internals34.loadPluginConfigWithMeta(ctx.directory);
|
|
27159
27203
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
27160
27204
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
27161
|
-
const pmResult = await
|
|
27162
|
-
llmDelegate:
|
|
27205
|
+
const pmResult = await _internals34.runCuratorPostMortem(ctx.directory, {
|
|
27206
|
+
llmDelegate: _internals34.createCuratorLLMDelegate(ctx.directory, "postmortem", ctx.options.sessionID),
|
|
27163
27207
|
scope: "project",
|
|
27164
27208
|
sessionID: ctx.options.sessionID
|
|
27165
27209
|
});
|
|
@@ -27185,7 +27229,7 @@ async function copySqliteSafe(srcPath, destPath, laneEnv) {
|
|
|
27185
27229
|
}
|
|
27186
27230
|
let checkpointVerified = false;
|
|
27187
27231
|
try {
|
|
27188
|
-
const result =
|
|
27232
|
+
const result = _internals34.spawnSync("sqlite3", [srcPath, "PRAGMA wal_checkpoint(TRUNCATE);"], {
|
|
27189
27233
|
cwd: path44.dirname(srcPath),
|
|
27190
27234
|
encoding: "utf-8",
|
|
27191
27235
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -27354,7 +27398,7 @@ async function runArchiveEvidenceRetention(ctx) {
|
|
|
27354
27398
|
let cacheMaxBytes;
|
|
27355
27399
|
let cacheMaxRecords;
|
|
27356
27400
|
try {
|
|
27357
|
-
const { config: evidenceLoadedConfig } =
|
|
27401
|
+
const { config: evidenceLoadedConfig } = _internals34.loadPluginConfigWithMeta(ctx.directory);
|
|
27358
27402
|
const evidenceCfg = evidenceLoadedConfig.evidence ?? {};
|
|
27359
27403
|
if (typeof evidenceCfg.max_age_days === "number") {
|
|
27360
27404
|
maxAgeDays = evidenceCfg.max_age_days;
|
|
@@ -27370,7 +27414,7 @@ async function runArchiveEvidenceRetention(ctx) {
|
|
|
27370
27414
|
}
|
|
27371
27415
|
} catch {}
|
|
27372
27416
|
try {
|
|
27373
|
-
await
|
|
27417
|
+
await _internals34.archiveEvidence(ctx.directory, maxAgeDays, maxBundles, {
|
|
27374
27418
|
report: true,
|
|
27375
27419
|
cacheMaxBytes,
|
|
27376
27420
|
cacheMaxRecords
|
|
@@ -27577,9 +27621,9 @@ async function runAlignStage(ctx) {
|
|
|
27577
27621
|
const pruneBranches = ctx.args.includes("--prune-branches");
|
|
27578
27622
|
let gitAlignResult = "";
|
|
27579
27623
|
const prunedBranches = [];
|
|
27580
|
-
const gitStatus =
|
|
27624
|
+
const gitStatus = _internals34.getGitRepositoryStatus(ctx.directory);
|
|
27581
27625
|
if (gitStatus.isRepo) {
|
|
27582
|
-
const aggressiveResult = await
|
|
27626
|
+
const aggressiveResult = await _internals34.resetToMainAfterMerge(ctx.directory, {
|
|
27583
27627
|
pruneBranches
|
|
27584
27628
|
});
|
|
27585
27629
|
if (aggressiveResult.success) {
|
|
@@ -27591,7 +27635,7 @@ async function runAlignStage(ctx) {
|
|
|
27591
27635
|
ctx.warnings.push("Uncommitted changes were discarded during git alignment");
|
|
27592
27636
|
}
|
|
27593
27637
|
} else {
|
|
27594
|
-
const alignResult = await
|
|
27638
|
+
const alignResult = await _internals34.resetToRemoteBranch(ctx.directory, {
|
|
27595
27639
|
pruneBranches
|
|
27596
27640
|
});
|
|
27597
27641
|
gitAlignResult = alignResult.message;
|
|
@@ -27627,7 +27671,7 @@ async function runFinalizeDryRun(directory, swarmDir, planData, planExists) {
|
|
|
27627
27671
|
const wouldArchiveDirs = ACTIVE_STATE_DIRS_TO_CLEAN.filter(existsInSwarm);
|
|
27628
27672
|
const wouldRemoveTerminal = TERMINAL_STATE_FILES.filter(existsInSwarm);
|
|
27629
27673
|
const wouldCleanFiles = ACTIVE_STATE_TO_CLEAN.filter((f) => existsInSwarm(f) && !TERMINAL_STATE_FILES.includes(f));
|
|
27630
|
-
const gitStatus =
|
|
27674
|
+
const gitStatus = _internals34.getGitRepositoryStatus(directory);
|
|
27631
27675
|
const gitNote = gitStatus.isRepo ? "would align the working tree to main/remote (git reset), pruning merged branches only with --prune-branches" : "would skip git alignment (not a git repository / git unavailable)";
|
|
27632
27676
|
const lines = [
|
|
27633
27677
|
"## /swarm finalize \u2014 DRY RUN (no changes made)",
|
|
@@ -27699,12 +27743,12 @@ async function handleCloseCommand(directory, args, options = {}) {
|
|
|
27699
27743
|
}
|
|
27700
27744
|
}
|
|
27701
27745
|
if (args.includes("--dry-run")) {
|
|
27702
|
-
return
|
|
27746
|
+
return _internals34.runFinalizeDryRun(directory, swarmDir, planData, planExists);
|
|
27703
27747
|
}
|
|
27704
27748
|
let finalizeLock = {
|
|
27705
27749
|
acquired: false
|
|
27706
27750
|
};
|
|
27707
|
-
finalizeLock = await
|
|
27751
|
+
finalizeLock = await _internals34.acquireFinalizeLock(directory);
|
|
27708
27752
|
if (!finalizeLock.acquired) {
|
|
27709
27753
|
return `\u274C Another /swarm finalize is already running for this project. If you are certain no other run is active, wait for the lock to expire or remove the stale lock and retry.`;
|
|
27710
27754
|
}
|
|
@@ -27735,7 +27779,7 @@ This project was already finalized in a previous /swarm close run. The plan has
|
|
|
27735
27779
|
if (planExists) {
|
|
27736
27780
|
planAlreadyDone = phases.length > 0 && phases.every((p) => p.status === "complete" || p.status === "completed" || p.status === "blocked" || p.status === "closed");
|
|
27737
27781
|
}
|
|
27738
|
-
const { config: loadedConfig } =
|
|
27782
|
+
const { config: loadedConfig } = _internals34.loadPluginConfigWithMeta(directory);
|
|
27739
27783
|
const config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
27740
27784
|
const ctx = {
|
|
27741
27785
|
directory,
|
|
@@ -27779,7 +27823,7 @@ This project was already finalized in a previous /swarm close run. The plan has
|
|
|
27779
27823
|
args
|
|
27780
27824
|
};
|
|
27781
27825
|
await runFinalizeStage(ctx);
|
|
27782
|
-
await
|
|
27826
|
+
await _internals34.runFinalizeRewardSweep({
|
|
27783
27827
|
directory,
|
|
27784
27828
|
closedTaskIds: ctx.guaranteeResult.closedTaskIds,
|
|
27785
27829
|
memoryConfig: loadedConfig.memory
|
|
@@ -27861,9 +27905,9 @@ This project was already finalized in a previous /swarm close run. The plan has
|
|
|
27861
27905
|
try {
|
|
27862
27906
|
const sessionIdsToEnd = [...swarmState.agentSessions.keys()];
|
|
27863
27907
|
for (const sessionId of sessionIdsToEnd) {
|
|
27864
|
-
|
|
27908
|
+
_internals34.endAgentSession(sessionId);
|
|
27865
27909
|
}
|
|
27866
|
-
|
|
27910
|
+
_internals34.resetSwarmStatePreservingSingletons();
|
|
27867
27911
|
} catch (teardownError) {
|
|
27868
27912
|
const msg = teardownError instanceof Error ? teardownError.message : String(teardownError);
|
|
27869
27913
|
ctx.warnings.push(`Session teardown encountered an error after finalization completed (state may not be fully reset): ${msg}`);
|
|
@@ -27937,7 +27981,7 @@ async function acquireFinalizeLock(directory) {
|
|
|
27937
27981
|
}
|
|
27938
27982
|
return { acquired: false };
|
|
27939
27983
|
}
|
|
27940
|
-
var
|
|
27984
|
+
var _internals34 = {
|
|
27941
27985
|
ACTIVE_STATE_DIRS_TO_CLEAN,
|
|
27942
27986
|
countSessionKnowledgeEntries,
|
|
27943
27987
|
CLOSE_SKILL_REVIEW_TIMEOUT_MS,
|
|
@@ -28435,7 +28479,7 @@ function isValidTelemetryEntry(value) {
|
|
|
28435
28479
|
const obj = value;
|
|
28436
28480
|
return typeof obj.timestamp === "string" && typeof obj.task_id === "string" && typeof obj.agent_role === "string" && typeof obj.delegation_reason === "string" && typeof obj.token_estimate === "number" && typeof obj.cache_hits === "number" && typeof obj.cache_misses === "number" && typeof obj.stale_entries === "number" && typeof obj.recommended_reads === "number" && typeof obj.skipped_reads === "number" && typeof obj.success === "boolean";
|
|
28437
28481
|
}
|
|
28438
|
-
var
|
|
28482
|
+
var _internals35 = {
|
|
28439
28483
|
appendFileSync: fs16.appendFileSync,
|
|
28440
28484
|
readFileSync: fs16.readFileSync,
|
|
28441
28485
|
existsSync: fs16.existsSync,
|
|
@@ -28448,10 +28492,10 @@ function readTelemetry(directory) {
|
|
|
28448
28492
|
const filePath = telemetryFilePath(directory);
|
|
28449
28493
|
const entries = [];
|
|
28450
28494
|
try {
|
|
28451
|
-
if (!
|
|
28495
|
+
if (!_internals35.existsSync(filePath)) {
|
|
28452
28496
|
return entries;
|
|
28453
28497
|
}
|
|
28454
|
-
const raw =
|
|
28498
|
+
const raw = _internals35.readFileSync(filePath, "utf-8");
|
|
28455
28499
|
const lines = raw.split(`
|
|
28456
28500
|
`);
|
|
28457
28501
|
for (const line of lines) {
|
|
@@ -28888,9 +28932,9 @@ async function detectDarkMatter(directory, options) {
|
|
|
28888
28932
|
} catch {
|
|
28889
28933
|
return [];
|
|
28890
28934
|
}
|
|
28891
|
-
const commitMap = await
|
|
28892
|
-
const matrix =
|
|
28893
|
-
const staticEdges = await
|
|
28935
|
+
const commitMap = await _internals36.parseGitLog(directory, maxCommitsToAnalyze);
|
|
28936
|
+
const matrix = _internals36.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
|
|
28937
|
+
const staticEdges = await _internals36.getStaticEdges(directory);
|
|
28894
28938
|
const results = [];
|
|
28895
28939
|
for (const entry of matrix.values()) {
|
|
28896
28940
|
const key = `${entry.fileA}::${entry.fileB}`;
|
|
@@ -29006,11 +29050,11 @@ var co_change_analyzer = createSwarmTool({
|
|
|
29006
29050
|
npmiThreshold,
|
|
29007
29051
|
maxCommitsToAnalyze
|
|
29008
29052
|
};
|
|
29009
|
-
const pairs = await
|
|
29010
|
-
return
|
|
29053
|
+
const pairs = await _internals36.detectDarkMatter(directory, options);
|
|
29054
|
+
return _internals36.formatDarkMatterOutput(pairs);
|
|
29011
29055
|
}
|
|
29012
29056
|
});
|
|
29013
|
-
var
|
|
29057
|
+
var _internals36 = {
|
|
29014
29058
|
parseGitLog,
|
|
29015
29059
|
buildCoChangeMatrix,
|
|
29016
29060
|
getStaticEdges,
|
|
@@ -29027,7 +29071,7 @@ var DEFAULT_MAX_COMMITS = 500;
|
|
|
29027
29071
|
var cache = new Map;
|
|
29028
29072
|
async function readGitHead(directory) {
|
|
29029
29073
|
try {
|
|
29030
|
-
const { stdout } = await
|
|
29074
|
+
const { stdout } = await _internals37.execFile("git", ["rev-parse", "HEAD"], {
|
|
29031
29075
|
cwd: directory,
|
|
29032
29076
|
timeout: GIT_HEAD_TIMEOUT_MS
|
|
29033
29077
|
});
|
|
@@ -29053,9 +29097,9 @@ async function getCoChangeData(directory, options) {
|
|
|
29053
29097
|
let entries;
|
|
29054
29098
|
let commitsObserved;
|
|
29055
29099
|
try {
|
|
29056
|
-
const commitMap = await
|
|
29100
|
+
const commitMap = await _internals37.parseGitLog(directory, maxCommits);
|
|
29057
29101
|
commitsObserved = commitMap.size;
|
|
29058
|
-
const matrix =
|
|
29102
|
+
const matrix = _internals37.buildCoChangeMatrix(commitMap);
|
|
29059
29103
|
entries = Array.from(matrix.values());
|
|
29060
29104
|
} catch {
|
|
29061
29105
|
return { pairs: [], commitsObserved: 0 };
|
|
@@ -29079,10 +29123,10 @@ async function getCoChangePairs(directory, options) {
|
|
|
29079
29123
|
const data = await getCoChangeData(directory, options);
|
|
29080
29124
|
return data.pairs;
|
|
29081
29125
|
}
|
|
29082
|
-
var
|
|
29126
|
+
var _internals37 = {
|
|
29083
29127
|
execFile: execFileAsync,
|
|
29084
|
-
parseGitLog:
|
|
29085
|
-
buildCoChangeMatrix:
|
|
29128
|
+
parseGitLog: _internals36.parseGitLog,
|
|
29129
|
+
buildCoChangeMatrix: _internals36.buildCoChangeMatrix
|
|
29086
29130
|
};
|
|
29087
29131
|
|
|
29088
29132
|
// src/turbo/epic/coupling-report.ts
|
|
@@ -29306,7 +29350,7 @@ async function handleCouplingCommand(directory, args) {
|
|
|
29306
29350
|
|
|
29307
29351
|
Usage: /swarm coupling [--phase <n>] [--threshold <-1..1>] [--min-co-changes <n>] [--format markdown|json] [--persist]`;
|
|
29308
29352
|
}
|
|
29309
|
-
const plan = await
|
|
29353
|
+
const plan = await _internals38.loadPlanJsonOnly(directory);
|
|
29310
29354
|
if (plan === null) {
|
|
29311
29355
|
return "No plan found at `.swarm/plan.json`. Run `/swarm plan` to create one before measuring coupling.";
|
|
29312
29356
|
}
|
|
@@ -29330,7 +29374,7 @@ Usage: /swarm coupling [--phase <n>] [--threshold <-1..1>] [--min-co-changes <n>
|
|
|
29330
29374
|
const scope = scopeFiles ?? task.files_touched ?? [];
|
|
29331
29375
|
return { id: task.id, scope };
|
|
29332
29376
|
});
|
|
29333
|
-
const cochangePairs = await
|
|
29377
|
+
const cochangePairs = await _internals38.getCoChangePairs(directory);
|
|
29334
29378
|
const report = computeCouplingReport(tasks, cochangePairs, {
|
|
29335
29379
|
npmi: parsed.threshold,
|
|
29336
29380
|
minCoChanges: parsed.minCoChanges
|
|
@@ -29369,14 +29413,14 @@ _Warning: failed to persist report (${persistStatus.error})._`;
|
|
|
29369
29413
|
}
|
|
29370
29414
|
return `${formatCouplingReportMarkdown(report)}${persistTrailer}`;
|
|
29371
29415
|
}
|
|
29372
|
-
var
|
|
29416
|
+
var _internals38 = {
|
|
29373
29417
|
loadPlanJsonOnly,
|
|
29374
29418
|
getCoChangePairs
|
|
29375
29419
|
};
|
|
29376
29420
|
|
|
29377
29421
|
// src/commands/curate.ts
|
|
29378
29422
|
init_schema();
|
|
29379
|
-
var
|
|
29423
|
+
var _internals39 = {
|
|
29380
29424
|
checkHivePromotions,
|
|
29381
29425
|
readKnowledge,
|
|
29382
29426
|
resolveSwarmKnowledgePath,
|
|
@@ -29384,9 +29428,9 @@ var _internals38 = {
|
|
|
29384
29428
|
loadPluginConfigWithMeta,
|
|
29385
29429
|
loadCuratorDeps: async () => {
|
|
29386
29430
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
29387
|
-
import("./schema-
|
|
29388
|
-
import("./curator-
|
|
29389
|
-
import("./curator-llm-factory-
|
|
29431
|
+
import("./schema-cr1nr1w0.js"),
|
|
29432
|
+
import("./curator-jc5cc980.js"),
|
|
29433
|
+
import("./curator-llm-factory-atfnhbn6.js")
|
|
29390
29434
|
]);
|
|
29391
29435
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
29392
29436
|
}
|
|
@@ -29395,20 +29439,20 @@ async function handleCurateCommand(directory, _args, options) {
|
|
|
29395
29439
|
try {
|
|
29396
29440
|
let config;
|
|
29397
29441
|
try {
|
|
29398
|
-
const { config: loadedConfig } =
|
|
29442
|
+
const { config: loadedConfig } = _internals39.loadPluginConfigWithMeta(directory);
|
|
29399
29443
|
config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
29400
29444
|
} catch {
|
|
29401
29445
|
config = KnowledgeConfigSchema.parse({});
|
|
29402
29446
|
}
|
|
29403
|
-
const swarmPath =
|
|
29404
|
-
const swarmEntries = await
|
|
29405
|
-
const summary = await
|
|
29447
|
+
const swarmPath = _internals39.resolveSwarmKnowledgePath(directory);
|
|
29448
|
+
const swarmEntries = await _internals39.readKnowledge(swarmPath) ?? [];
|
|
29449
|
+
const summary = await _internals39.checkHivePromotions(swarmEntries, config, directory);
|
|
29406
29450
|
if (options?.sessionID) {
|
|
29407
29451
|
let onDemandPhase = 1;
|
|
29408
29452
|
try {
|
|
29409
|
-
const { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 } = await
|
|
29453
|
+
const { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 } = await _internals39.loadCuratorDeps();
|
|
29410
29454
|
const curatorConfig = CuratorConfigSchema.parse({});
|
|
29411
|
-
const priorSummary = await
|
|
29455
|
+
const priorSummary = await _internals39.readSwarmFileAsync(directory, "curator-summary.json");
|
|
29412
29456
|
if (priorSummary) {
|
|
29413
29457
|
try {
|
|
29414
29458
|
const parsed = JSON.parse(priorSummary);
|
|
@@ -29419,7 +29463,7 @@ async function handleCurateCommand(directory, _args, options) {
|
|
|
29419
29463
|
}
|
|
29420
29464
|
let planPhaseCount = Infinity;
|
|
29421
29465
|
try {
|
|
29422
|
-
const planRaw = await
|
|
29466
|
+
const planRaw = await _internals39.readSwarmFileAsync(directory, "plan.json");
|
|
29423
29467
|
if (planRaw) {
|
|
29424
29468
|
const plan = JSON.parse(planRaw);
|
|
29425
29469
|
if (Array.isArray(plan.phases))
|
|
@@ -29438,8 +29482,8 @@ async function handleCurateCommand(directory, _args, options) {
|
|
|
29438
29482
|
summary.knowledge_skipped = applied.skipped;
|
|
29439
29483
|
summary.curator_phase = onDemandPhase;
|
|
29440
29484
|
try {
|
|
29441
|
-
const updatedEntries = await
|
|
29442
|
-
const postUpdateHive = await
|
|
29485
|
+
const updatedEntries = await _internals39.readKnowledge(swarmPath) ?? [];
|
|
29486
|
+
const postUpdateHive = await _internals39.checkHivePromotions(updatedEntries, config, directory);
|
|
29443
29487
|
summary.new_promotions += postUpdateHive.new_promotions;
|
|
29444
29488
|
summary.encounters_incremented += postUpdateHive.encounters_incremented;
|
|
29445
29489
|
summary.advancements += postUpdateHive.advancements;
|
|
@@ -29505,7 +29549,7 @@ async function handleDarkMatterCommand(directory, args) {
|
|
|
29505
29549
|
}
|
|
29506
29550
|
let pairs;
|
|
29507
29551
|
try {
|
|
29508
|
-
pairs = await
|
|
29552
|
+
pairs = await _internals36.detectDarkMatter(directory, options);
|
|
29509
29553
|
} catch (err) {
|
|
29510
29554
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
29511
29555
|
return `## Dark Matter Analysis Failed
|
|
@@ -29770,7 +29814,7 @@ ${USAGE7}`;
|
|
|
29770
29814
|
// src/commands/design-docs.ts
|
|
29771
29815
|
init_warning_buffer();
|
|
29772
29816
|
var MAX_DESC_LEN = 2000;
|
|
29773
|
-
var
|
|
29817
|
+
var _internals40 = { loadPluginConfigWithMeta };
|
|
29774
29818
|
var USAGE8 = `Usage: /swarm design-docs <description> [--out <dir>] [--lang <name>] [--update]
|
|
29775
29819
|
|
|
29776
29820
|
Generate or sync language-agnostic design docs for the project under build:
|
|
@@ -29866,7 +29910,7 @@ async function handleDesignDocsCommand(directory, args) {
|
|
|
29866
29910
|
${USAGE8}`;
|
|
29867
29911
|
}
|
|
29868
29912
|
try {
|
|
29869
|
-
const { config } =
|
|
29913
|
+
const { config } = _internals40.loadPluginConfigWithMeta(directory);
|
|
29870
29914
|
if (config.design_docs?.enabled !== true) {
|
|
29871
29915
|
return "Error: design docs are disabled. Set `design_docs.enabled: true` in " + `opencode-swarm.json to enable the docs_design agent and this command.
|
|
29872
29916
|
|
|
@@ -30227,18 +30271,21 @@ function computeMemoryCohortDiagnostics(directory) {
|
|
|
30227
30271
|
const cohortConfigPath = join43(resolveLinkDir(pointer.linkId), "memory", "memory-cohort-config.json");
|
|
30228
30272
|
if (existsSync28(cohortConfigPath)) {
|
|
30229
30273
|
const stored = JSON.parse(readFileSync18(cohortConfigPath, "utf-8"));
|
|
30230
|
-
const
|
|
30231
|
-
|
|
30232
|
-
|
|
30233
|
-
|
|
30234
|
-
|
|
30235
|
-
|
|
30236
|
-
|
|
30237
|
-
|
|
30238
|
-
|
|
30239
|
-
|
|
30240
|
-
|
|
30241
|
-
|
|
30274
|
+
const versionCheck = classifyStoredFingerprintAlgorithmVersion(stored.algorithm_version);
|
|
30275
|
+
if (versionCheck.status === "comparable" && typeof stored.fingerprint === "string") {
|
|
30276
|
+
const expected = computeMemoryCohortFingerprint(buildMemoryCohortFingerprintInput({
|
|
30277
|
+
provider: cfg.memory.provider ?? "sqlite",
|
|
30278
|
+
redaction: {
|
|
30279
|
+
rejectDurableSecrets: cfg.memory.redaction?.rejectDurableSecrets ?? true
|
|
30280
|
+
},
|
|
30281
|
+
embeddings: {
|
|
30282
|
+
model: cfg.memory.embeddings?.model ?? "Xenova/all-MiniLM-L6-v2",
|
|
30283
|
+
dimension: cfg.memory.embeddings?.dimension ?? 384,
|
|
30284
|
+
version: cfg.memory.embeddings?.version
|
|
30285
|
+
}
|
|
30286
|
+
}));
|
|
30287
|
+
configFingerprintMatch = stored.fingerprint === expected;
|
|
30288
|
+
}
|
|
30242
30289
|
}
|
|
30243
30290
|
}
|
|
30244
30291
|
} catch {}
|
|
@@ -30288,7 +30335,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
30288
30335
|
let scanCompleted = false;
|
|
30289
30336
|
let scanRemaining = 0;
|
|
30290
30337
|
try {
|
|
30291
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
30338
|
+
const { getScanStatus } = await import("./scan-cursor-yzj9n225.js");
|
|
30292
30339
|
const status = await getScanStatus(directory);
|
|
30293
30340
|
scanGeneration = status.generation;
|
|
30294
30341
|
scanCompleted = status.completed;
|
|
@@ -30298,17 +30345,17 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
30298
30345
|
try {
|
|
30299
30346
|
const { isLinked: isLinked2 } = await import("./knowledge-link-zr40rnwr.js");
|
|
30300
30347
|
if (isLinked2(directory)) {
|
|
30301
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
30348
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-cr1nr1w0.js");
|
|
30302
30349
|
let config;
|
|
30303
30350
|
try {
|
|
30304
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
30351
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-bqan4y2y.js");
|
|
30305
30352
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
30306
30353
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
30307
30354
|
} catch {
|
|
30308
30355
|
config = KnowledgeConfigSchema2.parse({});
|
|
30309
30356
|
}
|
|
30310
30357
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
30311
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
30358
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-c4g08bg1.js");
|
|
30312
30359
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
30313
30360
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
30314
30361
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -30470,7 +30517,7 @@ function resolveCachePackageRoot(cachePath) {
|
|
|
30470
30517
|
const nestedPackageRoot = path52.join(cachePath, "node_modules", "opencode-swarm");
|
|
30471
30518
|
return existsSync29(nestedPackageRoot) ? nestedPackageRoot : cachePath;
|
|
30472
30519
|
}
|
|
30473
|
-
var
|
|
30520
|
+
var _internals41 = {
|
|
30474
30521
|
detectSandboxCapability: () => sandboxCapabilityProbe.detect(),
|
|
30475
30522
|
getSandboxExecutor: getExecutor
|
|
30476
30523
|
};
|
|
@@ -31054,9 +31101,9 @@ async function checkCurator(directory) {
|
|
|
31054
31101
|
}
|
|
31055
31102
|
async function getSandboxStatus() {
|
|
31056
31103
|
try {
|
|
31057
|
-
const capability = await
|
|
31104
|
+
const capability = await _internals41.detectSandboxCapability();
|
|
31058
31105
|
const mechanism = capability.mechanism ?? "none";
|
|
31059
|
-
const executor = await
|
|
31106
|
+
const executor = await _internals41.getSandboxExecutor();
|
|
31060
31107
|
const hasExecutor = executor !== null;
|
|
31061
31108
|
if (hasExecutor) {
|
|
31062
31109
|
const executorStrength = executor?.strength;
|
|
@@ -31519,7 +31566,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
31519
31566
|
const result = runConfigDoctor(config, directory);
|
|
31520
31567
|
let output;
|
|
31521
31568
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
31522
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
31569
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-n3hatm9d.js");
|
|
31523
31570
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
31524
31571
|
applyLossy: true
|
|
31525
31572
|
});
|
|
@@ -31864,7 +31911,7 @@ function readPromotionEvidence(directory) {
|
|
|
31864
31911
|
}
|
|
31865
31912
|
|
|
31866
31913
|
// src/commands/epic.ts
|
|
31867
|
-
var
|
|
31914
|
+
var _internals42 = {
|
|
31868
31915
|
loadPluginConfigWithMeta,
|
|
31869
31916
|
loadPlanJsonOnly,
|
|
31870
31917
|
getCoChangeData,
|
|
@@ -31886,7 +31933,7 @@ async function handleEpicCommand(directory, args, sessionID) {
|
|
|
31886
31933
|
if (!sessionID || sessionID.trim() === "") {
|
|
31887
31934
|
return "Error: No active session context. Epic Mode requires an active session. Use /swarm epic from within an OpenCode session.";
|
|
31888
31935
|
}
|
|
31889
|
-
const session =
|
|
31936
|
+
const session = _internals42.ensureAgentSession(sessionID, undefined, directory);
|
|
31890
31937
|
const arg0 = args[0]?.toLowerCase();
|
|
31891
31938
|
switch (arg0) {
|
|
31892
31939
|
case "status":
|
|
@@ -31913,7 +31960,7 @@ Usage:
|
|
|
31913
31960
|
}
|
|
31914
31961
|
function enableAndAck(directory, sessionID, session) {
|
|
31915
31962
|
try {
|
|
31916
|
-
|
|
31963
|
+
_internals42.enableEpicMode(directory, sessionID);
|
|
31917
31964
|
} catch (err) {
|
|
31918
31965
|
return `Error enabling Epic Mode: ${err instanceof Error ? err.message : String(err)}`;
|
|
31919
31966
|
}
|
|
@@ -31929,7 +31976,7 @@ function enableAndAck(directory, sessionID, session) {
|
|
|
31929
31976
|
}
|
|
31930
31977
|
function disableAndAck(directory, sessionID, session) {
|
|
31931
31978
|
try {
|
|
31932
|
-
|
|
31979
|
+
_internals42.disableEpicMode(directory, sessionID);
|
|
31933
31980
|
} catch (err) {
|
|
31934
31981
|
return `Error disabling Epic Mode: ${err instanceof Error ? err.message : String(err)}`;
|
|
31935
31982
|
}
|
|
@@ -31938,12 +31985,12 @@ function disableAndAck(directory, sessionID, session) {
|
|
|
31938
31985
|
}
|
|
31939
31986
|
function renderStatus(directory, sessionID) {
|
|
31940
31987
|
const lines = ["## Epic Mode \u2014 Status", ""];
|
|
31941
|
-
if (
|
|
31988
|
+
if (_internals42.isStateUnreadable(directory)) {
|
|
31942
31989
|
lines.push("**Epic Mode state is unreadable** (`.swarm/epic-state.json` is corrupt or has an unexpected shape). Status cannot be reported until the file is repaired or removed. The fail-closed marker means `epic_decide_phase` will refuse to compute a verdict in this state.");
|
|
31943
31990
|
return lines.join(`
|
|
31944
31991
|
`);
|
|
31945
31992
|
}
|
|
31946
|
-
const state =
|
|
31993
|
+
const state = _internals42.loadEpicSessionState(directory, sessionID);
|
|
31947
31994
|
if (!state) {
|
|
31948
31995
|
lines.push("Epic Mode has not been toggled for this session.");
|
|
31949
31996
|
return lines.join(`
|
|
@@ -31995,7 +32042,7 @@ function formatGreenfieldDetail(input) {
|
|
|
31995
32042
|
function renderLast(directory) {
|
|
31996
32043
|
let records;
|
|
31997
32044
|
try {
|
|
31998
|
-
records =
|
|
32045
|
+
records = _internals42.readPromotionEvidence(directory);
|
|
31999
32046
|
} catch (err) {
|
|
32000
32047
|
return `Error reading epic-promotions.jsonl: ${err instanceof Error ? err.message : String(err)}`;
|
|
32001
32048
|
}
|
|
@@ -32050,7 +32097,7 @@ function renderLast(directory) {
|
|
|
32050
32097
|
`);
|
|
32051
32098
|
}
|
|
32052
32099
|
function renderCalibration(directory) {
|
|
32053
|
-
if (
|
|
32100
|
+
if (_internals42.isCalibrationStateUnreadable(directory)) {
|
|
32054
32101
|
return [
|
|
32055
32102
|
"## Epic Mode \u2014 Calibration",
|
|
32056
32103
|
"",
|
|
@@ -32062,11 +32109,11 @@ function renderCalibration(directory) {
|
|
|
32062
32109
|
}
|
|
32063
32110
|
let state;
|
|
32064
32111
|
try {
|
|
32065
|
-
state =
|
|
32112
|
+
state = _internals42.loadCalibrationState(directory);
|
|
32066
32113
|
} catch (err) {
|
|
32067
32114
|
return `Error reading calibration state: ${err instanceof Error ? err.message : String(err)}`;
|
|
32068
32115
|
}
|
|
32069
|
-
const { config } =
|
|
32116
|
+
const { config } = _internals42.loadPluginConfigWithMeta(directory);
|
|
32070
32117
|
const staticThreshold = config.turbo?.epic?.mode?.activation_threshold ?? 0.3;
|
|
32071
32118
|
const calibrationCfg = config.turbo?.epic?.calibration;
|
|
32072
32119
|
const loosenWindow = calibrationCfg?.loosen_window ?? 10;
|
|
@@ -32114,7 +32161,7 @@ function renderCalibration(directory) {
|
|
|
32114
32161
|
lines.push("");
|
|
32115
32162
|
let recentDivergent = [];
|
|
32116
32163
|
try {
|
|
32117
|
-
const all =
|
|
32164
|
+
const all = _internals42.readDivergenceHistory(directory, { limit: 50 });
|
|
32118
32165
|
recentDivergent = all.filter((r) => !r.isClean).slice(-5);
|
|
32119
32166
|
} catch {}
|
|
32120
32167
|
lines.push("### Recent divergent tasks (tightened the threshold)");
|
|
@@ -32131,11 +32178,11 @@ function renderCalibration(directory) {
|
|
|
32131
32178
|
`);
|
|
32132
32179
|
}
|
|
32133
32180
|
async function renderDecide(directory) {
|
|
32134
|
-
const plan = await
|
|
32181
|
+
const plan = await _internals42.loadPlanJsonOnly(directory);
|
|
32135
32182
|
if (!plan) {
|
|
32136
32183
|
return "No plan found at `.swarm/plan.json`. Run `/swarm plan` first.";
|
|
32137
32184
|
}
|
|
32138
|
-
const { config } =
|
|
32185
|
+
const { config } = _internals42.loadPluginConfigWithMeta(directory);
|
|
32139
32186
|
const modeCfg = config.turbo?.epic?.mode;
|
|
32140
32187
|
const cochangeCfg = config.turbo?.epic?.cochange;
|
|
32141
32188
|
const activationThreshold = modeCfg?.activation_threshold ?? 0.3;
|
|
@@ -32145,20 +32192,20 @@ async function renderDecide(directory) {
|
|
|
32145
32192
|
const tasks = [];
|
|
32146
32193
|
for (const phase of plan.phases) {
|
|
32147
32194
|
for (const task of phase.tasks) {
|
|
32148
|
-
const scopeFiles =
|
|
32195
|
+
const scopeFiles = _internals42.readTaskScopes(directory, task.id);
|
|
32149
32196
|
const scope = scopeFiles ?? task.files_touched ?? [];
|
|
32150
32197
|
tasks.push({ id: task.id, scope });
|
|
32151
32198
|
}
|
|
32152
32199
|
}
|
|
32153
|
-
const { pairs, commitsObserved } = await
|
|
32200
|
+
const { pairs, commitsObserved } = await _internals42.getCoChangeData(directory);
|
|
32154
32201
|
const isGitProject = (() => {
|
|
32155
32202
|
try {
|
|
32156
|
-
return
|
|
32203
|
+
return _internals42.isGitRepo(directory);
|
|
32157
32204
|
} catch {
|
|
32158
32205
|
return false;
|
|
32159
32206
|
}
|
|
32160
32207
|
})();
|
|
32161
|
-
const verdict =
|
|
32208
|
+
const verdict = _internals42.decideEpicActivation(tasks, pairs, commitsObserved, {
|
|
32162
32209
|
activationThreshold,
|
|
32163
32210
|
minCommitsForSignal,
|
|
32164
32211
|
cochangeNpmiThreshold,
|
|
@@ -32202,7 +32249,7 @@ function formatVerdict(verdict) {
|
|
|
32202
32249
|
}
|
|
32203
32250
|
|
|
32204
32251
|
// src/services/evidence-service.ts
|
|
32205
|
-
var
|
|
32252
|
+
var _internals43 = {
|
|
32206
32253
|
loadEvidence,
|
|
32207
32254
|
listEvidenceTaskIds
|
|
32208
32255
|
};
|
|
@@ -32247,7 +32294,7 @@ function getVerdictEmoji(verdict) {
|
|
|
32247
32294
|
return getVerdictIcon(verdict);
|
|
32248
32295
|
}
|
|
32249
32296
|
async function getTaskEvidenceData(directory, taskId) {
|
|
32250
|
-
const result = await
|
|
32297
|
+
const result = await _internals43.loadEvidence(directory, taskId);
|
|
32251
32298
|
if (result.status !== "found") {
|
|
32252
32299
|
return {
|
|
32253
32300
|
hasEvidence: false,
|
|
@@ -32270,13 +32317,13 @@ async function getTaskEvidenceData(directory, taskId) {
|
|
|
32270
32317
|
};
|
|
32271
32318
|
}
|
|
32272
32319
|
async function getEvidenceListData(directory) {
|
|
32273
|
-
const taskIds = await
|
|
32320
|
+
const taskIds = await _internals43.listEvidenceTaskIds(directory);
|
|
32274
32321
|
if (taskIds.length === 0) {
|
|
32275
32322
|
return { hasEvidence: false, tasks: [] };
|
|
32276
32323
|
}
|
|
32277
32324
|
const tasks = [];
|
|
32278
32325
|
for (const taskId of taskIds) {
|
|
32279
|
-
const result = await
|
|
32326
|
+
const result = await _internals43.loadEvidence(directory, taskId);
|
|
32280
32327
|
if (result.status === "found") {
|
|
32281
32328
|
tasks.push({
|
|
32282
32329
|
taskId,
|
|
@@ -33016,7 +33063,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
|
|
|
33016
33063
|
const strippedMutated = stripCode(mutatedCode);
|
|
33017
33064
|
return strippedOriginal === strippedMutated;
|
|
33018
33065
|
}
|
|
33019
|
-
var
|
|
33066
|
+
var _internals44 = {
|
|
33020
33067
|
isStaticallyEquivalent,
|
|
33021
33068
|
checkEquivalence,
|
|
33022
33069
|
batchCheckEquivalence
|
|
@@ -33056,7 +33103,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
|
|
|
33056
33103
|
const results = [];
|
|
33057
33104
|
for (const { patch, originalCode, mutatedCode } of patches) {
|
|
33058
33105
|
try {
|
|
33059
|
-
const result = await
|
|
33106
|
+
const result = await _internals44.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
|
|
33060
33107
|
results.push(result);
|
|
33061
33108
|
} catch (err) {
|
|
33062
33109
|
results.push({
|
|
@@ -33130,10 +33177,10 @@ function isMissingExecutableFailure(message) {
|
|
|
33130
33177
|
return /\bENOENT\b/i.test(message) || /\bexecutable\b[^\r\n]*\bnot found\b/i.test(message) || /\bnot found in (?:the )?\$?PATH\b/i.test(message);
|
|
33131
33178
|
}
|
|
33132
33179
|
var runMutationCommand = async (args) => {
|
|
33133
|
-
const resolvedExecutable =
|
|
33180
|
+
const resolvedExecutable = _internals45.resolveExecutableFromPath([
|
|
33134
33181
|
args.executable
|
|
33135
33182
|
]);
|
|
33136
|
-
const result = await
|
|
33183
|
+
const result = await _internals45.runExternalTool({
|
|
33137
33184
|
executable: resolvedExecutable ?? args.executable,
|
|
33138
33185
|
args: args.args,
|
|
33139
33186
|
cwd: args.cwd,
|
|
@@ -33152,7 +33199,7 @@ var runMutationCommand = async (args) => {
|
|
|
33152
33199
|
};
|
|
33153
33200
|
var runLegacyTestSeam = async (args) => {
|
|
33154
33201
|
try {
|
|
33155
|
-
const result =
|
|
33202
|
+
const result = _internals45.spawnSync(args.executable, args.args, {
|
|
33156
33203
|
cwd: args.cwd,
|
|
33157
33204
|
timeout: args.timeoutMs,
|
|
33158
33205
|
stdio: "pipe"
|
|
@@ -33186,11 +33233,11 @@ var runLegacyTestSeam = async (args) => {
|
|
|
33186
33233
|
function selectRunner(options) {
|
|
33187
33234
|
if (options.runner)
|
|
33188
33235
|
return options.runner;
|
|
33189
|
-
if (
|
|
33236
|
+
if (_internals45.spawnSync !== defaultLegacySpawnSync)
|
|
33190
33237
|
return runLegacyTestSeam;
|
|
33191
|
-
return
|
|
33238
|
+
return _internals45.runCommand;
|
|
33192
33239
|
}
|
|
33193
|
-
var
|
|
33240
|
+
var _internals45 = {
|
|
33194
33241
|
executeMutation,
|
|
33195
33242
|
computeReport,
|
|
33196
33243
|
executeMutationSuite,
|
|
@@ -34434,11 +34481,11 @@ var quality_budget = createSwarmTool({
|
|
|
34434
34481
|
}).optional().describe("Quality budget thresholds")
|
|
34435
34482
|
},
|
|
34436
34483
|
async execute(args, directory) {
|
|
34437
|
-
const result = await
|
|
34484
|
+
const result = await _internals46.qualityBudget(args, directory);
|
|
34438
34485
|
return JSON.stringify(result);
|
|
34439
34486
|
}
|
|
34440
34487
|
});
|
|
34441
|
-
var
|
|
34488
|
+
var _internals46 = {
|
|
34442
34489
|
qualityBudget
|
|
34443
34490
|
};
|
|
34444
34491
|
|
|
@@ -35307,7 +35354,7 @@ var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
|
|
|
35307
35354
|
var DEFAULT_TIMEOUT_MS2 = 30000;
|
|
35308
35355
|
var MAX_OUTPUT_BYTES = 10 * 1024 * 1024;
|
|
35309
35356
|
var KILL_GRACE_MS = 2000;
|
|
35310
|
-
var
|
|
35357
|
+
var _internals47 = {
|
|
35311
35358
|
isSemgrepAvailable,
|
|
35312
35359
|
checkSemgrepAvailable,
|
|
35313
35360
|
resetSemgrepCache,
|
|
@@ -35333,7 +35380,7 @@ function isSemgrepAvailable() {
|
|
|
35333
35380
|
}
|
|
35334
35381
|
}
|
|
35335
35382
|
async function checkSemgrepAvailable() {
|
|
35336
|
-
return
|
|
35383
|
+
return _internals47.isSemgrepAvailable();
|
|
35337
35384
|
}
|
|
35338
35385
|
function resetSemgrepCache() {
|
|
35339
35386
|
semgrepAvailableCache = null;
|
|
@@ -35520,12 +35567,12 @@ async function runSemgrep(options) {
|
|
|
35520
35567
|
const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS2;
|
|
35521
35568
|
if (files.length === 0) {
|
|
35522
35569
|
return {
|
|
35523
|
-
available:
|
|
35570
|
+
available: _internals47.isSemgrepAvailable(),
|
|
35524
35571
|
findings: [],
|
|
35525
35572
|
engine: "tier_a"
|
|
35526
35573
|
};
|
|
35527
35574
|
}
|
|
35528
|
-
if (!
|
|
35575
|
+
if (!_internals47.isSemgrepAvailable()) {
|
|
35529
35576
|
return {
|
|
35530
35577
|
available: false,
|
|
35531
35578
|
findings: [],
|
|
@@ -35687,7 +35734,7 @@ function assignOccurrenceIndices(findings, directory) {
|
|
|
35687
35734
|
}
|
|
35688
35735
|
const occIdx = countMap.get(baseKey) ?? 0;
|
|
35689
35736
|
countMap.set(baseKey, occIdx + 1);
|
|
35690
|
-
const fp =
|
|
35737
|
+
const fp = _internals48.fingerprintFinding(finding, directory, occIdx);
|
|
35691
35738
|
return {
|
|
35692
35739
|
finding,
|
|
35693
35740
|
index: occIdx,
|
|
@@ -35756,7 +35803,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
|
|
|
35756
35803
|
}
|
|
35757
35804
|
} catch {}
|
|
35758
35805
|
const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
|
|
35759
|
-
const indexed =
|
|
35806
|
+
const indexed = _internals48.assignOccurrenceIndices(findings, directory);
|
|
35760
35807
|
if (existing && !opts?.force) {
|
|
35761
35808
|
const prunedFingerprints = existing.fingerprints.filter((fp) => {
|
|
35762
35809
|
const relFile = fp.slice(0, fp.indexOf("|"));
|
|
@@ -35896,7 +35943,7 @@ function loadBaseline(directory, phase) {
|
|
|
35896
35943
|
};
|
|
35897
35944
|
}
|
|
35898
35945
|
}
|
|
35899
|
-
var
|
|
35946
|
+
var _internals48 = {
|
|
35900
35947
|
fingerprintFinding,
|
|
35901
35948
|
assignOccurrenceIndices,
|
|
35902
35949
|
captureOrMergeBaseline,
|
|
@@ -36010,7 +36057,7 @@ async function sastScan(input, directory, config) {
|
|
|
36010
36057
|
let filesScanned = 0;
|
|
36011
36058
|
let _filesSkipped = 0;
|
|
36012
36059
|
const scannedFilePaths = [];
|
|
36013
|
-
const semgrepAvailable = !offline_only &&
|
|
36060
|
+
const semgrepAvailable = !offline_only && _internals49.isSemgrepAvailable();
|
|
36014
36061
|
const engine = semgrepAvailable ? "tier_a+tier_b" : "tier_a";
|
|
36015
36062
|
const filesByLanguage = new Map;
|
|
36016
36063
|
for (const filePath of changed_files) {
|
|
@@ -36073,13 +36120,13 @@ async function sastScan(input, directory, config) {
|
|
|
36073
36120
|
let semgrepResult;
|
|
36074
36121
|
if (bucketKey.startsWith("auto:")) {
|
|
36075
36122
|
const lang = bucketKey.slice("auto:".length);
|
|
36076
|
-
semgrepResult = await
|
|
36123
|
+
semgrepResult = await _internals49.runSemgrep({
|
|
36077
36124
|
files: bucketFiles,
|
|
36078
36125
|
lang,
|
|
36079
36126
|
useAutoConfig: true
|
|
36080
36127
|
});
|
|
36081
36128
|
} else {
|
|
36082
|
-
semgrepResult = await
|
|
36129
|
+
semgrepResult = await _internals49.runSemgrep({
|
|
36083
36130
|
files: bucketFiles
|
|
36084
36131
|
});
|
|
36085
36132
|
}
|
|
@@ -36321,11 +36368,11 @@ var sast_scan = createSwarmTool({
|
|
|
36321
36368
|
capture_baseline: safeArgs.capture_baseline,
|
|
36322
36369
|
phase: safeArgs.phase
|
|
36323
36370
|
};
|
|
36324
|
-
const result = await
|
|
36371
|
+
const result = await _internals49.sastScan(input, directory);
|
|
36325
36372
|
return JSON.stringify(result, null, 2);
|
|
36326
36373
|
}
|
|
36327
36374
|
});
|
|
36328
|
-
var
|
|
36375
|
+
var _internals49 = {
|
|
36329
36376
|
sastScan,
|
|
36330
36377
|
sast_scan,
|
|
36331
36378
|
isSemgrepAvailable: () => isSemgrepAvailable(),
|
|
@@ -37155,7 +37202,7 @@ function extractCurrentPhaseFromPlan2(plan) {
|
|
|
37155
37202
|
if (!plan) {
|
|
37156
37203
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
37157
37204
|
}
|
|
37158
|
-
if (!
|
|
37205
|
+
if (!_internals50.validatePlanPhases(plan)) {
|
|
37159
37206
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
37160
37207
|
}
|
|
37161
37208
|
let currentPhase = null;
|
|
@@ -37297,9 +37344,9 @@ function extractPhaseMetrics(content) {
|
|
|
37297
37344
|
async function getHandoffData(directory) {
|
|
37298
37345
|
const now = new Date().toISOString();
|
|
37299
37346
|
const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
|
|
37300
|
-
const sessionState =
|
|
37347
|
+
const sessionState = _internals50.parseSessionState(sessionContent);
|
|
37301
37348
|
const plan = await loadPlanJsonOnly(directory);
|
|
37302
|
-
const planInfo =
|
|
37349
|
+
const planInfo = _internals50.extractCurrentPhaseFromPlan(plan);
|
|
37303
37350
|
if (!plan) {
|
|
37304
37351
|
const planMdContent = await readSwarmFileAsync(directory, "plan.md");
|
|
37305
37352
|
if (planMdContent) {
|
|
@@ -37318,8 +37365,8 @@ async function getHandoffData(directory) {
|
|
|
37318
37365
|
}
|
|
37319
37366
|
}
|
|
37320
37367
|
const contextContent = await readSwarmFileAsync(directory, "context.md");
|
|
37321
|
-
const recentDecisions =
|
|
37322
|
-
const rawPhaseMetrics =
|
|
37368
|
+
const recentDecisions = _internals50.extractDecisions(contextContent);
|
|
37369
|
+
const rawPhaseMetrics = _internals50.extractPhaseMetrics(contextContent);
|
|
37323
37370
|
const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
|
|
37324
37371
|
let delegationState = null;
|
|
37325
37372
|
if (sessionState?.delegationState) {
|
|
@@ -37483,7 +37530,7 @@ ${lines.join(`
|
|
|
37483
37530
|
`)}
|
|
37484
37531
|
\`\`\``;
|
|
37485
37532
|
}
|
|
37486
|
-
var
|
|
37533
|
+
var _internals50 = {
|
|
37487
37534
|
getHandoffData,
|
|
37488
37535
|
formatHandoffMarkdown,
|
|
37489
37536
|
formatContinuationPrompt,
|
|
@@ -37650,15 +37697,15 @@ async function writeSnapshot(directory, state) {
|
|
|
37650
37697
|
}
|
|
37651
37698
|
function createSnapshotWriterHook(directory) {
|
|
37652
37699
|
return (_input, _output) => {
|
|
37653
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
37700
|
+
_writeInFlight = _writeInFlight.then(() => _internals51.writeSnapshot(directory, swarmState), () => _internals51.writeSnapshot(directory, swarmState));
|
|
37654
37701
|
return _writeInFlight;
|
|
37655
37702
|
};
|
|
37656
37703
|
}
|
|
37657
37704
|
async function flushPendingSnapshot(directory) {
|
|
37658
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
37705
|
+
_writeInFlight = _writeInFlight.then(() => _internals51.writeSnapshot(directory, swarmState), () => _internals51.writeSnapshot(directory, swarmState));
|
|
37659
37706
|
await _writeInFlight;
|
|
37660
37707
|
}
|
|
37661
|
-
var
|
|
37708
|
+
var _internals51 = {
|
|
37662
37709
|
writeSnapshot,
|
|
37663
37710
|
createSnapshotWriterHook,
|
|
37664
37711
|
flushPendingSnapshot
|
|
@@ -37943,7 +37990,7 @@ function parseIssueRef(input, directory) {
|
|
|
37943
37990
|
}
|
|
37944
37991
|
return null;
|
|
37945
37992
|
}
|
|
37946
|
-
var
|
|
37993
|
+
var _internals52 = {
|
|
37947
37994
|
writeFileSync: fs28.writeFileSync,
|
|
37948
37995
|
mkdirSync: fs28.mkdirSync,
|
|
37949
37996
|
renameSync: fs28.renameSync,
|
|
@@ -37954,18 +38001,18 @@ var _internals51 = {
|
|
|
37954
38001
|
function atomicWriteFileSync(dir, filename, content) {
|
|
37955
38002
|
const tmpPath = path66.join(dir, `.tmp-${filename}-${Date.now()}-${process.pid}`);
|
|
37956
38003
|
const finalPath = path66.join(dir, filename);
|
|
37957
|
-
|
|
38004
|
+
_internals52.writeFileSync(tmpPath, content, "utf-8");
|
|
37958
38005
|
try {
|
|
37959
|
-
|
|
38006
|
+
_internals52.renameSync(tmpPath, finalPath);
|
|
37960
38007
|
} catch {
|
|
37961
38008
|
try {
|
|
37962
|
-
|
|
38009
|
+
_internals52.unlinkSync(finalPath);
|
|
37963
38010
|
} catch {}
|
|
37964
38011
|
try {
|
|
37965
|
-
|
|
38012
|
+
_internals52.renameSync(tmpPath, finalPath);
|
|
37966
38013
|
} catch (retryErr) {
|
|
37967
38014
|
try {
|
|
37968
|
-
|
|
38015
|
+
_internals52.unlinkSync(tmpPath);
|
|
37969
38016
|
} catch {}
|
|
37970
38017
|
throw retryErr;
|
|
37971
38018
|
}
|
|
@@ -38018,10 +38065,10 @@ ${USAGE9}`;
|
|
|
38018
38065
|
};
|
|
38019
38066
|
let oldTraceState = null;
|
|
38020
38067
|
try {
|
|
38021
|
-
oldTraceState =
|
|
38068
|
+
oldTraceState = _internals52.readFileSync(path66.join(swarmDir, "issue-trace-state.json"), "utf-8");
|
|
38022
38069
|
} catch {}
|
|
38023
38070
|
try {
|
|
38024
|
-
|
|
38071
|
+
_internals52.mkdirSync(swarmDir, { recursive: true });
|
|
38025
38072
|
atomicWriteFileSync(swarmDir, "issue-trace-state.json", JSON.stringify(traceState, null, 2));
|
|
38026
38073
|
atomicWriteFileSync(swarmDir, "issue-reference.json", JSON.stringify(issueReference, null, 2));
|
|
38027
38074
|
} catch (e) {
|
|
@@ -38031,11 +38078,11 @@ ${USAGE9}`;
|
|
|
38031
38078
|
} catch {}
|
|
38032
38079
|
} else {
|
|
38033
38080
|
try {
|
|
38034
|
-
|
|
38081
|
+
_internals52.unlinkSync(path66.join(swarmDir, "issue-trace-state.json"));
|
|
38035
38082
|
} catch {}
|
|
38036
38083
|
}
|
|
38037
38084
|
try {
|
|
38038
|
-
|
|
38085
|
+
_internals52.unlinkSync(path66.join(swarmDir, "issue-reference.json"));
|
|
38039
38086
|
} catch {}
|
|
38040
38087
|
const errMsg = e instanceof Error ? e.message : String(e);
|
|
38041
38088
|
return `Error: Failed to persist issue reference durably: ${errMsg}
|
|
@@ -38068,7 +38115,7 @@ init_knowledge_types();
|
|
|
38068
38115
|
async function migrateKnowledgeToExternal(_directory, _config) {
|
|
38069
38116
|
const externalSentinelPath = path67.join(_directory, ".swarm", ".knowledge-external-migrated");
|
|
38070
38117
|
const contextPath = path67.join(_directory, ".swarm", "context.md");
|
|
38071
|
-
if (
|
|
38118
|
+
if (_internals53.existsSync(externalSentinelPath)) {
|
|
38072
38119
|
return {
|
|
38073
38120
|
migrated: false,
|
|
38074
38121
|
entriesMigrated: 0,
|
|
@@ -38077,7 +38124,7 @@ async function migrateKnowledgeToExternal(_directory, _config) {
|
|
|
38077
38124
|
skippedReason: "external-sentinel-exists"
|
|
38078
38125
|
};
|
|
38079
38126
|
}
|
|
38080
|
-
if (!
|
|
38127
|
+
if (!_internals53.existsSync(contextPath)) {
|
|
38081
38128
|
return {
|
|
38082
38129
|
migrated: false,
|
|
38083
38130
|
entriesMigrated: 0,
|
|
@@ -38086,7 +38133,7 @@ async function migrateKnowledgeToExternal(_directory, _config) {
|
|
|
38086
38133
|
skippedReason: "no-context-file"
|
|
38087
38134
|
};
|
|
38088
38135
|
}
|
|
38089
|
-
const contextContent = await
|
|
38136
|
+
const contextContent = await _internals53.readFile(contextPath, "utf-8");
|
|
38090
38137
|
if (contextContent.trim().length === 0) {
|
|
38091
38138
|
return {
|
|
38092
38139
|
migrated: false,
|
|
@@ -38104,7 +38151,7 @@ async function migrateKnowledgeToExternal(_directory, _config) {
|
|
|
38104
38151
|
entriesCount++;
|
|
38105
38152
|
}
|
|
38106
38153
|
}
|
|
38107
|
-
await
|
|
38154
|
+
await _internals53.writeSentinel(externalSentinelPath, entriesCount, entriesCount);
|
|
38108
38155
|
return {
|
|
38109
38156
|
migrated: true,
|
|
38110
38157
|
entriesMigrated: entriesCount,
|
|
@@ -38112,7 +38159,7 @@ async function migrateKnowledgeToExternal(_directory, _config) {
|
|
|
38112
38159
|
entriesTotal: entriesCount
|
|
38113
38160
|
};
|
|
38114
38161
|
}
|
|
38115
|
-
var
|
|
38162
|
+
var _internals53 = {
|
|
38116
38163
|
appendKnowledge,
|
|
38117
38164
|
migrateContextToKnowledge,
|
|
38118
38165
|
migrateKnowledgeToExternal,
|
|
@@ -38163,9 +38210,9 @@ async function migrateContextToKnowledge(directory, config) {
|
|
|
38163
38210
|
skippedReason: "empty-context"
|
|
38164
38211
|
};
|
|
38165
38212
|
}
|
|
38166
|
-
const rawEntries =
|
|
38213
|
+
const rawEntries = _internals53.parseContextMd(contextContent);
|
|
38167
38214
|
if (rawEntries.length === 0) {
|
|
38168
|
-
await
|
|
38215
|
+
await _internals53.writeSentinel(sentinelPath, 0, 0);
|
|
38169
38216
|
return {
|
|
38170
38217
|
migrated: true,
|
|
38171
38218
|
entriesMigrated: 0,
|
|
@@ -38176,10 +38223,10 @@ async function migrateContextToKnowledge(directory, config) {
|
|
|
38176
38223
|
const existing = await readKnowledge(knowledgePath);
|
|
38177
38224
|
let migrated = 0;
|
|
38178
38225
|
let dropped = 0;
|
|
38179
|
-
const projectName =
|
|
38226
|
+
const projectName = _internals53.inferProjectName(directory);
|
|
38180
38227
|
for (const raw of rawEntries) {
|
|
38181
38228
|
if (config.validation_enabled !== false) {
|
|
38182
|
-
const category = raw.categoryHint ??
|
|
38229
|
+
const category = raw.categoryHint ?? _internals53.inferCategoryFromText(raw.text);
|
|
38183
38230
|
const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
|
|
38184
38231
|
category,
|
|
38185
38232
|
scope: "global",
|
|
@@ -38199,8 +38246,8 @@ async function migrateContextToKnowledge(directory, config) {
|
|
|
38199
38246
|
const entry = {
|
|
38200
38247
|
id: randomUUID8(),
|
|
38201
38248
|
tier: "swarm",
|
|
38202
|
-
lesson:
|
|
38203
|
-
category: raw.categoryHint ??
|
|
38249
|
+
lesson: _internals53.truncateLesson(raw.text),
|
|
38250
|
+
category: raw.categoryHint ?? _internals53.inferCategoryFromText(raw.text),
|
|
38204
38251
|
tags: [...inferredTags, `migration:${raw.sourceSection}`],
|
|
38205
38252
|
scope: "global",
|
|
38206
38253
|
confidence: 0.3,
|
|
@@ -38223,7 +38270,7 @@ async function migrateContextToKnowledge(directory, config) {
|
|
|
38223
38270
|
if (migrated > 0) {
|
|
38224
38271
|
await rewriteKnowledge(knowledgePath, existing);
|
|
38225
38272
|
}
|
|
38226
|
-
await
|
|
38273
|
+
await _internals53.writeSentinel(sentinelPath, migrated, dropped);
|
|
38227
38274
|
log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
|
|
38228
38275
|
return {
|
|
38229
38276
|
migrated: true,
|
|
@@ -38233,7 +38280,7 @@ async function migrateContextToKnowledge(directory, config) {
|
|
|
38233
38280
|
};
|
|
38234
38281
|
}
|
|
38235
38282
|
async function migrateHiveKnowledgeLegacy(config) {
|
|
38236
|
-
const legacyHivePath =
|
|
38283
|
+
const legacyHivePath = _internals53.resolveLegacyHiveKnowledgePath();
|
|
38237
38284
|
const canonicalHivePath = resolveHiveKnowledgePath2();
|
|
38238
38285
|
const sentinelPath = path67.join(path67.dirname(canonicalHivePath), ".hive-knowledge-migrated");
|
|
38239
38286
|
if (existsSync38(sentinelPath)) {
|
|
@@ -38256,7 +38303,7 @@ async function migrateHiveKnowledgeLegacy(config) {
|
|
|
38256
38303
|
}
|
|
38257
38304
|
const legacyEntries = await readKnowledge(legacyHivePath);
|
|
38258
38305
|
if (legacyEntries.length === 0) {
|
|
38259
|
-
await
|
|
38306
|
+
await _internals53.writeSentinel(sentinelPath, 0, 0);
|
|
38260
38307
|
return {
|
|
38261
38308
|
migrated: true,
|
|
38262
38309
|
entriesMigrated: 0,
|
|
@@ -38304,7 +38351,7 @@ async function migrateHiveKnowledgeLegacy(config) {
|
|
|
38304
38351
|
const newHiveEntry = {
|
|
38305
38352
|
id: resolvedId,
|
|
38306
38353
|
tier: "hive",
|
|
38307
|
-
lesson:
|
|
38354
|
+
lesson: _internals53.truncateLesson(lesson),
|
|
38308
38355
|
category,
|
|
38309
38356
|
tags: ["migration:legacy-hive"],
|
|
38310
38357
|
scope: scopeTag,
|
|
@@ -38323,7 +38370,7 @@ async function migrateHiveKnowledgeLegacy(config) {
|
|
|
38323
38370
|
encounter_score: 1
|
|
38324
38371
|
};
|
|
38325
38372
|
try {
|
|
38326
|
-
await
|
|
38373
|
+
await _internals53.appendKnowledge(canonicalHivePath, newHiveEntry);
|
|
38327
38374
|
existingHiveEntries.push(newHiveEntry);
|
|
38328
38375
|
migrated++;
|
|
38329
38376
|
} catch (appendError) {
|
|
@@ -38339,7 +38386,7 @@ async function migrateHiveKnowledgeLegacy(config) {
|
|
|
38339
38386
|
dropped++;
|
|
38340
38387
|
}
|
|
38341
38388
|
}
|
|
38342
|
-
await
|
|
38389
|
+
await _internals53.writeSentinel(sentinelPath, migrated, dropped);
|
|
38343
38390
|
log(`[knowledge-migrator] Migrated ${migrated} legacy hive entries, dropped ${dropped}`);
|
|
38344
38391
|
return {
|
|
38345
38392
|
migrated: true,
|
|
@@ -38350,7 +38397,7 @@ async function migrateHiveKnowledgeLegacy(config) {
|
|
|
38350
38397
|
};
|
|
38351
38398
|
}
|
|
38352
38399
|
function parseContextMd(content) {
|
|
38353
|
-
const sections =
|
|
38400
|
+
const sections = _internals53.splitIntoSections(content);
|
|
38354
38401
|
const entries = [];
|
|
38355
38402
|
const seen = new Set;
|
|
38356
38403
|
const sectionPatterns = [
|
|
@@ -38366,7 +38413,7 @@ function parseContextMd(content) {
|
|
|
38366
38413
|
const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
|
|
38367
38414
|
if (!match)
|
|
38368
38415
|
continue;
|
|
38369
|
-
const bullets =
|
|
38416
|
+
const bullets = _internals53.extractBullets(section.body);
|
|
38370
38417
|
for (const bullet of bullets) {
|
|
38371
38418
|
if (bullet.length < 15)
|
|
38372
38419
|
continue;
|
|
@@ -38375,9 +38422,9 @@ function parseContextMd(content) {
|
|
|
38375
38422
|
continue;
|
|
38376
38423
|
seen.add(normalized);
|
|
38377
38424
|
entries.push({
|
|
38378
|
-
text:
|
|
38425
|
+
text: _internals53.truncateLesson(bullet),
|
|
38379
38426
|
sourceSection: match.sourceSection,
|
|
38380
|
-
categoryHint:
|
|
38427
|
+
categoryHint: _internals53.inferCategoryFromText(bullet)
|
|
38381
38428
|
});
|
|
38382
38429
|
}
|
|
38383
38430
|
}
|
|
@@ -38467,8 +38514,8 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
|
|
|
38467
38514
|
schema_version: 1,
|
|
38468
38515
|
migration_tool: "knowledge-migrator.ts"
|
|
38469
38516
|
};
|
|
38470
|
-
await
|
|
38471
|
-
await
|
|
38517
|
+
await _internals53.mkdir(path67.dirname(sentinelPath), { recursive: true });
|
|
38518
|
+
await _internals53.writeFile(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
|
|
38472
38519
|
}
|
|
38473
38520
|
function resolveLegacyHiveKnowledgePath() {
|
|
38474
38521
|
const platform = process.platform;
|
|
@@ -38880,7 +38927,7 @@ function timeoutMessage(timeoutMs) {
|
|
|
38880
38927
|
async function computeWithTimeout(directory, currentPhase, timeoutMs) {
|
|
38881
38928
|
const controller = new AbortController;
|
|
38882
38929
|
let timeout;
|
|
38883
|
-
const metricsPromise =
|
|
38930
|
+
const metricsPromise = _internals54.computeLearningMetrics(directory, {
|
|
38884
38931
|
currentPhase,
|
|
38885
38932
|
signal: controller.signal
|
|
38886
38933
|
});
|
|
@@ -38937,7 +38984,7 @@ ${JSON.stringify({
|
|
|
38937
38984
|
return `Error computing learning metrics: ${message}. Run /swarm diagnose to check .swarm/ health.`;
|
|
38938
38985
|
}
|
|
38939
38986
|
}
|
|
38940
|
-
var
|
|
38987
|
+
var _internals54 = {
|
|
38941
38988
|
computeLearningMetrics
|
|
38942
38989
|
};
|
|
38943
38990
|
|
|
@@ -39458,7 +39505,7 @@ async function readLatestLoopState(directory) {
|
|
|
39458
39505
|
return null;
|
|
39459
39506
|
}
|
|
39460
39507
|
}
|
|
39461
|
-
var
|
|
39508
|
+
var _internals55 = {
|
|
39462
39509
|
readLatestLoopState
|
|
39463
39510
|
};
|
|
39464
39511
|
var USAGE10 = `Usage: /swarm loop <objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]
|
|
@@ -39571,7 +39618,7 @@ ${USAGE10}`;
|
|
|
39571
39618
|
}
|
|
39572
39619
|
let autonomy = parsed.autonomy;
|
|
39573
39620
|
if (parsed.resume && !parsed.autonomyExplicit) {
|
|
39574
|
-
const state = await
|
|
39621
|
+
const state = await _internals55.readLatestLoopState(_directory);
|
|
39575
39622
|
if (state?.autonomy && AUTONOMY_LEVELS.has(state.autonomy)) {
|
|
39576
39623
|
autonomy = state.autonomy;
|
|
39577
39624
|
}
|
|
@@ -41053,6 +41100,7 @@ ${formatStatus2(directory)}`;
|
|
|
41053
41100
|
const fingerprint = computeMemoryCohortFingerprint(fingerprintInput);
|
|
41054
41101
|
await writeFile15(path74.join(cohortRoot.cohortRoot, "memory-cohort-config.json"), JSON.stringify({
|
|
41055
41102
|
fingerprint,
|
|
41103
|
+
algorithm_version: FINGERPRINT_ALGORITHM_VERSION,
|
|
41056
41104
|
config: fingerprintInput,
|
|
41057
41105
|
updated_at: new Date().toISOString()
|
|
41058
41106
|
}, null, 2), "utf-8");
|
|
@@ -41124,15 +41172,15 @@ async function handleMemoryUnlinkCommand(directory, args) {
|
|
|
41124
41172
|
}
|
|
41125
41173
|
|
|
41126
41174
|
// src/services/plan-service.ts
|
|
41127
|
-
var
|
|
41175
|
+
var _internals56 = {
|
|
41128
41176
|
loadPlanJsonOnly,
|
|
41129
41177
|
derivePlanMarkdown,
|
|
41130
41178
|
readSwarmFileAsync
|
|
41131
41179
|
};
|
|
41132
41180
|
async function getPlanData(directory, phaseArg) {
|
|
41133
|
-
const plan = await
|
|
41181
|
+
const plan = await _internals56.loadPlanJsonOnly(directory);
|
|
41134
41182
|
if (plan) {
|
|
41135
|
-
const fullMarkdown =
|
|
41183
|
+
const fullMarkdown = _internals56.derivePlanMarkdown(plan);
|
|
41136
41184
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
41137
41185
|
return {
|
|
41138
41186
|
hasPlan: true,
|
|
@@ -41175,7 +41223,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
41175
41223
|
isLegacy: false
|
|
41176
41224
|
};
|
|
41177
41225
|
}
|
|
41178
|
-
const planContent = await
|
|
41226
|
+
const planContent = await _internals56.readSwarmFileAsync(directory, "plan.md");
|
|
41179
41227
|
if (!planContent) {
|
|
41180
41228
|
return {
|
|
41181
41229
|
hasPlan: false,
|
|
@@ -41272,7 +41320,7 @@ async function handlePlanCommand(directory, args) {
|
|
|
41272
41320
|
return formatPlanMarkdown(planData);
|
|
41273
41321
|
}
|
|
41274
41322
|
// src/commands/post-mortem.ts
|
|
41275
|
-
var
|
|
41323
|
+
var _internals57 = {
|
|
41276
41324
|
createCuratorLLMDelegate,
|
|
41277
41325
|
runCuratorPostMortem
|
|
41278
41326
|
};
|
|
@@ -41320,10 +41368,10 @@ async function handlePostMortemCommand(directory, args, options) {
|
|
|
41320
41368
|
};
|
|
41321
41369
|
if (options?.sessionID) {
|
|
41322
41370
|
try {
|
|
41323
|
-
pmOptions.llmDelegate =
|
|
41371
|
+
pmOptions.llmDelegate = _internals57.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
|
|
41324
41372
|
} catch {}
|
|
41325
41373
|
}
|
|
41326
|
-
const result = await
|
|
41374
|
+
const result = await _internals57.runCuratorPostMortem(directory, pmOptions);
|
|
41327
41375
|
const lines = [];
|
|
41328
41376
|
if (result.success) {
|
|
41329
41377
|
lines.push("## Post-Mortem Report Generated");
|
|
@@ -41581,7 +41629,7 @@ function formatMergeGroupStatus(status, conclusion, htmlUrl) {
|
|
|
41581
41629
|
}
|
|
41582
41630
|
return parts.join(" ");
|
|
41583
41631
|
}
|
|
41584
|
-
var
|
|
41632
|
+
var _internals58 = {
|
|
41585
41633
|
formatRelativeTime,
|
|
41586
41634
|
formatMergeGroupStatus,
|
|
41587
41635
|
listActive,
|
|
@@ -41589,7 +41637,7 @@ var _internals57 = {
|
|
|
41589
41637
|
parseMergeGroupRuns
|
|
41590
41638
|
};
|
|
41591
41639
|
async function handlePrMonitorStatusCommand(directory, _args, sessionID, source) {
|
|
41592
|
-
const allActive = await
|
|
41640
|
+
const allActive = await _internals58.listActive(directory);
|
|
41593
41641
|
const allSessions = source === "cli";
|
|
41594
41642
|
const subs = allSessions ? allActive : allActive.filter((record) => record.sessionID === sessionID);
|
|
41595
41643
|
if (subs.length === 0) {
|
|
@@ -41605,7 +41653,7 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID, source)
|
|
|
41605
41653
|
const index = i + 1;
|
|
41606
41654
|
lines.push(` ${index}. ${sub.repoFullName}#${sub.prNumber}`);
|
|
41607
41655
|
lines.push(` URL: ${sub.prUrl}`);
|
|
41608
|
-
const mergeGroupRuns = await
|
|
41656
|
+
const mergeGroupRuns = await _internals58.listMergeGroupRuns(directory, sub.repoFullName, sub.prNumber);
|
|
41609
41657
|
if (mergeGroupRuns.runs.length > 0) {
|
|
41610
41658
|
lines.push(" Merge-group runs:");
|
|
41611
41659
|
for (const run of mergeGroupRuns.runs) {
|
|
@@ -41746,7 +41794,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
41746
41794
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
41747
41795
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
41748
41796
|
try {
|
|
41749
|
-
const config =
|
|
41797
|
+
const config = _internals59.loadPluginConfig(directory);
|
|
41750
41798
|
const prMonitorConfig = config.pr_monitor;
|
|
41751
41799
|
if (!prMonitorConfig?.enabled) {
|
|
41752
41800
|
return [
|
|
@@ -41756,7 +41804,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
41756
41804
|
].join(`
|
|
41757
41805
|
`);
|
|
41758
41806
|
}
|
|
41759
|
-
await
|
|
41807
|
+
await _internals59.subscribe(directory, {
|
|
41760
41808
|
sessionID,
|
|
41761
41809
|
prNumber: prInfo.number,
|
|
41762
41810
|
repoFullName,
|
|
@@ -41784,7 +41832,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
41784
41832
|
`);
|
|
41785
41833
|
}
|
|
41786
41834
|
}
|
|
41787
|
-
var
|
|
41835
|
+
var _internals59 = {
|
|
41788
41836
|
loadPluginConfig,
|
|
41789
41837
|
subscribe
|
|
41790
41838
|
};
|
|
@@ -41807,9 +41855,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
41807
41855
|
`);
|
|
41808
41856
|
}
|
|
41809
41857
|
const refToken = rest[0];
|
|
41810
|
-
const prInfo =
|
|
41858
|
+
const prInfo = _internals60.parsePrRef(refToken, directory);
|
|
41811
41859
|
if (!prInfo) {
|
|
41812
|
-
if (
|
|
41860
|
+
if (_internals60.looksLikePrRef(refToken)) {
|
|
41813
41861
|
return [
|
|
41814
41862
|
`Error: Could not resolve PR reference from "${refToken}".`,
|
|
41815
41863
|
"",
|
|
@@ -41830,8 +41878,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
41830
41878
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
41831
41879
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
41832
41880
|
try {
|
|
41833
|
-
const correlationId =
|
|
41834
|
-
const result = await
|
|
41881
|
+
const correlationId = _internals60.buildCorrelationId(sessionID, repoFullName, prInfo.number);
|
|
41882
|
+
const result = await _internals60.unsubscribe(directory, correlationId);
|
|
41835
41883
|
if (!result) {
|
|
41836
41884
|
return [
|
|
41837
41885
|
`Not subscribed to ${prUrl}`,
|
|
@@ -41858,7 +41906,7 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
41858
41906
|
`);
|
|
41859
41907
|
}
|
|
41860
41908
|
}
|
|
41861
|
-
var
|
|
41909
|
+
var _internals60 = {
|
|
41862
41910
|
unsubscribe,
|
|
41863
41911
|
buildCorrelationId,
|
|
41864
41912
|
parsePrRef,
|
|
@@ -42298,15 +42346,15 @@ var lint = createSwarmTool({
|
|
|
42298
42346
|
}
|
|
42299
42347
|
const { mode } = args;
|
|
42300
42348
|
const cwd = directory;
|
|
42301
|
-
const linter = await
|
|
42349
|
+
const linter = await _internals61.detectAvailableLinter(directory);
|
|
42302
42350
|
if (linter) {
|
|
42303
|
-
const result = await
|
|
42351
|
+
const result = await _internals61.runLint(linter, mode, directory);
|
|
42304
42352
|
return JSON.stringify(result, null, 2);
|
|
42305
42353
|
}
|
|
42306
|
-
const additionalLinter =
|
|
42354
|
+
const additionalLinter = _internals61.detectAdditionalLinter(cwd);
|
|
42307
42355
|
if (additionalLinter) {
|
|
42308
42356
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
42309
|
-
const result = await
|
|
42357
|
+
const result = await _internals61.runAdditionalLint(additionalLinter, mode, cwd);
|
|
42310
42358
|
return JSON.stringify(result, null, 2);
|
|
42311
42359
|
}
|
|
42312
42360
|
const errorResult = {
|
|
@@ -42320,7 +42368,7 @@ For Rust: rustup component add clippy`
|
|
|
42320
42368
|
return JSON.stringify(errorResult, null, 2);
|
|
42321
42369
|
}
|
|
42322
42370
|
});
|
|
42323
|
-
var
|
|
42371
|
+
var _internals61 = {
|
|
42324
42372
|
detectAvailableLinter,
|
|
42325
42373
|
runLint,
|
|
42326
42374
|
detectAdditionalLinter,
|
|
@@ -43009,7 +43057,7 @@ var secretscan = createSwarmTool({
|
|
|
43009
43057
|
});
|
|
43010
43058
|
async function runSecretscan(directory) {
|
|
43011
43059
|
try {
|
|
43012
|
-
const result = await
|
|
43060
|
+
const result = await _internals62.secretscan.execute({ directory }, {});
|
|
43013
43061
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
43014
43062
|
return JSON.parse(jsonStr);
|
|
43015
43063
|
} catch (e) {
|
|
@@ -43081,7 +43129,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
43081
43129
|
};
|
|
43082
43130
|
}
|
|
43083
43131
|
}
|
|
43084
|
-
var
|
|
43132
|
+
var _internals62 = {
|
|
43085
43133
|
secretscan,
|
|
43086
43134
|
runSecretscan,
|
|
43087
43135
|
runSecretscanOnFiles,
|
|
@@ -43357,7 +43405,7 @@ async function buildImpactMapInternal(cwd) {
|
|
|
43357
43405
|
}
|
|
43358
43406
|
return impactMap;
|
|
43359
43407
|
}
|
|
43360
|
-
var
|
|
43408
|
+
var _internals63 = {
|
|
43361
43409
|
validateProjectRoot,
|
|
43362
43410
|
normalizePath: normalizePath2,
|
|
43363
43411
|
isCacheStale,
|
|
@@ -43372,8 +43420,8 @@ var _internals62 = {
|
|
|
43372
43420
|
_clearGoModuleCache
|
|
43373
43421
|
};
|
|
43374
43422
|
async function buildImpactMap(cwd) {
|
|
43375
|
-
const impactMap = await
|
|
43376
|
-
await
|
|
43423
|
+
const impactMap = await _internals63.buildImpactMapInternal(cwd);
|
|
43424
|
+
await _internals63.saveImpactMap(cwd, impactMap);
|
|
43377
43425
|
return impactMap;
|
|
43378
43426
|
}
|
|
43379
43427
|
async function loadImpactMap(cwd, options) {
|
|
@@ -43387,7 +43435,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
43387
43435
|
const hasValidValues = Object.values(map).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
43388
43436
|
if (hasValidValues) {
|
|
43389
43437
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
43390
|
-
if (!
|
|
43438
|
+
if (!_internals63.isCacheStale(map, generatedAt)) {
|
|
43391
43439
|
return map;
|
|
43392
43440
|
}
|
|
43393
43441
|
if (options?.skipRebuild) {
|
|
@@ -43407,13 +43455,13 @@ async function loadImpactMap(cwd, options) {
|
|
|
43407
43455
|
if (options?.skipRebuild) {
|
|
43408
43456
|
return {};
|
|
43409
43457
|
}
|
|
43410
|
-
return
|
|
43458
|
+
return _internals63.buildImpactMap(cwd);
|
|
43411
43459
|
}
|
|
43412
43460
|
async function saveImpactMap(cwd, impactMap) {
|
|
43413
43461
|
if (!path77.isAbsolute(cwd)) {
|
|
43414
43462
|
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
43415
43463
|
}
|
|
43416
|
-
|
|
43464
|
+
_internals63.validateProjectRoot(cwd);
|
|
43417
43465
|
const cacheDir2 = path77.join(cwd, ".swarm", "cache");
|
|
43418
43466
|
const cachePath = path77.join(cacheDir2, "impact-map.json");
|
|
43419
43467
|
if (!fs32.existsSync(cacheDir2)) {
|
|
@@ -43437,7 +43485,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
43437
43485
|
};
|
|
43438
43486
|
}
|
|
43439
43487
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
43440
|
-
const impactMap = await
|
|
43488
|
+
const impactMap = await _internals63.loadImpactMap(cwd);
|
|
43441
43489
|
const impactedTestsSet = new Set;
|
|
43442
43490
|
const untestedFiles = [];
|
|
43443
43491
|
let visitedCount = 0;
|
|
@@ -43714,7 +43762,7 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
43714
43762
|
}
|
|
43715
43763
|
const historyPath = getHistoryPath(workingDir);
|
|
43716
43764
|
const historyDir = path78.dirname(historyPath);
|
|
43717
|
-
|
|
43765
|
+
_internals64.validateProjectRoot(workingDir);
|
|
43718
43766
|
if (!fs33.existsSync(historyDir)) {
|
|
43719
43767
|
fs33.mkdirSync(historyDir, { recursive: true });
|
|
43720
43768
|
}
|
|
@@ -43837,7 +43885,7 @@ function getAllHistory(workingDir) {
|
|
|
43837
43885
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
43838
43886
|
return records;
|
|
43839
43887
|
}
|
|
43840
|
-
var
|
|
43888
|
+
var _internals64 = {
|
|
43841
43889
|
validateProjectRoot
|
|
43842
43890
|
};
|
|
43843
43891
|
|
|
@@ -43929,7 +43977,7 @@ var MAX_SAFE_TEST_FILES = 50;
|
|
|
43929
43977
|
var MAX_SAFE_SOURCE_FILES = 1;
|
|
43930
43978
|
async function estimateFanOut(sourceFiles, cwd) {
|
|
43931
43979
|
try {
|
|
43932
|
-
const impactMap = await
|
|
43980
|
+
const impactMap = await _internals65.loadImpactMap(cwd, {
|
|
43933
43981
|
skipRebuild: true
|
|
43934
43982
|
});
|
|
43935
43983
|
const uniqueTestFiles = new Set;
|
|
@@ -44019,45 +44067,45 @@ function hasDevDependency(devDeps, ...patterns) {
|
|
|
44019
44067
|
return hasPackageJsonDependency(devDeps, ...patterns);
|
|
44020
44068
|
}
|
|
44021
44069
|
function detectGoTest(cwd) {
|
|
44022
|
-
return
|
|
44070
|
+
return _internals65.existsSync(path80.join(cwd, "go.mod")) && _internals65.isCommandAvailable("go");
|
|
44023
44071
|
}
|
|
44024
44072
|
function detectJavaMaven(cwd) {
|
|
44025
|
-
return
|
|
44073
|
+
return _internals65.existsSync(path80.join(cwd, "pom.xml")) && _internals65.isCommandAvailable("mvn");
|
|
44026
44074
|
}
|
|
44027
44075
|
function detectGradle(cwd) {
|
|
44028
|
-
const hasBuildFile =
|
|
44029
|
-
const hasGradlew =
|
|
44030
|
-
return hasBuildFile && (hasGradlew ||
|
|
44076
|
+
const hasBuildFile = _internals65.existsSync(path80.join(cwd, "build.gradle")) || _internals65.existsSync(path80.join(cwd, "build.gradle.kts"));
|
|
44077
|
+
const hasGradlew = _internals65.existsSync(path80.join(cwd, "gradlew")) || _internals65.existsSync(path80.join(cwd, "gradlew.bat"));
|
|
44078
|
+
return hasBuildFile && (hasGradlew || _internals65.isCommandAvailable("gradle"));
|
|
44031
44079
|
}
|
|
44032
44080
|
function detectDotnetTest(cwd) {
|
|
44033
44081
|
try {
|
|
44034
|
-
const files =
|
|
44082
|
+
const files = _internals65.readdirSync(cwd);
|
|
44035
44083
|
const hasCsproj = files.some((f) => f.endsWith(".csproj"));
|
|
44036
|
-
return hasCsproj &&
|
|
44084
|
+
return hasCsproj && _internals65.isCommandAvailable("dotnet");
|
|
44037
44085
|
} catch {
|
|
44038
44086
|
return false;
|
|
44039
44087
|
}
|
|
44040
44088
|
}
|
|
44041
44089
|
function detectCTest(cwd) {
|
|
44042
|
-
const hasSource =
|
|
44043
|
-
const hasBuildCache =
|
|
44044
|
-
return (hasSource || hasBuildCache) &&
|
|
44090
|
+
const hasSource = _internals65.existsSync(path80.join(cwd, "CMakeLists.txt"));
|
|
44091
|
+
const hasBuildCache = _internals65.existsSync(path80.join(cwd, "CMakeCache.txt")) || _internals65.existsSync(path80.join(cwd, "build", "CMakeCache.txt"));
|
|
44092
|
+
return (hasSource || hasBuildCache) && _internals65.isCommandAvailable("ctest");
|
|
44045
44093
|
}
|
|
44046
44094
|
function detectSwiftTest(cwd) {
|
|
44047
|
-
return
|
|
44095
|
+
return _internals65.existsSync(path80.join(cwd, "Package.swift")) && _internals65.isCommandAvailable("swift");
|
|
44048
44096
|
}
|
|
44049
44097
|
function detectDartTest(cwd) {
|
|
44050
|
-
return
|
|
44098
|
+
return _internals65.existsSync(path80.join(cwd, "pubspec.yaml")) && (_internals65.isCommandAvailable("dart") || _internals65.isCommandAvailable("flutter"));
|
|
44051
44099
|
}
|
|
44052
44100
|
function detectRSpec(cwd) {
|
|
44053
|
-
const hasRSpecFile =
|
|
44054
|
-
const hasGemfile =
|
|
44055
|
-
const hasSpecDir =
|
|
44101
|
+
const hasRSpecFile = _internals65.existsSync(path80.join(cwd, ".rspec"));
|
|
44102
|
+
const hasGemfile = _internals65.existsSync(path80.join(cwd, "Gemfile"));
|
|
44103
|
+
const hasSpecDir = _internals65.existsSync(path80.join(cwd, "spec"));
|
|
44056
44104
|
const hasRSpec = hasRSpecFile || hasGemfile && hasSpecDir;
|
|
44057
|
-
return hasRSpec && (
|
|
44105
|
+
return hasRSpec && (_internals65.isCommandAvailable("bundle") || _internals65.isCommandAvailable("rspec"));
|
|
44058
44106
|
}
|
|
44059
44107
|
function detectMinitest(cwd) {
|
|
44060
|
-
return
|
|
44108
|
+
return _internals65.existsSync(path80.join(cwd, "test")) && (_internals65.existsSync(path80.join(cwd, "Gemfile")) || _internals65.existsSync(path80.join(cwd, "Rakefile"))) && _internals65.isCommandAvailable("ruby");
|
|
44061
44109
|
}
|
|
44062
44110
|
var DISPATCH_FRAMEWORK_MAP = {
|
|
44063
44111
|
bun: "bun",
|
|
@@ -44148,8 +44196,8 @@ async function detectTestFramework(cwd) {
|
|
|
44148
44196
|
const baseDir = cwd;
|
|
44149
44197
|
try {
|
|
44150
44198
|
const packageJsonPath = path80.join(baseDir, "package.json");
|
|
44151
|
-
if (
|
|
44152
|
-
const content =
|
|
44199
|
+
if (_internals65.existsSync(packageJsonPath)) {
|
|
44200
|
+
const content = _internals65.readFileSync(packageJsonPath, "utf-8");
|
|
44153
44201
|
const pkg = JSON.parse(content);
|
|
44154
44202
|
const _deps = pkg.dependencies || {};
|
|
44155
44203
|
const devDeps = pkg.devDependencies || {};
|
|
@@ -44168,7 +44216,7 @@ async function detectTestFramework(cwd) {
|
|
|
44168
44216
|
return "jest";
|
|
44169
44217
|
if (hasDevDependency(devDeps, "mocha", "@types/mocha"))
|
|
44170
44218
|
return "mocha";
|
|
44171
|
-
if (
|
|
44219
|
+
if (_internals65.existsSync(path80.join(baseDir, "bun.lockb")) || _internals65.existsSync(path80.join(baseDir, "bun.lock"))) {
|
|
44172
44220
|
if (scripts.test?.includes("bun"))
|
|
44173
44221
|
return "bun";
|
|
44174
44222
|
}
|
|
@@ -44178,28 +44226,28 @@ async function detectTestFramework(cwd) {
|
|
|
44178
44226
|
const pyprojectTomlPath = path80.join(baseDir, "pyproject.toml");
|
|
44179
44227
|
const setupCfgPath = path80.join(baseDir, "setup.cfg");
|
|
44180
44228
|
const requirementsTxtPath = path80.join(baseDir, "requirements.txt");
|
|
44181
|
-
if (
|
|
44182
|
-
const content =
|
|
44229
|
+
if (_internals65.existsSync(pyprojectTomlPath)) {
|
|
44230
|
+
const content = _internals65.readFileSync(pyprojectTomlPath, "utf-8");
|
|
44183
44231
|
if (content.includes("[tool.pytest"))
|
|
44184
44232
|
return "pytest";
|
|
44185
44233
|
if (content.includes("pytest"))
|
|
44186
44234
|
return "pytest";
|
|
44187
44235
|
}
|
|
44188
|
-
if (
|
|
44189
|
-
const content =
|
|
44236
|
+
if (_internals65.existsSync(setupCfgPath)) {
|
|
44237
|
+
const content = _internals65.readFileSync(setupCfgPath, "utf-8");
|
|
44190
44238
|
if (content.includes("[pytest]"))
|
|
44191
44239
|
return "pytest";
|
|
44192
44240
|
}
|
|
44193
|
-
if (
|
|
44194
|
-
const content =
|
|
44241
|
+
if (_internals65.existsSync(requirementsTxtPath)) {
|
|
44242
|
+
const content = _internals65.readFileSync(requirementsTxtPath, "utf-8");
|
|
44195
44243
|
if (content.includes("pytest"))
|
|
44196
44244
|
return "pytest";
|
|
44197
44245
|
}
|
|
44198
44246
|
} catch {}
|
|
44199
44247
|
try {
|
|
44200
44248
|
const cargoTomlPath = path80.join(baseDir, "Cargo.toml");
|
|
44201
|
-
if (
|
|
44202
|
-
const content =
|
|
44249
|
+
if (_internals65.existsSync(cargoTomlPath)) {
|
|
44250
|
+
const content = _internals65.readFileSync(cargoTomlPath, "utf-8");
|
|
44203
44251
|
if (content.includes("[dev-dependencies]")) {
|
|
44204
44252
|
if (content.includes("tokio") || content.includes("mockall") || content.includes("pretty_assertions")) {
|
|
44205
44253
|
return "cargo";
|
|
@@ -44211,7 +44259,7 @@ async function detectTestFramework(cwd) {
|
|
|
44211
44259
|
const pesterConfigPath = path80.join(baseDir, "pester.config.ps1");
|
|
44212
44260
|
const pesterConfigJsonPath = path80.join(baseDir, "pester.config.ps1.json");
|
|
44213
44261
|
const pesterPs1Path = path80.join(baseDir, "tests.ps1");
|
|
44214
|
-
if (
|
|
44262
|
+
if (_internals65.existsSync(pesterConfigPath) || _internals65.existsSync(pesterConfigJsonPath) || _internals65.existsSync(pesterPs1Path)) {
|
|
44215
44263
|
return "pester";
|
|
44216
44264
|
}
|
|
44217
44265
|
} catch {}
|
|
@@ -44239,12 +44287,12 @@ async function detectTestFramework(cwd) {
|
|
|
44239
44287
|
return "none";
|
|
44240
44288
|
}
|
|
44241
44289
|
function detectPhpTest(cwd) {
|
|
44242
|
-
if (
|
|
44290
|
+
if (_internals65.existsSync(path80.join(cwd, "artisan")) && _internals65.existsSync(path80.join(cwd, "composer.json"))) {
|
|
44243
44291
|
return "php-artisan";
|
|
44244
44292
|
}
|
|
44245
|
-
if (
|
|
44293
|
+
if (_internals65.existsSync(path80.join(cwd, "Pest.php")))
|
|
44246
44294
|
return "pest";
|
|
44247
|
-
if (
|
|
44295
|
+
if (_internals65.existsSync(path80.join(cwd, "phpunit.xml")) || _internals65.existsSync(path80.join(cwd, "phpunit.xml.dist"))) {
|
|
44248
44296
|
return "phpunit";
|
|
44249
44297
|
}
|
|
44250
44298
|
return null;
|
|
@@ -44626,9 +44674,9 @@ function buildTestCommand(framework, scope, files, coverage, baseDir, bail) {
|
|
|
44626
44674
|
case "swift-test":
|
|
44627
44675
|
return ["swift", "test"];
|
|
44628
44676
|
case "dart-test":
|
|
44629
|
-
return
|
|
44677
|
+
return _internals65.isCommandAvailable("flutter") ? ["flutter", "test", ...files] : ["dart", "test", ...files];
|
|
44630
44678
|
case "rspec": {
|
|
44631
|
-
const args =
|
|
44679
|
+
const args = _internals65.isCommandAvailable("bundle") ? ["bundle", "exec", "rspec"] : ["rspec"];
|
|
44632
44680
|
if (bail)
|
|
44633
44681
|
args.push("--fail-fast");
|
|
44634
44682
|
if (scope !== "all" && files.length > 0) {
|
|
@@ -45641,7 +45689,7 @@ var test_runner = createSwarmTool({
|
|
|
45641
45689
|
return JSON.stringify(errorResult, null, 2);
|
|
45642
45690
|
}
|
|
45643
45691
|
try {
|
|
45644
|
-
const impactResult = await
|
|
45692
|
+
const impactResult = await _internals65.analyzeImpact(sourceFiles, workingDir, MAX_SAFE_TEST_FILES);
|
|
45645
45693
|
if (impactResult.budgetExceeded) {
|
|
45646
45694
|
const errorResult = {
|
|
45647
45695
|
success: false,
|
|
@@ -45731,7 +45779,7 @@ var test_runner = createSwarmTool({
|
|
|
45731
45779
|
return JSON.stringify(result, null, 2);
|
|
45732
45780
|
}
|
|
45733
45781
|
});
|
|
45734
|
-
var
|
|
45782
|
+
var _internals65 = {
|
|
45735
45783
|
analyzeImpact,
|
|
45736
45784
|
loadImpactMap,
|
|
45737
45785
|
isCommandAvailable,
|
|
@@ -45826,9 +45874,9 @@ function getVersionFileVersion(dir) {
|
|
|
45826
45874
|
async function runVersionCheck(dir, _timeoutMs) {
|
|
45827
45875
|
const startTime = Date.now();
|
|
45828
45876
|
try {
|
|
45829
|
-
const packageVersion =
|
|
45830
|
-
const changelogVersion =
|
|
45831
|
-
const versionFileVersion =
|
|
45877
|
+
const packageVersion = _internals66.getPackageVersion(dir);
|
|
45878
|
+
const changelogVersion = _internals66.getChangelogVersion(dir);
|
|
45879
|
+
const versionFileVersion = _internals66.getVersionFileVersion(dir);
|
|
45832
45880
|
const versions = [];
|
|
45833
45881
|
if (packageVersion)
|
|
45834
45882
|
versions.push(`package.json: ${packageVersion}`);
|
|
@@ -46192,7 +46240,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
46192
46240
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
46193
46241
|
let validatedDir;
|
|
46194
46242
|
try {
|
|
46195
|
-
validatedDir =
|
|
46243
|
+
validatedDir = _internals66.validateDirectoryPath(dir);
|
|
46196
46244
|
} catch (error2) {
|
|
46197
46245
|
return {
|
|
46198
46246
|
id: reportId,
|
|
@@ -46212,7 +46260,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
46212
46260
|
}
|
|
46213
46261
|
let validatedTimeout;
|
|
46214
46262
|
try {
|
|
46215
|
-
validatedTimeout =
|
|
46263
|
+
validatedTimeout = _internals66.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
46216
46264
|
} catch (error2) {
|
|
46217
46265
|
return {
|
|
46218
46266
|
id: reportId,
|
|
@@ -46253,12 +46301,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
46253
46301
|
});
|
|
46254
46302
|
const checks = [];
|
|
46255
46303
|
log("[Preflight] Running lint check...");
|
|
46256
|
-
const lintResult = await
|
|
46304
|
+
const lintResult = await _internals66.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
46257
46305
|
checks.push(lintResult);
|
|
46258
46306
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
46259
46307
|
if (!cfg.skipTests) {
|
|
46260
46308
|
log("[Preflight] Running tests check...");
|
|
46261
|
-
const testsResult = await
|
|
46309
|
+
const testsResult = await _internals66.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
46262
46310
|
checks.push(testsResult);
|
|
46263
46311
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
46264
46312
|
} else {
|
|
@@ -46270,7 +46318,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
46270
46318
|
}
|
|
46271
46319
|
if (!cfg.skipSecrets) {
|
|
46272
46320
|
log("[Preflight] Running secrets check...");
|
|
46273
|
-
const secretsResult = await
|
|
46321
|
+
const secretsResult = await _internals66.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
46274
46322
|
checks.push(secretsResult);
|
|
46275
46323
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
46276
46324
|
} else {
|
|
@@ -46282,7 +46330,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
46282
46330
|
}
|
|
46283
46331
|
if (!cfg.skipEvidence) {
|
|
46284
46332
|
log("[Preflight] Running evidence check...");
|
|
46285
|
-
const evidenceResult = await
|
|
46333
|
+
const evidenceResult = await _internals66.runEvidenceCheck(validatedDir);
|
|
46286
46334
|
checks.push(evidenceResult);
|
|
46287
46335
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
46288
46336
|
} else {
|
|
@@ -46293,12 +46341,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
46293
46341
|
});
|
|
46294
46342
|
}
|
|
46295
46343
|
log("[Preflight] Running requirement coverage check...");
|
|
46296
|
-
const reqCoverageResult = await
|
|
46344
|
+
const reqCoverageResult = await _internals66.runRequirementCoverageCheck(validatedDir, phase);
|
|
46297
46345
|
checks.push(reqCoverageResult);
|
|
46298
46346
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
46299
46347
|
if (!cfg.skipVersion) {
|
|
46300
46348
|
log("[Preflight] Running version check...");
|
|
46301
|
-
const versionResult = await
|
|
46349
|
+
const versionResult = await _internals66.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
46302
46350
|
checks.push(versionResult);
|
|
46303
46351
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
46304
46352
|
} else {
|
|
@@ -46361,10 +46409,10 @@ function formatPreflightMarkdown(report) {
|
|
|
46361
46409
|
async function handlePreflightCommand(directory, _args) {
|
|
46362
46410
|
const plan = await loadPlan(directory);
|
|
46363
46411
|
const phase = plan?.current_phase ?? 1;
|
|
46364
|
-
const report = await
|
|
46365
|
-
return
|
|
46412
|
+
const report = await _internals66.runPreflight(directory, phase);
|
|
46413
|
+
return _internals66.formatPreflightMarkdown(report);
|
|
46366
46414
|
}
|
|
46367
|
-
var
|
|
46415
|
+
var _internals66 = {
|
|
46368
46416
|
runPreflight,
|
|
46369
46417
|
formatPreflightMarkdown,
|
|
46370
46418
|
handlePreflightCommand,
|
|
@@ -47357,7 +47405,7 @@ function pruneOldResetBackups(backupsRoot, warnings) {
|
|
|
47357
47405
|
}
|
|
47358
47406
|
|
|
47359
47407
|
// src/commands/reset.ts
|
|
47360
|
-
var
|
|
47408
|
+
var _internals67 = {
|
|
47361
47409
|
backupSwarmStateBeforeReset
|
|
47362
47410
|
};
|
|
47363
47411
|
async function handleResetCommand(directory, args) {
|
|
@@ -47391,7 +47439,7 @@ async function handleResetCommand(directory, args) {
|
|
|
47391
47439
|
];
|
|
47392
47440
|
const results = [];
|
|
47393
47441
|
try {
|
|
47394
|
-
const backup =
|
|
47442
|
+
const backup = _internals67.backupSwarmStateBeforeReset(directory, "reset", [
|
|
47395
47443
|
...filesToReset,
|
|
47396
47444
|
"summaries"
|
|
47397
47445
|
]);
|
|
@@ -47943,7 +47991,7 @@ async function recordReplayEntry(artifactPath, sessionID, entry) {
|
|
|
47943
47991
|
}
|
|
47944
47992
|
|
|
47945
47993
|
// src/prm/index.ts
|
|
47946
|
-
var
|
|
47994
|
+
var _internals68 = {
|
|
47947
47995
|
getAgentSession,
|
|
47948
47996
|
readTrajectory,
|
|
47949
47997
|
getInMemoryTrajectory,
|
|
@@ -47971,12 +48019,12 @@ function resetPrmSessionState(session, sessionId) {
|
|
|
47971
48019
|
session.prmInjectedAdvisoryKeys = new Set;
|
|
47972
48020
|
session.replayArtifactPath = null;
|
|
47973
48021
|
if (sessionId) {
|
|
47974
|
-
|
|
48022
|
+
_internals68.clearTrajectoryCache(sessionId);
|
|
47975
48023
|
}
|
|
47976
48024
|
}
|
|
47977
48025
|
|
|
47978
48026
|
// src/commands/reset-session.ts
|
|
47979
|
-
var
|
|
48027
|
+
var _internals69 = {
|
|
47980
48028
|
cleanupOrphanedBranches,
|
|
47981
48029
|
backupSwarmStateBeforeReset
|
|
47982
48030
|
};
|
|
@@ -47988,7 +48036,7 @@ function errorMessage(err) {
|
|
|
47988
48036
|
async function handleResetSessionCommand(directory, _args) {
|
|
47989
48037
|
const results = [];
|
|
47990
48038
|
try {
|
|
47991
|
-
const backup =
|
|
48039
|
+
const backup = _internals69.backupSwarmStateBeforeReset(directory, "reset-session", ["session"]);
|
|
47992
48040
|
if (backup.backupDir && backup.copied.length > 0) {
|
|
47993
48041
|
const rel = path85.relative(directory, backup.backupDir);
|
|
47994
48042
|
results.push(`\uD83D\uDCE6 Backed up session state to ${rel}/ (restore by copying files back into .swarm/session/)`);
|
|
@@ -48055,7 +48103,7 @@ async function handleResetSessionCommand(directory, _args) {
|
|
|
48055
48103
|
results.push(`\u26A0\uFE0F Failed to remove .swarm-worktrees/: ${errorMessage(err)}`);
|
|
48056
48104
|
}
|
|
48057
48105
|
try {
|
|
48058
|
-
const branchResult = await
|
|
48106
|
+
const branchResult = await _internals69.cleanupOrphanedBranches(directory, []);
|
|
48059
48107
|
if (branchResult.removed.length > 0) {
|
|
48060
48108
|
results.push(`\u2705 Removed ${branchResult.removed.length} orphan swarm-lane branch(es)`);
|
|
48061
48109
|
}
|
|
@@ -48214,7 +48262,7 @@ function resolveReceiptsDir(directory) {
|
|
|
48214
48262
|
function resolveReceiptIndexPath(directory) {
|
|
48215
48263
|
return path87.join(resolveReceiptsDir(directory), "index.json");
|
|
48216
48264
|
}
|
|
48217
|
-
var
|
|
48265
|
+
var _internals70 = {
|
|
48218
48266
|
openSync: fs41.openSync,
|
|
48219
48267
|
lstatBigIntSync: (path88) => fs41.lstatSync(path88, { bigint: true }),
|
|
48220
48268
|
fstatBigIntSync: (fd) => fs41.fstatSync(fd, { bigint: true })
|
|
@@ -48226,7 +48274,7 @@ function pathsEqual(left, right) {
|
|
|
48226
48274
|
}
|
|
48227
48275
|
function captureCanonicalDirectory(directory, label, expected) {
|
|
48228
48276
|
const resolved = path87.resolve(directory);
|
|
48229
|
-
const stat6 =
|
|
48277
|
+
const stat6 = _internals70.lstatBigIntSync(resolved);
|
|
48230
48278
|
if (!stat6.isDirectory() || stat6.isSymbolicLink()) {
|
|
48231
48279
|
throw new Error(`${label} must be a real directory`);
|
|
48232
48280
|
}
|
|
@@ -48312,7 +48360,7 @@ function assertDirectReceiptFile(context, filePath, mustExist) {
|
|
|
48312
48360
|
throw new Error("review receipt file escapes its expected directory");
|
|
48313
48361
|
}
|
|
48314
48362
|
try {
|
|
48315
|
-
const stat6 =
|
|
48363
|
+
const stat6 = _internals70.lstatBigIntSync(resolved);
|
|
48316
48364
|
if (!stat6.isFile() || stat6.isSymbolicLink()) {
|
|
48317
48365
|
throw new Error("review receipt path must be a real file");
|
|
48318
48366
|
}
|
|
@@ -48336,7 +48384,7 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
48336
48384
|
const resolved = assertDirectReceiptFile(context, receiptPath, true);
|
|
48337
48385
|
if (path87.extname(resolved) !== ".json")
|
|
48338
48386
|
return null;
|
|
48339
|
-
const pathBeforeOpen =
|
|
48387
|
+
const pathBeforeOpen = _internals70.lstatBigIntSync(resolved);
|
|
48340
48388
|
if (!pathBeforeOpen.isFile() || pathBeforeOpen.isSymbolicLink() || pathBeforeOpen.size < 0n || pathBeforeOpen.size > BigInt(maxBytes)) {
|
|
48341
48389
|
return null;
|
|
48342
48390
|
}
|
|
@@ -48344,10 +48392,10 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
48344
48392
|
if (!pathsEqual(canonicalBeforeOpen, resolved))
|
|
48345
48393
|
return null;
|
|
48346
48394
|
assertReceiptContextCurrent(context);
|
|
48347
|
-
descriptor =
|
|
48348
|
-
const openedBeforeRead =
|
|
48395
|
+
descriptor = _internals70.openSync(canonicalBeforeOpen, "r");
|
|
48396
|
+
const openedBeforeRead = _internals70.fstatBigIntSync(descriptor);
|
|
48349
48397
|
assertReceiptContextCurrent(context);
|
|
48350
|
-
const pathAfterOpen =
|
|
48398
|
+
const pathAfterOpen = _internals70.lstatBigIntSync(resolved);
|
|
48351
48399
|
const canonicalAfterOpen = fs41.realpathSync(resolved);
|
|
48352
48400
|
if (!openedBeforeRead.isFile() || openedBeforeRead.size < 0n || openedBeforeRead.size > BigInt(maxBytes) || !sameFileSnapshot2(pathBeforeOpen, openedBeforeRead) || !sameFileSnapshot2(openedBeforeRead, pathAfterOpen) || !pathsEqual(canonicalBeforeOpen, canonicalAfterOpen)) {
|
|
48353
48401
|
return null;
|
|
@@ -48360,9 +48408,9 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
48360
48408
|
break;
|
|
48361
48409
|
bytesRead += count;
|
|
48362
48410
|
}
|
|
48363
|
-
const openedAfterRead =
|
|
48411
|
+
const openedAfterRead = _internals70.fstatBigIntSync(descriptor);
|
|
48364
48412
|
assertReceiptContextCurrent(context);
|
|
48365
|
-
const pathAfterRead =
|
|
48413
|
+
const pathAfterRead = _internals70.lstatBigIntSync(resolved);
|
|
48366
48414
|
const canonicalAfterRead = fs41.realpathSync(resolved);
|
|
48367
48415
|
if (bytesRead !== buffer.length || !sameFileSnapshot2(openedBeforeRead, openedAfterRead) || !sameFileSnapshot2(openedAfterRead, pathAfterRead) || !pathsEqual(canonicalBeforeOpen, canonicalAfterRead)) {
|
|
48368
48416
|
return null;
|
|
@@ -48906,7 +48954,7 @@ var HEAD_TIMEOUT_MS = 5000;
|
|
|
48906
48954
|
var HEAD_OUTPUT_BYTES = 256;
|
|
48907
48955
|
var HEAD_SHA_PATTERN = /^[0-9a-f]{40,64}$/i;
|
|
48908
48956
|
var REVIEWER_TASK_SCOPE_DESCRIPTION = "reviewer-task-files-v1";
|
|
48909
|
-
var
|
|
48957
|
+
var _internals71 = {
|
|
48910
48958
|
spawn: child_process8.spawn,
|
|
48911
48959
|
realpath: fs42.promises.realpath,
|
|
48912
48960
|
lstatBigInt: (path89) => fs42.promises.lstat(path89, { bigint: true }),
|
|
@@ -48946,7 +48994,7 @@ async function missingPathParentIsContained(root, absolutePath2) {
|
|
|
48946
48994
|
let current = path88.dirname(absolutePath2);
|
|
48947
48995
|
for (;; ) {
|
|
48948
48996
|
try {
|
|
48949
|
-
const canonical = await
|
|
48997
|
+
const canonical = await _internals71.realpath(current);
|
|
48950
48998
|
return samePath2(root, canonical) || isContained2(root, canonical);
|
|
48951
48999
|
} catch (error2) {
|
|
48952
49000
|
if (error2.code !== "ENOENT")
|
|
@@ -48973,7 +49021,7 @@ async function resolveHeadSha(directory) {
|
|
|
48973
49021
|
let child;
|
|
48974
49022
|
let timeoutHandle;
|
|
48975
49023
|
try {
|
|
48976
|
-
child =
|
|
49024
|
+
child = _internals71.spawn("git", ["rev-parse", "--verify", "HEAD"], {
|
|
48977
49025
|
cwd: directory,
|
|
48978
49026
|
stdio: ["ignore", "pipe", "ignore"],
|
|
48979
49027
|
timeout: HEAD_TIMEOUT_MS,
|
|
@@ -49036,7 +49084,7 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
49036
49084
|
let realRoot;
|
|
49037
49085
|
try {
|
|
49038
49086
|
lexicalRoot = path88.resolve(directory);
|
|
49039
|
-
realRoot = await
|
|
49087
|
+
realRoot = await _internals71.realpath(lexicalRoot);
|
|
49040
49088
|
} catch {
|
|
49041
49089
|
return null;
|
|
49042
49090
|
}
|
|
@@ -49077,7 +49125,7 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
49077
49125
|
for (const candidate of ordered) {
|
|
49078
49126
|
let before;
|
|
49079
49127
|
try {
|
|
49080
|
-
before = await
|
|
49128
|
+
before = await _internals71.lstatBigInt(candidate.absolutePath);
|
|
49081
49129
|
} catch (error2) {
|
|
49082
49130
|
if (error2.code === "ENOENT") {
|
|
49083
49131
|
if (!await missingPathParentIsContained(realRoot, candidate.absolutePath)) {
|
|
@@ -49096,7 +49144,7 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
49096
49144
|
return null;
|
|
49097
49145
|
let realCandidate;
|
|
49098
49146
|
try {
|
|
49099
|
-
realCandidate = await
|
|
49147
|
+
realCandidate = await _internals71.realpath(candidate.absolutePath);
|
|
49100
49148
|
} catch {
|
|
49101
49149
|
return null;
|
|
49102
49150
|
}
|
|
@@ -49108,15 +49156,15 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
49108
49156
|
let bytes;
|
|
49109
49157
|
let openedBefore;
|
|
49110
49158
|
try {
|
|
49111
|
-
handle = await
|
|
49112
|
-
openedBefore = await
|
|
49113
|
-
const canonicalAfterOpen = await
|
|
49159
|
+
handle = await _internals71.open(realCandidate, "r");
|
|
49160
|
+
openedBefore = await _internals71.fileHandleStatBigInt(handle);
|
|
49161
|
+
const canonicalAfterOpen = await _internals71.realpath(candidate.absolutePath);
|
|
49114
49162
|
if (!openedBefore.isFile() || !sameFileSnapshot3(before, openedBefore) || !samePath2(realCandidate, canonicalAfterOpen) || !isContained2(realRoot, canonicalAfterOpen)) {
|
|
49115
49163
|
return null;
|
|
49116
49164
|
}
|
|
49117
49165
|
bytes = await readBoundedHandle(handle, maxBytes - totalBytes);
|
|
49118
|
-
const openedAfter = await
|
|
49119
|
-
const canonicalAfterRead = await
|
|
49166
|
+
const openedAfter = await _internals71.fileHandleStatBigInt(handle);
|
|
49167
|
+
const canonicalAfterRead = await _internals71.realpath(candidate.absolutePath);
|
|
49120
49168
|
if (!sameFileSnapshot3(openedBefore, openedAfter) || !samePath2(realCandidate, canonicalAfterRead) || !isContained2(realRoot, canonicalAfterRead) || BigInt(bytes.byteLength) !== openedBefore.size) {
|
|
49121
49169
|
return null;
|
|
49122
49170
|
}
|
|
@@ -49140,8 +49188,8 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
49140
49188
|
}
|
|
49141
49189
|
for (const stable of stableFiles) {
|
|
49142
49190
|
try {
|
|
49143
|
-
const current = await
|
|
49144
|
-
const canonical = await
|
|
49191
|
+
const current = await _internals71.lstatBigInt(stable.absolutePath);
|
|
49192
|
+
const canonical = await _internals71.realpath(stable.absolutePath);
|
|
49145
49193
|
if (!current.isFile() || current.isSymbolicLink() || !sameFileSnapshot3(stable.stat, current) || !samePath2(stable.canonicalPath, canonical) || !isContained2(realRoot, canonical)) {
|
|
49146
49194
|
return null;
|
|
49147
49195
|
}
|
|
@@ -49151,7 +49199,7 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
49151
49199
|
}
|
|
49152
49200
|
for (const deletedPath of deletedPaths) {
|
|
49153
49201
|
try {
|
|
49154
|
-
await
|
|
49202
|
+
await _internals71.lstatBigInt(deletedPath);
|
|
49155
49203
|
return null;
|
|
49156
49204
|
} catch (error2) {
|
|
49157
49205
|
if (error2.code !== "ENOENT" || !await missingPathParentIsContained(realRoot, deletedPath)) {
|
|
@@ -49314,7 +49362,7 @@ function parseReviewerOutput(text, options = {}) {
|
|
|
49314
49362
|
outputMode: "legacy"
|
|
49315
49363
|
};
|
|
49316
49364
|
}
|
|
49317
|
-
var
|
|
49365
|
+
var _internals72 = {
|
|
49318
49366
|
delegationEnd: telemetry.delegationEnd,
|
|
49319
49367
|
resolveReviewerTaskScope,
|
|
49320
49368
|
buildReviewerTaskScope,
|
|
@@ -49519,7 +49567,7 @@ function scopeFreshnessMismatches(reviewed, current) {
|
|
|
49519
49567
|
}
|
|
49520
49568
|
function createScopeVerifier(input, reviewed, maxBytes) {
|
|
49521
49569
|
return async () => {
|
|
49522
|
-
const current = await
|
|
49570
|
+
const current = await _internals73.collectReviewDiff({
|
|
49523
49571
|
directory: input.directory,
|
|
49524
49572
|
selector: input.selector,
|
|
49525
49573
|
maxBytes
|
|
@@ -49528,7 +49576,7 @@ function createScopeVerifier(input, reviewed, maxBytes) {
|
|
|
49528
49576
|
};
|
|
49529
49577
|
}
|
|
49530
49578
|
async function stalePersistenceResult(input, maxBytes, message, modelCalls) {
|
|
49531
|
-
const current = await
|
|
49579
|
+
const current = await _internals73.collectReviewDiff({
|
|
49532
49580
|
directory: input.directory,
|
|
49533
49581
|
selector: input.selector,
|
|
49534
49582
|
maxBytes
|
|
@@ -49907,7 +49955,7 @@ async function persistErrorResult(input, diff, result, error2, dispatches, promp
|
|
|
49907
49955
|
evidence2.review.error = error2;
|
|
49908
49956
|
addCost(evidence2, dispatches);
|
|
49909
49957
|
try {
|
|
49910
|
-
result.evidencePath = await
|
|
49958
|
+
result.evidencePath = await _internals73.persistEvidence(input.directory, evidence2);
|
|
49911
49959
|
} catch {
|
|
49912
49960
|
if (input.config.final_review.mode === "gate") {
|
|
49913
49961
|
result.blocked = true;
|
|
@@ -49923,7 +49971,7 @@ async function runReviewEngine(input) {
|
|
|
49923
49971
|
const gateMode = input.config.final_review.mode === "gate";
|
|
49924
49972
|
const maxBytes = input.trigger === "task_completion" ? input.config.max_diff_kb * 1024 : input.config.final_review.max_diff_bytes;
|
|
49925
49973
|
const timeoutMs = input.trigger === "task_completion" ? input.config.timeout_ms : input.config.final_review.timeout_ms;
|
|
49926
|
-
const diff = await
|
|
49974
|
+
const diff = await _internals73.collectReviewDiff({
|
|
49927
49975
|
directory: input.directory,
|
|
49928
49976
|
selector: input.selector,
|
|
49929
49977
|
maxBytes
|
|
@@ -49937,7 +49985,7 @@ async function runReviewEngine(input) {
|
|
|
49937
49985
|
const evidence3 = baseEvidence(input, diff, "clean");
|
|
49938
49986
|
let evidencePath2;
|
|
49939
49987
|
try {
|
|
49940
|
-
evidencePath2 = await
|
|
49988
|
+
evidencePath2 = await _internals73.persistEvidence(input.directory, evidence3, { verifyCurrent: createScopeVerifier(input, diff, maxBytes) });
|
|
49941
49989
|
} catch (error2) {
|
|
49942
49990
|
if (error2 instanceof ReviewScopeStaleError) {
|
|
49943
49991
|
return stalePersistenceResult(input, maxBytes, "Review scope changed before clean evidence could be committed.", 0);
|
|
@@ -49959,7 +50007,7 @@ async function runReviewEngine(input) {
|
|
|
49959
50007
|
phase: input.phase
|
|
49960
50008
|
});
|
|
49961
50009
|
if (input.phase !== undefined && (input.trigger === "phase_completion" || input.trigger === "plan_completion")) {
|
|
49962
|
-
const existing =
|
|
50010
|
+
const existing = _internals73.readPhaseEvidence(input.directory, input.phase);
|
|
49963
50011
|
const integrity = existing ? validateAutoReviewEvidenceIntegrity(input.directory, existing, {
|
|
49964
50012
|
scopeHash: diff.scopeHash,
|
|
49965
50013
|
phase: input.phase,
|
|
@@ -50085,7 +50133,7 @@ async function runReviewEngine(input) {
|
|
|
50085
50133
|
validation: byId.get(finding.finding_id)
|
|
50086
50134
|
}));
|
|
50087
50135
|
}
|
|
50088
|
-
const currentScope = await
|
|
50136
|
+
const currentScope = await _internals73.collectReviewDiff({
|
|
50089
50137
|
directory: input.directory,
|
|
50090
50138
|
selector: input.selector,
|
|
50091
50139
|
maxBytes
|
|
@@ -50164,7 +50212,7 @@ async function runReviewEngine(input) {
|
|
|
50164
50212
|
findingValidations: findings.map((finding) => finding.validation).filter((item) => Boolean(item))
|
|
50165
50213
|
});
|
|
50166
50214
|
receiptId = receipt.id;
|
|
50167
|
-
receiptPath = await
|
|
50215
|
+
receiptPath = await _internals73.persistReceipt(input.directory, receipt, {
|
|
50168
50216
|
verifyCurrent: createScopeVerifier(input, diff, maxBytes)
|
|
50169
50217
|
});
|
|
50170
50218
|
evidence2.receipt_path = receiptPath;
|
|
@@ -50194,7 +50242,7 @@ async function runReviewEngine(input) {
|
|
|
50194
50242
|
}
|
|
50195
50243
|
let evidencePath;
|
|
50196
50244
|
try {
|
|
50197
|
-
evidencePath = await
|
|
50245
|
+
evidencePath = await _internals73.persistEvidence(input.directory, evidence2, {
|
|
50198
50246
|
verifyCurrent: createScopeVerifier(input, diff, maxBytes)
|
|
50199
50247
|
});
|
|
50200
50248
|
} catch (error2) {
|
|
@@ -50231,7 +50279,7 @@ async function runReviewEngine(input) {
|
|
|
50231
50279
|
input.injectAdvisory?.(input.sessionID, advisoryMessage(input, result));
|
|
50232
50280
|
return result;
|
|
50233
50281
|
}
|
|
50234
|
-
var
|
|
50282
|
+
var _internals73 = {
|
|
50235
50283
|
collectReviewDiff,
|
|
50236
50284
|
persistEvidence: persistAutoReviewEvidence,
|
|
50237
50285
|
persistReceipt: persistReviewReceipt,
|
|
@@ -50502,7 +50550,7 @@ async function handleReviewCommand(ctx) {
|
|
|
50502
50550
|
} catch (error2) {
|
|
50503
50551
|
return `Review configuration error: ${error2 instanceof Error ? error2.message : String(error2)}`;
|
|
50504
50552
|
}
|
|
50505
|
-
const result = await
|
|
50553
|
+
const result = await _internals74.runReviewEngine({
|
|
50506
50554
|
directory: ctx.directory,
|
|
50507
50555
|
sessionID: ctx.sessionID,
|
|
50508
50556
|
trigger: "manual",
|
|
@@ -50516,10 +50564,10 @@ async function handleReviewCommand(ctx) {
|
|
|
50516
50564
|
validatorModel,
|
|
50517
50565
|
validatorFallbackModels
|
|
50518
50566
|
});
|
|
50519
|
-
const evidence2 =
|
|
50567
|
+
const evidence2 = _internals74.readEvidence(result.evidencePath, ctx.directory);
|
|
50520
50568
|
return parsed.json ? renderJson(result, evidence2, parsed.selector) : renderHuman(result, evidence2, parsed.selector);
|
|
50521
50569
|
}
|
|
50522
|
-
var
|
|
50570
|
+
var _internals74 = {
|
|
50523
50571
|
runReviewEngine,
|
|
50524
50572
|
readEvidence
|
|
50525
50573
|
};
|
|
@@ -50764,7 +50812,7 @@ async function handleRollbackCommand(directory, args) {
|
|
|
50764
50812
|
// src/commands/sdd.ts
|
|
50765
50813
|
import * as fs47 from "fs";
|
|
50766
50814
|
import * as path93 from "path";
|
|
50767
|
-
var
|
|
50815
|
+
var _internals75 = {
|
|
50768
50816
|
writeProjectedSpecSync
|
|
50769
50817
|
};
|
|
50770
50818
|
var SWARM_SPEC_REL = path93.join(".swarm", "spec.md");
|
|
@@ -51160,7 +51208,7 @@ ${USAGE12}`;
|
|
|
51160
51208
|
|
|
51161
51209
|
${USAGE12}`;
|
|
51162
51210
|
}
|
|
51163
|
-
const result2 =
|
|
51211
|
+
const result2 = _internals75.writeProjectedSpecSync(directory, {
|
|
51164
51212
|
source: "speckit",
|
|
51165
51213
|
feature: resolution.feature,
|
|
51166
51214
|
dryRun: parsed.dryRun,
|
|
@@ -51218,7 +51266,7 @@ ${formatList(result2.projection.warnings)}` : ""
|
|
|
51218
51266
|
].join(`
|
|
51219
51267
|
`);
|
|
51220
51268
|
}
|
|
51221
|
-
const result =
|
|
51269
|
+
const result = _internals75.writeProjectedSpecSync(directory, {
|
|
51222
51270
|
changeId: parsed.changeId,
|
|
51223
51271
|
dryRun: parsed.dryRun,
|
|
51224
51272
|
overwrite: parsed.overwrite
|
|
@@ -51299,7 +51347,7 @@ async function handleSimulateCommand(directory, args) {
|
|
|
51299
51347
|
}
|
|
51300
51348
|
let darkMatterPairs;
|
|
51301
51349
|
try {
|
|
51302
|
-
darkMatterPairs = await
|
|
51350
|
+
darkMatterPairs = await _internals36.detectDarkMatter(directory, options);
|
|
51303
51351
|
} catch (err) {
|
|
51304
51352
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
51305
51353
|
return `## Simulate Report
|
|
@@ -51457,7 +51505,7 @@ function writeFileFsyncedThenRename(tempPath, targetPath, data) {
|
|
|
51457
51505
|
throw err;
|
|
51458
51506
|
}
|
|
51459
51507
|
}
|
|
51460
|
-
var
|
|
51508
|
+
var _internals76 = {
|
|
51461
51509
|
withEvidenceLock,
|
|
51462
51510
|
writeFileFsyncedThenRename,
|
|
51463
51511
|
writeFileSync: writeFileSyncAsync,
|
|
@@ -51476,7 +51524,7 @@ async function appendEvent(directory, eventInput) {
|
|
|
51476
51524
|
}
|
|
51477
51525
|
const filePath = ledgerPath(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
51478
51526
|
ensureCandidateDir(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
51479
|
-
return
|
|
51527
|
+
return _internals76.withEvidenceLock(directory, path94.join(".swarm", "evolution", "skills", eventInput.skillSlug, eventInput.candidateId, "lifecycle.jsonl"), "skill-opt-ledger", "append-skill-opt-event", async () => {
|
|
51480
51528
|
const existing = existsSync52(filePath) ? readFileSync39(filePath, "utf8") : "";
|
|
51481
51529
|
const events = parseEventsFromText(existing);
|
|
51482
51530
|
const nextSeq = events.length === 0 ? 1 : events[events.length - 1].seq + 1;
|
|
@@ -51507,8 +51555,8 @@ async function appendEvent(directory, eventInput) {
|
|
|
51507
51555
|
const validContent = events.map((e) => JSON.stringify(e)).join(`
|
|
51508
51556
|
`) + (events.length > 0 ? `
|
|
51509
51557
|
` : "");
|
|
51510
|
-
|
|
51511
|
-
const verify = parseEventsFromText(
|
|
51558
|
+
_internals76.writeFileFsyncedThenRename(tempPath, filePath, validContent + line);
|
|
51559
|
+
const verify = parseEventsFromText(_internals76.readFileSync(filePath, "utf8"));
|
|
51512
51560
|
const last = verify.length > 0 ? verify[verify.length - 1] : null;
|
|
51513
51561
|
if (!last || last.seq !== event.seq || last.hashAfter !== event.hashAfter) {
|
|
51514
51562
|
throw new Error(`skill-opt ledger append verification failed for candidate ${event.candidateId} seq ${event.seq}`);
|
|
@@ -51610,14 +51658,14 @@ function writeStateProjection(directory, skillSlug, candidateId2, replay) {
|
|
|
51610
51658
|
updatedAt: new Date().toISOString()
|
|
51611
51659
|
};
|
|
51612
51660
|
const tempPath = `${target}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
51613
|
-
|
|
51661
|
+
_internals76.writeFileFsyncedThenRename(tempPath, target, `${JSON.stringify(projection, null, 2)}
|
|
51614
51662
|
`);
|
|
51615
51663
|
}
|
|
51616
51664
|
function writeArtifact(directory, skillSlug, candidateId2, fileName, content) {
|
|
51617
51665
|
const dir = ensureCandidateDir(directory, skillSlug, candidateId2);
|
|
51618
51666
|
const target = path94.join(dir, fileName);
|
|
51619
51667
|
const tempPath = `${target}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
51620
|
-
|
|
51668
|
+
_internals76.writeFileFsyncedThenRename(tempPath, target, content);
|
|
51621
51669
|
return target;
|
|
51622
51670
|
}
|
|
51623
51671
|
function readArtifact(directory, skillSlug, candidateId2, fileName) {
|
|
@@ -51710,16 +51758,16 @@ function currentCandidateState(directory, skillSlug, candidateId2) {
|
|
|
51710
51758
|
function writeSkillFileAtomic(targetPath, content) {
|
|
51711
51759
|
const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
51712
51760
|
try {
|
|
51713
|
-
|
|
51714
|
-
|
|
51761
|
+
_internals77.writeFileSync(tempPath, content, "utf8");
|
|
51762
|
+
_internals77.renameSync(tempPath, targetPath);
|
|
51715
51763
|
} finally {
|
|
51716
51764
|
try {
|
|
51717
51765
|
if (existsSync53(tempPath))
|
|
51718
|
-
|
|
51766
|
+
_internals77.unlinkSync(tempPath);
|
|
51719
51767
|
} catch {}
|
|
51720
51768
|
}
|
|
51721
51769
|
}
|
|
51722
|
-
var
|
|
51770
|
+
var _internals77 = {
|
|
51723
51771
|
writeFileSync: writeFileSync18,
|
|
51724
51772
|
renameSync: renameSync18,
|
|
51725
51773
|
unlinkSync: unlinkSync21
|
|
@@ -52065,7 +52113,7 @@ function buildGeneratorInputs(args) {
|
|
|
52065
52113
|
}
|
|
52066
52114
|
};
|
|
52067
52115
|
}
|
|
52068
|
-
var
|
|
52116
|
+
var _internals78 = {
|
|
52069
52117
|
draftDeterministic: defaultDeterministicDraft
|
|
52070
52118
|
};
|
|
52071
52119
|
function defaultDeterministicDraft(inputs) {
|
|
@@ -52135,7 +52183,7 @@ function countChangedLines(a, b) {
|
|
|
52135
52183
|
return changed;
|
|
52136
52184
|
}
|
|
52137
52185
|
function draftCandidate(inputs) {
|
|
52138
|
-
const candidate =
|
|
52186
|
+
const candidate = _internals78.draftDeterministic(inputs);
|
|
52139
52187
|
enforceTrustRegion(candidate, inputs.budget);
|
|
52140
52188
|
return candidate;
|
|
52141
52189
|
}
|
|
@@ -52178,7 +52226,7 @@ import * as path96 from "path";
|
|
|
52178
52226
|
// src/hooks/spawn-helper.ts
|
|
52179
52227
|
import * as child_process9 from "child_process";
|
|
52180
52228
|
var WIN32_CMD_BINARIES = new Set(["npm", "npx", "pnpm", "yarn"]);
|
|
52181
|
-
var
|
|
52229
|
+
var _internals79 = {
|
|
52182
52230
|
spawn: child_process9.spawn
|
|
52183
52231
|
};
|
|
52184
52232
|
function spawnAsync(command, cwd, timeoutMs) {
|
|
@@ -52186,7 +52234,7 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
52186
52234
|
try {
|
|
52187
52235
|
const [rawCmd, ...args] = command;
|
|
52188
52236
|
const cmd = process.platform === "win32" && WIN32_CMD_BINARIES.has(rawCmd) && !rawCmd.includes(".") ? `${rawCmd}.cmd` : rawCmd;
|
|
52189
|
-
const proc =
|
|
52237
|
+
const proc = _internals79.spawn(cmd, args, {
|
|
52190
52238
|
cwd,
|
|
52191
52239
|
stdio: ["ignore", "pipe", "pipe"]
|
|
52192
52240
|
});
|
|
@@ -52252,7 +52300,7 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
52252
52300
|
}
|
|
52253
52301
|
|
|
52254
52302
|
// src/services/skill-optimizer/smoke.ts
|
|
52255
|
-
var
|
|
52303
|
+
var _internals80 = {
|
|
52256
52304
|
validateSkillPath,
|
|
52257
52305
|
isSymbolicLink: (p) => {
|
|
52258
52306
|
try {
|
|
@@ -52273,7 +52321,7 @@ var _internals79 = {
|
|
|
52273
52321
|
async function validateSkillSmoke(input) {
|
|
52274
52322
|
const notes = [];
|
|
52275
52323
|
const repoRel = path96.join(".opencode", "skills", "generated", input.skillSlug, "SKILL.md");
|
|
52276
|
-
if (!
|
|
52324
|
+
if (!_internals80.validateSkillPath(repoRel)) {
|
|
52277
52325
|
return {
|
|
52278
52326
|
ok: false,
|
|
52279
52327
|
verdict: "VIOLATED",
|
|
@@ -52282,16 +52330,16 @@ async function validateSkillSmoke(input) {
|
|
|
52282
52330
|
}
|
|
52283
52331
|
const skillRoot = path96.join(input.directory, ".opencode", "skills", "generated", input.skillSlug);
|
|
52284
52332
|
if (existsSync54(skillRoot)) {
|
|
52285
|
-
if (
|
|
52333
|
+
if (_internals80.isSymbolicLink(skillRoot)) {
|
|
52286
52334
|
return {
|
|
52287
52335
|
ok: false,
|
|
52288
52336
|
verdict: "VIOLATED",
|
|
52289
52337
|
notes: ["skill root is a symlink (reparse denied)"]
|
|
52290
52338
|
};
|
|
52291
52339
|
}
|
|
52292
|
-
const realRoot =
|
|
52293
|
-
const realProjectDir =
|
|
52294
|
-
if (
|
|
52340
|
+
const realRoot = _internals80.realpath(skillRoot);
|
|
52341
|
+
const realProjectDir = _internals80.realpath(input.directory);
|
|
52342
|
+
if (_internals80.escapedRoot(realProjectDir, realRoot)) {
|
|
52295
52343
|
return {
|
|
52296
52344
|
ok: false,
|
|
52297
52345
|
verdict: "VIOLATED",
|
|
@@ -52309,7 +52357,7 @@ async function validateSkillSmoke(input) {
|
|
|
52309
52357
|
notes: [`frontmatter: ${fmError}`]
|
|
52310
52358
|
};
|
|
52311
52359
|
}
|
|
52312
|
-
const rejected = await
|
|
52360
|
+
const rejected = await _internals80.isRejectedSkillContent(input.directory, input.skillSlug, input.candidateContent);
|
|
52313
52361
|
if (rejected) {
|
|
52314
52362
|
return {
|
|
52315
52363
|
ok: false,
|
|
@@ -52319,7 +52367,7 @@ async function validateSkillSmoke(input) {
|
|
|
52319
52367
|
]
|
|
52320
52368
|
};
|
|
52321
52369
|
}
|
|
52322
|
-
const evalResult = await
|
|
52370
|
+
const evalResult = await _internals80.evaluateSkillChange({
|
|
52323
52371
|
directory: input.directory,
|
|
52324
52372
|
slug: input.skillSlug,
|
|
52325
52373
|
candidateContent: input.candidateContent,
|
|
@@ -52338,7 +52386,7 @@ async function validateSkillSmoke(input) {
|
|
|
52338
52386
|
notes.push(`phrase-eval passed (score ${evalResult.candidateScore.toFixed(2)})`);
|
|
52339
52387
|
}
|
|
52340
52388
|
if (input.checkCommand && input.checkCommand.length > 0) {
|
|
52341
|
-
const cmdResult = await
|
|
52389
|
+
const cmdResult = await _internals80.spawnAsync(input.checkCommand, input.directory, input.checkTimeoutMs ?? 60000);
|
|
52342
52390
|
if (!cmdResult || cmdResult.exitCode !== 0) {
|
|
52343
52391
|
return {
|
|
52344
52392
|
ok: false,
|
|
@@ -52408,14 +52456,14 @@ async function prepareCandidatePayloads(inputRoot, candidateId2, skillSlug, base
|
|
|
52408
52456
|
candidate.contentHash = await computeCandidateInputContentHash2(inputRoot, candidate);
|
|
52409
52457
|
return { baseline, candidate };
|
|
52410
52458
|
}
|
|
52411
|
-
var
|
|
52459
|
+
var _internals81 = {
|
|
52412
52460
|
tryAcquireLock,
|
|
52413
52461
|
emitTelemetry: emit,
|
|
52414
52462
|
evaluateCandidateV1,
|
|
52415
52463
|
prepareCandidatePayloads
|
|
52416
52464
|
};
|
|
52417
52465
|
async function acquireProjectLock(directory) {
|
|
52418
|
-
const result = await
|
|
52466
|
+
const result = await _internals81.tryAcquireLock(directory, PROJECT_LOCK_PATH, "skill-opt-controller", "project-run");
|
|
52419
52467
|
if (!result.acquired)
|
|
52420
52468
|
return null;
|
|
52421
52469
|
return async () => {
|
|
@@ -52428,7 +52476,7 @@ async function acquireProjectLock(directory) {
|
|
|
52428
52476
|
}
|
|
52429
52477
|
async function acquireSkillLock(directory, skillSlug) {
|
|
52430
52478
|
const lockPath = path97.join(".swarm", "evolution", "skills", skillSlug, ".skill.lock");
|
|
52431
|
-
const result = await
|
|
52479
|
+
const result = await _internals81.tryAcquireLock(directory, lockPath, "skill-opt-controller", `skill-${skillSlug}`);
|
|
52432
52480
|
if (!result.acquired)
|
|
52433
52481
|
return null;
|
|
52434
52482
|
return async () => {
|
|
@@ -52625,13 +52673,13 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
52625
52673
|
while (true) {
|
|
52626
52674
|
try {
|
|
52627
52675
|
const evalInputRoot = input.inputRoot ?? input.directory;
|
|
52628
|
-
const { baseline, candidate } = await
|
|
52676
|
+
const { baseline, candidate } = await _internals81.prepareCandidatePayloads(evalInputRoot, candidateId2, input.skillSlug, input.baselineModel, input.candidateModel, baselineContent, candidateContent);
|
|
52629
52677
|
if (!input.dispatcher) {
|
|
52630
52678
|
throw new Error("no evaluation dispatcher available (cannot run validation)");
|
|
52631
52679
|
}
|
|
52632
52680
|
const { createModelEvaluationExecutor } = await import("./runner-deeswadt.js");
|
|
52633
52681
|
const executor = createModelEvaluationExecutor(input.dispatcher, input.sessionId);
|
|
52634
|
-
const result = await
|
|
52682
|
+
const result = await _internals81.evaluateCandidateV1({
|
|
52635
52683
|
projectRoot: input.directory,
|
|
52636
52684
|
inputRoot: input.inputRoot ?? input.directory,
|
|
52637
52685
|
tasks: input.validationTasks,
|
|
@@ -52689,7 +52737,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
52689
52737
|
deadband: input.config.deadband
|
|
52690
52738
|
};
|
|
52691
52739
|
}
|
|
52692
|
-
|
|
52740
|
+
_internals81.emitTelemetry?.("loop_detected", {
|
|
52693
52741
|
skillSlug: input.skillSlug,
|
|
52694
52742
|
reason: message.slice(0, 160),
|
|
52695
52743
|
source: "skill-opt-controller"
|
|
@@ -53541,7 +53589,7 @@ var DEFAULT_CONTEXT_BUDGET_CONFIG = {
|
|
|
53541
53589
|
};
|
|
53542
53590
|
|
|
53543
53591
|
// src/services/status-service.ts
|
|
53544
|
-
var
|
|
53592
|
+
var _internals82 = {
|
|
53545
53593
|
loadLeanTurboRunState,
|
|
53546
53594
|
hasActiveLeanTurbo,
|
|
53547
53595
|
hasActiveFullAuto,
|
|
@@ -53691,8 +53739,11 @@ async function getStatusData(directory, agents, sessionId) {
|
|
|
53691
53739
|
const cohortConfigPath = path102.join(resolveLinkDir(memoryPointer.linkId), "memory", "memory-cohort-config.json");
|
|
53692
53740
|
if (fsSync3.existsSync(cohortConfigPath)) {
|
|
53693
53741
|
const stored = JSON.parse(fsSync3.readFileSync(cohortConfigPath, "utf-8"));
|
|
53694
|
-
const
|
|
53695
|
-
|
|
53742
|
+
const versionCheck = classifyStoredFingerprintAlgorithmVersion(stored.algorithm_version);
|
|
53743
|
+
if (versionCheck.status === "comparable" && typeof stored.fingerprint === "string") {
|
|
53744
|
+
const expected = computeMemoryCohortFingerprint(buildMemoryCohortFingerprintInput(memoryConfig));
|
|
53745
|
+
configFingerprintMatch = stored.fingerprint === expected;
|
|
53746
|
+
}
|
|
53696
53747
|
}
|
|
53697
53748
|
}
|
|
53698
53749
|
} catch {}
|
|
@@ -53714,11 +53765,11 @@ async function getStatusData(directory, agents, sessionId) {
|
|
|
53714
53765
|
} catch {
|
|
53715
53766
|
status.memoryCohort = { linked: false };
|
|
53716
53767
|
}
|
|
53717
|
-
status.fullAutoActive =
|
|
53768
|
+
status.fullAutoActive = _internals82.hasActiveFullAuto();
|
|
53718
53769
|
if (status.fullAutoActive) {
|
|
53719
|
-
const sid =
|
|
53770
|
+
const sid = _internals82.getActiveFullAutoSessionID();
|
|
53720
53771
|
if (sid) {
|
|
53721
|
-
const runState =
|
|
53772
|
+
const runState = _internals82.loadFullAutoRunState(directory, sid);
|
|
53722
53773
|
if (runState?.lastEscalation) {
|
|
53723
53774
|
status.fullAutoEscalation = {
|
|
53724
53775
|
reason: runState.lastEscalation.reason,
|
|
@@ -53752,7 +53803,7 @@ async function getStatusData(directory, agents, sessionId) {
|
|
|
53752
53803
|
}
|
|
53753
53804
|
function enrichWithLeanTurbo(status, directory) {
|
|
53754
53805
|
const turboMode = hasActiveTurboMode();
|
|
53755
|
-
const leanActive =
|
|
53806
|
+
const leanActive = _internals82.hasActiveLeanTurbo();
|
|
53756
53807
|
let turboStrategy = "off";
|
|
53757
53808
|
if (leanActive) {
|
|
53758
53809
|
turboStrategy = "lean";
|
|
@@ -53783,7 +53834,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
53783
53834
|
}
|
|
53784
53835
|
}
|
|
53785
53836
|
if (leanSessionID) {
|
|
53786
|
-
const runState =
|
|
53837
|
+
const runState = _internals82.loadLeanTurboRunState(directory, leanSessionID);
|
|
53787
53838
|
if (runState) {
|
|
53788
53839
|
status.leanTurboPhase = runState.phase;
|
|
53789
53840
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -54034,7 +54085,7 @@ init_logger();
|
|
|
54034
54085
|
var TURBO_BYPASS_DISCLOSURE = "Bypassed: Stage B (reviewer + test_engineer) for Tier 0-2 tasks; phase_complete Gates 1-5 " + "(completion-verify, drift-verifier, hallucination-guard, mutation-gate, phase-council). " + "Still enforced: Stage A (lint, imports, pre_check_batch); Tier 3 Stage B; Gate 5b " + "(architecture-supervisor); Gate 6 (final-council); Gate 7 (full-auto).";
|
|
54035
54086
|
|
|
54036
54087
|
// src/commands/turbo.ts
|
|
54037
|
-
var
|
|
54088
|
+
var _internals83 = {
|
|
54038
54089
|
loadPluginConfigWithMeta
|
|
54039
54090
|
};
|
|
54040
54091
|
async function handleTurboCommand(directory, args, sessionID) {
|
|
@@ -54094,7 +54145,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
54094
54145
|
if (arg0 === "on") {
|
|
54095
54146
|
let strategy = "standard";
|
|
54096
54147
|
try {
|
|
54097
|
-
const { config } =
|
|
54148
|
+
const { config } = _internals83.loadPluginConfigWithMeta(directory);
|
|
54098
54149
|
if (config.turbo?.strategy === "lean") {
|
|
54099
54150
|
strategy = "lean";
|
|
54100
54151
|
}
|
|
@@ -54191,7 +54242,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
54191
54242
|
let maxParallelCoders = 4;
|
|
54192
54243
|
let conflictPolicy = "serialize";
|
|
54193
54244
|
try {
|
|
54194
|
-
const { config } =
|
|
54245
|
+
const { config } = _internals83.loadPluginConfigWithMeta(directory);
|
|
54195
54246
|
const leanConfig = config.turbo?.lean;
|
|
54196
54247
|
if (leanConfig) {
|
|
54197
54248
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -54396,7 +54447,7 @@ function findSimilarCommands(query) {
|
|
|
54396
54447
|
}
|
|
54397
54448
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
54398
54449
|
const cmdLower = cmd.toLowerCase();
|
|
54399
|
-
const fullScore =
|
|
54450
|
+
const fullScore = _internals14.levenshteinDistance(q, cmdLower);
|
|
54400
54451
|
let tokenScore = Infinity;
|
|
54401
54452
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
54402
54453
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -54409,7 +54460,7 @@ function findSimilarCommands(query) {
|
|
|
54409
54460
|
for (const ct of cmdTokens) {
|
|
54410
54461
|
if (ct.length === 0)
|
|
54411
54462
|
continue;
|
|
54412
|
-
const dist =
|
|
54463
|
+
const dist = _internals14.levenshteinDistance(qt, ct);
|
|
54413
54464
|
if (dist < minDist)
|
|
54414
54465
|
minDist = dist;
|
|
54415
54466
|
}
|
|
@@ -54419,7 +54470,7 @@ function findSimilarCommands(query) {
|
|
|
54419
54470
|
}
|
|
54420
54471
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
54421
54472
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
54422
|
-
const dashScore =
|
|
54473
|
+
const dashScore = _internals14.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
54423
54474
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
54424
54475
|
return { cmd, score };
|
|
54425
54476
|
});
|
|
@@ -54454,16 +54505,16 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
54454
54505
|
async function handleHelpCommand(ctx) {
|
|
54455
54506
|
const targetCommand = ctx.args.join(" ");
|
|
54456
54507
|
if (!targetCommand) {
|
|
54457
|
-
const { buildHelpText } = await import("./index-
|
|
54508
|
+
const { buildHelpText } = await import("./index-xvcctb2t.js");
|
|
54458
54509
|
return buildHelpText();
|
|
54459
54510
|
}
|
|
54460
54511
|
const tokens = targetCommand.split(/\s+/);
|
|
54461
|
-
const resolved =
|
|
54512
|
+
const resolved = _internals14.resolveCommand(tokens);
|
|
54462
54513
|
if (resolved) {
|
|
54463
|
-
return
|
|
54514
|
+
return _internals14.buildDetailedHelp(resolved.key, resolved.entry);
|
|
54464
54515
|
}
|
|
54465
|
-
const similar =
|
|
54466
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
54516
|
+
const similar = _internals14.findSimilarCommands(targetCommand);
|
|
54517
|
+
const { buildHelpText: fullHelp } = await import("./index-xvcctb2t.js");
|
|
54467
54518
|
if (similar.length > 0) {
|
|
54468
54519
|
return `Command '/swarm ${targetCommand}' not found.
|
|
54469
54520
|
|
|
@@ -54571,7 +54622,7 @@ var COMMAND_REGISTRY = {
|
|
|
54571
54622
|
toolNoArgs: true
|
|
54572
54623
|
},
|
|
54573
54624
|
help: {
|
|
54574
|
-
handler: (ctx) =>
|
|
54625
|
+
handler: (ctx) => _internals14.handleHelpCommand(ctx),
|
|
54575
54626
|
description: "Show help for swarm commands",
|
|
54576
54627
|
category: "core",
|
|
54577
54628
|
args: "[command]",
|
|
@@ -54640,7 +54691,7 @@ var COMMAND_REGISTRY = {
|
|
|
54640
54691
|
},
|
|
54641
54692
|
"guardrail explain": {
|
|
54642
54693
|
handler: async (ctx) => {
|
|
54643
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
54694
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-v6f8efve.js");
|
|
54644
54695
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
54645
54696
|
},
|
|
54646
54697
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -54650,7 +54701,7 @@ var COMMAND_REGISTRY = {
|
|
|
54650
54701
|
},
|
|
54651
54702
|
"guardrail-explain": {
|
|
54652
54703
|
handler: async (ctx) => {
|
|
54653
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
54704
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-v6f8efve.js");
|
|
54654
54705
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
54655
54706
|
},
|
|
54656
54707
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -54660,7 +54711,7 @@ var COMMAND_REGISTRY = {
|
|
|
54660
54711
|
},
|
|
54661
54712
|
"guardrail-log": {
|
|
54662
54713
|
handler: async (ctx) => {
|
|
54663
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
54714
|
+
const { handleGuardrailLog } = await import("./guardrail-log-0mrq14g9.js");
|
|
54664
54715
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
54665
54716
|
},
|
|
54666
54717
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -55641,7 +55692,7 @@ function validateToolPolicy() {
|
|
|
55641
55692
|
}
|
|
55642
55693
|
return { valid: warnings.length === 0, warnings };
|
|
55643
55694
|
}
|
|
55644
|
-
var
|
|
55695
|
+
var _internals14 = {
|
|
55645
55696
|
handleHelpCommand,
|
|
55646
55697
|
validateAliases,
|
|
55647
55698
|
validateToolPolicy,
|
|
@@ -55651,16 +55702,16 @@ var _internals13 = {
|
|
|
55651
55702
|
findSimilarCommands,
|
|
55652
55703
|
buildDetailedHelp
|
|
55653
55704
|
};
|
|
55654
|
-
var validation =
|
|
55705
|
+
var validation = _internals14.validateAliases();
|
|
55655
55706
|
if (!validation.valid) {
|
|
55656
55707
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
55657
55708
|
${validation.errors.join(`
|
|
55658
55709
|
`)}`);
|
|
55659
55710
|
}
|
|
55660
|
-
|
|
55711
|
+
_internals14.emitValidationWarnings("COMMAND_REGISTRY alias warnings", validation.warnings);
|
|
55661
55712
|
try {
|
|
55662
|
-
const toolPolicyValidation =
|
|
55663
|
-
|
|
55713
|
+
const toolPolicyValidation = _internals14.validateToolPolicy();
|
|
55714
|
+
_internals14.emitValidationWarnings("COMMAND_REGISTRY toolPolicy warnings", toolPolicyValidation.warnings);
|
|
55664
55715
|
} catch (e) {
|
|
55665
55716
|
warn(`COMMAND_REGISTRY toolPolicy validation failed (non-fatal): ${e.message}`);
|
|
55666
55717
|
}
|
|
@@ -58237,4 +58288,4 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
|
|
|
58237
58288
|
};
|
|
58238
58289
|
}
|
|
58239
58290
|
|
|
58240
|
-
export { handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, DC_SAFE_TARGETS, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcValidateTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate,
|
|
58291
|
+
export { handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, DC_SAFE_TARGETS, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcValidateTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals23 as _internals, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals26 as _internals1, createHivePromoterHook, promoteToHive, promoteFromSwarm, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals14 as _internals2, resolveCommand };
|