opencode-swarm 7.26.1 → 7.26.2
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/index.js +1 -1
- package/dist/index.js +111 -60
- package/dist/plan/checkpoint.d.ts +10 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var package_default;
|
|
|
34
34
|
var init_package = __esm(() => {
|
|
35
35
|
package_default = {
|
|
36
36
|
name: "opencode-swarm",
|
|
37
|
-
version: "7.26.
|
|
37
|
+
version: "7.26.2",
|
|
38
38
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
39
39
|
main: "dist/index.js",
|
|
40
40
|
types: "dist/index.d.ts",
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var package_default;
|
|
|
33
33
|
var init_package = __esm(() => {
|
|
34
34
|
package_default = {
|
|
35
35
|
name: "opencode-swarm",
|
|
36
|
-
version: "7.26.
|
|
36
|
+
version: "7.26.2",
|
|
37
37
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
38
38
|
main: "dist/index.js",
|
|
39
39
|
types: "dist/index.d.ts",
|
|
@@ -73572,7 +73572,7 @@ var init_curator_drift = __esm(() => {
|
|
|
73572
73572
|
var exports_project_context = {};
|
|
73573
73573
|
__export(exports_project_context, {
|
|
73574
73574
|
buildProjectContext: () => buildProjectContext,
|
|
73575
|
-
_internals: () =>
|
|
73575
|
+
_internals: () => _internals57,
|
|
73576
73576
|
LANG_BACKEND_DETECTION_TIMEOUT_MS: () => LANG_BACKEND_DETECTION_TIMEOUT_MS
|
|
73577
73577
|
});
|
|
73578
73578
|
import * as fs112 from "node:fs";
|
|
@@ -73656,7 +73656,7 @@ function selectLintCommand(backend, directory) {
|
|
|
73656
73656
|
return null;
|
|
73657
73657
|
}
|
|
73658
73658
|
async function buildProjectContext(directory) {
|
|
73659
|
-
const backend = await
|
|
73659
|
+
const backend = await _internals57.pickBackend(directory);
|
|
73660
73660
|
if (!backend)
|
|
73661
73661
|
return null;
|
|
73662
73662
|
const ctx = emptyProjectContext();
|
|
@@ -73687,16 +73687,16 @@ async function buildProjectContext(directory) {
|
|
|
73687
73687
|
if (backend.prompts.reviewerChecklist.length > 0) {
|
|
73688
73688
|
ctx.REVIEWER_CHECKLIST = bulletList(backend.prompts.reviewerChecklist);
|
|
73689
73689
|
}
|
|
73690
|
-
const profiles =
|
|
73690
|
+
const profiles = _internals57.pickedProfiles(directory);
|
|
73691
73691
|
if (profiles.length > 1) {
|
|
73692
73692
|
ctx.PROJECT_CONTEXT_SECONDARY_LANGUAGES = profiles.slice(1).map((p) => p.id).join(", ");
|
|
73693
73693
|
}
|
|
73694
73694
|
return ctx;
|
|
73695
73695
|
}
|
|
73696
|
-
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300,
|
|
73696
|
+
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300, _internals57;
|
|
73697
73697
|
var init_project_context = __esm(() => {
|
|
73698
73698
|
init_dispatch();
|
|
73699
|
-
|
|
73699
|
+
_internals57 = {
|
|
73700
73700
|
pickBackend,
|
|
73701
73701
|
pickedProfiles
|
|
73702
73702
|
};
|
|
@@ -92261,10 +92261,61 @@ async function writeCheckpoint(directory) {
|
|
|
92261
92261
|
fs81.writeFileSync(jsonPath, JSON.stringify(plan, null, 2), "utf8");
|
|
92262
92262
|
const md = derivePlanMarkdown(plan);
|
|
92263
92263
|
fs81.writeFileSync(mdPath, md, "utf8");
|
|
92264
|
+
for (const legacyPath of [
|
|
92265
|
+
path108.join(directory, "SWARM_PLAN.json"),
|
|
92266
|
+
path108.join(directory, "SWARM_PLAN.md")
|
|
92267
|
+
]) {
|
|
92268
|
+
try {
|
|
92269
|
+
if (_internals43.existsSyncForCleanup(legacyPath)) {
|
|
92270
|
+
_internals43.unlinkSyncForCleanup(legacyPath);
|
|
92271
|
+
}
|
|
92272
|
+
} catch {}
|
|
92273
|
+
}
|
|
92264
92274
|
} catch (error93) {
|
|
92265
92275
|
console.warn(`[checkpoint] Failed to write SWARM_PLAN checkpoint: ${error93 instanceof Error ? error93.message : String(error93)}`);
|
|
92266
92276
|
}
|
|
92267
92277
|
}
|
|
92278
|
+
async function importCheckpoint(directory, source) {
|
|
92279
|
+
try {
|
|
92280
|
+
const swarmDirPath = path108.join(directory, ".swarm", "SWARM_PLAN.json");
|
|
92281
|
+
const rootPath = path108.join(directory, "SWARM_PLAN.json");
|
|
92282
|
+
let checkpointPath;
|
|
92283
|
+
let rawContent;
|
|
92284
|
+
if (fs81.existsSync(swarmDirPath)) {
|
|
92285
|
+
checkpointPath = swarmDirPath;
|
|
92286
|
+
rawContent = fs81.readFileSync(checkpointPath, "utf8");
|
|
92287
|
+
} else if (fs81.existsSync(rootPath)) {
|
|
92288
|
+
checkpointPath = rootPath;
|
|
92289
|
+
rawContent = fs81.readFileSync(checkpointPath, "utf8");
|
|
92290
|
+
console.warn("[checkpoint] importCheckpoint: using legacy root-level SWARM_PLAN.json. Consider running /swarm close to migrate.");
|
|
92291
|
+
} else {
|
|
92292
|
+
return {
|
|
92293
|
+
success: false,
|
|
92294
|
+
error: "SWARM_PLAN.json not found in .swarm/ or project root"
|
|
92295
|
+
};
|
|
92296
|
+
}
|
|
92297
|
+
const parsed = JSON.parse(rawContent);
|
|
92298
|
+
const plan = PlanSchema.parse(parsed);
|
|
92299
|
+
await savePlanWithAutoAcknowledgedRemovals(directory, plan, "import_checkpoint", "import external checkpoint");
|
|
92300
|
+
await appendLedgerEvent(directory, {
|
|
92301
|
+
event_type: "plan_rebuilt",
|
|
92302
|
+
source: source ?? "external_reseed",
|
|
92303
|
+
plan_id: derivePlanId(plan)
|
|
92304
|
+
});
|
|
92305
|
+
return { success: true, plan };
|
|
92306
|
+
} catch (error93) {
|
|
92307
|
+
return {
|
|
92308
|
+
success: false,
|
|
92309
|
+
error: error93 instanceof Error ? error93.message : String(error93)
|
|
92310
|
+
};
|
|
92311
|
+
}
|
|
92312
|
+
}
|
|
92313
|
+
var _internals43 = {
|
|
92314
|
+
writeCheckpoint,
|
|
92315
|
+
importCheckpoint,
|
|
92316
|
+
existsSyncForCleanup: fs81.existsSync,
|
|
92317
|
+
unlinkSyncForCleanup: fs81.unlinkSync
|
|
92318
|
+
};
|
|
92268
92319
|
|
|
92269
92320
|
// src/tools/phase-complete.ts
|
|
92270
92321
|
init_ledger();
|
|
@@ -92467,7 +92518,7 @@ function listLaneEvidenceSync(directory, phase) {
|
|
|
92467
92518
|
}
|
|
92468
92519
|
return laneIds;
|
|
92469
92520
|
}
|
|
92470
|
-
var
|
|
92521
|
+
var _internals44 = {
|
|
92471
92522
|
listActiveLocks,
|
|
92472
92523
|
readPersisted: readPersisted2,
|
|
92473
92524
|
readPlanJson: defaultReadPlanJson,
|
|
@@ -92528,7 +92579,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
92528
92579
|
reason: "Lean Turbo state unreadable or missing"
|
|
92529
92580
|
};
|
|
92530
92581
|
}
|
|
92531
|
-
const persisted =
|
|
92582
|
+
const persisted = _internals44.readPersisted(directory);
|
|
92532
92583
|
if (!persisted) {
|
|
92533
92584
|
return {
|
|
92534
92585
|
ok: false,
|
|
@@ -92592,7 +92643,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
92592
92643
|
}
|
|
92593
92644
|
}
|
|
92594
92645
|
if (runState.lanes.length > 0) {
|
|
92595
|
-
const evidenceLaneIds = new Set(
|
|
92646
|
+
const evidenceLaneIds = new Set(_internals44.listLaneEvidenceSync(directory, phase));
|
|
92596
92647
|
for (const lane of runState.lanes) {
|
|
92597
92648
|
if ((lane.status === "completed" || lane.status === "failed") && !evidenceLaneIds.has(lane.laneId)) {
|
|
92598
92649
|
return {
|
|
@@ -92602,7 +92653,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
92602
92653
|
}
|
|
92603
92654
|
}
|
|
92604
92655
|
}
|
|
92605
|
-
const activeLocks =
|
|
92656
|
+
const activeLocks = _internals44.listActiveLocks(directory);
|
|
92606
92657
|
const phaseLaneIds = new Set(laneIds);
|
|
92607
92658
|
for (const lock of activeLocks) {
|
|
92608
92659
|
if (lock.laneId && phaseLaneIds.has(lock.laneId)) {
|
|
@@ -92622,7 +92673,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
92622
92673
|
}
|
|
92623
92674
|
const serialDegradedTasks = runState.degradedTasks.filter((dt) => !laneTaskIds.has(dt.taskId));
|
|
92624
92675
|
if (serialDegradedTasks.length > 0) {
|
|
92625
|
-
const plan =
|
|
92676
|
+
const plan = _internals44.readPlanJson(directory);
|
|
92626
92677
|
if (!plan) {
|
|
92627
92678
|
return {
|
|
92628
92679
|
ok: false,
|
|
@@ -92666,7 +92717,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
92666
92717
|
}
|
|
92667
92718
|
const serializedTasks = runState.serializedTasks;
|
|
92668
92719
|
if (Array.isArray(serializedTasks) && serializedTasks.length > 0) {
|
|
92669
|
-
const plan =
|
|
92720
|
+
const plan = _internals44.readPlanJson(directory);
|
|
92670
92721
|
if (!plan) {
|
|
92671
92722
|
return {
|
|
92672
92723
|
ok: false,
|
|
@@ -92725,7 +92776,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
92725
92776
|
}
|
|
92726
92777
|
let reviewerVerdict = runState.lastReviewerVerdict;
|
|
92727
92778
|
if (!reviewerVerdict) {
|
|
92728
|
-
const evidence =
|
|
92779
|
+
const evidence = _internals44.readReviewerEvidence(directory, phase);
|
|
92729
92780
|
reviewerVerdict = evidence?.verdict ?? undefined;
|
|
92730
92781
|
}
|
|
92731
92782
|
if (mergedConfig.phase_reviewer) {
|
|
@@ -92738,7 +92789,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
92738
92789
|
}
|
|
92739
92790
|
let criticVerdict = runState.lastCriticVerdict;
|
|
92740
92791
|
if (!criticVerdict) {
|
|
92741
|
-
const evidence =
|
|
92792
|
+
const evidence = _internals44.readCriticEvidence(directory, phase);
|
|
92742
92793
|
criticVerdict = evidence?.verdict ?? undefined;
|
|
92743
92794
|
}
|
|
92744
92795
|
if (mergedConfig.phase_critic) {
|
|
@@ -93661,7 +93712,7 @@ Advisory notes: ${advisoryNotes.join("; ")}` : "";
|
|
|
93661
93712
|
phase_critic: leanConfig.phase_critic,
|
|
93662
93713
|
integrated_diff_required: leanConfig.integrated_diff_required
|
|
93663
93714
|
} : undefined;
|
|
93664
|
-
const leanCheck =
|
|
93715
|
+
const leanCheck = _internals44.verifyLeanTurboPhaseReady(dir, phase, sessionID, leanPhaseReadyConfig);
|
|
93665
93716
|
if (!leanCheck.ok) {
|
|
93666
93717
|
return JSON.stringify({
|
|
93667
93718
|
success: false,
|
|
@@ -95849,11 +95900,11 @@ var quality_budget = createSwarmTool({
|
|
|
95849
95900
|
}).optional().describe("Quality budget thresholds")
|
|
95850
95901
|
},
|
|
95851
95902
|
async execute(args2, directory) {
|
|
95852
|
-
const result = await
|
|
95903
|
+
const result = await _internals45.qualityBudget(args2, directory);
|
|
95853
95904
|
return JSON.stringify(result);
|
|
95854
95905
|
}
|
|
95855
95906
|
});
|
|
95856
|
-
var
|
|
95907
|
+
var _internals45 = {
|
|
95857
95908
|
qualityBudget
|
|
95858
95909
|
};
|
|
95859
95910
|
|
|
@@ -96582,7 +96633,7 @@ import * as path114 from "node:path";
|
|
|
96582
96633
|
var semgrepAvailableCache = null;
|
|
96583
96634
|
var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
|
|
96584
96635
|
var DEFAULT_TIMEOUT_MS3 = 30000;
|
|
96585
|
-
var
|
|
96636
|
+
var _internals46 = {
|
|
96586
96637
|
isSemgrepAvailable,
|
|
96587
96638
|
checkSemgrepAvailable,
|
|
96588
96639
|
resetSemgrepCache,
|
|
@@ -96607,7 +96658,7 @@ function isSemgrepAvailable() {
|
|
|
96607
96658
|
}
|
|
96608
96659
|
}
|
|
96609
96660
|
async function checkSemgrepAvailable() {
|
|
96610
|
-
return
|
|
96661
|
+
return _internals46.isSemgrepAvailable();
|
|
96611
96662
|
}
|
|
96612
96663
|
function resetSemgrepCache() {
|
|
96613
96664
|
semgrepAvailableCache = null;
|
|
@@ -96704,12 +96755,12 @@ async function runSemgrep(options) {
|
|
|
96704
96755
|
const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS3;
|
|
96705
96756
|
if (files.length === 0) {
|
|
96706
96757
|
return {
|
|
96707
|
-
available:
|
|
96758
|
+
available: _internals46.isSemgrepAvailable(),
|
|
96708
96759
|
findings: [],
|
|
96709
96760
|
engine: "tier_a"
|
|
96710
96761
|
};
|
|
96711
96762
|
}
|
|
96712
|
-
if (!
|
|
96763
|
+
if (!_internals46.isSemgrepAvailable()) {
|
|
96713
96764
|
return {
|
|
96714
96765
|
available: false,
|
|
96715
96766
|
findings: [],
|
|
@@ -96868,7 +96919,7 @@ function assignOccurrenceIndices(findings, directory) {
|
|
|
96868
96919
|
}
|
|
96869
96920
|
const occIdx = countMap.get(baseKey) ?? 0;
|
|
96870
96921
|
countMap.set(baseKey, occIdx + 1);
|
|
96871
|
-
const fp =
|
|
96922
|
+
const fp = _internals47.fingerprintFinding(finding, directory, occIdx);
|
|
96872
96923
|
return {
|
|
96873
96924
|
finding,
|
|
96874
96925
|
index: occIdx,
|
|
@@ -96937,7 +96988,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
|
|
|
96937
96988
|
}
|
|
96938
96989
|
} catch {}
|
|
96939
96990
|
const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
|
|
96940
|
-
const indexed =
|
|
96991
|
+
const indexed = _internals47.assignOccurrenceIndices(findings, directory);
|
|
96941
96992
|
if (existing && !opts?.force) {
|
|
96942
96993
|
const prunedFingerprints = existing.fingerprints.filter((fp) => {
|
|
96943
96994
|
const relFile = fp.slice(0, fp.indexOf("|"));
|
|
@@ -97077,7 +97128,7 @@ function loadBaseline(directory, phase) {
|
|
|
97077
97128
|
};
|
|
97078
97129
|
}
|
|
97079
97130
|
}
|
|
97080
|
-
var
|
|
97131
|
+
var _internals47 = {
|
|
97081
97132
|
fingerprintFinding,
|
|
97082
97133
|
assignOccurrenceIndices,
|
|
97083
97134
|
captureOrMergeBaseline,
|
|
@@ -97487,11 +97538,11 @@ var sast_scan = createSwarmTool({
|
|
|
97487
97538
|
capture_baseline: safeArgs.capture_baseline,
|
|
97488
97539
|
phase: safeArgs.phase
|
|
97489
97540
|
};
|
|
97490
|
-
const result = await
|
|
97541
|
+
const result = await _internals48.sastScan(input, directory);
|
|
97491
97542
|
return JSON.stringify(result, null, 2);
|
|
97492
97543
|
}
|
|
97493
97544
|
});
|
|
97494
|
-
var
|
|
97545
|
+
var _internals48 = {
|
|
97495
97546
|
sastScan,
|
|
97496
97547
|
sast_scan
|
|
97497
97548
|
};
|
|
@@ -101403,7 +101454,7 @@ import {
|
|
|
101403
101454
|
mkdirSync as mkdirSync31,
|
|
101404
101455
|
readFileSync as readFileSync63,
|
|
101405
101456
|
renameSync as renameSync20,
|
|
101406
|
-
unlinkSync as
|
|
101457
|
+
unlinkSync as unlinkSync16,
|
|
101407
101458
|
writeFileSync as writeFileSync25
|
|
101408
101459
|
} from "node:fs";
|
|
101409
101460
|
import path125 from "node:path";
|
|
@@ -101637,7 +101688,7 @@ function writePhaseCouncilEvidence(workingDir, synthesis) {
|
|
|
101637
101688
|
renameSync20(tempFile, evidenceFile);
|
|
101638
101689
|
} finally {
|
|
101639
101690
|
if (existsSync72(tempFile)) {
|
|
101640
|
-
|
|
101691
|
+
unlinkSync16(tempFile);
|
|
101641
101692
|
}
|
|
101642
101693
|
}
|
|
101643
101694
|
}
|
|
@@ -102815,7 +102866,7 @@ function resolveDefaultReviewerAgent(generatedAgentNames) {
|
|
|
102815
102866
|
}
|
|
102816
102867
|
async function compileReviewPackage(directory, phase, sessionID, requireDiffSummary) {
|
|
102817
102868
|
const lanes = await listLaneEvidence(directory, phase);
|
|
102818
|
-
const persisted =
|
|
102869
|
+
const persisted = _internals49.readPersisted?.(directory) ?? null;
|
|
102819
102870
|
if (persisted) {
|
|
102820
102871
|
let matchingRunState = null;
|
|
102821
102872
|
for (const sessionState of Object.values(persisted.sessions)) {
|
|
@@ -103007,7 +103058,7 @@ Be specific and evidence-based. Do not approve a phase with unresolved degraded
|
|
|
103007
103058
|
client.session.delete({ path: { id: sessionId } }).catch(() => {});
|
|
103008
103059
|
}
|
|
103009
103060
|
}
|
|
103010
|
-
var
|
|
103061
|
+
var _internals49 = {
|
|
103011
103062
|
compileReviewPackage,
|
|
103012
103063
|
parseReviewerVerdict,
|
|
103013
103064
|
writeReviewerEvidence,
|
|
@@ -103024,28 +103075,28 @@ async function dispatchPhaseReviewer(directory, phase, sessionID, config3) {
|
|
|
103024
103075
|
};
|
|
103025
103076
|
const generatedAgentNames = swarmState.generatedAgentNames;
|
|
103026
103077
|
const agentName = mergedConfig.reviewerAgent || resolveDefaultReviewerAgent(generatedAgentNames);
|
|
103027
|
-
const pkg = await
|
|
103078
|
+
const pkg = await _internals49.compileReviewPackage(directory, phase, sessionID, mergedConfig.requireDiffSummary);
|
|
103028
103079
|
let responseText;
|
|
103029
103080
|
try {
|
|
103030
|
-
responseText = await
|
|
103081
|
+
responseText = await _internals49.dispatchReviewerAgent(directory, pkg, agentName, mergedConfig.timeoutMs);
|
|
103031
103082
|
} catch (error93) {
|
|
103032
|
-
const evidencePath2 = await
|
|
103083
|
+
const evidencePath2 = await _internals49.writeReviewerEvidence(directory, phase, "REJECTED", error93 instanceof Error ? error93.message : String(error93));
|
|
103033
103084
|
return {
|
|
103034
103085
|
verdict: "REJECTED",
|
|
103035
103086
|
reason: `Reviewer dispatch failed: ${error93 instanceof Error ? error93.message : String(error93)}`,
|
|
103036
103087
|
evidencePath: evidencePath2
|
|
103037
103088
|
};
|
|
103038
103089
|
}
|
|
103039
|
-
const parsed =
|
|
103090
|
+
const parsed = _internals49.parseReviewerVerdict(responseText);
|
|
103040
103091
|
if (!parsed) {
|
|
103041
|
-
const evidencePath2 = await
|
|
103092
|
+
const evidencePath2 = await _internals49.writeReviewerEvidence(directory, phase, "REJECTED", "Reviewer response could not be parsed");
|
|
103042
103093
|
return {
|
|
103043
103094
|
verdict: "REJECTED",
|
|
103044
103095
|
reason: "Reviewer response could not be parsed",
|
|
103045
103096
|
evidencePath: evidencePath2
|
|
103046
103097
|
};
|
|
103047
103098
|
}
|
|
103048
|
-
const evidencePath = await
|
|
103099
|
+
const evidencePath = await _internals49.writeReviewerEvidence(directory, phase, parsed.verdict, parsed.reason);
|
|
103049
103100
|
return {
|
|
103050
103101
|
verdict: parsed.verdict,
|
|
103051
103102
|
reason: parsed.reason,
|
|
@@ -103551,7 +103602,7 @@ ${fileList}
|
|
|
103551
103602
|
|
|
103552
103603
|
// src/tools/lean-turbo-run-phase.ts
|
|
103553
103604
|
init_create_tool();
|
|
103554
|
-
var
|
|
103605
|
+
var _internals50 = {
|
|
103555
103606
|
LeanTurboRunner,
|
|
103556
103607
|
loadPluginConfigWithMeta
|
|
103557
103608
|
};
|
|
@@ -103561,9 +103612,9 @@ async function executeLeanTurboRunPhase(args2) {
|
|
|
103561
103612
|
let runError = null;
|
|
103562
103613
|
let runner = null;
|
|
103563
103614
|
try {
|
|
103564
|
-
const { config: config3 } =
|
|
103615
|
+
const { config: config3 } = _internals50.loadPluginConfigWithMeta(directory);
|
|
103565
103616
|
const leanConfig = config3.turbo?.strategy === "lean" ? config3.turbo.lean : undefined;
|
|
103566
|
-
runner = new
|
|
103617
|
+
runner = new _internals50.LeanTurboRunner({
|
|
103567
103618
|
directory,
|
|
103568
103619
|
sessionID,
|
|
103569
103620
|
opencodeClient: swarmState.opencodeClient ?? null,
|
|
@@ -103844,7 +103895,7 @@ import * as path132 from "node:path";
|
|
|
103844
103895
|
|
|
103845
103896
|
// src/mutation/engine.ts
|
|
103846
103897
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
103847
|
-
import { unlinkSync as
|
|
103898
|
+
import { unlinkSync as unlinkSync17, writeFileSync as writeFileSync26 } from "node:fs";
|
|
103848
103899
|
import * as path131 from "node:path";
|
|
103849
103900
|
|
|
103850
103901
|
// src/mutation/equivalence.ts
|
|
@@ -103917,7 +103968,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
|
|
|
103917
103968
|
const strippedMutated = stripCode(mutatedCode);
|
|
103918
103969
|
return strippedOriginal === strippedMutated;
|
|
103919
103970
|
}
|
|
103920
|
-
var
|
|
103971
|
+
var _internals51 = {
|
|
103921
103972
|
isStaticallyEquivalent,
|
|
103922
103973
|
checkEquivalence,
|
|
103923
103974
|
batchCheckEquivalence
|
|
@@ -103957,7 +104008,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
|
|
|
103957
104008
|
const results = [];
|
|
103958
104009
|
for (const { patch, originalCode, mutatedCode } of patches) {
|
|
103959
104010
|
try {
|
|
103960
|
-
const result = await
|
|
104011
|
+
const result = await _internals51.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
|
|
103961
104012
|
results.push(result);
|
|
103962
104013
|
} catch (err3) {
|
|
103963
104014
|
results.push({
|
|
@@ -103976,7 +104027,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
|
|
|
103976
104027
|
var MUTATION_TIMEOUT_MS = 30000;
|
|
103977
104028
|
var TOTAL_BUDGET_MS = 300000;
|
|
103978
104029
|
var GIT_APPLY_TIMEOUT_MS = 5000;
|
|
103979
|
-
var
|
|
104030
|
+
var _internals52 = {
|
|
103980
104031
|
executeMutation,
|
|
103981
104032
|
computeReport,
|
|
103982
104033
|
executeMutationSuite,
|
|
@@ -104008,7 +104059,7 @@ async function executeMutation(patch, testCommand, _testFiles, workingDir) {
|
|
|
104008
104059
|
};
|
|
104009
104060
|
}
|
|
104010
104061
|
try {
|
|
104011
|
-
const applyResult =
|
|
104062
|
+
const applyResult = _internals52.spawnSync("git", ["apply", "--", patchFile], {
|
|
104012
104063
|
cwd: workingDir,
|
|
104013
104064
|
timeout: GIT_APPLY_TIMEOUT_MS,
|
|
104014
104065
|
stdio: "pipe"
|
|
@@ -104037,7 +104088,7 @@ async function executeMutation(patch, testCommand, _testFiles, workingDir) {
|
|
|
104037
104088
|
}
|
|
104038
104089
|
let testPassed = false;
|
|
104039
104090
|
try {
|
|
104040
|
-
const spawnResult =
|
|
104091
|
+
const spawnResult = _internals52.spawnSync(testCommand[0], testCommand.slice(1), {
|
|
104041
104092
|
cwd: workingDir,
|
|
104042
104093
|
timeout: MUTATION_TIMEOUT_MS,
|
|
104043
104094
|
stdio: "pipe"
|
|
@@ -104070,7 +104121,7 @@ async function executeMutation(patch, testCommand, _testFiles, workingDir) {
|
|
|
104070
104121
|
} finally {
|
|
104071
104122
|
if (patchFile) {
|
|
104072
104123
|
try {
|
|
104073
|
-
const revertResult =
|
|
104124
|
+
const revertResult = _internals52.spawnSync("git", ["apply", "-R", "--", patchFile], {
|
|
104074
104125
|
cwd: workingDir,
|
|
104075
104126
|
timeout: GIT_APPLY_TIMEOUT_MS,
|
|
104076
104127
|
stdio: "pipe"
|
|
@@ -104089,7 +104140,7 @@ async function executeMutation(patch, testCommand, _testFiles, workingDir) {
|
|
|
104089
104140
|
revertError = new Error(`Failed to revert mutation ${patch.id}: ${revertErr}. Working tree may be dirty.`);
|
|
104090
104141
|
}
|
|
104091
104142
|
try {
|
|
104092
|
-
|
|
104143
|
+
unlinkSync17(patchFile);
|
|
104093
104144
|
} catch (_unlinkErr) {}
|
|
104094
104145
|
}
|
|
104095
104146
|
}
|
|
@@ -104263,7 +104314,7 @@ async function executeMutationSuite(patches, testCommand, testFiles, workingDir,
|
|
|
104263
104314
|
}
|
|
104264
104315
|
|
|
104265
104316
|
// src/mutation/gate.ts
|
|
104266
|
-
var
|
|
104317
|
+
var _internals53 = {
|
|
104267
104318
|
evaluateMutationGate,
|
|
104268
104319
|
buildTestImprovementPrompt,
|
|
104269
104320
|
buildMessage
|
|
@@ -104284,8 +104335,8 @@ function evaluateMutationGate(report, passThreshold = PASS_THRESHOLD, warnThresh
|
|
|
104284
104335
|
} else {
|
|
104285
104336
|
verdict = "fail";
|
|
104286
104337
|
}
|
|
104287
|
-
const testImprovementPrompt =
|
|
104288
|
-
const message =
|
|
104338
|
+
const testImprovementPrompt = _internals53.buildTestImprovementPrompt(report, passThreshold, verdict);
|
|
104339
|
+
const message = _internals53.buildMessage(verdict, adjustedKillRate, report.killed, report.totalMutants, report.equivalent, warnThreshold);
|
|
104289
104340
|
return {
|
|
104290
104341
|
verdict,
|
|
104291
104342
|
killRate: report.killRate,
|
|
@@ -104902,7 +104953,7 @@ import * as path136 from "node:path";
|
|
|
104902
104953
|
init_bun_compat();
|
|
104903
104954
|
import * as fs104 from "node:fs";
|
|
104904
104955
|
import * as path135 from "node:path";
|
|
104905
|
-
var
|
|
104956
|
+
var _internals54 = { bunSpawn };
|
|
104906
104957
|
var _swarmGitExcludedChecked = false;
|
|
104907
104958
|
function fileCoversSwarm(content) {
|
|
104908
104959
|
for (const rawLine of content.split(`
|
|
@@ -104935,7 +104986,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
104935
104986
|
checkIgnoreExitCode
|
|
104936
104987
|
] = await Promise.all([
|
|
104937
104988
|
(async () => {
|
|
104938
|
-
const proc =
|
|
104989
|
+
const proc = _internals54.bunSpawn(["git", "-C", directory, "rev-parse", "--show-toplevel"], GIT_SPAWN_OPTIONS);
|
|
104939
104990
|
try {
|
|
104940
104991
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
104941
104992
|
} finally {
|
|
@@ -104945,7 +104996,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
104945
104996
|
}
|
|
104946
104997
|
})(),
|
|
104947
104998
|
(async () => {
|
|
104948
|
-
const proc =
|
|
104999
|
+
const proc = _internals54.bunSpawn(["git", "-C", directory, "rev-parse", "--git-path", "info/exclude"], GIT_SPAWN_OPTIONS);
|
|
104949
105000
|
try {
|
|
104950
105001
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
104951
105002
|
} finally {
|
|
@@ -104955,7 +105006,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
104955
105006
|
}
|
|
104956
105007
|
})(),
|
|
104957
105008
|
(async () => {
|
|
104958
|
-
const proc =
|
|
105009
|
+
const proc = _internals54.bunSpawn(["git", "-C", directory, "check-ignore", "-q", ".swarm/.gitkeep"], GIT_SPAWN_OPTIONS);
|
|
104959
105010
|
try {
|
|
104960
105011
|
return await proc.exited;
|
|
104961
105012
|
} finally {
|
|
@@ -104994,7 +105045,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
104994
105045
|
}
|
|
104995
105046
|
} catch {}
|
|
104996
105047
|
}
|
|
104997
|
-
const trackedProc =
|
|
105048
|
+
const trackedProc = _internals54.bunSpawn(["git", "-C", directory, "ls-files", "--", ".swarm"], GIT_SPAWN_OPTIONS);
|
|
104998
105049
|
let trackedExitCode;
|
|
104999
105050
|
let trackedOutput;
|
|
105000
105051
|
try {
|
|
@@ -105019,7 +105070,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
105019
105070
|
}
|
|
105020
105071
|
|
|
105021
105072
|
// src/hooks/diff-scope.ts
|
|
105022
|
-
var
|
|
105073
|
+
var _internals55 = { bunSpawn };
|
|
105023
105074
|
function getDeclaredScope(taskId, directory) {
|
|
105024
105075
|
try {
|
|
105025
105076
|
const planPath = path136.join(directory, ".swarm", "plan.json");
|
|
@@ -105054,7 +105105,7 @@ var GIT_DIFF_SPAWN_OPTIONS = {
|
|
|
105054
105105
|
};
|
|
105055
105106
|
async function getChangedFiles(directory) {
|
|
105056
105107
|
try {
|
|
105057
|
-
const proc =
|
|
105108
|
+
const proc = _internals55.bunSpawn(["git", "diff", "--name-only", "HEAD~1"], {
|
|
105058
105109
|
cwd: directory,
|
|
105059
105110
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
105060
105111
|
});
|
|
@@ -105071,7 +105122,7 @@ async function getChangedFiles(directory) {
|
|
|
105071
105122
|
return stdout.trim().split(`
|
|
105072
105123
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
105073
105124
|
}
|
|
105074
|
-
const proc2 =
|
|
105125
|
+
const proc2 = _internals55.bunSpawn(["git", "diff", "--name-only", "HEAD"], {
|
|
105075
105126
|
cwd: directory,
|
|
105076
105127
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
105077
105128
|
});
|
|
@@ -105129,7 +105180,7 @@ init_telemetry();
|
|
|
105129
105180
|
init_file_locks();
|
|
105130
105181
|
import * as fs106 from "node:fs";
|
|
105131
105182
|
import * as path137 from "node:path";
|
|
105132
|
-
var
|
|
105183
|
+
var _internals56 = {
|
|
105133
105184
|
listActiveLocks,
|
|
105134
105185
|
verifyLeanTurboTaskCompletion
|
|
105135
105186
|
};
|
|
@@ -105271,7 +105322,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
|
|
|
105271
105322
|
}
|
|
105272
105323
|
};
|
|
105273
105324
|
}
|
|
105274
|
-
const activeLocks =
|
|
105325
|
+
const activeLocks = _internals56.listActiveLocks(directory);
|
|
105275
105326
|
const laneLocks = activeLocks.filter((lock) => lock.laneId === lane.laneId);
|
|
105276
105327
|
if (laneLocks.length > 0) {
|
|
105277
105328
|
return {
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoint artifact writer.
|
|
3
|
+
* Writes SWARM_PLAN.md and SWARM_PLAN.json inside .swarm/.
|
|
4
|
+
* Export-only — not a live runtime source of truth.
|
|
5
|
+
* Called on: save_plan, phase completion, /swarm close.
|
|
6
|
+
* NOT called on every task update.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'node:fs';
|
|
1
9
|
import { type Plan } from '../config/plan-schema';
|
|
2
10
|
/**
|
|
3
11
|
* Write SWARM_PLAN.json and SWARM_PLAN.md inside the .swarm/ directory under the project root.
|
|
@@ -26,4 +34,6 @@ export declare function importCheckpoint(directory: string, source?: string): Pr
|
|
|
26
34
|
export declare const _internals: {
|
|
27
35
|
writeCheckpoint: typeof writeCheckpoint;
|
|
28
36
|
importCheckpoint: typeof importCheckpoint;
|
|
37
|
+
existsSyncForCleanup: typeof fs.existsSync;
|
|
38
|
+
unlinkSyncForCleanup: typeof fs.unlinkSync;
|
|
29
39
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.26.
|
|
3
|
+
"version": "7.26.2",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|