opencode-swarm 7.87.2 → 7.87.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/{guardrail-explain-9fngqx80.js → guardrail-explain-2q9myk7c.js} +3 -3
- package/dist/cli/{index-s8bj492g.js → index-32axfg6h.js} +23 -7
- package/dist/cli/{index-f41fa3f0.js → index-amwa268r.js} +1 -1
- package/dist/cli/{index-6qkwgdsg.js → index-kz1bmebr.js} +241 -164
- package/dist/cli/{index-gjdq4na6.js → index-r3f47swm.js} +3 -3
- package/dist/cli/index.js +2 -2
- package/dist/cli/{skill-generator-3pvpk4y2.js → skill-generator-kz4q8e49.js} +3 -1
- package/dist/hooks/knowledge-reader.d.ts +2 -0
- package/dist/hooks/knowledge-types.d.ts +3 -0
- package/dist/index.js +626 -554
- package/dist/services/skill-generator.d.ts +10 -0
- package/dist/services/skill-improver.d.ts +25 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var package_default;
|
|
|
69
69
|
var init_package = __esm(() => {
|
|
70
70
|
package_default = {
|
|
71
71
|
name: "opencode-swarm",
|
|
72
|
-
version: "7.87.
|
|
72
|
+
version: "7.87.3",
|
|
73
73
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
74
74
|
main: "dist/index.js",
|
|
75
75
|
types: "dist/index.d.ts",
|
|
@@ -62037,7 +62037,13 @@ async function readCounterBaseline(directory) {
|
|
|
62037
62037
|
const filePath = resolveKnowledgeCounterBaselinePath(directory);
|
|
62038
62038
|
if (!existsSync18(filePath))
|
|
62039
62039
|
return new Map;
|
|
62040
|
-
|
|
62040
|
+
let raw;
|
|
62041
|
+
try {
|
|
62042
|
+
raw = JSON.parse(await readFile6(filePath, "utf-8"));
|
|
62043
|
+
} catch (err2) {
|
|
62044
|
+
warn(`[knowledge-events] corrupted counter baseline at ${filePath}; ignoring folded baseline and replaying live events only: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
62045
|
+
return new Map;
|
|
62046
|
+
}
|
|
62041
62047
|
const map3 = new Map;
|
|
62042
62048
|
for (const [id, rollup] of Object.entries(raw)) {
|
|
62043
62049
|
map3.set(id, normalizeRollupTimestamps(cloneRollup(rollup)));
|
|
@@ -62264,9 +62270,12 @@ function effectiveRetrievalOutcomes(stored, rollup) {
|
|
|
62264
62270
|
};
|
|
62265
62271
|
if (!rollup)
|
|
62266
62272
|
return base;
|
|
62273
|
+
const { n_a_count: _na, ...rollupWithoutNa } = rollup;
|
|
62267
62274
|
return {
|
|
62268
62275
|
...base,
|
|
62269
|
-
...
|
|
62276
|
+
...rollupWithoutNa,
|
|
62277
|
+
succeeded_after_shown_count: (base.succeeded_after_shown_count ?? 0) + (rollup.succeeded_after_shown_count ?? 0),
|
|
62278
|
+
failed_after_shown_count: (base.failed_after_shown_count ?? 0) + (rollup.failed_after_shown_count ?? 0)
|
|
62270
62279
|
};
|
|
62271
62280
|
}
|
|
62272
62281
|
async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
@@ -64808,6 +64817,7 @@ __export(exports_skill_generator, {
|
|
|
64808
64817
|
activateProposal: () => activateProposal,
|
|
64809
64818
|
_internals: () => _internals29,
|
|
64810
64819
|
STRONG_SKILL_OUTCOME_COUNT: () => STRONG_SKILL_OUTCOME_COUNT,
|
|
64820
|
+
HIGH_PRIORITY_SKILL_MIN_CONFIDENCE: () => HIGH_PRIORITY_SKILL_MIN_CONFIDENCE,
|
|
64811
64821
|
DEFAULT_SKILL_MIN_CONFIRMATIONS: () => DEFAULT_SKILL_MIN_CONFIRMATIONS,
|
|
64812
64822
|
DEFAULT_SKILL_MIN_CONFIDENCE: () => DEFAULT_SKILL_MIN_CONFIDENCE
|
|
64813
64823
|
});
|
|
@@ -64864,10 +64874,12 @@ function isSkillMaturityEligible(entry, opts, outcomes = entry.retrieval_outcome
|
|
|
64864
64874
|
const strongOutcomes = hasStrongSkillOutcomeRecord(outcomes);
|
|
64865
64875
|
if (outcomeSignal > 0 && strongOutcomes)
|
|
64866
64876
|
return true;
|
|
64867
|
-
if (entry.confidence < opts.minConfidence && !strongOutcomes)
|
|
64868
|
-
return false;
|
|
64869
64877
|
const distinctPhases = new Set((entry.confirmed_by ?? []).map((c) => c.phase_number).filter((p) => typeof p === "number")).size;
|
|
64870
|
-
|
|
64878
|
+
const highPriorityPath = isHighPriorityDirective(entry) && distinctPhases >= 1 && entry.confidence >= HIGH_PRIORITY_SKILL_MIN_CONFIDENCE;
|
|
64879
|
+
if (entry.confidence < opts.minConfidence && !strongOutcomes && !highPriorityPath) {
|
|
64880
|
+
return false;
|
|
64881
|
+
}
|
|
64882
|
+
return distinctPhases >= opts.minConfirmations || strongOutcomes || highPriorityPath;
|
|
64871
64883
|
}
|
|
64872
64884
|
function jaccardSimilarity(setA, setB) {
|
|
64873
64885
|
const normA = setA.map((s) => s.toLowerCase());
|
|
@@ -65062,7 +65074,11 @@ async function generateSkills(req) {
|
|
|
65062
65074
|
const swarm = await readKnowledge(resolveSwarmKnowledgePath(req.directory));
|
|
65063
65075
|
const hivePath = resolveHiveKnowledgePath();
|
|
65064
65076
|
const hive = existsSync22(hivePath) ? await readKnowledge(hivePath) : [];
|
|
65065
|
-
|
|
65077
|
+
const rollups = await readKnowledgeCounterRollups(req.directory);
|
|
65078
|
+
pool = [...swarm, ...hive].filter((e) => idSet.has(e.id) && e.status !== "archived").map((e) => ({
|
|
65079
|
+
...e,
|
|
65080
|
+
retrieval_outcomes: effectiveRetrievalOutcomes(e.retrieval_outcomes, rollups.get(e.id))
|
|
65081
|
+
}));
|
|
65066
65082
|
} else {
|
|
65067
65083
|
pool = candidates;
|
|
65068
65084
|
}
|
|
@@ -65761,7 +65777,7 @@ async function regenerateSkill(directory, slug, options = {}) {
|
|
|
65761
65777
|
evaluation
|
|
65762
65778
|
};
|
|
65763
65779
|
}
|
|
65764
|
-
var SLUG_PATTERN2, DEFAULT_SKILL_MIN_CONFIDENCE = 0.7, DEFAULT_SKILL_MIN_CONFIRMATIONS = 2, STRONG_SKILL_OUTCOME_COUNT = 3, MIN_CLUSTER_SIZE = 2, JACCARD_THRESHOLD = 0.5, AUTO_APPLY_BATCH_LIMIT = 5, _internals29;
|
|
65780
|
+
var SLUG_PATTERN2, DEFAULT_SKILL_MIN_CONFIDENCE = 0.7, DEFAULT_SKILL_MIN_CONFIRMATIONS = 2, STRONG_SKILL_OUTCOME_COUNT = 3, HIGH_PRIORITY_SKILL_MIN_CONFIDENCE = 0.6, MIN_CLUSTER_SIZE = 2, JACCARD_THRESHOLD = 0.5, AUTO_APPLY_BATCH_LIMIT = 5, _internals29;
|
|
65765
65781
|
var init_skill_generator = __esm(() => {
|
|
65766
65782
|
init_knowledge_events();
|
|
65767
65783
|
init_knowledge_store();
|
|
@@ -71062,7 +71078,14 @@ async function gatherInventory(directory) {
|
|
|
71062
71078
|
continue;
|
|
71063
71079
|
}
|
|
71064
71080
|
const fm = parseDraftFrontmatter(content);
|
|
71065
|
-
if (!fm)
|
|
71081
|
+
if (!fm) {
|
|
71082
|
+
staleActiveSkills.push({
|
|
71083
|
+
slug: skill.slug,
|
|
71084
|
+
reasons: ["unparseable_frontmatter"]
|
|
71085
|
+
});
|
|
71086
|
+
continue;
|
|
71087
|
+
}
|
|
71088
|
+
if (fm.skillOrigin === "shim")
|
|
71066
71089
|
continue;
|
|
71067
71090
|
metadataReadable += 1;
|
|
71068
71091
|
const reasons = [];
|
|
@@ -71210,6 +71233,59 @@ function buildLLMProposalFrame(args2) {
|
|
|
71210
71233
|
return lines.join(`
|
|
71211
71234
|
`);
|
|
71212
71235
|
}
|
|
71236
|
+
async function reconcileStaleActiveSkills(directory, options = {}) {
|
|
71237
|
+
const result = {
|
|
71238
|
+
regenerated: [],
|
|
71239
|
+
retired: [],
|
|
71240
|
+
skipped: [],
|
|
71241
|
+
checked: 0
|
|
71242
|
+
};
|
|
71243
|
+
let skills;
|
|
71244
|
+
try {
|
|
71245
|
+
skills = await listSkills(directory);
|
|
71246
|
+
} catch {
|
|
71247
|
+
return result;
|
|
71248
|
+
}
|
|
71249
|
+
for (const skill of skills.active) {
|
|
71250
|
+
let content;
|
|
71251
|
+
try {
|
|
71252
|
+
content = await readFile15(skill.path, "utf-8");
|
|
71253
|
+
} catch {
|
|
71254
|
+
continue;
|
|
71255
|
+
}
|
|
71256
|
+
const fm = parseDraftFrontmatter(content);
|
|
71257
|
+
if (fm?.skillOrigin === "shim") {
|
|
71258
|
+
result.skipped.push(skill.slug);
|
|
71259
|
+
continue;
|
|
71260
|
+
}
|
|
71261
|
+
const stale = !fm || fm.sourceKnowledgeIds.length === 0 || !fm.generatedAt;
|
|
71262
|
+
if (!stale)
|
|
71263
|
+
continue;
|
|
71264
|
+
result.checked += 1;
|
|
71265
|
+
if (options.dryRun) {
|
|
71266
|
+
result.retired.push(skill.slug);
|
|
71267
|
+
continue;
|
|
71268
|
+
}
|
|
71269
|
+
try {
|
|
71270
|
+
const regen = await _internals36.regenerateSkill(directory, skill.slug, {
|
|
71271
|
+
evaluate: false
|
|
71272
|
+
});
|
|
71273
|
+
if (regen.regenerated) {
|
|
71274
|
+
result.regenerated.push(skill.slug);
|
|
71275
|
+
} else if (regen.retired) {
|
|
71276
|
+
result.retired.push(skill.slug);
|
|
71277
|
+
} else {
|
|
71278
|
+
const retire = await retireSkill(directory, skill.slug, "stale_no_source_knowledge");
|
|
71279
|
+
if (retire.retired)
|
|
71280
|
+
result.retired.push(skill.slug);
|
|
71281
|
+
}
|
|
71282
|
+
} catch (err2) {
|
|
71283
|
+
warn(`[skill-improver] reconcileStaleActiveSkills: failed to reconcile '${skill.slug}': ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
71284
|
+
result.skipped.push(skill.slug);
|
|
71285
|
+
}
|
|
71286
|
+
}
|
|
71287
|
+
return result;
|
|
71288
|
+
}
|
|
71213
71289
|
async function runSkillImprover(req) {
|
|
71214
71290
|
const cfg = req.config;
|
|
71215
71291
|
const now = req.now ?? new Date;
|
|
@@ -71416,6 +71492,7 @@ async function runSkillImprover(req) {
|
|
|
71416
71492
|
motifs: successMotifResult.motifs,
|
|
71417
71493
|
proposalsWritten: successMotifResult.proposalsWritten.length
|
|
71418
71494
|
};
|
|
71495
|
+
const staleSkillReconciliation = await reconcileStaleActiveSkills(req.directory, { dryRun: writeMode !== "draft_skills" });
|
|
71419
71496
|
let autoApply;
|
|
71420
71497
|
if (req.allowAutoApply !== false && delegate && req.sessionId && hasActiveFullAuto(req.sessionId)) {
|
|
71421
71498
|
try {
|
|
@@ -71436,17 +71513,30 @@ async function runSkillImprover(req) {
|
|
|
71436
71513
|
unactionableHardening,
|
|
71437
71514
|
macroMotifs,
|
|
71438
71515
|
successMotifs,
|
|
71516
|
+
staleSkillReconciliation,
|
|
71439
71517
|
autoApply
|
|
71440
71518
|
};
|
|
71441
71519
|
}
|
|
71520
|
+
var _internals36;
|
|
71442
71521
|
var init_skill_improver = __esm(() => {
|
|
71443
71522
|
init_knowledge_store();
|
|
71444
71523
|
init_skill_improver_llm_factory();
|
|
71445
71524
|
init_state2();
|
|
71525
|
+
init_logger();
|
|
71446
71526
|
init_skill_generator();
|
|
71447
71527
|
init_skill_improver_quota();
|
|
71448
71528
|
init_trajectory_cluster();
|
|
71449
71529
|
init_unactionable_hardening();
|
|
71530
|
+
_internals36 = {
|
|
71531
|
+
runSkillImprover,
|
|
71532
|
+
buildDeterministicProposal,
|
|
71533
|
+
buildLLMProposalFrame,
|
|
71534
|
+
buildSystemPrompt,
|
|
71535
|
+
buildUserPrompt,
|
|
71536
|
+
gatherInventory,
|
|
71537
|
+
reconcileStaleActiveSkills,
|
|
71538
|
+
regenerateSkill
|
|
71539
|
+
};
|
|
71450
71540
|
});
|
|
71451
71541
|
|
|
71452
71542
|
// src/tools/write-retro.ts
|
|
@@ -71750,7 +71840,7 @@ async function executeWriteRetro(args2, directory) {
|
|
|
71750
71840
|
}, null, 2);
|
|
71751
71841
|
}
|
|
71752
71842
|
}
|
|
71753
|
-
var write_retro,
|
|
71843
|
+
var write_retro, _internals37;
|
|
71754
71844
|
var init_write_retro = __esm(() => {
|
|
71755
71845
|
init_zod();
|
|
71756
71846
|
init_evidence_schema();
|
|
@@ -71797,13 +71887,13 @@ var init_write_retro = __esm(() => {
|
|
|
71797
71887
|
task_id: args2.task_id !== undefined ? String(args2.task_id) : undefined,
|
|
71798
71888
|
metadata: args2.metadata
|
|
71799
71889
|
};
|
|
71800
|
-
return await
|
|
71890
|
+
return await _internals37.executeWriteRetro(writeRetroArgs, directory);
|
|
71801
71891
|
} catch {
|
|
71802
71892
|
return JSON.stringify({ success: false, phase: rawPhase, message: "Invalid arguments" }, null, 2);
|
|
71803
71893
|
}
|
|
71804
71894
|
}
|
|
71805
71895
|
});
|
|
71806
|
-
|
|
71896
|
+
_internals37 = {
|
|
71807
71897
|
executeWriteRetro,
|
|
71808
71898
|
write_retro
|
|
71809
71899
|
};
|
|
@@ -72031,8 +72121,8 @@ async function runFinalizeStage(ctx) {
|
|
|
72031
72121
|
];
|
|
72032
72122
|
ctx.curationSucceeded = false;
|
|
72033
72123
|
try {
|
|
72034
|
-
ctx.curationResult = await
|
|
72035
|
-
llmDelegate:
|
|
72124
|
+
ctx.curationResult = await _internals38.curateAndStoreSwarm(ctx.allLessons, ctx.projectName, { phase_number: 0 }, ctx.directory, ctx.config, {
|
|
72125
|
+
llmDelegate: _internals38.createCuratorLLMDelegate(ctx.directory, "phase", ctx.options.sessionID),
|
|
72036
72126
|
enrichmentQuota: {
|
|
72037
72127
|
maxCalls: ctx.config.enrichment.max_calls_per_day,
|
|
72038
72128
|
window: ctx.config.enrichment.quota_window
|
|
@@ -72051,7 +72141,7 @@ async function runFinalizeStage(ctx) {
|
|
|
72051
72141
|
if (ctx.config.hive_enabled === false) {} else {
|
|
72052
72142
|
try {
|
|
72053
72143
|
const entries = await readKnowledge(resolveSwarmKnowledgePath(ctx.directory));
|
|
72054
|
-
const result = await
|
|
72144
|
+
const result = await _internals38.checkHivePromotions(entries, ctx.config);
|
|
72055
72145
|
ctx.hivePromoted = result.new_promotions;
|
|
72056
72146
|
} catch (hiveErr) {
|
|
72057
72147
|
const msg = hiveErr instanceof Error ? hiveErr.message : String(hiveErr);
|
|
@@ -72072,7 +72162,7 @@ async function runFinalizeStage(ctx) {
|
|
|
72072
72162
|
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.` : "";
|
|
72073
72163
|
if (ctx.runSkillReview) {
|
|
72074
72164
|
try {
|
|
72075
|
-
const { config: loadedConfig } =
|
|
72165
|
+
const { config: loadedConfig } = _internals38.loadPluginConfigWithMeta(ctx.directory);
|
|
72076
72166
|
const skillImproverConfig = SkillImproverConfigSchema.parse(loadedConfig.skill_improver ?? {});
|
|
72077
72167
|
const skillReviewResult = await runAbortableSkillReview({
|
|
72078
72168
|
directory: ctx.directory,
|
|
@@ -72123,7 +72213,7 @@ async function runFinalizeStage(ctx) {
|
|
|
72123
72213
|
}
|
|
72124
72214
|
if (!ctx.planAlreadyDone || ctx.guaranteeResult.closedPhaseIds.length > 0 || ctx.guaranteeResult.closedTaskIds.length > 0) {
|
|
72125
72215
|
try {
|
|
72126
|
-
await
|
|
72216
|
+
await _internals38.closePlanTerminalState(ctx.directory, ctx.planData, {
|
|
72127
72217
|
closedPhaseIds: ctx.guaranteeResult.closedPhaseIds,
|
|
72128
72218
|
closedTaskIds: ctx.guaranteeResult.closedTaskIds,
|
|
72129
72219
|
originalStatuses: ctx.originalStatuses
|
|
@@ -72140,11 +72230,11 @@ async function runFinalizeStage(ctx) {
|
|
|
72140
72230
|
}
|
|
72141
72231
|
try {
|
|
72142
72232
|
const { CuratorConfigSchema: CCS } = await Promise.resolve().then(() => (init_schema(), exports_schema));
|
|
72143
|
-
const { config: pmLoadedConfig } =
|
|
72233
|
+
const { config: pmLoadedConfig } = _internals38.loadPluginConfigWithMeta(ctx.directory);
|
|
72144
72234
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
72145
72235
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
72146
|
-
const pmResult = await
|
|
72147
|
-
llmDelegate:
|
|
72236
|
+
const pmResult = await _internals38.runCuratorPostMortem(ctx.directory, {
|
|
72237
|
+
llmDelegate: _internals38.createCuratorLLMDelegate(ctx.directory, "postmortem", ctx.options.sessionID)
|
|
72148
72238
|
});
|
|
72149
72239
|
if (pmResult.success && pmResult.summary) {
|
|
72150
72240
|
ctx.postMortemSummary = pmResult.summary;
|
|
@@ -72314,7 +72404,7 @@ async function runArchiveEvidenceRetention(ctx) {
|
|
|
72314
72404
|
let maxAgeDays = 30;
|
|
72315
72405
|
let maxBundles = 10;
|
|
72316
72406
|
try {
|
|
72317
|
-
const { config: evidenceLoadedConfig } =
|
|
72407
|
+
const { config: evidenceLoadedConfig } = _internals38.loadPluginConfigWithMeta(ctx.directory);
|
|
72318
72408
|
const evidenceCfg = evidenceLoadedConfig.evidence ?? {};
|
|
72319
72409
|
if (typeof evidenceCfg.max_age_days === "number") {
|
|
72320
72410
|
maxAgeDays = evidenceCfg.max_age_days;
|
|
@@ -72324,7 +72414,7 @@ async function runArchiveEvidenceRetention(ctx) {
|
|
|
72324
72414
|
}
|
|
72325
72415
|
} catch {}
|
|
72326
72416
|
try {
|
|
72327
|
-
await
|
|
72417
|
+
await _internals38.archiveEvidence(ctx.directory, maxAgeDays, maxBundles);
|
|
72328
72418
|
} catch (error93) {
|
|
72329
72419
|
const msg = error93 instanceof Error ? error93.message : String(error93);
|
|
72330
72420
|
ctx.warnings.push(`Evidence retention archive failed: ${msg}`);
|
|
@@ -72479,9 +72569,9 @@ async function runAlignStage(ctx) {
|
|
|
72479
72569
|
const pruneBranches = ctx.args.includes("--prune-branches");
|
|
72480
72570
|
let gitAlignResult = "";
|
|
72481
72571
|
const prunedBranches = [];
|
|
72482
|
-
const gitStatus =
|
|
72572
|
+
const gitStatus = _internals38.getGitRepositoryStatus(ctx.directory);
|
|
72483
72573
|
if (gitStatus.isRepo) {
|
|
72484
|
-
const aggressiveResult = await
|
|
72574
|
+
const aggressiveResult = await _internals38.resetToMainAfterMerge(ctx.directory, {
|
|
72485
72575
|
pruneBranches
|
|
72486
72576
|
});
|
|
72487
72577
|
if (aggressiveResult.success) {
|
|
@@ -72493,7 +72583,7 @@ async function runAlignStage(ctx) {
|
|
|
72493
72583
|
ctx.warnings.push("Uncommitted changes were discarded during git alignment");
|
|
72494
72584
|
}
|
|
72495
72585
|
} else {
|
|
72496
|
-
const alignResult = await
|
|
72586
|
+
const alignResult = await _internals38.resetToRemoteBranch(ctx.directory, {
|
|
72497
72587
|
pruneBranches
|
|
72498
72588
|
});
|
|
72499
72589
|
gitAlignResult = alignResult.message;
|
|
@@ -72553,7 +72643,7 @@ async function handleCloseCommand(directory, args2, options = {}) {
|
|
|
72553
72643
|
let finalizeLock = {
|
|
72554
72644
|
acquired: false
|
|
72555
72645
|
};
|
|
72556
|
-
finalizeLock = await
|
|
72646
|
+
finalizeLock = await _internals38.acquireFinalizeLock(directory);
|
|
72557
72647
|
if (!finalizeLock.acquired) {
|
|
72558
72648
|
return `❌ 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.`;
|
|
72559
72649
|
}
|
|
@@ -72584,7 +72674,7 @@ This project was already finalized in a previous /swarm close run. The plan has
|
|
|
72584
72674
|
if (planExists) {
|
|
72585
72675
|
planAlreadyDone = phases.length > 0 && phases.every((p) => p.status === "complete" || p.status === "completed" || p.status === "blocked" || p.status === "closed");
|
|
72586
72676
|
}
|
|
72587
|
-
const { config: loadedConfig } =
|
|
72677
|
+
const { config: loadedConfig } = _internals38.loadPluginConfigWithMeta(directory);
|
|
72588
72678
|
const config3 = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
72589
72679
|
const ctx = {
|
|
72590
72680
|
directory,
|
|
@@ -72695,7 +72785,7 @@ This project was already finalized in a previous /swarm close run. The plan has
|
|
|
72695
72785
|
ctx.warnings.push(`Failed to write close-summary.md: ${msg}`);
|
|
72696
72786
|
console.warn("[close-command] Failed to write close-summary.md:", error93);
|
|
72697
72787
|
}
|
|
72698
|
-
|
|
72788
|
+
_internals38.resetSwarmStatePreservingSingletons();
|
|
72699
72789
|
const retroWarnings = ctx.warnings.filter((w) => w.includes("Retrospective write") || w.includes("retrospective write") || w.includes("Session retrospective"));
|
|
72700
72790
|
const otherWarnings = ctx.warnings.filter((w) => !w.includes("Retrospective write") && !w.includes("retrospective write") && !w.includes("Session retrospective"));
|
|
72701
72791
|
let warningMsg = "";
|
|
@@ -72750,7 +72840,7 @@ async function acquireFinalizeLock(directory) {
|
|
|
72750
72840
|
}
|
|
72751
72841
|
return { acquired: false };
|
|
72752
72842
|
}
|
|
72753
|
-
var CLOSE_SKILL_REVIEW_TIMEOUT_MS = 120000, ARCHIVE_ARTIFACTS, ACTIVE_STATE_TO_CLEAN, ACTIVE_STATE_DIRS_TO_CLEAN,
|
|
72843
|
+
var CLOSE_SKILL_REVIEW_TIMEOUT_MS = 120000, ARCHIVE_ARTIFACTS, ACTIVE_STATE_TO_CLEAN, ACTIVE_STATE_DIRS_TO_CLEAN, _internals38;
|
|
72754
72844
|
var init_close = __esm(() => {
|
|
72755
72845
|
init_config();
|
|
72756
72846
|
init_schema();
|
|
@@ -72816,7 +72906,7 @@ var init_close = __esm(() => {
|
|
|
72816
72906
|
"scopes",
|
|
72817
72907
|
"spec-archive"
|
|
72818
72908
|
];
|
|
72819
|
-
|
|
72909
|
+
_internals38 = {
|
|
72820
72910
|
ACTIVE_STATE_DIRS_TO_CLEAN,
|
|
72821
72911
|
countSessionKnowledgeEntries,
|
|
72822
72912
|
CLOSE_SKILL_REVIEW_TIMEOUT_MS,
|
|
@@ -73131,7 +73221,7 @@ __export(exports_skill_consolidation, {
|
|
|
73131
73221
|
runSkillConsolidationFireAndForget: () => runSkillConsolidationFireAndForget,
|
|
73132
73222
|
runSkillConsolidation: () => runSkillConsolidation,
|
|
73133
73223
|
consolidationStatePath: () => consolidationStatePath,
|
|
73134
|
-
_internals: () =>
|
|
73224
|
+
_internals: () => _internals39
|
|
73135
73225
|
});
|
|
73136
73226
|
import { existsSync as existsSync32 } from "node:fs";
|
|
73137
73227
|
import { mkdir as mkdir16, readFile as readFile16, rename as rename9, writeFile as writeFile14 } from "node:fs/promises";
|
|
@@ -73255,12 +73345,12 @@ function runSkillConsolidationFireAndForget(req, onComplete, onError) {
|
|
|
73255
73345
|
runSkillConsolidation(req).then(onComplete).catch(onError);
|
|
73256
73346
|
});
|
|
73257
73347
|
}
|
|
73258
|
-
var DEFAULT_CONSOLIDATION_INTERVAL_HOURS = 24, DEFAULT_CONSOLIDATION_MAX_CALLS_PER_RUN = 1, CONSOLIDATION_RUN_TIMEOUT_MS, runningByDirectory,
|
|
73348
|
+
var DEFAULT_CONSOLIDATION_INTERVAL_HOURS = 24, DEFAULT_CONSOLIDATION_MAX_CALLS_PER_RUN = 1, CONSOLIDATION_RUN_TIMEOUT_MS, runningByDirectory, _internals39;
|
|
73259
73349
|
var init_skill_consolidation = __esm(() => {
|
|
73260
73350
|
init_skill_improver();
|
|
73261
73351
|
CONSOLIDATION_RUN_TIMEOUT_MS = 5 * 60 * 1000;
|
|
73262
73352
|
runningByDirectory = new Map;
|
|
73263
|
-
|
|
73353
|
+
_internals39 = {
|
|
73264
73354
|
readState: readState2,
|
|
73265
73355
|
writeState: writeState2,
|
|
73266
73356
|
intervalElapsed,
|
|
@@ -73632,9 +73722,9 @@ async function detectDarkMatter(directory, options) {
|
|
|
73632
73722
|
} catch {
|
|
73633
73723
|
return [];
|
|
73634
73724
|
}
|
|
73635
|
-
const commitMap = await
|
|
73636
|
-
const matrix =
|
|
73637
|
-
const staticEdges = await
|
|
73725
|
+
const commitMap = await _internals40.parseGitLog(directory, maxCommitsToAnalyze);
|
|
73726
|
+
const matrix = _internals40.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
|
|
73727
|
+
const staticEdges = await _internals40.getStaticEdges(directory);
|
|
73638
73728
|
const results = [];
|
|
73639
73729
|
for (const entry of matrix.values()) {
|
|
73640
73730
|
const key = `${entry.fileA}::${entry.fileB}`;
|
|
@@ -73722,7 +73812,7 @@ ${rows}
|
|
|
73722
73812
|
These pairs likely share an architectural concern invisible to static analysis.
|
|
73723
73813
|
Consider adding explicit documentation or extracting the shared concern.`;
|
|
73724
73814
|
}
|
|
73725
|
-
var co_change_analyzer,
|
|
73815
|
+
var co_change_analyzer, _internals40;
|
|
73726
73816
|
var init_co_change_analyzer = __esm(() => {
|
|
73727
73817
|
init_zod();
|
|
73728
73818
|
init_create_tool();
|
|
@@ -73754,11 +73844,11 @@ var init_co_change_analyzer = __esm(() => {
|
|
|
73754
73844
|
npmiThreshold,
|
|
73755
73845
|
maxCommitsToAnalyze
|
|
73756
73846
|
};
|
|
73757
|
-
const pairs = await
|
|
73758
|
-
return
|
|
73847
|
+
const pairs = await _internals40.detectDarkMatter(directory, options);
|
|
73848
|
+
return _internals40.formatDarkMatterOutput(pairs);
|
|
73759
73849
|
}
|
|
73760
73850
|
});
|
|
73761
|
-
|
|
73851
|
+
_internals40 = {
|
|
73762
73852
|
parseGitLog,
|
|
73763
73853
|
buildCoChangeMatrix,
|
|
73764
73854
|
getStaticEdges,
|
|
@@ -73773,7 +73863,7 @@ import * as child_process5 from "node:child_process";
|
|
|
73773
73863
|
import { promisify as promisify2 } from "node:util";
|
|
73774
73864
|
async function readGitHead(directory) {
|
|
73775
73865
|
try {
|
|
73776
|
-
const { stdout } = await
|
|
73866
|
+
const { stdout } = await _internals41.execFile("git", ["rev-parse", "HEAD"], {
|
|
73777
73867
|
cwd: directory,
|
|
73778
73868
|
timeout: GIT_HEAD_TIMEOUT_MS
|
|
73779
73869
|
});
|
|
@@ -73799,9 +73889,9 @@ async function getCoChangeData(directory, options) {
|
|
|
73799
73889
|
let entries;
|
|
73800
73890
|
let commitsObserved;
|
|
73801
73891
|
try {
|
|
73802
|
-
const commitMap = await
|
|
73892
|
+
const commitMap = await _internals41.parseGitLog(directory, maxCommits);
|
|
73803
73893
|
commitsObserved = commitMap.size;
|
|
73804
|
-
const matrix =
|
|
73894
|
+
const matrix = _internals41.buildCoChangeMatrix(commitMap);
|
|
73805
73895
|
entries = Array.from(matrix.values());
|
|
73806
73896
|
} catch {
|
|
73807
73897
|
return { pairs: [], commitsObserved: 0 };
|
|
@@ -73825,15 +73915,15 @@ async function getCoChangePairs(directory, options) {
|
|
|
73825
73915
|
const data = await getCoChangeData(directory, options);
|
|
73826
73916
|
return data.pairs;
|
|
73827
73917
|
}
|
|
73828
|
-
var execFileAsync, MAX_TRACKED_DIRS = 10, GIT_HEAD_TIMEOUT_MS = 5000, DEFAULT_MAX_COMMITS = 500, cache,
|
|
73918
|
+
var execFileAsync, MAX_TRACKED_DIRS = 10, GIT_HEAD_TIMEOUT_MS = 5000, DEFAULT_MAX_COMMITS = 500, cache, _internals41;
|
|
73829
73919
|
var init_cochange_source = __esm(() => {
|
|
73830
73920
|
init_co_change_analyzer();
|
|
73831
73921
|
execFileAsync = promisify2(child_process5.execFile);
|
|
73832
73922
|
cache = new Map;
|
|
73833
|
-
|
|
73923
|
+
_internals41 = {
|
|
73834
73924
|
execFile: execFileAsync,
|
|
73835
|
-
parseGitLog:
|
|
73836
|
-
buildCoChangeMatrix:
|
|
73925
|
+
parseGitLog: _internals40.parseGitLog,
|
|
73926
|
+
buildCoChangeMatrix: _internals40.buildCoChangeMatrix
|
|
73837
73927
|
};
|
|
73838
73928
|
});
|
|
73839
73929
|
|
|
@@ -74123,7 +74213,7 @@ async function handleCouplingCommand(directory, args2) {
|
|
|
74123
74213
|
|
|
74124
74214
|
Usage: /swarm coupling [--phase <n>] [--threshold <-1..1>] [--min-co-changes <n>] [--format markdown|json] [--persist]`;
|
|
74125
74215
|
}
|
|
74126
|
-
const plan = await
|
|
74216
|
+
const plan = await _internals42.loadPlanJsonOnly(directory);
|
|
74127
74217
|
if (plan === null) {
|
|
74128
74218
|
return "No plan found at `.swarm/plan.json`. Run `/swarm plan` to create one before measuring coupling.";
|
|
74129
74219
|
}
|
|
@@ -74147,7 +74237,7 @@ Usage: /swarm coupling [--phase <n>] [--threshold <-1..1>] [--min-co-changes <n>
|
|
|
74147
74237
|
const scope = scopeFiles ?? task.files_touched ?? [];
|
|
74148
74238
|
return { id: task.id, scope };
|
|
74149
74239
|
});
|
|
74150
|
-
const cochangePairs = await
|
|
74240
|
+
const cochangePairs = await _internals42.getCoChangePairs(directory);
|
|
74151
74241
|
const report = computeCouplingReport(tasks, cochangePairs, {
|
|
74152
74242
|
npmi: parsed.threshold,
|
|
74153
74243
|
minCoChanges: parsed.minCoChanges
|
|
@@ -74186,13 +74276,13 @@ _Warning: failed to persist report (${persistStatus.error})._`;
|
|
|
74186
74276
|
}
|
|
74187
74277
|
return `${formatCouplingReportMarkdown(report)}${persistTrailer}`;
|
|
74188
74278
|
}
|
|
74189
|
-
var DEFAULT_THRESHOLD = 0.6, DEFAULT_MIN_CO_CHANGES = 5,
|
|
74279
|
+
var DEFAULT_THRESHOLD = 0.6, DEFAULT_MIN_CO_CHANGES = 5, _internals42;
|
|
74190
74280
|
var init_coupling = __esm(() => {
|
|
74191
74281
|
init_manager();
|
|
74192
74282
|
init_cochange_source();
|
|
74193
74283
|
init_coupling_report();
|
|
74194
74284
|
init_conflicts();
|
|
74195
|
-
|
|
74285
|
+
_internals42 = {
|
|
74196
74286
|
loadPlanJsonOnly,
|
|
74197
74287
|
getCoChangePairs
|
|
74198
74288
|
};
|
|
@@ -74252,7 +74342,7 @@ async function handleDarkMatterCommand(directory, args2) {
|
|
|
74252
74342
|
}
|
|
74253
74343
|
let pairs;
|
|
74254
74344
|
try {
|
|
74255
|
-
pairs = await
|
|
74345
|
+
pairs = await _internals40.detectDarkMatter(directory, options);
|
|
74256
74346
|
} catch (err2) {
|
|
74257
74347
|
const errMsg = err2 instanceof Error ? err2.message : String(err2);
|
|
74258
74348
|
return `## Dark Matter Analysis Failed
|
|
@@ -75676,9 +75766,9 @@ async function checkCurator(directory) {
|
|
|
75676
75766
|
}
|
|
75677
75767
|
async function getSandboxStatus() {
|
|
75678
75768
|
try {
|
|
75679
|
-
const capability = await
|
|
75769
|
+
const capability = await _internals43.detectSandboxCapability();
|
|
75680
75770
|
const mechanism = capability.mechanism ?? "none";
|
|
75681
|
-
const executor = await
|
|
75771
|
+
const executor = await _internals43.getSandboxExecutor();
|
|
75682
75772
|
const hasExecutor = executor !== null;
|
|
75683
75773
|
if (hasExecutor) {
|
|
75684
75774
|
return {
|
|
@@ -75927,7 +76017,7 @@ async function handleDiagnoseCommand(directory, _args) {
|
|
|
75927
76017
|
const diagnoseData = await getDiagnoseData(directory);
|
|
75928
76018
|
return formatDiagnoseMarkdown(diagnoseData);
|
|
75929
76019
|
}
|
|
75930
|
-
var version4, sandboxCapabilityProbe,
|
|
76020
|
+
var version4, sandboxCapabilityProbe, _internals43;
|
|
75931
76021
|
var init_diagnose_service = __esm(() => {
|
|
75932
76022
|
init_package();
|
|
75933
76023
|
init_cache_paths();
|
|
@@ -75944,7 +76034,7 @@ var init_diagnose_service = __esm(() => {
|
|
|
75944
76034
|
init_warning_buffer();
|
|
75945
76035
|
({ version: version4 } = package_default);
|
|
75946
76036
|
sandboxCapabilityProbe = new SandboxCapabilityProbe;
|
|
75947
|
-
|
|
76037
|
+
_internals43 = {
|
|
75948
76038
|
detectSandboxCapability: () => sandboxCapabilityProbe.detect(),
|
|
75949
76039
|
getSandboxExecutor: getExecutor
|
|
75950
76040
|
};
|
|
@@ -78330,7 +78420,7 @@ function isCommandAvailable(command) {
|
|
|
78330
78420
|
const isWindows = process.platform === "win32";
|
|
78331
78421
|
const cmd = isWindows ? `${command}.exe` : command;
|
|
78332
78422
|
try {
|
|
78333
|
-
const result =
|
|
78423
|
+
const result = _internals44.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
|
|
78334
78424
|
cwd: process.cwd(),
|
|
78335
78425
|
stdin: "ignore",
|
|
78336
78426
|
stdout: "ignore",
|
|
@@ -78480,7 +78570,7 @@ async function discoverBuildCommands(workingDir, options) {
|
|
|
78480
78570
|
const scope = options?.scope ?? "all";
|
|
78481
78571
|
const changedFiles = options?.changedFiles ?? [];
|
|
78482
78572
|
const _filesToCheck = filterByScope(workingDir, scope, changedFiles);
|
|
78483
|
-
const profileResult = await
|
|
78573
|
+
const profileResult = await _internals44.discoverBuildCommandsFromProfiles(workingDir);
|
|
78484
78574
|
const profileCommands = profileResult.commands;
|
|
78485
78575
|
const profileSkipped = profileResult.skipped;
|
|
78486
78576
|
const coveredEcosystems = new Set;
|
|
@@ -78543,7 +78633,7 @@ function clearToolchainCache() {
|
|
|
78543
78633
|
function getEcosystems() {
|
|
78544
78634
|
return ECOSYSTEMS.map((e) => e.ecosystem);
|
|
78545
78635
|
}
|
|
78546
|
-
var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000,
|
|
78636
|
+
var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals44, build_discovery;
|
|
78547
78637
|
var init_discovery = __esm(() => {
|
|
78548
78638
|
init_dist();
|
|
78549
78639
|
init_detector();
|
|
@@ -78661,7 +78751,7 @@ var init_discovery = __esm(() => {
|
|
|
78661
78751
|
php: ["php-composer"]
|
|
78662
78752
|
};
|
|
78663
78753
|
toolchainCache = new Map;
|
|
78664
|
-
|
|
78754
|
+
_internals44 = {
|
|
78665
78755
|
isCommandAvailable,
|
|
78666
78756
|
discoverBuildCommandsFromProfiles,
|
|
78667
78757
|
discoverBuildCommands,
|
|
@@ -79318,7 +79408,7 @@ async function handleEpicCommand(directory, args2, sessionID) {
|
|
|
79318
79408
|
if (!sessionID || sessionID.trim() === "") {
|
|
79319
79409
|
return "Error: No active session context. Epic Mode requires an active session. Use /swarm epic from within an OpenCode session.";
|
|
79320
79410
|
}
|
|
79321
|
-
const session =
|
|
79411
|
+
const session = _internals45.ensureAgentSession(sessionID, undefined, directory);
|
|
79322
79412
|
const arg0 = args2[0]?.toLowerCase();
|
|
79323
79413
|
switch (arg0) {
|
|
79324
79414
|
case "status":
|
|
@@ -79345,7 +79435,7 @@ Usage:
|
|
|
79345
79435
|
}
|
|
79346
79436
|
function enableAndAck(directory, sessionID, session) {
|
|
79347
79437
|
try {
|
|
79348
|
-
|
|
79438
|
+
_internals45.enableEpicMode(directory, sessionID);
|
|
79349
79439
|
} catch (err2) {
|
|
79350
79440
|
return `Error enabling Epic Mode: ${err2 instanceof Error ? err2.message : String(err2)}`;
|
|
79351
79441
|
}
|
|
@@ -79361,7 +79451,7 @@ function enableAndAck(directory, sessionID, session) {
|
|
|
79361
79451
|
}
|
|
79362
79452
|
function disableAndAck(directory, sessionID, session) {
|
|
79363
79453
|
try {
|
|
79364
|
-
|
|
79454
|
+
_internals45.disableEpicMode(directory, sessionID);
|
|
79365
79455
|
} catch (err2) {
|
|
79366
79456
|
return `Error disabling Epic Mode: ${err2 instanceof Error ? err2.message : String(err2)}`;
|
|
79367
79457
|
}
|
|
@@ -79370,12 +79460,12 @@ function disableAndAck(directory, sessionID, session) {
|
|
|
79370
79460
|
}
|
|
79371
79461
|
function renderStatus(directory, sessionID) {
|
|
79372
79462
|
const lines = ["## Epic Mode — Status", ""];
|
|
79373
|
-
if (
|
|
79463
|
+
if (_internals45.isStateUnreadable(directory)) {
|
|
79374
79464
|
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.");
|
|
79375
79465
|
return lines.join(`
|
|
79376
79466
|
`);
|
|
79377
79467
|
}
|
|
79378
|
-
const state =
|
|
79468
|
+
const state = _internals45.loadEpicSessionState(directory, sessionID);
|
|
79379
79469
|
if (!state) {
|
|
79380
79470
|
lines.push("Epic Mode has not been toggled for this session.");
|
|
79381
79471
|
return lines.join(`
|
|
@@ -79427,7 +79517,7 @@ function formatGreenfieldDetail(input) {
|
|
|
79427
79517
|
function renderLast(directory) {
|
|
79428
79518
|
let records;
|
|
79429
79519
|
try {
|
|
79430
|
-
records =
|
|
79520
|
+
records = _internals45.readPromotionEvidence(directory);
|
|
79431
79521
|
} catch (err2) {
|
|
79432
79522
|
return `Error reading epic-promotions.jsonl: ${err2 instanceof Error ? err2.message : String(err2)}`;
|
|
79433
79523
|
}
|
|
@@ -79482,7 +79572,7 @@ function renderLast(directory) {
|
|
|
79482
79572
|
`);
|
|
79483
79573
|
}
|
|
79484
79574
|
function renderCalibration(directory) {
|
|
79485
|
-
if (
|
|
79575
|
+
if (_internals45.isCalibrationStateUnreadable(directory)) {
|
|
79486
79576
|
return [
|
|
79487
79577
|
"## Epic Mode — Calibration",
|
|
79488
79578
|
"",
|
|
@@ -79494,11 +79584,11 @@ function renderCalibration(directory) {
|
|
|
79494
79584
|
}
|
|
79495
79585
|
let state;
|
|
79496
79586
|
try {
|
|
79497
|
-
state =
|
|
79587
|
+
state = _internals45.loadCalibrationState(directory);
|
|
79498
79588
|
} catch (err2) {
|
|
79499
79589
|
return `Error reading calibration state: ${err2 instanceof Error ? err2.message : String(err2)}`;
|
|
79500
79590
|
}
|
|
79501
|
-
const { config: config3 } =
|
|
79591
|
+
const { config: config3 } = _internals45.loadPluginConfigWithMeta(directory);
|
|
79502
79592
|
const staticThreshold = config3.turbo?.epic?.mode?.activation_threshold ?? 0.3;
|
|
79503
79593
|
const calibrationCfg = config3.turbo?.epic?.calibration;
|
|
79504
79594
|
const loosenWindow = calibrationCfg?.loosen_window ?? 10;
|
|
@@ -79546,7 +79636,7 @@ function renderCalibration(directory) {
|
|
|
79546
79636
|
lines.push("");
|
|
79547
79637
|
let recentDivergent = [];
|
|
79548
79638
|
try {
|
|
79549
|
-
const all =
|
|
79639
|
+
const all = _internals45.readDivergenceHistory(directory, { limit: 50 });
|
|
79550
79640
|
recentDivergent = all.filter((r) => !r.isClean).slice(-5);
|
|
79551
79641
|
} catch {}
|
|
79552
79642
|
lines.push("### Recent divergent tasks (tightened the threshold)");
|
|
@@ -79563,11 +79653,11 @@ function renderCalibration(directory) {
|
|
|
79563
79653
|
`);
|
|
79564
79654
|
}
|
|
79565
79655
|
async function renderDecide(directory) {
|
|
79566
|
-
const plan = await
|
|
79656
|
+
const plan = await _internals45.loadPlanJsonOnly(directory);
|
|
79567
79657
|
if (!plan) {
|
|
79568
79658
|
return "No plan found at `.swarm/plan.json`. Run `/swarm plan` first.";
|
|
79569
79659
|
}
|
|
79570
|
-
const { config: config3 } =
|
|
79660
|
+
const { config: config3 } = _internals45.loadPluginConfigWithMeta(directory);
|
|
79571
79661
|
const modeCfg = config3.turbo?.epic?.mode;
|
|
79572
79662
|
const cochangeCfg = config3.turbo?.epic?.cochange;
|
|
79573
79663
|
const activationThreshold = modeCfg?.activation_threshold ?? 0.3;
|
|
@@ -79577,20 +79667,20 @@ async function renderDecide(directory) {
|
|
|
79577
79667
|
const tasks = [];
|
|
79578
79668
|
for (const phase of plan.phases) {
|
|
79579
79669
|
for (const task of phase.tasks) {
|
|
79580
|
-
const scopeFiles =
|
|
79670
|
+
const scopeFiles = _internals45.readTaskScopes(directory, task.id);
|
|
79581
79671
|
const scope = scopeFiles ?? task.files_touched ?? [];
|
|
79582
79672
|
tasks.push({ id: task.id, scope });
|
|
79583
79673
|
}
|
|
79584
79674
|
}
|
|
79585
|
-
const { pairs, commitsObserved } = await
|
|
79675
|
+
const { pairs, commitsObserved } = await _internals45.getCoChangeData(directory);
|
|
79586
79676
|
const isGitProject = (() => {
|
|
79587
79677
|
try {
|
|
79588
|
-
return
|
|
79678
|
+
return _internals45.isGitRepo(directory);
|
|
79589
79679
|
} catch {
|
|
79590
79680
|
return false;
|
|
79591
79681
|
}
|
|
79592
79682
|
})();
|
|
79593
|
-
const verdict =
|
|
79683
|
+
const verdict = _internals45.decideEpicActivation(tasks, pairs, commitsObserved, {
|
|
79594
79684
|
activationThreshold,
|
|
79595
79685
|
minCommitsForSignal,
|
|
79596
79686
|
cochangeNpmiThreshold,
|
|
@@ -79632,7 +79722,7 @@ function formatVerdict(verdict) {
|
|
|
79632
79722
|
return lines.join(`
|
|
79633
79723
|
`);
|
|
79634
79724
|
}
|
|
79635
|
-
var
|
|
79725
|
+
var _internals45;
|
|
79636
79726
|
var init_epic = __esm(() => {
|
|
79637
79727
|
init_config();
|
|
79638
79728
|
init_branch();
|
|
@@ -79645,7 +79735,7 @@ var init_epic = __esm(() => {
|
|
|
79645
79735
|
init_promotion_evidence();
|
|
79646
79736
|
init_state();
|
|
79647
79737
|
init_conflicts();
|
|
79648
|
-
|
|
79738
|
+
_internals45 = {
|
|
79649
79739
|
loadPluginConfigWithMeta,
|
|
79650
79740
|
loadPlanJsonOnly,
|
|
79651
79741
|
getCoChangeData,
|
|
@@ -79670,7 +79760,7 @@ var exports_evidence_summary_service = {};
|
|
|
79670
79760
|
__export(exports_evidence_summary_service, {
|
|
79671
79761
|
isAutoSummaryEnabled: () => isAutoSummaryEnabled,
|
|
79672
79762
|
buildEvidenceSummary: () => buildEvidenceSummary,
|
|
79673
|
-
_internals: () =>
|
|
79763
|
+
_internals: () => _internals46,
|
|
79674
79764
|
REQUIRED_EVIDENCE_TYPES: () => REQUIRED_EVIDENCE_TYPES,
|
|
79675
79765
|
EVIDENCE_SUMMARY_VERSION: () => EVIDENCE_SUMMARY_VERSION
|
|
79676
79766
|
});
|
|
@@ -79708,7 +79798,7 @@ function getTaskStatus(task, bundle) {
|
|
|
79708
79798
|
if (task?.status) {
|
|
79709
79799
|
return task.status;
|
|
79710
79800
|
}
|
|
79711
|
-
const entries =
|
|
79801
|
+
const entries = _internals46.normalizeBundleEntries(bundle);
|
|
79712
79802
|
if (entries.length > 0) {
|
|
79713
79803
|
return "completed";
|
|
79714
79804
|
}
|
|
@@ -79734,7 +79824,7 @@ function evidenceCompleteFromEntries(entries) {
|
|
|
79734
79824
|
};
|
|
79735
79825
|
}
|
|
79736
79826
|
function isEvidenceComplete(bundle) {
|
|
79737
|
-
return evidenceCompleteFromEntries(
|
|
79827
|
+
return evidenceCompleteFromEntries(_internals46.normalizeBundleEntries(bundle));
|
|
79738
79828
|
}
|
|
79739
79829
|
function getTaskBlockers(task, summary, status) {
|
|
79740
79830
|
const blockers = [];
|
|
@@ -79754,9 +79844,9 @@ async function buildTaskSummary(directory, task, taskId) {
|
|
|
79754
79844
|
const bundle = result.status === "found" ? result.bundle : null;
|
|
79755
79845
|
const gateEvidence = await readDurableGateEvidence(directory, taskId);
|
|
79756
79846
|
const phase = task?.phase ?? 0;
|
|
79757
|
-
const status =
|
|
79758
|
-
const entries = mergeDurableGateEntriesFromEvidence(taskId,
|
|
79759
|
-
let evidenceCheck =
|
|
79847
|
+
const status = _internals46.getTaskStatus(task, bundle);
|
|
79848
|
+
const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals46.normalizeBundleEntries(bundle), gateEvidence);
|
|
79849
|
+
let evidenceCheck = _internals46.evidenceCompleteFromEntries(entries);
|
|
79760
79850
|
if (gateEvidence) {
|
|
79761
79851
|
const gateStatus = getDurableGateEvidenceStatus(gateEvidence);
|
|
79762
79852
|
evidenceCheck = gateStatus.isComplete ? { isComplete: true, missingEvidence: [] } : {
|
|
@@ -79764,7 +79854,7 @@ async function buildTaskSummary(directory, task, taskId) {
|
|
|
79764
79854
|
missingEvidence: gateStatus.missingGates.map((gate) => `gate:${gate}`)
|
|
79765
79855
|
};
|
|
79766
79856
|
}
|
|
79767
|
-
const blockers =
|
|
79857
|
+
const blockers = _internals46.getTaskBlockers(task, evidenceCheck, status);
|
|
79768
79858
|
const hasReview = entries.some((e) => e.type === "review");
|
|
79769
79859
|
const hasTest = entries.some((e) => e.type === "test");
|
|
79770
79860
|
const hasApproval = entries.some((e) => e.type === "approval");
|
|
@@ -79793,12 +79883,12 @@ async function buildPhaseSummary(directory, phase) {
|
|
|
79793
79883
|
const taskSummaries = [];
|
|
79794
79884
|
const _taskMap = new Map(phase.tasks.map((t) => [t.id, t]));
|
|
79795
79885
|
for (const task of phase.tasks) {
|
|
79796
|
-
const summary = await
|
|
79886
|
+
const summary = await _internals46.buildTaskSummary(directory, task, task.id);
|
|
79797
79887
|
taskSummaries.push(summary);
|
|
79798
79888
|
}
|
|
79799
79889
|
const extraTaskIds = taskIds.filter((id) => !phaseTaskIds.has(id));
|
|
79800
79890
|
for (const taskId of extraTaskIds) {
|
|
79801
|
-
const summary = await
|
|
79891
|
+
const summary = await _internals46.buildTaskSummary(directory, undefined, taskId);
|
|
79802
79892
|
if (summary.phase === phase.id) {
|
|
79803
79893
|
taskSummaries.push(summary);
|
|
79804
79894
|
}
|
|
@@ -79899,7 +79989,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
|
|
|
79899
79989
|
let totalTasks = 0;
|
|
79900
79990
|
let completedTasks = 0;
|
|
79901
79991
|
for (const phase of phasesToProcess) {
|
|
79902
|
-
const summary = await
|
|
79992
|
+
const summary = await _internals46.buildPhaseSummary(directory, phase);
|
|
79903
79993
|
phaseSummaries.push(summary);
|
|
79904
79994
|
totalTasks += summary.totalTasks;
|
|
79905
79995
|
completedTasks += summary.completedTasks;
|
|
@@ -79921,7 +80011,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
|
|
|
79921
80011
|
overallBlockers,
|
|
79922
80012
|
summaryText: ""
|
|
79923
80013
|
};
|
|
79924
|
-
artifact.summaryText =
|
|
80014
|
+
artifact.summaryText = _internals46.generateSummaryText(artifact);
|
|
79925
80015
|
log("[EvidenceSummary] Summary built", {
|
|
79926
80016
|
phases: phaseSummaries.length,
|
|
79927
80017
|
totalTasks,
|
|
@@ -79940,7 +80030,7 @@ function isAutoSummaryEnabled(automationConfig) {
|
|
|
79940
80030
|
}
|
|
79941
80031
|
return automationConfig.capabilities?.evidence_auto_summaries === true;
|
|
79942
80032
|
}
|
|
79943
|
-
var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0",
|
|
80033
|
+
var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals46;
|
|
79944
80034
|
var init_evidence_summary_service = __esm(() => {
|
|
79945
80035
|
init_gate_bridge();
|
|
79946
80036
|
init_manager2();
|
|
@@ -79955,7 +80045,7 @@ var init_evidence_summary_service = __esm(() => {
|
|
|
79955
80045
|
"retrospective"
|
|
79956
80046
|
]);
|
|
79957
80047
|
REQUIRED_EVIDENCE_TYPES = ["review", "test"];
|
|
79958
|
-
|
|
80048
|
+
_internals46 = {
|
|
79959
80049
|
buildEvidenceSummary,
|
|
79960
80050
|
isAutoSummaryEnabled,
|
|
79961
80051
|
normalizeBundleEntries,
|
|
@@ -80011,7 +80101,7 @@ function getVerdictEmoji(verdict) {
|
|
|
80011
80101
|
return getVerdictIcon(verdict);
|
|
80012
80102
|
}
|
|
80013
80103
|
async function getTaskEvidenceData(directory, taskId) {
|
|
80014
|
-
const result = await
|
|
80104
|
+
const result = await _internals47.loadEvidence(directory, taskId);
|
|
80015
80105
|
if (result.status !== "found") {
|
|
80016
80106
|
return {
|
|
80017
80107
|
hasEvidence: false,
|
|
@@ -80034,13 +80124,13 @@ async function getTaskEvidenceData(directory, taskId) {
|
|
|
80034
80124
|
};
|
|
80035
80125
|
}
|
|
80036
80126
|
async function getEvidenceListData(directory) {
|
|
80037
|
-
const taskIds = await
|
|
80127
|
+
const taskIds = await _internals47.listEvidenceTaskIds(directory);
|
|
80038
80128
|
if (taskIds.length === 0) {
|
|
80039
80129
|
return { hasEvidence: false, tasks: [] };
|
|
80040
80130
|
}
|
|
80041
80131
|
const tasks = [];
|
|
80042
80132
|
for (const taskId of taskIds) {
|
|
80043
|
-
const result = await
|
|
80133
|
+
const result = await _internals47.loadEvidence(directory, taskId);
|
|
80044
80134
|
if (result.status === "found") {
|
|
80045
80135
|
tasks.push({
|
|
80046
80136
|
taskId,
|
|
@@ -80154,10 +80244,10 @@ async function handleEvidenceSummaryCommand(directory) {
|
|
|
80154
80244
|
return lines.join(`
|
|
80155
80245
|
`);
|
|
80156
80246
|
}
|
|
80157
|
-
var
|
|
80247
|
+
var _internals47;
|
|
80158
80248
|
var init_evidence_service = __esm(() => {
|
|
80159
80249
|
init_manager2();
|
|
80160
|
-
|
|
80250
|
+
_internals47 = {
|
|
80161
80251
|
loadEvidence,
|
|
80162
80252
|
listEvidenceTaskIds
|
|
80163
80253
|
};
|
|
@@ -80806,7 +80896,7 @@ function extractCurrentPhaseFromPlan2(plan) {
|
|
|
80806
80896
|
if (!plan) {
|
|
80807
80897
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
80808
80898
|
}
|
|
80809
|
-
if (!
|
|
80899
|
+
if (!_internals48.validatePlanPhases(plan)) {
|
|
80810
80900
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
80811
80901
|
}
|
|
80812
80902
|
let currentPhase = null;
|
|
@@ -80948,9 +81038,9 @@ function extractPhaseMetrics(content) {
|
|
|
80948
81038
|
async function getHandoffData(directory) {
|
|
80949
81039
|
const now = new Date().toISOString();
|
|
80950
81040
|
const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
|
|
80951
|
-
const sessionState =
|
|
81041
|
+
const sessionState = _internals48.parseSessionState(sessionContent);
|
|
80952
81042
|
const plan = await loadPlanJsonOnly(directory);
|
|
80953
|
-
const planInfo =
|
|
81043
|
+
const planInfo = _internals48.extractCurrentPhaseFromPlan(plan);
|
|
80954
81044
|
if (!plan) {
|
|
80955
81045
|
const planMdContent = await readSwarmFileAsync(directory, "plan.md");
|
|
80956
81046
|
if (planMdContent) {
|
|
@@ -80969,8 +81059,8 @@ async function getHandoffData(directory) {
|
|
|
80969
81059
|
}
|
|
80970
81060
|
}
|
|
80971
81061
|
const contextContent = await readSwarmFileAsync(directory, "context.md");
|
|
80972
|
-
const recentDecisions =
|
|
80973
|
-
const rawPhaseMetrics =
|
|
81062
|
+
const recentDecisions = _internals48.extractDecisions(contextContent);
|
|
81063
|
+
const rawPhaseMetrics = _internals48.extractPhaseMetrics(contextContent);
|
|
80974
81064
|
const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
|
|
80975
81065
|
let delegationState = null;
|
|
80976
81066
|
if (sessionState?.delegationState) {
|
|
@@ -81134,13 +81224,13 @@ ${lines.join(`
|
|
|
81134
81224
|
`)}
|
|
81135
81225
|
\`\`\``;
|
|
81136
81226
|
}
|
|
81137
|
-
var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20,
|
|
81227
|
+
var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals48;
|
|
81138
81228
|
var init_handoff_service = __esm(() => {
|
|
81139
81229
|
init_utils2();
|
|
81140
81230
|
init_manager();
|
|
81141
81231
|
init_utils();
|
|
81142
81232
|
RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
|
|
81143
|
-
|
|
81233
|
+
_internals48 = {
|
|
81144
81234
|
getHandoffData,
|
|
81145
81235
|
formatHandoffMarkdown,
|
|
81146
81236
|
formatContinuationPrompt,
|
|
@@ -81283,22 +81373,22 @@ async function writeSnapshot(directory, state) {
|
|
|
81283
81373
|
}
|
|
81284
81374
|
function createSnapshotWriterHook(directory) {
|
|
81285
81375
|
return (_input, _output) => {
|
|
81286
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
81376
|
+
_writeInFlight = _writeInFlight.then(() => _internals49.writeSnapshot(directory, swarmState), () => _internals49.writeSnapshot(directory, swarmState));
|
|
81287
81377
|
return _writeInFlight;
|
|
81288
81378
|
};
|
|
81289
81379
|
}
|
|
81290
81380
|
async function flushPendingSnapshot(directory) {
|
|
81291
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
81381
|
+
_writeInFlight = _writeInFlight.then(() => _internals49.writeSnapshot(directory, swarmState), () => _internals49.writeSnapshot(directory, swarmState));
|
|
81292
81382
|
await _writeInFlight;
|
|
81293
81383
|
}
|
|
81294
|
-
var _writeInFlight,
|
|
81384
|
+
var _writeInFlight, _internals49;
|
|
81295
81385
|
var init_snapshot_writer = __esm(() => {
|
|
81296
81386
|
init_utils2();
|
|
81297
81387
|
init_state2();
|
|
81298
81388
|
init_utils();
|
|
81299
81389
|
init_bun_compat();
|
|
81300
81390
|
_writeInFlight = Promise.resolve();
|
|
81301
|
-
|
|
81391
|
+
_internals49 = {
|
|
81302
81392
|
writeSnapshot,
|
|
81303
81393
|
createSnapshotWriterHook,
|
|
81304
81394
|
flushPendingSnapshot
|
|
@@ -81618,7 +81708,7 @@ function validateAndSanitizeGithubUrl(rawUrl, resource) {
|
|
|
81618
81708
|
}
|
|
81619
81709
|
function detectGitRemote(cwd) {
|
|
81620
81710
|
try {
|
|
81621
|
-
const result =
|
|
81711
|
+
const result = _internals50.spawnSync("git", ["remote", "get-url", "origin"], {
|
|
81622
81712
|
encoding: "utf-8",
|
|
81623
81713
|
stdio: ["ignore", "pipe", "pipe"],
|
|
81624
81714
|
timeout: 5000,
|
|
@@ -81663,7 +81753,7 @@ function parseGitRemoteUrl(remoteUrl) {
|
|
|
81663
81753
|
}
|
|
81664
81754
|
return null;
|
|
81665
81755
|
}
|
|
81666
|
-
var MAX_URL_LEN = 2048, IPV4_PRIVATE, IPV4_LOOPBACK, IPV4_LINK_LOCAL, IPV4_PRIVATE_172, IPV4_PRIVATE_192, IPV4_ZERO_NETWORK, IPV6_LINK_LOCAL, IPV6_UNIQUE_LOCAL,
|
|
81756
|
+
var MAX_URL_LEN = 2048, IPV4_PRIVATE, IPV4_LOOPBACK, IPV4_LINK_LOCAL, IPV4_PRIVATE_172, IPV4_PRIVATE_192, IPV4_ZERO_NETWORK, IPV6_LINK_LOCAL, IPV6_UNIQUE_LOCAL, _internals50;
|
|
81667
81757
|
var init_url_security = __esm(() => {
|
|
81668
81758
|
IPV4_PRIVATE = /^10\./;
|
|
81669
81759
|
IPV4_LOOPBACK = /^127\./;
|
|
@@ -81673,7 +81763,7 @@ var init_url_security = __esm(() => {
|
|
|
81673
81763
|
IPV4_ZERO_NETWORK = /^0\./;
|
|
81674
81764
|
IPV6_LINK_LOCAL = /^fe80:/i;
|
|
81675
81765
|
IPV6_UNIQUE_LOCAL = /^f[cd][0-9a-f]{2}:/i;
|
|
81676
|
-
|
|
81766
|
+
_internals50 = { spawnSync: spawnSync10 };
|
|
81677
81767
|
});
|
|
81678
81768
|
|
|
81679
81769
|
// src/commands/issue.ts
|
|
@@ -81847,9 +81937,9 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
81847
81937
|
skippedReason: "empty-context"
|
|
81848
81938
|
};
|
|
81849
81939
|
}
|
|
81850
|
-
const rawEntries =
|
|
81940
|
+
const rawEntries = _internals51.parseContextMd(contextContent);
|
|
81851
81941
|
if (rawEntries.length === 0) {
|
|
81852
|
-
await
|
|
81942
|
+
await _internals51.writeSentinel(sentinelPath, 0, 0);
|
|
81853
81943
|
return {
|
|
81854
81944
|
migrated: true,
|
|
81855
81945
|
entriesMigrated: 0,
|
|
@@ -81860,10 +81950,10 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
81860
81950
|
const existing = await readKnowledge(knowledgePath);
|
|
81861
81951
|
let migrated = 0;
|
|
81862
81952
|
let dropped = 0;
|
|
81863
|
-
const projectName =
|
|
81953
|
+
const projectName = _internals51.inferProjectName(directory);
|
|
81864
81954
|
for (const raw of rawEntries) {
|
|
81865
81955
|
if (config3.validation_enabled !== false) {
|
|
81866
|
-
const category = raw.categoryHint ??
|
|
81956
|
+
const category = raw.categoryHint ?? _internals51.inferCategoryFromText(raw.text);
|
|
81867
81957
|
const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
|
|
81868
81958
|
category,
|
|
81869
81959
|
scope: "global",
|
|
@@ -81883,8 +81973,8 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
81883
81973
|
const entry = {
|
|
81884
81974
|
id: randomUUID6(),
|
|
81885
81975
|
tier: "swarm",
|
|
81886
|
-
lesson:
|
|
81887
|
-
category: raw.categoryHint ??
|
|
81976
|
+
lesson: _internals51.truncateLesson(raw.text),
|
|
81977
|
+
category: raw.categoryHint ?? _internals51.inferCategoryFromText(raw.text),
|
|
81888
81978
|
tags: [...inferredTags, `migration:${raw.sourceSection}`],
|
|
81889
81979
|
scope: "global",
|
|
81890
81980
|
confidence: 0.3,
|
|
@@ -81907,7 +81997,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
81907
81997
|
if (migrated > 0) {
|
|
81908
81998
|
await rewriteKnowledge(knowledgePath, existing);
|
|
81909
81999
|
}
|
|
81910
|
-
await
|
|
82000
|
+
await _internals51.writeSentinel(sentinelPath, migrated, dropped);
|
|
81911
82001
|
log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
|
|
81912
82002
|
return {
|
|
81913
82003
|
migrated: true,
|
|
@@ -81917,7 +82007,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
81917
82007
|
};
|
|
81918
82008
|
}
|
|
81919
82009
|
async function migrateHiveKnowledgeLegacy(config3) {
|
|
81920
|
-
const legacyHivePath =
|
|
82010
|
+
const legacyHivePath = _internals51.resolveLegacyHiveKnowledgePath();
|
|
81921
82011
|
const canonicalHivePath = resolveHiveKnowledgePath();
|
|
81922
82012
|
const sentinelPath = path73.join(path73.dirname(canonicalHivePath), ".hive-knowledge-migrated");
|
|
81923
82013
|
if (existsSync42(sentinelPath)) {
|
|
@@ -81940,7 +82030,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
81940
82030
|
}
|
|
81941
82031
|
const legacyEntries = await readKnowledge(legacyHivePath);
|
|
81942
82032
|
if (legacyEntries.length === 0) {
|
|
81943
|
-
await
|
|
82033
|
+
await _internals51.writeSentinel(sentinelPath, 0, 0);
|
|
81944
82034
|
return {
|
|
81945
82035
|
migrated: true,
|
|
81946
82036
|
entriesMigrated: 0,
|
|
@@ -81988,7 +82078,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
81988
82078
|
const newHiveEntry = {
|
|
81989
82079
|
id: resolvedId,
|
|
81990
82080
|
tier: "hive",
|
|
81991
|
-
lesson:
|
|
82081
|
+
lesson: _internals51.truncateLesson(lesson),
|
|
81992
82082
|
category,
|
|
81993
82083
|
tags: ["migration:legacy-hive"],
|
|
81994
82084
|
scope: scopeTag,
|
|
@@ -82007,7 +82097,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
82007
82097
|
encounter_score: 1
|
|
82008
82098
|
};
|
|
82009
82099
|
try {
|
|
82010
|
-
await
|
|
82100
|
+
await _internals51.appendKnowledge(canonicalHivePath, newHiveEntry);
|
|
82011
82101
|
existingHiveEntries.push(newHiveEntry);
|
|
82012
82102
|
migrated++;
|
|
82013
82103
|
} catch (appendError) {
|
|
@@ -82023,7 +82113,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
82023
82113
|
dropped++;
|
|
82024
82114
|
}
|
|
82025
82115
|
}
|
|
82026
|
-
await
|
|
82116
|
+
await _internals51.writeSentinel(sentinelPath, migrated, dropped);
|
|
82027
82117
|
log(`[knowledge-migrator] Migrated ${migrated} legacy hive entries, dropped ${dropped}`);
|
|
82028
82118
|
return {
|
|
82029
82119
|
migrated: true,
|
|
@@ -82034,7 +82124,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
82034
82124
|
};
|
|
82035
82125
|
}
|
|
82036
82126
|
function parseContextMd(content) {
|
|
82037
|
-
const sections =
|
|
82127
|
+
const sections = _internals51.splitIntoSections(content);
|
|
82038
82128
|
const entries = [];
|
|
82039
82129
|
const seen = new Set;
|
|
82040
82130
|
const sectionPatterns = [
|
|
@@ -82050,7 +82140,7 @@ function parseContextMd(content) {
|
|
|
82050
82140
|
const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
|
|
82051
82141
|
if (!match)
|
|
82052
82142
|
continue;
|
|
82053
|
-
const bullets =
|
|
82143
|
+
const bullets = _internals51.extractBullets(section.body);
|
|
82054
82144
|
for (const bullet of bullets) {
|
|
82055
82145
|
if (bullet.length < 15)
|
|
82056
82146
|
continue;
|
|
@@ -82059,9 +82149,9 @@ function parseContextMd(content) {
|
|
|
82059
82149
|
continue;
|
|
82060
82150
|
seen.add(normalized);
|
|
82061
82151
|
entries.push({
|
|
82062
|
-
text:
|
|
82152
|
+
text: _internals51.truncateLesson(bullet),
|
|
82063
82153
|
sourceSection: match.sourceSection,
|
|
82064
|
-
categoryHint:
|
|
82154
|
+
categoryHint: _internals51.inferCategoryFromText(bullet)
|
|
82065
82155
|
});
|
|
82066
82156
|
}
|
|
82067
82157
|
}
|
|
@@ -82167,12 +82257,12 @@ function resolveLegacyHiveKnowledgePath() {
|
|
|
82167
82257
|
}
|
|
82168
82258
|
return path73.join(dataDir, "hive-knowledge.jsonl");
|
|
82169
82259
|
}
|
|
82170
|
-
var
|
|
82260
|
+
var _internals51;
|
|
82171
82261
|
var init_knowledge_migrator = __esm(() => {
|
|
82172
82262
|
init_logger();
|
|
82173
82263
|
init_knowledge_store();
|
|
82174
82264
|
init_knowledge_validator();
|
|
82175
|
-
|
|
82265
|
+
_internals51 = {
|
|
82176
82266
|
appendKnowledge,
|
|
82177
82267
|
migrateContextToKnowledge,
|
|
82178
82268
|
migrateKnowledgeToExternal,
|
|
@@ -82424,7 +82514,7 @@ function timeoutMessage(timeoutMs) {
|
|
|
82424
82514
|
async function computeWithTimeout(directory, currentPhase, timeoutMs) {
|
|
82425
82515
|
const controller = new AbortController;
|
|
82426
82516
|
let timeout;
|
|
82427
|
-
const metricsPromise =
|
|
82517
|
+
const metricsPromise = _internals52.computeLearningMetrics(directory, {
|
|
82428
82518
|
currentPhase,
|
|
82429
82519
|
signal: controller.signal
|
|
82430
82520
|
});
|
|
@@ -82481,7 +82571,7 @@ ${JSON.stringify({
|
|
|
82481
82571
|
return `Error computing learning metrics: ${message}. Run /swarm diagnose to check .swarm/ health.`;
|
|
82482
82572
|
}
|
|
82483
82573
|
}
|
|
82484
|
-
var DEFAULT_LEARNING_TIMEOUT_MS = 30000, MAX_LEARNING_TIMEOUT_MS = 300000, LearningMetricsTimeoutError,
|
|
82574
|
+
var DEFAULT_LEARNING_TIMEOUT_MS = 30000, MAX_LEARNING_TIMEOUT_MS = 300000, LearningMetricsTimeoutError, _internals52;
|
|
82485
82575
|
var init_learning = __esm(() => {
|
|
82486
82576
|
init_learning_metrics();
|
|
82487
82577
|
LearningMetricsTimeoutError = class LearningMetricsTimeoutError extends Error {
|
|
@@ -82492,7 +82582,7 @@ var init_learning = __esm(() => {
|
|
|
82492
82582
|
this.name = "LearningMetricsTimeoutError";
|
|
82493
82583
|
}
|
|
82494
82584
|
};
|
|
82495
|
-
|
|
82585
|
+
_internals52 = {
|
|
82496
82586
|
computeLearningMetrics
|
|
82497
82587
|
};
|
|
82498
82588
|
});
|
|
@@ -87067,9 +87157,9 @@ var init_memory2 = __esm(() => {
|
|
|
87067
87157
|
|
|
87068
87158
|
// src/services/plan-service.ts
|
|
87069
87159
|
async function getPlanData(directory, phaseArg) {
|
|
87070
|
-
const plan = await
|
|
87160
|
+
const plan = await _internals53.loadPlanJsonOnly(directory);
|
|
87071
87161
|
if (plan) {
|
|
87072
|
-
const fullMarkdown =
|
|
87162
|
+
const fullMarkdown = _internals53.derivePlanMarkdown(plan);
|
|
87073
87163
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
87074
87164
|
return {
|
|
87075
87165
|
hasPlan: true,
|
|
@@ -87112,7 +87202,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
87112
87202
|
isLegacy: false
|
|
87113
87203
|
};
|
|
87114
87204
|
}
|
|
87115
|
-
const planContent = await
|
|
87205
|
+
const planContent = await _internals53.readSwarmFileAsync(directory, "plan.md");
|
|
87116
87206
|
if (!planContent) {
|
|
87117
87207
|
return {
|
|
87118
87208
|
hasPlan: false,
|
|
@@ -87208,11 +87298,11 @@ async function handlePlanCommand(directory, args2) {
|
|
|
87208
87298
|
const planData = await getPlanData(directory, phaseArg);
|
|
87209
87299
|
return formatPlanMarkdown(planData);
|
|
87210
87300
|
}
|
|
87211
|
-
var
|
|
87301
|
+
var _internals53;
|
|
87212
87302
|
var init_plan_service = __esm(() => {
|
|
87213
87303
|
init_utils2();
|
|
87214
87304
|
init_manager();
|
|
87215
|
-
|
|
87305
|
+
_internals53 = {
|
|
87216
87306
|
loadPlanJsonOnly,
|
|
87217
87307
|
derivePlanMarkdown,
|
|
87218
87308
|
readSwarmFileAsync
|
|
@@ -87233,10 +87323,10 @@ async function handlePostMortemCommand(directory, args2, options) {
|
|
|
87233
87323
|
};
|
|
87234
87324
|
if (options?.sessionID) {
|
|
87235
87325
|
try {
|
|
87236
|
-
pmOptions.llmDelegate =
|
|
87326
|
+
pmOptions.llmDelegate = _internals54.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
|
|
87237
87327
|
} catch {}
|
|
87238
87328
|
}
|
|
87239
|
-
const result = await
|
|
87329
|
+
const result = await _internals54.runCuratorPostMortem(directory, pmOptions);
|
|
87240
87330
|
const lines = [];
|
|
87241
87331
|
if (result.success) {
|
|
87242
87332
|
lines.push("## Post-Mortem Report Generated");
|
|
@@ -87267,11 +87357,11 @@ async function handlePostMortemCommand(directory, args2, options) {
|
|
|
87267
87357
|
return `Error running post-mortem: ${message}. Run /swarm diagnose to check .swarm/ health.`;
|
|
87268
87358
|
}
|
|
87269
87359
|
}
|
|
87270
|
-
var
|
|
87360
|
+
var _internals54;
|
|
87271
87361
|
var init_post_mortem = __esm(() => {
|
|
87272
87362
|
init_curator_llm_factory();
|
|
87273
87363
|
init_curator_postmortem();
|
|
87274
|
-
|
|
87364
|
+
_internals54 = {
|
|
87275
87365
|
createCuratorLLMDelegate,
|
|
87276
87366
|
runCuratorPostMortem
|
|
87277
87367
|
};
|
|
@@ -87407,7 +87497,7 @@ function formatRelativeTime(epochMs) {
|
|
|
87407
87497
|
return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
87408
87498
|
}
|
|
87409
87499
|
async function handlePrMonitorStatusCommand(directory, _args, sessionID) {
|
|
87410
|
-
const allActive = await
|
|
87500
|
+
const allActive = await _internals55.listActive(directory);
|
|
87411
87501
|
const sessionSubs = allActive.filter((record3) => record3.sessionID === sessionID);
|
|
87412
87502
|
if (sessionSubs.length === 0) {
|
|
87413
87503
|
return "No active PR subscriptions for this session.";
|
|
@@ -87436,10 +87526,10 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID) {
|
|
|
87436
87526
|
return lines.join(`
|
|
87437
87527
|
`);
|
|
87438
87528
|
}
|
|
87439
|
-
var
|
|
87529
|
+
var _internals55;
|
|
87440
87530
|
var init_pr_monitor_status = __esm(() => {
|
|
87441
87531
|
init_pr_subscriptions();
|
|
87442
|
-
|
|
87532
|
+
_internals55 = {
|
|
87443
87533
|
formatRelativeTime,
|
|
87444
87534
|
listActive
|
|
87445
87535
|
};
|
|
@@ -87544,7 +87634,7 @@ async function handlePrSubscribeCommand(directory, args2, sessionID) {
|
|
|
87544
87634
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
87545
87635
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
87546
87636
|
try {
|
|
87547
|
-
const config3 =
|
|
87637
|
+
const config3 = _internals56.loadPluginConfig(directory);
|
|
87548
87638
|
const prMonitorConfig = config3.pr_monitor;
|
|
87549
87639
|
if (!prMonitorConfig?.enabled) {
|
|
87550
87640
|
return [
|
|
@@ -87554,7 +87644,7 @@ async function handlePrSubscribeCommand(directory, args2, sessionID) {
|
|
|
87554
87644
|
].join(`
|
|
87555
87645
|
`);
|
|
87556
87646
|
}
|
|
87557
|
-
await
|
|
87647
|
+
await _internals56.subscribe(directory, {
|
|
87558
87648
|
sessionID,
|
|
87559
87649
|
prNumber: prInfo.number,
|
|
87560
87650
|
repoFullName,
|
|
@@ -87578,12 +87668,12 @@ async function handlePrSubscribeCommand(directory, args2, sessionID) {
|
|
|
87578
87668
|
`);
|
|
87579
87669
|
}
|
|
87580
87670
|
}
|
|
87581
|
-
var
|
|
87671
|
+
var _internals56;
|
|
87582
87672
|
var init_pr_subscribe = __esm(() => {
|
|
87583
87673
|
init_pr_subscriptions();
|
|
87584
87674
|
init_loader();
|
|
87585
87675
|
init_pr_ref();
|
|
87586
|
-
|
|
87676
|
+
_internals56 = {
|
|
87587
87677
|
loadPluginConfig,
|
|
87588
87678
|
subscribe
|
|
87589
87679
|
};
|
|
@@ -87607,9 +87697,9 @@ async function handlePrUnsubscribeCommand(directory, args2, sessionID) {
|
|
|
87607
87697
|
`);
|
|
87608
87698
|
}
|
|
87609
87699
|
const refToken = rest[0];
|
|
87610
|
-
const prInfo =
|
|
87700
|
+
const prInfo = _internals57.parsePrRef(refToken, directory);
|
|
87611
87701
|
if (!prInfo) {
|
|
87612
|
-
if (
|
|
87702
|
+
if (_internals57.looksLikePrRef(refToken)) {
|
|
87613
87703
|
return [
|
|
87614
87704
|
`Error: Could not resolve PR reference from "${refToken}".`,
|
|
87615
87705
|
"",
|
|
@@ -87630,8 +87720,8 @@ async function handlePrUnsubscribeCommand(directory, args2, sessionID) {
|
|
|
87630
87720
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
87631
87721
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
87632
87722
|
try {
|
|
87633
|
-
const correlationId =
|
|
87634
|
-
const result = await
|
|
87723
|
+
const correlationId = _internals57.buildCorrelationId(sessionID, repoFullName, prInfo.number);
|
|
87724
|
+
const result = await _internals57.unsubscribe(directory, correlationId);
|
|
87635
87725
|
if (!result) {
|
|
87636
87726
|
return [
|
|
87637
87727
|
`Not subscribed to ${prUrl}`,
|
|
@@ -87658,11 +87748,11 @@ async function handlePrUnsubscribeCommand(directory, args2, sessionID) {
|
|
|
87658
87748
|
`);
|
|
87659
87749
|
}
|
|
87660
87750
|
}
|
|
87661
|
-
var
|
|
87751
|
+
var _internals57;
|
|
87662
87752
|
var init_pr_unsubscribe = __esm(() => {
|
|
87663
87753
|
init_pr_subscriptions();
|
|
87664
87754
|
init_pr_ref();
|
|
87665
|
-
|
|
87755
|
+
_internals57 = {
|
|
87666
87756
|
unsubscribe,
|
|
87667
87757
|
buildCorrelationId,
|
|
87668
87758
|
parsePrRef,
|
|
@@ -88118,7 +88208,7 @@ async function runAdditionalLint(linter, mode, cwd) {
|
|
|
88118
88208
|
};
|
|
88119
88209
|
}
|
|
88120
88210
|
}
|
|
88121
|
-
var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint,
|
|
88211
|
+
var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals58;
|
|
88122
88212
|
var init_lint = __esm(() => {
|
|
88123
88213
|
init_zod();
|
|
88124
88214
|
init_discovery();
|
|
@@ -88150,15 +88240,15 @@ var init_lint = __esm(() => {
|
|
|
88150
88240
|
}
|
|
88151
88241
|
const { mode } = args2;
|
|
88152
88242
|
const cwd = directory;
|
|
88153
|
-
const linter = await
|
|
88243
|
+
const linter = await _internals58.detectAvailableLinter(directory);
|
|
88154
88244
|
if (linter) {
|
|
88155
|
-
const result = await
|
|
88245
|
+
const result = await _internals58.runLint(linter, mode, directory);
|
|
88156
88246
|
return JSON.stringify(result, null, 2);
|
|
88157
88247
|
}
|
|
88158
|
-
const additionalLinter =
|
|
88248
|
+
const additionalLinter = _internals58.detectAdditionalLinter(cwd);
|
|
88159
88249
|
if (additionalLinter) {
|
|
88160
88250
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
88161
|
-
const result = await
|
|
88251
|
+
const result = await _internals58.runAdditionalLint(additionalLinter, mode, cwd);
|
|
88162
88252
|
return JSON.stringify(result, null, 2);
|
|
88163
88253
|
}
|
|
88164
88254
|
const errorResult = {
|
|
@@ -88172,7 +88262,7 @@ For Rust: rustup component add clippy`
|
|
|
88172
88262
|
return JSON.stringify(errorResult, null, 2);
|
|
88173
88263
|
}
|
|
88174
88264
|
});
|
|
88175
|
-
|
|
88265
|
+
_internals58 = {
|
|
88176
88266
|
detectAvailableLinter,
|
|
88177
88267
|
runLint,
|
|
88178
88268
|
detectAdditionalLinter,
|
|
@@ -88486,7 +88576,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
88486
88576
|
}
|
|
88487
88577
|
async function runSecretscan(directory) {
|
|
88488
88578
|
try {
|
|
88489
|
-
const result = await
|
|
88579
|
+
const result = await _internals59.secretscan.execute({ directory }, {});
|
|
88490
88580
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
88491
88581
|
return JSON.parse(jsonStr);
|
|
88492
88582
|
} catch (e) {
|
|
@@ -88501,7 +88591,7 @@ async function runSecretscan(directory) {
|
|
|
88501
88591
|
return errorResult;
|
|
88502
88592
|
}
|
|
88503
88593
|
}
|
|
88504
|
-
var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS2, O_NOFOLLOW, secretscan,
|
|
88594
|
+
var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS2, O_NOFOLLOW, secretscan, _internals59;
|
|
88505
88595
|
var init_secretscan = __esm(() => {
|
|
88506
88596
|
init_zod();
|
|
88507
88597
|
init_path_security();
|
|
@@ -88873,7 +88963,7 @@ var init_secretscan = __esm(() => {
|
|
|
88873
88963
|
}
|
|
88874
88964
|
}
|
|
88875
88965
|
});
|
|
88876
|
-
|
|
88966
|
+
_internals59 = {
|
|
88877
88967
|
secretscan,
|
|
88878
88968
|
runSecretscan
|
|
88879
88969
|
};
|
|
@@ -89465,14 +89555,14 @@ function buildGoBackend() {
|
|
|
89465
89555
|
selectEntryPoints
|
|
89466
89556
|
};
|
|
89467
89557
|
}
|
|
89468
|
-
var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE,
|
|
89558
|
+
var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals60;
|
|
89469
89559
|
var init_go = __esm(() => {
|
|
89470
89560
|
init_default_backend();
|
|
89471
89561
|
init_profiles();
|
|
89472
89562
|
IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
|
|
89473
89563
|
IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
|
|
89474
89564
|
IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
|
|
89475
|
-
|
|
89565
|
+
_internals60 = { extractImports };
|
|
89476
89566
|
});
|
|
89477
89567
|
|
|
89478
89568
|
// src/lang/backends/python.ts
|
|
@@ -89584,13 +89674,13 @@ function buildPythonBackend() {
|
|
|
89584
89674
|
selectEntryPoints: selectEntryPoints2
|
|
89585
89675
|
};
|
|
89586
89676
|
}
|
|
89587
|
-
var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT,
|
|
89677
|
+
var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals61;
|
|
89588
89678
|
var init_python = __esm(() => {
|
|
89589
89679
|
init_default_backend();
|
|
89590
89680
|
init_profiles();
|
|
89591
89681
|
IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
|
|
89592
89682
|
IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
|
|
89593
|
-
|
|
89683
|
+
_internals61 = { extractImports: extractImports2 };
|
|
89594
89684
|
});
|
|
89595
89685
|
|
|
89596
89686
|
// src/test-impact/analyzer.ts
|
|
@@ -89814,7 +89904,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
|
|
|
89814
89904
|
return;
|
|
89815
89905
|
}
|
|
89816
89906
|
if (PYTHON_EXTENSIONS.has(ext)) {
|
|
89817
|
-
const modules =
|
|
89907
|
+
const modules = _internals61.extractImports(testFile, content);
|
|
89818
89908
|
for (const mod of modules) {
|
|
89819
89909
|
const resolved = resolvePythonImport(testDir, mod);
|
|
89820
89910
|
if (resolved !== null)
|
|
@@ -89823,7 +89913,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
|
|
|
89823
89913
|
return;
|
|
89824
89914
|
}
|
|
89825
89915
|
if (GO_EXTENSIONS.has(ext)) {
|
|
89826
|
-
const imports =
|
|
89916
|
+
const imports = _internals60.extractImports(testFile, content);
|
|
89827
89917
|
for (const importPath of imports) {
|
|
89828
89918
|
const sourceFiles = resolveGoImport(testDir, importPath);
|
|
89829
89919
|
for (const source of sourceFiles)
|
|
@@ -89850,8 +89940,8 @@ async function buildImpactMapInternal(cwd) {
|
|
|
89850
89940
|
return impactMap;
|
|
89851
89941
|
}
|
|
89852
89942
|
async function buildImpactMap(cwd) {
|
|
89853
|
-
const impactMap = await
|
|
89854
|
-
await
|
|
89943
|
+
const impactMap = await _internals62.buildImpactMapInternal(cwd);
|
|
89944
|
+
await _internals62.saveImpactMap(cwd, impactMap);
|
|
89855
89945
|
return impactMap;
|
|
89856
89946
|
}
|
|
89857
89947
|
async function loadImpactMap(cwd, options) {
|
|
@@ -89865,7 +89955,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
89865
89955
|
const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
89866
89956
|
if (hasValidValues) {
|
|
89867
89957
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
89868
|
-
if (!
|
|
89958
|
+
if (!_internals62.isCacheStale(map3, generatedAt)) {
|
|
89869
89959
|
return map3;
|
|
89870
89960
|
}
|
|
89871
89961
|
if (options?.skipRebuild) {
|
|
@@ -89885,13 +89975,13 @@ async function loadImpactMap(cwd, options) {
|
|
|
89885
89975
|
if (options?.skipRebuild) {
|
|
89886
89976
|
return {};
|
|
89887
89977
|
}
|
|
89888
|
-
return
|
|
89978
|
+
return _internals62.buildImpactMap(cwd);
|
|
89889
89979
|
}
|
|
89890
89980
|
async function saveImpactMap(cwd, impactMap) {
|
|
89891
89981
|
if (!path87.isAbsolute(cwd)) {
|
|
89892
89982
|
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
89893
89983
|
}
|
|
89894
|
-
|
|
89984
|
+
_internals62.validateProjectRoot(cwd);
|
|
89895
89985
|
const cacheDir2 = path87.join(cwd, ".swarm", "cache");
|
|
89896
89986
|
const cachePath = path87.join(cacheDir2, "impact-map.json");
|
|
89897
89987
|
if (!fs43.existsSync(cacheDir2)) {
|
|
@@ -89915,7 +90005,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
89915
90005
|
};
|
|
89916
90006
|
}
|
|
89917
90007
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
89918
|
-
const impactMap = await
|
|
90008
|
+
const impactMap = await _internals62.loadImpactMap(cwd);
|
|
89919
90009
|
const impactedTestsSet = new Set;
|
|
89920
90010
|
const untestedFiles = [];
|
|
89921
90011
|
let visitedCount = 0;
|
|
@@ -90000,7 +90090,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
90000
90090
|
budgetExceeded
|
|
90001
90091
|
};
|
|
90002
90092
|
}
|
|
90003
|
-
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache,
|
|
90093
|
+
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals62;
|
|
90004
90094
|
var init_analyzer = __esm(() => {
|
|
90005
90095
|
init_manager2();
|
|
90006
90096
|
init_go();
|
|
@@ -90013,7 +90103,7 @@ var init_analyzer = __esm(() => {
|
|
|
90013
90103
|
GO_EXTENSIONS = new Set([".go"]);
|
|
90014
90104
|
EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
90015
90105
|
goModuleCache = new Map;
|
|
90016
|
-
|
|
90106
|
+
_internals62 = {
|
|
90017
90107
|
validateProjectRoot,
|
|
90018
90108
|
normalizePath: normalizePath2,
|
|
90019
90109
|
isCacheStale,
|
|
@@ -90396,7 +90486,7 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
90396
90486
|
}
|
|
90397
90487
|
const historyPath = getHistoryPath(workingDir);
|
|
90398
90488
|
const historyDir = path88.dirname(historyPath);
|
|
90399
|
-
|
|
90489
|
+
_internals63.validateProjectRoot(workingDir);
|
|
90400
90490
|
if (!fs44.existsSync(historyDir)) {
|
|
90401
90491
|
fs44.mkdirSync(historyDir, { recursive: true });
|
|
90402
90492
|
}
|
|
@@ -90519,7 +90609,7 @@ function getAllHistory(workingDir) {
|
|
|
90519
90609
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
90520
90610
|
return records;
|
|
90521
90611
|
}
|
|
90522
|
-
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES,
|
|
90612
|
+
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals63;
|
|
90523
90613
|
var init_history_store = __esm(() => {
|
|
90524
90614
|
init_manager2();
|
|
90525
90615
|
DANGEROUS_PROPERTY_NAMES = new Set([
|
|
@@ -90527,7 +90617,7 @@ var init_history_store = __esm(() => {
|
|
|
90527
90617
|
"constructor",
|
|
90528
90618
|
"prototype"
|
|
90529
90619
|
]);
|
|
90530
|
-
|
|
90620
|
+
_internals63 = {
|
|
90531
90621
|
validateProjectRoot
|
|
90532
90622
|
};
|
|
90533
90623
|
});
|
|
@@ -90777,7 +90867,7 @@ function readPackageJsonRaw(dir) {
|
|
|
90777
90867
|
}
|
|
90778
90868
|
}
|
|
90779
90869
|
function readPackageJson(dir) {
|
|
90780
|
-
return
|
|
90870
|
+
return _internals64.readPackageJsonRaw(dir);
|
|
90781
90871
|
}
|
|
90782
90872
|
function readPackageJsonTestScript(dir) {
|
|
90783
90873
|
return readPackageJson(dir)?.scripts?.test ?? null;
|
|
@@ -90947,7 +91037,7 @@ function buildTypescriptBackend() {
|
|
|
90947
91037
|
selectEntryPoints: selectEntryPoints3
|
|
90948
91038
|
};
|
|
90949
91039
|
}
|
|
90950
|
-
var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2,
|
|
91040
|
+
var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals64;
|
|
90951
91041
|
var init_typescript = __esm(() => {
|
|
90952
91042
|
init_default_backend();
|
|
90953
91043
|
init_profiles();
|
|
@@ -90956,7 +91046,7 @@ var init_typescript = __esm(() => {
|
|
|
90956
91046
|
IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
90957
91047
|
IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
90958
91048
|
IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
|
|
90959
|
-
|
|
91049
|
+
_internals64 = {
|
|
90960
91050
|
readPackageJsonRaw,
|
|
90961
91051
|
readPackageJsonTestScript,
|
|
90962
91052
|
frameworkFromScriptsTest
|
|
@@ -90989,7 +91079,7 @@ __export(exports_dispatch, {
|
|
|
90989
91079
|
pickedProfiles: () => pickedProfiles,
|
|
90990
91080
|
pickBackend: () => pickBackend,
|
|
90991
91081
|
clearDispatchCache: () => clearDispatchCache,
|
|
90992
|
-
_internals: () =>
|
|
91082
|
+
_internals: () => _internals65
|
|
90993
91083
|
});
|
|
90994
91084
|
import * as fs48 from "node:fs";
|
|
90995
91085
|
import * as path92 from "node:path";
|
|
@@ -91044,7 +91134,7 @@ function findManifestRoot(start2) {
|
|
|
91044
91134
|
return start2;
|
|
91045
91135
|
}
|
|
91046
91136
|
function evictIfNeeded() {
|
|
91047
|
-
if (cache2.size <=
|
|
91137
|
+
if (cache2.size <= _internals65.cacheCapacity)
|
|
91048
91138
|
return;
|
|
91049
91139
|
let oldestKey;
|
|
91050
91140
|
let oldestOrder = Infinity;
|
|
@@ -91075,7 +91165,7 @@ async function pickBackend(dir) {
|
|
|
91075
91165
|
evictIfNeeded();
|
|
91076
91166
|
return null;
|
|
91077
91167
|
}
|
|
91078
|
-
const profiles = await
|
|
91168
|
+
const profiles = await _internals65.detectProjectLanguages(root);
|
|
91079
91169
|
if (profiles.length === 0) {
|
|
91080
91170
|
cache2.set(cacheKey, {
|
|
91081
91171
|
hash: hash4,
|
|
@@ -91107,12 +91197,12 @@ function clearDispatchCache() {
|
|
|
91107
91197
|
manifestRootCache.clear();
|
|
91108
91198
|
insertCounter = 0;
|
|
91109
91199
|
}
|
|
91110
|
-
var
|
|
91200
|
+
var _internals65, cache2, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
|
|
91111
91201
|
var init_dispatch = __esm(() => {
|
|
91112
91202
|
init_backends();
|
|
91113
91203
|
init_detector();
|
|
91114
91204
|
init_registry_backend();
|
|
91115
|
-
|
|
91205
|
+
_internals65 = {
|
|
91116
91206
|
detectProjectLanguages,
|
|
91117
91207
|
cacheCapacity: 64
|
|
91118
91208
|
};
|
|
@@ -92968,9 +93058,9 @@ function getVersionFileVersion(dir) {
|
|
|
92968
93058
|
async function runVersionCheck2(dir, _timeoutMs) {
|
|
92969
93059
|
const startTime = Date.now();
|
|
92970
93060
|
try {
|
|
92971
|
-
const packageVersion =
|
|
92972
|
-
const changelogVersion =
|
|
92973
|
-
const versionFileVersion =
|
|
93061
|
+
const packageVersion = _internals66.getPackageVersion(dir);
|
|
93062
|
+
const changelogVersion = _internals66.getChangelogVersion(dir);
|
|
93063
|
+
const versionFileVersion = _internals66.getVersionFileVersion(dir);
|
|
92974
93064
|
const versions3 = [];
|
|
92975
93065
|
if (packageVersion)
|
|
92976
93066
|
versions3.push(`package.json: ${packageVersion}`);
|
|
@@ -93334,7 +93424,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
93334
93424
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
93335
93425
|
let validatedDir;
|
|
93336
93426
|
try {
|
|
93337
|
-
validatedDir =
|
|
93427
|
+
validatedDir = _internals66.validateDirectoryPath(dir);
|
|
93338
93428
|
} catch (error93) {
|
|
93339
93429
|
return {
|
|
93340
93430
|
id: reportId,
|
|
@@ -93354,7 +93444,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
93354
93444
|
}
|
|
93355
93445
|
let validatedTimeout;
|
|
93356
93446
|
try {
|
|
93357
|
-
validatedTimeout =
|
|
93447
|
+
validatedTimeout = _internals66.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
93358
93448
|
} catch (error93) {
|
|
93359
93449
|
return {
|
|
93360
93450
|
id: reportId,
|
|
@@ -93395,12 +93485,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
93395
93485
|
});
|
|
93396
93486
|
const checks5 = [];
|
|
93397
93487
|
log("[Preflight] Running lint check...");
|
|
93398
|
-
const lintResult = await
|
|
93488
|
+
const lintResult = await _internals66.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
93399
93489
|
checks5.push(lintResult);
|
|
93400
93490
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
93401
93491
|
if (!cfg.skipTests) {
|
|
93402
93492
|
log("[Preflight] Running tests check...");
|
|
93403
|
-
const testsResult = await
|
|
93493
|
+
const testsResult = await _internals66.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
93404
93494
|
checks5.push(testsResult);
|
|
93405
93495
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
93406
93496
|
} else {
|
|
@@ -93412,7 +93502,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
93412
93502
|
}
|
|
93413
93503
|
if (!cfg.skipSecrets) {
|
|
93414
93504
|
log("[Preflight] Running secrets check...");
|
|
93415
|
-
const secretsResult = await
|
|
93505
|
+
const secretsResult = await _internals66.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
93416
93506
|
checks5.push(secretsResult);
|
|
93417
93507
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
93418
93508
|
} else {
|
|
@@ -93424,7 +93514,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
93424
93514
|
}
|
|
93425
93515
|
if (!cfg.skipEvidence) {
|
|
93426
93516
|
log("[Preflight] Running evidence check...");
|
|
93427
|
-
const evidenceResult = await
|
|
93517
|
+
const evidenceResult = await _internals66.runEvidenceCheck(validatedDir);
|
|
93428
93518
|
checks5.push(evidenceResult);
|
|
93429
93519
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
93430
93520
|
} else {
|
|
@@ -93435,12 +93525,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
93435
93525
|
});
|
|
93436
93526
|
}
|
|
93437
93527
|
log("[Preflight] Running requirement coverage check...");
|
|
93438
|
-
const reqCoverageResult = await
|
|
93528
|
+
const reqCoverageResult = await _internals66.runRequirementCoverageCheck(validatedDir, phase);
|
|
93439
93529
|
checks5.push(reqCoverageResult);
|
|
93440
93530
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
93441
93531
|
if (!cfg.skipVersion) {
|
|
93442
93532
|
log("[Preflight] Running version check...");
|
|
93443
|
-
const versionResult = await
|
|
93533
|
+
const versionResult = await _internals66.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
93444
93534
|
checks5.push(versionResult);
|
|
93445
93535
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
93446
93536
|
} else {
|
|
@@ -93503,10 +93593,10 @@ function formatPreflightMarkdown(report) {
|
|
|
93503
93593
|
async function handlePreflightCommand(directory, _args) {
|
|
93504
93594
|
const plan = await loadPlan(directory);
|
|
93505
93595
|
const phase = plan?.current_phase ?? 1;
|
|
93506
|
-
const report = await
|
|
93507
|
-
return
|
|
93596
|
+
const report = await _internals66.runPreflight(directory, phase);
|
|
93597
|
+
return _internals66.formatPreflightMarkdown(report);
|
|
93508
93598
|
}
|
|
93509
|
-
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG,
|
|
93599
|
+
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals66;
|
|
93510
93600
|
var init_preflight_service = __esm(() => {
|
|
93511
93601
|
init_gate_bridge();
|
|
93512
93602
|
init_manager2();
|
|
@@ -93525,7 +93615,7 @@ var init_preflight_service = __esm(() => {
|
|
|
93525
93615
|
testScope: "convention",
|
|
93526
93616
|
linter: "biome"
|
|
93527
93617
|
};
|
|
93528
|
-
|
|
93618
|
+
_internals66 = {
|
|
93529
93619
|
runPreflight,
|
|
93530
93620
|
formatPreflightMarkdown,
|
|
93531
93621
|
handlePreflightCommand,
|
|
@@ -95349,7 +95439,7 @@ function resetPrmSessionState(session, sessionId) {
|
|
|
95349
95439
|
session.prmTrajectoryStep = 0;
|
|
95350
95440
|
session.replayArtifactPath = null;
|
|
95351
95441
|
if (sessionId) {
|
|
95352
|
-
|
|
95442
|
+
_internals67.clearTrajectoryCache(sessionId);
|
|
95353
95443
|
}
|
|
95354
95444
|
}
|
|
95355
95445
|
function createPrmHook(config3, directory) {
|
|
@@ -95358,26 +95448,26 @@ function createPrmHook(config3, directory) {
|
|
|
95358
95448
|
return;
|
|
95359
95449
|
}
|
|
95360
95450
|
const { sessionID } = context;
|
|
95361
|
-
const session =
|
|
95451
|
+
const session = _internals67.getAgentSession(sessionID);
|
|
95362
95452
|
if (!session || !session.delegationActive) {
|
|
95363
95453
|
return;
|
|
95364
95454
|
}
|
|
95365
95455
|
try {
|
|
95366
|
-
const cachedTrajectory =
|
|
95367
|
-
const trajectory = cachedTrajectory.length > 0 ? cachedTrajectory : await
|
|
95368
|
-
const detectionResult =
|
|
95456
|
+
const cachedTrajectory = _internals67.getInMemoryTrajectory(sessionID);
|
|
95457
|
+
const trajectory = cachedTrajectory.length > 0 ? cachedTrajectory : await _internals67.readTrajectory(sessionID, directory);
|
|
95458
|
+
const detectionResult = _internals67.detectPatterns(trajectory, config3, session.prmTrajectoryStep);
|
|
95369
95459
|
if (detectionResult.matches.length === 0) {
|
|
95370
95460
|
return;
|
|
95371
95461
|
}
|
|
95372
95462
|
const sessionPrmState = session;
|
|
95373
95463
|
let escalationTracker = sessionPrmState.prmEscalationTracker;
|
|
95374
95464
|
if (!sessionPrmState.replayArtifactPath) {
|
|
95375
|
-
sessionPrmState.replayArtifactPath = await
|
|
95465
|
+
sessionPrmState.replayArtifactPath = await _internals67.startReplayRecording(sessionID, directory);
|
|
95376
95466
|
}
|
|
95377
95467
|
const artifactPath = sessionPrmState.replayArtifactPath;
|
|
95378
95468
|
if (!sessionPrmState.prmInitialized) {
|
|
95379
95469
|
sessionPrmState.prmInitialized = true;
|
|
95380
|
-
|
|
95470
|
+
_internals67.cleanupOldTrajectoryFiles(directory).catch(() => {});
|
|
95381
95471
|
}
|
|
95382
95472
|
if (!escalationTracker) {
|
|
95383
95473
|
const initialState = session.prmLastPatternDetected ? {
|
|
@@ -95392,8 +95482,8 @@ function createPrmHook(config3, directory) {
|
|
|
95392
95482
|
}
|
|
95393
95483
|
const previousEscalationLevel = session.prmEscalationLevel;
|
|
95394
95484
|
for (const match of detectionResult.matches) {
|
|
95395
|
-
const correction =
|
|
95396
|
-
const formattedCorrection =
|
|
95485
|
+
const correction = _internals67.generateCourseCorrection(match, trajectory);
|
|
95486
|
+
const formattedCorrection = _internals67.formatCourseCorrectionForInjection(correction);
|
|
95397
95487
|
if (!session.pendingAdvisoryMessages) {
|
|
95398
95488
|
session.pendingAdvisoryMessages = [];
|
|
95399
95489
|
}
|
|
@@ -95409,10 +95499,10 @@ function createPrmHook(config3, directory) {
|
|
|
95409
95499
|
session.prmEscalationLevel = escalationLevel;
|
|
95410
95500
|
session.prmLastPatternDetected = match;
|
|
95411
95501
|
session.prmHardStopPending = hardStopPending;
|
|
95412
|
-
|
|
95413
|
-
|
|
95502
|
+
_internals67.telemetry.prmPatternDetected(sessionID, match.pattern, match.severity, match.category, match.stepRange);
|
|
95503
|
+
_internals67.telemetry.prmCourseCorrectionInjected(sessionID, match.pattern, escalationLevel);
|
|
95414
95504
|
if (artifactPath) {
|
|
95415
|
-
await
|
|
95505
|
+
await _internals67.recordReplayEntry(artifactPath, sessionID, {
|
|
95416
95506
|
type: "pattern_detected",
|
|
95417
95507
|
data: {
|
|
95418
95508
|
pattern: match.pattern,
|
|
@@ -95427,7 +95517,7 @@ function createPrmHook(config3, directory) {
|
|
|
95427
95517
|
});
|
|
95428
95518
|
}
|
|
95429
95519
|
if (artifactPath) {
|
|
95430
|
-
await
|
|
95520
|
+
await _internals67.recordReplayEntry(artifactPath, sessionID, {
|
|
95431
95521
|
type: "course_correction",
|
|
95432
95522
|
data: {
|
|
95433
95523
|
pattern: correction.pattern,
|
|
@@ -95443,7 +95533,7 @@ function createPrmHook(config3, directory) {
|
|
|
95443
95533
|
}
|
|
95444
95534
|
escalationTracker.clearPendingCorrections();
|
|
95445
95535
|
if (artifactPath && session.prmEscalationLevel > previousEscalationLevel) {
|
|
95446
|
-
await
|
|
95536
|
+
await _internals67.recordReplayEntry(artifactPath, sessionID, {
|
|
95447
95537
|
type: "escalation",
|
|
95448
95538
|
data: {
|
|
95449
95539
|
previousLevel: previousEscalationLevel,
|
|
@@ -95453,7 +95543,7 @@ function createPrmHook(config3, directory) {
|
|
|
95453
95543
|
});
|
|
95454
95544
|
}
|
|
95455
95545
|
if (artifactPath && session.prmHardStopPending && previousEscalationLevel < 3) {
|
|
95456
|
-
await
|
|
95546
|
+
await _internals67.recordReplayEntry(artifactPath, sessionID, {
|
|
95457
95547
|
type: "hard_stop",
|
|
95458
95548
|
data: {
|
|
95459
95549
|
escalationLevel: session.prmEscalationLevel,
|
|
@@ -95470,7 +95560,7 @@ function createPrmHook(config3, directory) {
|
|
|
95470
95560
|
}
|
|
95471
95561
|
return { toolAfter };
|
|
95472
95562
|
}
|
|
95473
|
-
var
|
|
95563
|
+
var _internals67;
|
|
95474
95564
|
var init_prm = __esm(() => {
|
|
95475
95565
|
init_course_correction();
|
|
95476
95566
|
init_escalation();
|
|
@@ -95482,7 +95572,7 @@ var init_prm = __esm(() => {
|
|
|
95482
95572
|
init_pattern_detector();
|
|
95483
95573
|
init_replay();
|
|
95484
95574
|
init_trajectory_store();
|
|
95485
|
-
|
|
95575
|
+
_internals67 = {
|
|
95486
95576
|
getAgentSession,
|
|
95487
95577
|
readTrajectory,
|
|
95488
95578
|
getInMemoryTrajectory,
|
|
@@ -96032,7 +96122,7 @@ async function handleSimulateCommand(directory, args2) {
|
|
|
96032
96122
|
}
|
|
96033
96123
|
let darkMatterPairs;
|
|
96034
96124
|
try {
|
|
96035
|
-
darkMatterPairs = await
|
|
96125
|
+
darkMatterPairs = await _internals40.detectDarkMatter(directory, options);
|
|
96036
96126
|
} catch (err2) {
|
|
96037
96127
|
const errMsg = err2 instanceof Error ? err2.message : String(err2);
|
|
96038
96128
|
return `## Simulate Report
|
|
@@ -96626,7 +96716,7 @@ async function getStatusData(directory, agents) {
|
|
|
96626
96716
|
}
|
|
96627
96717
|
function enrichWithLeanTurbo(status, directory) {
|
|
96628
96718
|
const turboMode = hasActiveTurboMode();
|
|
96629
|
-
const leanActive =
|
|
96719
|
+
const leanActive = _internals68.hasActiveLeanTurbo();
|
|
96630
96720
|
let turboStrategy = "off";
|
|
96631
96721
|
if (leanActive) {
|
|
96632
96722
|
turboStrategy = "lean";
|
|
@@ -96645,7 +96735,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
96645
96735
|
}
|
|
96646
96736
|
}
|
|
96647
96737
|
if (leanSessionID) {
|
|
96648
|
-
const runState =
|
|
96738
|
+
const runState = _internals68.loadLeanTurboRunState(directory, leanSessionID);
|
|
96649
96739
|
if (runState) {
|
|
96650
96740
|
status.leanTurboPhase = runState.phase;
|
|
96651
96741
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -96677,7 +96767,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
96677
96767
|
}
|
|
96678
96768
|
}
|
|
96679
96769
|
}
|
|
96680
|
-
status.fullAutoActive =
|
|
96770
|
+
status.fullAutoActive = _internals68.hasActiveFullAuto();
|
|
96681
96771
|
return status;
|
|
96682
96772
|
}
|
|
96683
96773
|
function formatStatusMarkdown(status) {
|
|
@@ -96805,7 +96895,7 @@ async function countProposals(directory) {
|
|
|
96805
96895
|
return 0;
|
|
96806
96896
|
}
|
|
96807
96897
|
}
|
|
96808
|
-
var
|
|
96898
|
+
var _internals68;
|
|
96809
96899
|
var init_status_service = __esm(() => {
|
|
96810
96900
|
init_extractors();
|
|
96811
96901
|
init_knowledge_escalator();
|
|
@@ -96815,7 +96905,7 @@ var init_status_service = __esm(() => {
|
|
|
96815
96905
|
init_state4();
|
|
96816
96906
|
init_compaction_service();
|
|
96817
96907
|
init_context_budget_service();
|
|
96818
|
-
|
|
96908
|
+
_internals68 = {
|
|
96819
96909
|
loadLeanTurboRunState,
|
|
96820
96910
|
hasActiveLeanTurbo,
|
|
96821
96911
|
hasActiveFullAuto
|
|
@@ -96912,7 +97002,7 @@ async function handleTurboCommand(directory, args2, sessionID) {
|
|
|
96912
97002
|
if (arg0 === "on") {
|
|
96913
97003
|
let strategy = "standard";
|
|
96914
97004
|
try {
|
|
96915
|
-
const { config: config3 } =
|
|
97005
|
+
const { config: config3 } = _internals69.loadPluginConfigWithMeta(directory);
|
|
96916
97006
|
if (config3.turbo?.strategy === "lean") {
|
|
96917
97007
|
strategy = "lean";
|
|
96918
97008
|
}
|
|
@@ -97009,7 +97099,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
97009
97099
|
let maxParallelCoders = 4;
|
|
97010
97100
|
let conflictPolicy = "serialize";
|
|
97011
97101
|
try {
|
|
97012
|
-
const { config: config3 } =
|
|
97102
|
+
const { config: config3 } = _internals69.loadPluginConfigWithMeta(directory);
|
|
97013
97103
|
const leanConfig = config3.turbo?.lean;
|
|
97014
97104
|
if (leanConfig) {
|
|
97015
97105
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -97079,14 +97169,14 @@ function buildStatusMessage2(session, directory, sessionID) {
|
|
|
97079
97169
|
].join(`
|
|
97080
97170
|
`);
|
|
97081
97171
|
}
|
|
97082
|
-
var
|
|
97172
|
+
var _internals69;
|
|
97083
97173
|
var init_turbo = __esm(() => {
|
|
97084
97174
|
init_config();
|
|
97085
97175
|
init_state2();
|
|
97086
97176
|
init_state();
|
|
97087
97177
|
init_state4();
|
|
97088
97178
|
init_logger();
|
|
97089
|
-
|
|
97179
|
+
_internals69 = {
|
|
97090
97180
|
loadPluginConfigWithMeta
|
|
97091
97181
|
};
|
|
97092
97182
|
});
|
|
@@ -103919,42 +104009,42 @@ var init_evidence_summary_integration = __esm(() => {
|
|
|
103919
104009
|
var exports_pr_event_subscribers = {};
|
|
103920
104010
|
__export(exports_pr_event_subscribers, {
|
|
103921
104011
|
registerPrEventSubscribers: () => registerPrEventSubscribers,
|
|
103922
|
-
_internals: () =>
|
|
104012
|
+
_internals: () => _internals70
|
|
103923
104013
|
});
|
|
103924
104014
|
function registerPrEventSubscribers(options) {
|
|
103925
104015
|
const { directory, config: config3 } = options;
|
|
103926
|
-
const bus =
|
|
104016
|
+
const bus = _internals70.getGlobalEventBus();
|
|
103927
104017
|
const unsubscribers = [];
|
|
103928
104018
|
for (const [eventType, configFlag] of Object.entries(EVENT_CONFIG_MAP)) {
|
|
103929
104019
|
if (!config3[configFlag]) {
|
|
103930
|
-
|
|
104020
|
+
_internals70.log(`[pr-monitor] Skipping ${eventType} subscriber (disabled by config)`);
|
|
103931
104021
|
continue;
|
|
103932
104022
|
}
|
|
103933
104023
|
const listener = async (event) => {
|
|
103934
104024
|
try {
|
|
103935
|
-
await
|
|
104025
|
+
await _internals70.handlePrEvent(event, directory, config3);
|
|
103936
104026
|
} catch (err2) {
|
|
103937
|
-
|
|
104027
|
+
_internals70.log(`[pr-monitor] Error handling ${eventType}`, {
|
|
103938
104028
|
error: err2 instanceof Error ? err2.message : String(err2)
|
|
103939
104029
|
});
|
|
103940
104030
|
}
|
|
103941
104031
|
};
|
|
103942
104032
|
const unsub = bus.subscribe(eventType, listener);
|
|
103943
104033
|
unsubscribers.push(unsub);
|
|
103944
|
-
|
|
104034
|
+
_internals70.log(`[pr-monitor] Registered subscriber for ${eventType}`);
|
|
103945
104035
|
}
|
|
103946
104036
|
return () => {
|
|
103947
104037
|
for (const unsub of unsubscribers) {
|
|
103948
104038
|
unsub();
|
|
103949
104039
|
}
|
|
103950
|
-
|
|
104040
|
+
_internals70.log("[pr-monitor] Unregistered all PR event subscribers");
|
|
103951
104041
|
};
|
|
103952
104042
|
}
|
|
103953
104043
|
async function handlePrEvent(event, directory, config3) {
|
|
103954
104044
|
const payload = event.payload;
|
|
103955
104045
|
if (!payload?.prNumber || !payload?.repoFullName)
|
|
103956
104046
|
return;
|
|
103957
|
-
const subscriptions = await
|
|
104047
|
+
const subscriptions = await _internals70.listActive(directory);
|
|
103958
104048
|
const matching = subscriptions.filter((sub) => sub.prNumber === payload.prNumber && sub.repoFullName === payload.repoFullName);
|
|
103959
104049
|
if (matching.length === 0)
|
|
103960
104050
|
return;
|
|
@@ -103966,9 +104056,9 @@ async function handlePrEvent(event, directory, config3) {
|
|
|
103966
104056
|
return `[MODE: PR_FEEDBACK pr="${safePrUrl}"]`;
|
|
103967
104057
|
})() : null;
|
|
103968
104058
|
for (const sub of matching) {
|
|
103969
|
-
const session =
|
|
104059
|
+
const session = _internals70.getAgentSession(sub.sessionID);
|
|
103970
104060
|
if (!session) {
|
|
103971
|
-
|
|
104061
|
+
_internals70.log(`[pr-monitor] Session ${sub.sessionID} not found — skipping advisory delivery`);
|
|
103972
104062
|
continue;
|
|
103973
104063
|
}
|
|
103974
104064
|
session.pendingAdvisoryMessages ??= [];
|
|
@@ -103978,10 +104068,10 @@ async function handlePrEvent(event, directory, config3) {
|
|
|
103978
104068
|
continue;
|
|
103979
104069
|
}
|
|
103980
104070
|
session.pendingAdvisoryMessages.push(message);
|
|
103981
|
-
|
|
104071
|
+
_internals70.log(`[pr-monitor] Delivered ${event.type} advisory to session ${sub.sessionID}`);
|
|
103982
104072
|
if (modeSignal) {
|
|
103983
104073
|
session.pendingAdvisoryMessages.push(modeSignal);
|
|
103984
|
-
|
|
104074
|
+
_internals70.log(`[pr-monitor] Injected PR_FEEDBACK mode signal for session ${sub.sessionID} (${event.type})`);
|
|
103985
104075
|
}
|
|
103986
104076
|
}
|
|
103987
104077
|
}
|
|
@@ -104017,13 +104107,13 @@ function formatAdvisory(type, payload) {
|
|
|
104017
104107
|
return null;
|
|
104018
104108
|
}
|
|
104019
104109
|
}
|
|
104020
|
-
var
|
|
104110
|
+
var _internals70, AUTO_PR_FEEDBACK_EVENTS, EVENT_CONFIG_MAP;
|
|
104021
104111
|
var init_pr_event_subscribers = __esm(() => {
|
|
104022
104112
|
init_state2();
|
|
104023
104113
|
init_utils();
|
|
104024
104114
|
init_event_bus();
|
|
104025
104115
|
init_pr_subscriptions();
|
|
104026
|
-
|
|
104116
|
+
_internals70 = {
|
|
104027
104117
|
handlePrEvent,
|
|
104028
104118
|
getGlobalEventBus,
|
|
104029
104119
|
listActive,
|
|
@@ -108283,7 +108373,7 @@ __export(exports_runtime, {
|
|
|
108283
108373
|
getSupportedLanguages: () => getSupportedLanguages,
|
|
108284
108374
|
getInitializedLanguages: () => getInitializedLanguages,
|
|
108285
108375
|
clearParserCache: () => clearParserCache,
|
|
108286
|
-
_internals: () =>
|
|
108376
|
+
_internals: () => _internals81
|
|
108287
108377
|
});
|
|
108288
108378
|
import { existsSync as existsSync75, statSync as statSync28 } from "node:fs";
|
|
108289
108379
|
import * as path133 from "node:path";
|
|
@@ -108294,10 +108384,10 @@ async function initTreeSitter() {
|
|
|
108294
108384
|
const thisDir = path133.dirname(fileURLToPath4(import.meta.url));
|
|
108295
108385
|
const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
|
|
108296
108386
|
if (isSource) {
|
|
108297
|
-
await
|
|
108387
|
+
await _internals81.parserInit();
|
|
108298
108388
|
} else {
|
|
108299
108389
|
const grammarsDir = getGrammarsDirAbsolute();
|
|
108300
|
-
await
|
|
108390
|
+
await _internals81.parserInit({
|
|
108301
108391
|
locateFile(scriptName) {
|
|
108302
108392
|
return path133.join(grammarsDir, scriptName);
|
|
108303
108393
|
}
|
|
@@ -108412,13 +108502,13 @@ function getInitializedLanguages() {
|
|
|
108412
108502
|
function getSupportedLanguages() {
|
|
108413
108503
|
return Object.keys(LANGUAGE_WASM_MAP);
|
|
108414
108504
|
}
|
|
108415
|
-
var parserCache, inflightLoads, GRAMMAR_LOAD_TIMEOUT_MS = 1e4, initializedLanguages, treeSitterInitPromise = null,
|
|
108505
|
+
var parserCache, inflightLoads, GRAMMAR_LOAD_TIMEOUT_MS = 1e4, initializedLanguages, treeSitterInitPromise = null, _internals81, LANGUAGE_WASM_MAP;
|
|
108416
108506
|
var init_runtime = __esm(() => {
|
|
108417
108507
|
init_tree_sitter();
|
|
108418
108508
|
parserCache = new Map;
|
|
108419
108509
|
inflightLoads = new Map;
|
|
108420
108510
|
initializedLanguages = new Set;
|
|
108421
|
-
|
|
108511
|
+
_internals81 = {
|
|
108422
108512
|
parserInit: Parser.init
|
|
108423
108513
|
};
|
|
108424
108514
|
LANGUAGE_WASM_MAP = {
|
|
@@ -109064,47 +109154,21 @@ async function updateRetrievalOutcome(directory, phaseInfo, phaseSucceeded) {
|
|
|
109064
109154
|
if (!shownIds || shownIds.length === 0) {
|
|
109065
109155
|
return;
|
|
109066
109156
|
}
|
|
109067
|
-
const
|
|
109068
|
-
const
|
|
109069
|
-
await transactKnowledge(swarmPath, (entries) => {
|
|
109070
|
-
let mutated = false;
|
|
109071
|
-
for (const entry of entries) {
|
|
109072
|
-
if (shownIds.includes(entry.id)) {
|
|
109073
|
-
const ro = entry.retrieval_outcomes;
|
|
109074
|
-
if (phaseSucceeded) {
|
|
109075
|
-
ro.succeeded_after_shown_count = (ro.succeeded_after_shown_count ?? 0) + 1;
|
|
109076
|
-
} else {
|
|
109077
|
-
ro.failed_after_shown_count = (ro.failed_after_shown_count ?? 0) + 1;
|
|
109078
|
-
}
|
|
109079
|
-
mutated = true;
|
|
109080
|
-
foundInSwarm.add(entry.id);
|
|
109081
|
-
}
|
|
109082
|
-
}
|
|
109083
|
-
return mutated ? entries : null;
|
|
109084
|
-
});
|
|
109085
|
-
const remainingIds = shownIds.filter((id) => !foundInSwarm.has(id));
|
|
109086
|
-
if (remainingIds.length > 0) {
|
|
109087
|
-
const hivePath = resolveHiveKnowledgePath();
|
|
109088
|
-
await transactKnowledge(hivePath, (hiveEntries) => {
|
|
109089
|
-
let mutated = false;
|
|
109090
|
-
for (const entry of hiveEntries) {
|
|
109091
|
-
if (remainingIds.includes(entry.id)) {
|
|
109092
|
-
const ro = entry.retrieval_outcomes;
|
|
109093
|
-
if (phaseSucceeded) {
|
|
109094
|
-
ro.succeeded_after_shown_count = (ro.succeeded_after_shown_count ?? 0) + 1;
|
|
109095
|
-
} else {
|
|
109096
|
-
ro.failed_after_shown_count = (ro.failed_after_shown_count ?? 0) + 1;
|
|
109097
|
-
}
|
|
109098
|
-
mutated = true;
|
|
109099
|
-
}
|
|
109100
|
-
}
|
|
109101
|
-
return mutated ? hiveEntries : null;
|
|
109102
|
-
});
|
|
109103
|
-
}
|
|
109157
|
+
const outcome = phaseSucceeded ? "success" : "failure";
|
|
109158
|
+
const evidenceSummary = `${phaseInfo} ${phaseSucceeded ? "succeeded" : "failed"} after entry was shown`;
|
|
109104
109159
|
await transactShownFile(shownFile, (data) => {
|
|
109105
109160
|
delete data[phaseInfo];
|
|
109106
109161
|
return data;
|
|
109107
109162
|
});
|
|
109163
|
+
for (const id of shownIds) {
|
|
109164
|
+
await _internals82.recordKnowledgeEvent(directory, {
|
|
109165
|
+
type: "outcome",
|
|
109166
|
+
knowledge_id: id,
|
|
109167
|
+
phase: phaseInfo,
|
|
109168
|
+
outcome,
|
|
109169
|
+
evidence_summary: evidenceSummary
|
|
109170
|
+
});
|
|
109171
|
+
}
|
|
109108
109172
|
} catch {
|
|
109109
109173
|
warn("[swarm] Knowledge: failed to update retrieval outcomes");
|
|
109110
109174
|
}
|
|
@@ -109166,11 +109230,19 @@ function scoreDirectiveAgainstContext(entry, ctx) {
|
|
|
109166
109230
|
score += 0.1;
|
|
109167
109231
|
return { triggerHit, actionHit, agentHit, score: Math.min(1, score) };
|
|
109168
109232
|
}
|
|
109169
|
-
var JACCARD_THRESHOLD2 = 0.6, HIVE_TIER_BOOST = 0.05, DEFAULT_SAME_PROJECT_PENALTY = -0.05, QUARANTINED_STATUS = "quarantined";
|
|
109233
|
+
var JACCARD_THRESHOLD2 = 0.6, HIVE_TIER_BOOST = 0.05, DEFAULT_SAME_PROJECT_PENALTY = -0.05, QUARANTINED_STATUS = "quarantined", _internals82;
|
|
109170
109234
|
var init_knowledge_reader = __esm(() => {
|
|
109171
109235
|
init_task_file();
|
|
109172
109236
|
init_logger();
|
|
109237
|
+
init_knowledge_events();
|
|
109173
109238
|
init_knowledge_store();
|
|
109239
|
+
_internals82 = {
|
|
109240
|
+
readMergedKnowledge,
|
|
109241
|
+
updateRetrievalOutcome,
|
|
109242
|
+
scoreDirectiveAgainstContext,
|
|
109243
|
+
transactShownFile,
|
|
109244
|
+
recordKnowledgeEvent
|
|
109245
|
+
};
|
|
109174
109246
|
});
|
|
109175
109247
|
|
|
109176
109248
|
// src/hooks/search-knowledge.ts
|
|
@@ -109464,9 +109536,9 @@ var init_search_knowledge = __esm(() => {
|
|
|
109464
109536
|
var exports_knowledge_recall = {};
|
|
109465
109537
|
__export(exports_knowledge_recall, {
|
|
109466
109538
|
knowledge_recall: () => knowledge_recall,
|
|
109467
|
-
_internals: () =>
|
|
109539
|
+
_internals: () => _internals83
|
|
109468
109540
|
});
|
|
109469
|
-
var knowledge_recall,
|
|
109541
|
+
var knowledge_recall, _internals83;
|
|
109470
109542
|
var init_knowledge_recall = __esm(() => {
|
|
109471
109543
|
init_zod();
|
|
109472
109544
|
init_config();
|
|
@@ -109547,7 +109619,7 @@ var init_knowledge_recall = __esm(() => {
|
|
|
109547
109619
|
return JSON.stringify(result);
|
|
109548
109620
|
}
|
|
109549
109621
|
});
|
|
109550
|
-
|
|
109622
|
+
_internals83 = {
|
|
109551
109623
|
knowledge_recall
|
|
109552
109624
|
};
|
|
109553
109625
|
});
|
|
@@ -109602,7 +109674,7 @@ __export(exports_curator_drift, {
|
|
|
109602
109674
|
runDeterministicDriftCheck: () => runDeterministicDriftCheck,
|
|
109603
109675
|
readPriorDriftReports: () => readPriorDriftReports,
|
|
109604
109676
|
buildDriftInjectionText: () => buildDriftInjectionText,
|
|
109605
|
-
_internals: () =>
|
|
109677
|
+
_internals: () => _internals87
|
|
109606
109678
|
});
|
|
109607
109679
|
import * as fs85 from "node:fs";
|
|
109608
109680
|
import * as path141 from "node:path";
|
|
@@ -109651,7 +109723,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
|
|
|
109651
109723
|
try {
|
|
109652
109724
|
const planMd = await readSwarmFileAsync(directory, "plan.md");
|
|
109653
109725
|
const specMd = readEffectiveSpecSync(directory)?.content ?? null;
|
|
109654
|
-
const priorReports = await
|
|
109726
|
+
const priorReports = await _internals87.readPriorDriftReports(directory);
|
|
109655
109727
|
const complianceCount = curatorResult.compliance.length;
|
|
109656
109728
|
const warningCompliance = curatorResult.compliance.filter((obs) => obs.severity === "warning");
|
|
109657
109729
|
let alignment = "ALIGNED";
|
|
@@ -109714,7 +109786,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
|
|
|
109714
109786
|
scope_additions: [],
|
|
109715
109787
|
injection_summary: injectionSummary
|
|
109716
109788
|
};
|
|
109717
|
-
const reportPath = await
|
|
109789
|
+
const reportPath = await _internals87.writeDriftReport(directory, report);
|
|
109718
109790
|
getGlobalEventBus().publish("curator.drift.completed", {
|
|
109719
109791
|
phase,
|
|
109720
109792
|
alignment,
|
|
@@ -109777,13 +109849,13 @@ function buildDriftInjectionText(report, maxChars) {
|
|
|
109777
109849
|
}
|
|
109778
109850
|
return text.slice(0, maxChars);
|
|
109779
109851
|
}
|
|
109780
|
-
var DRIFT_REPORT_PREFIX = "drift-report-phase-",
|
|
109852
|
+
var DRIFT_REPORT_PREFIX = "drift-report-phase-", _internals87;
|
|
109781
109853
|
var init_curator_drift = __esm(() => {
|
|
109782
109854
|
init_event_bus();
|
|
109783
109855
|
init_effective_spec();
|
|
109784
109856
|
init_logger();
|
|
109785
109857
|
init_utils2();
|
|
109786
|
-
|
|
109858
|
+
_internals87 = {
|
|
109787
109859
|
readPriorDriftReports,
|
|
109788
109860
|
writeDriftReport,
|
|
109789
109861
|
runDeterministicDriftCheck,
|
|
@@ -109795,7 +109867,7 @@ var init_curator_drift = __esm(() => {
|
|
|
109795
109867
|
var exports_design_doc_drift = {};
|
|
109796
109868
|
__export(exports_design_doc_drift, {
|
|
109797
109869
|
runDesignDocDriftCheck: () => runDesignDocDriftCheck,
|
|
109798
|
-
_internals: () =>
|
|
109870
|
+
_internals: () => _internals111
|
|
109799
109871
|
});
|
|
109800
109872
|
import * as fs118 from "node:fs";
|
|
109801
109873
|
import * as path179 from "node:path";
|
|
@@ -109928,7 +110000,7 @@ async function runDesignDocDriftCheck(directory, phase, outDir) {
|
|
|
109928
110000
|
return null;
|
|
109929
110001
|
}
|
|
109930
110002
|
}
|
|
109931
|
-
var DOC_DRIFT_REPORT_PREFIX = "doc-drift-phase-", MAX_TRACEABILITY_BYTES, DESIGN_DOC_FILES, TRACEABILITY_REL,
|
|
110003
|
+
var DOC_DRIFT_REPORT_PREFIX = "doc-drift-phase-", MAX_TRACEABILITY_BYTES, DESIGN_DOC_FILES, TRACEABILITY_REL, _internals111;
|
|
109932
110004
|
var init_design_doc_drift = __esm(() => {
|
|
109933
110005
|
init_event_bus();
|
|
109934
110006
|
init_effective_spec();
|
|
@@ -109943,7 +110015,7 @@ var init_design_doc_drift = __esm(() => {
|
|
|
109943
110015
|
"idiom-notes": path179.join("reference", "idiom-notes.md")
|
|
109944
110016
|
};
|
|
109945
110017
|
TRACEABILITY_REL = path179.join("reference", "traceability.json");
|
|
109946
|
-
|
|
110018
|
+
_internals111 = {
|
|
109947
110019
|
mtimeMsOrNull,
|
|
109948
110020
|
resolveAnchorWithin,
|
|
109949
110021
|
DESIGN_DOC_FILES
|
|
@@ -109954,7 +110026,7 @@ var init_design_doc_drift = __esm(() => {
|
|
|
109954
110026
|
var exports_project_context = {};
|
|
109955
110027
|
__export(exports_project_context, {
|
|
109956
110028
|
buildProjectContext: () => buildProjectContext,
|
|
109957
|
-
_internals: () =>
|
|
110029
|
+
_internals: () => _internals124,
|
|
109958
110030
|
LANG_BACKEND_DETECTION_TIMEOUT_MS: () => LANG_BACKEND_DETECTION_TIMEOUT_MS
|
|
109959
110031
|
});
|
|
109960
110032
|
import * as fs142 from "node:fs";
|
|
@@ -110038,7 +110110,7 @@ function selectLintCommand(backend, directory) {
|
|
|
110038
110110
|
return null;
|
|
110039
110111
|
}
|
|
110040
110112
|
async function buildProjectContext(directory) {
|
|
110041
|
-
const backend = await
|
|
110113
|
+
const backend = await _internals124.pickBackend(directory);
|
|
110042
110114
|
if (!backend)
|
|
110043
110115
|
return null;
|
|
110044
110116
|
const ctx = emptyProjectContext();
|
|
@@ -110077,17 +110149,17 @@ async function buildProjectContext(directory) {
|
|
|
110077
110149
|
if (backend.prompts.reviewerChecklist.length > 0) {
|
|
110078
110150
|
ctx.REVIEWER_CHECKLIST = bulletList(backend.prompts.reviewerChecklist);
|
|
110079
110151
|
}
|
|
110080
|
-
const profiles =
|
|
110152
|
+
const profiles = _internals124.pickedProfiles(directory);
|
|
110081
110153
|
if (profiles.length > 1) {
|
|
110082
110154
|
ctx.PROJECT_CONTEXT_SECONDARY_LANGUAGES = profiles.slice(1).map((p) => p.id).join(", ");
|
|
110083
110155
|
}
|
|
110084
110156
|
return ctx;
|
|
110085
110157
|
}
|
|
110086
|
-
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300,
|
|
110158
|
+
var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300, _internals124;
|
|
110087
110159
|
var init_project_context = __esm(() => {
|
|
110088
110160
|
init_dispatch();
|
|
110089
110161
|
init_framework_detector();
|
|
110090
|
-
|
|
110162
|
+
_internals124 = {
|
|
110091
110163
|
pickBackend,
|
|
110092
110164
|
pickedProfiles
|
|
110093
110165
|
};
|
|
@@ -110511,11 +110583,11 @@ async function ghExecAsync(args2, cwd) {
|
|
|
110511
110583
|
});
|
|
110512
110584
|
});
|
|
110513
110585
|
}
|
|
110514
|
-
var
|
|
110586
|
+
var _internals71 = { ghExec, ghExecAsync, spawnSyncWithTransientRetry };
|
|
110515
110587
|
async function getPRStatus(prNumber, repoFullName, cwd) {
|
|
110516
110588
|
let stdout;
|
|
110517
110589
|
try {
|
|
110518
|
-
stdout = await
|
|
110590
|
+
stdout = await _internals71.ghExecAsync([
|
|
110519
110591
|
"pr",
|
|
110520
110592
|
"view",
|
|
110521
110593
|
String(prNumber),
|
|
@@ -110536,13 +110608,13 @@ async function getPRComments(prNumber, repoFullName, cwd, since) {
|
|
|
110536
110608
|
let issueComments;
|
|
110537
110609
|
let reviewComments;
|
|
110538
110610
|
try {
|
|
110539
|
-
const issueRaw = await
|
|
110611
|
+
const issueRaw = await _internals71.ghExecAsync(["api", issueCommentsPath], cwd);
|
|
110540
110612
|
issueComments = JSON.parse(issueRaw);
|
|
110541
110613
|
} catch (err2) {
|
|
110542
110614
|
throw new Error(`Failed to fetch issue comments for ${repoFullName}#${prNumber}: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
110543
110615
|
}
|
|
110544
110616
|
try {
|
|
110545
|
-
const reviewRaw = await
|
|
110617
|
+
const reviewRaw = await _internals71.ghExecAsync(["api", reviewCommentsPath], cwd);
|
|
110546
110618
|
reviewComments = JSON.parse(reviewRaw);
|
|
110547
110619
|
} catch (err2) {
|
|
110548
110620
|
throw new Error(`Failed to fetch review comments for ${repoFullName}#${prNumber}: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
@@ -110569,7 +110641,7 @@ async function getPRComments(prNumber, repoFullName, cwd, since) {
|
|
|
110569
110641
|
async function getMergeState(prNumber, repoFullName, cwd) {
|
|
110570
110642
|
let stdout;
|
|
110571
110643
|
try {
|
|
110572
|
-
stdout = await
|
|
110644
|
+
stdout = await _internals71.ghExecAsync([
|
|
110573
110645
|
"pr",
|
|
110574
110646
|
"view",
|
|
110575
110647
|
String(prNumber),
|
|
@@ -110591,7 +110663,7 @@ async function getMergeState(prNumber, repoFullName, cwd) {
|
|
|
110591
110663
|
async function getPRReviewState(prNumber, repoFullName, cwd) {
|
|
110592
110664
|
let stdout;
|
|
110593
110665
|
try {
|
|
110594
|
-
stdout = await
|
|
110666
|
+
stdout = await _internals71.ghExecAsync([
|
|
110595
110667
|
"pr",
|
|
110596
110668
|
"view",
|
|
110597
110669
|
String(prNumber),
|
|
@@ -110699,7 +110771,7 @@ class PrMonitorWorker {
|
|
|
110699
110771
|
async executePollCycle() {
|
|
110700
110772
|
log("[PrMonitorWorker] Poll cycle starting");
|
|
110701
110773
|
try {
|
|
110702
|
-
const activeSubs = await
|
|
110774
|
+
const activeSubs = await _internals72.listActive(this.directory);
|
|
110703
110775
|
if (activeSubs.length === 0) {
|
|
110704
110776
|
log("[PrMonitorWorker] No active subscriptions");
|
|
110705
110777
|
await this.runSweep();
|
|
@@ -110771,10 +110843,10 @@ class PrMonitorWorker {
|
|
|
110771
110843
|
}
|
|
110772
110844
|
try {
|
|
110773
110845
|
const [statusResult, commentsResult, mergeResult, reviewResult] = await Promise.all([
|
|
110774
|
-
|
|
110775
|
-
|
|
110776
|
-
|
|
110777
|
-
|
|
110846
|
+
_internals72.getPRStatus(sub.prNumber, sub.repoFullName, this.directory),
|
|
110847
|
+
_internals72.getPRComments(sub.prNumber, sub.repoFullName, this.directory),
|
|
110848
|
+
_internals72.getMergeState(sub.prNumber, sub.repoFullName, this.directory),
|
|
110849
|
+
_internals72.getPRReviewState(sub.prNumber, sub.repoFullName, this.directory)
|
|
110778
110850
|
]);
|
|
110779
110851
|
if (isTimedOut?.()) {
|
|
110780
110852
|
log("[PrMonitorWorker] Skipping late result — poll already timed out", {
|
|
@@ -110791,7 +110863,7 @@ class PrMonitorWorker {
|
|
|
110791
110863
|
await this.applyChanges(sub, changes, isTimedOut);
|
|
110792
110864
|
if (!isTimedOut?.()) {
|
|
110793
110865
|
this.circuitBreakerMap.delete(correlationId);
|
|
110794
|
-
await
|
|
110866
|
+
await _internals72.updateSnapshot(this.directory, correlationId, {
|
|
110795
110867
|
errorCount: 0,
|
|
110796
110868
|
lastCheckedAt: Date.now()
|
|
110797
110869
|
});
|
|
@@ -110992,7 +111064,7 @@ class PrMonitorWorker {
|
|
|
110992
111064
|
this.mergedOrClosedKeys.add(`${sub.repoFullName}::${sub.prNumber}`);
|
|
110993
111065
|
}
|
|
110994
111066
|
if (changes.isMerged && this.config.auto_unsubscribe_on_merge) {
|
|
110995
|
-
await
|
|
111067
|
+
await _internals72.unsubscribe(this.directory, sub.correlationId);
|
|
110996
111068
|
this.reviewStateMap.delete(sub.correlationId);
|
|
110997
111069
|
this.circuitBreakerMap.delete(sub.correlationId);
|
|
110998
111070
|
log("[PrMonitorWorker] Auto-unsubscribed merged PR", {
|
|
@@ -111001,7 +111073,7 @@ class PrMonitorWorker {
|
|
|
111001
111073
|
return;
|
|
111002
111074
|
}
|
|
111003
111075
|
if (changes.isClosed && this.config.auto_unsubscribe_on_close) {
|
|
111004
|
-
await
|
|
111076
|
+
await _internals72.unsubscribe(this.directory, sub.correlationId);
|
|
111005
111077
|
this.reviewStateMap.delete(sub.correlationId);
|
|
111006
111078
|
this.circuitBreakerMap.delete(sub.correlationId);
|
|
111007
111079
|
log("[PrMonitorWorker] Auto-unsubscribed closed PR", {
|
|
@@ -111013,7 +111085,7 @@ class PrMonitorWorker {
|
|
|
111013
111085
|
log("[PrMonitorWorker] Skipping snapshot update — poll timed out before write", { correlationId: sub.correlationId });
|
|
111014
111086
|
return;
|
|
111015
111087
|
}
|
|
111016
|
-
await
|
|
111088
|
+
await _internals72.updateSnapshot(this.directory, sub.correlationId, changes.snapshotUpdates);
|
|
111017
111089
|
}
|
|
111018
111090
|
async handlePollError(sub, error93) {
|
|
111019
111091
|
const correlationId = sub.correlationId;
|
|
@@ -111023,7 +111095,7 @@ class PrMonitorWorker {
|
|
|
111023
111095
|
cooldownLevel: 0
|
|
111024
111096
|
};
|
|
111025
111097
|
cb.errorCount++;
|
|
111026
|
-
await
|
|
111098
|
+
await _internals72.updateSnapshot(this.directory, correlationId, {
|
|
111027
111099
|
errorCount: cb.errorCount,
|
|
111028
111100
|
lastCheckedAt: Date.now()
|
|
111029
111101
|
});
|
|
@@ -111062,7 +111134,7 @@ class PrMonitorWorker {
|
|
|
111062
111134
|
source: "pr-monitor-worker"
|
|
111063
111135
|
};
|
|
111064
111136
|
try {
|
|
111065
|
-
const bus =
|
|
111137
|
+
const bus = _internals72.getGlobalEventBus();
|
|
111066
111138
|
await bus.publish(type, payload, "pr-monitor-worker");
|
|
111067
111139
|
} catch (err2) {
|
|
111068
111140
|
log("[PrMonitorWorker] Event publish failed", {
|
|
@@ -111080,7 +111152,7 @@ class PrMonitorWorker {
|
|
|
111080
111152
|
if (this.config.cleanup_ttl_days > 0) {
|
|
111081
111153
|
try {
|
|
111082
111154
|
const keysToPass = this.mergedOrClosedKeys.size > 0 ? this.mergedOrClosedKeys : undefined;
|
|
111083
|
-
await
|
|
111155
|
+
await _internals72.sweepStale(this.directory, this.config.cleanup_ttl_days, keysToPass);
|
|
111084
111156
|
} catch (err2) {
|
|
111085
111157
|
log("[PrMonitorWorker] Sweep failed", {
|
|
111086
111158
|
error: err2 instanceof Error ? err2.message : String(err2)
|
|
@@ -111104,7 +111176,7 @@ class PrMonitorWorker {
|
|
|
111104
111176
|
}
|
|
111105
111177
|
}
|
|
111106
111178
|
}
|
|
111107
|
-
var
|
|
111179
|
+
var _internals72 = {
|
|
111108
111180
|
getPRStatus,
|
|
111109
111181
|
getPRComments,
|
|
111110
111182
|
getMergeState,
|
|
@@ -111575,7 +111647,7 @@ import * as path113 from "node:path";
|
|
|
111575
111647
|
import * as crypto9 from "node:crypto";
|
|
111576
111648
|
import * as fs63 from "node:fs";
|
|
111577
111649
|
import * as path112 from "node:path";
|
|
111578
|
-
var
|
|
111650
|
+
var _internals73 = {
|
|
111579
111651
|
readFileSync: fs63.readFileSync,
|
|
111580
111652
|
writeFileSync: fs63.writeFileSync,
|
|
111581
111653
|
mkdirSync: fs63.mkdirSync,
|
|
@@ -111585,7 +111657,7 @@ var _internals72 = {
|
|
|
111585
111657
|
createHash: crypto9.createHash.bind(crypto9)
|
|
111586
111658
|
};
|
|
111587
111659
|
function computeContentHash(content) {
|
|
111588
|
-
return
|
|
111660
|
+
return _internals73.createHash("sha256").update(content, "utf-8").digest("hex");
|
|
111589
111661
|
}
|
|
111590
111662
|
function createEmptyContextMap() {
|
|
111591
111663
|
return {
|
|
@@ -111600,10 +111672,10 @@ function createEmptyContextMap() {
|
|
|
111600
111672
|
function loadContextMap(directory) {
|
|
111601
111673
|
const filePath = path112.join(directory, ".swarm", "context-map.json");
|
|
111602
111674
|
try {
|
|
111603
|
-
if (!
|
|
111675
|
+
if (!_internals73.existsSync(filePath)) {
|
|
111604
111676
|
return null;
|
|
111605
111677
|
}
|
|
111606
|
-
const raw =
|
|
111678
|
+
const raw = _internals73.readFileSync(filePath, "utf-8");
|
|
111607
111679
|
const parsed = JSON.parse(raw);
|
|
111608
111680
|
if (typeof parsed !== "object" || parsed === null || parsed.schema_version !== 1) {
|
|
111609
111681
|
return null;
|
|
@@ -111617,14 +111689,14 @@ function saveContextMap(map3, directory) {
|
|
|
111617
111689
|
const swarmDir = path112.join(directory, ".swarm");
|
|
111618
111690
|
const tmpPath = path112.join(swarmDir, "context-map.tmp");
|
|
111619
111691
|
const finalPath = path112.join(swarmDir, "context-map.json");
|
|
111620
|
-
|
|
111692
|
+
_internals73.mkdirSync(swarmDir, { recursive: true });
|
|
111621
111693
|
const updated = {
|
|
111622
111694
|
...map3,
|
|
111623
111695
|
generated_at: new Date().toISOString()
|
|
111624
111696
|
};
|
|
111625
111697
|
const json3 = JSON.stringify(updated, null, 2);
|
|
111626
|
-
|
|
111627
|
-
|
|
111698
|
+
_internals73.writeFileSync(tmpPath, json3, "utf-8");
|
|
111699
|
+
_internals73.renameSync(tmpPath, finalPath);
|
|
111628
111700
|
}
|
|
111629
111701
|
function appendTaskHistory(map3, summary) {
|
|
111630
111702
|
return {
|
|
@@ -111790,10 +111862,10 @@ function deriveFinalStatus(params) {
|
|
|
111790
111862
|
}
|
|
111791
111863
|
function readFileContent(absolutePath) {
|
|
111792
111864
|
try {
|
|
111793
|
-
if (!
|
|
111865
|
+
if (!_internals74.existsSync(absolutePath)) {
|
|
111794
111866
|
return null;
|
|
111795
111867
|
}
|
|
111796
|
-
return
|
|
111868
|
+
return _internals74.readFileSync(absolutePath, "utf-8");
|
|
111797
111869
|
} catch {
|
|
111798
111870
|
return null;
|
|
111799
111871
|
}
|
|
@@ -111803,9 +111875,9 @@ function refreshFileEntry(relativePath, absolutePath, existingEntry) {
|
|
|
111803
111875
|
if (content === null) {
|
|
111804
111876
|
return null;
|
|
111805
111877
|
}
|
|
111806
|
-
return
|
|
111878
|
+
return _internals74.extractFileSummary(relativePath, content, absolutePath, existingEntry);
|
|
111807
111879
|
}
|
|
111808
|
-
var
|
|
111880
|
+
var _internals74 = {
|
|
111809
111881
|
loadContextMap,
|
|
111810
111882
|
saveContextMap,
|
|
111811
111883
|
createEmptyContextMap,
|
|
@@ -111824,10 +111896,10 @@ function extractEvidenceFindings(taskId, directory) {
|
|
|
111824
111896
|
};
|
|
111825
111897
|
try {
|
|
111826
111898
|
const evidenceDir = path114.join(directory, ".swarm", "evidence", taskId);
|
|
111827
|
-
if (!
|
|
111899
|
+
if (!_internals74.existsSync(evidenceDir)) {
|
|
111828
111900
|
return result;
|
|
111829
111901
|
}
|
|
111830
|
-
const evidenceFiles =
|
|
111902
|
+
const evidenceFiles = _internals74.readdirSync(evidenceDir);
|
|
111831
111903
|
const targetFiles = [
|
|
111832
111904
|
"evidence.json",
|
|
111833
111905
|
"reviewer.json",
|
|
@@ -111919,20 +111991,20 @@ function extractEvidenceFindings(taskId, directory) {
|
|
|
111919
111991
|
}
|
|
111920
111992
|
function updateContextMapAfterAgent(params) {
|
|
111921
111993
|
try {
|
|
111922
|
-
let map3 =
|
|
111994
|
+
let map3 = _internals74.loadContextMap(params.directory);
|
|
111923
111995
|
if (map3 === null) {
|
|
111924
|
-
map3 =
|
|
111996
|
+
map3 = _internals74.createEmptyContextMap();
|
|
111925
111997
|
}
|
|
111926
111998
|
const root = path114.resolve(params.directory);
|
|
111927
111999
|
const updatedFiles = {
|
|
111928
112000
|
...map3.files
|
|
111929
112001
|
};
|
|
111930
112002
|
const validFiles = [];
|
|
111931
|
-
const realRoot =
|
|
112003
|
+
const realRoot = _internals74.realpathSync(root);
|
|
111932
112004
|
for (const filePath of params.files_touched) {
|
|
111933
112005
|
try {
|
|
111934
112006
|
const resolved = path114.resolve(root, filePath);
|
|
111935
|
-
const realResolved =
|
|
112007
|
+
const realResolved = _internals74.realpathSync(resolved);
|
|
111936
112008
|
const relative20 = path114.relative(realRoot, realResolved);
|
|
111937
112009
|
if (relative20.startsWith("..") || path114.isAbsolute(relative20)) {
|
|
111938
112010
|
continue;
|
|
@@ -111970,7 +112042,7 @@ function updateContextMapAfterAgent(params) {
|
|
|
111970
112042
|
reviewer_findings: reviewerFindings.length > 0 ? reviewerFindings : undefined,
|
|
111971
112043
|
final_status: mergedRejectionReasons.length > 0 ? "rejected" : deriveFinalStatus(params)
|
|
111972
112044
|
};
|
|
111973
|
-
map3 =
|
|
112045
|
+
map3 = _internals74.appendTaskHistory(map3, taskSummary);
|
|
111974
112046
|
if (params.decisions) {
|
|
111975
112047
|
for (const entry of params.decisions) {
|
|
111976
112048
|
const decision = {
|
|
@@ -111980,17 +112052,17 @@ function updateContextMapAfterAgent(params) {
|
|
|
111980
112052
|
timestamp: new Date().toISOString(),
|
|
111981
112053
|
task_id: params.task_id
|
|
111982
112054
|
};
|
|
111983
|
-
map3 =
|
|
112055
|
+
map3 = _internals74.appendDecision(map3, decision);
|
|
111984
112056
|
}
|
|
111985
112057
|
}
|
|
111986
|
-
|
|
112058
|
+
_internals74.saveContextMap(map3, params.directory);
|
|
111987
112059
|
return map3;
|
|
111988
112060
|
} catch {
|
|
111989
112061
|
try {
|
|
111990
|
-
const fallback =
|
|
112062
|
+
const fallback = _internals74.loadContextMap(params.directory) ?? _internals74.createEmptyContextMap();
|
|
111991
112063
|
return fallback;
|
|
111992
112064
|
} catch {
|
|
111993
|
-
return
|
|
112065
|
+
return _internals74.createEmptyContextMap();
|
|
111994
112066
|
}
|
|
111995
112067
|
}
|
|
111996
112068
|
}
|
|
@@ -113321,7 +113393,7 @@ import * as path116 from "node:path";
|
|
|
113321
113393
|
function estimateTokens3(content) {
|
|
113322
113394
|
return Math.max(1, estimateTokens2(content));
|
|
113323
113395
|
}
|
|
113324
|
-
var
|
|
113396
|
+
var _internals75 = {
|
|
113325
113397
|
loadContextMap,
|
|
113326
113398
|
createEmptyContextMap,
|
|
113327
113399
|
computeContentHash,
|
|
@@ -113389,14 +113461,14 @@ function buildReadPolicy(files, map3, directory, invalidateOnHashChange = true,
|
|
|
113389
113461
|
const absolutePath = path116.join(directory, filePath);
|
|
113390
113462
|
let currentContent;
|
|
113391
113463
|
try {
|
|
113392
|
-
if (
|
|
113393
|
-
currentContent =
|
|
113464
|
+
if (_internals75.existsSync(absolutePath)) {
|
|
113465
|
+
currentContent = _internals75.readFileSync(absolutePath, "utf-8");
|
|
113394
113466
|
}
|
|
113395
113467
|
} catch {}
|
|
113396
113468
|
if (contentCache !== undefined) {
|
|
113397
113469
|
contentCache.set(filePath, currentContent);
|
|
113398
113470
|
}
|
|
113399
|
-
if (currentContent === undefined || invalidateOnHashChange &&
|
|
113471
|
+
if (currentContent === undefined || invalidateOnHashChange && _internals75.isFileStale(entry, currentContent)) {
|
|
113400
113472
|
policy.push({
|
|
113401
113473
|
file_path: filePath,
|
|
113402
113474
|
trust_summary: false,
|
|
@@ -113471,7 +113543,7 @@ function pruneCapsuleContent(sections, tokenEstimate, maxTokens, estimateFn) {
|
|
|
113471
113543
|
function buildCapsule(params) {
|
|
113472
113544
|
const { task_id, agent_role, delegation_reason, directory } = params;
|
|
113473
113545
|
const generatedAt = new Date().toISOString();
|
|
113474
|
-
const map3 =
|
|
113546
|
+
const map3 = _internals75.loadContextMap(directory) ?? _internals75.createEmptyContextMap();
|
|
113475
113547
|
let profile = DEFAULT_ROLE_PROFILES[agent_role];
|
|
113476
113548
|
if (params.mode === "conservative") {
|
|
113477
113549
|
profile = { ...profile, max_files: Math.ceil(profile.max_files * 1.5) };
|
|
@@ -113500,7 +113572,7 @@ function buildCapsule(params) {
|
|
|
113500
113572
|
const shouldCheckStaleness = params.invalidate_on_hash_change !== false;
|
|
113501
113573
|
if (shouldCheckStaleness) {
|
|
113502
113574
|
const currentContent = contentCache.get(filePath);
|
|
113503
|
-
if (currentContent === undefined ||
|
|
113575
|
+
if (currentContent === undefined || _internals75.isFileStale(entry, currentContent)) {
|
|
113504
113576
|
staleEntries++;
|
|
113505
113577
|
fileSummaries.push(`- ${filePath} — ${entry.purpose || "No summary available"} (stale)`);
|
|
113506
113578
|
} else {
|
|
@@ -113542,11 +113614,11 @@ function buildCapsule(params) {
|
|
|
113542
113614
|
}
|
|
113543
113615
|
const content = sections.join(`
|
|
113544
113616
|
`);
|
|
113545
|
-
let tokenEstimate =
|
|
113617
|
+
let tokenEstimate = _internals75.estimateTokens(content);
|
|
113546
113618
|
const maxCapsuleTokens = params.max_capsule_tokens ?? 2000;
|
|
113547
113619
|
let prunedContent = content;
|
|
113548
113620
|
if (tokenEstimate > maxCapsuleTokens) {
|
|
113549
|
-
const { prunedSections, prunedTokenEstimate } = pruneCapsuleContent(sections, tokenEstimate, maxCapsuleTokens,
|
|
113621
|
+
const { prunedSections, prunedTokenEstimate } = pruneCapsuleContent(sections, tokenEstimate, maxCapsuleTokens, _internals75.estimateTokens);
|
|
113550
113622
|
prunedContent = prunedSections.join(`
|
|
113551
113623
|
`);
|
|
113552
113624
|
tokenEstimate = prunedTokenEstimate;
|
|
@@ -113582,7 +113654,7 @@ function buildCapsule(params) {
|
|
|
113582
113654
|
// src/context-map/capsule-persistence.ts
|
|
113583
113655
|
import * as fs69 from "node:fs";
|
|
113584
113656
|
import * as path117 from "node:path";
|
|
113585
|
-
var
|
|
113657
|
+
var _internals76 = {
|
|
113586
113658
|
writeFileSync: fs69.writeFileSync,
|
|
113587
113659
|
readFileSync: fs69.readFileSync,
|
|
113588
113660
|
existsSync: fs69.existsSync,
|
|
@@ -113618,10 +113690,10 @@ function saveCapsule(capsule, directory) {
|
|
|
113618
113690
|
const capsulesDir = path117.join(directory, ".swarm", "capsules");
|
|
113619
113691
|
const finalPath = capsulePath(capsule.task_id, directory);
|
|
113620
113692
|
const tmpPath = path117.join(capsulesDir, `capsule-${capsule.task_id}.tmp`);
|
|
113621
|
-
|
|
113693
|
+
_internals76.mkdirSync(capsulesDir, { recursive: true });
|
|
113622
113694
|
const json3 = JSON.stringify(capsule, null, 2);
|
|
113623
|
-
|
|
113624
|
-
|
|
113695
|
+
_internals76.writeFileSync(tmpPath, json3, "utf-8");
|
|
113696
|
+
_internals76.renameSync(tmpPath, finalPath);
|
|
113625
113697
|
return {
|
|
113626
113698
|
success: true,
|
|
113627
113699
|
capsule_path: finalPath,
|
|
@@ -113649,7 +113721,7 @@ function saveCapsule(capsule, directory) {
|
|
|
113649
113721
|
// src/context-map/telemetry.ts
|
|
113650
113722
|
import * as fs70 from "node:fs";
|
|
113651
113723
|
import * as path118 from "node:path";
|
|
113652
|
-
var
|
|
113724
|
+
var _internals77 = {
|
|
113653
113725
|
appendFileSync: fs70.appendFileSync,
|
|
113654
113726
|
readFileSync: fs70.readFileSync,
|
|
113655
113727
|
existsSync: fs70.existsSync,
|
|
@@ -113662,10 +113734,10 @@ function recordTelemetry(entry, directory) {
|
|
|
113662
113734
|
const filePath = telemetryFilePath(directory);
|
|
113663
113735
|
const swarmDir = path118.join(directory, ".swarm");
|
|
113664
113736
|
try {
|
|
113665
|
-
|
|
113737
|
+
_internals77.mkdirSync(swarmDir, { recursive: true });
|
|
113666
113738
|
const line = `${JSON.stringify(entry)}
|
|
113667
113739
|
`;
|
|
113668
|
-
|
|
113740
|
+
_internals77.appendFileSync(filePath, line, "utf-8");
|
|
113669
113741
|
return true;
|
|
113670
113742
|
} catch {
|
|
113671
113743
|
return false;
|
|
@@ -113707,7 +113779,7 @@ function extractTaskGoal(taskId, directory) {
|
|
|
113707
113779
|
return "";
|
|
113708
113780
|
}
|
|
113709
113781
|
}
|
|
113710
|
-
var
|
|
113782
|
+
var _internals78 = {
|
|
113711
113783
|
buildCapsule,
|
|
113712
113784
|
recordTelemetry,
|
|
113713
113785
|
saveCapsule,
|
|
@@ -113775,21 +113847,21 @@ async function injectCapsule(input, output, config3, directory) {
|
|
|
113775
113847
|
const sessionID = input.sessionID;
|
|
113776
113848
|
if (!sessionID)
|
|
113777
113849
|
return;
|
|
113778
|
-
const agentName =
|
|
113850
|
+
const agentName = _internals78.getActiveAgent(sessionID);
|
|
113779
113851
|
if (!agentName)
|
|
113780
113852
|
return;
|
|
113781
113853
|
const role = extractCapsuleRole(agentName);
|
|
113782
113854
|
if (!role)
|
|
113783
113855
|
return;
|
|
113784
|
-
const taskId =
|
|
113856
|
+
const taskId = _internals78.getCurrentTaskId(sessionID);
|
|
113785
113857
|
const effectiveTaskId = taskId ?? "unknown";
|
|
113786
|
-
const files =
|
|
113858
|
+
const files = _internals78.readScopeFile(effectiveTaskId, directory);
|
|
113787
113859
|
if (files.length === 0)
|
|
113788
113860
|
return;
|
|
113789
113861
|
const maxTokens = config3.context_map?.max_capsule_tokens;
|
|
113790
|
-
const delegationReason =
|
|
113791
|
-
const taskGoal =
|
|
113792
|
-
const { capsule, metadata: metadata2 } =
|
|
113862
|
+
const delegationReason = _internals78.resolveCapsuleDelegationReason(_internals78.getSession(sessionID), role, effectiveTaskId);
|
|
113863
|
+
const taskGoal = _internals78.extractTaskGoal(effectiveTaskId, directory);
|
|
113864
|
+
const { capsule, metadata: metadata2 } = _internals78.buildCapsule({
|
|
113793
113865
|
task_id: effectiveTaskId,
|
|
113794
113866
|
agent_role: role,
|
|
113795
113867
|
delegation_reason: delegationReason,
|
|
@@ -113805,7 +113877,7 @@ async function injectCapsule(input, output, config3, directory) {
|
|
|
113805
113877
|
return;
|
|
113806
113878
|
output.system.push(capsule.content);
|
|
113807
113879
|
try {
|
|
113808
|
-
|
|
113880
|
+
_internals78.saveCapsule(capsule, directory);
|
|
113809
113881
|
} catch {}
|
|
113810
113882
|
const telemetryEntry = {
|
|
113811
113883
|
timestamp: new Date().toISOString(),
|
|
@@ -113821,7 +113893,7 @@ async function injectCapsule(input, output, config3, directory) {
|
|
|
113821
113893
|
success: metadata2.success
|
|
113822
113894
|
};
|
|
113823
113895
|
try {
|
|
113824
|
-
|
|
113896
|
+
_internals78.recordTelemetry(telemetryEntry, directory);
|
|
113825
113897
|
} catch {}
|
|
113826
113898
|
}
|
|
113827
113899
|
|
|
@@ -115997,7 +116069,7 @@ function validateGraphEdge(edge) {
|
|
|
115997
116069
|
}
|
|
115998
116070
|
|
|
115999
116071
|
// src/tools/repo-graph/builder.ts
|
|
116000
|
-
var
|
|
116072
|
+
var _internals79 = {
|
|
116001
116073
|
safeRealpathSync,
|
|
116002
116074
|
extractTSSymbols,
|
|
116003
116075
|
extractPythonSymbols,
|
|
@@ -116094,12 +116166,12 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
|
|
|
116094
116166
|
if (specifier.startsWith(".")) {
|
|
116095
116167
|
const sourceDir = path125.dirname(sourceFile);
|
|
116096
116168
|
let resolved = path125.resolve(sourceDir, specifier);
|
|
116097
|
-
const initialRealResolved =
|
|
116169
|
+
const initialRealResolved = _internals79.safeRealpathSync(resolved, resolved);
|
|
116098
116170
|
if (initialRealResolved === null) {
|
|
116099
116171
|
return null;
|
|
116100
116172
|
}
|
|
116101
116173
|
let realResolved = initialRealResolved;
|
|
116102
|
-
const realRoot =
|
|
116174
|
+
const realRoot = _internals79.safeRealpathSync(workspaceRoot, path125.normalize(workspaceRoot));
|
|
116103
116175
|
if (realRoot === null) {
|
|
116104
116176
|
return null;
|
|
116105
116177
|
}
|
|
@@ -116123,7 +116195,7 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
|
|
|
116123
116195
|
}
|
|
116124
116196
|
}
|
|
116125
116197
|
if (found) {
|
|
116126
|
-
const foundRealPath =
|
|
116198
|
+
const foundRealPath = _internals79.safeRealpathSync(found, found);
|
|
116127
116199
|
if (foundRealPath === null) {
|
|
116128
116200
|
return null;
|
|
116129
116201
|
}
|
|
@@ -116531,13 +116603,13 @@ function scanFile(filePath, absoluteRoot, maxFileSize) {
|
|
|
116531
116603
|
try {
|
|
116532
116604
|
if ([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"].includes(ext)) {
|
|
116533
116605
|
const relativePath = path125.relative(absoluteRoot, filePath);
|
|
116534
|
-
({ exports, exportLines } = collectExports(
|
|
116606
|
+
({ exports, exportLines } = collectExports(_internals79.extractTSSymbols(relativePath, absoluteRoot)));
|
|
116535
116607
|
} else if (ext === ".py") {
|
|
116536
116608
|
const relativePath = path125.relative(absoluteRoot, filePath);
|
|
116537
|
-
({ exports, exportLines } = collectExports(
|
|
116609
|
+
({ exports, exportLines } = collectExports(_internals79.extractPythonSymbols(relativePath, absoluteRoot)));
|
|
116538
116610
|
}
|
|
116539
|
-
const parsedImports =
|
|
116540
|
-
const strippedForUsage = parsedImports.length > 0 ?
|
|
116611
|
+
const parsedImports = _internals79.parseFileImports(content);
|
|
116612
|
+
const strippedForUsage = parsedImports.length > 0 ? _internals79.stripComments(content) : "";
|
|
116541
116613
|
const moduleName = toModuleName(filePath, absoluteRoot);
|
|
116542
116614
|
const node = {
|
|
116543
116615
|
filePath,
|
|
@@ -116547,7 +116619,7 @@ function scanFile(filePath, absoluteRoot, maxFileSize) {
|
|
|
116547
116619
|
imports: parsedImports.map((p) => p.specifier),
|
|
116548
116620
|
language: getLanguage(filePath),
|
|
116549
116621
|
mtime: fileStats.mtime.toISOString(),
|
|
116550
|
-
ontology:
|
|
116622
|
+
ontology: _internals79.extractFileOntology({
|
|
116551
116623
|
moduleName,
|
|
116552
116624
|
filePath,
|
|
116553
116625
|
content,
|
|
@@ -117251,7 +117323,7 @@ import * as fsPromises6 from "node:fs/promises";
|
|
|
117251
117323
|
import * as path128 from "node:path";
|
|
117252
117324
|
var WINDOWS_RENAME_MAX_RETRIES2 = 5;
|
|
117253
117325
|
var WINDOWS_RENAME_RETRY_DELAY_MS2 = 100;
|
|
117254
|
-
var
|
|
117326
|
+
var _internals80 = {
|
|
117255
117327
|
safeRealpathSync,
|
|
117256
117328
|
fsRename: fsPromises6.rename.bind(fsPromises6),
|
|
117257
117329
|
retryDelayMs: WINDOWS_RENAME_RETRY_DELAY_MS2
|
|
@@ -117396,12 +117468,12 @@ async function saveGraph(workspace, graph, options) {
|
|
|
117396
117468
|
throw new Error("Graph must have edges array");
|
|
117397
117469
|
}
|
|
117398
117470
|
const normalizedWorkspace = path128.normalize(workspace);
|
|
117399
|
-
const realWorkspace =
|
|
117471
|
+
const realWorkspace = _internals80.safeRealpathSync(workspace, normalizedWorkspace);
|
|
117400
117472
|
if (realWorkspace === null) {
|
|
117401
117473
|
throw new Error(`Workspace realpath security check failed (non-ENOENT): ${workspace}`);
|
|
117402
117474
|
}
|
|
117403
117475
|
const normalizedGraphRoot = path128.normalize(graph.workspaceRoot);
|
|
117404
|
-
const realGraphRoot =
|
|
117476
|
+
const realGraphRoot = _internals80.safeRealpathSync(graph.workspaceRoot, normalizedGraphRoot);
|
|
117405
117477
|
if (realGraphRoot === null) {
|
|
117406
117478
|
throw new Error(`Graph workspaceRoot realpath security check failed (non-ENOENT): ${graph.workspaceRoot}`);
|
|
117407
117479
|
}
|
|
@@ -117439,7 +117511,7 @@ async function saveGraph(workspace, graph, options) {
|
|
|
117439
117511
|
} else {
|
|
117440
117512
|
for (let attempt = 0;attempt < WINDOWS_RENAME_MAX_RETRIES2; attempt++) {
|
|
117441
117513
|
try {
|
|
117442
|
-
await
|
|
117514
|
+
await _internals80.fsRename(tempPath, graphPath);
|
|
117443
117515
|
lastError = null;
|
|
117444
117516
|
break;
|
|
117445
117517
|
} catch (error93) {
|
|
@@ -117449,7 +117521,7 @@ async function saveGraph(workspace, graph, options) {
|
|
|
117449
117521
|
break;
|
|
117450
117522
|
}
|
|
117451
117523
|
if (attempt < WINDOWS_RENAME_MAX_RETRIES2 - 1) {
|
|
117452
|
-
await new Promise((resolve46) => setTimeout(resolve46,
|
|
117524
|
+
await new Promise((resolve46) => setTimeout(resolve46, _internals80.retryDelayMs));
|
|
117453
117525
|
}
|
|
117454
117526
|
}
|
|
117455
117527
|
}
|
|
@@ -119650,20 +119722,20 @@ function createSystemEnhancerHook(config3, directory) {
|
|
|
119650
119722
|
try {
|
|
119651
119723
|
const darkMatterPath = validateSwarmPath(directory, "dark-matter.md");
|
|
119652
119724
|
if (!fs80.existsSync(darkMatterPath)) {
|
|
119653
|
-
const darkMatter = await
|
|
119725
|
+
const darkMatter = await _internals40.detectDarkMatter(directory, {
|
|
119654
119726
|
minCommits: 20,
|
|
119655
119727
|
minCoChanges: 3
|
|
119656
119728
|
});
|
|
119657
119729
|
await fs80.promises.mkdir(path137.dirname(darkMatterPath), {
|
|
119658
119730
|
recursive: true
|
|
119659
119731
|
});
|
|
119660
|
-
const darkMatterReport =
|
|
119732
|
+
const darkMatterReport = _internals40.formatDarkMatterOutput(darkMatter);
|
|
119661
119733
|
await fs80.promises.writeFile(darkMatterPath, darkMatterReport, "utf-8");
|
|
119662
119734
|
warn(`[system-enhancer] Dark matter scan complete: ${darkMatter.length} co-change patterns found`);
|
|
119663
119735
|
if (darkMatter.length > 0) {
|
|
119664
119736
|
try {
|
|
119665
119737
|
const projectName = path137.basename(path137.resolve(directory));
|
|
119666
|
-
const knowledgeEntries =
|
|
119738
|
+
const knowledgeEntries = _internals40.darkMatterToKnowledgeEntries(darkMatter, projectName);
|
|
119667
119739
|
const knowledgePath = _internals26.resolveSwarmKnowledgePath(directory);
|
|
119668
119740
|
const existingEntries = await _internals26.readKnowledge(knowledgePath);
|
|
119669
119741
|
const existingLessons = new Set(existingEntries.map((e) => e.lesson));
|
|
@@ -120963,7 +121035,7 @@ function resolveDefaultReviewerAgent(generatedAgentNames) {
|
|
|
120963
121035
|
}
|
|
120964
121036
|
async function compileReviewPackage(directory, phase, sessionID, requireDiffSummary) {
|
|
120965
121037
|
const lanes = await listLaneEvidence(directory, phase);
|
|
120966
|
-
const persisted =
|
|
121038
|
+
const persisted = _internals84.readPersisted?.(directory) ?? null;
|
|
120967
121039
|
if (persisted) {
|
|
120968
121040
|
let matchingRunState = null;
|
|
120969
121041
|
for (const sessionState of Object.values(persisted.sessions)) {
|
|
@@ -121173,7 +121245,7 @@ Be specific and evidence-based. Do not approve a phase with unresolved degraded
|
|
|
121173
121245
|
client.session.delete({ path: { id: sessionId } }).catch(() => {});
|
|
121174
121246
|
}
|
|
121175
121247
|
}
|
|
121176
|
-
var
|
|
121248
|
+
var _internals84 = {
|
|
121177
121249
|
compileReviewPackage,
|
|
121178
121250
|
parseReviewerVerdict,
|
|
121179
121251
|
writeReviewerEvidence,
|
|
@@ -121190,28 +121262,28 @@ async function dispatchPhaseReviewer(directory, phase, sessionID, config3) {
|
|
|
121190
121262
|
};
|
|
121191
121263
|
const generatedAgentNames = swarmState.generatedAgentNames;
|
|
121192
121264
|
const agentName = mergedConfig.reviewerAgent || resolveDefaultReviewerAgent(generatedAgentNames);
|
|
121193
|
-
const pkg = await
|
|
121265
|
+
const pkg = await _internals84.compileReviewPackage(directory, phase, sessionID, mergedConfig.requireDiffSummary);
|
|
121194
121266
|
let responseText;
|
|
121195
121267
|
try {
|
|
121196
|
-
responseText = await
|
|
121268
|
+
responseText = await _internals84.dispatchReviewerAgent(directory, pkg, agentName, mergedConfig.timeoutMs, sessionID);
|
|
121197
121269
|
} catch (error93) {
|
|
121198
|
-
const evidencePath2 = await
|
|
121270
|
+
const evidencePath2 = await _internals84.writeReviewerEvidence(directory, phase, "REJECTED", error93 instanceof Error ? error93.message : String(error93));
|
|
121199
121271
|
return {
|
|
121200
121272
|
verdict: "REJECTED",
|
|
121201
121273
|
reason: `Reviewer dispatch failed: ${error93 instanceof Error ? error93.message : String(error93)}`,
|
|
121202
121274
|
evidencePath: evidencePath2
|
|
121203
121275
|
};
|
|
121204
121276
|
}
|
|
121205
|
-
const parsed =
|
|
121277
|
+
const parsed = _internals84.parseReviewerVerdict(responseText);
|
|
121206
121278
|
if (!parsed) {
|
|
121207
|
-
const evidencePath2 = await
|
|
121279
|
+
const evidencePath2 = await _internals84.writeReviewerEvidence(directory, phase, "REJECTED", "Reviewer response could not be parsed");
|
|
121208
121280
|
return {
|
|
121209
121281
|
verdict: "REJECTED",
|
|
121210
121282
|
reason: "Reviewer response could not be parsed",
|
|
121211
121283
|
evidencePath: evidencePath2
|
|
121212
121284
|
};
|
|
121213
121285
|
}
|
|
121214
|
-
const evidencePath = await
|
|
121286
|
+
const evidencePath = await _internals84.writeReviewerEvidence(directory, phase, parsed.verdict, parsed.reason);
|
|
121215
121287
|
return {
|
|
121216
121288
|
verdict: parsed.verdict,
|
|
121217
121289
|
reason: parsed.reason,
|
|
@@ -121388,7 +121460,7 @@ async function runAutoReview(input) {
|
|
|
121388
121460
|
phase
|
|
121389
121461
|
};
|
|
121390
121462
|
try {
|
|
121391
|
-
const diffResult = await
|
|
121463
|
+
const diffResult = await _internals85.computeExecutionDiff(directory, config3.max_diff_kb * 1024);
|
|
121392
121464
|
if (diffResult.status === "clean") {
|
|
121393
121465
|
writeAutoReviewEvent(directory, {
|
|
121394
121466
|
...base,
|
|
@@ -121410,7 +121482,7 @@ async function runAutoReview(input) {
|
|
|
121410
121482
|
const prompt = buildReviewPrompt(trigger, diff, taskId, phase);
|
|
121411
121483
|
let transcript;
|
|
121412
121484
|
try {
|
|
121413
|
-
transcript = await
|
|
121485
|
+
transcript = await _internals85.dispatchReviewer(directory, prompt, agentName, config3.timeout_ms);
|
|
121414
121486
|
} catch (err2) {
|
|
121415
121487
|
writeAutoReviewEvent(directory, {
|
|
121416
121488
|
...base,
|
|
@@ -121514,13 +121586,13 @@ function createAutoReviewHook(options) {
|
|
|
121514
121586
|
if (inFlightSessions.has(sessionID))
|
|
121515
121587
|
return;
|
|
121516
121588
|
const last = lastDispatchBySession.get(sessionID) ?? 0;
|
|
121517
|
-
if (
|
|
121589
|
+
if (_internals85.now() - last < COOLDOWN_MS)
|
|
121518
121590
|
return;
|
|
121519
121591
|
inFlightSessions.add(sessionID);
|
|
121520
121592
|
lastDispatchBySession.delete(sessionID);
|
|
121521
|
-
lastDispatchBySession.set(sessionID,
|
|
121593
|
+
lastDispatchBySession.set(sessionID, _internals85.now());
|
|
121522
121594
|
evictCooldownMap();
|
|
121523
|
-
|
|
121595
|
+
_internals85.runAutoReview({
|
|
121524
121596
|
directory,
|
|
121525
121597
|
sessionID,
|
|
121526
121598
|
trigger,
|
|
@@ -121540,7 +121612,7 @@ function createAutoReviewHook(options) {
|
|
|
121540
121612
|
}
|
|
121541
121613
|
};
|
|
121542
121614
|
}
|
|
121543
|
-
var
|
|
121615
|
+
var _internals85 = {
|
|
121544
121616
|
computeExecutionDiff,
|
|
121545
121617
|
dispatchReviewer,
|
|
121546
121618
|
runAutoReview,
|
|
@@ -121973,10 +122045,10 @@ async function getRunMemorySummary(directory) {
|
|
|
121973
122045
|
if (entries.length === 0) {
|
|
121974
122046
|
return null;
|
|
121975
122047
|
}
|
|
121976
|
-
const groups =
|
|
122048
|
+
const groups = _internals86.groupByTaskId(entries);
|
|
121977
122049
|
const summaries = [];
|
|
121978
122050
|
for (const [taskId, taskEntries] of groups) {
|
|
121979
|
-
const summary =
|
|
122051
|
+
const summary = _internals86.summarizeTask(taskId, taskEntries);
|
|
121980
122052
|
if (summary) {
|
|
121981
122053
|
summaries.push(summary);
|
|
121982
122054
|
}
|
|
@@ -122009,7 +122081,7 @@ Use this data to avoid repeating known failure patterns.`;
|
|
|
122009
122081
|
}
|
|
122010
122082
|
return prefix + summaryText + suffix;
|
|
122011
122083
|
}
|
|
122012
|
-
var
|
|
122084
|
+
var _internals86 = {
|
|
122013
122085
|
generateTaskFingerprint,
|
|
122014
122086
|
recordOutcome,
|
|
122015
122087
|
getTaskHistory,
|
|
@@ -122198,7 +122270,7 @@ async function injectForDelegate(params) {
|
|
|
122198
122270
|
currentTool: firstTool,
|
|
122199
122271
|
mode: "delegation"
|
|
122200
122272
|
};
|
|
122201
|
-
const searchFn = params.searchFn ?? (
|
|
122273
|
+
const searchFn = params.searchFn ?? (_internals88.searchKnowledge === defaultSearchKnowledge ? searchKnowledge : _internals88.searchKnowledge);
|
|
122202
122274
|
try {
|
|
122203
122275
|
const search = await searchFn({
|
|
122204
122276
|
directory,
|
|
@@ -122222,7 +122294,7 @@ async function injectForDelegate(params) {
|
|
|
122222
122294
|
ranks[e.id] = idx + 1;
|
|
122223
122295
|
scores[e.id] = e.finalScore;
|
|
122224
122296
|
});
|
|
122225
|
-
await
|
|
122297
|
+
await _internals88.recordKnowledgeEvent(directory, {
|
|
122226
122298
|
type: "retrieved",
|
|
122227
122299
|
trace_id: search.trace_id,
|
|
122228
122300
|
session_id: sessionId ?? "unknown",
|
|
@@ -122421,7 +122493,7 @@ function createKnowledgeInjectorHook(directory, config3, modelLimitOverrides = {
|
|
|
122421
122493
|
projectName,
|
|
122422
122494
|
currentPhase: phaseDescription
|
|
122423
122495
|
};
|
|
122424
|
-
const searchFn =
|
|
122496
|
+
const searchFn = _internals88.searchKnowledge === defaultSearchKnowledge ? searchKnowledge : _internals88.searchKnowledge;
|
|
122425
122497
|
const search = await searchFn({
|
|
122426
122498
|
directory,
|
|
122427
122499
|
config: config3,
|
|
@@ -122537,7 +122609,7 @@ ${freshPreamble}` : `<curator_briefing>${truncatedBriefing}</curator_briefing>`;
|
|
|
122537
122609
|
ranks[id] = idx + 1;
|
|
122538
122610
|
scores[id] = scoreById.get(id) ?? 0;
|
|
122539
122611
|
});
|
|
122540
|
-
await
|
|
122612
|
+
await _internals88.recordKnowledgeEvent(directory, {
|
|
122541
122613
|
type: "retrieved",
|
|
122542
122614
|
trace_id: search.trace_id,
|
|
122543
122615
|
session_id: systemMsg?.info?.sessionID ?? "unknown",
|
|
@@ -122550,7 +122622,7 @@ ${freshPreamble}` : `<curator_briefing>${truncatedBriefing}</curator_briefing>`;
|
|
|
122550
122622
|
ranks,
|
|
122551
122623
|
scores
|
|
122552
122624
|
});
|
|
122553
|
-
|
|
122625
|
+
_internals88.recordKnowledgeShown(directory, cachedShownIds, {
|
|
122554
122626
|
phase: phaseLabel,
|
|
122555
122627
|
tool: retrievalCtx.currentTool,
|
|
122556
122628
|
action: retrievalCtx.currentAction,
|
|
@@ -122560,7 +122632,7 @@ ${freshPreamble}` : `<curator_briefing>${truncatedBriefing}</curator_briefing>`;
|
|
|
122560
122632
|
}
|
|
122561
122633
|
});
|
|
122562
122634
|
}
|
|
122563
|
-
var
|
|
122635
|
+
var _internals88 = {
|
|
122564
122636
|
searchKnowledge,
|
|
122565
122637
|
recordKnowledgeEvent,
|
|
122566
122638
|
recordKnowledgeShown
|
|
@@ -124564,7 +124636,7 @@ async function knowledgeApplicationGateBefore(directory, input, config3) {
|
|
|
124564
124636
|
if (config3.mode === "enforce") {
|
|
124565
124637
|
throw new Error("KNOWLEDGE_ENFORCE_GATE_DENY: missing sessionID on tool.execute.before; refusing to evaluate critical-directive ack state");
|
|
124566
124638
|
}
|
|
124567
|
-
|
|
124639
|
+
_internals89.writeWarnEvent(directory, {
|
|
124568
124640
|
timestamp: new Date().toISOString(),
|
|
124569
124641
|
event: "knowledge_application_gate_warn",
|
|
124570
124642
|
tool: toolName,
|
|
@@ -124647,7 +124719,7 @@ async function knowledgeApplicationTransformScan(directory, output, sessionID) {
|
|
|
124647
124719
|
}
|
|
124648
124720
|
}
|
|
124649
124721
|
}
|
|
124650
|
-
var
|
|
124722
|
+
var _internals89 = {
|
|
124651
124723
|
knowledgeApplicationGateBefore,
|
|
124652
124724
|
knowledgeApplicationTransformScan,
|
|
124653
124725
|
HIGH_RISK_TOOLS,
|
|
@@ -128339,7 +128411,7 @@ var VALID_TASK_ID = /^\d+\.\d+(\.\d+)*$/;
|
|
|
128339
128411
|
var COUNCIL_GATE_NAME = "council";
|
|
128340
128412
|
var COUNCIL_AGENT_ID = "architect";
|
|
128341
128413
|
var EvidenceFileSchema = exports_external.record(exports_external.string(), exports_external.unknown());
|
|
128342
|
-
var
|
|
128414
|
+
var _internals90 = {
|
|
128343
128415
|
withTaskEvidenceLock
|
|
128344
128416
|
};
|
|
128345
128417
|
var FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
@@ -128374,7 +128446,7 @@ async function writeCouncilEvidence(workingDir, synthesis) {
|
|
|
128374
128446
|
const dir = join122(workingDir, EVIDENCE_DIR2);
|
|
128375
128447
|
mkdirSync41(dir, { recursive: true });
|
|
128376
128448
|
const filePath = taskEvidencePath(workingDir, synthesis.taskId);
|
|
128377
|
-
await
|
|
128449
|
+
await _internals90.withTaskEvidenceLock(workingDir, synthesis.taskId, COUNCIL_AGENT_ID, async () => {
|
|
128378
128450
|
const existingRoot = Object.create(null);
|
|
128379
128451
|
if (existsSync89(filePath)) {
|
|
128380
128452
|
try {
|
|
@@ -130878,7 +130950,7 @@ var CollectLaneResultsArgsSchema = exports_external.object({
|
|
|
130878
130950
|
include_pending: exports_external.boolean().optional(),
|
|
130879
130951
|
cancel_pending: exports_external.boolean().optional().describe("Abort and mark pending/running lanes cancelled")
|
|
130880
130952
|
});
|
|
130881
|
-
var
|
|
130953
|
+
var _internals91 = {
|
|
130882
130954
|
getSessionOps: () => swarmState.opencodeClient?.session ?? null,
|
|
130883
130955
|
getGeneratedAgentNames: () => swarmState.generatedAgentNames,
|
|
130884
130956
|
createParallelDispatcher,
|
|
@@ -130902,7 +130974,7 @@ async function executeDispatchLanes(args2, directory, context = {}) {
|
|
|
130902
130974
|
errors: duplicateLaneIds.map((id) => `Duplicate lane id: ${id}`)
|
|
130903
130975
|
});
|
|
130904
130976
|
}
|
|
130905
|
-
const session =
|
|
130977
|
+
const session = _internals91.getSessionOps();
|
|
130906
130978
|
if (!session) {
|
|
130907
130979
|
return failureResult({
|
|
130908
130980
|
failure_class: "no_client",
|
|
@@ -130920,7 +130992,7 @@ async function executeDispatchLanes(args2, directory, context = {}) {
|
|
|
130920
130992
|
const lanes = common.lanes;
|
|
130921
130993
|
const maxConcurrent = Math.min(parsed.data.max_concurrent ?? lanes.length, lanes.length, MAX_LANES);
|
|
130922
130994
|
const timeoutMs = parsed.data.timeout_ms ?? DEFAULT_TIMEOUT_MS3;
|
|
130923
|
-
const dispatcher =
|
|
130995
|
+
const dispatcher = _internals91.createParallelDispatcher({
|
|
130924
130996
|
enabled: true,
|
|
130925
130997
|
maxConcurrentTasks: maxConcurrent,
|
|
130926
130998
|
evidenceLockTimeoutMs: 0
|
|
@@ -130950,7 +131022,7 @@ async function executeDispatchLanesAsync(args2, directory, context = {}) {
|
|
|
130950
131022
|
errors: duplicateLaneIds.map((id) => `Duplicate lane id: ${id}`)
|
|
130951
131023
|
});
|
|
130952
131024
|
}
|
|
130953
|
-
const session =
|
|
131025
|
+
const session = _internals91.getSessionOps();
|
|
130954
131026
|
if (!session || typeof session.promptAsync !== "function") {
|
|
130955
131027
|
return asyncFailureResult({
|
|
130956
131028
|
failure_class: "no_client",
|
|
@@ -130976,7 +131048,7 @@ async function executeDispatchLanesAsync(args2, directory, context = {}) {
|
|
|
130976
131048
|
}
|
|
130977
131049
|
const maxConcurrent = Math.min(parsed.data.max_concurrent ?? lanes.length, lanes.length, MAX_LANES);
|
|
130978
131050
|
const timeoutMs = parsed.data.timeout_ms ?? DEFAULT_TIMEOUT_MS3;
|
|
130979
|
-
const dispatcher =
|
|
131051
|
+
const dispatcher = _internals91.createParallelDispatcher({
|
|
130980
131052
|
enabled: true,
|
|
130981
131053
|
maxConcurrentTasks: maxConcurrent,
|
|
130982
131054
|
evidenceLockTimeoutMs: 0
|
|
@@ -131023,7 +131095,7 @@ async function executeCollectLaneResults(args2, directory, context = {}) {
|
|
|
131023
131095
|
errors: parsed.error.issues.map((issue3) => `${issue3.path.join(".")}: ${issue3.message}`)
|
|
131024
131096
|
});
|
|
131025
131097
|
}
|
|
131026
|
-
const session =
|
|
131098
|
+
const session = _internals91.getSessionOps();
|
|
131027
131099
|
if (!session || typeof session.messages !== "function") {
|
|
131028
131100
|
return collectFailureResult({
|
|
131029
131101
|
failure_class: "no_client",
|
|
@@ -131032,7 +131104,7 @@ async function executeCollectLaneResults(args2, directory, context = {}) {
|
|
|
131032
131104
|
});
|
|
131033
131105
|
}
|
|
131034
131106
|
const timeoutMs = parsed.data.timeout_ms ?? DEFAULT_COLLECT_TIMEOUT_MS;
|
|
131035
|
-
const deadline =
|
|
131107
|
+
const deadline = _internals91.now() + timeoutMs;
|
|
131036
131108
|
const batchFilter = context.sessionID !== undefined ? { parentSessionId: context.sessionID } : undefined;
|
|
131037
131109
|
await sweepStaleDelegations(directory, DEFAULT_ASYNC_STALE_TIMEOUT_MS);
|
|
131038
131110
|
let records = findByBatchId(directory, parsed.data.batch_id, batchFilter);
|
|
@@ -131053,11 +131125,11 @@ async function executeCollectLaneResults(args2, directory, context = {}) {
|
|
|
131053
131125
|
keepPolling = false;
|
|
131054
131126
|
continue;
|
|
131055
131127
|
}
|
|
131056
|
-
if (
|
|
131128
|
+
if (_internals91.now() >= deadline) {
|
|
131057
131129
|
keepPolling = false;
|
|
131058
131130
|
continue;
|
|
131059
131131
|
}
|
|
131060
|
-
await
|
|
131132
|
+
await _internals91.sleep(Math.min(pollIntervalMs, Math.max(0, deadline - _internals91.now())));
|
|
131061
131133
|
pollIntervalMs = nextCollectPollInterval(pollIntervalMs);
|
|
131062
131134
|
}
|
|
131063
131135
|
return buildCollectResult(parsed.data.batch_id, records, parsed.data.include_pending === true);
|
|
@@ -131457,7 +131529,7 @@ function failedLane(lane, role, startedAt, error93, slotId, runId, sessionId) {
|
|
|
131457
131529
|
};
|
|
131458
131530
|
}
|
|
131459
131531
|
function validateLaneAgent(agent, context) {
|
|
131460
|
-
const generatedAgentNames =
|
|
131532
|
+
const generatedAgentNames = _internals91.getGeneratedAgentNames();
|
|
131461
131533
|
const role = resolveGeneratedAgentRole(agent, generatedAgentNames);
|
|
131462
131534
|
if (!isKnownCanonicalRole(role)) {
|
|
131463
131535
|
return {
|
|
@@ -131664,10 +131736,10 @@ function boundErrorString(text) {
|
|
|
131664
131736
|
return `${text.slice(0, MAX_ERROR_CHARS)}${ERROR_TRUNCATION_SUFFIX}`;
|
|
131665
131737
|
}
|
|
131666
131738
|
function isoNow() {
|
|
131667
|
-
return new Date(
|
|
131739
|
+
return new Date(_internals91.now()).toISOString();
|
|
131668
131740
|
}
|
|
131669
131741
|
function makeBatchId() {
|
|
131670
|
-
return `lanes-${
|
|
131742
|
+
return `lanes-${_internals91.now().toString(36)}`;
|
|
131671
131743
|
}
|
|
131672
131744
|
function promptHash(lane, directory, batchId) {
|
|
131673
131745
|
return digestText2(JSON.stringify({
|
|
@@ -131958,7 +132030,7 @@ function buildIsUpstreamCommittedWithStatus(directory, options) {
|
|
|
131958
132030
|
const max = options?.maxCommits ?? MAX_LOG_COMMITS;
|
|
131959
132031
|
let subjects;
|
|
131960
132032
|
try {
|
|
131961
|
-
subjects =
|
|
132033
|
+
subjects = _internals92.readGitLogSubjects(directory, max);
|
|
131962
132034
|
} catch (err2) {
|
|
131963
132035
|
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
131964
132036
|
criticalWarn(`[epic:upstream-commits] git log scan failed (degrading to permissive predicate, the activation gate may flip fail-closed): ${msg}`);
|
|
@@ -131980,7 +132052,7 @@ function buildIsUpstreamCommittedWithStatus(directory, options) {
|
|
|
131980
132052
|
gitFailed: false
|
|
131981
132053
|
};
|
|
131982
132054
|
}
|
|
131983
|
-
var
|
|
132055
|
+
var _internals92 = {
|
|
131984
132056
|
readGitLogSubjects: (cwd, max) => {
|
|
131985
132057
|
return _internals4.gitExec(["log", "--no-merges", `--max-count=${max}`, "--pretty=%s"], cwd);
|
|
131986
132058
|
}
|
|
@@ -132385,7 +132457,7 @@ function readPlanJson(directory) {
|
|
|
132385
132457
|
}
|
|
132386
132458
|
async function executeEpicPlanWaves(args2) {
|
|
132387
132459
|
const { directory, phase, scopes } = args2;
|
|
132388
|
-
const plan =
|
|
132460
|
+
const plan = _internals93.readPlanJson(directory);
|
|
132389
132461
|
if (!plan) {
|
|
132390
132462
|
return {
|
|
132391
132463
|
success: false,
|
|
@@ -132438,7 +132510,7 @@ async function executeEpicPlanWaves(args2) {
|
|
|
132438
132510
|
try {
|
|
132439
132511
|
const tasksMissingScope = [];
|
|
132440
132512
|
for (const task of pendingTasks) {
|
|
132441
|
-
const declaredScope =
|
|
132513
|
+
const declaredScope = _internals93.readTaskScopes(directory, task.id);
|
|
132442
132514
|
const filesTouched = task.files_touched ?? [];
|
|
132443
132515
|
const providedScope = scopes && task.id in scopes ? scopes[task.id] : null;
|
|
132444
132516
|
if ((declaredScope === null || declaredScope.length === 0) && filesTouched.length === 0 && (providedScope === null || providedScope.length === 0)) {
|
|
@@ -132461,8 +132533,8 @@ async function executeEpicPlanWaves(args2) {
|
|
|
132461
132533
|
};
|
|
132462
132534
|
}
|
|
132463
132535
|
let isUpstreamCommitted;
|
|
132464
|
-
if (
|
|
132465
|
-
const evidence =
|
|
132536
|
+
if (_internals93.isGitRepo(directory)) {
|
|
132537
|
+
const evidence = _internals93.buildIsUpstreamCommittedWithStatus(directory);
|
|
132466
132538
|
if (evidence.gitFailed) {
|
|
132467
132539
|
criticalWarn(`[epic_plan_waves] wave-planning blocked for directory=${directory} phase=${phase}: git log scan failed. Any prior promote verdict in .swarm/evidence/epic-promotions.jsonl for this phase is not backed by actual parallel execution.`);
|
|
132468
132540
|
return {
|
|
@@ -132477,7 +132549,7 @@ async function executeEpicPlanWaves(args2) {
|
|
|
132477
132549
|
}
|
|
132478
132550
|
let leanConfig = { ...DEFAULT_LEAN_TURBO_CONFIG };
|
|
132479
132551
|
try {
|
|
132480
|
-
const loaded = await
|
|
132552
|
+
const loaded = await _internals93.loadPluginConfigWithMeta(directory);
|
|
132481
132553
|
const userLean = loaded?.config?.turbo?.lean;
|
|
132482
132554
|
if (userLean) {
|
|
132483
132555
|
leanConfig = { ...leanConfig, ...userLean };
|
|
@@ -132501,7 +132573,7 @@ async function executeEpicPlanWaves(args2) {
|
|
|
132501
132573
|
};
|
|
132502
132574
|
}
|
|
132503
132575
|
}
|
|
132504
|
-
var
|
|
132576
|
+
var _internals93 = {
|
|
132505
132577
|
readPlanJson,
|
|
132506
132578
|
readTaskScopes,
|
|
132507
132579
|
isGitRepo: (cwd) => isGitRepo(cwd),
|
|
@@ -132533,7 +132605,7 @@ init_state2();
|
|
|
132533
132605
|
init_divergence_recorder();
|
|
132534
132606
|
init_logger();
|
|
132535
132607
|
init_create_tool();
|
|
132536
|
-
var
|
|
132608
|
+
var _internals94 = {
|
|
132537
132609
|
hasActiveEpicMode,
|
|
132538
132610
|
getAgentSession,
|
|
132539
132611
|
readScopeFromDisk,
|
|
@@ -132542,7 +132614,7 @@ var _internals92 = {
|
|
|
132542
132614
|
};
|
|
132543
132615
|
async function findPhaseForTask(directory, taskId) {
|
|
132544
132616
|
try {
|
|
132545
|
-
const plan = await
|
|
132617
|
+
const plan = await _internals94.loadPlanJsonOnly(directory);
|
|
132546
132618
|
if (!plan)
|
|
132547
132619
|
return;
|
|
132548
132620
|
for (const phase of plan.phases) {
|
|
@@ -132555,20 +132627,20 @@ async function findPhaseForTask(directory, taskId) {
|
|
|
132555
132627
|
}
|
|
132556
132628
|
async function executeEpicRecordDivergence(args2) {
|
|
132557
132629
|
const { directory, taskId, sessionID } = args2;
|
|
132558
|
-
if (!
|
|
132630
|
+
if (!_internals94.hasActiveEpicMode(sessionID)) {
|
|
132559
132631
|
return { success: true, reason: "epic-mode-not-active" };
|
|
132560
132632
|
}
|
|
132561
|
-
const session =
|
|
132633
|
+
const session = _internals94.getAgentSession(sessionID);
|
|
132562
132634
|
if (!session) {
|
|
132563
132635
|
return { success: true, reason: "no-session" };
|
|
132564
132636
|
}
|
|
132565
|
-
const declaredScope =
|
|
132637
|
+
const declaredScope = _internals94.readScopeFromDisk(directory, taskId);
|
|
132566
132638
|
if (declaredScope === null) {
|
|
132567
132639
|
return { success: true, reason: "no-scope" };
|
|
132568
132640
|
}
|
|
132569
132641
|
const actualFiles = session.modifiedFilesThisCoderTask ?? [];
|
|
132570
132642
|
const phaseNumber = await findPhaseForTask(directory, taskId);
|
|
132571
|
-
const result =
|
|
132643
|
+
const result = _internals94.recordTaskDivergence({
|
|
132572
132644
|
directory,
|
|
132573
132645
|
sessionID,
|
|
132574
132646
|
taskId,
|
|
@@ -132950,7 +133022,7 @@ init_state4();
|
|
|
132950
133022
|
|
|
132951
133023
|
// src/turbo/lean/state-lock.ts
|
|
132952
133024
|
init_file_locks();
|
|
132953
|
-
var
|
|
133025
|
+
var _internals95 = { tryAcquireLock };
|
|
132954
133026
|
|
|
132955
133027
|
class TurboStateLockTimeoutError extends Error {
|
|
132956
133028
|
directory;
|
|
@@ -132978,7 +133050,7 @@ async function withTurboStateLock(directory, sessionID, fn2, timeoutMs = 30000)
|
|
|
132978
133050
|
while (true) {
|
|
132979
133051
|
let result;
|
|
132980
133052
|
try {
|
|
132981
|
-
result = await
|
|
133053
|
+
result = await _internals95.tryAcquireLock(directory, lockPath, agent, sessionID);
|
|
132982
133054
|
} catch (acquireErr) {
|
|
132983
133055
|
console.warn(`[lean-turbo] state lock acquisition error for ${sessionID} (${lockPath}), will retry: ${acquireErr instanceof Error ? acquireErr.message : String(acquireErr)}`);
|
|
132984
133056
|
}
|
|
@@ -133725,7 +133797,7 @@ ${fileList}
|
|
|
133725
133797
|
// src/tools/epic-run-phase.ts
|
|
133726
133798
|
init_logger();
|
|
133727
133799
|
init_create_tool();
|
|
133728
|
-
var
|
|
133800
|
+
var _internals96 = {
|
|
133729
133801
|
loadPluginConfigWithMeta,
|
|
133730
133802
|
loadPlanJsonOnly,
|
|
133731
133803
|
getCoChangeData,
|
|
@@ -133747,13 +133819,13 @@ var _internals94 = {
|
|
|
133747
133819
|
};
|
|
133748
133820
|
async function executeEpicDecidePhase(args2) {
|
|
133749
133821
|
const { directory, phase, sessionID } = args2;
|
|
133750
|
-
if (!
|
|
133822
|
+
if (!_internals96.isEpicModeActive(directory, sessionID)) {
|
|
133751
133823
|
return {
|
|
133752
133824
|
success: false,
|
|
133753
133825
|
reason: "epic-mode-not-active"
|
|
133754
133826
|
};
|
|
133755
133827
|
}
|
|
133756
|
-
const plan = await
|
|
133828
|
+
const plan = await _internals96.loadPlanJsonOnly(directory);
|
|
133757
133829
|
if (plan === null) {
|
|
133758
133830
|
return { success: false, reason: "no-plan" };
|
|
133759
133831
|
}
|
|
@@ -133783,7 +133855,7 @@ async function executeEpicDecidePhase(args2) {
|
|
|
133783
133855
|
}
|
|
133784
133856
|
const tasksMissingScope = [];
|
|
133785
133857
|
for (const task of pendingTasks) {
|
|
133786
|
-
const declaredScope =
|
|
133858
|
+
const declaredScope = _internals96.readTaskScopes(directory, task.id);
|
|
133787
133859
|
const filesTouched = task.files_touched ?? [];
|
|
133788
133860
|
if ((declaredScope === null || declaredScope.length === 0) && filesTouched.length === 0) {
|
|
133789
133861
|
tasksMissingScope.push(task.id);
|
|
@@ -133803,7 +133875,7 @@ async function executeEpicDecidePhase(args2) {
|
|
|
133803
133875
|
};
|
|
133804
133876
|
}
|
|
133805
133877
|
}
|
|
133806
|
-
const { config: config3 } =
|
|
133878
|
+
const { config: config3 } = _internals96.loadPluginConfigWithMeta(directory);
|
|
133807
133879
|
const modeCfg = config3.turbo?.epic?.mode;
|
|
133808
133880
|
const cochangeCfg = config3.turbo?.epic?.cochange;
|
|
133809
133881
|
const calibrationCfg = config3.turbo?.epic?.calibration;
|
|
@@ -133816,14 +133888,14 @@ async function executeEpicDecidePhase(args2) {
|
|
|
133816
133888
|
let extraHotModules = [];
|
|
133817
133889
|
if (calibrationEnabled) {
|
|
133818
133890
|
try {
|
|
133819
|
-
const currentCalibration =
|
|
133891
|
+
const currentCalibration = _internals96.loadCalibrationState(directory);
|
|
133820
133892
|
if (currentCalibration !== null) {
|
|
133821
|
-
const history =
|
|
133893
|
+
const history = _internals96.readDivergenceHistory(directory, {
|
|
133822
133894
|
maxBytes: Number.POSITIVE_INFINITY
|
|
133823
133895
|
});
|
|
133824
133896
|
const newRecords = history.slice(currentCalibration.processedRecords);
|
|
133825
133897
|
if (newRecords.length > 0) {
|
|
133826
|
-
const updated =
|
|
133898
|
+
const updated = _internals96.applyCalibration(currentCalibration, newRecords, {
|
|
133827
133899
|
staticThreshold: staticActivationThreshold,
|
|
133828
133900
|
floorThreshold: calibrationCfg?.floor_threshold,
|
|
133829
133901
|
tightenStep: calibrationCfg?.tighten_step,
|
|
@@ -133832,17 +133904,17 @@ async function executeEpicDecidePhase(args2) {
|
|
|
133832
133904
|
});
|
|
133833
133905
|
let savedSuccessfully = false;
|
|
133834
133906
|
try {
|
|
133835
|
-
|
|
133907
|
+
_internals96.saveCalibrationState(directory, updated);
|
|
133836
133908
|
savedSuccessfully = true;
|
|
133837
133909
|
} catch (err2) {
|
|
133838
133910
|
criticalWarn(`[epic_run_phase] calibration persist failed; ignoring this run's calibration delta to avoid drift on next run: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
133839
133911
|
}
|
|
133840
133912
|
const sourceForThisRun = savedSuccessfully ? updated : currentCalibration;
|
|
133841
|
-
effectiveThreshold =
|
|
133842
|
-
extraHotModules =
|
|
133913
|
+
effectiveThreshold = _internals96.effectiveActivationThreshold(staticActivationThreshold, sourceForThisRun);
|
|
133914
|
+
extraHotModules = _internals96.effectiveHotModules([], sourceForThisRun);
|
|
133843
133915
|
} else {
|
|
133844
|
-
effectiveThreshold =
|
|
133845
|
-
extraHotModules =
|
|
133916
|
+
effectiveThreshold = _internals96.effectiveActivationThreshold(staticActivationThreshold, currentCalibration);
|
|
133917
|
+
extraHotModules = _internals96.effectiveHotModules([], currentCalibration);
|
|
133846
133918
|
}
|
|
133847
133919
|
}
|
|
133848
133920
|
} catch (err2) {
|
|
@@ -133858,14 +133930,14 @@ async function executeEpicDecidePhase(args2) {
|
|
|
133858
133930
|
}
|
|
133859
133931
|
}
|
|
133860
133932
|
const tasks = rawTasks.map((task) => {
|
|
133861
|
-
const scopeFiles =
|
|
133933
|
+
const scopeFiles = _internals96.readTaskScopes(directory, task.id);
|
|
133862
133934
|
const scope = scopeFiles ?? task.files_touched ?? [];
|
|
133863
133935
|
return { id: task.id, scope };
|
|
133864
133936
|
});
|
|
133865
|
-
const { pairs, commitsObserved } = await
|
|
133937
|
+
const { pairs, commitsObserved } = await _internals96.getCoChangeData(directory);
|
|
133866
133938
|
const isGitProject = (() => {
|
|
133867
133939
|
try {
|
|
133868
|
-
return
|
|
133940
|
+
return _internals96.isGitRepo(directory);
|
|
133869
133941
|
} catch {
|
|
133870
133942
|
return false;
|
|
133871
133943
|
}
|
|
@@ -133898,10 +133970,10 @@ async function executeEpicDecidePhase(args2) {
|
|
|
133898
133970
|
const phantomDeps = [...phantomDepsSet];
|
|
133899
133971
|
let isUpstreamCommitted;
|
|
133900
133972
|
if (isGitProject) {
|
|
133901
|
-
const evidence =
|
|
133973
|
+
const evidence = _internals96.buildIsUpstreamCommittedWithStatus(directory);
|
|
133902
133974
|
isUpstreamCommitted = evidence.gitFailed ? () => false : evidence.predicate;
|
|
133903
133975
|
}
|
|
133904
|
-
const verdict =
|
|
133976
|
+
const verdict = _internals96.decideEpicActivation(tasks, pairs, commitsObserved, {
|
|
133905
133977
|
activationThreshold: effectiveThreshold,
|
|
133906
133978
|
minCommitsForSignal,
|
|
133907
133979
|
cochangeNpmiThreshold,
|
|
@@ -133913,7 +133985,7 @@ async function executeEpicDecidePhase(args2) {
|
|
|
133913
133985
|
isUpstreamCommitted
|
|
133914
133986
|
});
|
|
133915
133987
|
try {
|
|
133916
|
-
|
|
133988
|
+
_internals96.appendPromotionEvidence(directory, {
|
|
133917
133989
|
timestamp: new Date().toISOString(),
|
|
133918
133990
|
sessionID,
|
|
133919
133991
|
phase,
|
|
@@ -133923,7 +133995,7 @@ async function executeEpicDecidePhase(args2) {
|
|
|
133923
133995
|
warn(`[epic_run_phase] promotion-evidence append failed: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
133924
133996
|
}
|
|
133925
133997
|
try {
|
|
133926
|
-
|
|
133998
|
+
_internals96.recordEpicDecision(directory, sessionID, {
|
|
133927
133999
|
decidedAt: new Date().toISOString(),
|
|
133928
134000
|
phase,
|
|
133929
134001
|
decision: verdict.decision,
|
|
@@ -134220,7 +134292,7 @@ function candidateFilePath(storePath3, id) {
|
|
|
134220
134292
|
}
|
|
134221
134293
|
return path162.join(storePath3, `${id}.json`);
|
|
134222
134294
|
}
|
|
134223
|
-
var
|
|
134295
|
+
var _internals97 = {
|
|
134224
134296
|
randomUUID: crypto12.randomUUID.bind(crypto12),
|
|
134225
134297
|
fs: {
|
|
134226
134298
|
mkdir: fs103.mkdir,
|
|
@@ -134233,11 +134305,11 @@ var _internals95 = {
|
|
|
134233
134305
|
function createExternalSkillStore(directory, config3) {
|
|
134234
134306
|
const storePath3 = path162.join(directory, ".swarm", "skills", "candidates");
|
|
134235
134307
|
async function add2(candidate) {
|
|
134236
|
-
const id =
|
|
134308
|
+
const id = _internals97.randomUUID();
|
|
134237
134309
|
const full = { ...candidate, id };
|
|
134238
134310
|
const filePath = path162.join(storePath3, `${id}.json`);
|
|
134239
|
-
await
|
|
134240
|
-
await
|
|
134311
|
+
await _internals97.fs.mkdir(storePath3, { recursive: true });
|
|
134312
|
+
await _internals97.atomicWriteFile(filePath, JSON.stringify(full, null, "\t"));
|
|
134241
134313
|
return full;
|
|
134242
134314
|
}
|
|
134243
134315
|
async function get2(id) {
|
|
@@ -134247,7 +134319,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
134247
134319
|
}
|
|
134248
134320
|
let raw;
|
|
134249
134321
|
try {
|
|
134250
|
-
raw = await
|
|
134322
|
+
raw = await _internals97.fs.readFile(filePath, "utf-8");
|
|
134251
134323
|
} catch (err2) {
|
|
134252
134324
|
if (err2.code === "ENOENT") {
|
|
134253
134325
|
return null;
|
|
@@ -134263,7 +134335,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
134263
134335
|
async function list(filter) {
|
|
134264
134336
|
let entries;
|
|
134265
134337
|
try {
|
|
134266
|
-
entries = await
|
|
134338
|
+
entries = await _internals97.fs.readdir(storePath3);
|
|
134267
134339
|
} catch (err2) {
|
|
134268
134340
|
if (err2.code === "ENOENT") {
|
|
134269
134341
|
return [];
|
|
@@ -134278,7 +134350,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
134278
134350
|
const filePath = path162.join(storePath3, entry);
|
|
134279
134351
|
let raw;
|
|
134280
134352
|
try {
|
|
134281
|
-
raw = await
|
|
134353
|
+
raw = await _internals97.fs.readFile(filePath, "utf-8");
|
|
134282
134354
|
} catch {
|
|
134283
134355
|
continue;
|
|
134284
134356
|
}
|
|
@@ -134345,7 +134417,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
134345
134417
|
...patch.evaluation_history
|
|
134346
134418
|
];
|
|
134347
134419
|
}
|
|
134348
|
-
await
|
|
134420
|
+
await _internals97.atomicWriteFile(filePath, JSON.stringify(updated, null, "\t"));
|
|
134349
134421
|
return updated;
|
|
134350
134422
|
}
|
|
134351
134423
|
async function deleteCandidate(id) {
|
|
@@ -134354,7 +134426,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
134354
134426
|
return false;
|
|
134355
134427
|
}
|
|
134356
134428
|
try {
|
|
134357
|
-
await
|
|
134429
|
+
await _internals97.fs.unlink(filePath);
|
|
134358
134430
|
return true;
|
|
134359
134431
|
} catch (err2) {
|
|
134360
134432
|
if (err2.code === "ENOENT") {
|
|
@@ -134392,7 +134464,7 @@ function createExternalSkillStore(directory, config3) {
|
|
|
134392
134464
|
|
|
134393
134465
|
// src/tools/external-skill-delete.ts
|
|
134394
134466
|
init_create_tool();
|
|
134395
|
-
var
|
|
134467
|
+
var _internals98 = {
|
|
134396
134468
|
loadConfig: (directory) => {
|
|
134397
134469
|
const pluginConfig = loadPluginConfig(directory);
|
|
134398
134470
|
return pluginConfig.external_skills;
|
|
@@ -134414,7 +134486,7 @@ var external_skill_delete = createSwarmTool({
|
|
|
134414
134486
|
} catch {}
|
|
134415
134487
|
let config3;
|
|
134416
134488
|
try {
|
|
134417
|
-
config3 =
|
|
134489
|
+
config3 = _internals98.loadConfig(directory);
|
|
134418
134490
|
} catch {
|
|
134419
134491
|
return JSON.stringify({
|
|
134420
134492
|
success: false,
|
|
@@ -134882,7 +134954,7 @@ function scanProvenanceIntegrity(candidate, trustLevel = "low", ttlDays) {
|
|
|
134882
134954
|
});
|
|
134883
134955
|
}
|
|
134884
134956
|
fieldsScanned.push("fetched_at");
|
|
134885
|
-
const now = new Date(
|
|
134957
|
+
const now = new Date(_internals99.getTimestamp()).getTime();
|
|
134886
134958
|
const fetchedAtMs = new Date(candidate.fetched_at).getTime();
|
|
134887
134959
|
if (Number.isNaN(fetchedAtMs)) {
|
|
134888
134960
|
findings.push({
|
|
@@ -134946,7 +135018,7 @@ function scanProvenanceIntegrity(candidate, trustLevel = "low", ttlDays) {
|
|
|
134946
135018
|
});
|
|
134947
135019
|
}
|
|
134948
135020
|
fieldsScanned.push("skill_body");
|
|
134949
|
-
const computedHash =
|
|
135021
|
+
const computedHash = _internals99.computeSha256(candidate.skill_body);
|
|
134950
135022
|
if (computedHash !== candidate.sha256) {
|
|
134951
135023
|
findings.push({
|
|
134952
135024
|
pattern: "content_hash_mismatch",
|
|
@@ -134996,7 +135068,7 @@ function evaluateCandidate(candidate, options) {
|
|
|
134996
135068
|
risk_flags: riskFlags
|
|
134997
135069
|
};
|
|
134998
135070
|
}
|
|
134999
|
-
var
|
|
135071
|
+
var _internals99 = {
|
|
135000
135072
|
getTimestamp: () => new Date().toISOString(),
|
|
135001
135073
|
computeSha256: (content) => createHash20("sha256").update(content).digest("hex"),
|
|
135002
135074
|
stripMarkdownCodeForUnsafeScan
|
|
@@ -135004,7 +135076,7 @@ var _internals97 = {
|
|
|
135004
135076
|
|
|
135005
135077
|
// src/tools/external-skill-discover.ts
|
|
135006
135078
|
init_create_tool();
|
|
135007
|
-
var
|
|
135079
|
+
var _internals100 = {
|
|
135008
135080
|
fetchContent: async (_url3, _timeoutMs) => {
|
|
135009
135081
|
const parsed = new URL(_url3);
|
|
135010
135082
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
@@ -135165,7 +135237,7 @@ var external_skill_discover = createSwarmTool({
|
|
|
135165
135237
|
resolvedContent = content;
|
|
135166
135238
|
} else {
|
|
135167
135239
|
try {
|
|
135168
|
-
const fetched = await
|
|
135240
|
+
const fetched = await _internals100.fetchContent(resolvedUrl, config3.fetch_timeout_ms);
|
|
135169
135241
|
if (fetched.finalUrl !== resolvedUrl && matchedSource && !isSubpathUrl(fetched.finalUrl, matchedSource.location)) {
|
|
135170
135242
|
return JSON.stringify({
|
|
135171
135243
|
success: false,
|
|
@@ -135187,14 +135259,14 @@ var external_skill_discover = createSwarmTool({
|
|
|
135187
135259
|
error: `Content too large: ${resolvedContent.length} bytes exceeds max_bytes_per_candidate (${config3.max_bytes_per_candidate})`
|
|
135188
135260
|
});
|
|
135189
135261
|
}
|
|
135190
|
-
const sha256 =
|
|
135262
|
+
const sha256 = _internals100.computeSha256(resolvedContent);
|
|
135191
135263
|
const candidate = {
|
|
135192
|
-
id:
|
|
135264
|
+
id: _internals100.uuid(),
|
|
135193
135265
|
source_url: resolvedUrl,
|
|
135194
135266
|
source_type: sourceType,
|
|
135195
135267
|
publisher,
|
|
135196
135268
|
sha256,
|
|
135197
|
-
fetched_at:
|
|
135269
|
+
fetched_at: _internals100.getTimestamp(),
|
|
135198
135270
|
skill_name: typeof skillName === "string" ? skillName : undefined,
|
|
135199
135271
|
skill_description: typeof skillDescription === "string" ? skillDescription : undefined,
|
|
135200
135272
|
skill_body: resolvedContent,
|
|
@@ -135212,7 +135284,7 @@ var external_skill_discover = createSwarmTool({
|
|
|
135212
135284
|
candidate.evaluation_history = [
|
|
135213
135285
|
{
|
|
135214
135286
|
verdict: result.overall_verdict,
|
|
135215
|
-
timestamp:
|
|
135287
|
+
timestamp: _internals100.getTimestamp(),
|
|
135216
135288
|
actor: "system",
|
|
135217
135289
|
reason: `Validation: ${result.gate_results.length} gates, ${result.all_findings.length} findings`,
|
|
135218
135290
|
gate_results: result.gate_results.map((gr) => ({
|
|
@@ -135257,7 +135329,7 @@ var external_skill_discover = createSwarmTool({
|
|
|
135257
135329
|
init_zod();
|
|
135258
135330
|
init_loader();
|
|
135259
135331
|
init_create_tool();
|
|
135260
|
-
var
|
|
135332
|
+
var _internals101 = {
|
|
135261
135333
|
loadConfig: (directory) => {
|
|
135262
135334
|
const pluginConfig = loadPluginConfig(directory);
|
|
135263
135335
|
return pluginConfig.external_skills;
|
|
@@ -135279,7 +135351,7 @@ var external_skill_inspect = createSwarmTool({
|
|
|
135279
135351
|
} catch {}
|
|
135280
135352
|
let config3;
|
|
135281
135353
|
try {
|
|
135282
|
-
config3 =
|
|
135354
|
+
config3 = _internals101.loadConfig(directory);
|
|
135283
135355
|
} catch {
|
|
135284
135356
|
return JSON.stringify({
|
|
135285
135357
|
success: false,
|
|
@@ -135321,7 +135393,7 @@ var external_skill_inspect = createSwarmTool({
|
|
|
135321
135393
|
init_zod();
|
|
135322
135394
|
init_loader();
|
|
135323
135395
|
init_create_tool();
|
|
135324
|
-
var
|
|
135396
|
+
var _internals102 = {
|
|
135325
135397
|
loadConfig: (directory) => {
|
|
135326
135398
|
const pluginConfig = loadPluginConfig(directory);
|
|
135327
135399
|
return pluginConfig.external_skills;
|
|
@@ -135357,7 +135429,7 @@ var external_skill_list = createSwarmTool({
|
|
|
135357
135429
|
} catch {}
|
|
135358
135430
|
let config3;
|
|
135359
135431
|
try {
|
|
135360
|
-
config3 =
|
|
135432
|
+
config3 = _internals102.loadConfig(directory);
|
|
135361
135433
|
} catch {
|
|
135362
135434
|
return JSON.stringify({
|
|
135363
135435
|
success: false,
|
|
@@ -135410,7 +135482,7 @@ import { createHash as createHash22 } from "node:crypto";
|
|
|
135410
135482
|
import * as fs104 from "node:fs/promises";
|
|
135411
135483
|
import * as path163 from "node:path";
|
|
135412
135484
|
init_create_tool();
|
|
135413
|
-
var
|
|
135485
|
+
var _internals103 = {
|
|
135414
135486
|
loadConfig: (directory) => {
|
|
135415
135487
|
const pluginConfig = loadPluginConfig(directory);
|
|
135416
135488
|
return pluginConfig.external_skills;
|
|
@@ -135480,7 +135552,7 @@ var external_skill_promote = createSwarmTool({
|
|
|
135480
135552
|
} catch {}
|
|
135481
135553
|
let config3;
|
|
135482
135554
|
try {
|
|
135483
|
-
config3 =
|
|
135555
|
+
config3 = _internals103.loadConfig(directory);
|
|
135484
135556
|
} catch {
|
|
135485
135557
|
return JSON.stringify({
|
|
135486
135558
|
success: false,
|
|
@@ -135550,8 +135622,8 @@ var external_skill_promote = createSwarmTool({
|
|
|
135550
135622
|
}
|
|
135551
135623
|
const targetDir = path163.join(directory, ".opencode", "skills", "generated", sanitizedSlug);
|
|
135552
135624
|
const targetPath = path163.join(targetDir, "SKILL.md");
|
|
135553
|
-
const timestamp =
|
|
135554
|
-
const alreadyExists = await
|
|
135625
|
+
const timestamp = _internals103.getTimestamp();
|
|
135626
|
+
const alreadyExists = await _internals103.fileExists(targetPath);
|
|
135555
135627
|
if (alreadyExists) {
|
|
135556
135628
|
return JSON.stringify({
|
|
135557
135629
|
success: false,
|
|
@@ -135560,7 +135632,7 @@ var external_skill_promote = createSwarmTool({
|
|
|
135560
135632
|
}
|
|
135561
135633
|
const skillMarkdown = buildSkillMarkdown(candidate, sanitizedSlug, timestamp);
|
|
135562
135634
|
try {
|
|
135563
|
-
await
|
|
135635
|
+
await _internals103.writeSkillFile(targetPath, skillMarkdown);
|
|
135564
135636
|
} catch (writeErr) {
|
|
135565
135637
|
const writeError = writeErr;
|
|
135566
135638
|
if (writeError?.code === "EEXIST") {
|
|
@@ -135637,7 +135709,7 @@ var external_skill_promote = createSwarmTool({
|
|
|
135637
135709
|
init_zod();
|
|
135638
135710
|
init_loader();
|
|
135639
135711
|
init_create_tool();
|
|
135640
|
-
var
|
|
135712
|
+
var _internals104 = {
|
|
135641
135713
|
loadConfig: (directory) => {
|
|
135642
135714
|
const pluginConfig = loadPluginConfig(directory);
|
|
135643
135715
|
return pluginConfig.external_skills;
|
|
@@ -135662,7 +135734,7 @@ var external_skill_reject = createSwarmTool({
|
|
|
135662
135734
|
} catch {}
|
|
135663
135735
|
let config3;
|
|
135664
135736
|
try {
|
|
135665
|
-
config3 =
|
|
135737
|
+
config3 = _internals104.loadConfig(directory);
|
|
135666
135738
|
} catch {
|
|
135667
135739
|
return JSON.stringify({
|
|
135668
135740
|
success: false,
|
|
@@ -135725,7 +135797,7 @@ init_zod();
|
|
|
135725
135797
|
init_loader();
|
|
135726
135798
|
import * as path164 from "node:path";
|
|
135727
135799
|
init_create_tool();
|
|
135728
|
-
var
|
|
135800
|
+
var _internals105 = {
|
|
135729
135801
|
loadConfig: (directory) => {
|
|
135730
135802
|
const pluginConfig = loadPluginConfig(directory);
|
|
135731
135803
|
return pluginConfig.external_skills;
|
|
@@ -135776,7 +135848,7 @@ var external_skill_revoke = createSwarmTool({
|
|
|
135776
135848
|
} catch {}
|
|
135777
135849
|
let config3;
|
|
135778
135850
|
try {
|
|
135779
|
-
config3 =
|
|
135851
|
+
config3 = _internals105.loadConfig(directory);
|
|
135780
135852
|
} catch {
|
|
135781
135853
|
return JSON.stringify({
|
|
135782
135854
|
success: false,
|
|
@@ -135823,8 +135895,8 @@ var external_skill_revoke = createSwarmTool({
|
|
|
135823
135895
|
});
|
|
135824
135896
|
}
|
|
135825
135897
|
const skillPath = path164.join(directory, ".opencode", "skills", "generated", slug, "SKILL.md");
|
|
135826
|
-
const skillFileRemoved = await
|
|
135827
|
-
const timestamp =
|
|
135898
|
+
const skillFileRemoved = await _internals105.retireSkillFile(skillPath);
|
|
135899
|
+
const timestamp = _internals105.getTimestamp();
|
|
135828
135900
|
const historyEntry = {
|
|
135829
135901
|
verdict: "revoked",
|
|
135830
135902
|
timestamp,
|
|
@@ -138211,7 +138283,7 @@ init_zod();
|
|
|
138211
138283
|
init_config();
|
|
138212
138284
|
init_state2();
|
|
138213
138285
|
init_create_tool();
|
|
138214
|
-
var
|
|
138286
|
+
var _internals106 = {
|
|
138215
138287
|
LeanTurboRunner,
|
|
138216
138288
|
loadPluginConfigWithMeta
|
|
138217
138289
|
};
|
|
@@ -138221,9 +138293,9 @@ async function executeLeanTurboRunPhase(args2) {
|
|
|
138221
138293
|
let runError = null;
|
|
138222
138294
|
let runner = null;
|
|
138223
138295
|
try {
|
|
138224
|
-
const { config: config3 } =
|
|
138296
|
+
const { config: config3 } = _internals106.loadPluginConfigWithMeta(directory);
|
|
138225
138297
|
const leanConfig = config3.turbo?.strategy === "lean" ? config3.turbo.lean : undefined;
|
|
138226
|
-
runner = new
|
|
138298
|
+
runner = new _internals106.LeanTurboRunner({
|
|
138227
138299
|
directory,
|
|
138228
138300
|
sessionID,
|
|
138229
138301
|
opencodeClient: swarmState.opencodeClient ?? null,
|
|
@@ -138559,7 +138631,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
|
|
|
138559
138631
|
const strippedMutated = stripCode(mutatedCode);
|
|
138560
138632
|
return strippedOriginal === strippedMutated;
|
|
138561
138633
|
}
|
|
138562
|
-
var
|
|
138634
|
+
var _internals107 = {
|
|
138563
138635
|
isStaticallyEquivalent,
|
|
138564
138636
|
checkEquivalence,
|
|
138565
138637
|
batchCheckEquivalence
|
|
@@ -138599,7 +138671,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
|
|
|
138599
138671
|
const results = [];
|
|
138600
138672
|
for (const { patch, originalCode, mutatedCode } of patches) {
|
|
138601
138673
|
try {
|
|
138602
|
-
const result = await
|
|
138674
|
+
const result = await _internals107.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
|
|
138603
138675
|
results.push(result);
|
|
138604
138676
|
} catch (err2) {
|
|
138605
138677
|
results.push({
|
|
@@ -138659,7 +138731,7 @@ function validateTestCommand(testCommand) {
|
|
|
138659
138731
|
var MUTATION_TIMEOUT_MS = 30000;
|
|
138660
138732
|
var TOTAL_BUDGET_MS = 300000;
|
|
138661
138733
|
var GIT_APPLY_TIMEOUT_MS = 5000;
|
|
138662
|
-
var
|
|
138734
|
+
var _internals108 = {
|
|
138663
138735
|
executeMutation,
|
|
138664
138736
|
computeReport,
|
|
138665
138737
|
executeMutationSuite,
|
|
@@ -138691,7 +138763,7 @@ async function executeMutation(patch, testCommand, testFiles, workingDir) {
|
|
|
138691
138763
|
};
|
|
138692
138764
|
}
|
|
138693
138765
|
try {
|
|
138694
|
-
const applyResult =
|
|
138766
|
+
const applyResult = _internals108.spawnSync("git", ["apply", "--", patchFile], {
|
|
138695
138767
|
cwd: workingDir,
|
|
138696
138768
|
timeout: GIT_APPLY_TIMEOUT_MS,
|
|
138697
138769
|
stdio: "pipe"
|
|
@@ -138722,7 +138794,7 @@ async function executeMutation(patch, testCommand, testFiles, workingDir) {
|
|
|
138722
138794
|
try {
|
|
138723
138795
|
const safeTestFiles = testFiles.filter((f) => !f.startsWith("-"));
|
|
138724
138796
|
const testArgs = safeTestFiles.length > 0 ? [...testCommand.slice(1), ...safeTestFiles] : testCommand.slice(1);
|
|
138725
|
-
const spawnResult =
|
|
138797
|
+
const spawnResult = _internals108.spawnSync(testCommand[0], testArgs, {
|
|
138726
138798
|
cwd: workingDir,
|
|
138727
138799
|
timeout: MUTATION_TIMEOUT_MS,
|
|
138728
138800
|
stdio: "pipe"
|
|
@@ -138755,7 +138827,7 @@ async function executeMutation(patch, testCommand, testFiles, workingDir) {
|
|
|
138755
138827
|
} finally {
|
|
138756
138828
|
if (patchFile) {
|
|
138757
138829
|
try {
|
|
138758
|
-
const revertResult =
|
|
138830
|
+
const revertResult = _internals108.spawnSync("git", ["apply", "-R", "--", patchFile], {
|
|
138759
138831
|
cwd: workingDir,
|
|
138760
138832
|
timeout: GIT_APPLY_TIMEOUT_MS,
|
|
138761
138833
|
stdio: "pipe"
|
|
@@ -138952,7 +139024,7 @@ async function executeMutationSuite(patches, testCommand, testFiles, workingDir,
|
|
|
138952
139024
|
}
|
|
138953
139025
|
|
|
138954
139026
|
// src/mutation/gate.ts
|
|
138955
|
-
var
|
|
139027
|
+
var _internals109 = {
|
|
138956
139028
|
evaluateMutationGate,
|
|
138957
139029
|
buildTestImprovementPrompt,
|
|
138958
139030
|
buildMessage
|
|
@@ -138973,8 +139045,8 @@ function evaluateMutationGate(report, passThreshold = PASS_THRESHOLD, warnThresh
|
|
|
138973
139045
|
} else {
|
|
138974
139046
|
verdict = "fail";
|
|
138975
139047
|
}
|
|
138976
|
-
const testImprovementPrompt =
|
|
138977
|
-
const message =
|
|
139048
|
+
const testImprovementPrompt = _internals109.buildTestImprovementPrompt(report, passThreshold, verdict);
|
|
139049
|
+
const message = _internals109.buildMessage(verdict, adjustedKillRate, report.killed, report.totalMutants, report.equivalent, warnThreshold);
|
|
138978
139050
|
return {
|
|
138979
139051
|
verdict,
|
|
138980
139052
|
killRate: report.killRate,
|
|
@@ -139493,7 +139565,7 @@ function listLaneEvidenceSync(directory, phase) {
|
|
|
139493
139565
|
}
|
|
139494
139566
|
return laneIds;
|
|
139495
139567
|
}
|
|
139496
|
-
var
|
|
139568
|
+
var _internals110 = {
|
|
139497
139569
|
listActiveLocks,
|
|
139498
139570
|
readPersisted: readPersisted3,
|
|
139499
139571
|
readPlanJson: defaultReadPlanJson,
|
|
@@ -139554,7 +139626,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
139554
139626
|
reason: "Lean Turbo state unreadable or missing"
|
|
139555
139627
|
};
|
|
139556
139628
|
}
|
|
139557
|
-
const persisted =
|
|
139629
|
+
const persisted = _internals110.readPersisted(directory);
|
|
139558
139630
|
if (!persisted) {
|
|
139559
139631
|
return {
|
|
139560
139632
|
ok: false,
|
|
@@ -139618,7 +139690,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
139618
139690
|
}
|
|
139619
139691
|
}
|
|
139620
139692
|
if (runState.lanes.length > 0) {
|
|
139621
|
-
const evidenceLaneIds = new Set(
|
|
139693
|
+
const evidenceLaneIds = new Set(_internals110.listLaneEvidenceSync(directory, phase));
|
|
139622
139694
|
for (const lane of runState.lanes) {
|
|
139623
139695
|
if ((lane.status === "completed" || lane.status === "failed") && !evidenceLaneIds.has(lane.laneId)) {
|
|
139624
139696
|
return {
|
|
@@ -139628,7 +139700,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
139628
139700
|
}
|
|
139629
139701
|
}
|
|
139630
139702
|
}
|
|
139631
|
-
const activeLocks =
|
|
139703
|
+
const activeLocks = _internals110.listActiveLocks(directory);
|
|
139632
139704
|
const phaseLaneIds = new Set(laneIds);
|
|
139633
139705
|
for (const lock of activeLocks) {
|
|
139634
139706
|
if (lock.laneId && phaseLaneIds.has(lock.laneId)) {
|
|
@@ -139648,7 +139720,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
139648
139720
|
}
|
|
139649
139721
|
const serialDegradedTasks = runState.degradedTasks.filter((dt) => !laneTaskIds.has(dt.taskId));
|
|
139650
139722
|
if (serialDegradedTasks.length > 0) {
|
|
139651
|
-
const plan =
|
|
139723
|
+
const plan = _internals110.readPlanJson(directory);
|
|
139652
139724
|
if (!plan) {
|
|
139653
139725
|
return {
|
|
139654
139726
|
ok: false,
|
|
@@ -139692,7 +139764,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
139692
139764
|
}
|
|
139693
139765
|
const serializedTasks = runState.serializedTasks;
|
|
139694
139766
|
if (Array.isArray(serializedTasks) && serializedTasks.length > 0) {
|
|
139695
|
-
const plan =
|
|
139767
|
+
const plan = _internals110.readPlanJson(directory);
|
|
139696
139768
|
if (!plan) {
|
|
139697
139769
|
return {
|
|
139698
139770
|
ok: false,
|
|
@@ -139751,7 +139823,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
139751
139823
|
}
|
|
139752
139824
|
let reviewerVerdict = runState.lastReviewerVerdict;
|
|
139753
139825
|
if (!reviewerVerdict) {
|
|
139754
|
-
const evidence =
|
|
139826
|
+
const evidence = _internals110.readReviewerEvidence(directory, phase);
|
|
139755
139827
|
reviewerVerdict = evidence?.verdict ?? undefined;
|
|
139756
139828
|
}
|
|
139757
139829
|
if (mergedConfig.phase_reviewer) {
|
|
@@ -139764,7 +139836,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
|
|
|
139764
139836
|
}
|
|
139765
139837
|
let criticVerdict = runState.lastCriticVerdict;
|
|
139766
139838
|
if (!criticVerdict) {
|
|
139767
|
-
const evidence =
|
|
139839
|
+
const evidence = _internals110.readCriticEvidence(directory, phase);
|
|
139768
139840
|
criticVerdict = evidence?.verdict ?? undefined;
|
|
139769
139841
|
}
|
|
139770
139842
|
if (mergedConfig.phase_critic) {
|
|
@@ -140948,7 +141020,7 @@ async function executePhaseComplete(args2, workingDirectory, directory) {
|
|
|
140948
141020
|
phase_critic: leanConfig.phase_critic,
|
|
140949
141021
|
integrated_diff_required: leanConfig.integrated_diff_required
|
|
140950
141022
|
} : undefined;
|
|
140951
|
-
const leanCheck =
|
|
141023
|
+
const leanCheck = _internals110.verifyLeanTurboPhaseReady(dir, phase, sessionID, leanPhaseReadyConfig);
|
|
140952
141024
|
if (!leanCheck.ok) {
|
|
140953
141025
|
return JSON.stringify({
|
|
140954
141026
|
success: false,
|
|
@@ -143330,11 +143402,11 @@ var quality_budget = createSwarmTool({
|
|
|
143330
143402
|
}).optional().describe("Quality budget thresholds")
|
|
143331
143403
|
},
|
|
143332
143404
|
async execute(args2, directory) {
|
|
143333
|
-
const result = await
|
|
143405
|
+
const result = await _internals112.qualityBudget(args2, directory);
|
|
143334
143406
|
return JSON.stringify(result);
|
|
143335
143407
|
}
|
|
143336
143408
|
});
|
|
143337
|
-
var
|
|
143409
|
+
var _internals112 = {
|
|
143338
143410
|
qualityBudget
|
|
143339
143411
|
};
|
|
143340
143412
|
|
|
@@ -144059,7 +144131,7 @@ var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
|
|
|
144059
144131
|
var DEFAULT_TIMEOUT_MS4 = 30000;
|
|
144060
144132
|
var MAX_OUTPUT_BYTES8 = 10 * 1024 * 1024;
|
|
144061
144133
|
var KILL_GRACE_MS = 2000;
|
|
144062
|
-
var
|
|
144134
|
+
var _internals113 = {
|
|
144063
144135
|
isSemgrepAvailable,
|
|
144064
144136
|
checkSemgrepAvailable,
|
|
144065
144137
|
resetSemgrepCache,
|
|
@@ -144085,7 +144157,7 @@ function isSemgrepAvailable() {
|
|
|
144085
144157
|
}
|
|
144086
144158
|
}
|
|
144087
144159
|
async function checkSemgrepAvailable() {
|
|
144088
|
-
return
|
|
144160
|
+
return _internals113.isSemgrepAvailable();
|
|
144089
144161
|
}
|
|
144090
144162
|
function resetSemgrepCache() {
|
|
144091
144163
|
semgrepAvailableCache = null;
|
|
@@ -144271,12 +144343,12 @@ async function runSemgrep(options) {
|
|
|
144271
144343
|
const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS4;
|
|
144272
144344
|
if (files.length === 0) {
|
|
144273
144345
|
return {
|
|
144274
|
-
available:
|
|
144346
|
+
available: _internals113.isSemgrepAvailable(),
|
|
144275
144347
|
findings: [],
|
|
144276
144348
|
engine: "tier_a"
|
|
144277
144349
|
};
|
|
144278
144350
|
}
|
|
144279
|
-
if (!
|
|
144351
|
+
if (!_internals113.isSemgrepAvailable()) {
|
|
144280
144352
|
return {
|
|
144281
144353
|
available: false,
|
|
144282
144354
|
findings: [],
|
|
@@ -144443,7 +144515,7 @@ function assignOccurrenceIndices(findings, directory) {
|
|
|
144443
144515
|
}
|
|
144444
144516
|
const occIdx = countMap.get(baseKey) ?? 0;
|
|
144445
144517
|
countMap.set(baseKey, occIdx + 1);
|
|
144446
|
-
const fp =
|
|
144518
|
+
const fp = _internals114.fingerprintFinding(finding, directory, occIdx);
|
|
144447
144519
|
return {
|
|
144448
144520
|
finding,
|
|
144449
144521
|
index: occIdx,
|
|
@@ -144512,7 +144584,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
|
|
|
144512
144584
|
}
|
|
144513
144585
|
} catch {}
|
|
144514
144586
|
const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
|
|
144515
|
-
const indexed =
|
|
144587
|
+
const indexed = _internals114.assignOccurrenceIndices(findings, directory);
|
|
144516
144588
|
if (existing && !opts?.force) {
|
|
144517
144589
|
const prunedFingerprints = existing.fingerprints.filter((fp) => {
|
|
144518
144590
|
const relFile = fp.slice(0, fp.indexOf("|"));
|
|
@@ -144652,7 +144724,7 @@ function loadBaseline(directory, phase) {
|
|
|
144652
144724
|
};
|
|
144653
144725
|
}
|
|
144654
144726
|
}
|
|
144655
|
-
var
|
|
144727
|
+
var _internals114 = {
|
|
144656
144728
|
fingerprintFinding,
|
|
144657
144729
|
assignOccurrenceIndices,
|
|
144658
144730
|
captureOrMergeBaseline,
|
|
@@ -145062,11 +145134,11 @@ var sast_scan = createSwarmTool({
|
|
|
145062
145134
|
capture_baseline: safeArgs.capture_baseline,
|
|
145063
145135
|
phase: safeArgs.phase
|
|
145064
145136
|
};
|
|
145065
|
-
const result = await
|
|
145137
|
+
const result = await _internals115.sastScan(input, directory);
|
|
145066
145138
|
return JSON.stringify(result, null, 2);
|
|
145067
145139
|
}
|
|
145068
145140
|
});
|
|
145069
|
-
var
|
|
145141
|
+
var _internals115 = {
|
|
145070
145142
|
sastScan,
|
|
145071
145143
|
sast_scan
|
|
145072
145144
|
};
|
|
@@ -150191,7 +150263,7 @@ var swarm_memory_propose = createSwarmTool({
|
|
|
150191
150263
|
evidenceRefs: exports_external.array(exports_external.string().min(1).max(500)).max(20).optional().describe("Evidence refs such as files, commits, test outputs, or URLs")
|
|
150192
150264
|
},
|
|
150193
150265
|
execute: async (args2, directory, ctx) => {
|
|
150194
|
-
const { config: config3 } =
|
|
150266
|
+
const { config: config3 } = _internals116.loadPluginConfigWithMeta(directory);
|
|
150195
150267
|
if (config3.memory?.enabled !== true) {
|
|
150196
150268
|
return JSON.stringify({
|
|
150197
150269
|
success: false,
|
|
@@ -150207,7 +150279,7 @@ var swarm_memory_propose = createSwarmTool({
|
|
|
150207
150279
|
});
|
|
150208
150280
|
}
|
|
150209
150281
|
const agent = getContextAgent3(ctx);
|
|
150210
|
-
const gateway =
|
|
150282
|
+
const gateway = _internals116.createMemoryGateway({
|
|
150211
150283
|
directory,
|
|
150212
150284
|
sessionID: ctx?.sessionID,
|
|
150213
150285
|
agentRole: agent,
|
|
@@ -150232,7 +150304,7 @@ var swarm_memory_propose = createSwarmTool({
|
|
|
150232
150304
|
}
|
|
150233
150305
|
}
|
|
150234
150306
|
});
|
|
150235
|
-
var
|
|
150307
|
+
var _internals116 = {
|
|
150236
150308
|
loadPluginConfigWithMeta,
|
|
150237
150309
|
createMemoryGateway
|
|
150238
150310
|
};
|
|
@@ -150270,7 +150342,7 @@ var swarm_memory_recall = createSwarmTool({
|
|
|
150270
150342
|
maxItems: exports_external.number().int().min(1).max(20).optional().describe("Maximum memories to return")
|
|
150271
150343
|
},
|
|
150272
150344
|
execute: async (args2, directory, ctx) => {
|
|
150273
|
-
const { config: config3 } =
|
|
150345
|
+
const { config: config3 } = _internals117.loadPluginConfigWithMeta(directory);
|
|
150274
150346
|
if (config3.memory?.enabled !== true) {
|
|
150275
150347
|
return JSON.stringify({
|
|
150276
150348
|
success: false,
|
|
@@ -150286,7 +150358,7 @@ var swarm_memory_recall = createSwarmTool({
|
|
|
150286
150358
|
});
|
|
150287
150359
|
}
|
|
150288
150360
|
const agent = getContextAgent4(ctx);
|
|
150289
|
-
const gateway =
|
|
150361
|
+
const gateway = _internals117.createMemoryGateway({
|
|
150290
150362
|
directory,
|
|
150291
150363
|
sessionID: ctx?.sessionID,
|
|
150292
150364
|
agentRole: agent,
|
|
@@ -150319,7 +150391,7 @@ var RecallArgsSchema = exports_external.object({
|
|
|
150319
150391
|
kinds: exports_external.array(exports_external.enum(MEMORY_KINDS2)).optional(),
|
|
150320
150392
|
maxItems: exports_external.number().int().min(1).max(20).optional()
|
|
150321
150393
|
});
|
|
150322
|
-
var
|
|
150394
|
+
var _internals117 = {
|
|
150323
150395
|
loadPluginConfigWithMeta,
|
|
150324
150396
|
createMemoryGateway
|
|
150325
150397
|
};
|
|
@@ -150845,7 +150917,7 @@ import * as path199 from "node:path";
|
|
|
150845
150917
|
init_bun_compat();
|
|
150846
150918
|
import * as fs134 from "node:fs";
|
|
150847
150919
|
import * as path198 from "node:path";
|
|
150848
|
-
var
|
|
150920
|
+
var _internals118 = { bunSpawn };
|
|
150849
150921
|
var _swarmGitExcludedChecked = false;
|
|
150850
150922
|
function fileCoversSwarm(content) {
|
|
150851
150923
|
for (const rawLine of content.split(`
|
|
@@ -150878,7 +150950,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
150878
150950
|
checkIgnoreExitCode
|
|
150879
150951
|
] = await Promise.all([
|
|
150880
150952
|
(async () => {
|
|
150881
|
-
const proc =
|
|
150953
|
+
const proc = _internals118.bunSpawn(["git", "-C", directory, "rev-parse", "--show-toplevel"], GIT_SPAWN_OPTIONS);
|
|
150882
150954
|
try {
|
|
150883
150955
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
150884
150956
|
} finally {
|
|
@@ -150888,7 +150960,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
150888
150960
|
}
|
|
150889
150961
|
})(),
|
|
150890
150962
|
(async () => {
|
|
150891
|
-
const proc =
|
|
150963
|
+
const proc = _internals118.bunSpawn(["git", "-C", directory, "rev-parse", "--git-path", "info/exclude"], GIT_SPAWN_OPTIONS);
|
|
150892
150964
|
try {
|
|
150893
150965
|
return await Promise.all([proc.exited, proc.stdout.text()]);
|
|
150894
150966
|
} finally {
|
|
@@ -150898,7 +150970,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
150898
150970
|
}
|
|
150899
150971
|
})(),
|
|
150900
150972
|
(async () => {
|
|
150901
|
-
const proc =
|
|
150973
|
+
const proc = _internals118.bunSpawn(["git", "-C", directory, "check-ignore", "-q", ".swarm/.gitkeep"], GIT_SPAWN_OPTIONS);
|
|
150902
150974
|
try {
|
|
150903
150975
|
return await proc.exited;
|
|
150904
150976
|
} finally {
|
|
@@ -150937,7 +151009,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
150937
151009
|
}
|
|
150938
151010
|
} catch {}
|
|
150939
151011
|
}
|
|
150940
|
-
const trackedProc =
|
|
151012
|
+
const trackedProc = _internals118.bunSpawn(["git", "-C", directory, "ls-files", "--", ".swarm"], GIT_SPAWN_OPTIONS);
|
|
150941
151013
|
let trackedExitCode;
|
|
150942
151014
|
let trackedOutput;
|
|
150943
151015
|
try {
|
|
@@ -150962,7 +151034,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
|
|
|
150962
151034
|
}
|
|
150963
151035
|
|
|
150964
151036
|
// src/hooks/diff-scope.ts
|
|
150965
|
-
var
|
|
151037
|
+
var _internals119 = { bunSpawn };
|
|
150966
151038
|
function getDeclaredScope(taskId, directory) {
|
|
150967
151039
|
try {
|
|
150968
151040
|
const planPath = path199.join(directory, ".swarm", "plan.json");
|
|
@@ -150997,7 +151069,7 @@ var GIT_DIFF_SPAWN_OPTIONS = {
|
|
|
150997
151069
|
};
|
|
150998
151070
|
async function getChangedFiles2(directory) {
|
|
150999
151071
|
try {
|
|
151000
|
-
const proc =
|
|
151072
|
+
const proc = _internals119.bunSpawn(["git", "diff", "--name-only", "HEAD~1"], {
|
|
151001
151073
|
cwd: directory,
|
|
151002
151074
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
151003
151075
|
});
|
|
@@ -151014,7 +151086,7 @@ async function getChangedFiles2(directory) {
|
|
|
151014
151086
|
return stdout.trim().split(`
|
|
151015
151087
|
`).map((f) => f.trim()).filter((f) => f.length > 0);
|
|
151016
151088
|
}
|
|
151017
|
-
const proc2 =
|
|
151089
|
+
const proc2 = _internals119.bunSpawn(["git", "diff", "--name-only", "HEAD"], {
|
|
151018
151090
|
cwd: directory,
|
|
151019
151091
|
...GIT_DIFF_SPAWN_OPTIONS
|
|
151020
151092
|
});
|
|
@@ -151072,7 +151144,7 @@ init_telemetry();
|
|
|
151072
151144
|
init_file_locks();
|
|
151073
151145
|
import * as fs136 from "node:fs";
|
|
151074
151146
|
import * as path200 from "node:path";
|
|
151075
|
-
var
|
|
151147
|
+
var _internals120 = {
|
|
151076
151148
|
listActiveLocks,
|
|
151077
151149
|
verifyLeanTurboTaskCompletion
|
|
151078
151150
|
};
|
|
@@ -151214,7 +151286,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
|
|
|
151214
151286
|
}
|
|
151215
151287
|
};
|
|
151216
151288
|
}
|
|
151217
|
-
const activeLocks =
|
|
151289
|
+
const activeLocks = _internals120.listActiveLocks(directory);
|
|
151218
151290
|
const laneLocks = activeLocks.filter((lock) => lock.laneId === lane.laneId);
|
|
151219
151291
|
if (laneLocks.length > 0) {
|
|
151220
151292
|
return {
|
|
@@ -151281,7 +151353,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
|
|
|
151281
151353
|
init_task_id();
|
|
151282
151354
|
init_create_tool();
|
|
151283
151355
|
init_resolve_working_directory();
|
|
151284
|
-
var
|
|
151356
|
+
var _internals121 = {
|
|
151285
151357
|
tryAcquireLock,
|
|
151286
151358
|
updateTaskStatus,
|
|
151287
151359
|
resolveWorkingDirectory
|
|
@@ -151378,7 +151450,7 @@ function checkReviewerGate(taskId, workingDirectory, stageBParallelEnabled = fal
|
|
|
151378
151450
|
}
|
|
151379
151451
|
let resolvedDir;
|
|
151380
151452
|
if (fallbackDir) {
|
|
151381
|
-
const resolveResult =
|
|
151453
|
+
const resolveResult = _internals121.resolveWorkingDirectory(workingDirectory, fallbackDir);
|
|
151382
151454
|
if (resolveResult.success) {
|
|
151383
151455
|
resolvedDir = resolveResult.directory;
|
|
151384
151456
|
} else {
|
|
@@ -151725,7 +151797,7 @@ async function executeUpdateTaskStatus(args2, fallbackDir, ctx) {
|
|
|
151725
151797
|
}
|
|
151726
151798
|
}
|
|
151727
151799
|
let directory;
|
|
151728
|
-
const resolveResult =
|
|
151800
|
+
const resolveResult = _internals121.resolveWorkingDirectory(args2.working_directory, fallbackDir);
|
|
151729
151801
|
if (!resolveResult.success) {
|
|
151730
151802
|
return {
|
|
151731
151803
|
success: false,
|
|
@@ -151818,7 +151890,7 @@ async function executeUpdateTaskStatus(args2, fallbackDir, ctx) {
|
|
|
151818
151890
|
}
|
|
151819
151891
|
let lockResult;
|
|
151820
151892
|
try {
|
|
151821
|
-
lockResult = await
|
|
151893
|
+
lockResult = await _internals121.tryAcquireLock(directory, planFilePath, agentName, lockTaskId);
|
|
151822
151894
|
} catch (error93) {
|
|
151823
151895
|
return {
|
|
151824
151896
|
success: false,
|
|
@@ -151837,7 +151909,7 @@ async function executeUpdateTaskStatus(args2, fallbackDir, ctx) {
|
|
|
151837
151909
|
};
|
|
151838
151910
|
}
|
|
151839
151911
|
try {
|
|
151840
|
-
const updatedPlan = await
|
|
151912
|
+
const updatedPlan = await _internals121.updateTaskStatus(directory, args2.task_id, args2.status);
|
|
151841
151913
|
if (args2.status === "completed") {
|
|
151842
151914
|
for (const [_sessionId, session] of swarmState.agentSessions) {
|
|
151843
151915
|
if (!(session.taskWorkflowStates instanceof Map)) {
|
|
@@ -152492,7 +152564,7 @@ var web_fetch = createSwarmTool({
|
|
|
152492
152564
|
};
|
|
152493
152565
|
return JSON.stringify(fail, null, 2);
|
|
152494
152566
|
}
|
|
152495
|
-
const config3 =
|
|
152567
|
+
const config3 = _internals122.loadPluginConfig(dirResult.directory);
|
|
152496
152568
|
const generalConfig = config3.council?.general;
|
|
152497
152569
|
if (!generalConfig || generalConfig.enabled !== true) {
|
|
152498
152570
|
const fail = {
|
|
@@ -152502,7 +152574,7 @@ var web_fetch = createSwarmTool({
|
|
|
152502
152574
|
};
|
|
152503
152575
|
return JSON.stringify(fail, null, 2);
|
|
152504
152576
|
}
|
|
152505
|
-
const validated = await validateFetchUrl(parsed.data.url,
|
|
152577
|
+
const validated = await validateFetchUrl(parsed.data.url, _internals122.dnsLookup);
|
|
152506
152578
|
if (!validated.ok) {
|
|
152507
152579
|
const fail = {
|
|
152508
152580
|
success: false,
|
|
@@ -152513,7 +152585,7 @@ var web_fetch = createSwarmTool({
|
|
|
152513
152585
|
}
|
|
152514
152586
|
const maxBytes = parsed.data.max_bytes ?? DEFAULT_MAX_BYTES;
|
|
152515
152587
|
const timeoutMs = parsed.data.timeout_ms ?? DEFAULT_TIMEOUT_MS5;
|
|
152516
|
-
const result = await boundedFetch({ url: validated.url, address: validated.address }, maxBytes, timeoutMs,
|
|
152588
|
+
const result = await boundedFetch({ url: validated.url, address: validated.address }, maxBytes, timeoutMs, _internals122);
|
|
152517
152589
|
if (!result.ok) {
|
|
152518
152590
|
const fail = {
|
|
152519
152591
|
success: false,
|
|
@@ -152548,7 +152620,7 @@ var web_fetch = createSwarmTool({
|
|
|
152548
152620
|
});
|
|
152549
152621
|
async function captureFetchEvidence(directory, url3, title, text) {
|
|
152550
152622
|
try {
|
|
152551
|
-
const written = await
|
|
152623
|
+
const written = await _internals122.writeEvidenceDocuments(directory, [
|
|
152552
152624
|
{
|
|
152553
152625
|
sourceType: "crawl",
|
|
152554
152626
|
url: url3,
|
|
@@ -152569,7 +152641,7 @@ async function captureFetchEvidence(directory, url3, title, text) {
|
|
|
152569
152641
|
};
|
|
152570
152642
|
}
|
|
152571
152643
|
}
|
|
152572
|
-
var
|
|
152644
|
+
var _internals122 = {
|
|
152573
152645
|
httpRequest: performHttpRequest,
|
|
152574
152646
|
dnsLookup: lookup,
|
|
152575
152647
|
loadPluginConfig,
|
|
@@ -152883,7 +152955,7 @@ var web_search = createSwarmTool({
|
|
|
152883
152955
|
});
|
|
152884
152956
|
async function captureSearchEvidence(directory, query, results) {
|
|
152885
152957
|
try {
|
|
152886
|
-
const written = await
|
|
152958
|
+
const written = await _internals123.writeEvidenceDocuments(directory, results.map((result) => ({
|
|
152887
152959
|
sourceType: "web_search",
|
|
152888
152960
|
query,
|
|
152889
152961
|
title: result.title,
|
|
@@ -152911,7 +152983,7 @@ async function captureSearchEvidence(directory, query, results) {
|
|
|
152911
152983
|
};
|
|
152912
152984
|
}
|
|
152913
152985
|
}
|
|
152914
|
-
var
|
|
152986
|
+
var _internals123 = {
|
|
152915
152987
|
writeEvidenceDocuments
|
|
152916
152988
|
};
|
|
152917
152989
|
|