opencode-swarm 7.121.2 → 7.121.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.
@@ -11076,11 +11076,11 @@ var _internals15 = {
11076
11076
  }
11077
11077
  },
11078
11078
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
11079
- const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-mwvrryf3.js");
11079
+ const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-ed91r7rw.js");
11080
11080
  return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
11081
11081
  },
11082
11082
  checkHivePromotions: async (entries, knowledgeConfig, directory) => {
11083
- const { checkHivePromotions } = await import("./hive-promoter-z4tw1gfv.js");
11083
+ const { checkHivePromotions } = await import("./hive-promoter-dg6fk563.js");
11084
11084
  return checkHivePromotions(entries, knowledgeConfig, directory);
11085
11085
  },
11086
11086
  applyProposalTriage: async (directory, triage) => {
@@ -13808,19 +13808,19 @@ var ENRICHMENT_ALLOWED_FIELDS = [
13808
13808
  function buildV3EnrichmentPrompt(lesson, category, tags) {
13809
13809
  return [
13810
13810
  "Convert this prose lesson into an actionable knowledge directive.",
13811
- "Output ONLY a single JSON object \xE2\u20AC\u201D no code fences, no commentary.",
13811
+ "Output ONLY a single JSON object \u2014 no code fences, no commentary.",
13812
13812
  "",
13813
13813
  "MANDATORY fields (the directive is rejected without them):",
13814
13814
  "- At least ONE scope field non-empty:",
13815
- ' "applies_to_agents": string[] \xE2\u20AC\u201D roles from: architect, coder, reviewer, test_engineer, sme, docs, designer, critic, curator',
13816
- ' "applies_to_tools": string[] \xE2\u20AC\u201D tool names from: edit, write, patch, bash, read, grep, glob',
13815
+ ' "applies_to_agents": string[] \u2014 roles from: architect, coder, reviewer, test_engineer, sme, docs, designer, critic, curator',
13816
+ ' "applies_to_tools": string[] \u2014 tool names from: edit, write, patch, bash, read, grep, glob',
13817
13817
  "- At least ONE predicate field non-empty:",
13818
- ' "forbidden_actions": string[] \xE2\u20AC\u201D concrete actions to never take',
13819
- ' "required_actions": string[] \xE2\u20AC\u201D concrete actions to always take',
13820
- ' "verification_checks": string[] \xE2\u20AC\u201D checks a reviewer can run',
13818
+ ' "forbidden_actions": string[] \u2014 concrete actions to never take',
13819
+ ' "required_actions": string[] \u2014 concrete actions to always take',
13820
+ ' "verification_checks": string[] \u2014 checks a reviewer can run',
13821
13821
  "",
13822
13822
  "OPTIONAL fields:",
13823
- ' "triggers": string[] \xE2\u20AC\u201D short phrases that should surface this lesson',
13823
+ ' "triggers": string[] \u2014 short phrases that should surface this lesson',
13824
13824
  ' "directive_priority": "low" | "medium" | "high" | "critical"',
13825
13825
  "",
13826
13826
  "Example output:",
@@ -13845,8 +13845,8 @@ function buildV3BatchEnrichmentPrompt(lessons) {
13845
13845
  "",
13846
13846
  "For EACH element, mandatory requirements:",
13847
13847
  "- At least ONE scope field non-empty:",
13848
- ' "applies_to_agents": string[] \xE2\u20AC\u201D roles from: architect, coder, reviewer, test_engineer, sme, docs, designer, critic, curator',
13849
- ' "applies_to_tools": string[] \xE2\u20AC\u201D tool names from: edit, write, patch, bash, read, grep, glob',
13848
+ ' "applies_to_agents": string[] \u2014 roles from: architect, coder, reviewer, test_engineer, sme, docs, designer, critic, curator',
13849
+ ' "applies_to_tools": string[] \u2014 tool names from: edit, write, patch, bash, read, grep, glob',
13850
13850
  "- At least ONE predicate field non-empty:",
13851
13851
  ' "forbidden_actions": string[] | "required_actions": string[] | "verification_checks": string[]',
13852
13852
  "",
@@ -18867,8 +18867,8 @@ var _internals28 = {
18867
18867
  loadCuratorDeps: async () => {
18868
18868
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
18869
18869
  import("./schema-vwxpsk6j.js"),
18870
- import("./curator-mwvrryf3.js"),
18871
- import("./curator-llm-factory-vcyvbny0.js")
18870
+ import("./curator-ed91r7rw.js"),
18871
+ import("./curator-llm-factory-q9veqj3h.js")
18872
18872
  ]);
18873
18873
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
18874
18874
  }
@@ -19244,8 +19244,8 @@ ${USAGE5}`;
19244
19244
  }
19245
19245
 
19246
19246
  // src/commands/design-docs.ts
19247
- init_logger();
19248
19247
  var MAX_DESC_LEN = 2000;
19248
+ var _internals29 = { loadPluginConfigWithMeta };
19249
19249
  var USAGE6 = `Usage: /swarm design-docs <description> [--out <dir>] [--lang <name>] [--update]
19250
19250
 
19251
19251
  Generate or sync language-agnostic design docs for the project under build:
@@ -19341,14 +19341,14 @@ async function handleDesignDocsCommand(directory, args) {
19341
19341
  ${USAGE6}`;
19342
19342
  }
19343
19343
  try {
19344
- const { config } = loadPluginConfigWithMeta(directory);
19344
+ const { config } = _internals29.loadPluginConfigWithMeta(directory);
19345
19345
  if (config.design_docs?.enabled !== true) {
19346
19346
  return "Error: design docs are disabled. Set `design_docs.enabled: true` in " + `opencode-swarm.json to enable the docs_design agent and this command.
19347
19347
 
19348
19348
  ` + USAGE6;
19349
19349
  }
19350
19350
  } catch (configErr) {
19351
- log(`[design-docs] Could not read opencode-swarm.json (${String(configErr)}). ` + "Falling through \u2014 the architect will abort if docs_design is not registered.");
19351
+ advisoryWarn(`[design-docs] Could not read opencode-swarm.json (${String(configErr)}). ` + "Falling through \u2014 the architect will abort if docs_design is not registered.");
19352
19352
  }
19353
19353
  const description = sanitizeDescription(parsed.rest.join(" "));
19354
19354
  if (!description && !parsed.update) {
@@ -19366,7 +19366,7 @@ import { fileURLToPath } from "url";
19366
19366
  // package.json
19367
19367
  var package_default = {
19368
19368
  name: "opencode-swarm",
19369
- version: "7.121.2",
19369
+ version: "7.121.3",
19370
19370
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
19371
19371
  main: "dist/index.js",
19372
19372
  types: "dist/index.d.ts",
@@ -19987,7 +19987,7 @@ function resolveCachePackageRoot(cachePath) {
19987
19987
  const nestedPackageRoot = path38.join(cachePath, "node_modules", "opencode-swarm");
19988
19988
  return existsSync22(nestedPackageRoot) ? nestedPackageRoot : cachePath;
19989
19989
  }
19990
- var _internals29 = {
19990
+ var _internals30 = {
19991
19991
  detectSandboxCapability: () => sandboxCapabilityProbe.detect(),
19992
19992
  getSandboxExecutor: getExecutor
19993
19993
  };
@@ -20571,9 +20571,9 @@ async function checkCurator(directory) {
20571
20571
  }
20572
20572
  async function getSandboxStatus() {
20573
20573
  try {
20574
- const capability = await _internals29.detectSandboxCapability();
20574
+ const capability = await _internals30.detectSandboxCapability();
20575
20575
  const mechanism = capability.mechanism ?? "none";
20576
- const executor = await _internals29.getSandboxExecutor();
20576
+ const executor = await _internals30.getSandboxExecutor();
20577
20577
  const hasExecutor = executor !== null;
20578
20578
  if (hasExecutor) {
20579
20579
  const executorStrength = executor?.strength;
@@ -21325,7 +21325,7 @@ function readPromotionEvidence(directory) {
21325
21325
  }
21326
21326
 
21327
21327
  // src/commands/epic.ts
21328
- var _internals30 = {
21328
+ var _internals31 = {
21329
21329
  loadPluginConfigWithMeta,
21330
21330
  loadPlanJsonOnly,
21331
21331
  getCoChangeData,
@@ -21347,7 +21347,7 @@ async function handleEpicCommand(directory, args, sessionID) {
21347
21347
  if (!sessionID || sessionID.trim() === "") {
21348
21348
  return "Error: No active session context. Epic Mode requires an active session. Use /swarm epic from within an OpenCode session.";
21349
21349
  }
21350
- const session = _internals30.ensureAgentSession(sessionID, undefined, directory);
21350
+ const session = _internals31.ensureAgentSession(sessionID, undefined, directory);
21351
21351
  const arg0 = args[0]?.toLowerCase();
21352
21352
  switch (arg0) {
21353
21353
  case "status":
@@ -21374,7 +21374,7 @@ Usage:
21374
21374
  }
21375
21375
  function enableAndAck(directory, sessionID, session) {
21376
21376
  try {
21377
- _internals30.enableEpicMode(directory, sessionID);
21377
+ _internals31.enableEpicMode(directory, sessionID);
21378
21378
  } catch (err) {
21379
21379
  return `Error enabling Epic Mode: ${err instanceof Error ? err.message : String(err)}`;
21380
21380
  }
@@ -21390,7 +21390,7 @@ function enableAndAck(directory, sessionID, session) {
21390
21390
  }
21391
21391
  function disableAndAck(directory, sessionID, session) {
21392
21392
  try {
21393
- _internals30.disableEpicMode(directory, sessionID);
21393
+ _internals31.disableEpicMode(directory, sessionID);
21394
21394
  } catch (err) {
21395
21395
  return `Error disabling Epic Mode: ${err instanceof Error ? err.message : String(err)}`;
21396
21396
  }
@@ -21399,12 +21399,12 @@ function disableAndAck(directory, sessionID, session) {
21399
21399
  }
21400
21400
  function renderStatus(directory, sessionID) {
21401
21401
  const lines = ["## Epic Mode \u2014 Status", ""];
21402
- if (_internals30.isStateUnreadable(directory)) {
21402
+ if (_internals31.isStateUnreadable(directory)) {
21403
21403
  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.");
21404
21404
  return lines.join(`
21405
21405
  `);
21406
21406
  }
21407
- const state = _internals30.loadEpicSessionState(directory, sessionID);
21407
+ const state = _internals31.loadEpicSessionState(directory, sessionID);
21408
21408
  if (!state) {
21409
21409
  lines.push("Epic Mode has not been toggled for this session.");
21410
21410
  return lines.join(`
@@ -21456,7 +21456,7 @@ function formatGreenfieldDetail(input) {
21456
21456
  function renderLast(directory) {
21457
21457
  let records;
21458
21458
  try {
21459
- records = _internals30.readPromotionEvidence(directory);
21459
+ records = _internals31.readPromotionEvidence(directory);
21460
21460
  } catch (err) {
21461
21461
  return `Error reading epic-promotions.jsonl: ${err instanceof Error ? err.message : String(err)}`;
21462
21462
  }
@@ -21511,7 +21511,7 @@ function renderLast(directory) {
21511
21511
  `);
21512
21512
  }
21513
21513
  function renderCalibration(directory) {
21514
- if (_internals30.isCalibrationStateUnreadable(directory)) {
21514
+ if (_internals31.isCalibrationStateUnreadable(directory)) {
21515
21515
  return [
21516
21516
  "## Epic Mode \u2014 Calibration",
21517
21517
  "",
@@ -21523,11 +21523,11 @@ function renderCalibration(directory) {
21523
21523
  }
21524
21524
  let state;
21525
21525
  try {
21526
- state = _internals30.loadCalibrationState(directory);
21526
+ state = _internals31.loadCalibrationState(directory);
21527
21527
  } catch (err) {
21528
21528
  return `Error reading calibration state: ${err instanceof Error ? err.message : String(err)}`;
21529
21529
  }
21530
- const { config } = _internals30.loadPluginConfigWithMeta(directory);
21530
+ const { config } = _internals31.loadPluginConfigWithMeta(directory);
21531
21531
  const staticThreshold = config.turbo?.epic?.mode?.activation_threshold ?? 0.3;
21532
21532
  const calibrationCfg = config.turbo?.epic?.calibration;
21533
21533
  const loosenWindow = calibrationCfg?.loosen_window ?? 10;
@@ -21575,7 +21575,7 @@ function renderCalibration(directory) {
21575
21575
  lines.push("");
21576
21576
  let recentDivergent = [];
21577
21577
  try {
21578
- const all = _internals30.readDivergenceHistory(directory, { limit: 50 });
21578
+ const all = _internals31.readDivergenceHistory(directory, { limit: 50 });
21579
21579
  recentDivergent = all.filter((r) => !r.isClean).slice(-5);
21580
21580
  } catch {}
21581
21581
  lines.push("### Recent divergent tasks (tightened the threshold)");
@@ -21592,11 +21592,11 @@ function renderCalibration(directory) {
21592
21592
  `);
21593
21593
  }
21594
21594
  async function renderDecide(directory) {
21595
- const plan = await _internals30.loadPlanJsonOnly(directory);
21595
+ const plan = await _internals31.loadPlanJsonOnly(directory);
21596
21596
  if (!plan) {
21597
21597
  return "No plan found at `.swarm/plan.json`. Run `/swarm plan` first.";
21598
21598
  }
21599
- const { config } = _internals30.loadPluginConfigWithMeta(directory);
21599
+ const { config } = _internals31.loadPluginConfigWithMeta(directory);
21600
21600
  const modeCfg = config.turbo?.epic?.mode;
21601
21601
  const cochangeCfg = config.turbo?.epic?.cochange;
21602
21602
  const activationThreshold = modeCfg?.activation_threshold ?? 0.3;
@@ -21606,20 +21606,20 @@ async function renderDecide(directory) {
21606
21606
  const tasks = [];
21607
21607
  for (const phase of plan.phases) {
21608
21608
  for (const task of phase.tasks) {
21609
- const scopeFiles = _internals30.readTaskScopes(directory, task.id);
21609
+ const scopeFiles = _internals31.readTaskScopes(directory, task.id);
21610
21610
  const scope = scopeFiles ?? task.files_touched ?? [];
21611
21611
  tasks.push({ id: task.id, scope });
21612
21612
  }
21613
21613
  }
21614
- const { pairs, commitsObserved } = await _internals30.getCoChangeData(directory);
21614
+ const { pairs, commitsObserved } = await _internals31.getCoChangeData(directory);
21615
21615
  const isGitProject = (() => {
21616
21616
  try {
21617
- return _internals30.isGitRepo(directory);
21617
+ return _internals31.isGitRepo(directory);
21618
21618
  } catch {
21619
21619
  return false;
21620
21620
  }
21621
21621
  })();
21622
- const verdict = _internals30.decideEpicActivation(tasks, pairs, commitsObserved, {
21622
+ const verdict = _internals31.decideEpicActivation(tasks, pairs, commitsObserved, {
21623
21623
  activationThreshold,
21624
21624
  minCommitsForSignal,
21625
21625
  cochangeNpmiThreshold,
@@ -21663,7 +21663,7 @@ function formatVerdict(verdict) {
21663
21663
  }
21664
21664
 
21665
21665
  // src/services/evidence-service.ts
21666
- var _internals31 = {
21666
+ var _internals32 = {
21667
21667
  loadEvidence,
21668
21668
  listEvidenceTaskIds
21669
21669
  };
@@ -21708,7 +21708,7 @@ function getVerdictEmoji(verdict) {
21708
21708
  return getVerdictIcon(verdict);
21709
21709
  }
21710
21710
  async function getTaskEvidenceData(directory, taskId) {
21711
- const result = await _internals31.loadEvidence(directory, taskId);
21711
+ const result = await _internals32.loadEvidence(directory, taskId);
21712
21712
  if (result.status !== "found") {
21713
21713
  return {
21714
21714
  hasEvidence: false,
@@ -21731,13 +21731,13 @@ async function getTaskEvidenceData(directory, taskId) {
21731
21731
  };
21732
21732
  }
21733
21733
  async function getEvidenceListData(directory) {
21734
- const taskIds = await _internals31.listEvidenceTaskIds(directory);
21734
+ const taskIds = await _internals32.listEvidenceTaskIds(directory);
21735
21735
  if (taskIds.length === 0) {
21736
21736
  return { hasEvidence: false, tasks: [] };
21737
21737
  }
21738
21738
  const tasks = [];
21739
21739
  for (const taskId of taskIds) {
21740
- const result = await _internals31.loadEvidence(directory, taskId);
21740
+ const result = await _internals32.loadEvidence(directory, taskId);
21741
21741
  if (result.status === "found") {
21742
21742
  tasks.push({
21743
21743
  taskId,
@@ -22632,7 +22632,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
22632
22632
  const strippedMutated = stripCode(mutatedCode);
22633
22633
  return strippedOriginal === strippedMutated;
22634
22634
  }
22635
- var _internals32 = {
22635
+ var _internals33 = {
22636
22636
  isStaticallyEquivalent,
22637
22637
  checkEquivalence,
22638
22638
  batchCheckEquivalence
@@ -22672,7 +22672,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
22672
22672
  const results = [];
22673
22673
  for (const { patch, originalCode, mutatedCode } of patches) {
22674
22674
  try {
22675
- const result = await _internals32.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
22675
+ const result = await _internals33.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
22676
22676
  results.push(result);
22677
22677
  } catch (err) {
22678
22678
  results.push({
@@ -22746,10 +22746,10 @@ function isMissingExecutableFailure(message) {
22746
22746
  return /\bENOENT\b/i.test(message) || /\bexecutable\b[^\r\n]*\bnot found\b/i.test(message) || /\bnot found in (?:the )?\$?PATH\b/i.test(message);
22747
22747
  }
22748
22748
  var runMutationCommand = async (args) => {
22749
- const resolvedExecutable = _internals33.resolveExecutableFromPath([
22749
+ const resolvedExecutable = _internals34.resolveExecutableFromPath([
22750
22750
  args.executable
22751
22751
  ]);
22752
- const result = await _internals33.runExternalTool({
22752
+ const result = await _internals34.runExternalTool({
22753
22753
  executable: resolvedExecutable ?? args.executable,
22754
22754
  args: args.args,
22755
22755
  cwd: args.cwd,
@@ -22768,7 +22768,7 @@ var runMutationCommand = async (args) => {
22768
22768
  };
22769
22769
  var runLegacyTestSeam = async (args) => {
22770
22770
  try {
22771
- const result = _internals33.spawnSync(args.executable, args.args, {
22771
+ const result = _internals34.spawnSync(args.executable, args.args, {
22772
22772
  cwd: args.cwd,
22773
22773
  timeout: args.timeoutMs,
22774
22774
  stdio: "pipe"
@@ -22802,11 +22802,11 @@ var runLegacyTestSeam = async (args) => {
22802
22802
  function selectRunner(options) {
22803
22803
  if (options.runner)
22804
22804
  return options.runner;
22805
- if (_internals33.spawnSync !== defaultLegacySpawnSync)
22805
+ if (_internals34.spawnSync !== defaultLegacySpawnSync)
22806
22806
  return runLegacyTestSeam;
22807
- return _internals33.runCommand;
22807
+ return _internals34.runCommand;
22808
22808
  }
22809
- var _internals33 = {
22809
+ var _internals34 = {
22810
22810
  executeMutation,
22811
22811
  computeReport,
22812
22812
  executeMutationSuite,
@@ -24047,11 +24047,11 @@ var quality_budget = createSwarmTool({
24047
24047
  }).optional().describe("Quality budget thresholds")
24048
24048
  },
24049
24049
  async execute(args, directory) {
24050
- const result = await _internals34.qualityBudget(args, directory);
24050
+ const result = await _internals35.qualityBudget(args, directory);
24051
24051
  return JSON.stringify(result);
24052
24052
  }
24053
24053
  });
24054
- var _internals34 = {
24054
+ var _internals35 = {
24055
24055
  qualityBudget
24056
24056
  };
24057
24057
 
@@ -24919,7 +24919,7 @@ var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
24919
24919
  var DEFAULT_TIMEOUT_MS = 30000;
24920
24920
  var MAX_OUTPUT_BYTES = 10 * 1024 * 1024;
24921
24921
  var KILL_GRACE_MS = 2000;
24922
- var _internals35 = {
24922
+ var _internals36 = {
24923
24923
  isSemgrepAvailable,
24924
24924
  checkSemgrepAvailable,
24925
24925
  resetSemgrepCache,
@@ -24945,7 +24945,7 @@ function isSemgrepAvailable() {
24945
24945
  }
24946
24946
  }
24947
24947
  async function checkSemgrepAvailable() {
24948
- return _internals35.isSemgrepAvailable();
24948
+ return _internals36.isSemgrepAvailable();
24949
24949
  }
24950
24950
  function resetSemgrepCache() {
24951
24951
  semgrepAvailableCache = null;
@@ -25132,12 +25132,12 @@ async function runSemgrep(options) {
25132
25132
  const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS;
25133
25133
  if (files.length === 0) {
25134
25134
  return {
25135
- available: _internals35.isSemgrepAvailable(),
25135
+ available: _internals36.isSemgrepAvailable(),
25136
25136
  findings: [],
25137
25137
  engine: "tier_a"
25138
25138
  };
25139
25139
  }
25140
- if (!_internals35.isSemgrepAvailable()) {
25140
+ if (!_internals36.isSemgrepAvailable()) {
25141
25141
  return {
25142
25142
  available: false,
25143
25143
  findings: [],
@@ -25299,7 +25299,7 @@ function assignOccurrenceIndices(findings, directory) {
25299
25299
  }
25300
25300
  const occIdx = countMap.get(baseKey) ?? 0;
25301
25301
  countMap.set(baseKey, occIdx + 1);
25302
- const fp = _internals36.fingerprintFinding(finding, directory, occIdx);
25302
+ const fp = _internals37.fingerprintFinding(finding, directory, occIdx);
25303
25303
  return {
25304
25304
  finding,
25305
25305
  index: occIdx,
@@ -25368,7 +25368,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
25368
25368
  }
25369
25369
  } catch {}
25370
25370
  const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
25371
- const indexed = _internals36.assignOccurrenceIndices(findings, directory);
25371
+ const indexed = _internals37.assignOccurrenceIndices(findings, directory);
25372
25372
  if (existing && !opts?.force) {
25373
25373
  const prunedFingerprints = existing.fingerprints.filter((fp) => {
25374
25374
  const relFile = fp.slice(0, fp.indexOf("|"));
@@ -25508,7 +25508,7 @@ function loadBaseline(directory, phase) {
25508
25508
  };
25509
25509
  }
25510
25510
  }
25511
- var _internals36 = {
25511
+ var _internals37 = {
25512
25512
  fingerprintFinding,
25513
25513
  assignOccurrenceIndices,
25514
25514
  captureOrMergeBaseline,
@@ -25622,7 +25622,7 @@ async function sastScan(input, directory, config) {
25622
25622
  let filesScanned = 0;
25623
25623
  let _filesSkipped = 0;
25624
25624
  const scannedFilePaths = [];
25625
- const semgrepAvailable = !offline_only && _internals37.isSemgrepAvailable();
25625
+ const semgrepAvailable = !offline_only && _internals38.isSemgrepAvailable();
25626
25626
  const engine = semgrepAvailable ? "tier_a+tier_b" : "tier_a";
25627
25627
  const filesByLanguage = new Map;
25628
25628
  for (const filePath of changed_files) {
@@ -25685,13 +25685,13 @@ async function sastScan(input, directory, config) {
25685
25685
  let semgrepResult;
25686
25686
  if (bucketKey.startsWith("auto:")) {
25687
25687
  const lang = bucketKey.slice("auto:".length);
25688
- semgrepResult = await _internals37.runSemgrep({
25688
+ semgrepResult = await _internals38.runSemgrep({
25689
25689
  files: bucketFiles,
25690
25690
  lang,
25691
25691
  useAutoConfig: true
25692
25692
  });
25693
25693
  } else {
25694
- semgrepResult = await _internals37.runSemgrep({
25694
+ semgrepResult = await _internals38.runSemgrep({
25695
25695
  files: bucketFiles
25696
25696
  });
25697
25697
  }
@@ -25933,11 +25933,11 @@ var sast_scan = createSwarmTool({
25933
25933
  capture_baseline: safeArgs.capture_baseline,
25934
25934
  phase: safeArgs.phase
25935
25935
  };
25936
- const result = await _internals37.sastScan(input, directory);
25936
+ const result = await _internals38.sastScan(input, directory);
25937
25937
  return JSON.stringify(result, null, 2);
25938
25938
  }
25939
25939
  });
25940
- var _internals37 = {
25940
+ var _internals38 = {
25941
25941
  sastScan,
25942
25942
  sast_scan,
25943
25943
  isSemgrepAvailable: () => isSemgrepAvailable(),
@@ -25969,10 +25969,10 @@ class DisposableWorktreeCleanupError extends Error {
25969
25969
  }
25970
25970
  }
25971
25971
  async function git(projectRoot, args, abortSignal) {
25972
- const executable = _internals38.resolveExecutableFromPath(["git"]);
25972
+ const executable = _internals39.resolveExecutableFromPath(["git"]);
25973
25973
  if (!executable)
25974
25974
  throw new Error("git executable not found");
25975
- const result = await _internals38.runExternalTool({
25975
+ const result = await _internals39.runExternalTool({
25976
25976
  executable,
25977
25977
  args: ["-C", projectRoot, ...args],
25978
25978
  cwd: projectRoot,
@@ -26008,7 +26008,7 @@ async function createDisposableWorktree(projectRoot, baseRef, abortSignal) {
26008
26008
  if (!/^[A-Fa-f0-9]{40,64}$/.test(baseRef)) {
26009
26009
  throw new Error("Evaluation baseRef must be a full commit hash");
26010
26010
  }
26011
- const parent = path49.join(_internals38.tmpdir(), WORKTREE_PARENT);
26011
+ const parent = path49.join(_internals39.tmpdir(), WORKTREE_PARENT);
26012
26012
  fs22.mkdirSync(parent, { recursive: true });
26013
26013
  const canonicalParent = fs22.realpathSync(parent);
26014
26014
  const worktreePath = path49.join(canonicalParent, crypto4.randomUUID());
@@ -26017,7 +26017,7 @@ async function createDisposableWorktree(projectRoot, baseRef, abortSignal) {
26017
26017
  }
26018
26018
  async function removeDisposableWorktree(projectRoot, worktreePath) {
26019
26019
  const canonicalRoot = fs22.realpathSync(projectRoot);
26020
- const expectedParent = fs22.realpathSync(path49.join(_internals38.tmpdir(), WORKTREE_PARENT));
26020
+ const expectedParent = fs22.realpathSync(path49.join(_internals39.tmpdir(), WORKTREE_PARENT));
26021
26021
  const resolved = path49.resolve(worktreePath);
26022
26022
  const relative7 = path49.relative(expectedParent, resolved);
26023
26023
  if (!relative7 || relative7 === ".." || relative7.startsWith(`..${path49.sep}`) || path49.isAbsolute(relative7)) {
@@ -26030,7 +26030,7 @@ async function removeDisposableWorktree(projectRoot, worktreePath) {
26030
26030
  cleanupErrors.push(`git-remove: ${error2 instanceof Error ? error2.message : String(error2)}`);
26031
26031
  }
26032
26032
  try {
26033
- _internals38.rmSync(resolved, { recursive: true, force: true });
26033
+ _internals39.rmSync(resolved, { recursive: true, force: true });
26034
26034
  } catch (error2) {
26035
26035
  cleanupErrors.push(`filesystem-remove: ${error2 instanceof Error ? error2.message : String(error2)}`);
26036
26036
  }
@@ -26039,7 +26039,7 @@ async function removeDisposableWorktree(projectRoot, worktreePath) {
26039
26039
  } catch (error2) {
26040
26040
  cleanupErrors.push(`git-prune: ${error2 instanceof Error ? error2.message : String(error2)}`);
26041
26041
  }
26042
- const pathPresent = _internals38.existsSync(resolved);
26042
+ const pathPresent = _internals39.existsSync(resolved);
26043
26043
  let registrationPresent;
26044
26044
  try {
26045
26045
  const listed = await git(canonicalRoot, [
@@ -26061,7 +26061,7 @@ function normalizeWorktreePath(value) {
26061
26061
  const resolved = path49.resolve(value);
26062
26062
  return process.platform === "win32" ? resolved.toLowerCase() : resolved;
26063
26063
  }
26064
- var _internals38 = {
26064
+ var _internals39 = {
26065
26065
  runExternalTool,
26066
26066
  resolveExecutableFromPath,
26067
26067
  tmpdir: os7.tmpdir,
@@ -26895,7 +26895,7 @@ function extractCurrentPhaseFromPlan(plan) {
26895
26895
  if (!plan) {
26896
26896
  return { currentPhase: null, currentTask: null, incompleteTasks: [] };
26897
26897
  }
26898
- if (!_internals39.validatePlanPhases(plan)) {
26898
+ if (!_internals40.validatePlanPhases(plan)) {
26899
26899
  return { currentPhase: null, currentTask: null, incompleteTasks: [] };
26900
26900
  }
26901
26901
  let currentPhase = null;
@@ -27037,9 +27037,9 @@ function extractPhaseMetrics(content) {
27037
27037
  async function getHandoffData(directory) {
27038
27038
  const now = new Date().toISOString();
27039
27039
  const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
27040
- const sessionState = _internals39.parseSessionState(sessionContent);
27040
+ const sessionState = _internals40.parseSessionState(sessionContent);
27041
27041
  const plan = await loadPlanJsonOnly(directory);
27042
- const planInfo = _internals39.extractCurrentPhaseFromPlan(plan);
27042
+ const planInfo = _internals40.extractCurrentPhaseFromPlan(plan);
27043
27043
  if (!plan) {
27044
27044
  const planMdContent = await readSwarmFileAsync(directory, "plan.md");
27045
27045
  if (planMdContent) {
@@ -27058,8 +27058,8 @@ async function getHandoffData(directory) {
27058
27058
  }
27059
27059
  }
27060
27060
  const contextContent = await readSwarmFileAsync(directory, "context.md");
27061
- const recentDecisions = _internals39.extractDecisions(contextContent);
27062
- const rawPhaseMetrics = _internals39.extractPhaseMetrics(contextContent);
27061
+ const recentDecisions = _internals40.extractDecisions(contextContent);
27062
+ const rawPhaseMetrics = _internals40.extractPhaseMetrics(contextContent);
27063
27063
  const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
27064
27064
  let delegationState = null;
27065
27065
  if (sessionState?.delegationState) {
@@ -27223,7 +27223,7 @@ ${lines.join(`
27223
27223
  `)}
27224
27224
  \`\`\``;
27225
27225
  }
27226
- var _internals39 = {
27226
+ var _internals40 = {
27227
27227
  getHandoffData,
27228
27228
  formatHandoffMarkdown,
27229
27229
  formatContinuationPrompt,
@@ -27372,15 +27372,15 @@ async function writeSnapshot(directory, state) {
27372
27372
  }
27373
27373
  function createSnapshotWriterHook(directory) {
27374
27374
  return (_input, _output) => {
27375
- _writeInFlight = _writeInFlight.then(() => _internals40.writeSnapshot(directory, swarmState), () => _internals40.writeSnapshot(directory, swarmState));
27375
+ _writeInFlight = _writeInFlight.then(() => _internals41.writeSnapshot(directory, swarmState), () => _internals41.writeSnapshot(directory, swarmState));
27376
27376
  return _writeInFlight;
27377
27377
  };
27378
27378
  }
27379
27379
  async function flushPendingSnapshot(directory) {
27380
- _writeInFlight = _writeInFlight.then(() => _internals40.writeSnapshot(directory, swarmState), () => _internals40.writeSnapshot(directory, swarmState));
27380
+ _writeInFlight = _writeInFlight.then(() => _internals41.writeSnapshot(directory, swarmState), () => _internals41.writeSnapshot(directory, swarmState));
27381
27381
  await _writeInFlight;
27382
27382
  }
27383
- var _internals40 = {
27383
+ var _internals41 = {
27384
27384
  writeSnapshot,
27385
27385
  createSnapshotWriterHook,
27386
27386
  flushPendingSnapshot
@@ -27665,7 +27665,7 @@ function parseIssueRef(input, directory) {
27665
27665
  }
27666
27666
  return null;
27667
27667
  }
27668
- var _internals41 = {
27668
+ var _internals42 = {
27669
27669
  writeFileSync: fs24.writeFileSync,
27670
27670
  mkdirSync: fs24.mkdirSync,
27671
27671
  renameSync: fs24.renameSync,
@@ -27676,18 +27676,18 @@ var _internals41 = {
27676
27676
  function atomicWriteFileSync(dir, filename, content) {
27677
27677
  const tmpPath = path53.join(dir, `.tmp-${filename}-${Date.now()}-${process.pid}`);
27678
27678
  const finalPath = path53.join(dir, filename);
27679
- _internals41.writeFileSync(tmpPath, content, "utf-8");
27679
+ _internals42.writeFileSync(tmpPath, content, "utf-8");
27680
27680
  try {
27681
- _internals41.renameSync(tmpPath, finalPath);
27681
+ _internals42.renameSync(tmpPath, finalPath);
27682
27682
  } catch {
27683
27683
  try {
27684
- _internals41.unlinkSync(finalPath);
27684
+ _internals42.unlinkSync(finalPath);
27685
27685
  } catch {}
27686
27686
  try {
27687
- _internals41.renameSync(tmpPath, finalPath);
27687
+ _internals42.renameSync(tmpPath, finalPath);
27688
27688
  } catch (retryErr) {
27689
27689
  try {
27690
- _internals41.unlinkSync(tmpPath);
27690
+ _internals42.unlinkSync(tmpPath);
27691
27691
  } catch {}
27692
27692
  throw retryErr;
27693
27693
  }
@@ -27740,10 +27740,10 @@ ${USAGE7}`;
27740
27740
  };
27741
27741
  let oldTraceState = null;
27742
27742
  try {
27743
- oldTraceState = _internals41.readFileSync(path53.join(swarmDir, "issue-trace-state.json"), "utf-8");
27743
+ oldTraceState = _internals42.readFileSync(path53.join(swarmDir, "issue-trace-state.json"), "utf-8");
27744
27744
  } catch {}
27745
27745
  try {
27746
- _internals41.mkdirSync(swarmDir, { recursive: true });
27746
+ _internals42.mkdirSync(swarmDir, { recursive: true });
27747
27747
  atomicWriteFileSync(swarmDir, "issue-trace-state.json", JSON.stringify(traceState, null, 2));
27748
27748
  atomicWriteFileSync(swarmDir, "issue-reference.json", JSON.stringify(issueReference, null, 2));
27749
27749
  } catch (e) {
@@ -27753,11 +27753,11 @@ ${USAGE7}`;
27753
27753
  } catch {}
27754
27754
  } else {
27755
27755
  try {
27756
- _internals41.unlinkSync(path53.join(swarmDir, "issue-trace-state.json"));
27756
+ _internals42.unlinkSync(path53.join(swarmDir, "issue-trace-state.json"));
27757
27757
  } catch {}
27758
27758
  }
27759
27759
  try {
27760
- _internals41.unlinkSync(path53.join(swarmDir, "issue-reference.json"));
27760
+ _internals42.unlinkSync(path53.join(swarmDir, "issue-reference.json"));
27761
27761
  } catch {}
27762
27762
  const errMsg = e instanceof Error ? e.message : String(e);
27763
27763
  return `Error: Failed to persist issue reference durably: ${errMsg}
@@ -27788,7 +27788,7 @@ import * as path54 from "path";
27788
27788
  async function migrateKnowledgeToExternal(_directory, _config) {
27789
27789
  const externalSentinelPath = path54.join(_directory, ".swarm", ".knowledge-external-migrated");
27790
27790
  const contextPath = path54.join(_directory, ".swarm", "context.md");
27791
- if (_internals42.existsSync(externalSentinelPath)) {
27791
+ if (_internals43.existsSync(externalSentinelPath)) {
27792
27792
  return {
27793
27793
  migrated: false,
27794
27794
  entriesMigrated: 0,
@@ -27797,7 +27797,7 @@ async function migrateKnowledgeToExternal(_directory, _config) {
27797
27797
  skippedReason: "external-sentinel-exists"
27798
27798
  };
27799
27799
  }
27800
- if (!_internals42.existsSync(contextPath)) {
27800
+ if (!_internals43.existsSync(contextPath)) {
27801
27801
  return {
27802
27802
  migrated: false,
27803
27803
  entriesMigrated: 0,
@@ -27806,7 +27806,7 @@ async function migrateKnowledgeToExternal(_directory, _config) {
27806
27806
  skippedReason: "no-context-file"
27807
27807
  };
27808
27808
  }
27809
- const contextContent = await _internals42.readFile(contextPath, "utf-8");
27809
+ const contextContent = await _internals43.readFile(contextPath, "utf-8");
27810
27810
  if (contextContent.trim().length === 0) {
27811
27811
  return {
27812
27812
  migrated: false,
@@ -27824,7 +27824,7 @@ async function migrateKnowledgeToExternal(_directory, _config) {
27824
27824
  entriesCount++;
27825
27825
  }
27826
27826
  }
27827
- await _internals42.writeSentinel(externalSentinelPath, entriesCount, entriesCount);
27827
+ await _internals43.writeSentinel(externalSentinelPath, entriesCount, entriesCount);
27828
27828
  return {
27829
27829
  migrated: true,
27830
27830
  entriesMigrated: entriesCount,
@@ -27832,7 +27832,7 @@ async function migrateKnowledgeToExternal(_directory, _config) {
27832
27832
  entriesTotal: entriesCount
27833
27833
  };
27834
27834
  }
27835
- var _internals42 = {
27835
+ var _internals43 = {
27836
27836
  appendKnowledge,
27837
27837
  migrateContextToKnowledge,
27838
27838
  migrateKnowledgeToExternal,
@@ -27883,9 +27883,9 @@ async function migrateContextToKnowledge(directory, config) {
27883
27883
  skippedReason: "empty-context"
27884
27884
  };
27885
27885
  }
27886
- const rawEntries = _internals42.parseContextMd(contextContent);
27886
+ const rawEntries = _internals43.parseContextMd(contextContent);
27887
27887
  if (rawEntries.length === 0) {
27888
- await _internals42.writeSentinel(sentinelPath, 0, 0);
27888
+ await _internals43.writeSentinel(sentinelPath, 0, 0);
27889
27889
  return {
27890
27890
  migrated: true,
27891
27891
  entriesMigrated: 0,
@@ -27896,10 +27896,10 @@ async function migrateContextToKnowledge(directory, config) {
27896
27896
  const existing = await readKnowledge(knowledgePath);
27897
27897
  let migrated = 0;
27898
27898
  let dropped = 0;
27899
- const projectName = _internals42.inferProjectName(directory);
27899
+ const projectName = _internals43.inferProjectName(directory);
27900
27900
  for (const raw of rawEntries) {
27901
27901
  if (config.validation_enabled !== false) {
27902
- const category = raw.categoryHint ?? _internals42.inferCategoryFromText(raw.text);
27902
+ const category = raw.categoryHint ?? _internals43.inferCategoryFromText(raw.text);
27903
27903
  const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
27904
27904
  category,
27905
27905
  scope: "global",
@@ -27919,8 +27919,8 @@ async function migrateContextToKnowledge(directory, config) {
27919
27919
  const entry = {
27920
27920
  id: randomUUID7(),
27921
27921
  tier: "swarm",
27922
- lesson: _internals42.truncateLesson(raw.text),
27923
- category: raw.categoryHint ?? _internals42.inferCategoryFromText(raw.text),
27922
+ lesson: _internals43.truncateLesson(raw.text),
27923
+ category: raw.categoryHint ?? _internals43.inferCategoryFromText(raw.text),
27924
27924
  tags: [...inferredTags, `migration:${raw.sourceSection}`],
27925
27925
  scope: "global",
27926
27926
  confidence: 0.3,
@@ -27943,7 +27943,7 @@ async function migrateContextToKnowledge(directory, config) {
27943
27943
  if (migrated > 0) {
27944
27944
  await rewriteKnowledge(knowledgePath, existing);
27945
27945
  }
27946
- await _internals42.writeSentinel(sentinelPath, migrated, dropped);
27946
+ await _internals43.writeSentinel(sentinelPath, migrated, dropped);
27947
27947
  log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
27948
27948
  return {
27949
27949
  migrated: true,
@@ -27953,7 +27953,7 @@ async function migrateContextToKnowledge(directory, config) {
27953
27953
  };
27954
27954
  }
27955
27955
  async function migrateHiveKnowledgeLegacy(config) {
27956
- const legacyHivePath = _internals42.resolveLegacyHiveKnowledgePath();
27956
+ const legacyHivePath = _internals43.resolveLegacyHiveKnowledgePath();
27957
27957
  const canonicalHivePath = resolveHiveKnowledgePath2();
27958
27958
  const sentinelPath = path54.join(path54.dirname(canonicalHivePath), ".hive-knowledge-migrated");
27959
27959
  if (existsSync32(sentinelPath)) {
@@ -27976,7 +27976,7 @@ async function migrateHiveKnowledgeLegacy(config) {
27976
27976
  }
27977
27977
  const legacyEntries = await readKnowledge(legacyHivePath);
27978
27978
  if (legacyEntries.length === 0) {
27979
- await _internals42.writeSentinel(sentinelPath, 0, 0);
27979
+ await _internals43.writeSentinel(sentinelPath, 0, 0);
27980
27980
  return {
27981
27981
  migrated: true,
27982
27982
  entriesMigrated: 0,
@@ -28024,7 +28024,7 @@ async function migrateHiveKnowledgeLegacy(config) {
28024
28024
  const newHiveEntry = {
28025
28025
  id: resolvedId,
28026
28026
  tier: "hive",
28027
- lesson: _internals42.truncateLesson(lesson),
28027
+ lesson: _internals43.truncateLesson(lesson),
28028
28028
  category,
28029
28029
  tags: ["migration:legacy-hive"],
28030
28030
  scope: scopeTag,
@@ -28043,7 +28043,7 @@ async function migrateHiveKnowledgeLegacy(config) {
28043
28043
  encounter_score: 1
28044
28044
  };
28045
28045
  try {
28046
- await _internals42.appendKnowledge(canonicalHivePath, newHiveEntry);
28046
+ await _internals43.appendKnowledge(canonicalHivePath, newHiveEntry);
28047
28047
  existingHiveEntries.push(newHiveEntry);
28048
28048
  migrated++;
28049
28049
  } catch (appendError) {
@@ -28059,7 +28059,7 @@ async function migrateHiveKnowledgeLegacy(config) {
28059
28059
  dropped++;
28060
28060
  }
28061
28061
  }
28062
- await _internals42.writeSentinel(sentinelPath, migrated, dropped);
28062
+ await _internals43.writeSentinel(sentinelPath, migrated, dropped);
28063
28063
  log(`[knowledge-migrator] Migrated ${migrated} legacy hive entries, dropped ${dropped}`);
28064
28064
  return {
28065
28065
  migrated: true,
@@ -28070,7 +28070,7 @@ async function migrateHiveKnowledgeLegacy(config) {
28070
28070
  };
28071
28071
  }
28072
28072
  function parseContextMd(content) {
28073
- const sections = _internals42.splitIntoSections(content);
28073
+ const sections = _internals43.splitIntoSections(content);
28074
28074
  const entries = [];
28075
28075
  const seen = new Set;
28076
28076
  const sectionPatterns = [
@@ -28086,7 +28086,7 @@ function parseContextMd(content) {
28086
28086
  const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
28087
28087
  if (!match)
28088
28088
  continue;
28089
- const bullets = _internals42.extractBullets(section.body);
28089
+ const bullets = _internals43.extractBullets(section.body);
28090
28090
  for (const bullet of bullets) {
28091
28091
  if (bullet.length < 15)
28092
28092
  continue;
@@ -28095,9 +28095,9 @@ function parseContextMd(content) {
28095
28095
  continue;
28096
28096
  seen.add(normalized);
28097
28097
  entries.push({
28098
- text: _internals42.truncateLesson(bullet),
28098
+ text: _internals43.truncateLesson(bullet),
28099
28099
  sourceSection: match.sourceSection,
28100
- categoryHint: _internals42.inferCategoryFromText(bullet)
28100
+ categoryHint: _internals43.inferCategoryFromText(bullet)
28101
28101
  });
28102
28102
  }
28103
28103
  }
@@ -28187,8 +28187,8 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
28187
28187
  schema_version: 1,
28188
28188
  migration_tool: "knowledge-migrator.ts"
28189
28189
  };
28190
- await _internals42.mkdir(path54.dirname(sentinelPath), { recursive: true });
28191
- await _internals42.writeFile(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
28190
+ await _internals43.mkdir(path54.dirname(sentinelPath), { recursive: true });
28191
+ await _internals43.writeFile(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
28192
28192
  }
28193
28193
  function resolveLegacyHiveKnowledgePath() {
28194
28194
  const platform = process.platform;
@@ -28600,7 +28600,7 @@ function timeoutMessage(timeoutMs) {
28600
28600
  async function computeWithTimeout(directory, currentPhase, timeoutMs) {
28601
28601
  const controller = new AbortController;
28602
28602
  let timeout;
28603
- const metricsPromise = _internals43.computeLearningMetrics(directory, {
28603
+ const metricsPromise = _internals44.computeLearningMetrics(directory, {
28604
28604
  currentPhase,
28605
28605
  signal: controller.signal
28606
28606
  });
@@ -28657,7 +28657,7 @@ ${JSON.stringify({
28657
28657
  return `Error computing learning metrics: ${message}. Run /swarm diagnose to check .swarm/ health.`;
28658
28658
  }
28659
28659
  }
28660
- var _internals43 = {
28660
+ var _internals44 = {
28661
28661
  computeLearningMetrics
28662
28662
  };
28663
28663
 
@@ -29279,7 +29279,7 @@ async function readLatestLoopState(directory) {
29279
29279
  return null;
29280
29280
  }
29281
29281
  }
29282
- var _internals44 = {
29282
+ var _internals45 = {
29283
29283
  readLatestLoopState
29284
29284
  };
29285
29285
  var USAGE8 = `Usage: /swarm loop <objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]
@@ -29392,7 +29392,7 @@ ${USAGE8}`;
29392
29392
  }
29393
29393
  let autonomy = parsed.autonomy;
29394
29394
  if (parsed.resume && !parsed.autonomyExplicit) {
29395
- const state = await _internals44.readLatestLoopState(_directory);
29395
+ const state = await _internals45.readLatestLoopState(_directory);
29396
29396
  if (state?.autonomy && AUTONOMY_LEVELS.has(state.autonomy)) {
29397
29397
  autonomy = state.autonomy;
29398
29398
  }
@@ -30328,15 +30328,15 @@ function truncate(value, maxLength) {
30328
30328
  }
30329
30329
 
30330
30330
  // src/services/plan-service.ts
30331
- var _internals45 = {
30331
+ var _internals46 = {
30332
30332
  loadPlanJsonOnly,
30333
30333
  derivePlanMarkdown,
30334
30334
  readSwarmFileAsync
30335
30335
  };
30336
30336
  async function getPlanData(directory, phaseArg) {
30337
- const plan = await _internals45.loadPlanJsonOnly(directory);
30337
+ const plan = await _internals46.loadPlanJsonOnly(directory);
30338
30338
  if (plan) {
30339
- const fullMarkdown = _internals45.derivePlanMarkdown(plan);
30339
+ const fullMarkdown = _internals46.derivePlanMarkdown(plan);
30340
30340
  if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
30341
30341
  return {
30342
30342
  hasPlan: true,
@@ -30379,7 +30379,7 @@ async function getPlanData(directory, phaseArg) {
30379
30379
  isLegacy: false
30380
30380
  };
30381
30381
  }
30382
- const planContent = await _internals45.readSwarmFileAsync(directory, "plan.md");
30382
+ const planContent = await _internals46.readSwarmFileAsync(directory, "plan.md");
30383
30383
  if (!planContent) {
30384
30384
  return {
30385
30385
  hasPlan: false,
@@ -30476,7 +30476,7 @@ async function handlePlanCommand(directory, args) {
30476
30476
  return formatPlanMarkdown(planData);
30477
30477
  }
30478
30478
  // src/commands/post-mortem.ts
30479
- var _internals46 = {
30479
+ var _internals47 = {
30480
30480
  createCuratorLLMDelegate,
30481
30481
  runCuratorPostMortem
30482
30482
  };
@@ -30524,10 +30524,10 @@ async function handlePostMortemCommand(directory, args, options) {
30524
30524
  };
30525
30525
  if (options?.sessionID) {
30526
30526
  try {
30527
- pmOptions.llmDelegate = _internals46.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
30527
+ pmOptions.llmDelegate = _internals47.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
30528
30528
  } catch {}
30529
30529
  }
30530
- const result = await _internals46.runCuratorPostMortem(directory, pmOptions);
30530
+ const result = await _internals47.runCuratorPostMortem(directory, pmOptions);
30531
30531
  const lines = [];
30532
30532
  if (result.success) {
30533
30533
  lines.push("## Post-Mortem Report Generated");
@@ -30684,7 +30684,7 @@ function formatMergeGroupStatus(status, conclusion, htmlUrl) {
30684
30684
  }
30685
30685
  return parts.join(" ");
30686
30686
  }
30687
- var _internals47 = {
30687
+ var _internals48 = {
30688
30688
  formatRelativeTime,
30689
30689
  formatMergeGroupStatus,
30690
30690
  listActive,
@@ -30692,7 +30692,7 @@ var _internals47 = {
30692
30692
  parseMergeGroupRuns
30693
30693
  };
30694
30694
  async function handlePrMonitorStatusCommand(directory, _args, sessionID, source) {
30695
- const allActive = await _internals47.listActive(directory);
30695
+ const allActive = await _internals48.listActive(directory);
30696
30696
  const allSessions = source === "cli";
30697
30697
  const subs = allSessions ? allActive : allActive.filter((record) => record.sessionID === sessionID);
30698
30698
  if (subs.length === 0) {
@@ -30708,7 +30708,7 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID, source)
30708
30708
  const index = i + 1;
30709
30709
  lines.push(` ${index}. ${sub.repoFullName}#${sub.prNumber}`);
30710
30710
  lines.push(` URL: ${sub.prUrl}`);
30711
- const mergeGroupRuns = await _internals47.listMergeGroupRuns(directory, sub.repoFullName, sub.prNumber);
30711
+ const mergeGroupRuns = await _internals48.listMergeGroupRuns(directory, sub.repoFullName, sub.prNumber);
30712
30712
  if (mergeGroupRuns.runs.length > 0) {
30713
30713
  lines.push(" Merge-group runs:");
30714
30714
  for (const run of mergeGroupRuns.runs) {
@@ -30848,7 +30848,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
30848
30848
  const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
30849
30849
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
30850
30850
  try {
30851
- const config = _internals48.loadPluginConfig(directory);
30851
+ const config = _internals49.loadPluginConfig(directory);
30852
30852
  const prMonitorConfig = config.pr_monitor;
30853
30853
  if (!prMonitorConfig?.enabled) {
30854
30854
  return [
@@ -30858,7 +30858,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
30858
30858
  ].join(`
30859
30859
  `);
30860
30860
  }
30861
- await _internals48.subscribe(directory, {
30861
+ await _internals49.subscribe(directory, {
30862
30862
  sessionID,
30863
30863
  prNumber: prInfo.number,
30864
30864
  repoFullName,
@@ -30886,7 +30886,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
30886
30886
  `);
30887
30887
  }
30888
30888
  }
30889
- var _internals48 = {
30889
+ var _internals49 = {
30890
30890
  loadPluginConfig,
30891
30891
  subscribe
30892
30892
  };
@@ -30909,9 +30909,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
30909
30909
  `);
30910
30910
  }
30911
30911
  const refToken = rest[0];
30912
- const prInfo = _internals49.parsePrRef(refToken, directory);
30912
+ const prInfo = _internals50.parsePrRef(refToken, directory);
30913
30913
  if (!prInfo) {
30914
- if (_internals49.looksLikePrRef(refToken)) {
30914
+ if (_internals50.looksLikePrRef(refToken)) {
30915
30915
  return [
30916
30916
  `Error: Could not resolve PR reference from "${refToken}".`,
30917
30917
  "",
@@ -30932,8 +30932,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
30932
30932
  const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
30933
30933
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
30934
30934
  try {
30935
- const correlationId = _internals49.buildCorrelationId(sessionID, repoFullName, prInfo.number);
30936
- const result = await _internals49.unsubscribe(directory, correlationId);
30935
+ const correlationId = _internals50.buildCorrelationId(sessionID, repoFullName, prInfo.number);
30936
+ const result = await _internals50.unsubscribe(directory, correlationId);
30937
30937
  if (!result) {
30938
30938
  return [
30939
30939
  `Not subscribed to ${prUrl}`,
@@ -30960,7 +30960,7 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
30960
30960
  `);
30961
30961
  }
30962
30962
  }
30963
- var _internals49 = {
30963
+ var _internals50 = {
30964
30964
  unsubscribe,
30965
30965
  buildCorrelationId,
30966
30966
  parsePrRef,
@@ -31442,15 +31442,15 @@ var lint = createSwarmTool({
31442
31442
  }
31443
31443
  const { mode } = args;
31444
31444
  const cwd = directory;
31445
- const linter = await _internals50.detectAvailableLinter(directory);
31445
+ const linter = await _internals51.detectAvailableLinter(directory);
31446
31446
  if (linter) {
31447
- const result = await _internals50.runLint(linter, mode, directory);
31447
+ const result = await _internals51.runLint(linter, mode, directory);
31448
31448
  return JSON.stringify(result, null, 2);
31449
31449
  }
31450
- const additionalLinter = _internals50.detectAdditionalLinter(cwd);
31450
+ const additionalLinter = _internals51.detectAdditionalLinter(cwd);
31451
31451
  if (additionalLinter) {
31452
31452
  warn(`[lint] Using ${additionalLinter} linter for this project`);
31453
- const result = await _internals50.runAdditionalLint(additionalLinter, mode, cwd);
31453
+ const result = await _internals51.runAdditionalLint(additionalLinter, mode, cwd);
31454
31454
  return JSON.stringify(result, null, 2);
31455
31455
  }
31456
31456
  const errorResult = {
@@ -31464,7 +31464,7 @@ For Rust: rustup component add clippy`
31464
31464
  return JSON.stringify(errorResult, null, 2);
31465
31465
  }
31466
31466
  });
31467
- var _internals50 = {
31467
+ var _internals51 = {
31468
31468
  detectAvailableLinter,
31469
31469
  runLint,
31470
31470
  detectAdditionalLinter,
@@ -32152,7 +32152,7 @@ var secretscan = createSwarmTool({
32152
32152
  });
32153
32153
  async function runSecretscan(directory) {
32154
32154
  try {
32155
- const result = await _internals51.secretscan.execute({ directory }, {});
32155
+ const result = await _internals52.secretscan.execute({ directory }, {});
32156
32156
  const jsonStr = typeof result === "string" ? result : result.output;
32157
32157
  return JSON.parse(jsonStr);
32158
32158
  } catch (e) {
@@ -32224,7 +32224,7 @@ async function runSecretscanOnFiles(files, directory) {
32224
32224
  };
32225
32225
  }
32226
32226
  }
32227
- var _internals51 = {
32227
+ var _internals52 = {
32228
32228
  secretscan,
32229
32229
  runSecretscan,
32230
32230
  runSecretscanOnFiles,
@@ -32500,7 +32500,7 @@ async function buildImpactMapInternal(cwd) {
32500
32500
  }
32501
32501
  return impactMap;
32502
32502
  }
32503
- var _internals52 = {
32503
+ var _internals53 = {
32504
32504
  validateProjectRoot,
32505
32505
  normalizePath: normalizePath2,
32506
32506
  isCacheStale,
@@ -32515,8 +32515,8 @@ var _internals52 = {
32515
32515
  _clearGoModuleCache
32516
32516
  };
32517
32517
  async function buildImpactMap(cwd) {
32518
- const impactMap = await _internals52.buildImpactMapInternal(cwd);
32519
- await _internals52.saveImpactMap(cwd, impactMap);
32518
+ const impactMap = await _internals53.buildImpactMapInternal(cwd);
32519
+ await _internals53.saveImpactMap(cwd, impactMap);
32520
32520
  return impactMap;
32521
32521
  }
32522
32522
  async function loadImpactMap(cwd, options) {
@@ -32530,7 +32530,7 @@ async function loadImpactMap(cwd, options) {
32530
32530
  const hasValidValues = Object.values(map).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
32531
32531
  if (hasValidValues) {
32532
32532
  const generatedAt = new Date(data.generatedAt).getTime();
32533
- if (!_internals52.isCacheStale(map, generatedAt)) {
32533
+ if (!_internals53.isCacheStale(map, generatedAt)) {
32534
32534
  return map;
32535
32535
  }
32536
32536
  if (options?.skipRebuild) {
@@ -32550,13 +32550,13 @@ async function loadImpactMap(cwd, options) {
32550
32550
  if (options?.skipRebuild) {
32551
32551
  return {};
32552
32552
  }
32553
- return _internals52.buildImpactMap(cwd);
32553
+ return _internals53.buildImpactMap(cwd);
32554
32554
  }
32555
32555
  async function saveImpactMap(cwd, impactMap) {
32556
32556
  if (!path62.isAbsolute(cwd)) {
32557
32557
  throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
32558
32558
  }
32559
- _internals52.validateProjectRoot(cwd);
32559
+ _internals53.validateProjectRoot(cwd);
32560
32560
  const cacheDir2 = path62.join(cwd, ".swarm", "cache");
32561
32561
  const cachePath = path62.join(cacheDir2, "impact-map.json");
32562
32562
  if (!fs28.existsSync(cacheDir2)) {
@@ -32580,7 +32580,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
32580
32580
  };
32581
32581
  }
32582
32582
  const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
32583
- const impactMap = await _internals52.loadImpactMap(cwd);
32583
+ const impactMap = await _internals53.loadImpactMap(cwd);
32584
32584
  const impactedTestsSet = new Set;
32585
32585
  const untestedFiles = [];
32586
32586
  let visitedCount = 0;
@@ -32857,7 +32857,7 @@ function batchAppendTestRuns(records, workingDir) {
32857
32857
  }
32858
32858
  const historyPath = getHistoryPath(workingDir);
32859
32859
  const historyDir = path63.dirname(historyPath);
32860
- _internals53.validateProjectRoot(workingDir);
32860
+ _internals54.validateProjectRoot(workingDir);
32861
32861
  if (!fs29.existsSync(historyDir)) {
32862
32862
  fs29.mkdirSync(historyDir, { recursive: true });
32863
32863
  }
@@ -32980,7 +32980,7 @@ function getAllHistory(workingDir) {
32980
32980
  records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
32981
32981
  return records;
32982
32982
  }
32983
- var _internals53 = {
32983
+ var _internals54 = {
32984
32984
  validateProjectRoot
32985
32985
  };
32986
32986
 
@@ -34957,9 +34957,9 @@ function getVersionFileVersion(dir) {
34957
34957
  async function runVersionCheck(dir, _timeoutMs) {
34958
34958
  const startTime = Date.now();
34959
34959
  try {
34960
- const packageVersion = _internals54.getPackageVersion(dir);
34961
- const changelogVersion = _internals54.getChangelogVersion(dir);
34962
- const versionFileVersion = _internals54.getVersionFileVersion(dir);
34960
+ const packageVersion = _internals55.getPackageVersion(dir);
34961
+ const changelogVersion = _internals55.getChangelogVersion(dir);
34962
+ const versionFileVersion = _internals55.getVersionFileVersion(dir);
34963
34963
  const versions = [];
34964
34964
  if (packageVersion)
34965
34965
  versions.push(`package.json: ${packageVersion}`);
@@ -35323,7 +35323,7 @@ async function runPreflight(dir, phase, config) {
35323
35323
  const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
35324
35324
  let validatedDir;
35325
35325
  try {
35326
- validatedDir = _internals54.validateDirectoryPath(dir);
35326
+ validatedDir = _internals55.validateDirectoryPath(dir);
35327
35327
  } catch (error2) {
35328
35328
  return {
35329
35329
  id: reportId,
@@ -35343,7 +35343,7 @@ async function runPreflight(dir, phase, config) {
35343
35343
  }
35344
35344
  let validatedTimeout;
35345
35345
  try {
35346
- validatedTimeout = _internals54.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
35346
+ validatedTimeout = _internals55.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
35347
35347
  } catch (error2) {
35348
35348
  return {
35349
35349
  id: reportId,
@@ -35384,12 +35384,12 @@ async function runPreflight(dir, phase, config) {
35384
35384
  });
35385
35385
  const checks = [];
35386
35386
  log("[Preflight] Running lint check...");
35387
- const lintResult = await _internals54.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
35387
+ const lintResult = await _internals55.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
35388
35388
  checks.push(lintResult);
35389
35389
  log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
35390
35390
  if (!cfg.skipTests) {
35391
35391
  log("[Preflight] Running tests check...");
35392
- const testsResult = await _internals54.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
35392
+ const testsResult = await _internals55.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
35393
35393
  checks.push(testsResult);
35394
35394
  log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
35395
35395
  } else {
@@ -35401,7 +35401,7 @@ async function runPreflight(dir, phase, config) {
35401
35401
  }
35402
35402
  if (!cfg.skipSecrets) {
35403
35403
  log("[Preflight] Running secrets check...");
35404
- const secretsResult = await _internals54.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
35404
+ const secretsResult = await _internals55.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
35405
35405
  checks.push(secretsResult);
35406
35406
  log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
35407
35407
  } else {
@@ -35413,7 +35413,7 @@ async function runPreflight(dir, phase, config) {
35413
35413
  }
35414
35414
  if (!cfg.skipEvidence) {
35415
35415
  log("[Preflight] Running evidence check...");
35416
- const evidenceResult = await _internals54.runEvidenceCheck(validatedDir);
35416
+ const evidenceResult = await _internals55.runEvidenceCheck(validatedDir);
35417
35417
  checks.push(evidenceResult);
35418
35418
  log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
35419
35419
  } else {
@@ -35424,12 +35424,12 @@ async function runPreflight(dir, phase, config) {
35424
35424
  });
35425
35425
  }
35426
35426
  log("[Preflight] Running requirement coverage check...");
35427
- const reqCoverageResult = await _internals54.runRequirementCoverageCheck(validatedDir, phase);
35427
+ const reqCoverageResult = await _internals55.runRequirementCoverageCheck(validatedDir, phase);
35428
35428
  checks.push(reqCoverageResult);
35429
35429
  log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
35430
35430
  if (!cfg.skipVersion) {
35431
35431
  log("[Preflight] Running version check...");
35432
- const versionResult = await _internals54.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
35432
+ const versionResult = await _internals55.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
35433
35433
  checks.push(versionResult);
35434
35434
  log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
35435
35435
  } else {
@@ -35492,10 +35492,10 @@ function formatPreflightMarkdown(report) {
35492
35492
  async function handlePreflightCommand(directory, _args) {
35493
35493
  const plan = await loadPlan(directory);
35494
35494
  const phase = plan?.current_phase ?? 1;
35495
- const report = await _internals54.runPreflight(directory, phase);
35496
- return _internals54.formatPreflightMarkdown(report);
35495
+ const report = await _internals55.runPreflight(directory, phase);
35496
+ return _internals55.formatPreflightMarkdown(report);
35497
35497
  }
35498
- var _internals54 = {
35498
+ var _internals55 = {
35499
35499
  runPreflight,
35500
35500
  formatPreflightMarkdown,
35501
35501
  handlePreflightCommand,
@@ -36466,7 +36466,7 @@ function pruneOldResetBackups(backupsRoot, warnings) {
36466
36466
  }
36467
36467
 
36468
36468
  // src/commands/reset.ts
36469
- var _internals55 = {
36469
+ var _internals56 = {
36470
36470
  backupSwarmStateBeforeReset
36471
36471
  };
36472
36472
  async function handleResetCommand(directory, args) {
@@ -36500,7 +36500,7 @@ async function handleResetCommand(directory, args) {
36500
36500
  ];
36501
36501
  const results = [];
36502
36502
  try {
36503
- const backup = _internals55.backupSwarmStateBeforeReset(directory, "reset", [
36503
+ const backup = _internals56.backupSwarmStateBeforeReset(directory, "reset", [
36504
36504
  ...filesToReset,
36505
36505
  "summaries"
36506
36506
  ]);
@@ -37122,7 +37122,7 @@ async function recordReplayEntry(artifactPath, sessionID, entry) {
37122
37122
  }
37123
37123
 
37124
37124
  // src/prm/index.ts
37125
- var _internals56 = {
37125
+ var _internals57 = {
37126
37126
  getAgentSession,
37127
37127
  readTrajectory,
37128
37128
  getInMemoryTrajectory,
@@ -37145,12 +37145,12 @@ function resetPrmSessionState(session, sessionId) {
37145
37145
  session.prmTrajectoryStep = 0;
37146
37146
  session.replayArtifactPath = null;
37147
37147
  if (sessionId) {
37148
- _internals56.clearTrajectoryCache(sessionId);
37148
+ _internals57.clearTrajectoryCache(sessionId);
37149
37149
  }
37150
37150
  }
37151
37151
 
37152
37152
  // src/commands/reset-session.ts
37153
- var _internals57 = {
37153
+ var _internals58 = {
37154
37154
  cleanupOrphanedBranches,
37155
37155
  backupSwarmStateBeforeReset
37156
37156
  };
@@ -37162,7 +37162,7 @@ function errorMessage(err) {
37162
37162
  async function handleResetSessionCommand(directory, _args) {
37163
37163
  const results = [];
37164
37164
  try {
37165
- const backup = _internals57.backupSwarmStateBeforeReset(directory, "reset-session", ["session"]);
37165
+ const backup = _internals58.backupSwarmStateBeforeReset(directory, "reset-session", ["session"]);
37166
37166
  if (backup.backupDir && backup.copied.length > 0) {
37167
37167
  const rel = path71.relative(directory, backup.backupDir);
37168
37168
  results.push(`\uD83D\uDCE6 Backed up session state to ${rel}/ (restore by copying files back into .swarm/session/)`);
@@ -37229,7 +37229,7 @@ async function handleResetSessionCommand(directory, _args) {
37229
37229
  results.push(`\u26A0\uFE0F Failed to remove .swarm-worktrees/: ${errorMessage(err)}`);
37230
37230
  }
37231
37231
  try {
37232
- const branchResult = await _internals57.cleanupOrphanedBranches(directory, []);
37232
+ const branchResult = await _internals58.cleanupOrphanedBranches(directory, []);
37233
37233
  if (branchResult.removed.length > 0) {
37234
37234
  results.push(`\u2705 Removed ${branchResult.removed.length} orphan swarm-lane branch(es)`);
37235
37235
  }
@@ -37567,7 +37567,7 @@ async function handleRollbackCommand(directory, args) {
37567
37567
  // src/commands/sdd.ts
37568
37568
  import * as fs39 from "fs";
37569
37569
  import * as path74 from "path";
37570
- var _internals58 = {
37570
+ var _internals59 = {
37571
37571
  writeProjectedSpecSync
37572
37572
  };
37573
37573
  var SWARM_SPEC_REL = path74.join(".swarm", "spec.md");
@@ -37963,7 +37963,7 @@ ${USAGE10}`;
37963
37963
 
37964
37964
  ${USAGE10}`;
37965
37965
  }
37966
- const result2 = _internals58.writeProjectedSpecSync(directory, {
37966
+ const result2 = _internals59.writeProjectedSpecSync(directory, {
37967
37967
  source: "speckit",
37968
37968
  feature: resolution.feature,
37969
37969
  dryRun: parsed.dryRun,
@@ -38021,7 +38021,7 @@ ${formatList(result2.projection.warnings)}` : ""
38021
38021
  ].join(`
38022
38022
  `);
38023
38023
  }
38024
- const result = _internals58.writeProjectedSpecSync(directory, {
38024
+ const result = _internals59.writeProjectedSpecSync(directory, {
38025
38025
  changeId: parsed.changeId,
38026
38026
  dryRun: parsed.dryRun,
38027
38027
  overwrite: parsed.overwrite
@@ -38408,7 +38408,7 @@ var DEFAULT_CONTEXT_BUDGET_CONFIG = {
38408
38408
  };
38409
38409
 
38410
38410
  // src/services/status-service.ts
38411
- var _internals59 = {
38411
+ var _internals60 = {
38412
38412
  loadLeanTurboRunState,
38413
38413
  hasActiveLeanTurbo,
38414
38414
  hasActiveFullAuto,
@@ -38529,11 +38529,11 @@ async function getStatusData(directory, agents) {
38529
38529
  } catch {
38530
38530
  status.cohort = { linked: false };
38531
38531
  }
38532
- status.fullAutoActive = _internals59.hasActiveFullAuto();
38532
+ status.fullAutoActive = _internals60.hasActiveFullAuto();
38533
38533
  if (status.fullAutoActive) {
38534
- const sid = _internals59.getActiveFullAutoSessionID();
38534
+ const sid = _internals60.getActiveFullAutoSessionID();
38535
38535
  if (sid) {
38536
- const runState = _internals59.loadFullAutoRunState(directory, sid);
38536
+ const runState = _internals60.loadFullAutoRunState(directory, sid);
38537
38537
  if (runState?.lastEscalation) {
38538
38538
  status.fullAutoEscalation = {
38539
38539
  reason: runState.lastEscalation.reason,
@@ -38548,7 +38548,7 @@ async function getStatusData(directory, agents) {
38548
38548
  }
38549
38549
  function enrichWithLeanTurbo(status, directory) {
38550
38550
  const turboMode = hasActiveTurboMode();
38551
- const leanActive = _internals59.hasActiveLeanTurbo();
38551
+ const leanActive = _internals60.hasActiveLeanTurbo();
38552
38552
  let turboStrategy = "off";
38553
38553
  if (leanActive) {
38554
38554
  turboStrategy = "lean";
@@ -38567,7 +38567,7 @@ function enrichWithLeanTurbo(status, directory) {
38567
38567
  }
38568
38568
  }
38569
38569
  if (leanSessionID) {
38570
- const runState = _internals59.loadLeanTurboRunState(directory, leanSessionID);
38570
+ const runState = _internals60.loadLeanTurboRunState(directory, leanSessionID);
38571
38571
  if (runState) {
38572
38572
  status.leanTurboPhase = runState.phase;
38573
38573
  status.leanMaxParallelCoders = runState.maxParallelCoders;
@@ -38774,7 +38774,7 @@ No active swarm plan found. Nothing to sync.`;
38774
38774
 
38775
38775
  // src/commands/turbo.ts
38776
38776
  init_logger();
38777
- var _internals60 = {
38777
+ var _internals61 = {
38778
38778
  loadPluginConfigWithMeta
38779
38779
  };
38780
38780
  async function handleTurboCommand(directory, args, sessionID) {
@@ -38834,7 +38834,7 @@ async function handleTurboCommand(directory, args, sessionID) {
38834
38834
  if (arg0 === "on") {
38835
38835
  let strategy = "standard";
38836
38836
  try {
38837
- const { config } = _internals60.loadPluginConfigWithMeta(directory);
38837
+ const { config } = _internals61.loadPluginConfigWithMeta(directory);
38838
38838
  if (config.turbo?.strategy === "lean") {
38839
38839
  strategy = "lean";
38840
38840
  }
@@ -38931,7 +38931,7 @@ function enableLeanTurbo(session, directory, sessionID) {
38931
38931
  let maxParallelCoders = 4;
38932
38932
  let conflictPolicy = "serialize";
38933
38933
  try {
38934
- const { config } = _internals60.loadPluginConfigWithMeta(directory);
38934
+ const { config } = _internals61.loadPluginConfigWithMeta(directory);
38935
38935
  const leanConfig = config.turbo?.lean;
38936
38936
  if (leanConfig) {
38937
38937
  maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
@@ -39136,7 +39136,7 @@ function findSimilarCommands(query) {
39136
39136
  }
39137
39137
  const scored = VALID_COMMANDS.map((cmd) => {
39138
39138
  const cmdLower = cmd.toLowerCase();
39139
- const fullScore = _internals61.levenshteinDistance(q, cmdLower);
39139
+ const fullScore = _internals62.levenshteinDistance(q, cmdLower);
39140
39140
  let tokenScore = Infinity;
39141
39141
  if (cmd.includes(" ") || cmd.includes("-")) {
39142
39142
  const qTokens = q.split(/[\s-]+/);
@@ -39149,7 +39149,7 @@ function findSimilarCommands(query) {
39149
39149
  for (const ct of cmdTokens) {
39150
39150
  if (ct.length === 0)
39151
39151
  continue;
39152
- const dist = _internals61.levenshteinDistance(qt, ct);
39152
+ const dist = _internals62.levenshteinDistance(qt, ct);
39153
39153
  if (dist < minDist)
39154
39154
  minDist = dist;
39155
39155
  }
@@ -39159,7 +39159,7 @@ function findSimilarCommands(query) {
39159
39159
  }
39160
39160
  const dashStrippedQ = q.replace(/-/g, "");
39161
39161
  const dashStrippedCmd = cmdLower.replace(/-/g, "");
39162
- const dashScore = _internals61.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
39162
+ const dashScore = _internals62.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
39163
39163
  const score = Math.min(fullScore, tokenScore, dashScore);
39164
39164
  return { cmd, score };
39165
39165
  });
@@ -39194,16 +39194,16 @@ function buildDetailedHelp(commandName, entry) {
39194
39194
  async function handleHelpCommand(ctx) {
39195
39195
  const targetCommand = ctx.args.join(" ");
39196
39196
  if (!targetCommand) {
39197
- const { buildHelpText } = await import("./index-2ygp3qq4.js");
39197
+ const { buildHelpText } = await import("./index-g9eg7z93.js");
39198
39198
  return buildHelpText();
39199
39199
  }
39200
39200
  const tokens = targetCommand.split(/\s+/);
39201
- const resolved = _internals61.resolveCommand(tokens);
39201
+ const resolved = _internals62.resolveCommand(tokens);
39202
39202
  if (resolved) {
39203
- return _internals61.buildDetailedHelp(resolved.key, resolved.entry);
39203
+ return _internals62.buildDetailedHelp(resolved.key, resolved.entry);
39204
39204
  }
39205
- const similar = _internals61.findSimilarCommands(targetCommand);
39206
- const { buildHelpText: fullHelp } = await import("./index-2ygp3qq4.js");
39205
+ const similar = _internals62.findSimilarCommands(targetCommand);
39206
+ const { buildHelpText: fullHelp } = await import("./index-g9eg7z93.js");
39207
39207
  if (similar.length > 0) {
39208
39208
  return `Command '/swarm ${targetCommand}' not found.
39209
39209
 
@@ -39267,7 +39267,7 @@ var COMMAND_REGISTRY = {
39267
39267
  toolNoArgs: true
39268
39268
  },
39269
39269
  help: {
39270
- handler: (ctx) => _internals61.handleHelpCommand(ctx),
39270
+ handler: (ctx) => _internals62.handleHelpCommand(ctx),
39271
39271
  description: "Show help for swarm commands",
39272
39272
  category: "core",
39273
39273
  args: "[command]",
@@ -39336,7 +39336,7 @@ var COMMAND_REGISTRY = {
39336
39336
  },
39337
39337
  "guardrail explain": {
39338
39338
  handler: async (ctx) => {
39339
- const { handleGuardrailExplain } = await import("./guardrail-explain-tgkk87z5.js");
39339
+ const { handleGuardrailExplain } = await import("./guardrail-explain-0vcaa7hj.js");
39340
39340
  return handleGuardrailExplain(ctx.directory, ctx.args);
39341
39341
  },
39342
39342
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -39346,7 +39346,7 @@ var COMMAND_REGISTRY = {
39346
39346
  },
39347
39347
  "guardrail-explain": {
39348
39348
  handler: async (ctx) => {
39349
- const { handleGuardrailExplain } = await import("./guardrail-explain-tgkk87z5.js");
39349
+ const { handleGuardrailExplain } = await import("./guardrail-explain-0vcaa7hj.js");
39350
39350
  return handleGuardrailExplain(ctx.directory, ctx.args);
39351
39351
  },
39352
39352
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -40207,7 +40207,7 @@ function validateToolPolicy() {
40207
40207
  }
40208
40208
  return { valid: warnings.length === 0, warnings };
40209
40209
  }
40210
- var _internals61 = {
40210
+ var _internals62 = {
40211
40211
  handleHelpCommand,
40212
40212
  validateAliases,
40213
40213
  validateToolPolicy,
@@ -40217,16 +40217,16 @@ var _internals61 = {
40217
40217
  findSimilarCommands,
40218
40218
  buildDetailedHelp
40219
40219
  };
40220
- var validation = _internals61.validateAliases();
40220
+ var validation = _internals62.validateAliases();
40221
40221
  if (!validation.valid) {
40222
40222
  throw new Error(`COMMAND_REGISTRY alias validation failed:
40223
40223
  ${validation.errors.join(`
40224
40224
  `)}`);
40225
40225
  }
40226
- _internals61.emitValidationWarnings("COMMAND_REGISTRY alias warnings", validation.warnings);
40226
+ _internals62.emitValidationWarnings("COMMAND_REGISTRY alias warnings", validation.warnings);
40227
40227
  try {
40228
- const toolPolicyValidation = _internals61.validateToolPolicy();
40229
- _internals61.emitValidationWarnings("COMMAND_REGISTRY toolPolicy warnings", toolPolicyValidation.warnings);
40228
+ const toolPolicyValidation = _internals62.validateToolPolicy();
40229
+ _internals62.emitValidationWarnings("COMMAND_REGISTRY toolPolicy warnings", toolPolicyValidation.warnings);
40230
40230
  } catch (e) {
40231
40231
  warn(`COMMAND_REGISTRY toolPolicy validation failed (non-fatal): ${e.message}`);
40232
40232
  }
@@ -42946,7 +42946,7 @@ function formatCommandNotFound(tokens) {
42946
42946
  const attemptedCommand = tokens[0] || "";
42947
42947
  const MAX_DISPLAY = 100;
42948
42948
  const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
42949
- const similar = _internals61.findSimilarCommands(attemptedCommand);
42949
+ const similar = _internals62.findSimilarCommands(attemptedCommand);
42950
42950
  const header = `Command \`/swarm ${displayCommand}\` not found.`;
42951
42951
  const suggestions = similar.length > 0 ? `Did you mean:
42952
42952
  ${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
@@ -44906,10 +44906,10 @@ function startAgentSession(sessionId, agentName, staleDurationMs = STALE_SESSION
44906
44906
  }
44907
44907
  telemetry.sessionStarted(sessionId, agentName);
44908
44908
  swarmState.activeAgent.set(sessionId, agentName);
44909
- _internals64.applyRehydrationCache(sessionState);
44909
+ _internals65.applyRehydrationCache(sessionState);
44910
44910
  if (directory) {
44911
44911
  let rehydrationPromise;
44912
- rehydrationPromise = _internals64.rehydrateSessionFromDisk(directory, sessionState).then(async () => {
44912
+ rehydrationPromise = _internals65.rehydrateSessionFromDisk(directory, sessionState).then(async () => {
44913
44913
  try {
44914
44914
  sessionState.prSubscriptions = await rehydratePrSubscriptions(sessionId, directory);
44915
44915
  } catch (err) {
@@ -45090,7 +45090,7 @@ function ensureAgentSession(sessionId, agentName, directory) {
45090
45090
  maybeSweepStaleSessions();
45091
45091
  return session;
45092
45092
  }
45093
- _internals64.startAgentSession(sessionId, agentName ?? "unknown", 7200000, directory);
45093
+ _internals65.startAgentSession(sessionId, agentName ?? "unknown", 7200000, directory);
45094
45094
  session = swarmState.agentSessions.get(sessionId);
45095
45095
  if (!session) {
45096
45096
  throw new Error(`Failed to create guardrail session for ${sessionId}`);
@@ -45378,8 +45378,8 @@ function applyRehydrationCache(session) {
45378
45378
  }
45379
45379
  }
45380
45380
  async function rehydrateSessionFromDisk(directory, session) {
45381
- await _internals64.buildRehydrationCache(directory);
45382
- _internals64.applyRehydrationCache(session);
45381
+ await _internals65.buildRehydrationCache(directory);
45382
+ _internals65.applyRehydrationCache(session);
45383
45383
  }
45384
45384
  function hasActiveTurboMode(sessionID) {
45385
45385
  if (sessionID) {
@@ -45467,7 +45467,7 @@ async function rehydratePrSubscriptions(sessionID, directory) {
45467
45467
  }
45468
45468
  return map;
45469
45469
  }
45470
- var _internals64 = {
45470
+ var _internals65 = {
45471
45471
  swarmState,
45472
45472
  resetSwarmState,
45473
45473
  ensureAgentSession,
@@ -45606,4 +45606,4 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
45606
45606
  };
45607
45607
  }
45608
45608
 
45609
- export { package_default, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleArchiveCommand, DC_SAFE_TARGETS, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcValidateTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals14 as _internals, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals17 as _internals1, createHivePromoterHook, promoteToHive, promoteFromSwarm, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals61 as _internals2, resolveCommand };
45609
+ export { package_default, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleArchiveCommand, DC_SAFE_TARGETS, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcValidateTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals14 as _internals, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals17 as _internals1, createHivePromoterHook, promoteToHive, promoteFromSwarm, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals62 as _internals2, resolveCommand };