opencode-swarm 7.143.2 → 7.143.3
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-xadt4kv5.js → config-doctor-ddbwxt14.js} +2 -2
- package/dist/cli/{core-vpefadja.js → core-gfk2tsre.js} +1 -1
- package/dist/cli/{curator-wahbxxw9.js → curator-hkcd03bx.js} +17 -17
- package/dist/cli/{curator-llm-factory-xjw5j2jj.js → curator-llm-factory-z23scnwb.js} +17 -17
- package/dist/cli/{evidence-summary-service-m0jes2yb.js → evidence-summary-service-cbhsye6e.js} +6 -6
- package/dist/cli/{gate-evidence-sf9hbhm0.js → gate-evidence-5xd9j34y.js} +2 -2
- package/dist/cli/{guardrail-explain-9vdjkz5x.js → guardrail-explain-49vn7rv6.js} +18 -18
- package/dist/cli/{guardrail-log-xr0cv07v.js → guardrail-log-ghymef5s.js} +3 -3
- package/dist/cli/{hive-promoter-ften3m3h.js → hive-promoter-akf3x240.js} +17 -17
- package/dist/cli/{index-6q3wx600.js → index-1et48zgf.js} +1 -1
- package/dist/cli/{index-qswsp6s3.js → index-1y0rggw0.js} +1 -1
- package/dist/cli/{index-jvbqryky.js → index-30yyh3m0.js} +3 -3
- package/dist/cli/{index-nvt1152n.js → index-3qw0bsgr.js} +1 -1
- package/dist/cli/{index-yw4atzww.js → index-4mr3ga48.js} +1 -1
- package/dist/cli/{index-2pxq133w.js → index-64pk7525.js} +1 -1
- package/dist/cli/{index-x0ja3n3g.js → index-6cgp4ska.js} +2 -2
- package/dist/cli/{index-700yppfy.js → index-86tn52b3.js} +1 -1
- package/dist/cli/{index-6hwedxn7.js → index-9py8e0dk.js} +3 -3
- package/dist/cli/{index-4g1bnzma.js → index-a6rnw33a.js} +2 -2
- package/dist/cli/{index-je3jmcc1.js → index-ds7j4hth.js} +3 -3
- package/dist/cli/{index-kjgma6hg.js → index-e1feasna.js} +1 -1
- package/dist/cli/{index-yr997mhn.js → index-e3g0t29w.js} +1 -1
- package/dist/cli/{index-fq0b44vq.js → index-etxy4vz9.js} +4 -4
- package/dist/cli/{index-6f80e8r5.js → index-m7gss7zy.js} +167 -118
- package/dist/cli/{index-kc9tfc7e.js → index-qykq6vge.js} +3 -3
- package/dist/cli/{index-h5fmwg5b.js → index-tj18fe58.js} +19 -19
- package/dist/cli/{index-7e91cs99.js → index-vatqcjnd.js} +5 -5
- package/dist/cli/{index-8hxbjgyk.js → index-vdkywste.js} +1 -1
- package/dist/cli/{index-r0j1sh38.js → index-x90gktjx.js} +1 -1
- package/dist/cli/{index-xacfcpyn.js → index-xq2effek.js} +2 -2
- package/dist/cli/index.js +17 -17
- package/dist/cli/{knowledge-escalator-9xesv2xx.js → knowledge-escalator-mgg6kvva.js} +6 -6
- package/dist/cli/{knowledge-events-s8nvbdyk.js → knowledge-events-yjmkrrv2.js} +4 -4
- package/dist/cli/{knowledge-store-2zt0b10b.js → knowledge-store-647twyjp.js} +1 -1
- package/dist/cli/{knowledge-validator-nt955tw0.js → knowledge-validator-0nsax3n6.js} +2 -2
- package/dist/cli/{scan-cursor-emrg35t0.js → scan-cursor-vgmzg5ys.js} +2 -2
- package/dist/cli/{schema-tpbz8f0x.js → schema-mzh2tam4.js} +1 -1
- package/dist/cli/{scope-persistence-1hf839ys.js → scope-persistence-m4ah4fay.js} +4 -4
- package/dist/cli/{skill-generator-fja22m4q.js → skill-generator-eyf32w7h.js} +7 -7
- package/dist/cli/{worktree-isolation-gnqvy10j.js → worktree-isolation-grxn94v9.js} +17 -17
- package/dist/index.js +67 -59
- package/dist/session/snapshot-writer.d.ts +12 -0
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
stableCanonicalStringify
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-vdkywste.js";
|
|
5
5
|
import {
|
|
6
6
|
detectStraySwarmDirs,
|
|
7
7
|
readDoctorArtifact,
|
|
8
8
|
removeStraySwarmDir,
|
|
9
9
|
runConfigDoctor
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-e3g0t29w.js";
|
|
11
11
|
import {
|
|
12
12
|
MAX_TRANSIENT_RETRIES,
|
|
13
13
|
archiveEvidence,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
updateTaskCheckpointReceipt,
|
|
55
55
|
updateTaskStatus,
|
|
56
56
|
validateProjectRoot
|
|
57
|
-
} from "./index-
|
|
57
|
+
} from "./index-30yyh3m0.js";
|
|
58
58
|
import {
|
|
59
59
|
loadDatabaseCtor
|
|
60
60
|
} from "./index-134d35c1.js";
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
alreadyCuratedThisGeneration,
|
|
107
107
|
claimNextScanBatch,
|
|
108
108
|
resolveCohortId
|
|
109
|
-
} from "./index-
|
|
109
|
+
} from "./index-64pk7525.js";
|
|
110
110
|
import {
|
|
111
111
|
CURATOR_INIT_PROMPT,
|
|
112
112
|
CURATOR_PHASE_PROMPT,
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
startupOrphanRecovery,
|
|
142
142
|
withTaskEvidenceTransaction,
|
|
143
143
|
writeWorkflowWalFile
|
|
144
|
-
} from "./index-
|
|
144
|
+
} from "./index-86tn52b3.js";
|
|
145
145
|
import {
|
|
146
146
|
changedFilesSinceSnapshot,
|
|
147
147
|
parsePorcelainV2Snapshot,
|
|
@@ -188,16 +188,16 @@ import {
|
|
|
188
188
|
retireSkill,
|
|
189
189
|
selectCandidateEntries,
|
|
190
190
|
syncBundledProjectSkillsIfMissingAsync
|
|
191
|
-
} from "./index-
|
|
191
|
+
} from "./index-9py8e0dk.js";
|
|
192
192
|
import {
|
|
193
193
|
readRecentEscalations
|
|
194
|
-
} from "./index-
|
|
194
|
+
} from "./index-vatqcjnd.js";
|
|
195
195
|
import {
|
|
196
196
|
MAX_PENDING_SCOPE_BINDINGS,
|
|
197
197
|
clearAllScopes,
|
|
198
198
|
clearScopeBindingFromDisk,
|
|
199
199
|
clearScopeBindings
|
|
200
|
-
} from "./index-
|
|
200
|
+
} from "./index-a6rnw33a.js";
|
|
201
201
|
import {
|
|
202
202
|
appendLedgerEvent,
|
|
203
203
|
computePlanHash,
|
|
@@ -210,7 +210,7 @@ import {
|
|
|
210
210
|
readPlanEpochIdentity,
|
|
211
211
|
replayFromLedgerWithStatus,
|
|
212
212
|
takeSnapshotEvent
|
|
213
|
-
} from "./index-
|
|
213
|
+
} from "./index-e1feasna.js";
|
|
214
214
|
import {
|
|
215
215
|
isPathWithinDeclaredScope
|
|
216
216
|
} from "./index-556ja8an.js";
|
|
@@ -238,7 +238,7 @@ import {
|
|
|
238
238
|
import {
|
|
239
239
|
provisionWorktree,
|
|
240
240
|
removeWorktree
|
|
241
|
-
} from "./index-
|
|
241
|
+
} from "./index-3qw0bsgr.js";
|
|
242
242
|
import {
|
|
243
243
|
SandboxCapabilityProbe,
|
|
244
244
|
init_capability_probe
|
|
@@ -262,10 +262,10 @@ import {
|
|
|
262
262
|
recordKnowledgeEvent,
|
|
263
263
|
recordPhaseCloseIntent,
|
|
264
264
|
resolveKnowledgeEventsPath
|
|
265
|
-
} from "./index-
|
|
265
|
+
} from "./index-ds7j4hth.js";
|
|
266
266
|
import {
|
|
267
267
|
resolveWorktreeIsolationConfig
|
|
268
|
-
} from "./index-
|
|
268
|
+
} from "./index-6cgp4ska.js";
|
|
269
269
|
import {
|
|
270
270
|
RetrospectiveEvidenceSchema
|
|
271
271
|
} from "./index-gprxjmm7.js";
|
|
@@ -275,7 +275,7 @@ import {
|
|
|
275
275
|
init_loader,
|
|
276
276
|
loadPluginConfig,
|
|
277
277
|
loadPluginConfigWithMeta
|
|
278
|
-
} from "./index-
|
|
278
|
+
} from "./index-1y0rggw0.js";
|
|
279
279
|
import {
|
|
280
280
|
DEFAULT_SKILL_OPT_CONFIG,
|
|
281
281
|
FALLBACK_MODELS_MAX,
|
|
@@ -289,7 +289,7 @@ import {
|
|
|
289
289
|
package_default,
|
|
290
290
|
resolveAutoReviewConfig,
|
|
291
291
|
stripKnownSwarmPrefix
|
|
292
|
-
} from "./index-
|
|
292
|
+
} from "./index-1et48zgf.js";
|
|
293
293
|
import {
|
|
294
294
|
readSwarmFileAsync,
|
|
295
295
|
safeHook,
|
|
@@ -324,7 +324,7 @@ import {
|
|
|
324
324
|
validateActionableFields,
|
|
325
325
|
validateLesson,
|
|
326
326
|
validateSkillPath
|
|
327
|
-
} from "./index-
|
|
327
|
+
} from "./index-4mr3ga48.js";
|
|
328
328
|
import {
|
|
329
329
|
authorizeCuration,
|
|
330
330
|
buildConfigFingerprintInput
|
|
@@ -361,7 +361,7 @@ import {
|
|
|
361
361
|
transactFile,
|
|
362
362
|
transactKnowledge,
|
|
363
363
|
wordBigrams
|
|
364
|
-
} from "./index-
|
|
364
|
+
} from "./index-etxy4vz9.js";
|
|
365
365
|
import {
|
|
366
366
|
resolveHiveDataDir,
|
|
367
367
|
resolveHiveEventsPath,
|
|
@@ -4153,7 +4153,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
|
|
|
4153
4153
|
awaitingMergeByCallID,
|
|
4154
4154
|
cleanupStandardWorktreeForCallId,
|
|
4155
4155
|
standardWorktreeByCallID
|
|
4156
|
-
} = await import("./worktree-isolation-
|
|
4156
|
+
} = await import("./worktree-isolation-grxn94v9.js");
|
|
4157
4157
|
standardWorktreeByCallID.delete(descriptor.callID);
|
|
4158
4158
|
if (hasResidue)
|
|
4159
4159
|
awaitingMergeByCallID.set(descriptor.callID, {
|
|
@@ -4232,7 +4232,7 @@ async function recoverCoderSettlement(directory, taskId) {
|
|
|
4232
4232
|
awaitingMergeByCallID,
|
|
4233
4233
|
finishStandardWorktreeDispatch,
|
|
4234
4234
|
standardWorktreeByCallID
|
|
4235
|
-
} = await import("./worktree-isolation-
|
|
4235
|
+
} = await import("./worktree-isolation-grxn94v9.js");
|
|
4236
4236
|
const descriptor = wal.worktree;
|
|
4237
4237
|
const reconstructedDispatch = {
|
|
4238
4238
|
callID: descriptor.callID,
|
|
@@ -14931,7 +14931,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
14931
14931
|
};
|
|
14932
14932
|
}
|
|
14933
14933
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
14934
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
14934
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qykq6vge.js");
|
|
14935
14935
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
14936
14936
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
14937
14937
|
if (sweepConfig?.enabled === false)
|
|
@@ -16015,7 +16015,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
16015
16015
|
}
|
|
16016
16016
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
16017
16017
|
try {
|
|
16018
|
-
const skillModule = await import("./skill-generator-
|
|
16018
|
+
const skillModule = await import("./skill-generator-eyf32w7h.js");
|
|
16019
16019
|
for (const cand of skillCandidates) {
|
|
16020
16020
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
16021
16021
|
continue;
|
|
@@ -16475,7 +16475,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
16475
16475
|
} catch {}
|
|
16476
16476
|
}
|
|
16477
16477
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
16478
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
16478
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-mgg6kvva.js");
|
|
16479
16479
|
for (const { id } of contradictedEntries) {
|
|
16480
16480
|
try {
|
|
16481
16481
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -17294,7 +17294,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
17294
17294
|
warnings.push("Failed to collect knowledge summary.");
|
|
17295
17295
|
}
|
|
17296
17296
|
try {
|
|
17297
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
17297
|
+
const { getScanStatus } = await import("./scan-cursor-vgmzg5ys.js");
|
|
17298
17298
|
const scanStatus = await getScanStatus(directory);
|
|
17299
17299
|
if (scanStatus.remaining_estimate > 0) {
|
|
17300
17300
|
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.`);
|
|
@@ -17466,9 +17466,9 @@ var _internals23 = {
|
|
|
17466
17466
|
verifyPostMortemKnowledgeActions,
|
|
17467
17467
|
repairPostMortemActions,
|
|
17468
17468
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
17469
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
17469
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-mzh2tam4.js");
|
|
17470
17470
|
try {
|
|
17471
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
17471
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qykq6vge.js");
|
|
17472
17472
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
17473
17473
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
17474
17474
|
} catch {
|
|
@@ -17476,11 +17476,11 @@ var _internals23 = {
|
|
|
17476
17476
|
}
|
|
17477
17477
|
},
|
|
17478
17478
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
17479
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
17479
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-hkcd03bx.js");
|
|
17480
17480
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
17481
17481
|
},
|
|
17482
17482
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
17483
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
17483
|
+
const { checkHivePromotions } = await import("./hive-promoter-akf3x240.js");
|
|
17484
17484
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
17485
17485
|
},
|
|
17486
17486
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -17489,7 +17489,7 @@ var _internals23 = {
|
|
|
17489
17489
|
activateProposal,
|
|
17490
17490
|
listSkills: listSkills2,
|
|
17491
17491
|
sanitizeSlug
|
|
17492
|
-
} = await import("./skill-generator-
|
|
17492
|
+
} = await import("./skill-generator-eyf32w7h.js");
|
|
17493
17493
|
const result = {
|
|
17494
17494
|
approved: [],
|
|
17495
17495
|
rejected: [],
|
|
@@ -18825,9 +18825,9 @@ function hashContent(content) {
|
|
|
18825
18825
|
return createHash7("sha1").update(content).digest("hex");
|
|
18826
18826
|
}
|
|
18827
18827
|
async function loadConfigForPolicyCurator(directory) {
|
|
18828
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
18828
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-mzh2tam4.js");
|
|
18829
18829
|
try {
|
|
18830
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
18830
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qykq6vge.js");
|
|
18831
18831
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
18832
18832
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
18833
18833
|
} catch {
|
|
@@ -27669,7 +27669,7 @@ async function runFinalizeStage(ctx) {
|
|
|
27669
27669
|
}
|
|
27670
27670
|
}
|
|
27671
27671
|
try {
|
|
27672
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
27672
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-mzh2tam4.js");
|
|
27673
27673
|
const { config: pmLoadedConfig } = _internals36.loadPluginConfigWithMeta(ctx.directory);
|
|
27674
27674
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
27675
27675
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -29947,9 +29947,9 @@ var _internals41 = {
|
|
|
29947
29947
|
loadPluginConfigWithMeta,
|
|
29948
29948
|
loadCuratorDeps: async () => {
|
|
29949
29949
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
29950
|
-
import("./schema-
|
|
29951
|
-
import("./curator-
|
|
29952
|
-
import("./curator-llm-factory-
|
|
29950
|
+
import("./schema-mzh2tam4.js"),
|
|
29951
|
+
import("./curator-hkcd03bx.js"),
|
|
29952
|
+
import("./curator-llm-factory-z23scnwb.js")
|
|
29953
29953
|
]);
|
|
29954
29954
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
29955
29955
|
}
|
|
@@ -30854,7 +30854,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
30854
30854
|
let scanCompleted = false;
|
|
30855
30855
|
let scanRemaining = 0;
|
|
30856
30856
|
try {
|
|
30857
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
30857
|
+
const { getScanStatus } = await import("./scan-cursor-vgmzg5ys.js");
|
|
30858
30858
|
const status = await getScanStatus(directory);
|
|
30859
30859
|
scanGeneration = status.generation;
|
|
30860
30860
|
scanCompleted = status.completed;
|
|
@@ -30864,10 +30864,10 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
30864
30864
|
try {
|
|
30865
30865
|
const { isLinked: isLinked2 } = await import("./knowledge-link-fn5j3r4q.js");
|
|
30866
30866
|
if (isLinked2(directory)) {
|
|
30867
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
30867
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-mzh2tam4.js");
|
|
30868
30868
|
let config;
|
|
30869
30869
|
try {
|
|
30870
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
30870
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-qykq6vge.js");
|
|
30871
30871
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
30872
30872
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
30873
30873
|
} catch {
|
|
@@ -32085,7 +32085,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
32085
32085
|
const result = runConfigDoctor(config, directory);
|
|
32086
32086
|
let output;
|
|
32087
32087
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
32088
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
32088
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-ddbwxt14.js");
|
|
32089
32089
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
32090
32090
|
applyLossy: true
|
|
32091
32091
|
});
|
|
@@ -32922,7 +32922,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
32922
32922
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
32923
32923
|
}
|
|
32924
32924
|
async function handleEvidenceSummaryCommand(directory) {
|
|
32925
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
32925
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-cbhsye6e.js");
|
|
32926
32926
|
const artifact = await buildEvidenceSummary(directory);
|
|
32927
32927
|
if (!artifact) {
|
|
32928
32928
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -36531,8 +36531,10 @@ async function sastScan(input, directory, config) {
|
|
|
36531
36531
|
break;
|
|
36532
36532
|
}
|
|
36533
36533
|
}
|
|
36534
|
+
let zeroCoverageError;
|
|
36534
36535
|
if (filesScanned === 0) {
|
|
36535
36536
|
verdict = "fail";
|
|
36537
|
+
zeroCoverageError = "SAST requires at least one file to scan; zero files were scanned";
|
|
36536
36538
|
}
|
|
36537
36539
|
const summary = {
|
|
36538
36540
|
engine,
|
|
@@ -36561,7 +36563,8 @@ async function sastScan(input, directory, config) {
|
|
|
36561
36563
|
const result = {
|
|
36562
36564
|
verdict,
|
|
36563
36565
|
findings: finalFindings,
|
|
36564
|
-
summary
|
|
36566
|
+
summary,
|
|
36567
|
+
...zeroCoverageError ? { error: zeroCoverageError } : {}
|
|
36565
36568
|
};
|
|
36566
36569
|
if (baselineUsed) {
|
|
36567
36570
|
result.new_findings = newFindings;
|
|
@@ -37436,7 +37439,7 @@ async function handleGateStatsCommand(directory, args) {
|
|
|
37436
37439
|
|
|
37437
37440
|
// src/commands/handoff.ts
|
|
37438
37441
|
import crypto5 from "crypto";
|
|
37439
|
-
import { renameSync as
|
|
37442
|
+
import { renameSync as renameSync11, unlinkSync as unlinkSync10 } from "fs";
|
|
37440
37443
|
|
|
37441
37444
|
// src/services/handoff-service.ts
|
|
37442
37445
|
var RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
|
|
@@ -37821,9 +37824,41 @@ var _internals52 = {
|
|
|
37821
37824
|
};
|
|
37822
37825
|
|
|
37823
37826
|
// src/session/snapshot-writer.ts
|
|
37824
|
-
import {
|
|
37827
|
+
import {
|
|
37828
|
+
closeSync as closeSync7,
|
|
37829
|
+
existsSync as existsSync36,
|
|
37830
|
+
fsyncSync as fsyncSync2,
|
|
37831
|
+
mkdirSync as mkdirSync19,
|
|
37832
|
+
openSync as openSync7,
|
|
37833
|
+
unlinkSync as unlinkSync9
|
|
37834
|
+
} from "fs";
|
|
37835
|
+
import { rename as fsRename } from "fs/promises";
|
|
37825
37836
|
import * as path62 from "path";
|
|
37826
37837
|
var _writeInFlight = Promise.resolve();
|
|
37838
|
+
var SNAPSHOT_RENAME_MAX_ATTEMPTS = 3;
|
|
37839
|
+
var SNAPSHOT_RENAME_RETRY_DELAY_MS = 50;
|
|
37840
|
+
async function renameWithTransientRetry(tempPath, targetPath) {
|
|
37841
|
+
let lastError;
|
|
37842
|
+
for (let attempt = 0;attempt < SNAPSHOT_RENAME_MAX_ATTEMPTS; attempt++) {
|
|
37843
|
+
try {
|
|
37844
|
+
await _internals53.rename(tempPath, targetPath);
|
|
37845
|
+
return;
|
|
37846
|
+
} catch (error2) {
|
|
37847
|
+
lastError = error2;
|
|
37848
|
+
const code = error2.code;
|
|
37849
|
+
if (code === "ENOENT" && attempt > 0 && !existsSync36(tempPath) && existsSync36(targetPath)) {
|
|
37850
|
+
return;
|
|
37851
|
+
}
|
|
37852
|
+
if (code !== "EEXIST" && code !== "EBUSY" && code !== "EPERM") {
|
|
37853
|
+
break;
|
|
37854
|
+
}
|
|
37855
|
+
if (attempt < SNAPSHOT_RENAME_MAX_ATTEMPTS - 1) {
|
|
37856
|
+
await new Promise((resolve20) => setTimeout(resolve20, SNAPSHOT_RENAME_RETRY_DELAY_MS));
|
|
37857
|
+
}
|
|
37858
|
+
}
|
|
37859
|
+
}
|
|
37860
|
+
throw lastError;
|
|
37861
|
+
}
|
|
37827
37862
|
function serializeAgentSession(s) {
|
|
37828
37863
|
const gateLog = {};
|
|
37829
37864
|
const rawGateLog = s.gateLog ?? new Map;
|
|
@@ -37966,7 +38001,13 @@ async function writeSnapshot(directory, state) {
|
|
|
37966
38001
|
closeSync7(fd);
|
|
37967
38002
|
}
|
|
37968
38003
|
} catch {}
|
|
37969
|
-
|
|
38004
|
+
try {
|
|
38005
|
+
await renameWithTransientRetry(tempPath, resolvedPath);
|
|
38006
|
+
} finally {
|
|
38007
|
+
try {
|
|
38008
|
+
unlinkSync9(tempPath);
|
|
38009
|
+
} catch {}
|
|
38010
|
+
}
|
|
37970
38011
|
invalidateCachedArtifact(resolvedPath);
|
|
37971
38012
|
} catch (error2) {
|
|
37972
38013
|
log("[snapshot-writer] write failed", {
|
|
@@ -37987,7 +38028,8 @@ async function flushPendingSnapshot(directory) {
|
|
|
37987
38028
|
var _internals53 = {
|
|
37988
38029
|
writeSnapshot,
|
|
37989
38030
|
createSnapshotWriterHook,
|
|
37990
|
-
flushPendingSnapshot
|
|
38031
|
+
flushPendingSnapshot,
|
|
38032
|
+
rename: fsRename
|
|
37991
38033
|
};
|
|
37992
38034
|
|
|
37993
38035
|
// src/commands/handoff.ts
|
|
@@ -38007,10 +38049,10 @@ async function handleHandoffCommand(directory, _args, sessionID) {
|
|
|
38007
38049
|
const tempPath = `${resolvedPath}.tmp.${crypto5.randomUUID()}`;
|
|
38008
38050
|
await bunWrite(tempPath, formatSessionScopedHandoffMarkdown(markdown, sessionID));
|
|
38009
38051
|
try {
|
|
38010
|
-
|
|
38052
|
+
renameSync11(tempPath, resolvedPath);
|
|
38011
38053
|
} catch (renameErr) {
|
|
38012
38054
|
try {
|
|
38013
|
-
|
|
38055
|
+
unlinkSync10(tempPath);
|
|
38014
38056
|
} catch {}
|
|
38015
38057
|
throw renameErr;
|
|
38016
38058
|
}
|
|
@@ -38020,10 +38062,10 @@ async function handleHandoffCommand(directory, _args, sessionID) {
|
|
|
38020
38062
|
const promptTempPath = `${promptPath}.tmp.${crypto5.randomUUID()}`;
|
|
38021
38063
|
await bunWrite(promptTempPath, continuationPrompt);
|
|
38022
38064
|
try {
|
|
38023
|
-
|
|
38065
|
+
renameSync11(promptTempPath, promptPath);
|
|
38024
38066
|
} catch (renameErr) {
|
|
38025
38067
|
try {
|
|
38026
|
-
|
|
38068
|
+
unlinkSync10(promptTempPath);
|
|
38027
38069
|
} catch {}
|
|
38028
38070
|
throw renameErr;
|
|
38029
38071
|
}
|
|
@@ -39326,7 +39368,7 @@ init_schema();
|
|
|
39326
39368
|
// src/hooks/knowledge-migrator.ts
|
|
39327
39369
|
init_logger();
|
|
39328
39370
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
39329
|
-
import { existsSync as
|
|
39371
|
+
import { existsSync as existsSync38, readFileSync as readFileSync29 } from "fs";
|
|
39330
39372
|
import { mkdir as mkdir17, readFile as readFile19, writeFile as writeFile13 } from "fs/promises";
|
|
39331
39373
|
import * as os8 from "os";
|
|
39332
39374
|
import * as path65 from "path";
|
|
@@ -39391,7 +39433,7 @@ var _internals56 = {
|
|
|
39391
39433
|
inferProjectName,
|
|
39392
39434
|
writeSentinel,
|
|
39393
39435
|
resolveLegacyHiveKnowledgePath,
|
|
39394
|
-
existsSync:
|
|
39436
|
+
existsSync: existsSync38,
|
|
39395
39437
|
readFileSync: readFileSync29,
|
|
39396
39438
|
readFile: readFile19,
|
|
39397
39439
|
mkdir: mkdir17,
|
|
@@ -39401,7 +39443,7 @@ async function migrateContextToKnowledge(directory, config) {
|
|
|
39401
39443
|
const sentinelPath = path65.join(directory, ".swarm", ".knowledge-migrated");
|
|
39402
39444
|
const contextPath = path65.join(directory, ".swarm", "context.md");
|
|
39403
39445
|
const knowledgePath = resolveSwarmKnowledgePath(directory);
|
|
39404
|
-
if (
|
|
39446
|
+
if (existsSync38(sentinelPath)) {
|
|
39405
39447
|
return {
|
|
39406
39448
|
migrated: false,
|
|
39407
39449
|
entriesMigrated: 0,
|
|
@@ -39410,7 +39452,7 @@ async function migrateContextToKnowledge(directory, config) {
|
|
|
39410
39452
|
skippedReason: "sentinel-exists"
|
|
39411
39453
|
};
|
|
39412
39454
|
}
|
|
39413
|
-
if (!
|
|
39455
|
+
if (!existsSync38(contextPath)) {
|
|
39414
39456
|
return {
|
|
39415
39457
|
migrated: false,
|
|
39416
39458
|
entriesMigrated: 0,
|
|
@@ -39502,7 +39544,7 @@ async function migrateHiveKnowledgeLegacy(config) {
|
|
|
39502
39544
|
const legacyHivePath = _internals56.resolveLegacyHiveKnowledgePath();
|
|
39503
39545
|
const canonicalHivePath = resolveHiveKnowledgePath2();
|
|
39504
39546
|
const sentinelPath = path65.join(path65.dirname(canonicalHivePath), ".hive-knowledge-migrated");
|
|
39505
|
-
if (
|
|
39547
|
+
if (existsSync38(sentinelPath)) {
|
|
39506
39548
|
return {
|
|
39507
39549
|
migrated: false,
|
|
39508
39550
|
entriesMigrated: 0,
|
|
@@ -39511,7 +39553,7 @@ async function migrateHiveKnowledgeLegacy(config) {
|
|
|
39511
39553
|
skippedReason: "sentinel-exists"
|
|
39512
39554
|
};
|
|
39513
39555
|
}
|
|
39514
|
-
if (!
|
|
39556
|
+
if (!existsSync38(legacyHivePath)) {
|
|
39515
39557
|
return {
|
|
39516
39558
|
migrated: false,
|
|
39517
39559
|
entriesMigrated: 0,
|
|
@@ -39713,7 +39755,7 @@ function truncateLesson2(text) {
|
|
|
39713
39755
|
}
|
|
39714
39756
|
function inferProjectName(directory) {
|
|
39715
39757
|
const packageJsonPath = path65.join(directory, "package.json");
|
|
39716
|
-
if (
|
|
39758
|
+
if (existsSync38(packageJsonPath)) {
|
|
39717
39759
|
try {
|
|
39718
39760
|
const pkg = JSON.parse(readFileSync29(packageJsonPath, "utf-8"));
|
|
39719
39761
|
if (pkg.name && typeof pkg.name === "string") {
|
|
@@ -40214,7 +40256,7 @@ init_schema();
|
|
|
40214
40256
|
|
|
40215
40257
|
// src/knowledge/family-migration.ts
|
|
40216
40258
|
var import_proper_lockfile6 = __toESM(require_proper_lockfile(), 1);
|
|
40217
|
-
import { existsSync as
|
|
40259
|
+
import { existsSync as existsSync39, readFileSync as readFileSync30 } from "fs";
|
|
40218
40260
|
import { mkdir as mkdir18 } from "fs/promises";
|
|
40219
40261
|
import * as path66 from "path";
|
|
40220
40262
|
|
|
@@ -40323,7 +40365,7 @@ var MIGRATION_LOCK_RETRIES = {
|
|
|
40323
40365
|
// src/knowledge/family-migration.ts
|
|
40324
40366
|
var DEDUP_THRESHOLD = 0.6;
|
|
40325
40367
|
function readJsonl2(filePath) {
|
|
40326
|
-
if (!
|
|
40368
|
+
if (!existsSync39(filePath))
|
|
40327
40369
|
return [];
|
|
40328
40370
|
try {
|
|
40329
40371
|
const content = readFileSync30(filePath, "utf-8");
|
|
@@ -40343,7 +40385,7 @@ function readJsonl2(filePath) {
|
|
|
40343
40385
|
}
|
|
40344
40386
|
}
|
|
40345
40387
|
function readJson(filePath) {
|
|
40346
|
-
if (!
|
|
40388
|
+
if (!existsSync39(filePath))
|
|
40347
40389
|
return null;
|
|
40348
40390
|
try {
|
|
40349
40391
|
return JSON.parse(readFileSync30(filePath, "utf-8"));
|
|
@@ -40851,7 +40893,7 @@ ${USAGE11}`;
|
|
|
40851
40893
|
|
|
40852
40894
|
// src/commands/memory.ts
|
|
40853
40895
|
init_loader();
|
|
40854
|
-
import { existsSync as
|
|
40896
|
+
import { existsSync as existsSync40 } from "fs";
|
|
40855
40897
|
import * as path70 from "path";
|
|
40856
40898
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
40857
40899
|
// src/memory/evaluation.ts
|
|
@@ -41425,7 +41467,7 @@ async function handleMemoryStatusCommand(directory, _args) {
|
|
|
41425
41467
|
`- Provider: \`${config.provider}\``,
|
|
41426
41468
|
`- Storage: \`${storageDir}\``,
|
|
41427
41469
|
`- SQLite path: \`${sqlitePath}\``,
|
|
41428
|
-
`- SQLite database exists: \`${
|
|
41470
|
+
`- SQLite database exists: \`${existsSync40(sqlitePath)}\``,
|
|
41429
41471
|
`- Automatic destructive cleanup: \`disabled\``,
|
|
41430
41472
|
"",
|
|
41431
41473
|
"### Legacy JSONL"
|
|
@@ -41910,7 +41952,7 @@ init_schema();
|
|
|
41910
41952
|
|
|
41911
41953
|
// src/memory/memory-family-migration.ts
|
|
41912
41954
|
var import_proper_lockfile7 = __toESM(require_proper_lockfile(), 1);
|
|
41913
|
-
import { copyFileSync as copyFileSync4, existsSync as
|
|
41955
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync41, readFileSync as readFileSync31, unlinkSync as unlinkSync12 } from "fs";
|
|
41914
41956
|
import { mkdir as mkdir21, rename as rename8 } from "fs/promises";
|
|
41915
41957
|
import * as path71 from "path";
|
|
41916
41958
|
init_logger();
|
|
@@ -41971,7 +42013,7 @@ var MIGRATED_MEMORY_FILENAMES = MEMORY_FAMILY.filter((m) => m.mergeStrategy !==
|
|
|
41971
42013
|
// src/memory/memory-family-migration.ts
|
|
41972
42014
|
var MAX_BACKUPS = 5;
|
|
41973
42015
|
function readJsonl3(filePath) {
|
|
41974
|
-
if (!
|
|
42016
|
+
if (!existsSync41(filePath))
|
|
41975
42017
|
return [];
|
|
41976
42018
|
try {
|
|
41977
42019
|
const content = readFileSync31(filePath, "utf-8");
|
|
@@ -42036,13 +42078,13 @@ function validateSerializedJsonl(serialized) {
|
|
|
42036
42078
|
}
|
|
42037
42079
|
function stageSqliteDb(sourceStoragePath, destDir) {
|
|
42038
42080
|
const sourceDbPath = path71.join(sourceStoragePath, "memory.db");
|
|
42039
|
-
if (!
|
|
42081
|
+
if (!existsSync41(sourceDbPath))
|
|
42040
42082
|
return null;
|
|
42041
42083
|
const stagedPath = path71.join(destDir, ".memory.db.stage");
|
|
42042
42084
|
copyFileSync4(sourceDbPath, stagedPath);
|
|
42043
42085
|
for (const suffix of ["-wal", "-shm"]) {
|
|
42044
42086
|
const sidecar = `${sourceDbPath}${suffix}`;
|
|
42045
|
-
if (
|
|
42087
|
+
if (existsSync41(sidecar)) {
|
|
42046
42088
|
try {
|
|
42047
42089
|
copyFileSync4(sidecar, `${stagedPath}${suffix}`);
|
|
42048
42090
|
} catch {}
|
|
@@ -42052,11 +42094,11 @@ function stageSqliteDb(sourceStoragePath, destDir) {
|
|
|
42052
42094
|
}
|
|
42053
42095
|
async function mergeStagedSqlite(destStoragePath, stagedPath) {
|
|
42054
42096
|
const destDbPath = path71.join(destStoragePath, "memory.db");
|
|
42055
|
-
if (!
|
|
42097
|
+
if (!existsSync41(destDbPath)) {
|
|
42056
42098
|
await rename8(stagedPath, destDbPath);
|
|
42057
42099
|
for (const suffix of ["-wal", "-shm"]) {
|
|
42058
42100
|
const stagedSidecar = `${stagedPath}${suffix}`;
|
|
42059
|
-
if (
|
|
42101
|
+
if (existsSync41(stagedSidecar)) {
|
|
42060
42102
|
try {
|
|
42061
42103
|
await rename8(stagedSidecar, `${destDbPath}${suffix}`);
|
|
42062
42104
|
} catch {}
|
|
@@ -42101,10 +42143,10 @@ async function mergeStagedSqlite(destStoragePath, stagedPath) {
|
|
|
42101
42143
|
} finally {
|
|
42102
42144
|
db.close();
|
|
42103
42145
|
try {
|
|
42104
|
-
|
|
42146
|
+
unlinkSync12(stagedPath);
|
|
42105
42147
|
for (const suffix of ["-wal", "-shm"]) {
|
|
42106
42148
|
try {
|
|
42107
|
-
|
|
42149
|
+
unlinkSync12(`${stagedPath}${suffix}`);
|
|
42108
42150
|
} catch {}
|
|
42109
42151
|
}
|
|
42110
42152
|
} catch {}
|
|
@@ -42147,7 +42189,7 @@ async function migrateMemoryFamily(destRoot, sourceRoot) {
|
|
|
42147
42189
|
const srcPath = path71.join(sourceStoragePath, member.filename);
|
|
42148
42190
|
const destPath = path71.join(destStoragePath, member.filename);
|
|
42149
42191
|
if (member.mergeStrategy === "sqlite-file-copy") {
|
|
42150
|
-
if (!
|
|
42192
|
+
if (!existsSync41(srcPath)) {
|
|
42151
42193
|
perMember.push({ filename: member.filename, merged: 0, skipped: 0 });
|
|
42152
42194
|
continue;
|
|
42153
42195
|
}
|
|
@@ -42161,7 +42203,7 @@ async function migrateMemoryFamily(destRoot, sourceRoot) {
|
|
|
42161
42203
|
continue;
|
|
42162
42204
|
}
|
|
42163
42205
|
if (member.mergeStrategy === "append-union") {
|
|
42164
|
-
if (!
|
|
42206
|
+
if (!existsSync41(srcPath)) {
|
|
42165
42207
|
perMember.push({ filename: member.filename, merged: 0, skipped: 0 });
|
|
42166
42208
|
continue;
|
|
42167
42209
|
}
|
|
@@ -42181,7 +42223,7 @@ async function migrateMemoryFamily(destRoot, sourceRoot) {
|
|
|
42181
42223
|
await mkdir21(backupDir, { recursive: true });
|
|
42182
42224
|
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
42183
42225
|
const sourceDbPath = path71.join(sourceStoragePath, "memory.db");
|
|
42184
|
-
if (
|
|
42226
|
+
if (existsSync41(sourceDbPath)) {
|
|
42185
42227
|
try {
|
|
42186
42228
|
copyFileSync4(sourceDbPath, path71.join(backupDir, `memory.db.pre-merge-${stamp}`));
|
|
42187
42229
|
} catch {}
|
|
@@ -54128,7 +54170,7 @@ async function handleSddCommand(_directory, _args) {
|
|
|
54128
54170
|
}
|
|
54129
54171
|
|
|
54130
54172
|
// src/commands/simulate.ts
|
|
54131
|
-
import { renameSync as
|
|
54173
|
+
import { renameSync as renameSync15, unlinkSync as unlinkSync19 } from "fs";
|
|
54132
54174
|
async function handleSimulateCommand(directory, args) {
|
|
54133
54175
|
const thresholdIndex = args.indexOf("--threshold");
|
|
54134
54176
|
const minCommitsIndex = args.indexOf("--min-commits");
|
|
@@ -54183,10 +54225,10 @@ Ensure this is a git repository with commit history.`;
|
|
|
54183
54225
|
const reportTempPath = path91.join(path91.dirname(reportPath), `${path91.basename(reportPath)}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`);
|
|
54184
54226
|
try {
|
|
54185
54227
|
await fs45.writeFile(reportTempPath, report, "utf-8");
|
|
54186
|
-
|
|
54228
|
+
renameSync15(reportTempPath, reportPath);
|
|
54187
54229
|
} catch (err) {
|
|
54188
54230
|
try {
|
|
54189
|
-
|
|
54231
|
+
unlinkSync19(reportTempPath);
|
|
54190
54232
|
} catch {}
|
|
54191
54233
|
throw err;
|
|
54192
54234
|
}
|
|
@@ -54199,16 +54241,16 @@ Ensure this is a git repository with commit history.`;
|
|
|
54199
54241
|
|
|
54200
54242
|
// src/commands/skill-opt.ts
|
|
54201
54243
|
init_schema();
|
|
54202
|
-
import { copyFileSync as copyFileSync5, existsSync as
|
|
54244
|
+
import { copyFileSync as copyFileSync5, existsSync as existsSync57, mkdirSync as mkdirSync29, readFileSync as readFileSync42 } from "fs";
|
|
54203
54245
|
import * as path97 from "path";
|
|
54204
54246
|
|
|
54205
54247
|
// src/services/skill-optimizer/activation.ts
|
|
54206
54248
|
import {
|
|
54207
|
-
existsSync as
|
|
54249
|
+
existsSync as existsSync53,
|
|
54208
54250
|
mkdirSync as mkdirSync26,
|
|
54209
54251
|
readFileSync as readFileSync39,
|
|
54210
|
-
renameSync as
|
|
54211
|
-
unlinkSync as
|
|
54252
|
+
renameSync as renameSync17,
|
|
54253
|
+
unlinkSync as unlinkSync21,
|
|
54212
54254
|
writeFileSync as writeFileSync17
|
|
54213
54255
|
} from "fs";
|
|
54214
54256
|
import * as path92 from "path";
|
|
@@ -54217,14 +54259,14 @@ import * as path92 from "path";
|
|
|
54217
54259
|
import { createHash as createHash18, randomUUID as randomUUID11 } from "crypto";
|
|
54218
54260
|
import {
|
|
54219
54261
|
closeSync as closeSync13,
|
|
54220
|
-
existsSync as
|
|
54262
|
+
existsSync as existsSync52,
|
|
54221
54263
|
fsyncSync as fsyncSync3,
|
|
54222
54264
|
mkdirSync as mkdirSync25,
|
|
54223
54265
|
openSync as openSync13,
|
|
54224
54266
|
readFileSync as readFileSync38,
|
|
54225
|
-
renameSync as
|
|
54267
|
+
renameSync as renameSync16,
|
|
54226
54268
|
statSync as statSync16,
|
|
54227
|
-
unlinkSync as
|
|
54269
|
+
unlinkSync as unlinkSync20,
|
|
54228
54270
|
writeFileSync as writeFileSync16,
|
|
54229
54271
|
writeFileSync as writeFileSyncAsync
|
|
54230
54272
|
} from "fs";
|
|
@@ -54284,7 +54326,7 @@ function stateProjectionPath(directory, skillSlug, candidateId2) {
|
|
|
54284
54326
|
}
|
|
54285
54327
|
function ensureCandidateDir(directory, skillSlug, candidateId2) {
|
|
54286
54328
|
const dir = candidateDir(directory, skillSlug, candidateId2);
|
|
54287
|
-
if (!
|
|
54329
|
+
if (!existsSync52(dir))
|
|
54288
54330
|
mkdirSync25(dir, { recursive: true });
|
|
54289
54331
|
return dir;
|
|
54290
54332
|
}
|
|
@@ -54297,10 +54339,10 @@ function writeFileFsyncedThenRename(tempPath, targetPath, data) {
|
|
|
54297
54339
|
closeSync13(fd);
|
|
54298
54340
|
}
|
|
54299
54341
|
try {
|
|
54300
|
-
|
|
54342
|
+
renameSync16(tempPath, targetPath);
|
|
54301
54343
|
} catch (err) {
|
|
54302
54344
|
try {
|
|
54303
|
-
|
|
54345
|
+
unlinkSync20(tempPath);
|
|
54304
54346
|
} catch {}
|
|
54305
54347
|
throw err;
|
|
54306
54348
|
}
|
|
@@ -54310,9 +54352,9 @@ var _internals79 = {
|
|
|
54310
54352
|
writeFileFsyncedThenRename,
|
|
54311
54353
|
writeFileSync: writeFileSyncAsync,
|
|
54312
54354
|
readFileSync: readFileSync38,
|
|
54313
|
-
renameSync:
|
|
54314
|
-
unlinkSync:
|
|
54315
|
-
existsSync:
|
|
54355
|
+
renameSync: renameSync16,
|
|
54356
|
+
unlinkSync: unlinkSync20,
|
|
54357
|
+
existsSync: existsSync52,
|
|
54316
54358
|
statSync: statSync16
|
|
54317
54359
|
};
|
|
54318
54360
|
async function appendEvent2(directory, eventInput) {
|
|
@@ -54326,7 +54368,7 @@ async function appendEvent2(directory, eventInput) {
|
|
|
54326
54368
|
const filePath = ledgerPath(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
54327
54369
|
return _internals79.withEvidenceLock(directory, path91.join(".swarm", "evolution", "skills", eventInput.skillSlug, eventInput.candidateId, "lifecycle.jsonl"), "skill-opt-ledger", "append-skill-opt-event", async () => {
|
|
54328
54370
|
ensureCandidateDir(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
54329
|
-
const existing =
|
|
54371
|
+
const existing = existsSync52(filePath) ? readFileSync38(filePath, "utf8") : "";
|
|
54330
54372
|
const events = parseEventsFromText(existing);
|
|
54331
54373
|
const nextSeq = events.length === 0 ? 1 : events[events.length - 1].seq + 1;
|
|
54332
54374
|
const lastEvent = events.length === 0 ? null : events[events.length - 1];
|
|
@@ -54384,7 +54426,7 @@ function parseEventsFromText(text) {
|
|
|
54384
54426
|
}
|
|
54385
54427
|
function replayCandidate(directory, skillSlug, candidateId2) {
|
|
54386
54428
|
const filePath = ledgerPath(directory, skillSlug, candidateId2);
|
|
54387
|
-
if (!
|
|
54429
|
+
if (!existsSync52(filePath)) {
|
|
54388
54430
|
return {
|
|
54389
54431
|
events: [],
|
|
54390
54432
|
state: null,
|
|
@@ -54438,7 +54480,7 @@ function replayCandidate(directory, skillSlug, candidateId2) {
|
|
|
54438
54480
|
function quarantineSuffix(directory, skillSlug, badSuffix) {
|
|
54439
54481
|
assertProjectRoot(directory);
|
|
54440
54482
|
const dir = path91.join(directory, ".swarm", "evolution", "skills");
|
|
54441
|
-
if (!
|
|
54483
|
+
if (!existsSync52(dir))
|
|
54442
54484
|
mkdirSync25(dir, { recursive: true });
|
|
54443
54485
|
const hash = computeStateHash(badSuffix).slice(0, 12);
|
|
54444
54486
|
const stamp = Date.now();
|
|
@@ -54474,7 +54516,7 @@ function writeArtifact(directory, skillSlug, candidateId2, fileName, content) {
|
|
|
54474
54516
|
}
|
|
54475
54517
|
function readArtifact(directory, skillSlug, candidateId2, fileName) {
|
|
54476
54518
|
const target = path91.join(candidateDir(directory, skillSlug, candidateId2), fileName);
|
|
54477
|
-
if (!
|
|
54519
|
+
if (!existsSync52(target))
|
|
54478
54520
|
return null;
|
|
54479
54521
|
return readFileSync38(target, "utf8");
|
|
54480
54522
|
}
|
|
@@ -54566,19 +54608,19 @@ function writeSkillFileAtomic(targetPath, content) {
|
|
|
54566
54608
|
_internals80.renameSync(tempPath, targetPath);
|
|
54567
54609
|
} finally {
|
|
54568
54610
|
try {
|
|
54569
|
-
if (
|
|
54611
|
+
if (existsSync53(tempPath))
|
|
54570
54612
|
_internals80.unlinkSync(tempPath);
|
|
54571
54613
|
} catch {}
|
|
54572
54614
|
}
|
|
54573
54615
|
}
|
|
54574
54616
|
var _internals80 = {
|
|
54575
54617
|
writeFileSync: writeFileSync17,
|
|
54576
|
-
renameSync:
|
|
54577
|
-
unlinkSync:
|
|
54618
|
+
renameSync: renameSync17,
|
|
54619
|
+
unlinkSync: unlinkSync21
|
|
54578
54620
|
};
|
|
54579
54621
|
async function activateCandidate(input) {
|
|
54580
54622
|
const skillPath = path92.join(input.directory, ".opencode", "skills", "generated", input.skillSlug, "SKILL.md");
|
|
54581
|
-
const incumbent =
|
|
54623
|
+
const incumbent = existsSync53(skillPath) ? readFileSync39(skillPath, "utf8") : "";
|
|
54582
54624
|
const currentHash = computeContentHash2(incumbent);
|
|
54583
54625
|
if (currentHash !== input.expectedContentHash) {
|
|
54584
54626
|
return {
|
|
@@ -54605,7 +54647,7 @@ async function activateCandidate(input) {
|
|
|
54605
54647
|
}
|
|
54606
54648
|
const rollbackSnapshotRef = writeArtifact(input.directory, input.skillSlug, input.candidateId, "rollback.md", incumbent);
|
|
54607
54649
|
const skillRoot = path92.dirname(skillPath);
|
|
54608
|
-
if (!
|
|
54650
|
+
if (!existsSync53(skillRoot))
|
|
54609
54651
|
mkdirSync26(skillRoot, { recursive: true });
|
|
54610
54652
|
writeSkillFileAtomic(skillPath, candidateContent);
|
|
54611
54653
|
await recordTransition({
|
|
@@ -54644,7 +54686,7 @@ async function rollbackCandidate(input) {
|
|
|
54644
54686
|
};
|
|
54645
54687
|
}
|
|
54646
54688
|
const skillPath = path92.join(input.directory, ".opencode", "skills", "generated", input.skillSlug, "SKILL.md");
|
|
54647
|
-
const beforeContent =
|
|
54689
|
+
const beforeContent = existsSync53(skillPath) ? readFileSync39(skillPath, "utf8") : "";
|
|
54648
54690
|
writeSkillFileAtomic(skillPath, snapshot);
|
|
54649
54691
|
await recordTransition({
|
|
54650
54692
|
directory: input.directory,
|
|
@@ -54663,7 +54705,7 @@ async function rollbackCandidate(input) {
|
|
|
54663
54705
|
|
|
54664
54706
|
// src/services/skill-optimizer/controller.ts
|
|
54665
54707
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
54666
|
-
import { existsSync as
|
|
54708
|
+
import { existsSync as existsSync55, mkdirSync as mkdirSync27, readFileSync as readFileSync41, writeFileSync as writeFileSync18 } from "fs";
|
|
54667
54709
|
import * as path95 from "path";
|
|
54668
54710
|
|
|
54669
54711
|
// src/evaluation/pr-review-recovery.ts
|
|
@@ -55135,7 +55177,7 @@ async function deterministicSeed(input) {
|
|
|
55135
55177
|
}
|
|
55136
55178
|
|
|
55137
55179
|
// src/services/skill-optimizer/smoke.ts
|
|
55138
|
-
import { existsSync as
|
|
55180
|
+
import { existsSync as existsSync54, lstatSync as lstatSync9, readFileSync as readFileSync40, realpathSync as realpathSync13 } from "fs";
|
|
55139
55181
|
import * as path94 from "path";
|
|
55140
55182
|
|
|
55141
55183
|
// src/hooks/spawn-helper.ts
|
|
@@ -55244,7 +55286,7 @@ async function validateSkillSmoke(input) {
|
|
|
55244
55286
|
};
|
|
55245
55287
|
}
|
|
55246
55288
|
const skillRoot = path94.join(input.directory, ".opencode", "skills", "generated", input.skillSlug);
|
|
55247
|
-
if (
|
|
55289
|
+
if (existsSync54(skillRoot)) {
|
|
55248
55290
|
if (_internals83.isSymbolicLink(skillRoot)) {
|
|
55249
55291
|
return {
|
|
55250
55292
|
ok: false,
|
|
@@ -55330,7 +55372,7 @@ function checkFrontmatter(content) {
|
|
|
55330
55372
|
}
|
|
55331
55373
|
function readIncumbentContent(directory, skillSlug) {
|
|
55332
55374
|
const incumbent = path94.join(directory, ".opencode", "skills", "generated", skillSlug, "SKILL.md");
|
|
55333
|
-
if (!
|
|
55375
|
+
if (!existsSync54(incumbent))
|
|
55334
55376
|
return "";
|
|
55335
55377
|
try {
|
|
55336
55378
|
return readFileSync40(incumbent, "utf8");
|
|
@@ -55344,7 +55386,7 @@ var PROJECT_LOCK_PATH = path95.join(".swarm", "evolution", "skills", ".run.lock"
|
|
|
55344
55386
|
var CONVERGENCE_FILE = path95.join(".swarm", "evolution", "skills", ".convergence.json");
|
|
55345
55387
|
async function prepareCandidatePayloads(inputRoot, candidateId2, skillSlug, baselineModel, candidateModel, baselineContent, candidateContent) {
|
|
55346
55388
|
const payloadSubdir = path95.join(inputRoot, "candidates", candidateId2);
|
|
55347
|
-
if (!
|
|
55389
|
+
if (!existsSync55(payloadSubdir))
|
|
55348
55390
|
mkdirSync27(payloadSubdir, { recursive: true });
|
|
55349
55391
|
const baselinePayloadRel = path95.join("candidates", candidateId2, "baseline.md");
|
|
55350
55392
|
const candidatePayloadRel = path95.join("candidates", candidateId2, "candidate.md");
|
|
@@ -55670,7 +55712,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
55670
55712
|
}
|
|
55671
55713
|
function readConvergenceState(directory) {
|
|
55672
55714
|
const file = path95.join(directory, CONVERGENCE_FILE);
|
|
55673
|
-
if (!
|
|
55715
|
+
if (!existsSync55(file))
|
|
55674
55716
|
return { nonImprovements: 0 };
|
|
55675
55717
|
try {
|
|
55676
55718
|
return JSON.parse(readFileSync41(file, "utf8"));
|
|
@@ -55681,7 +55723,7 @@ function readConvergenceState(directory) {
|
|
|
55681
55723
|
function writeConvergenceState(directory, nonImprovements) {
|
|
55682
55724
|
assertProjectRoot(directory);
|
|
55683
55725
|
const dir = path95.dirname(path95.join(directory, CONVERGENCE_FILE));
|
|
55684
|
-
if (!
|
|
55726
|
+
if (!existsSync55(dir))
|
|
55685
55727
|
mkdirSync27(dir, { recursive: true });
|
|
55686
55728
|
writeFileSync18(path95.join(directory, CONVERGENCE_FILE), JSON.stringify({ nonImprovements }), "utf8");
|
|
55687
55729
|
}
|
|
@@ -55738,7 +55780,7 @@ async function runOptimizationLoop(input) {
|
|
|
55738
55780
|
}
|
|
55739
55781
|
|
|
55740
55782
|
// src/services/skill-optimizer/skill-eval-tasks.ts
|
|
55741
|
-
import { existsSync as
|
|
55783
|
+
import { existsSync as existsSync56, mkdirSync as mkdirSync28, writeFileSync as writeFileSync19 } from "fs";
|
|
55742
55784
|
import * as path96 from "path";
|
|
55743
55785
|
var DEFAULT_SKILL_EVAL_TASKS = [
|
|
55744
55786
|
{
|
|
@@ -55780,7 +55822,7 @@ function buildSkillEvalTasks(args) {
|
|
|
55780
55822
|
const result = [];
|
|
55781
55823
|
for (const spec of tasks) {
|
|
55782
55824
|
const taskDir = path96.join(args.inputRoot, "skill-eval", spec.id);
|
|
55783
|
-
if (!
|
|
55825
|
+
if (!existsSync56(taskDir))
|
|
55784
55826
|
mkdirSync28(taskDir, { recursive: true });
|
|
55785
55827
|
const instructionPath = path96.join("skill-eval", spec.id, "instruction.md");
|
|
55786
55828
|
writeFileSync19(path96.join(args.inputRoot, instructionPath), `${spec.instruction}
|
|
@@ -55879,7 +55921,7 @@ ${JSON.stringify(result, null, 2)}
|
|
|
55879
55921
|
function readSkillOptConfigFromProject(directory) {
|
|
55880
55922
|
try {
|
|
55881
55923
|
const cfgPath = path97.join(directory, "opencode.json");
|
|
55882
|
-
if (!
|
|
55924
|
+
if (!existsSync57(cfgPath))
|
|
55883
55925
|
return { ...DEFAULT_SKILL_OPT_CONFIG };
|
|
55884
55926
|
const raw = JSON.parse(readFileSync42(cfgPath, "utf8"));
|
|
55885
55927
|
const block = raw?.skill_opt ?? raw?.swarm?.skill_opt;
|
|
@@ -55929,14 +55971,14 @@ async function handleSkillOptRun(directory, args, runtime = {}) {
|
|
|
55929
55971
|
}
|
|
55930
55972
|
const models = parsed.models.length > 0 ? parsed.models : ["default"];
|
|
55931
55973
|
const inputRoot = path97.join(directory, ".swarm", "evolution", "skills", "_eval-input");
|
|
55932
|
-
if (!
|
|
55974
|
+
if (!existsSync57(inputRoot))
|
|
55933
55975
|
mkdirSync29(inputRoot, { recursive: true });
|
|
55934
55976
|
const scorerDir = path97.join(inputRoot, "scoring");
|
|
55935
|
-
if (!
|
|
55977
|
+
if (!existsSync57(scorerDir))
|
|
55936
55978
|
mkdirSync29(scorerDir, { recursive: true });
|
|
55937
55979
|
const scorerSource = path97.join(directory, "evaluation-fixtures", "skill-eval", "scoring", "score-skill-eval.cjs");
|
|
55938
55980
|
const scorerDest = path97.join(scorerDir, "score-skill-eval.cjs");
|
|
55939
|
-
if (
|
|
55981
|
+
if (existsSync57(scorerSource)) {
|
|
55940
55982
|
copyFileSync5(scorerSource, scorerDest);
|
|
55941
55983
|
}
|
|
55942
55984
|
const scorerRelPath = path97.join("scoring", "score-skill-eval.cjs");
|
|
@@ -57426,7 +57468,7 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
57426
57468
|
async function handleHelpCommand(ctx) {
|
|
57427
57469
|
const targetCommand = ctx.args.join(" ");
|
|
57428
57470
|
if (!targetCommand) {
|
|
57429
|
-
const { buildHelpText } = await import("./index-
|
|
57471
|
+
const { buildHelpText } = await import("./index-tj18fe58.js");
|
|
57430
57472
|
return buildHelpText();
|
|
57431
57473
|
}
|
|
57432
57474
|
const tokens = targetCommand.split(/\s+/);
|
|
@@ -57435,7 +57477,7 @@ async function handleHelpCommand(ctx) {
|
|
|
57435
57477
|
return _internals87.buildDetailedHelp(resolved.key, resolved.entry);
|
|
57436
57478
|
}
|
|
57437
57479
|
const similar = _internals87.findSimilarCommands(targetCommand);
|
|
57438
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
57480
|
+
const { buildHelpText: fullHelp } = await import("./index-tj18fe58.js");
|
|
57439
57481
|
if (similar.length > 0) {
|
|
57440
57482
|
return `Command '/swarm ${targetCommand}' not found.
|
|
57441
57483
|
|
|
@@ -57612,7 +57654,7 @@ var COMMAND_REGISTRY = {
|
|
|
57612
57654
|
},
|
|
57613
57655
|
"guardrail explain": {
|
|
57614
57656
|
handler: async (ctx) => {
|
|
57615
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
57657
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-49vn7rv6.js");
|
|
57616
57658
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
57617
57659
|
},
|
|
57618
57660
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -57622,7 +57664,7 @@ var COMMAND_REGISTRY = {
|
|
|
57622
57664
|
},
|
|
57623
57665
|
"guardrail-explain": {
|
|
57624
57666
|
handler: async (ctx) => {
|
|
57625
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
57667
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-49vn7rv6.js");
|
|
57626
57668
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
57627
57669
|
},
|
|
57628
57670
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -57632,7 +57674,7 @@ var COMMAND_REGISTRY = {
|
|
|
57632
57674
|
},
|
|
57633
57675
|
"guardrail-log": {
|
|
57634
57676
|
handler: async (ctx) => {
|
|
57635
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
57677
|
+
const { handleGuardrailLog } = await import("./guardrail-log-ghymef5s.js");
|
|
57636
57678
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
57637
57679
|
},
|
|
57638
57680
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -59326,6 +59368,13 @@ Every loaded mode skill is written with active-swarm role phrases. Before follow
|
|
|
59326
59368
|
|
|
59327
59369
|
Do not delegate to the literal natural-language phrase. Delegate only to the concrete rendered agent name for the active swarm.
|
|
59328
59370
|
|
|
59371
|
+
### SKILL LOADING (self-load protocol for MODE actions)
|
|
59372
|
+
When a MODE section says "ACTION: Load skill file:<path>", load the skill yourself using the search tool:
|
|
59373
|
+
- Strip the \`file:\` prefix to get the repo-relative path.
|
|
59374
|
+
- Call the search tool with \`include\` set to that exact repo-relative path, \`mode: regex\`, \`query: .*\`, \`max_results: 10000\`, and \`max_lines: 10000\`.
|
|
59375
|
+
- If \`total === 0\` (file does not exist or is empty) OR \`truncated\` is \`true\` (the file exceeded even \`max_results: 10000\`), report \`SKILL_LOAD_FAILED: <path>\`, stop, and ask the user how to proceed. Do NOT continue without the complete skill and do NOT substitute a partial or improvised protocol.
|
|
59376
|
+
- If the search result has \`total > 0\` and \`truncated\` is \`false\`, reconstruct the full skill content from the line-by-line matches and follow the loaded protocol.
|
|
59377
|
+
|
|
59329
59378
|
### MODE: BRAINSTORM
|
|
59330
59379
|
Activates when: user invokes /swarm brainstorm, uses brainstorm-style phrasing, or the problem is exploratory and requirements need structured dialogue.
|
|
59331
59380
|
|
|
@@ -60863,7 +60912,7 @@ ACCEPTANCE HANDLING: ACCEPTANCE is the authoritative definition of "done" for th
|
|
|
60863
60912
|
|
|
60864
60913
|
SKILLS HANDLING: If SKILLS is present and not "none", read the skill names/descriptions first, then load every referenced skill that applies before beginning your review. If uncertain whether a skill applies, load it.
|
|
60865
60914
|
- A file entry may include a short description after the path; use the description to decide whether the full skill body is relevant.
|
|
60866
|
-
- For \`file:\` entries, use the search tool to read the referenced \`SKILL.md\` file with \`include\` set to that exact repo-relative path, \`mode: regex\`, \`query: .*\`, \`max_results:
|
|
60915
|
+
- For \`file:\` entries, use the search tool to read the referenced \`SKILL.md\` file with \`include\` set to that exact repo-relative path, \`mode: regex\`, \`query: .*\`, \`max_results: 10000\`, and \`max_lines: 10000\`.
|
|
60867
60916
|
- After running search, inspect the result: if \`total === 0\` (file does not exist or is empty) OR \`truncated\` is \`true\` (file was too large and content was cut off), stop and report \`SKILL_LOAD_FAILED: <path>\`. Do NOT continue without the complete skill.
|
|
60868
60917
|
- If the search result has \`total > 0\` and \`truncated\` is \`false\`, reconstruct the full skill content from the line-by-line matches and apply it.
|
|
60869
60918
|
- If inline \`--- skill-name ---\` sections are present, read them directly.
|
|
@@ -61006,7 +61055,7 @@ SKILLS: [optional \u2014 either "none", repo-relative file: references (preferre
|
|
|
61006
61055
|
|
|
61007
61056
|
SKILLS HANDLING: If SKILLS is present and not "none", read the skill names/descriptions first, then load every referenced skill that applies before formulating your recommendation. If uncertain whether a skill applies, load it.
|
|
61008
61057
|
- A file entry may include a short description after the path; use the description to decide whether the full skill body is relevant.
|
|
61009
|
-
- For \`file:\` entries, use the search tool to read the referenced \`SKILL.md\` file with \`include\` set to that exact repo-relative path, \`mode: regex\`, \`query: .*\`, \`max_results:
|
|
61058
|
+
- For \`file:\` entries, use the search tool to read the referenced \`SKILL.md\` file with \`include\` set to that exact repo-relative path, \`mode: regex\`, \`query: .*\`, \`max_results: 10000\`, and \`max_lines: 10000\`.
|
|
61010
61059
|
- After running search, inspect the result: if \`total === 0\` (file does not exist or is empty) OR \`truncated\` is \`true\` (file was too large and content was cut off), stop and report \`SKILL_LOAD_FAILED: <path>\`. Do NOT continue without the complete skill.
|
|
61011
61060
|
- If the search result has \`total > 0\` and \`truncated\` is \`false\`, reconstruct the full skill content from the line-by-line matches and apply it.
|
|
61012
61061
|
- If inline \`--- skill-name ---\` sections are present, read them directly.
|
|
@@ -64983,7 +65032,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
64983
65032
|
const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, provisionResult.worktreePath);
|
|
64984
65033
|
if (laneProfile) {
|
|
64985
65034
|
try {
|
|
64986
|
-
const { writeLaneProfileToDiskReal } = await import("./core-
|
|
65035
|
+
const { writeLaneProfileToDiskReal } = await import("./core-gfk2tsre.js");
|
|
64987
65036
|
await writeLaneProfileToDiskReal(provisionResult.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
|
|
64988
65037
|
} catch {}
|
|
64989
65038
|
}
|
|
@@ -65482,7 +65531,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
65482
65531
|
}
|
|
65483
65532
|
clearWorktreeMergeStatus(statusKey);
|
|
65484
65533
|
try {
|
|
65485
|
-
const { removeLaneProfileFromDiskReal } = await import("./core-
|
|
65534
|
+
const { removeLaneProfileFromDiskReal } = await import("./core-gfk2tsre.js");
|
|
65486
65535
|
await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
|
|
65487
65536
|
} catch {}
|
|
65488
65537
|
const state = serializationStateBySessionID.get(dispatch.parentSessionID);
|