opencode-swarm 7.99.1 → 7.99.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -114,7 +114,7 @@ import {
114
114
  transientBackoff,
115
115
  validateProjectRoot,
116
116
  writeProjectedSpecSync
117
- } from "./index-qcr60fgm.js";
117
+ } from "./index-6wgwybzj.js";
118
118
  import {
119
119
  _internals as _internals2,
120
120
  _internals1 as _internals3,
@@ -138,12 +138,12 @@ import {
138
138
  listActive,
139
139
  subscribe,
140
140
  unsubscribe
141
- } from "./index-5fxjagjt.js";
141
+ } from "./index-s3esnz7m.js";
142
142
  import {
143
143
  readSwarmFileAsync,
144
144
  safeHook,
145
145
  validateSwarmPath
146
- } from "./index-we94wkty.js";
146
+ } from "./index-94qwbx11.js";
147
147
  import {
148
148
  deepMerge
149
149
  } from "./index-p0arc26j.js";
@@ -909,7 +909,7 @@ var init_executor = __esm(() => {
909
909
  // package.json
910
910
  var package_default = {
911
911
  name: "opencode-swarm",
912
- version: "7.99.1",
912
+ version: "7.99.2",
913
913
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
914
914
  main: "dist/index.js",
915
915
  types: "dist/index.d.ts",
@@ -1668,7 +1668,8 @@ var _internals4 = {
1668
1668
  getOrCreateProfile,
1669
1669
  setGates,
1670
1670
  getEffectiveGates,
1671
- computeProfileHash
1671
+ computeProfileHash,
1672
+ hasAnyProfileWithEnabledGate
1672
1673
  };
1673
1674
  var DEFAULT_QA_GATES = {
1674
1675
  reviewer: true,
@@ -1723,6 +1724,20 @@ function getProfile(directory, planId) {
1723
1724
  const row = db.query("SELECT * FROM qa_gate_profile WHERE plan_id = ?").get(planId);
1724
1725
  return row ? rowToProfile(row) : null;
1725
1726
  }
1727
+ function hasAnyProfileWithEnabledGate(directory, gate) {
1728
+ if (!projectDbExists(directory))
1729
+ return false;
1730
+ const db = getProjectDb(directory);
1731
+ const rows = db.query("SELECT gates FROM qa_gate_profile").all();
1732
+ for (const row of rows) {
1733
+ try {
1734
+ const parsed = JSON.parse(row.gates);
1735
+ if (parsed?.[gate] === true)
1736
+ return true;
1737
+ } catch {}
1738
+ }
1739
+ return false;
1740
+ }
1726
1741
  function getOrCreateProfile(directory, planId, projectType) {
1727
1742
  const existing = _internals4.getProfile(directory, planId);
1728
1743
  if (existing)
@@ -5999,7 +6014,7 @@ function hasActiveEpicMode(sessionID) {
5999
6014
  async function rehydratePrSubscriptions(sessionID, directory) {
6000
6015
  const map = new Map;
6001
6016
  try {
6002
- const { listActive: listActive2 } = await import("./pr-subscriptions-fqrzm0tv.js");
6017
+ const { listActive: listActive2 } = await import("./pr-subscriptions-d57tq0c0.js");
6003
6018
  const records = await listActive2(directory);
6004
6019
  for (const record of records) {
6005
6020
  if (record.sessionID !== sessionID)
@@ -17917,7 +17932,7 @@ async function handleEvidenceCommand(directory, args) {
17917
17932
  return formatTaskEvidenceMarkdown(evidenceData);
17918
17933
  }
17919
17934
  async function handleEvidenceSummaryCommand(directory) {
17920
- const { buildEvidenceSummary } = await import("./evidence-summary-service-gvd7mw7v.js");
17935
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-wxarfgt8.js");
17921
17936
  const artifact = await buildEvidenceSummary(directory);
17922
17937
  if (!artifact) {
17923
17938
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -20308,10 +20323,45 @@ var MAX_OBJECTIVE_LEN = 2000;
20308
20323
  var DEPTHS2 = new Set(["standard", "exhaustive"]);
20309
20324
  var AUTONOMY_LEVELS = new Set(["checkpoint", "auto"]);
20310
20325
  var DEFAULT_DEPTH2 = "standard";
20311
- var DEFAULT_AUTONOMY = "checkpoint";
20326
+ var DEFAULT_AUTONOMY = "auto";
20312
20327
  var DEFAULT_MAX_CYCLES = 3;
20313
20328
  var MIN_MAX_CYCLES = 1;
20314
20329
  var MAX_MAX_CYCLES = 5;
20330
+ async function readLatestLoopState(directory) {
20331
+ try {
20332
+ const { readdirSync: readdirSync4, statSync: statSync9, readFileSync: readFileSync16 } = await import("fs");
20333
+ const loopDir = `${directory}/.swarm/loop`;
20334
+ let latestMtime = 0;
20335
+ let latestPath = null;
20336
+ try {
20337
+ const entries = readdirSync4(loopDir, { withFileTypes: true });
20338
+ for (const entry of entries) {
20339
+ if (!entry.isDirectory())
20340
+ continue;
20341
+ const statePath = `${loopDir}/${entry.name}/state.json`;
20342
+ try {
20343
+ const mtime = statSync9(statePath).mtimeMs;
20344
+ if (mtime > latestMtime) {
20345
+ latestMtime = mtime;
20346
+ latestPath = statePath;
20347
+ }
20348
+ } catch {}
20349
+ }
20350
+ } catch {
20351
+ return null;
20352
+ }
20353
+ if (!latestPath)
20354
+ return null;
20355
+ const raw = readFileSync16(latestPath, "utf-8");
20356
+ const state = JSON.parse(raw);
20357
+ return { autonomy: state.params?.autonomy };
20358
+ } catch {
20359
+ return null;
20360
+ }
20361
+ }
20362
+ var _internals32 = {
20363
+ readLatestLoopState
20364
+ };
20315
20365
  var USAGE7 = `Usage: /swarm loop <objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]
20316
20366
 
20317
20367
  Run a compound-engineering loop: brainstorm \u2192 plan \u2192 build \u2192 review \u2192 improve,
@@ -20320,13 +20370,13 @@ iterating until the objective is met or a budget stop condition fires.
20320
20370
  Examples:
20321
20371
  /swarm loop "add rate limiting to the public API"
20322
20372
  /swarm loop "harden auth session handling" --depth exhaustive --max-cycles 2
20323
- /swarm loop "migrate config loader" --autonomy auto
20373
+ /swarm loop "migrate config loader" --autonomy checkpoint
20324
20374
  /swarm loop --resume
20325
20375
 
20326
20376
  Flags:
20327
20377
  --max-cycles <N> outer improvement cycles, 1..5 (default: 3)
20328
- --autonomy <level> checkpoint (pause at phase gates, default) or auto
20329
- (run unattended; hard stop conditions still apply)
20378
+ --autonomy <level> auto (default; run unattended with hard stops still
20379
+ enforced) or checkpoint (pause at phase gates)
20330
20380
  --depth <name> standard (default) or exhaustive (wider exploration)
20331
20381
  --resume resume the existing loop run from durable state in
20332
20382
  .swarm/loop/ instead of starting a new objective`;
@@ -20345,6 +20395,7 @@ function parseArgs8(args) {
20345
20395
  const result = {
20346
20396
  maxCycles: DEFAULT_MAX_CYCLES,
20347
20397
  autonomy: DEFAULT_AUTONOMY,
20398
+ autonomyExplicit: false,
20348
20399
  depth: DEFAULT_DEPTH2,
20349
20400
  resume: false,
20350
20401
  rest: []
@@ -20352,7 +20403,10 @@ function parseArgs8(args) {
20352
20403
  let i = 0;
20353
20404
  while (i < args.length) {
20354
20405
  const token = args[i];
20355
- if (token === "--max-cycles") {
20406
+ if (token === "--") {
20407
+ result.rest.push(...args.slice(i + 1));
20408
+ break;
20409
+ } else if (token === "--max-cycles") {
20356
20410
  if (i + 1 >= args.length) {
20357
20411
  return { ...result, error: `Flag "${token}" requires a value` };
20358
20412
  }
@@ -20376,6 +20430,7 @@ function parseArgs8(args) {
20376
20430
  };
20377
20431
  }
20378
20432
  result.autonomy = value;
20433
+ result.autonomyExplicit = true;
20379
20434
  } else if (token === "--depth") {
20380
20435
  if (i + 1 >= args.length) {
20381
20436
  return { ...result, error: `Flag "${token}" requires a value` };
@@ -20391,6 +20446,11 @@ function parseArgs8(args) {
20391
20446
  } else if (token === "--resume") {
20392
20447
  result.resume = true;
20393
20448
  } else if (token.startsWith("--")) {
20449
+ if (result.rest.length > 0) {
20450
+ result.rest.push(token);
20451
+ i++;
20452
+ continue;
20453
+ }
20394
20454
  return { ...result, error: `Unknown flag "${token}"` };
20395
20455
  } else {
20396
20456
  result.rest.push(token);
@@ -20410,7 +20470,14 @@ ${USAGE7}`;
20410
20470
  if (!objective && !parsed.resume) {
20411
20471
  return USAGE7;
20412
20472
  }
20413
- const header = `[MODE: LOOP max_cycles=${parsed.maxCycles} autonomy=${parsed.autonomy}` + ` depth=${parsed.depth} resume=${parsed.resume}]`;
20473
+ let autonomy = parsed.autonomy;
20474
+ if (parsed.resume && !parsed.autonomyExplicit) {
20475
+ const state = await _internals32.readLatestLoopState(_directory);
20476
+ if (state?.autonomy && AUTONOMY_LEVELS.has(state.autonomy)) {
20477
+ autonomy = state.autonomy;
20478
+ }
20479
+ }
20480
+ const header = `[MODE: LOOP max_cycles=${parsed.maxCycles} autonomy=${autonomy} depth=${parsed.depth} resume=${parsed.resume}]`;
20414
20481
  if (!objective && parsed.resume) {
20415
20482
  return `${header} Resume the existing compound-engineering loop from durable state in .swarm/loop/. Read the latest run state, report cycle progress, and continue from the current phase.`;
20416
20483
  }
@@ -24187,15 +24254,15 @@ function truncate(value, maxLength) {
24187
24254
  }
24188
24255
 
24189
24256
  // src/services/plan-service.ts
24190
- var _internals32 = {
24257
+ var _internals33 = {
24191
24258
  loadPlanJsonOnly,
24192
24259
  derivePlanMarkdown,
24193
24260
  readSwarmFileAsync
24194
24261
  };
24195
24262
  async function getPlanData(directory, phaseArg) {
24196
- const plan = await _internals32.loadPlanJsonOnly(directory);
24263
+ const plan = await _internals33.loadPlanJsonOnly(directory);
24197
24264
  if (plan) {
24198
- const fullMarkdown = _internals32.derivePlanMarkdown(plan);
24265
+ const fullMarkdown = _internals33.derivePlanMarkdown(plan);
24199
24266
  if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
24200
24267
  return {
24201
24268
  hasPlan: true,
@@ -24238,7 +24305,7 @@ async function getPlanData(directory, phaseArg) {
24238
24305
  isLegacy: false
24239
24306
  };
24240
24307
  }
24241
- const planContent = await _internals32.readSwarmFileAsync(directory, "plan.md");
24308
+ const planContent = await _internals33.readSwarmFileAsync(directory, "plan.md");
24242
24309
  if (!planContent) {
24243
24310
  return {
24244
24311
  hasPlan: false,
@@ -24335,7 +24402,7 @@ async function handlePlanCommand(directory, args) {
24335
24402
  return formatPlanMarkdown(planData);
24336
24403
  }
24337
24404
  // src/commands/post-mortem.ts
24338
- var _internals33 = {
24405
+ var _internals34 = {
24339
24406
  createCuratorLLMDelegate,
24340
24407
  runCuratorPostMortem
24341
24408
  };
@@ -24347,10 +24414,10 @@ async function handlePostMortemCommand(directory, args, options) {
24347
24414
  };
24348
24415
  if (options?.sessionID) {
24349
24416
  try {
24350
- pmOptions.llmDelegate = _internals33.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
24417
+ pmOptions.llmDelegate = _internals34.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
24351
24418
  } catch {}
24352
24419
  }
24353
- const result = await _internals33.runCuratorPostMortem(directory, pmOptions);
24420
+ const result = await _internals34.runCuratorPostMortem(directory, pmOptions);
24354
24421
  const lines = [];
24355
24422
  if (result.success) {
24356
24423
  lines.push("## Post-Mortem Report Generated");
@@ -24505,12 +24572,12 @@ function formatRelativeTime(epochMs) {
24505
24572
  const diffDays = Math.floor(diffHours / 24);
24506
24573
  return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
24507
24574
  }
24508
- var _internals34 = {
24575
+ var _internals35 = {
24509
24576
  formatRelativeTime,
24510
24577
  listActive
24511
24578
  };
24512
24579
  async function handlePrMonitorStatusCommand(directory, _args, sessionID, source) {
24513
- const allActive = await _internals34.listActive(directory);
24580
+ const allActive = await _internals35.listActive(directory);
24514
24581
  const allSessions = source === "cli";
24515
24582
  const subs = allSessions ? allActive : allActive.filter((record) => record.sessionID === sessionID);
24516
24583
  if (subs.length === 0) {
@@ -24648,7 +24715,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
24648
24715
  const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
24649
24716
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
24650
24717
  try {
24651
- const config = _internals35.loadPluginConfig(directory);
24718
+ const config = _internals36.loadPluginConfig(directory);
24652
24719
  const prMonitorConfig = config.pr_monitor;
24653
24720
  if (!prMonitorConfig?.enabled) {
24654
24721
  return [
@@ -24658,7 +24725,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
24658
24725
  ].join(`
24659
24726
  `);
24660
24727
  }
24661
- await _internals35.subscribe(directory, {
24728
+ await _internals36.subscribe(directory, {
24662
24729
  sessionID,
24663
24730
  prNumber: prInfo.number,
24664
24731
  repoFullName,
@@ -24682,7 +24749,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
24682
24749
  `);
24683
24750
  }
24684
24751
  }
24685
- var _internals35 = {
24752
+ var _internals36 = {
24686
24753
  loadPluginConfig,
24687
24754
  subscribe
24688
24755
  };
@@ -24705,9 +24772,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
24705
24772
  `);
24706
24773
  }
24707
24774
  const refToken = rest[0];
24708
- const prInfo = _internals36.parsePrRef(refToken, directory);
24775
+ const prInfo = _internals37.parsePrRef(refToken, directory);
24709
24776
  if (!prInfo) {
24710
- if (_internals36.looksLikePrRef(refToken)) {
24777
+ if (_internals37.looksLikePrRef(refToken)) {
24711
24778
  return [
24712
24779
  `Error: Could not resolve PR reference from "${refToken}".`,
24713
24780
  "",
@@ -24728,8 +24795,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
24728
24795
  const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
24729
24796
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
24730
24797
  try {
24731
- const correlationId = _internals36.buildCorrelationId(sessionID, repoFullName, prInfo.number);
24732
- const result = await _internals36.unsubscribe(directory, correlationId);
24798
+ const correlationId = _internals37.buildCorrelationId(sessionID, repoFullName, prInfo.number);
24799
+ const result = await _internals37.unsubscribe(directory, correlationId);
24733
24800
  if (!result) {
24734
24801
  return [
24735
24802
  `Not subscribed to ${prUrl}`,
@@ -24756,7 +24823,7 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
24756
24823
  `);
24757
24824
  }
24758
24825
  }
24759
- var _internals36 = {
24826
+ var _internals37 = {
24760
24827
  unsubscribe,
24761
24828
  buildCorrelationId,
24762
24829
  parsePrRef,
@@ -25190,15 +25257,15 @@ var lint = createSwarmTool({
25190
25257
  }
25191
25258
  const { mode } = args;
25192
25259
  const cwd = directory;
25193
- const linter = await _internals37.detectAvailableLinter(directory);
25260
+ const linter = await _internals38.detectAvailableLinter(directory);
25194
25261
  if (linter) {
25195
- const result = await _internals37.runLint(linter, mode, directory);
25262
+ const result = await _internals38.runLint(linter, mode, directory);
25196
25263
  return JSON.stringify(result, null, 2);
25197
25264
  }
25198
- const additionalLinter = _internals37.detectAdditionalLinter(cwd);
25265
+ const additionalLinter = _internals38.detectAdditionalLinter(cwd);
25199
25266
  if (additionalLinter) {
25200
25267
  warn(`[lint] Using ${additionalLinter} linter for this project`);
25201
- const result = await _internals37.runAdditionalLint(additionalLinter, mode, cwd);
25268
+ const result = await _internals38.runAdditionalLint(additionalLinter, mode, cwd);
25202
25269
  return JSON.stringify(result, null, 2);
25203
25270
  }
25204
25271
  const errorResult = {
@@ -25212,7 +25279,7 @@ For Rust: rustup component add clippy`
25212
25279
  return JSON.stringify(errorResult, null, 2);
25213
25280
  }
25214
25281
  });
25215
- var _internals37 = {
25282
+ var _internals38 = {
25216
25283
  detectAvailableLinter,
25217
25284
  runLint,
25218
25285
  detectAdditionalLinter,
@@ -25900,7 +25967,7 @@ var secretscan = createSwarmTool({
25900
25967
  });
25901
25968
  async function runSecretscan(directory) {
25902
25969
  try {
25903
- const result = await _internals38.secretscan.execute({ directory }, {});
25970
+ const result = await _internals39.secretscan.execute({ directory }, {});
25904
25971
  const jsonStr = typeof result === "string" ? result : result.output;
25905
25972
  return JSON.parse(jsonStr);
25906
25973
  } catch (e) {
@@ -25915,7 +25982,7 @@ async function runSecretscan(directory) {
25915
25982
  return errorResult;
25916
25983
  }
25917
25984
  }
25918
- var _internals38 = {
25985
+ var _internals39 = {
25919
25986
  secretscan,
25920
25987
  runSecretscan
25921
25988
  };
@@ -26188,7 +26255,7 @@ async function buildImpactMapInternal(cwd) {
26188
26255
  }
26189
26256
  return impactMap;
26190
26257
  }
26191
- var _internals39 = {
26258
+ var _internals40 = {
26192
26259
  validateProjectRoot,
26193
26260
  normalizePath: normalizePath2,
26194
26261
  isCacheStale,
@@ -26203,8 +26270,8 @@ var _internals39 = {
26203
26270
  _clearGoModuleCache
26204
26271
  };
26205
26272
  async function buildImpactMap(cwd) {
26206
- const impactMap = await _internals39.buildImpactMapInternal(cwd);
26207
- await _internals39.saveImpactMap(cwd, impactMap);
26273
+ const impactMap = await _internals40.buildImpactMapInternal(cwd);
26274
+ await _internals40.saveImpactMap(cwd, impactMap);
26208
26275
  return impactMap;
26209
26276
  }
26210
26277
  async function loadImpactMap(cwd, options) {
@@ -26218,7 +26285,7 @@ async function loadImpactMap(cwd, options) {
26218
26285
  const hasValidValues = Object.values(map).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
26219
26286
  if (hasValidValues) {
26220
26287
  const generatedAt = new Date(data.generatedAt).getTime();
26221
- if (!_internals39.isCacheStale(map, generatedAt)) {
26288
+ if (!_internals40.isCacheStale(map, generatedAt)) {
26222
26289
  return map;
26223
26290
  }
26224
26291
  if (options?.skipRebuild) {
@@ -26238,13 +26305,13 @@ async function loadImpactMap(cwd, options) {
26238
26305
  if (options?.skipRebuild) {
26239
26306
  return {};
26240
26307
  }
26241
- return _internals39.buildImpactMap(cwd);
26308
+ return _internals40.buildImpactMap(cwd);
26242
26309
  }
26243
26310
  async function saveImpactMap(cwd, impactMap) {
26244
26311
  if (!path51.isAbsolute(cwd)) {
26245
26312
  throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
26246
26313
  }
26247
- _internals39.validateProjectRoot(cwd);
26314
+ _internals40.validateProjectRoot(cwd);
26248
26315
  const cacheDir2 = path51.join(cwd, ".swarm", "cache");
26249
26316
  const cachePath = path51.join(cacheDir2, "impact-map.json");
26250
26317
  if (!fs22.existsSync(cacheDir2)) {
@@ -26268,7 +26335,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
26268
26335
  };
26269
26336
  }
26270
26337
  const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
26271
- const impactMap = await _internals39.loadImpactMap(cwd);
26338
+ const impactMap = await _internals40.loadImpactMap(cwd);
26272
26339
  const impactedTestsSet = new Set;
26273
26340
  const untestedFiles = [];
26274
26341
  let visitedCount = 0;
@@ -26733,7 +26800,7 @@ function batchAppendTestRuns(records, workingDir) {
26733
26800
  }
26734
26801
  const historyPath = getHistoryPath(workingDir);
26735
26802
  const historyDir = path52.dirname(historyPath);
26736
- _internals40.validateProjectRoot(workingDir);
26803
+ _internals41.validateProjectRoot(workingDir);
26737
26804
  if (!fs23.existsSync(historyDir)) {
26738
26805
  fs23.mkdirSync(historyDir, { recursive: true });
26739
26806
  }
@@ -26856,7 +26923,7 @@ function getAllHistory(workingDir) {
26856
26923
  records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
26857
26924
  return records;
26858
26925
  }
26859
- var _internals40 = {
26926
+ var _internals41 = {
26860
26927
  validateProjectRoot
26861
26928
  };
26862
26929
 
@@ -28769,9 +28836,9 @@ function getVersionFileVersion(dir) {
28769
28836
  async function runVersionCheck(dir, _timeoutMs) {
28770
28837
  const startTime = Date.now();
28771
28838
  try {
28772
- const packageVersion = _internals41.getPackageVersion(dir);
28773
- const changelogVersion = _internals41.getChangelogVersion(dir);
28774
- const versionFileVersion = _internals41.getVersionFileVersion(dir);
28839
+ const packageVersion = _internals42.getPackageVersion(dir);
28840
+ const changelogVersion = _internals42.getChangelogVersion(dir);
28841
+ const versionFileVersion = _internals42.getVersionFileVersion(dir);
28775
28842
  const versions = [];
28776
28843
  if (packageVersion)
28777
28844
  versions.push(`package.json: ${packageVersion}`);
@@ -29135,7 +29202,7 @@ async function runPreflight(dir, phase, config) {
29135
29202
  const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
29136
29203
  let validatedDir;
29137
29204
  try {
29138
- validatedDir = _internals41.validateDirectoryPath(dir);
29205
+ validatedDir = _internals42.validateDirectoryPath(dir);
29139
29206
  } catch (error2) {
29140
29207
  return {
29141
29208
  id: reportId,
@@ -29155,7 +29222,7 @@ async function runPreflight(dir, phase, config) {
29155
29222
  }
29156
29223
  let validatedTimeout;
29157
29224
  try {
29158
- validatedTimeout = _internals41.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
29225
+ validatedTimeout = _internals42.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
29159
29226
  } catch (error2) {
29160
29227
  return {
29161
29228
  id: reportId,
@@ -29196,12 +29263,12 @@ async function runPreflight(dir, phase, config) {
29196
29263
  });
29197
29264
  const checks = [];
29198
29265
  log("[Preflight] Running lint check...");
29199
- const lintResult = await _internals41.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
29266
+ const lintResult = await _internals42.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
29200
29267
  checks.push(lintResult);
29201
29268
  log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
29202
29269
  if (!cfg.skipTests) {
29203
29270
  log("[Preflight] Running tests check...");
29204
- const testsResult = await _internals41.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
29271
+ const testsResult = await _internals42.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
29205
29272
  checks.push(testsResult);
29206
29273
  log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
29207
29274
  } else {
@@ -29213,7 +29280,7 @@ async function runPreflight(dir, phase, config) {
29213
29280
  }
29214
29281
  if (!cfg.skipSecrets) {
29215
29282
  log("[Preflight] Running secrets check...");
29216
- const secretsResult = await _internals41.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
29283
+ const secretsResult = await _internals42.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
29217
29284
  checks.push(secretsResult);
29218
29285
  log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
29219
29286
  } else {
@@ -29225,7 +29292,7 @@ async function runPreflight(dir, phase, config) {
29225
29292
  }
29226
29293
  if (!cfg.skipEvidence) {
29227
29294
  log("[Preflight] Running evidence check...");
29228
- const evidenceResult = await _internals41.runEvidenceCheck(validatedDir);
29295
+ const evidenceResult = await _internals42.runEvidenceCheck(validatedDir);
29229
29296
  checks.push(evidenceResult);
29230
29297
  log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
29231
29298
  } else {
@@ -29236,12 +29303,12 @@ async function runPreflight(dir, phase, config) {
29236
29303
  });
29237
29304
  }
29238
29305
  log("[Preflight] Running requirement coverage check...");
29239
- const reqCoverageResult = await _internals41.runRequirementCoverageCheck(validatedDir, phase);
29306
+ const reqCoverageResult = await _internals42.runRequirementCoverageCheck(validatedDir, phase);
29240
29307
  checks.push(reqCoverageResult);
29241
29308
  log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
29242
29309
  if (!cfg.skipVersion) {
29243
29310
  log("[Preflight] Running version check...");
29244
- const versionResult = await _internals41.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
29311
+ const versionResult = await _internals42.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
29245
29312
  checks.push(versionResult);
29246
29313
  log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
29247
29314
  } else {
@@ -29304,10 +29371,10 @@ function formatPreflightMarkdown(report) {
29304
29371
  async function handlePreflightCommand(directory, _args) {
29305
29372
  const plan = await loadPlan(directory);
29306
29373
  const phase = plan?.current_phase ?? 1;
29307
- const report = await _internals41.runPreflight(directory, phase);
29308
- return _internals41.formatPreflightMarkdown(report);
29374
+ const report = await _internals42.runPreflight(directory, phase);
29375
+ return _internals42.formatPreflightMarkdown(report);
29309
29376
  }
29310
- var _internals41 = {
29377
+ var _internals42 = {
29311
29378
  runPreflight,
29312
29379
  formatPreflightMarkdown,
29313
29380
  handlePreflightCommand,
@@ -30712,7 +30779,7 @@ async function recordReplayEntry(artifactPath, sessionID, entry) {
30712
30779
  }
30713
30780
 
30714
30781
  // src/prm/index.ts
30715
- var _internals42 = {
30782
+ var _internals43 = {
30716
30783
  getAgentSession,
30717
30784
  readTrajectory,
30718
30785
  getInMemoryTrajectory,
@@ -30735,7 +30802,7 @@ function resetPrmSessionState(session, sessionId) {
30735
30802
  session.prmTrajectoryStep = 0;
30736
30803
  session.replayArtifactPath = null;
30737
30804
  if (sessionId) {
30738
- _internals42.clearTrajectoryCache(sessionId);
30805
+ _internals43.clearTrajectoryCache(sessionId);
30739
30806
  }
30740
30807
  }
30741
30808
 
@@ -31477,7 +31544,7 @@ var DEFAULT_CONTEXT_BUDGET_CONFIG = {
31477
31544
  };
31478
31545
 
31479
31546
  // src/services/status-service.ts
31480
- var _internals43 = {
31547
+ var _internals44 = {
31481
31548
  loadLeanTurboRunState,
31482
31549
  hasActiveLeanTurbo,
31483
31550
  hasActiveFullAuto
@@ -31582,7 +31649,7 @@ async function getStatusData(directory, agents) {
31582
31649
  }
31583
31650
  function enrichWithLeanTurbo(status, directory) {
31584
31651
  const turboMode = hasActiveTurboMode();
31585
- const leanActive = _internals43.hasActiveLeanTurbo();
31652
+ const leanActive = _internals44.hasActiveLeanTurbo();
31586
31653
  let turboStrategy = "off";
31587
31654
  if (leanActive) {
31588
31655
  turboStrategy = "lean";
@@ -31601,7 +31668,7 @@ function enrichWithLeanTurbo(status, directory) {
31601
31668
  }
31602
31669
  }
31603
31670
  if (leanSessionID) {
31604
- const runState = _internals43.loadLeanTurboRunState(directory, leanSessionID);
31671
+ const runState = _internals44.loadLeanTurboRunState(directory, leanSessionID);
31605
31672
  if (runState) {
31606
31673
  status.leanTurboPhase = runState.phase;
31607
31674
  status.leanMaxParallelCoders = runState.maxParallelCoders;
@@ -31633,7 +31700,7 @@ function enrichWithLeanTurbo(status, directory) {
31633
31700
  }
31634
31701
  }
31635
31702
  }
31636
- status.fullAutoActive = _internals43.hasActiveFullAuto();
31703
+ status.fullAutoActive = _internals44.hasActiveFullAuto();
31637
31704
  return status;
31638
31705
  }
31639
31706
  function formatStatusMarkdown(status) {
@@ -31787,7 +31854,7 @@ No active swarm plan found. Nothing to sync.`;
31787
31854
 
31788
31855
  // src/commands/turbo.ts
31789
31856
  init_logger();
31790
- var _internals44 = {
31857
+ var _internals45 = {
31791
31858
  loadPluginConfigWithMeta
31792
31859
  };
31793
31860
  async function handleTurboCommand(directory, args, sessionID) {
@@ -31847,7 +31914,7 @@ async function handleTurboCommand(directory, args, sessionID) {
31847
31914
  if (arg0 === "on") {
31848
31915
  let strategy = "standard";
31849
31916
  try {
31850
- const { config } = _internals44.loadPluginConfigWithMeta(directory);
31917
+ const { config } = _internals45.loadPluginConfigWithMeta(directory);
31851
31918
  if (config.turbo?.strategy === "lean") {
31852
31919
  strategy = "lean";
31853
31920
  }
@@ -31944,7 +32011,7 @@ function enableLeanTurbo(session, directory, sessionID) {
31944
32011
  let maxParallelCoders = 4;
31945
32012
  let conflictPolicy = "serialize";
31946
32013
  try {
31947
- const { config } = _internals44.loadPluginConfigWithMeta(directory);
32014
+ const { config } = _internals45.loadPluginConfigWithMeta(directory);
31948
32015
  const leanConfig = config.turbo?.lean;
31949
32016
  if (leanConfig) {
31950
32017
  maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
@@ -32160,7 +32227,7 @@ function findSimilarCommands(query) {
32160
32227
  }
32161
32228
  const scored = VALID_COMMANDS.map((cmd) => {
32162
32229
  const cmdLower = cmd.toLowerCase();
32163
- const fullScore = _internals45.levenshteinDistance(q, cmdLower);
32230
+ const fullScore = _internals46.levenshteinDistance(q, cmdLower);
32164
32231
  let tokenScore = Infinity;
32165
32232
  if (cmd.includes(" ") || cmd.includes("-")) {
32166
32233
  const qTokens = q.split(/[\s-]+/);
@@ -32173,7 +32240,7 @@ function findSimilarCommands(query) {
32173
32240
  for (const ct of cmdTokens) {
32174
32241
  if (ct.length === 0)
32175
32242
  continue;
32176
- const dist = _internals45.levenshteinDistance(qt, ct);
32243
+ const dist = _internals46.levenshteinDistance(qt, ct);
32177
32244
  if (dist < minDist)
32178
32245
  minDist = dist;
32179
32246
  }
@@ -32183,7 +32250,7 @@ function findSimilarCommands(query) {
32183
32250
  }
32184
32251
  const dashStrippedQ = q.replace(/-/g, "");
32185
32252
  const dashStrippedCmd = cmdLower.replace(/-/g, "");
32186
- const dashScore = _internals45.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
32253
+ const dashScore = _internals46.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
32187
32254
  const score = Math.min(fullScore, tokenScore, dashScore);
32188
32255
  return { cmd, score };
32189
32256
  });
@@ -32211,16 +32278,16 @@ function buildDetailedHelp(commandName, entry) {
32211
32278
  async function handleHelpCommand(ctx) {
32212
32279
  const targetCommand = ctx.args.join(" ");
32213
32280
  if (!targetCommand) {
32214
- const { buildHelpText } = await import("./index-xy3gw0rw.js");
32281
+ const { buildHelpText } = await import("./index-ryns3fqt.js");
32215
32282
  return buildHelpText();
32216
32283
  }
32217
32284
  const tokens = targetCommand.split(/\s+/);
32218
- const resolved = _internals45.resolveCommand(tokens);
32285
+ const resolved = _internals46.resolveCommand(tokens);
32219
32286
  if (resolved) {
32220
- return _internals45.buildDetailedHelp(resolved.key, resolved.entry);
32287
+ return _internals46.buildDetailedHelp(resolved.key, resolved.entry);
32221
32288
  }
32222
- const similar = _internals45.findSimilarCommands(targetCommand);
32223
- const { buildHelpText: fullHelp } = await import("./index-xy3gw0rw.js");
32289
+ const similar = _internals46.findSimilarCommands(targetCommand);
32290
+ const { buildHelpText: fullHelp } = await import("./index-ryns3fqt.js");
32224
32291
  if (similar.length > 0) {
32225
32292
  return `Command '/swarm ${targetCommand}' not found.
32226
32293
 
@@ -32284,7 +32351,7 @@ var COMMAND_REGISTRY = {
32284
32351
  toolNoArgs: true
32285
32352
  },
32286
32353
  help: {
32287
- handler: (ctx) => _internals45.handleHelpCommand(ctx),
32354
+ handler: (ctx) => _internals46.handleHelpCommand(ctx),
32288
32355
  description: "Show help for swarm commands",
32289
32356
  category: "core",
32290
32357
  args: "[command]",
@@ -32353,7 +32420,7 @@ var COMMAND_REGISTRY = {
32353
32420
  },
32354
32421
  "guardrail explain": {
32355
32422
  handler: async (ctx) => {
32356
- const { handleGuardrailExplain } = await import("./guardrail-explain-6g1japmf.js");
32423
+ const { handleGuardrailExplain } = await import("./guardrail-explain-t3prwa5b.js");
32357
32424
  return handleGuardrailExplain(ctx.directory, ctx.args);
32358
32425
  },
32359
32426
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -32676,7 +32743,7 @@ Subcommands:
32676
32743
  handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleLoopCommand),
32677
32744
  description: "Enter architect MODE: LOOP \u2014 compound-engineering loop: brainstorm \u2192 plan \u2192 build \u2192 review \u2192 improve, iterating until done [objective]",
32678
32745
  args: "<objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]",
32679
- details: "Triggers the architect to run the compound-engineering loop defined in .opencode/skills/loop/SKILL.md: BRAINSTORM (requirements) \u2192 PLAN (+ critic gate) \u2192 BUILD (execute) \u2192 REVIEW (independent reviewer + critic on the diff, report-only) \u2192 IMPROVE (phase-wrap retrospective + compounding learning capture), then evaluate stop conditions and loop for another improvement cycle if the objective is unmet and budget remains. Generator and reviewer/critic run in separate contexts; failing assertions must be fixed at the root cause, never weakened, mocked, or skipped. Defense-in-depth stop conditions: objective met, --max-cycles budget (default 3), no-progress/plateau, oscillation, unrecoverable error, or explicit user stop. --autonomy checkpoint (default) pauses at phase gates for user approval; --autonomy auto runs unattended with hard stops still enforced. --depth exhaustive widens exploration. --resume continues an existing loop run from durable .swarm/loop/ state. Distinct from full-auto (autonomous cross-phase oversight) and turbo (parallel lanes within a phase): loop is a user-initiated, gated, compounding workflow.",
32746
+ details: "Triggers the architect to run the compound-engineering loop defined in .opencode/skills/loop/SKILL.md: BRAINSTORM (requirements) \u2192 PLAN (+ critic gate) \u2192 BUILD (execute) \u2192 REVIEW (independent reviewer + critic on the diff, report-only) \u2192 IMPROVE (phase-wrap retrospective + compounding learning capture), then evaluate stop conditions and loop for another improvement cycle if the objective is unmet and budget remains. Generator and reviewer/critic run in separate contexts; failing assertions must be fixed at the root cause, never weakened, mocked, or skipped. Defense-in-depth stop conditions: objective met, --max-cycles budget (default 3), no-progress/plateau, oscillation, unrecoverable error, or explicit user stop. --autonomy auto (default) runs unattended with hard stops still enforced; --autonomy checkpoint pauses at phase gates for user approval. --depth exhaustive widens exploration. --resume continues an existing loop run from durable .swarm/loop/ state. Distinct from full-auto (autonomous cross-phase oversight) and turbo (parallel lanes within a phase): loop is a user-initiated, gated, compounding workflow.",
32680
32747
  category: "agent",
32681
32748
  toolPolicy: "none"
32682
32749
  },
@@ -33117,7 +33184,6 @@ var VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
33117
33184
  function validateAliases() {
33118
33185
  const errors = [];
33119
33186
  const warnings = [];
33120
- const aliasTargets = new Map;
33121
33187
  for (const [name, entry] of Object.entries(COMMAND_REGISTRY)) {
33122
33188
  const cmdEntry = entry;
33123
33189
  if (cmdEntry.aliasOf) {
@@ -33126,10 +33192,6 @@ function validateAliases() {
33126
33192
  errors.push(`Alias '${name}' points to non-existent command '${target}'`);
33127
33193
  continue;
33128
33194
  }
33129
- if (!aliasTargets.has(target)) {
33130
- aliasTargets.set(target, []);
33131
- }
33132
- aliasTargets.get(target).push(name);
33133
33195
  const visited = new Set;
33134
33196
  const path64 = [];
33135
33197
  let current = target;
@@ -33153,11 +33215,6 @@ function validateAliases() {
33153
33215
  }
33154
33216
  }
33155
33217
  }
33156
- for (const [target, aliases] of aliasTargets.entries()) {
33157
- if (aliases.length > 1) {
33158
- warnings.push(`Multiple aliases point to '${target}': ${aliases.join(", ")}`);
33159
- }
33160
- }
33161
33218
  return { valid: errors.length === 0, errors, warnings };
33162
33219
  }
33163
33220
  function validateToolPolicy() {
@@ -33172,7 +33229,7 @@ function validateToolPolicy() {
33172
33229
  }
33173
33230
  return { valid: warnings.length === 0, warnings };
33174
33231
  }
33175
- var _internals45 = {
33232
+ var _internals46 = {
33176
33233
  handleHelpCommand,
33177
33234
  validateAliases,
33178
33235
  validateToolPolicy,
@@ -33181,7 +33238,7 @@ var _internals45 = {
33181
33238
  findSimilarCommands,
33182
33239
  buildDetailedHelp
33183
33240
  };
33184
- var validation = _internals45.validateAliases();
33241
+ var validation = _internals46.validateAliases();
33185
33242
  if (!validation.valid) {
33186
33243
  throw new Error(`COMMAND_REGISTRY alias validation failed:
33187
33244
  ${validation.errors.join(`
@@ -33193,7 +33250,7 @@ ${validation.warnings.join(`
33193
33250
  `)}`);
33194
33251
  }
33195
33252
  try {
33196
- const toolPolicyValidation = _internals45.validateToolPolicy();
33253
+ const toolPolicyValidation = _internals46.validateToolPolicy();
33197
33254
  if (toolPolicyValidation.warnings.length > 0) {
33198
33255
  console.warn(`COMMAND_REGISTRY toolPolicy warnings:
33199
33256
  ${toolPolicyValidation.warnings.join(`
@@ -33257,7 +33314,7 @@ function formatCommandNotFound(tokens) {
33257
33314
  const attemptedCommand = tokens[0] || "";
33258
33315
  const MAX_DISPLAY = 100;
33259
33316
  const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
33260
- const similar = _internals45.findSimilarCommands(attemptedCommand);
33317
+ const similar = _internals46.findSimilarCommands(attemptedCommand);
33261
33318
  const header = `Command \`/swarm ${displayCommand}\` not found.`;
33262
33319
  const suggestions = similar.length > 0 ? `Did you mean:
33263
33320
  ${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
@@ -33314,4 +33371,4 @@ ${text}`;
33314
33371
  };
33315
33372
  }
33316
33373
 
33317
- 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, handleClarifyCommand, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, 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, _internals45 as _internals, resolveCommand };
33374
+ 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, handleClarifyCommand, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, 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, _internals46 as _internals, resolveCommand };