opencode-swarm 7.52.2 → 7.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@ var package_default;
69
69
  var init_package = __esm(() => {
70
70
  package_default = {
71
71
  name: "opencode-swarm",
72
- version: "7.52.2",
72
+ version: "7.53.0",
73
73
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
74
74
  main: "dist/index.js",
75
75
  types: "dist/index.d.ts",
@@ -41528,6 +41528,7 @@ __export(exports_state, {
41528
41528
  endAgentSession: () => endAgentSession,
41529
41529
  defaultRunContext: () => defaultRunContext,
41530
41530
  clearCriticalShownIds: () => clearCriticalShownIds,
41531
+ canAdvanceTaskState: () => canAdvanceTaskState,
41531
41532
  buildRehydrationCache: () => buildRehydrationCache,
41532
41533
  beginInvocation: () => beginInvocation,
41533
41534
  applyRehydrationCache: () => applyRehydrationCache,
@@ -41906,14 +41907,6 @@ function advanceTaskState(session, taskId, newState, options, councilConfig) {
41906
41907
  if (!session || !(session.taskWorkflowStates instanceof Map)) {
41907
41908
  throw new Error("INVALID_SESSION: session.taskWorkflowStates must be a Map instance");
41908
41909
  }
41909
- const STATE_ORDER = [
41910
- "idle",
41911
- "coder_delegated",
41912
- "pre_check_passed",
41913
- "reviewer_run",
41914
- "tests_run",
41915
- "complete"
41916
- ];
41917
41910
  const current = session.taskWorkflowStates.get(taskId) ?? "idle";
41918
41911
  const currentIndex = STATE_ORDER.indexOf(current);
41919
41912
  const newIndex = STATE_ORDER.indexOf(newState);
@@ -41930,10 +41923,33 @@ function advanceTaskState(session, taskId, newState, options, councilConfig) {
41930
41923
  }
41931
41924
  }
41932
41925
  session.taskWorkflowStates.set(taskId, newState);
41926
+ if (newState === "complete") {
41927
+ session.stageBCompletion?.delete(taskId);
41928
+ }
41933
41929
  if (options?.emitTelemetry !== false) {
41934
41930
  telemetry.taskStateChanged(options?.telemetrySessionId ?? session.agentName, taskId, newState, current);
41935
41931
  }
41936
41932
  }
41933
+ function canAdvanceTaskState(session, taskId, newState, councilConfig) {
41934
+ if (!isValidTaskId2(taskId))
41935
+ return false;
41936
+ if (!session || !(session.taskWorkflowStates instanceof Map))
41937
+ return false;
41938
+ const current = session.taskWorkflowStates.get(taskId) ?? "idle";
41939
+ const currentIndex = STATE_ORDER.indexOf(current);
41940
+ const newIndex = STATE_ORDER.indexOf(newState);
41941
+ if (newIndex <= currentIndex)
41942
+ return false;
41943
+ if (newState === "complete" && current !== "tests_run") {
41944
+ const councilEntry = session.taskCouncilApproved?.get(taskId);
41945
+ const effectiveMinimum = councilConfig?.requireAllMembers ? 5 : councilConfig?.minimumMembers ?? 3;
41946
+ const councilApproved = councilEntry?.verdict === "APPROVE" && (councilEntry.quorumSize ?? 0) >= effectiveMinimum;
41947
+ const pastPreCheck = currentIndex >= STATE_ORDER.indexOf("pre_check_passed");
41948
+ if (!councilApproved || !pastPreCheck)
41949
+ return false;
41950
+ }
41951
+ return true;
41952
+ }
41937
41953
  async function advanceTaskStateAndPersist(session, taskId, newState, directory, options, councilConfig) {
41938
41954
  advanceTaskState(session, taskId, newState, options, councilConfig);
41939
41955
  if (newState !== "coder_delegated" && newState !== "complete") {
@@ -42104,14 +42120,6 @@ function applyRehydrationCache(session) {
42104
42120
  session.taskCouncilApproved = new Map;
42105
42121
  }
42106
42122
  const { planTaskStates, evidenceMap } = _rehydrationCache;
42107
- const STATE_ORDER = [
42108
- "idle",
42109
- "coder_delegated",
42110
- "pre_check_passed",
42111
- "reviewer_run",
42112
- "tests_run",
42113
- "complete"
42114
- ];
42115
42123
  for (const [taskId, planState] of planTaskStates) {
42116
42124
  const existingState = session.taskWorkflowStates.get(taskId);
42117
42125
  const evidence = evidenceMap.get(taskId);
@@ -42247,7 +42255,7 @@ function addKnowledgeAckDedup(key) {
42247
42255
  set2.delete(oldest);
42248
42256
  }
42249
42257
  }
42250
- var _rehydrationCache = null, _councilDisagreementWarned, _toolAggregates, defaultRunContext, _runContexts, swarmState, MAX_TRACKED_CRITICAL_SHOWN = 500, MAX_TRACKED_KNOWLEDGE_ACKS = 5000, _internals16;
42258
+ var _rehydrationCache = null, _councilDisagreementWarned, STATE_ORDER, _toolAggregates, defaultRunContext, _runContexts, swarmState, MAX_TRACKED_CRITICAL_SHOWN = 500, MAX_TRACKED_KNOWLEDGE_ACKS = 5000, _internals16;
42251
42259
  var init_state = __esm(() => {
42252
42260
  init_constants();
42253
42261
  init_plan_schema();
@@ -42258,6 +42266,14 @@ var init_state = __esm(() => {
42258
42266
  init_telemetry();
42259
42267
  init_logger();
42260
42268
  _councilDisagreementWarned = new Set;
42269
+ STATE_ORDER = [
42270
+ "idle",
42271
+ "coder_delegated",
42272
+ "pre_check_passed",
42273
+ "reviewer_run",
42274
+ "tests_run",
42275
+ "complete"
42276
+ ];
42261
42277
  _toolAggregates = new Map;
42262
42278
  defaultRunContext = new AgentRunContext("default", _toolAggregates);
42263
42279
  _runContexts = new Map;
@@ -73197,7 +73213,7 @@ var init_plan = __esm(() => {
73197
73213
  init_plan_service();
73198
73214
  });
73199
73215
 
73200
- // src/commands/pr-review.ts
73216
+ // src/commands/pr-ref.ts
73201
73217
  import { execSync as execSync3 } from "node:child_process";
73202
73218
  function sanitizeUrl2(raw) {
73203
73219
  let urlStr = raw.trim();
@@ -73216,6 +73232,22 @@ function sanitizeUrl2(raw) {
73216
73232
  }
73217
73233
  return urlStr.trim();
73218
73234
  }
73235
+ function sanitizeInstructions(raw) {
73236
+ const collapsed = raw.replace(/\s+/g, " ").trim();
73237
+ const stripped = collapsed.replace(/\[\s*MODE\s*:[^\]]*\]/gi, "");
73238
+ const normalized = stripped.replace(/\s+/g, " ").trim();
73239
+ if (normalized.length <= MAX_INSTRUCTIONS_LEN)
73240
+ return normalized;
73241
+ return `${normalized.slice(0, MAX_INSTRUCTIONS_LEN)}…`;
73242
+ }
73243
+ function hasNonAsciiHostname(hostname5) {
73244
+ for (const ch of hostname5) {
73245
+ const cp = ch.codePointAt(0);
73246
+ if (cp !== undefined && cp > 127)
73247
+ return true;
73248
+ }
73249
+ return false;
73250
+ }
73219
73251
  function isPrivateHost2(url3) {
73220
73252
  const host = url3.hostname.toLowerCase();
73221
73253
  if (host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "0.0.0.0") {
@@ -73250,8 +73282,7 @@ function validateAndSanitizeUrl2(rawUrl) {
73250
73282
  }
73251
73283
  try {
73252
73284
  const url3 = new URL(sanitized);
73253
- const hostname5 = url3.hostname;
73254
- if (/[\u0080-\u{10FFFF}]/u.test(hostname5)) {
73285
+ if (hasNonAsciiHostname(url3.hostname)) {
73255
73286
  return { error: "Non-ASCII hostnames are not allowed" };
73256
73287
  }
73257
73288
  if (isPrivateHost2(url3)) {
@@ -73268,18 +73299,7 @@ function validateAndSanitizeUrl2(rawUrl) {
73268
73299
  return { error: "Invalid URL format" };
73269
73300
  }
73270
73301
  }
73271
- function parseArgs5(args2) {
73272
- const out2 = { council: false, rest: [] };
73273
- for (const token of args2) {
73274
- if (token === "--council") {
73275
- out2.council = true;
73276
- continue;
73277
- }
73278
- out2.rest.push(token);
73279
- }
73280
- return out2;
73281
- }
73282
- function parsePrRef(input) {
73302
+ function parsePrRef(input, cwd) {
73283
73303
  const urlMatch = input.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)\/?$/i);
73284
73304
  if (urlMatch) {
73285
73305
  return {
@@ -73299,7 +73319,7 @@ function parsePrRef(input) {
73299
73319
  const bareMatch = input.match(/^(\d+)$/);
73300
73320
  if (bareMatch) {
73301
73321
  const prNumber = parseInt(bareMatch[1], 10);
73302
- const remoteUrl = detectGitRemote2();
73322
+ const remoteUrl = detectGitRemote2(cwd);
73303
73323
  if (!remoteUrl) {
73304
73324
  return null;
73305
73325
  }
@@ -73315,12 +73335,13 @@ function parsePrRef(input) {
73315
73335
  }
73316
73336
  return null;
73317
73337
  }
73318
- function detectGitRemote2() {
73338
+ function detectGitRemote2(cwd) {
73319
73339
  try {
73320
- const remoteUrl = execSync3("git remote get-url origin", {
73340
+ const remoteUrl = _internals31.execSync("git remote get-url origin", {
73321
73341
  encoding: "utf-8",
73322
73342
  stdio: ["pipe", "pipe", "pipe"],
73323
- timeout: 5000
73343
+ timeout: 5000,
73344
+ ...cwd ? { cwd } : {}
73324
73345
  }).trim();
73325
73346
  return remoteUrl || null;
73326
73347
  } catch {
@@ -73351,41 +73372,115 @@ function parseGitRemoteUrl2(remoteUrl) {
73351
73372
  }
73352
73373
  return null;
73353
73374
  }
73354
- function handlePrReviewCommand(_directory, args2) {
73355
- const parsed = parseArgs5(args2);
73356
- const rawInput = parsed.rest.join(" ").trim();
73357
- if (!rawInput) {
73358
- return USAGE5;
73375
+ function looksLikePrRef(token) {
73376
+ return /^https?:\/\//i.test(token) || /^[^/]+\/[^#]+#\d+$/.test(token) || /^\d+$/.test(token);
73377
+ }
73378
+ function resolvePrCommandInput(rest, cwd) {
73379
+ if (rest.length === 0) {
73380
+ return null;
73359
73381
  }
73360
- const isFullUrl = /^https?:\/\//i.test(rawInput);
73361
- const prInfo = parsePrRef(isFullUrl ? sanitizeUrl2(rawInput) : rawInput);
73382
+ const refToken = rest[0];
73383
+ const instructions = sanitizeInstructions(rest.slice(1).join(" "));
73384
+ const isFullUrl = /^https?:\/\//i.test(refToken);
73385
+ const prInfo = parsePrRef(isFullUrl ? sanitizeUrl2(refToken) : refToken, cwd);
73362
73386
  if (!prInfo) {
73363
- return `Error: Could not parse PR reference from "${rawInput}"
73364
-
73365
- ${USAGE5}`;
73387
+ return { error: `Could not parse PR reference from "${refToken}"` };
73366
73388
  }
73367
73389
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
73368
73390
  const result = validateAndSanitizeUrl2(prUrl);
73369
73391
  if ("error" in result) {
73370
- return `Error: ${result.error}
73392
+ return { error: result.error };
73393
+ }
73394
+ return { prUrl: result.sanitized, instructions };
73395
+ }
73396
+ var _internals31, MAX_URL_LEN2 = 2048, MAX_INSTRUCTIONS_LEN = 1000;
73397
+ var init_pr_ref = __esm(() => {
73398
+ _internals31 = { execSync: execSync3 };
73399
+ });
73400
+
73401
+ // src/commands/pr-feedback.ts
73402
+ function handlePrFeedbackCommand(directory, args2) {
73403
+ const rest = args2.filter((t) => t.trim().length > 0);
73404
+ if (rest.length === 0) {
73405
+ return "[MODE: PR_FEEDBACK]";
73406
+ }
73407
+ const resolved = resolvePrCommandInput(rest, directory);
73408
+ if (resolved && "prUrl" in resolved) {
73409
+ const signal = `[MODE: PR_FEEDBACK pr="${resolved.prUrl}"]`;
73410
+ return resolved.instructions ? `${signal} ${resolved.instructions}` : signal;
73411
+ }
73412
+ if (resolved && "error" in resolved && looksLikePrRef(rest[0])) {
73413
+ return [
73414
+ `Error: ${resolved.error}`,
73415
+ "",
73416
+ "That looked like a PR reference but could not be resolved. Pass a full",
73417
+ "URL or `owner/repo#N`, or omit the reference to start a no-PR feedback",
73418
+ "session (e.g. `/swarm pr-feedback address the review notes`)."
73419
+ ].join(`
73420
+ `);
73421
+ }
73422
+ const instructions = sanitizeInstructions(rest.join(" "));
73423
+ return instructions ? `[MODE: PR_FEEDBACK] ${instructions}` : "[MODE: PR_FEEDBACK]";
73424
+ }
73425
+ var init_pr_feedback = __esm(() => {
73426
+ init_pr_ref();
73427
+ });
73428
+
73429
+ // src/commands/pr-review.ts
73430
+ function parseArgs5(args2) {
73431
+ const out2 = { council: false, rest: [] };
73432
+ for (const token of args2) {
73433
+ if (token === "--council") {
73434
+ out2.council = true;
73435
+ continue;
73436
+ }
73437
+ if (token.startsWith("--")) {
73438
+ if (out2.unknownFlag === undefined)
73439
+ out2.unknownFlag = token;
73440
+ continue;
73441
+ }
73442
+ if (token.trim().length === 0)
73443
+ continue;
73444
+ out2.rest.push(token);
73445
+ }
73446
+ return out2;
73447
+ }
73448
+ function handlePrReviewCommand(directory, args2) {
73449
+ const parsed = parseArgs5(args2);
73450
+ if (parsed.unknownFlag) {
73451
+ return `Error: Unknown flag "${parsed.unknownFlag}"
73452
+
73453
+ ${USAGE5}`;
73454
+ }
73455
+ const resolved = resolvePrCommandInput(parsed.rest, directory);
73456
+ if (resolved === null) {
73457
+ return USAGE5;
73458
+ }
73459
+ if ("error" in resolved) {
73460
+ return `Error: ${resolved.error}
73371
73461
 
73372
73462
  ${USAGE5}`;
73373
73463
  }
73374
73464
  const councilFlag = parsed.council ? "council=true" : "council=false";
73375
- return `[MODE: PR_REVIEW pr="${result.sanitized}" ${councilFlag}]`;
73465
+ const signal = `[MODE: PR_REVIEW pr="${resolved.prUrl}" ${councilFlag}]`;
73466
+ return resolved.instructions ? `${signal} ${resolved.instructions}` : signal;
73376
73467
  }
73377
- var MAX_URL_LEN2 = 2048, USAGE5;
73468
+ var USAGE5;
73378
73469
  var init_pr_review = __esm(() => {
73470
+ init_pr_ref();
73379
73471
  USAGE5 = [
73380
- "Usage: /swarm pr-review <url|owner/repo#N|N> [--council]",
73472
+ "Usage: /swarm pr-review <url|owner/repo#N|N> [--council] [instructions...]",
73381
73473
  "",
73382
73474
  "Run a full swarm PR review on a GitHub pull request.",
73383
73475
  " /swarm pr-review https://github.com/owner/repo/pull/42",
73384
73476
  " /swarm pr-review owner/repo#42",
73385
73477
  " /swarm pr-review 42 --council",
73478
+ " /swarm pr-review 42 focus on the auth refactor and the new retry logic",
73386
73479
  "",
73387
73480
  "Flags:",
73388
- " --council Run adversarial council variant (all lanes assume work is wrong)"
73481
+ " --council Run adversarial council variant (all lanes assume work is wrong)",
73482
+ "",
73483
+ "Any text after the PR reference is forwarded to the reviewer as extra instructions."
73389
73484
  ].join(`
73390
73485
  `);
73391
73486
  });
@@ -73827,7 +73922,7 @@ async function runAdditionalLint(linter, mode, cwd) {
73827
73922
  };
73828
73923
  }
73829
73924
  }
73830
- var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals31;
73925
+ var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals32;
73831
73926
  var init_lint = __esm(() => {
73832
73927
  init_zod();
73833
73928
  init_discovery();
@@ -73859,15 +73954,15 @@ var init_lint = __esm(() => {
73859
73954
  }
73860
73955
  const { mode } = args2;
73861
73956
  const cwd = directory;
73862
- const linter = await _internals31.detectAvailableLinter(directory);
73957
+ const linter = await _internals32.detectAvailableLinter(directory);
73863
73958
  if (linter) {
73864
- const result = await _internals31.runLint(linter, mode, directory);
73959
+ const result = await _internals32.runLint(linter, mode, directory);
73865
73960
  return JSON.stringify(result, null, 2);
73866
73961
  }
73867
- const additionalLinter = _internals31.detectAdditionalLinter(cwd);
73962
+ const additionalLinter = _internals32.detectAdditionalLinter(cwd);
73868
73963
  if (additionalLinter) {
73869
73964
  warn(`[lint] Using ${additionalLinter} linter for this project`);
73870
- const result = await _internals31.runAdditionalLint(additionalLinter, mode, cwd);
73965
+ const result = await _internals32.runAdditionalLint(additionalLinter, mode, cwd);
73871
73966
  return JSON.stringify(result, null, 2);
73872
73967
  }
73873
73968
  const errorResult = {
@@ -73881,7 +73976,7 @@ For Rust: rustup component add clippy`
73881
73976
  return JSON.stringify(errorResult, null, 2);
73882
73977
  }
73883
73978
  });
73884
- _internals31 = {
73979
+ _internals32 = {
73885
73980
  detectAvailableLinter,
73886
73981
  runLint,
73887
73982
  detectAdditionalLinter,
@@ -74195,7 +74290,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
74195
74290
  }
74196
74291
  async function runSecretscan(directory) {
74197
74292
  try {
74198
- const result = await _internals32.secretscan.execute({ directory }, {});
74293
+ const result = await _internals33.secretscan.execute({ directory }, {});
74199
74294
  const jsonStr = typeof result === "string" ? result : result.output;
74200
74295
  return JSON.parse(jsonStr);
74201
74296
  } catch (e) {
@@ -74210,7 +74305,7 @@ async function runSecretscan(directory) {
74210
74305
  return errorResult;
74211
74306
  }
74212
74307
  }
74213
- var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS2, O_NOFOLLOW, secretscan, _internals32;
74308
+ var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS2, O_NOFOLLOW, secretscan, _internals33;
74214
74309
  var init_secretscan = __esm(() => {
74215
74310
  init_zod();
74216
74311
  init_path_security();
@@ -74582,7 +74677,7 @@ var init_secretscan = __esm(() => {
74582
74677
  }
74583
74678
  }
74584
74679
  });
74585
- _internals32 = {
74680
+ _internals33 = {
74586
74681
  secretscan,
74587
74682
  runSecretscan
74588
74683
  };
@@ -75174,14 +75269,14 @@ function buildGoBackend() {
75174
75269
  selectEntryPoints
75175
75270
  };
75176
75271
  }
75177
- var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals33;
75272
+ var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals34;
75178
75273
  var init_go = __esm(() => {
75179
75274
  init_default_backend();
75180
75275
  init_profiles();
75181
75276
  IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
75182
75277
  IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
75183
75278
  IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
75184
- _internals33 = { extractImports };
75279
+ _internals34 = { extractImports };
75185
75280
  });
75186
75281
 
75187
75282
  // src/lang/backends/python.ts
@@ -75293,13 +75388,13 @@ function buildPythonBackend() {
75293
75388
  selectEntryPoints: selectEntryPoints2
75294
75389
  };
75295
75390
  }
75296
- var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals34;
75391
+ var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals35;
75297
75392
  var init_python = __esm(() => {
75298
75393
  init_default_backend();
75299
75394
  init_profiles();
75300
75395
  IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
75301
75396
  IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
75302
- _internals34 = { extractImports: extractImports2 };
75397
+ _internals35 = { extractImports: extractImports2 };
75303
75398
  });
75304
75399
 
75305
75400
  // src/test-impact/analyzer.ts
@@ -75523,7 +75618,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
75523
75618
  return;
75524
75619
  }
75525
75620
  if (PYTHON_EXTENSIONS.has(ext)) {
75526
- const modules = _internals34.extractImports(testFile, content);
75621
+ const modules = _internals35.extractImports(testFile, content);
75527
75622
  for (const mod of modules) {
75528
75623
  const resolved = resolvePythonImport(testDir, mod);
75529
75624
  if (resolved !== null)
@@ -75532,7 +75627,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
75532
75627
  return;
75533
75628
  }
75534
75629
  if (GO_EXTENSIONS.has(ext)) {
75535
- const imports = _internals33.extractImports(testFile, content);
75630
+ const imports = _internals34.extractImports(testFile, content);
75536
75631
  for (const importPath of imports) {
75537
75632
  const sourceFiles = resolveGoImport(testDir, importPath);
75538
75633
  for (const source of sourceFiles)
@@ -75559,8 +75654,8 @@ async function buildImpactMapInternal(cwd) {
75559
75654
  return impactMap;
75560
75655
  }
75561
75656
  async function buildImpactMap(cwd) {
75562
- const impactMap = await _internals35.buildImpactMapInternal(cwd);
75563
- await _internals35.saveImpactMap(cwd, impactMap);
75657
+ const impactMap = await _internals36.buildImpactMapInternal(cwd);
75658
+ await _internals36.saveImpactMap(cwd, impactMap);
75564
75659
  return impactMap;
75565
75660
  }
75566
75661
  async function loadImpactMap(cwd, options) {
@@ -75574,7 +75669,7 @@ async function loadImpactMap(cwd, options) {
75574
75669
  const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
75575
75670
  if (hasValidValues) {
75576
75671
  const generatedAt = new Date(data.generatedAt).getTime();
75577
- if (!_internals35.isCacheStale(map3, generatedAt)) {
75672
+ if (!_internals36.isCacheStale(map3, generatedAt)) {
75578
75673
  return map3;
75579
75674
  }
75580
75675
  if (options?.skipRebuild) {
@@ -75594,13 +75689,13 @@ async function loadImpactMap(cwd, options) {
75594
75689
  if (options?.skipRebuild) {
75595
75690
  return {};
75596
75691
  }
75597
- return _internals35.buildImpactMap(cwd);
75692
+ return _internals36.buildImpactMap(cwd);
75598
75693
  }
75599
75694
  async function saveImpactMap(cwd, impactMap) {
75600
75695
  if (!path55.isAbsolute(cwd)) {
75601
75696
  throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
75602
75697
  }
75603
- _internals35.validateProjectRoot(cwd);
75698
+ _internals36.validateProjectRoot(cwd);
75604
75699
  const cacheDir2 = path55.join(cwd, ".swarm", "cache");
75605
75700
  const cachePath = path55.join(cacheDir2, "impact-map.json");
75606
75701
  if (!fs28.existsSync(cacheDir2)) {
@@ -75624,7 +75719,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
75624
75719
  };
75625
75720
  }
75626
75721
  const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
75627
- const impactMap = await _internals35.loadImpactMap(cwd);
75722
+ const impactMap = await _internals36.loadImpactMap(cwd);
75628
75723
  const impactedTestsSet = new Set;
75629
75724
  const untestedFiles = [];
75630
75725
  let visitedCount = 0;
@@ -75709,7 +75804,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
75709
75804
  budgetExceeded
75710
75805
  };
75711
75806
  }
75712
- var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals35;
75807
+ var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals36;
75713
75808
  var init_analyzer = __esm(() => {
75714
75809
  init_manager2();
75715
75810
  init_go();
@@ -75722,7 +75817,7 @@ var init_analyzer = __esm(() => {
75722
75817
  GO_EXTENSIONS = new Set([".go"]);
75723
75818
  EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
75724
75819
  goModuleCache = new Map;
75725
- _internals35 = {
75820
+ _internals36 = {
75726
75821
  validateProjectRoot,
75727
75822
  normalizePath,
75728
75823
  isCacheStale,
@@ -76058,7 +76153,7 @@ function batchAppendTestRuns(records, workingDir) {
76058
76153
  }
76059
76154
  const historyPath = getHistoryPath(workingDir);
76060
76155
  const historyDir = path56.dirname(historyPath);
76061
- _internals36.validateProjectRoot(workingDir);
76156
+ _internals37.validateProjectRoot(workingDir);
76062
76157
  if (!fs29.existsSync(historyDir)) {
76063
76158
  fs29.mkdirSync(historyDir, { recursive: true });
76064
76159
  }
@@ -76181,7 +76276,7 @@ function getAllHistory(workingDir) {
76181
76276
  records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
76182
76277
  return records;
76183
76278
  }
76184
- var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals36;
76279
+ var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals37;
76185
76280
  var init_history_store = __esm(() => {
76186
76281
  init_manager2();
76187
76282
  DANGEROUS_PROPERTY_NAMES = new Set([
@@ -76189,7 +76284,7 @@ var init_history_store = __esm(() => {
76189
76284
  "constructor",
76190
76285
  "prototype"
76191
76286
  ]);
76192
- _internals36 = {
76287
+ _internals37 = {
76193
76288
  validateProjectRoot
76194
76289
  };
76195
76290
  });
@@ -76315,7 +76410,7 @@ function readPackageJsonRaw(dir) {
76315
76410
  }
76316
76411
  }
76317
76412
  function readPackageJson(dir) {
76318
- return _internals37.readPackageJsonRaw(dir);
76413
+ return _internals38.readPackageJsonRaw(dir);
76319
76414
  }
76320
76415
  function readPackageJsonTestScript(dir) {
76321
76416
  return readPackageJson(dir)?.scripts?.test ?? null;
@@ -76485,7 +76580,7 @@ function buildTypescriptBackend() {
76485
76580
  selectEntryPoints: selectEntryPoints3
76486
76581
  };
76487
76582
  }
76488
- var PROFILE_ID3 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals37;
76583
+ var PROFILE_ID3 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals38;
76489
76584
  var init_typescript = __esm(() => {
76490
76585
  init_default_backend();
76491
76586
  init_profiles();
@@ -76494,7 +76589,7 @@ var init_typescript = __esm(() => {
76494
76589
  IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
76495
76590
  IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
76496
76591
  IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
76497
- _internals37 = {
76592
+ _internals38 = {
76498
76593
  readPackageJsonRaw,
76499
76594
  readPackageJsonTestScript,
76500
76595
  frameworkFromScriptsTest
@@ -76525,7 +76620,7 @@ __export(exports_dispatch, {
76525
76620
  pickedProfiles: () => pickedProfiles,
76526
76621
  pickBackend: () => pickBackend,
76527
76622
  clearDispatchCache: () => clearDispatchCache,
76528
- _internals: () => _internals38
76623
+ _internals: () => _internals39
76529
76624
  });
76530
76625
  import * as fs32 from "node:fs";
76531
76626
  import * as path59 from "node:path";
@@ -76580,7 +76675,7 @@ function findManifestRoot(start2) {
76580
76675
  return start2;
76581
76676
  }
76582
76677
  function evictIfNeeded() {
76583
- if (cache.size <= _internals38.cacheCapacity)
76678
+ if (cache.size <= _internals39.cacheCapacity)
76584
76679
  return;
76585
76680
  let oldestKey;
76586
76681
  let oldestOrder = Infinity;
@@ -76611,7 +76706,7 @@ async function pickBackend(dir) {
76611
76706
  evictIfNeeded();
76612
76707
  return null;
76613
76708
  }
76614
- const profiles = await _internals38.detectProjectLanguages(root);
76709
+ const profiles = await _internals39.detectProjectLanguages(root);
76615
76710
  if (profiles.length === 0) {
76616
76711
  cache.set(cacheKey, {
76617
76712
  hash: hash3,
@@ -76643,12 +76738,12 @@ function clearDispatchCache() {
76643
76738
  manifestRootCache.clear();
76644
76739
  insertCounter = 0;
76645
76740
  }
76646
- var _internals38, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
76741
+ var _internals39, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
76647
76742
  var init_dispatch = __esm(() => {
76648
76743
  init_backends();
76649
76744
  init_detector();
76650
76745
  init_registry_backend();
76651
- _internals38 = {
76746
+ _internals39 = {
76652
76747
  detectProjectLanguages,
76653
76748
  cacheCapacity: 64
76654
76749
  };
@@ -78505,9 +78600,9 @@ function getVersionFileVersion(dir) {
78505
78600
  async function runVersionCheck2(dir, _timeoutMs) {
78506
78601
  const startTime = Date.now();
78507
78602
  try {
78508
- const packageVersion = _internals39.getPackageVersion(dir);
78509
- const changelogVersion = _internals39.getChangelogVersion(dir);
78510
- const versionFileVersion = _internals39.getVersionFileVersion(dir);
78603
+ const packageVersion = _internals40.getPackageVersion(dir);
78604
+ const changelogVersion = _internals40.getChangelogVersion(dir);
78605
+ const versionFileVersion = _internals40.getVersionFileVersion(dir);
78511
78606
  const versions3 = [];
78512
78607
  if (packageVersion)
78513
78608
  versions3.push(`package.json: ${packageVersion}`);
@@ -78872,7 +78967,7 @@ async function runPreflight(dir, phase, config3) {
78872
78967
  const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
78873
78968
  let validatedDir;
78874
78969
  try {
78875
- validatedDir = _internals39.validateDirectoryPath(dir);
78970
+ validatedDir = _internals40.validateDirectoryPath(dir);
78876
78971
  } catch (error93) {
78877
78972
  return {
78878
78973
  id: reportId,
@@ -78892,7 +78987,7 @@ async function runPreflight(dir, phase, config3) {
78892
78987
  }
78893
78988
  let validatedTimeout;
78894
78989
  try {
78895
- validatedTimeout = _internals39.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
78990
+ validatedTimeout = _internals40.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
78896
78991
  } catch (error93) {
78897
78992
  return {
78898
78993
  id: reportId,
@@ -78933,12 +79028,12 @@ async function runPreflight(dir, phase, config3) {
78933
79028
  });
78934
79029
  const checks5 = [];
78935
79030
  log("[Preflight] Running lint check...");
78936
- const lintResult = await _internals39.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
79031
+ const lintResult = await _internals40.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
78937
79032
  checks5.push(lintResult);
78938
79033
  log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
78939
79034
  if (!cfg.skipTests) {
78940
79035
  log("[Preflight] Running tests check...");
78941
- const testsResult = await _internals39.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
79036
+ const testsResult = await _internals40.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
78942
79037
  checks5.push(testsResult);
78943
79038
  log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
78944
79039
  } else {
@@ -78950,7 +79045,7 @@ async function runPreflight(dir, phase, config3) {
78950
79045
  }
78951
79046
  if (!cfg.skipSecrets) {
78952
79047
  log("[Preflight] Running secrets check...");
78953
- const secretsResult = await _internals39.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
79048
+ const secretsResult = await _internals40.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
78954
79049
  checks5.push(secretsResult);
78955
79050
  log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
78956
79051
  } else {
@@ -78962,7 +79057,7 @@ async function runPreflight(dir, phase, config3) {
78962
79057
  }
78963
79058
  if (!cfg.skipEvidence) {
78964
79059
  log("[Preflight] Running evidence check...");
78965
- const evidenceResult = await _internals39.runEvidenceCheck(validatedDir);
79060
+ const evidenceResult = await _internals40.runEvidenceCheck(validatedDir);
78966
79061
  checks5.push(evidenceResult);
78967
79062
  log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
78968
79063
  } else {
@@ -78973,12 +79068,12 @@ async function runPreflight(dir, phase, config3) {
78973
79068
  });
78974
79069
  }
78975
79070
  log("[Preflight] Running requirement coverage check...");
78976
- const reqCoverageResult = await _internals39.runRequirementCoverageCheck(validatedDir, phase);
79071
+ const reqCoverageResult = await _internals40.runRequirementCoverageCheck(validatedDir, phase);
78977
79072
  checks5.push(reqCoverageResult);
78978
79073
  log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
78979
79074
  if (!cfg.skipVersion) {
78980
79075
  log("[Preflight] Running version check...");
78981
- const versionResult = await _internals39.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
79076
+ const versionResult = await _internals40.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
78982
79077
  checks5.push(versionResult);
78983
79078
  log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
78984
79079
  } else {
@@ -79041,10 +79136,10 @@ function formatPreflightMarkdown(report) {
79041
79136
  async function handlePreflightCommand(directory, _args) {
79042
79137
  const plan = await loadPlan(directory);
79043
79138
  const phase = plan?.current_phase ?? 1;
79044
- const report = await _internals39.runPreflight(directory, phase);
79045
- return _internals39.formatPreflightMarkdown(report);
79139
+ const report = await _internals40.runPreflight(directory, phase);
79140
+ return _internals40.formatPreflightMarkdown(report);
79046
79141
  }
79047
- var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals39;
79142
+ var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals40;
79048
79143
  var init_preflight_service = __esm(() => {
79049
79144
  init_gate_bridge();
79050
79145
  init_manager2();
@@ -79062,7 +79157,7 @@ var init_preflight_service = __esm(() => {
79062
79157
  testScope: "convention",
79063
79158
  linter: "biome"
79064
79159
  };
79065
- _internals39 = {
79160
+ _internals40 = {
79066
79161
  runPreflight,
79067
79162
  formatPreflightMarkdown,
79068
79163
  handlePreflightCommand,
@@ -80957,7 +81052,7 @@ async function getStatusData(directory, agents) {
80957
81052
  }
80958
81053
  function enrichWithLeanTurbo(status, directory) {
80959
81054
  const turboMode = hasActiveTurboMode();
80960
- const leanActive = _internals40.hasActiveLeanTurbo();
81055
+ const leanActive = _internals41.hasActiveLeanTurbo();
80961
81056
  let turboStrategy = "off";
80962
81057
  if (leanActive) {
80963
81058
  turboStrategy = "lean";
@@ -80976,7 +81071,7 @@ function enrichWithLeanTurbo(status, directory) {
80976
81071
  }
80977
81072
  }
80978
81073
  if (leanSessionID) {
80979
- const runState = _internals40.loadLeanTurboRunState(directory, leanSessionID);
81074
+ const runState = _internals41.loadLeanTurboRunState(directory, leanSessionID);
80980
81075
  if (runState) {
80981
81076
  status.leanTurboPhase = runState.phase;
80982
81077
  status.leanMaxParallelCoders = runState.maxParallelCoders;
@@ -81008,7 +81103,7 @@ function enrichWithLeanTurbo(status, directory) {
81008
81103
  }
81009
81104
  }
81010
81105
  }
81011
- status.fullAutoActive = _internals40.hasActiveFullAuto();
81106
+ status.fullAutoActive = _internals41.hasActiveFullAuto();
81012
81107
  return status;
81013
81108
  }
81014
81109
  function formatStatusMarkdown(status) {
@@ -81090,7 +81185,7 @@ async function handleStatusCommand(directory, agents) {
81090
81185
  }
81091
81186
  return formatStatusMarkdown(statusData);
81092
81187
  }
81093
- var _internals40;
81188
+ var _internals41;
81094
81189
  var init_status_service = __esm(() => {
81095
81190
  init_extractors();
81096
81191
  init_utils2();
@@ -81099,7 +81194,7 @@ var init_status_service = __esm(() => {
81099
81194
  init_state3();
81100
81195
  init_compaction_service();
81101
81196
  init_context_budget_service();
81102
- _internals40 = {
81197
+ _internals41 = {
81103
81198
  loadLeanTurboRunState,
81104
81199
  hasActiveLeanTurbo,
81105
81200
  hasActiveFullAuto
@@ -81190,7 +81285,7 @@ async function handleTurboCommand(directory, args2, sessionID) {
81190
81285
  if (arg0 === "on") {
81191
81286
  let strategy = "standard";
81192
81287
  try {
81193
- const { config: config3 } = _internals41.loadPluginConfigWithMeta(directory);
81288
+ const { config: config3 } = _internals42.loadPluginConfigWithMeta(directory);
81194
81289
  if (config3.turbo?.strategy === "lean") {
81195
81290
  strategy = "lean";
81196
81291
  }
@@ -81245,7 +81340,7 @@ function enableLeanTurbo(session, directory, sessionID) {
81245
81340
  let maxParallelCoders = 4;
81246
81341
  let conflictPolicy = "serialize";
81247
81342
  try {
81248
- const { config: config3 } = _internals41.loadPluginConfigWithMeta(directory);
81343
+ const { config: config3 } = _internals42.loadPluginConfigWithMeta(directory);
81249
81344
  const leanConfig = config3.turbo?.lean;
81250
81345
  if (leanConfig) {
81251
81346
  maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
@@ -81315,13 +81410,13 @@ function buildStatusMessage2(session, directory, sessionID) {
81315
81410
  ].join(`
81316
81411
  `);
81317
81412
  }
81318
- var _internals41;
81413
+ var _internals42;
81319
81414
  var init_turbo = __esm(() => {
81320
81415
  init_config();
81321
81416
  init_state();
81322
81417
  init_state3();
81323
81418
  init_logger();
81324
- _internals41 = {
81419
+ _internals42 = {
81325
81420
  loadPluginConfigWithMeta
81326
81421
  };
81327
81422
  });
@@ -81414,7 +81509,7 @@ function formatCommandNotFound(tokens) {
81414
81509
  const attemptedCommand = tokens[0] || "";
81415
81510
  const MAX_DISPLAY = 100;
81416
81511
  const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
81417
- const similar = _internals42.findSimilarCommands(attemptedCommand);
81512
+ const similar = _internals43.findSimilarCommands(attemptedCommand);
81418
81513
  const header = `Command \`/swarm ${displayCommand}\` not found.`;
81419
81514
  const suggestions = similar.length > 0 ? `Did you mean:
81420
81515
  ${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
@@ -81916,7 +82011,7 @@ async function buildSwarmCommandPrompt(args2) {
81916
82011
  activeAgentName,
81917
82012
  registeredAgents
81918
82013
  } = args2;
81919
- const resolved = _internals42.resolveCommand(tokens);
82014
+ const resolved = _internals43.resolveCommand(tokens);
81920
82015
  if (!resolved) {
81921
82016
  if (tokens.length === 0) {
81922
82017
  return buildHelpText();
@@ -81977,6 +82072,19 @@ function agentHasSwarmCommandTool(activeAgentName, agents, registeredAgents) {
81977
82072
  return AGENT_TOOL_MAP[baseName]?.includes("swarm_command") === true;
81978
82073
  }
81979
82074
  function formatCanonicalPromptFallback(args2) {
82075
+ if (/^\s*\[MODE:/.test(args2.text)) {
82076
+ return [
82077
+ `The user typed \`${args2.original}\`.`,
82078
+ "The line below is a swarm MODE-activation signal, NOT output to display.",
82079
+ "Enter the mode named in its `[MODE: X ...]` header now: follow your",
82080
+ 'prompt’s "### MODE: X" section, load the SKILL.md it references, and',
82081
+ "follow that protocol exactly. Treat any text after the closing bracket as",
82082
+ "additional instructions. Do NOT echo this signal verbatim.",
82083
+ "",
82084
+ args2.text
82085
+ ].join(`
82086
+ `);
82087
+ }
81980
82088
  return [
81981
82089
  `The user typed \`${args2.original}\`.`,
81982
82090
  "Canonical opencode-swarm command output follows.",
@@ -82069,7 +82177,7 @@ function findSimilarCommands(query) {
82069
82177
  }
82070
82178
  const scored = VALID_COMMANDS.map((cmd) => {
82071
82179
  const cmdLower = cmd.toLowerCase();
82072
- const fullScore = _internals42.levenshteinDistance(q, cmdLower);
82180
+ const fullScore = _internals43.levenshteinDistance(q, cmdLower);
82073
82181
  let tokenScore = Infinity;
82074
82182
  if (cmd.includes(" ") || cmd.includes("-")) {
82075
82183
  const qTokens = q.split(/[\s-]+/);
@@ -82082,7 +82190,7 @@ function findSimilarCommands(query) {
82082
82190
  for (const ct of cmdTokens) {
82083
82191
  if (ct.length === 0)
82084
82192
  continue;
82085
- const dist = _internals42.levenshteinDistance(qt, ct);
82193
+ const dist = _internals43.levenshteinDistance(qt, ct);
82086
82194
  if (dist < minDist)
82087
82195
  minDist = dist;
82088
82196
  }
@@ -82092,7 +82200,7 @@ function findSimilarCommands(query) {
82092
82200
  }
82093
82201
  const dashStrippedQ = q.replace(/-/g, "");
82094
82202
  const dashStrippedCmd = cmdLower.replace(/-/g, "");
82095
- const dashScore = _internals42.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
82203
+ const dashScore = _internals43.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
82096
82204
  const score = Math.min(fullScore, tokenScore, dashScore);
82097
82205
  return { cmd, score };
82098
82206
  });
@@ -82124,11 +82232,11 @@ async function handleHelpCommand(ctx) {
82124
82232
  return buildHelpText2();
82125
82233
  }
82126
82234
  const tokens = targetCommand.split(/\s+/);
82127
- const resolved = _internals42.resolveCommand(tokens);
82235
+ const resolved = _internals43.resolveCommand(tokens);
82128
82236
  if (resolved) {
82129
- return _internals42.buildDetailedHelp(resolved.key, resolved.entry);
82237
+ return _internals43.buildDetailedHelp(resolved.key, resolved.entry);
82130
82238
  }
82131
- const similar = _internals42.findSimilarCommands(targetCommand);
82239
+ const similar = _internals43.findSimilarCommands(targetCommand);
82132
82240
  const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
82133
82241
  if (similar.length > 0) {
82134
82242
  return `Command '/swarm ${targetCommand}' not found.
@@ -82222,7 +82330,7 @@ function resolveCommand(tokens) {
82222
82330
  }
82223
82331
  return null;
82224
82332
  }
82225
- var COMMAND_REGISTRY, VALID_COMMANDS, _internals42, validation;
82333
+ var COMMAND_REGISTRY, VALID_COMMANDS, _internals43, validation;
82226
82334
  var init_registry = __esm(() => {
82227
82335
  init_acknowledge_spec_drift();
82228
82336
  init_agents();
@@ -82248,6 +82356,7 @@ var init_registry = __esm(() => {
82248
82356
  init_knowledge();
82249
82357
  init_memory2();
82250
82358
  init_plan();
82359
+ init_pr_feedback();
82251
82360
  init_pr_review();
82252
82361
  init_preflight();
82253
82362
  init_promote();
@@ -82295,7 +82404,7 @@ var init_registry = __esm(() => {
82295
82404
  clashesWithNativeCcCommand: "/agents"
82296
82405
  },
82297
82406
  help: {
82298
- handler: (ctx) => _internals42.handleHelpCommand(ctx),
82407
+ handler: (ctx) => _internals43.handleHelpCommand(ctx),
82299
82408
  description: "Show help for swarm commands",
82300
82409
  category: "core",
82301
82410
  args: "[command]",
@@ -82538,6 +82647,13 @@ Subcommands:
82538
82647
  details: "Launches a structured PR review: reconstructs PR intent via obligation extraction cascade, runs 6 parallel explorer lanes (correctness, security, dependencies, docs-intent-vs-actual, tests, performance-architecture), validates findings through independent reviewer confirmation, applies critic challenge to HIGH/CRITICAL findings, synthesizes structured report. --council variant fires adversarial multi-model review. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolves against origin remote).",
82539
82648
  category: "agent"
82540
82649
  },
82650
+ "pr-feedback": {
82651
+ handler: async (ctx) => handlePrFeedbackCommand(ctx.directory, ctx.args),
82652
+ description: "Ingest and close known PR feedback (review comments, CI failures, conflicts) [pr] [instructions]",
82653
+ args: "[url|owner/repo#N|N] [instructions...]",
82654
+ details: "Triggers MODE: PR_FEEDBACK — ingests existing pull-request feedback (review threads, requested changes, CI/check failures, merge conflicts, stale branch state, pasted notes), verifies every claim against source, clusters related problems, fixes confirmed items, validates the branch, and reports closure status for every ledger item. Distinct from /swarm pr-review, which discovers new findings. The PR reference is optional: with none, the architect builds the ledger from the current PR/branch; text after the reference is forwarded as extra instructions. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolved against origin).",
82655
+ category: "agent"
82656
+ },
82541
82657
  "deep-dive": {
82542
82658
  handler: async (ctx) => handleDeepDiveCommand(ctx.directory, ctx.args),
82543
82659
  description: "Launch deep codebase audit with parallel explorer waves, dual reviewers, and critic challenge [scope]",
@@ -82766,7 +82882,7 @@ Subcommands:
82766
82882
  }
82767
82883
  };
82768
82884
  VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
82769
- _internals42 = {
82885
+ _internals43 = {
82770
82886
  handleHelpCommand,
82771
82887
  validateAliases,
82772
82888
  resolveCommand,
@@ -82774,7 +82890,7 @@ Subcommands:
82774
82890
  findSimilarCommands,
82775
82891
  buildDetailedHelp
82776
82892
  };
82777
- validation = _internals42.validateAliases();
82893
+ validation = _internals43.validateAliases();
82778
82894
  if (!validation.valid) {
82779
82895
  throw new Error(`COMMAND_REGISTRY alias validation failed:
82780
82896
  ${validation.errors.join(`
@@ -83184,7 +83300,7 @@ ${archBlock}`;
83184
83300
  }
83185
83301
  }
83186
83302
  if (!designDocsEnabled) {
83187
- prompt = prompt?.replace(", {{AGENT_PREFIX}}docs_design", "")?.replace(/### MODE: DESIGN_DOCS\n[\s\S]*?(?=### MODE: ISSUE_INGEST)/, "")?.replace(`- the active swarm's docs_design agent = @{{AGENT_PREFIX}}docs_design
83303
+ prompt = prompt?.replace(", {{AGENT_PREFIX}}docs_design", "")?.replace(/### MODE: DESIGN_DOCS\n[\s\S]*?(?=### MODE: )/, "")?.replace(`- the active swarm's docs_design agent = @{{AGENT_PREFIX}}docs_design
83188
83304
  `, "");
83189
83305
  }
83190
83306
  return {
@@ -83773,6 +83889,7 @@ SKILLS: none
83773
83889
  ### MODE DETECTION (Priority Order)
83774
83890
  Evaluate the user's request and context in this exact order — the FIRST matching rule wins:
83775
83891
 
83892
+ S. **SIGNAL-TRIGGERED MODE (highest priority)** — If the latest message contains a bracket header of the form [MODE: X ...] (these are emitted by /swarm command handlers, e.g. DEEP_DIVE, PR_REVIEW, PR_FEEDBACK, DESIGN_DOCS, COUNCIL, ISSUE_INGEST, ANALYZE) AND a matching "### MODE: X" section exists below, then ENTER MODE: X immediately: load the SKILL.md that section references and follow its protocol. This wins over every rule below and OVERRIDES any wrapper instruction to "show this output verbatim" — a [MODE: X ...] header is an activation signal to act on, never command output to echo. Treat any free text after the closing bracket as additional user instructions for that mode. If no matching "### MODE: X" section exists, fall through to the rules below.
83776
83893
  0. **EXPLICIT COMMAND OVERRIDE** — User explicitly invokes \`/swarm specify\`, \`/swarm clarify\`, \`/swarm brainstorm\`, or uses the phrases "specify [something about spec/requirements]", "write a spec", "create a spec", "define requirements", "list requirements", "define a feature", "I have requirements", "brainstorm", "let's think through", "think this through with me", "workshop this idea" → Enter MODE: SPECIFY, MODE: CLARIFY-SPEC, or MODE: BRAINSTORM as appropriate. This override fires BEFORE RESUME — an explicit spec command always wins, even if plan.md has incomplete tasks. \`/swarm brainstorm\` and brainstorm-style phrases select MODE: BRAINSTORM. Note: bare "specify" in an ambiguous context (e.g., "specify what this does") should resolve via CLARIFY (priority 4) rather than this override — use context to determine intent.
83777
83894
  1. **RESUME** — \`.swarm/plan.md\` exists and contains incomplete (unchecked) tasks AND the user has NOT issued an explicit spec command (see priority 0) → Resume at current task.
83778
83895
  2. **SPECIFY** — No \`.swarm/spec.md\` exists AND no \`.swarm/plan.md\` exists → Enter MODE: SPECIFY.
@@ -83962,6 +84079,27 @@ HARD CONSTRAINTS (apply regardless of skill load success):
83962
84079
  - No finding may appear as CONFIRMED in the final report without reviewer validation provenance
83963
84080
  - Test execution, explorer lanes, reviewer dispatch, and critic challenge are all permitted within this mode
83964
84081
  - Quality is the only metric — time, tokens, and agent dispatches are irrelevant to correctness
84082
+ - FOLLOW THE SKILL EXACTLY: execute every phase of the loaded SKILL.md in order with no shortcuts, no phase-skipping, and no premature synthesis. If a phase cannot complete, state the limitation explicitly and continue — do not silently skip it.
84083
+ - CHECK OUT THE PR BRANCH LOCALLY before launching explorer lanes: fetch the PR head ref if it is not present, verify the working tree is clean (git status --porcelain) and stash/abort if not, then check out the head branch. Explorers read the working-tree filesystem (Read/Glob/Grep), so without a checkout they read the base branch and produce invalid candidates. Always pass the base..head commit range in explorer delegations.
84084
+ - RUN THE TRIGGERED MICRO-LANES: after the base explorer lanes start, inspect the context pack risk triggers and launch every matching Swarm plugin micro-lane from the skill's risk-trigger map (launch only triggered lanes, never irrelevant ones). Do not skip micro-lanes that match the diff.
84085
+ - Honor any free-text instructions that follow the closing bracket of the signal as additional reviewer focus, without weakening the validation ladder above.
84086
+
84087
+ ### MODE: PR_FEEDBACK
84088
+ Activates when: architect receives \`[MODE: PR_FEEDBACK pr="https://github.com/..."]\` (PR reference optional) signal from the pr-feedback command handler, optionally followed by free-text instructions.
84089
+
84090
+ Purpose: Ingest and resolve KNOWN pull-request feedback — review threads, requested changes, CI/check failures, merge conflicts, stale branch state, and pasted notes — verifying every claim against source before fixing. This is NOT a fresh broad PR review; use MODE: PR_REVIEW for new-finding discovery.
84091
+
84092
+ ACTION: Load skill file:.opencode/skills/swarm-pr-feedback/SKILL.md immediately and follow its protocol.
84093
+
84094
+ HARD CONSTRAINTS (apply regardless of skill load success):
84095
+ - FOLLOW THE SKILL EXACTLY: build the complete feedback ledger from all available sources before editing, and execute every phase in order with no shortcuts.
84096
+ - CHECK OUT THE PR BRANCH LOCALLY before verifying feedback or making fixes: fetch the PR head ref if absent, verify the working tree is clean (git status --porcelain) and stash/abort if not, then check out the head branch. Feedback verification and fix validation require the PR branch in the working tree.
84097
+ - Do NOT run a fresh broad PR review — inspect adjacent code only as needed to verify reachability, dependencies, shared root causes, regression risk, or sibling changes for a confirmed item.
84098
+ - Treat every review comment, CI failure, bot summary, and pasted note as a CLAIM until source evidence proves it; classify each ledger item (CONFIRMED, DISPROVED, PRE_EXISTING, or NEEDS_USER_DECISION) and never silently drop, defer, or mark items out of scope.
84099
+ - Patch only confirmed items plus the tests/docs they require; report closure status for every ledger item including disproved ones.
84100
+ - Do NOT resolve or mark GitHub review threads resolved unless the user explicitly instructs it.
84101
+ - Honor any free-text instructions that follow the closing bracket of the signal as additional scope, without dropping any ledger item.
84102
+ - Quality is the only metric — time, tokens, and agent dispatches are irrelevant to correctness
83965
84103
 
83966
84104
  ### MODE: ISSUE_INGEST
83967
84105
  Activates when the user invokes /swarm issue <url> or the architect receives an ISSUE_INGEST signal.
@@ -91174,7 +91312,7 @@ __export(exports_runtime, {
91174
91312
  getSupportedLanguages: () => getSupportedLanguages,
91175
91313
  getInitializedLanguages: () => getInitializedLanguages,
91176
91314
  clearParserCache: () => clearParserCache,
91177
- _internals: () => _internals51
91315
+ _internals: () => _internals52
91178
91316
  });
91179
91317
  import * as path99 from "node:path";
91180
91318
  import { fileURLToPath as fileURLToPath4 } from "node:url";
@@ -91184,10 +91322,10 @@ async function initTreeSitter() {
91184
91322
  const thisDir = path99.dirname(fileURLToPath4(import.meta.url));
91185
91323
  const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
91186
91324
  if (isSource) {
91187
- await _internals51.parserInit();
91325
+ await _internals52.parserInit();
91188
91326
  } else {
91189
91327
  const grammarsDir = getGrammarsDirAbsolute();
91190
- await _internals51.parserInit({
91328
+ await _internals52.parserInit({
91191
91329
  locateFile(scriptName) {
91192
91330
  return path99.join(grammarsDir, scriptName);
91193
91331
  }
@@ -91292,12 +91430,12 @@ function getInitializedLanguages() {
91292
91430
  function getSupportedLanguages() {
91293
91431
  return Object.keys(LANGUAGE_WASM_MAP);
91294
91432
  }
91295
- var parserCache, initializedLanguages, treeSitterInitPromise = null, _internals51, LANGUAGE_WASM_MAP;
91433
+ var parserCache, initializedLanguages, treeSitterInitPromise = null, _internals52, LANGUAGE_WASM_MAP;
91296
91434
  var init_runtime = __esm(() => {
91297
91435
  init_tree_sitter();
91298
91436
  parserCache = new Map;
91299
91437
  initializedLanguages = new Set;
91300
- _internals51 = {
91438
+ _internals52 = {
91301
91439
  parserInit: Parser.init
91302
91440
  };
91303
91441
  LANGUAGE_WASM_MAP = {
@@ -92200,9 +92338,9 @@ var init_search_knowledge = __esm(() => {
92200
92338
  var exports_knowledge_recall = {};
92201
92339
  __export(exports_knowledge_recall, {
92202
92340
  knowledge_recall: () => knowledge_recall,
92203
- _internals: () => _internals52
92341
+ _internals: () => _internals53
92204
92342
  });
92205
- var knowledge_recall, _internals52;
92343
+ var knowledge_recall, _internals53;
92206
92344
  var init_knowledge_recall = __esm(() => {
92207
92345
  init_zod();
92208
92346
  init_config();
@@ -92283,7 +92421,7 @@ var init_knowledge_recall = __esm(() => {
92283
92421
  return JSON.stringify(result);
92284
92422
  }
92285
92423
  });
92286
- _internals52 = {
92424
+ _internals53 = {
92287
92425
  knowledge_recall
92288
92426
  };
92289
92427
  });
@@ -92338,7 +92476,7 @@ __export(exports_curator_drift, {
92338
92476
  runDeterministicDriftCheck: () => runDeterministicDriftCheck,
92339
92477
  readPriorDriftReports: () => readPriorDriftReports,
92340
92478
  buildDriftInjectionText: () => buildDriftInjectionText,
92341
- _internals: () => _internals55
92479
+ _internals: () => _internals56
92342
92480
  });
92343
92481
  import * as fs71 from "node:fs";
92344
92482
  import * as path108 from "node:path";
@@ -92387,7 +92525,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
92387
92525
  try {
92388
92526
  const planMd = await readSwarmFileAsync(directory, "plan.md");
92389
92527
  const specMd = await readSwarmFileAsync(directory, "spec.md");
92390
- const priorReports = await _internals55.readPriorDriftReports(directory);
92528
+ const priorReports = await _internals56.readPriorDriftReports(directory);
92391
92529
  const complianceCount = curatorResult.compliance.length;
92392
92530
  const warningCompliance = curatorResult.compliance.filter((obs) => obs.severity === "warning");
92393
92531
  let alignment = "ALIGNED";
@@ -92450,7 +92588,7 @@ async function runDeterministicDriftCheck(directory, phase, curatorResult, confi
92450
92588
  scope_additions: [],
92451
92589
  injection_summary: injectionSummary
92452
92590
  };
92453
- const reportPath = await _internals55.writeDriftReport(directory, report);
92591
+ const reportPath = await _internals56.writeDriftReport(directory, report);
92454
92592
  getGlobalEventBus().publish("curator.drift.completed", {
92455
92593
  phase,
92456
92594
  alignment,
@@ -92513,12 +92651,12 @@ function buildDriftInjectionText(report, maxChars) {
92513
92651
  }
92514
92652
  return text.slice(0, maxChars);
92515
92653
  }
92516
- var DRIFT_REPORT_PREFIX = "drift-report-phase-", _internals55;
92654
+ var DRIFT_REPORT_PREFIX = "drift-report-phase-", _internals56;
92517
92655
  var init_curator_drift = __esm(() => {
92518
92656
  init_event_bus();
92519
92657
  init_logger();
92520
92658
  init_utils2();
92521
- _internals55 = {
92659
+ _internals56 = {
92522
92660
  readPriorDriftReports,
92523
92661
  writeDriftReport,
92524
92662
  runDeterministicDriftCheck,
@@ -92530,7 +92668,7 @@ var init_curator_drift = __esm(() => {
92530
92668
  var exports_design_doc_drift = {};
92531
92669
  __export(exports_design_doc_drift, {
92532
92670
  runDesignDocDriftCheck: () => runDesignDocDriftCheck,
92533
- _internals: () => _internals66
92671
+ _internals: () => _internals67
92534
92672
  });
92535
92673
  import * as fs106 from "node:fs";
92536
92674
  import * as path145 from "node:path";
@@ -92662,7 +92800,7 @@ async function runDesignDocDriftCheck(directory, phase, outDir) {
92662
92800
  return null;
92663
92801
  }
92664
92802
  }
92665
- var DOC_DRIFT_REPORT_PREFIX = "doc-drift-phase-", MAX_TRACEABILITY_BYTES, DESIGN_DOC_FILES, TRACEABILITY_REL, _internals66;
92803
+ var DOC_DRIFT_REPORT_PREFIX = "doc-drift-phase-", MAX_TRACEABILITY_BYTES, DESIGN_DOC_FILES, TRACEABILITY_REL, _internals67;
92666
92804
  var init_design_doc_drift = __esm(() => {
92667
92805
  init_event_bus();
92668
92806
  init_logger();
@@ -92676,7 +92814,7 @@ var init_design_doc_drift = __esm(() => {
92676
92814
  "idiom-notes": path145.join("reference", "idiom-notes.md")
92677
92815
  };
92678
92816
  TRACEABILITY_REL = path145.join("reference", "traceability.json");
92679
- _internals66 = {
92817
+ _internals67 = {
92680
92818
  mtimeMsOrNull,
92681
92819
  resolveAnchorWithin,
92682
92820
  DESIGN_DOC_FILES
@@ -92687,7 +92825,7 @@ var init_design_doc_drift = __esm(() => {
92687
92825
  var exports_project_context = {};
92688
92826
  __export(exports_project_context, {
92689
92827
  buildProjectContext: () => buildProjectContext,
92690
- _internals: () => _internals77,
92828
+ _internals: () => _internals78,
92691
92829
  LANG_BACKEND_DETECTION_TIMEOUT_MS: () => LANG_BACKEND_DETECTION_TIMEOUT_MS
92692
92830
  });
92693
92831
  import * as fs130 from "node:fs";
@@ -92771,7 +92909,7 @@ function selectLintCommand(backend, directory) {
92771
92909
  return null;
92772
92910
  }
92773
92911
  async function buildProjectContext(directory) {
92774
- const backend = await _internals77.pickBackend(directory);
92912
+ const backend = await _internals78.pickBackend(directory);
92775
92913
  if (!backend)
92776
92914
  return null;
92777
92915
  const ctx = emptyProjectContext();
@@ -92802,16 +92940,16 @@ async function buildProjectContext(directory) {
92802
92940
  if (backend.prompts.reviewerChecklist.length > 0) {
92803
92941
  ctx.REVIEWER_CHECKLIST = bulletList(backend.prompts.reviewerChecklist);
92804
92942
  }
92805
- const profiles = _internals77.pickedProfiles(directory);
92943
+ const profiles = _internals78.pickedProfiles(directory);
92806
92944
  if (profiles.length > 1) {
92807
92945
  ctx.PROJECT_CONTEXT_SECONDARY_LANGUAGES = profiles.slice(1).map((p) => p.id).join(", ");
92808
92946
  }
92809
92947
  return ctx;
92810
92948
  }
92811
- var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300, _internals77;
92949
+ var LANG_BACKEND_DETECTION_TIMEOUT_MS = 300, _internals78;
92812
92950
  var init_project_context = __esm(() => {
92813
92951
  init_dispatch();
92814
- _internals77 = {
92952
+ _internals78 = {
92815
92953
  pickBackend,
92816
92954
  pickedProfiles
92817
92955
  };
@@ -93192,7 +93330,7 @@ import * as path76 from "node:path";
93192
93330
  import * as crypto7 from "node:crypto";
93193
93331
  import * as fs44 from "node:fs";
93194
93332
  import * as path75 from "node:path";
93195
- var _internals43 = {
93333
+ var _internals44 = {
93196
93334
  readFileSync: fs44.readFileSync,
93197
93335
  writeFileSync: fs44.writeFileSync,
93198
93336
  mkdirSync: fs44.mkdirSync,
@@ -93202,7 +93340,7 @@ var _internals43 = {
93202
93340
  createHash: crypto7.createHash.bind(crypto7)
93203
93341
  };
93204
93342
  function computeContentHash(content) {
93205
- return _internals43.createHash("sha256").update(content, "utf-8").digest("hex");
93343
+ return _internals44.createHash("sha256").update(content, "utf-8").digest("hex");
93206
93344
  }
93207
93345
  function createEmptyContextMap() {
93208
93346
  return {
@@ -93217,10 +93355,10 @@ function createEmptyContextMap() {
93217
93355
  function loadContextMap(directory) {
93218
93356
  const filePath = path75.join(directory, ".swarm", "context-map.json");
93219
93357
  try {
93220
- if (!_internals43.existsSync(filePath)) {
93358
+ if (!_internals44.existsSync(filePath)) {
93221
93359
  return null;
93222
93360
  }
93223
- const raw = _internals43.readFileSync(filePath, "utf-8");
93361
+ const raw = _internals44.readFileSync(filePath, "utf-8");
93224
93362
  const parsed = JSON.parse(raw);
93225
93363
  if (typeof parsed !== "object" || parsed === null || parsed.schema_version !== 1) {
93226
93364
  return null;
@@ -93234,14 +93372,14 @@ function saveContextMap(map3, directory) {
93234
93372
  const swarmDir = path75.join(directory, ".swarm");
93235
93373
  const tmpPath = path75.join(swarmDir, "context-map.tmp");
93236
93374
  const finalPath = path75.join(swarmDir, "context-map.json");
93237
- _internals43.mkdirSync(swarmDir, { recursive: true });
93375
+ _internals44.mkdirSync(swarmDir, { recursive: true });
93238
93376
  const updated = {
93239
93377
  ...map3,
93240
93378
  generated_at: new Date().toISOString()
93241
93379
  };
93242
93380
  const json3 = JSON.stringify(updated, null, 2);
93243
- _internals43.writeFileSync(tmpPath, json3, "utf-8");
93244
- _internals43.renameSync(tmpPath, finalPath);
93381
+ _internals44.writeFileSync(tmpPath, json3, "utf-8");
93382
+ _internals44.renameSync(tmpPath, finalPath);
93245
93383
  }
93246
93384
  function appendTaskHistory(map3, summary) {
93247
93385
  return {
@@ -93407,10 +93545,10 @@ function deriveFinalStatus(params) {
93407
93545
  }
93408
93546
  function readFileContent(absolutePath) {
93409
93547
  try {
93410
- if (!_internals44.existsSync(absolutePath)) {
93548
+ if (!_internals45.existsSync(absolutePath)) {
93411
93549
  return null;
93412
93550
  }
93413
- return _internals44.readFileSync(absolutePath, "utf-8");
93551
+ return _internals45.readFileSync(absolutePath, "utf-8");
93414
93552
  } catch {
93415
93553
  return null;
93416
93554
  }
@@ -93420,9 +93558,9 @@ function refreshFileEntry(relativePath, absolutePath, existingEntry) {
93420
93558
  if (content === null) {
93421
93559
  return null;
93422
93560
  }
93423
- return _internals44.extractFileSummary(relativePath, content, absolutePath, existingEntry);
93561
+ return _internals45.extractFileSummary(relativePath, content, absolutePath, existingEntry);
93424
93562
  }
93425
- var _internals44 = {
93563
+ var _internals45 = {
93426
93564
  loadContextMap,
93427
93565
  saveContextMap,
93428
93566
  createEmptyContextMap,
@@ -93441,10 +93579,10 @@ function extractEvidenceFindings(taskId, directory) {
93441
93579
  };
93442
93580
  try {
93443
93581
  const evidenceDir = path77.join(directory, ".swarm", "evidence", taskId);
93444
- if (!_internals44.existsSync(evidenceDir)) {
93582
+ if (!_internals45.existsSync(evidenceDir)) {
93445
93583
  return result;
93446
93584
  }
93447
- const evidenceFiles = _internals44.readdirSync(evidenceDir);
93585
+ const evidenceFiles = _internals45.readdirSync(evidenceDir);
93448
93586
  const targetFiles = [
93449
93587
  "evidence.json",
93450
93588
  "reviewer.json",
@@ -93536,20 +93674,20 @@ function extractEvidenceFindings(taskId, directory) {
93536
93674
  }
93537
93675
  function updateContextMapAfterAgent(params) {
93538
93676
  try {
93539
- let map3 = _internals44.loadContextMap(params.directory);
93677
+ let map3 = _internals45.loadContextMap(params.directory);
93540
93678
  if (map3 === null) {
93541
- map3 = _internals44.createEmptyContextMap();
93679
+ map3 = _internals45.createEmptyContextMap();
93542
93680
  }
93543
93681
  const root = path77.resolve(params.directory);
93544
93682
  const updatedFiles = {
93545
93683
  ...map3.files
93546
93684
  };
93547
93685
  const validFiles = [];
93548
- const realRoot = _internals44.realpathSync(root);
93686
+ const realRoot = _internals45.realpathSync(root);
93549
93687
  for (const filePath of params.files_touched) {
93550
93688
  try {
93551
93689
  const resolved = path77.resolve(root, filePath);
93552
- const realResolved = _internals44.realpathSync(resolved);
93690
+ const realResolved = _internals45.realpathSync(resolved);
93553
93691
  const relative12 = path77.relative(realRoot, realResolved);
93554
93692
  if (relative12.startsWith("..") || path77.isAbsolute(relative12)) {
93555
93693
  continue;
@@ -93587,7 +93725,7 @@ function updateContextMapAfterAgent(params) {
93587
93725
  reviewer_findings: reviewerFindings.length > 0 ? reviewerFindings : undefined,
93588
93726
  final_status: mergedRejectionReasons.length > 0 ? "rejected" : deriveFinalStatus(params)
93589
93727
  };
93590
- map3 = _internals44.appendTaskHistory(map3, taskSummary);
93728
+ map3 = _internals45.appendTaskHistory(map3, taskSummary);
93591
93729
  if (params.decisions) {
93592
93730
  for (const entry of params.decisions) {
93593
93731
  const decision = {
@@ -93597,17 +93735,17 @@ function updateContextMapAfterAgent(params) {
93597
93735
  timestamp: new Date().toISOString(),
93598
93736
  task_id: params.task_id
93599
93737
  };
93600
- map3 = _internals44.appendDecision(map3, decision);
93738
+ map3 = _internals45.appendDecision(map3, decision);
93601
93739
  }
93602
93740
  }
93603
- _internals44.saveContextMap(map3, params.directory);
93741
+ _internals45.saveContextMap(map3, params.directory);
93604
93742
  return map3;
93605
93743
  } catch {
93606
93744
  try {
93607
- const fallback = _internals44.loadContextMap(params.directory) ?? _internals44.createEmptyContextMap();
93745
+ const fallback = _internals45.loadContextMap(params.directory) ?? _internals45.createEmptyContextMap();
93608
93746
  return fallback;
93609
93747
  } catch {
93610
- return _internals44.createEmptyContextMap();
93748
+ return _internals45.createEmptyContextMap();
93611
93749
  }
93612
93750
  }
93613
93751
  }
@@ -94914,7 +95052,7 @@ import * as path79 from "node:path";
94914
95052
  function estimateTokens3(content) {
94915
95053
  return Math.max(1, estimateTokens2(content));
94916
95054
  }
94917
- var _internals45 = {
95055
+ var _internals46 = {
94918
95056
  loadContextMap,
94919
95057
  createEmptyContextMap,
94920
95058
  computeContentHash,
@@ -94982,14 +95120,14 @@ function buildReadPolicy(files, map3, directory, invalidateOnHashChange = true,
94982
95120
  const absolutePath = path79.join(directory, filePath);
94983
95121
  let currentContent;
94984
95122
  try {
94985
- if (_internals45.existsSync(absolutePath)) {
94986
- currentContent = _internals45.readFileSync(absolutePath, "utf-8");
95123
+ if (_internals46.existsSync(absolutePath)) {
95124
+ currentContent = _internals46.readFileSync(absolutePath, "utf-8");
94987
95125
  }
94988
95126
  } catch {}
94989
95127
  if (contentCache !== undefined) {
94990
95128
  contentCache.set(filePath, currentContent);
94991
95129
  }
94992
- if (currentContent === undefined || invalidateOnHashChange && _internals45.isFileStale(entry, currentContent)) {
95130
+ if (currentContent === undefined || invalidateOnHashChange && _internals46.isFileStale(entry, currentContent)) {
94993
95131
  policy.push({
94994
95132
  file_path: filePath,
94995
95133
  trust_summary: false,
@@ -95064,7 +95202,7 @@ function pruneCapsuleContent(sections, tokenEstimate, maxTokens, estimateFn) {
95064
95202
  function buildCapsule(params) {
95065
95203
  const { task_id, agent_role, delegation_reason, directory } = params;
95066
95204
  const generatedAt = new Date().toISOString();
95067
- const map3 = _internals45.loadContextMap(directory) ?? _internals45.createEmptyContextMap();
95205
+ const map3 = _internals46.loadContextMap(directory) ?? _internals46.createEmptyContextMap();
95068
95206
  let profile = DEFAULT_ROLE_PROFILES[agent_role];
95069
95207
  if (params.mode === "conservative") {
95070
95208
  profile = { ...profile, max_files: Math.ceil(profile.max_files * 1.5) };
@@ -95093,7 +95231,7 @@ function buildCapsule(params) {
95093
95231
  const shouldCheckStaleness = params.invalidate_on_hash_change !== false;
95094
95232
  if (shouldCheckStaleness) {
95095
95233
  const currentContent = contentCache.get(filePath);
95096
- if (currentContent === undefined || _internals45.isFileStale(entry, currentContent)) {
95234
+ if (currentContent === undefined || _internals46.isFileStale(entry, currentContent)) {
95097
95235
  staleEntries++;
95098
95236
  fileSummaries.push(`- ${filePath} — ${entry.purpose || "No summary available"} (stale)`);
95099
95237
  } else {
@@ -95135,11 +95273,11 @@ function buildCapsule(params) {
95135
95273
  }
95136
95274
  const content = sections.join(`
95137
95275
  `);
95138
- let tokenEstimate = _internals45.estimateTokens(content);
95276
+ let tokenEstimate = _internals46.estimateTokens(content);
95139
95277
  const maxCapsuleTokens = params.max_capsule_tokens ?? 2000;
95140
95278
  let prunedContent = content;
95141
95279
  if (tokenEstimate > maxCapsuleTokens) {
95142
- const { prunedSections, prunedTokenEstimate } = pruneCapsuleContent(sections, tokenEstimate, maxCapsuleTokens, _internals45.estimateTokens);
95280
+ const { prunedSections, prunedTokenEstimate } = pruneCapsuleContent(sections, tokenEstimate, maxCapsuleTokens, _internals46.estimateTokens);
95143
95281
  prunedContent = prunedSections.join(`
95144
95282
  `);
95145
95283
  tokenEstimate = prunedTokenEstimate;
@@ -95175,7 +95313,7 @@ function buildCapsule(params) {
95175
95313
  // src/context-map/capsule-persistence.ts
95176
95314
  import * as fs50 from "node:fs";
95177
95315
  import * as path80 from "node:path";
95178
- var _internals46 = {
95316
+ var _internals47 = {
95179
95317
  writeFileSync: fs50.writeFileSync,
95180
95318
  readFileSync: fs50.readFileSync,
95181
95319
  existsSync: fs50.existsSync,
@@ -95211,10 +95349,10 @@ function saveCapsule(capsule, directory) {
95211
95349
  const capsulesDir = path80.join(directory, ".swarm", "capsules");
95212
95350
  const finalPath = capsulePath(capsule.task_id, directory);
95213
95351
  const tmpPath = path80.join(capsulesDir, `capsule-${capsule.task_id}.tmp`);
95214
- _internals46.mkdirSync(capsulesDir, { recursive: true });
95352
+ _internals47.mkdirSync(capsulesDir, { recursive: true });
95215
95353
  const json3 = JSON.stringify(capsule, null, 2);
95216
- _internals46.writeFileSync(tmpPath, json3, "utf-8");
95217
- _internals46.renameSync(tmpPath, finalPath);
95354
+ _internals47.writeFileSync(tmpPath, json3, "utf-8");
95355
+ _internals47.renameSync(tmpPath, finalPath);
95218
95356
  return {
95219
95357
  success: true,
95220
95358
  capsule_path: finalPath,
@@ -95242,7 +95380,7 @@ function saveCapsule(capsule, directory) {
95242
95380
  // src/context-map/telemetry.ts
95243
95381
  import * as fs51 from "node:fs";
95244
95382
  import * as path81 from "node:path";
95245
- var _internals47 = {
95383
+ var _internals48 = {
95246
95384
  appendFileSync: fs51.appendFileSync,
95247
95385
  readFileSync: fs51.readFileSync,
95248
95386
  existsSync: fs51.existsSync,
@@ -95255,10 +95393,10 @@ function recordTelemetry(entry, directory) {
95255
95393
  const filePath = telemetryFilePath(directory);
95256
95394
  const swarmDir = path81.join(directory, ".swarm");
95257
95395
  try {
95258
- _internals47.mkdirSync(swarmDir, { recursive: true });
95396
+ _internals48.mkdirSync(swarmDir, { recursive: true });
95259
95397
  const line = `${JSON.stringify(entry)}
95260
95398
  `;
95261
- _internals47.appendFileSync(filePath, line, "utf-8");
95399
+ _internals48.appendFileSync(filePath, line, "utf-8");
95262
95400
  return true;
95263
95401
  } catch {
95264
95402
  return false;
@@ -95300,7 +95438,7 @@ function extractTaskGoal(taskId, directory) {
95300
95438
  return "";
95301
95439
  }
95302
95440
  }
95303
- var _internals48 = {
95441
+ var _internals49 = {
95304
95442
  buildCapsule,
95305
95443
  recordTelemetry,
95306
95444
  saveCapsule,
@@ -95368,21 +95506,21 @@ async function injectCapsule(input, output, config3, directory) {
95368
95506
  const sessionID = input.sessionID;
95369
95507
  if (!sessionID)
95370
95508
  return;
95371
- const agentName = _internals48.getActiveAgent(sessionID);
95509
+ const agentName = _internals49.getActiveAgent(sessionID);
95372
95510
  if (!agentName)
95373
95511
  return;
95374
95512
  const role = extractCapsuleRole(agentName);
95375
95513
  if (!role)
95376
95514
  return;
95377
- const taskId = _internals48.getCurrentTaskId(sessionID);
95515
+ const taskId = _internals49.getCurrentTaskId(sessionID);
95378
95516
  const effectiveTaskId = taskId ?? "unknown";
95379
- const files = _internals48.readScopeFile(effectiveTaskId, directory);
95517
+ const files = _internals49.readScopeFile(effectiveTaskId, directory);
95380
95518
  if (files.length === 0)
95381
95519
  return;
95382
95520
  const maxTokens = config3.context_map?.max_capsule_tokens;
95383
- const delegationReason = _internals48.resolveCapsuleDelegationReason(_internals48.getSession(sessionID), role, effectiveTaskId);
95384
- const taskGoal = _internals48.extractTaskGoal(effectiveTaskId, directory);
95385
- const { capsule, metadata: metadata2 } = _internals48.buildCapsule({
95521
+ const delegationReason = _internals49.resolveCapsuleDelegationReason(_internals49.getSession(sessionID), role, effectiveTaskId);
95522
+ const taskGoal = _internals49.extractTaskGoal(effectiveTaskId, directory);
95523
+ const { capsule, metadata: metadata2 } = _internals49.buildCapsule({
95386
95524
  task_id: effectiveTaskId,
95387
95525
  agent_role: role,
95388
95526
  delegation_reason: delegationReason,
@@ -95398,7 +95536,7 @@ async function injectCapsule(input, output, config3, directory) {
95398
95536
  return;
95399
95537
  output.system.push(capsule.content);
95400
95538
  try {
95401
- _internals48.saveCapsule(capsule, directory);
95539
+ _internals49.saveCapsule(capsule, directory);
95402
95540
  } catch {}
95403
95541
  const telemetryEntry = {
95404
95542
  timestamp: new Date().toISOString(),
@@ -95414,7 +95552,7 @@ async function injectCapsule(input, output, config3, directory) {
95414
95552
  success: metadata2.success
95415
95553
  };
95416
95554
  try {
95417
- _internals48.recordTelemetry(telemetryEntry, directory);
95555
+ _internals49.recordTelemetry(telemetryEntry, directory);
95418
95556
  } catch {}
95419
95557
  }
95420
95558
  // src/hooks/curator-llm-factory.ts
@@ -97124,7 +97262,7 @@ function validateGraphEdge(edge) {
97124
97262
  }
97125
97263
 
97126
97264
  // src/tools/repo-graph/builder.ts
97127
- var _internals49 = {
97265
+ var _internals50 = {
97128
97266
  safeRealpathSync,
97129
97267
  extractTSSymbols,
97130
97268
  extractPythonSymbols,
@@ -97211,12 +97349,12 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
97211
97349
  if (specifier.startsWith(".")) {
97212
97350
  const sourceDir = path88.dirname(sourceFile);
97213
97351
  let resolved = path88.resolve(sourceDir, specifier);
97214
- const initialRealResolved = _internals49.safeRealpathSync(resolved, resolved);
97352
+ const initialRealResolved = _internals50.safeRealpathSync(resolved, resolved);
97215
97353
  if (initialRealResolved === null) {
97216
97354
  return null;
97217
97355
  }
97218
97356
  let realResolved = initialRealResolved;
97219
- const realRoot = _internals49.safeRealpathSync(workspaceRoot, path88.normalize(workspaceRoot));
97357
+ const realRoot = _internals50.safeRealpathSync(workspaceRoot, path88.normalize(workspaceRoot));
97220
97358
  if (realRoot === null) {
97221
97359
  return null;
97222
97360
  }
@@ -97240,7 +97378,7 @@ function resolveModuleSpecifier(workspaceRoot, sourceFile, specifier) {
97240
97378
  }
97241
97379
  }
97242
97380
  if (found) {
97243
- const foundRealPath = _internals49.safeRealpathSync(found, found);
97381
+ const foundRealPath = _internals50.safeRealpathSync(found, found);
97244
97382
  if (foundRealPath === null) {
97245
97383
  return null;
97246
97384
  }
@@ -97440,14 +97578,14 @@ function scanFile(filePath, absoluteRoot, maxFileSize) {
97440
97578
  try {
97441
97579
  if ([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"].includes(ext)) {
97442
97580
  const relativePath = path88.relative(absoluteRoot, filePath);
97443
- const symbols2 = _internals49.extractTSSymbols(relativePath, absoluteRoot);
97581
+ const symbols2 = _internals50.extractTSSymbols(relativePath, absoluteRoot);
97444
97582
  exports = symbols2.filter((s) => s.exported).map((s) => s.name);
97445
97583
  } else if (ext === ".py") {
97446
97584
  const relativePath = path88.relative(absoluteRoot, filePath);
97447
- const symbols2 = _internals49.extractPythonSymbols(relativePath, absoluteRoot);
97585
+ const symbols2 = _internals50.extractPythonSymbols(relativePath, absoluteRoot);
97448
97586
  exports = symbols2.filter((s) => s.exported).map((s) => s.name);
97449
97587
  }
97450
- const parsedImports = _internals49.parseFileImports(content);
97588
+ const parsedImports = _internals50.parseFileImports(content);
97451
97589
  const node = {
97452
97590
  filePath,
97453
97591
  moduleName: toModuleName(filePath, absoluteRoot),
@@ -97577,7 +97715,7 @@ init_path_security();
97577
97715
  import { constants as constants4, existsSync as existsSync54 } from "node:fs";
97578
97716
  import * as fsPromises6 from "node:fs/promises";
97579
97717
  import * as path90 from "node:path";
97580
- var _internals50 = {
97718
+ var _internals51 = {
97581
97719
  safeRealpathSync
97582
97720
  };
97583
97721
  var WINDOWS_RENAME_MAX_RETRIES2 = 3;
@@ -97685,12 +97823,12 @@ async function saveGraph(workspace, graph, options) {
97685
97823
  throw new Error("Graph must have edges array");
97686
97824
  }
97687
97825
  const normalizedWorkspace = path90.normalize(workspace);
97688
- const realWorkspace = _internals50.safeRealpathSync(workspace, normalizedWorkspace);
97826
+ const realWorkspace = _internals51.safeRealpathSync(workspace, normalizedWorkspace);
97689
97827
  if (realWorkspace === null) {
97690
97828
  throw new Error(`Workspace realpath security check failed (non-ENOENT): ${workspace}`);
97691
97829
  }
97692
97830
  const normalizedGraphRoot = path90.normalize(graph.workspaceRoot);
97693
- const realGraphRoot = _internals50.safeRealpathSync(graph.workspaceRoot, normalizedGraphRoot);
97831
+ const realGraphRoot = _internals51.safeRealpathSync(graph.workspaceRoot, normalizedGraphRoot);
97694
97832
  if (realGraphRoot === null) {
97695
97833
  throw new Error(`Graph workspaceRoot realpath security check failed (non-ENOENT): ${graph.workspaceRoot}`);
97696
97834
  }
@@ -104165,7 +104303,7 @@ async function knowledgeApplicationGateBefore(directory, input, config3) {
104165
104303
  if (config3.mode === "enforce") {
104166
104304
  throw new Error("KNOWLEDGE_ENFORCE_GATE_DENY: missing sessionID on tool.execute.before; refusing to evaluate critical-directive ack state");
104167
104305
  }
104168
- _internals53.writeWarnEvent(directory, {
104306
+ _internals54.writeWarnEvent(directory, {
104169
104307
  timestamp: new Date().toISOString(),
104170
104308
  event: "knowledge_application_gate_warn",
104171
104309
  tool: toolName,
@@ -104248,7 +104386,7 @@ async function knowledgeApplicationTransformScan(directory, output, sessionID) {
104248
104386
  }
104249
104387
  }
104250
104388
  }
104251
- var _internals53 = {
104389
+ var _internals54 = {
104252
104390
  knowledgeApplicationGateBefore,
104253
104391
  knowledgeApplicationTransformScan,
104254
104392
  HIGH_RISK_TOOLS,
@@ -104384,10 +104522,10 @@ async function getRunMemorySummary(directory) {
104384
104522
  if (entries.length === 0) {
104385
104523
  return null;
104386
104524
  }
104387
- const groups = _internals54.groupByTaskId(entries);
104525
+ const groups = _internals55.groupByTaskId(entries);
104388
104526
  const summaries = [];
104389
104527
  for (const [taskId, taskEntries] of groups) {
104390
- const summary = _internals54.summarizeTask(taskId, taskEntries);
104528
+ const summary = _internals55.summarizeTask(taskId, taskEntries);
104391
104529
  if (summary) {
104392
104530
  summaries.push(summary);
104393
104531
  }
@@ -104420,7 +104558,7 @@ Use this data to avoid repeating known failure patterns.`;
104420
104558
  }
104421
104559
  return prefix + summaryText + suffix;
104422
104560
  }
104423
- var _internals54 = {
104561
+ var _internals55 = {
104424
104562
  generateTaskFingerprint,
104425
104563
  recordOutcome,
104426
104564
  getTaskHistory,
@@ -104613,7 +104751,7 @@ function createKnowledgeInjectorHook(directory, config3) {
104613
104751
  projectName,
104614
104752
  currentPhase: phaseDescription
104615
104753
  };
104616
- const searchFn = _internals56.searchKnowledge === defaultSearchKnowledge ? searchKnowledge : _internals56.searchKnowledge;
104754
+ const searchFn = _internals57.searchKnowledge === defaultSearchKnowledge ? searchKnowledge : _internals57.searchKnowledge;
104617
104755
  const search = await searchFn({
104618
104756
  directory,
104619
104757
  config: config3,
@@ -104722,7 +104860,7 @@ ${freshPreamble}` : `<curator_briefing>${truncatedBriefing}</curator_briefing>`;
104722
104860
  ranks[id] = idx + 1;
104723
104861
  scores[id] = scoreById.get(id) ?? 0;
104724
104862
  });
104725
- await _internals56.recordKnowledgeEvent(directory, {
104863
+ await _internals57.recordKnowledgeEvent(directory, {
104726
104864
  type: "retrieved",
104727
104865
  trace_id: search.trace_id,
104728
104866
  session_id: systemMsg?.info?.sessionID ?? "unknown",
@@ -104735,7 +104873,7 @@ ${freshPreamble}` : `<curator_briefing>${truncatedBriefing}</curator_briefing>`;
104735
104873
  ranks,
104736
104874
  scores
104737
104875
  });
104738
- _internals56.recordKnowledgeShown(directory, cachedShownIds, {
104876
+ _internals57.recordKnowledgeShown(directory, cachedShownIds, {
104739
104877
  phase: phaseLabel,
104740
104878
  tool: retrievalCtx.currentTool,
104741
104879
  action: retrievalCtx.currentAction,
@@ -104745,7 +104883,7 @@ ${freshPreamble}` : `<curator_briefing>${truncatedBriefing}</curator_briefing>`;
104745
104883
  }
104746
104884
  });
104747
104885
  }
104748
- var _internals56 = {
104886
+ var _internals57 = {
104749
104887
  searchKnowledge,
104750
104888
  recordKnowledgeEvent,
104751
104889
  recordKnowledgeShown
@@ -104930,7 +105068,7 @@ var TASK_DIVERSITY_WEIGHT = 0.05;
104930
105068
  var CONTEXT_WEIGHT = 0.2;
104931
105069
  var RECENCY_DECAY_MS = 30 * 24 * 60 * 60 * 1000;
104932
105070
  var SKILL_FRONTMATTER_READ_BYTES = 16 * 1024;
104933
- var _internals57 = {
105071
+ var _internals58 = {
104934
105072
  computeSkillRelevanceScore: null,
104935
105073
  rankSkillsForContext: null,
104936
105074
  getSkillStats: null,
@@ -105149,7 +105287,7 @@ function formatSkillIndexWithContext(skills, directory) {
105149
105287
  } catch {}
105150
105288
  if (!hasHistory) {
105151
105289
  return skills.map((sp) => {
105152
- const meta3 = _internals57.readSkillMetadata(sp, directory);
105290
+ const meta3 = _internals58.readSkillMetadata(sp, directory);
105153
105291
  return ` - file:${meta3.path} - ${meta3.name}: ${meta3.description}`;
105154
105292
  }).join(`
105155
105293
  `);
@@ -105157,7 +105295,7 @@ function formatSkillIndexWithContext(skills, directory) {
105157
105295
  const lines = [];
105158
105296
  for (const skillPath of skills) {
105159
105297
  const stats = getSkillStats(skillPath, directory);
105160
- const meta3 = _internals57.readSkillMetadata(skillPath, directory);
105298
+ const meta3 = _internals58.readSkillMetadata(skillPath, directory);
105161
105299
  const compliancePct = Math.round(stats.complianceRate * 100);
105162
105300
  const topAgentNames = stats.topAgents.slice(0, 3).map((a) => a.agent).join(", ");
105163
105301
  lines.push(` - file:${meta3.path} - ${meta3.name}: ${meta3.description} (used: ${stats.totalUsage}, compliance: ${compliancePct}%)` + (stats.topAgents.length > 0 ? ` → ${topAgentNames}` : ""));
@@ -105165,15 +105303,15 @@ function formatSkillIndexWithContext(skills, directory) {
105165
105303
  return lines.join(`
105166
105304
  `);
105167
105305
  }
105168
- _internals57.computeSkillRelevanceScore = computeSkillRelevanceScore;
105169
- _internals57.rankSkillsForContext = rankSkillsForContext;
105170
- _internals57.getSkillStats = getSkillStats;
105171
- _internals57.formatSkillIndexWithContext = formatSkillIndexWithContext;
105172
- _internals57.parseSkillFrontmatter = parseSkillFrontmatter;
105173
- _internals57.readSkillMetadata = readSkillMetadata;
105174
- _internals57.extractSkillName = extractSkillName;
105175
- _internals57.computeRecencyScore = computeRecencyScore;
105176
- _internals57.computeContextMatchScore = computeContextMatchScore;
105306
+ _internals58.computeSkillRelevanceScore = computeSkillRelevanceScore;
105307
+ _internals58.rankSkillsForContext = rankSkillsForContext;
105308
+ _internals58.getSkillStats = getSkillStats;
105309
+ _internals58.formatSkillIndexWithContext = formatSkillIndexWithContext;
105310
+ _internals58.parseSkillFrontmatter = parseSkillFrontmatter;
105311
+ _internals58.readSkillMetadata = readSkillMetadata;
105312
+ _internals58.extractSkillName = extractSkillName;
105313
+ _internals58.computeRecencyScore = computeRecencyScore;
105314
+ _internals58.computeContextMatchScore = computeContextMatchScore;
105177
105315
 
105178
105316
  // src/hooks/skill-propagation-gate.ts
105179
105317
  init_skill_usage_log();
@@ -105276,10 +105414,10 @@ function parseYamlValue(value) {
105276
105414
  }
105277
105415
  function loadRoutingSkills(directory, targetAgent) {
105278
105416
  const routingPath = path111.join(directory, ".opencode", "skill-routing.yaml");
105279
- if (!_internals58.existsSync(routingPath))
105417
+ if (!_internals59.existsSync(routingPath))
105280
105418
  return [];
105281
105419
  try {
105282
- const content = _internals58.readFileSync(routingPath, "utf-8");
105420
+ const content = _internals59.readFileSync(routingPath, "utf-8");
105283
105421
  const config3 = parseSimpleYaml(content);
105284
105422
  if (!config3?.routing)
105285
105423
  return [];
@@ -105306,7 +105444,7 @@ var SKILL_SEARCH_ROOTS = [
105306
105444
  ".claude/skills"
105307
105445
  ];
105308
105446
  var MAX_SCORING_SESSION_ENTRIES = 500;
105309
- var _internals58 = {
105447
+ var _internals59 = {
105310
105448
  readdirSync: fs73.readdirSync.bind(fs73),
105311
105449
  existsSync: fs73.existsSync.bind(fs73),
105312
105450
  statSync: fs73.statSync.bind(fs73),
@@ -105335,11 +105473,11 @@ function discoverAvailableSkills(directory) {
105335
105473
  const results = [];
105336
105474
  for (const root of SKILL_SEARCH_ROOTS) {
105337
105475
  const rootPath = path111.join(directory, root);
105338
- if (!_internals58.existsSync(rootPath))
105476
+ if (!_internals59.existsSync(rootPath))
105339
105477
  continue;
105340
105478
  let entries;
105341
105479
  try {
105342
- entries = _internals58.readdirSync(rootPath);
105480
+ entries = _internals59.readdirSync(rootPath);
105343
105481
  } catch {
105344
105482
  continue;
105345
105483
  }
@@ -105347,11 +105485,11 @@ function discoverAvailableSkills(directory) {
105347
105485
  if (entry.startsWith("."))
105348
105486
  continue;
105349
105487
  const skillDir = path111.join(rootPath, entry);
105350
- if (_internals58.existsSync(path111.join(skillDir, "retired.marker")))
105488
+ if (_internals59.existsSync(path111.join(skillDir, "retired.marker")))
105351
105489
  continue;
105352
105490
  const skillFile = path111.join(skillDir, "SKILL.md");
105353
105491
  try {
105354
- if (_internals58.statSync(skillDir).isDirectory() && _internals58.existsSync(skillFile)) {
105492
+ if (_internals59.statSync(skillDir).isDirectory() && _internals59.existsSync(skillFile)) {
105355
105493
  results.push(path111.join(root, entry, "SKILL.md").replace(/\\/g, "/"));
105356
105494
  }
105357
105495
  } catch (err2) {
@@ -105383,7 +105521,7 @@ function parseDelegationArgs(args2) {
105383
105521
  }
105384
105522
  if (!targetAgent)
105385
105523
  return null;
105386
- const skillsField = prompt ? _internals58.extractSkillsFieldFromPrompt(prompt) : "";
105524
+ const skillsField = prompt ? _internals59.extractSkillsFieldFromPrompt(prompt) : "";
105387
105525
  return { targetAgent, skillsField };
105388
105526
  }
105389
105527
  function extractSkillsFieldFromPrompt(prompt) {
@@ -105424,10 +105562,10 @@ function writeWarnEvent2(directory, record3) {
105424
105562
  const filePath = path111.join(directory, ".swarm", "events.jsonl");
105425
105563
  try {
105426
105564
  const dir = path111.dirname(filePath);
105427
- if (!_internals58.existsSync(dir)) {
105428
- _internals58.mkdirSync(dir, { recursive: true });
105565
+ if (!_internals59.existsSync(dir)) {
105566
+ _internals59.mkdirSync(dir, { recursive: true });
105429
105567
  }
105430
- _internals58.appendFileSync(filePath, `${JSON.stringify(record3)}
105568
+ _internals59.appendFileSync(filePath, `${JSON.stringify(record3)}
105431
105569
  `, "utf-8");
105432
105570
  } catch (err2) {
105433
105571
  warn(`[skill-propagation-gate] failed to write warning event: ${err2 instanceof Error ? err2.message : String(err2)}`);
@@ -105478,19 +105616,19 @@ async function skillPropagationGateBefore(directory, input, config3) {
105478
105616
  const baseAgent = stripKnownSwarmPrefix(agentRaw);
105479
105617
  if (baseAgent !== "architect")
105480
105618
  return { blocked: false, reason: null, recommendedSkills: undefined };
105481
- const parsed = _internals58.parseDelegationArgs(input.args);
105619
+ const parsed = _internals59.parseDelegationArgs(input.args);
105482
105620
  if (!parsed)
105483
105621
  return { blocked: false, reason: null, recommendedSkills: undefined };
105484
105622
  const targetBase = stripKnownSwarmPrefix(parsed.targetAgent);
105485
- if (!_internals58.SKILL_CAPABLE_AGENTS.has(targetBase))
105623
+ if (!_internals59.SKILL_CAPABLE_AGENTS.has(targetBase))
105486
105624
  return { blocked: false, reason: null, recommendedSkills: undefined };
105487
105625
  const sessionID = typeof input.sessionID === "string" ? input.sessionID : "unknown";
105488
- const availableSkills = _internals58.discoverAvailableSkills(directory);
105626
+ const availableSkills = _internals59.discoverAvailableSkills(directory);
105489
105627
  const skillsValue = parsed.skillsField.trim();
105490
105628
  if (skillsValue && skillsValue.toLowerCase() !== "none") {
105491
105629
  const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
105492
- const taskId = _internals58.extractTaskIdFromPrompt(prompt);
105493
- const skillPaths = _internals58.parseSkillPaths(skillsValue);
105630
+ const taskId = _internals59.extractTaskIdFromPrompt(prompt);
105631
+ const skillPaths = _internals59.parseSkillPaths(skillsValue);
105494
105632
  let coderSkillPaths = [];
105495
105633
  if (prompt) {
105496
105634
  for (const line of prompt.split(`
@@ -105498,7 +105636,7 @@ async function skillPropagationGateBefore(directory, input, config3) {
105498
105636
  const trimmed = line.trim();
105499
105637
  if (trimmed.startsWith("SKILLS_USED_BY_CODER:")) {
105500
105638
  const fieldVal = trimmed.slice("SKILLS_USED_BY_CODER:".length).trim();
105501
- coderSkillPaths = _internals58.parseSkillPaths(fieldVal);
105639
+ coderSkillPaths = _internals59.parseSkillPaths(fieldVal);
105502
105640
  break;
105503
105641
  }
105504
105642
  }
@@ -105506,7 +105644,7 @@ async function skillPropagationGateBefore(directory, input, config3) {
105506
105644
  const allPaths = [...new Set([...skillPaths, ...coderSkillPaths])];
105507
105645
  for (const skillPath of allPaths) {
105508
105646
  try {
105509
- _internals58.appendSkillUsageEntry(directory, {
105647
+ _internals59.appendSkillUsageEntry(directory, {
105510
105648
  skillPath,
105511
105649
  agentName: targetBase,
105512
105650
  taskID: taskId,
@@ -105523,17 +105661,17 @@ async function skillPropagationGateBefore(directory, input, config3) {
105523
105661
  let scored = [];
105524
105662
  if (skillsValue && skillsValue.toLowerCase() !== "none" && availableSkills.length > 0) {
105525
105663
  try {
105526
- const sessionEntries = _internals58.readSkillUsageEntriesTail(directory, {
105664
+ const sessionEntries = _internals59.readSkillUsageEntriesTail(directory, {
105527
105665
  sessionID
105528
105666
  });
105529
- if (sessionEntries.length > _internals58.MAX_SCORING_SESSION_ENTRIES) {
105667
+ if (sessionEntries.length > _internals59.MAX_SCORING_SESSION_ENTRIES) {
105530
105668
  scoringSkipped = true;
105531
- warn(`[skill-propagation-gate] skipping scoring — tail window has ${sessionEntries.length} session entries (limit: ${_internals58.MAX_SCORING_SESSION_ENTRIES})`);
105669
+ warn(`[skill-propagation-gate] skipping scoring — tail window has ${sessionEntries.length} session entries (limit: ${_internals59.MAX_SCORING_SESSION_ENTRIES})`);
105532
105670
  } else {
105533
105671
  const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
105534
105672
  scored = availableSkills.map((skillPath) => {
105535
105673
  const skillEntries = sessionEntries.filter((e) => e.skillPath === skillPath);
105536
- const score = _internals58.computeSkillRelevanceScore(skillPath, prompt, skillEntries);
105674
+ const score = _internals59.computeSkillRelevanceScore(skillPath, prompt, skillEntries);
105537
105675
  return { skillPath, score, usageCount: skillEntries.length };
105538
105676
  }).sort((a, b) => b.score - a.score || b.usageCount - a.usageCount);
105539
105677
  if (scored.length > 0) {
@@ -105547,12 +105685,12 @@ async function skillPropagationGateBefore(directory, input, config3) {
105547
105685
  }
105548
105686
  }
105549
105687
  try {
105550
- const routingPaths = _internals58.loadRoutingSkills(directory, targetBase);
105688
+ const routingPaths = _internals59.loadRoutingSkills(directory, targetBase);
105551
105689
  if (routingPaths.length > 0) {
105552
105690
  const existingPaths = new Set(scored.map((s) => s.skillPath));
105553
105691
  for (const routingPath of routingPaths) {
105554
105692
  const routedSkillDir = path111.dirname(path111.join(directory, routingPath));
105555
- if (_internals58.existsSync(path111.join(routedSkillDir, "retired.marker")))
105693
+ if (_internals59.existsSync(path111.join(routedSkillDir, "retired.marker")))
105556
105694
  continue;
105557
105695
  if (!existingPaths.has(routingPath)) {
105558
105696
  scored.push({
@@ -105578,12 +105716,12 @@ async function skillPropagationGateBefore(directory, input, config3) {
105578
105716
  } else if (typeof scored !== "undefined" && scored.length > 0) {
105579
105717
  skillsForIndex = scored.map((r) => r.skillPath);
105580
105718
  }
105581
- const formattedIndex = _internals58.formatSkillIndexWithContext(skillsForIndex, directory);
105719
+ const formattedIndex = _internals59.formatSkillIndexWithContext(skillsForIndex, directory);
105582
105720
  if (formattedIndex.length > 0) {
105583
105721
  const contextPath = path111.join(directory, ".swarm", "context.md");
105584
105722
  let existingContent = "";
105585
- if (_internals58.existsSync(contextPath)) {
105586
- existingContent = _internals58.readFileSync(contextPath, "utf-8");
105723
+ if (_internals59.existsSync(contextPath)) {
105724
+ existingContent = _internals59.readFileSync(contextPath, "utf-8");
105587
105725
  }
105588
105726
  const sectionHeader = "## Available Skills";
105589
105727
  const newSection = `${sectionHeader}
@@ -105603,10 +105741,10 @@ ${newSection}`;
105603
105741
  }
105604
105742
  }
105605
105743
  const swarmDir = path111.dirname(contextPath);
105606
- if (!_internals58.existsSync(swarmDir)) {
105607
- _internals58.mkdirSync(swarmDir, { recursive: true });
105744
+ if (!_internals59.existsSync(swarmDir)) {
105745
+ _internals59.mkdirSync(swarmDir, { recursive: true });
105608
105746
  }
105609
- _internals58.writeFileSync(contextPath, updatedContent, "utf-8");
105747
+ _internals59.writeFileSync(contextPath, updatedContent, "utf-8");
105610
105748
  }
105611
105749
  } catch (err2) {
105612
105750
  warn(`[skill-propagation-gate] failed to write skill index to context.md: ${err2 instanceof Error ? err2.message : String(err2)}`);
@@ -105632,7 +105770,7 @@ ${newSection}`;
105632
105770
  });
105633
105771
  const warningMsg = `Skill propagation warning: Delegating to ${targetBase} without SKILLS field. ` + `Available skills: ${skillNames.join(", ")}`;
105634
105772
  try {
105635
- _internals58.writeWarnEvent(directory, {
105773
+ _internals59.writeWarnEvent(directory, {
105636
105774
  type: "skill_propagation_warn",
105637
105775
  timestamp: new Date().toISOString(),
105638
105776
  tool: toolName,
@@ -105661,7 +105799,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
105661
105799
  let dedupKeys = new Set;
105662
105800
  let existingEntries = [];
105663
105801
  try {
105664
- existingEntries = _internals58.readSkillUsageEntriesTail(directory, {
105802
+ existingEntries = _internals59.readSkillUsageEntriesTail(directory, {
105665
105803
  sessionID
105666
105804
  });
105667
105805
  dedupKeys = new Set(existingEntries.map((e, i2) => {
@@ -105693,7 +105831,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
105693
105831
  `)) {
105694
105832
  const coderMatch = line.trim().match(CODER_SKILLS_PATTERN);
105695
105833
  if (coderMatch) {
105696
- const parsed = _internals58.parseSkillPaths(coderMatch[1]);
105834
+ const parsed = _internals59.parseSkillPaths(coderMatch[1]);
105697
105835
  skillPaths.push(...parsed);
105698
105836
  }
105699
105837
  }
@@ -105724,7 +105862,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
105724
105862
  if (isDuplicate(skillPath, "reviewer", resolvedTaskID))
105725
105863
  continue;
105726
105864
  try {
105727
- _internals58.appendSkillUsageEntry(directory, {
105865
+ _internals59.appendSkillUsageEntry(directory, {
105728
105866
  skillPath,
105729
105867
  agentName: "reviewer",
105730
105868
  taskID: resolvedTaskID,
@@ -105768,15 +105906,15 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
105768
105906
  skillsField = trimmed.slice("SKILLS:".length).trim();
105769
105907
  }
105770
105908
  if (currentTargetAgent && skillsField && skillsField.toLowerCase() !== "none") {
105771
- const skillPaths = _internals58.parseSkillPaths(skillsField);
105772
- const taskId = _internals58.extractTaskIdFromPrompt(text);
105909
+ const skillPaths = _internals59.parseSkillPaths(skillsField);
105910
+ const taskId = _internals59.extractTaskIdFromPrompt(text);
105773
105911
  for (const skillPath of skillPaths) {
105774
105912
  if (hadRecordingError)
105775
105913
  break;
105776
105914
  if (isDuplicate(skillPath, currentTargetAgent, taskId))
105777
105915
  continue;
105778
105916
  try {
105779
- _internals58.appendSkillUsageEntry(directory, {
105917
+ _internals59.appendSkillUsageEntry(directory, {
105780
105918
  skillPath,
105781
105919
  agentName: currentTargetAgent,
105782
105920
  taskID: taskId,
@@ -105796,16 +105934,16 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
105796
105934
  break;
105797
105935
  }
105798
105936
  }
105799
- _internals58.skillPropagationGateBefore = skillPropagationGateBefore;
105800
- _internals58.skillPropagationTransformScan = skillPropagationTransformScan;
105801
- _internals58.writeWarnEvent = writeWarnEvent2;
105802
- _internals58.discoverAvailableSkills = discoverAvailableSkills;
105803
- _internals58.parseDelegationArgs = parseDelegationArgs;
105804
- _internals58.parseSkillPaths = parseSkillPaths;
105805
- _internals58.extractTaskIdFromPrompt = extractTaskIdFromPrompt;
105806
- _internals58.extractSkillsFieldFromPrompt = extractSkillsFieldFromPrompt;
105807
- _internals58.formatSkillIndexWithContext = formatSkillIndexWithContext;
105808
- _internals58.loadRoutingSkills = loadRoutingSkills;
105937
+ _internals59.skillPropagationGateBefore = skillPropagationGateBefore;
105938
+ _internals59.skillPropagationTransformScan = skillPropagationTransformScan;
105939
+ _internals59.writeWarnEvent = writeWarnEvent2;
105940
+ _internals59.discoverAvailableSkills = discoverAvailableSkills;
105941
+ _internals59.parseDelegationArgs = parseDelegationArgs;
105942
+ _internals59.parseSkillPaths = parseSkillPaths;
105943
+ _internals59.extractTaskIdFromPrompt = extractTaskIdFromPrompt;
105944
+ _internals59.extractSkillsFieldFromPrompt = extractSkillsFieldFromPrompt;
105945
+ _internals59.formatSkillIndexWithContext = formatSkillIndexWithContext;
105946
+ _internals59.loadRoutingSkills = loadRoutingSkills;
105809
105947
 
105810
105948
  // src/index.ts
105811
105949
  init_skill_usage_log();
@@ -109920,7 +110058,7 @@ var VALID_TASK_ID = /^\d+\.\d+(\.\d+)*$/;
109920
110058
  var COUNCIL_GATE_NAME = "council";
109921
110059
  var COUNCIL_AGENT_ID = "architect";
109922
110060
  var EvidenceFileSchema = exports_external.record(exports_external.string(), exports_external.unknown());
109923
- var _internals59 = {
110061
+ var _internals60 = {
109924
110062
  withTaskEvidenceLock
109925
110063
  };
109926
110064
  var FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
@@ -109955,7 +110093,7 @@ async function writeCouncilEvidence(workingDir, synthesis) {
109955
110093
  const dir = join102(workingDir, EVIDENCE_DIR2);
109956
110094
  mkdirSync32(dir, { recursive: true });
109957
110095
  const filePath = taskEvidencePath(workingDir, synthesis.taskId);
109958
- await _internals59.withTaskEvidenceLock(workingDir, synthesis.taskId, COUNCIL_AGENT_ID, async () => {
110096
+ await _internals60.withTaskEvidenceLock(workingDir, synthesis.taskId, COUNCIL_AGENT_ID, async () => {
109959
110097
  const existingRoot = Object.create(null);
109960
110098
  if (existsSync69(filePath)) {
109961
110099
  try {
@@ -115076,7 +115214,7 @@ function resolveDefaultReviewerAgent(generatedAgentNames) {
115076
115214
  }
115077
115215
  async function compileReviewPackage(directory, phase, sessionID, requireDiffSummary) {
115078
115216
  const lanes = await listLaneEvidence(directory, phase);
115079
- const persisted = _internals60.readPersisted?.(directory) ?? null;
115217
+ const persisted = _internals61.readPersisted?.(directory) ?? null;
115080
115218
  if (persisted) {
115081
115219
  let matchingRunState = null;
115082
115220
  for (const sessionState of Object.values(persisted.sessions)) {
@@ -115268,7 +115406,7 @@ Be specific and evidence-based. Do not approve a phase with unresolved degraded
115268
115406
  client.session.delete({ path: { id: sessionId } }).catch(() => {});
115269
115407
  }
115270
115408
  }
115271
- var _internals60 = {
115409
+ var _internals61 = {
115272
115410
  compileReviewPackage,
115273
115411
  parseReviewerVerdict,
115274
115412
  writeReviewerEvidence,
@@ -115285,28 +115423,28 @@ async function dispatchPhaseReviewer(directory, phase, sessionID, config3) {
115285
115423
  };
115286
115424
  const generatedAgentNames = swarmState.generatedAgentNames;
115287
115425
  const agentName = mergedConfig.reviewerAgent || resolveDefaultReviewerAgent(generatedAgentNames);
115288
- const pkg = await _internals60.compileReviewPackage(directory, phase, sessionID, mergedConfig.requireDiffSummary);
115426
+ const pkg = await _internals61.compileReviewPackage(directory, phase, sessionID, mergedConfig.requireDiffSummary);
115289
115427
  let responseText;
115290
115428
  try {
115291
- responseText = await _internals60.dispatchReviewerAgent(directory, pkg, agentName, mergedConfig.timeoutMs);
115429
+ responseText = await _internals61.dispatchReviewerAgent(directory, pkg, agentName, mergedConfig.timeoutMs);
115292
115430
  } catch (error93) {
115293
- const evidencePath2 = await _internals60.writeReviewerEvidence(directory, phase, "REJECTED", error93 instanceof Error ? error93.message : String(error93));
115431
+ const evidencePath2 = await _internals61.writeReviewerEvidence(directory, phase, "REJECTED", error93 instanceof Error ? error93.message : String(error93));
115294
115432
  return {
115295
115433
  verdict: "REJECTED",
115296
115434
  reason: `Reviewer dispatch failed: ${error93 instanceof Error ? error93.message : String(error93)}`,
115297
115435
  evidencePath: evidencePath2
115298
115436
  };
115299
115437
  }
115300
- const parsed = _internals60.parseReviewerVerdict(responseText);
115438
+ const parsed = _internals61.parseReviewerVerdict(responseText);
115301
115439
  if (!parsed) {
115302
- const evidencePath2 = await _internals60.writeReviewerEvidence(directory, phase, "REJECTED", "Reviewer response could not be parsed");
115440
+ const evidencePath2 = await _internals61.writeReviewerEvidence(directory, phase, "REJECTED", "Reviewer response could not be parsed");
115303
115441
  return {
115304
115442
  verdict: "REJECTED",
115305
115443
  reason: "Reviewer response could not be parsed",
115306
115444
  evidencePath: evidencePath2
115307
115445
  };
115308
115446
  }
115309
- const evidencePath = await _internals60.writeReviewerEvidence(directory, phase, parsed.verdict, parsed.reason);
115447
+ const evidencePath = await _internals61.writeReviewerEvidence(directory, phase, parsed.verdict, parsed.reason);
115310
115448
  return {
115311
115449
  verdict: parsed.verdict,
115312
115450
  reason: parsed.reason,
@@ -115813,7 +115951,7 @@ ${fileList}
115813
115951
 
115814
115952
  // src/tools/lean-turbo-run-phase.ts
115815
115953
  init_create_tool();
115816
- var _internals61 = {
115954
+ var _internals62 = {
115817
115955
  LeanTurboRunner,
115818
115956
  loadPluginConfigWithMeta
115819
115957
  };
@@ -115823,9 +115961,9 @@ async function executeLeanTurboRunPhase(args2) {
115823
115961
  let runError = null;
115824
115962
  let runner = null;
115825
115963
  try {
115826
- const { config: config3 } = _internals61.loadPluginConfigWithMeta(directory);
115964
+ const { config: config3 } = _internals62.loadPluginConfigWithMeta(directory);
115827
115965
  const leanConfig = config3.turbo?.strategy === "lean" ? config3.turbo.lean : undefined;
115828
- runner = new _internals61.LeanTurboRunner({
115966
+ runner = new _internals62.LeanTurboRunner({
115829
115967
  directory,
115830
115968
  sessionID,
115831
115969
  opencodeClient: swarmState.opencodeClient ?? null,
@@ -116186,7 +116324,7 @@ function isStaticallyEquivalent(originalCode, mutatedCode) {
116186
116324
  const strippedMutated = stripCode(mutatedCode);
116187
116325
  return strippedOriginal === strippedMutated;
116188
116326
  }
116189
- var _internals62 = {
116327
+ var _internals63 = {
116190
116328
  isStaticallyEquivalent,
116191
116329
  checkEquivalence,
116192
116330
  batchCheckEquivalence
@@ -116226,7 +116364,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
116226
116364
  const results = [];
116227
116365
  for (const { patch, originalCode, mutatedCode } of patches) {
116228
116366
  try {
116229
- const result = await _internals62.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
116367
+ const result = await _internals63.checkEquivalence(patch, originalCode, mutatedCode, llmJudge);
116230
116368
  results.push(result);
116231
116369
  } catch (err2) {
116232
116370
  results.push({
@@ -116245,7 +116383,7 @@ async function batchCheckEquivalence(patches, llmJudge) {
116245
116383
  var MUTATION_TIMEOUT_MS = 30000;
116246
116384
  var TOTAL_BUDGET_MS = 300000;
116247
116385
  var GIT_APPLY_TIMEOUT_MS = 5000;
116248
- var _internals63 = {
116386
+ var _internals64 = {
116249
116387
  executeMutation,
116250
116388
  computeReport,
116251
116389
  executeMutationSuite,
@@ -116277,7 +116415,7 @@ async function executeMutation(patch, testCommand, _testFiles, workingDir) {
116277
116415
  };
116278
116416
  }
116279
116417
  try {
116280
- const applyResult = _internals63.spawnSync("git", ["apply", "--", patchFile], {
116418
+ const applyResult = _internals64.spawnSync("git", ["apply", "--", patchFile], {
116281
116419
  cwd: workingDir,
116282
116420
  timeout: GIT_APPLY_TIMEOUT_MS,
116283
116421
  stdio: "pipe"
@@ -116306,7 +116444,7 @@ async function executeMutation(patch, testCommand, _testFiles, workingDir) {
116306
116444
  }
116307
116445
  let testPassed = false;
116308
116446
  try {
116309
- const spawnResult = _internals63.spawnSync(testCommand[0], testCommand.slice(1), {
116447
+ const spawnResult = _internals64.spawnSync(testCommand[0], testCommand.slice(1), {
116310
116448
  cwd: workingDir,
116311
116449
  timeout: MUTATION_TIMEOUT_MS,
116312
116450
  stdio: "pipe"
@@ -116339,7 +116477,7 @@ async function executeMutation(patch, testCommand, _testFiles, workingDir) {
116339
116477
  } finally {
116340
116478
  if (patchFile) {
116341
116479
  try {
116342
- const revertResult = _internals63.spawnSync("git", ["apply", "-R", "--", patchFile], {
116480
+ const revertResult = _internals64.spawnSync("git", ["apply", "-R", "--", patchFile], {
116343
116481
  cwd: workingDir,
116344
116482
  timeout: GIT_APPLY_TIMEOUT_MS,
116345
116483
  stdio: "pipe"
@@ -116532,7 +116670,7 @@ async function executeMutationSuite(patches, testCommand, testFiles, workingDir,
116532
116670
  }
116533
116671
 
116534
116672
  // src/mutation/gate.ts
116535
- var _internals64 = {
116673
+ var _internals65 = {
116536
116674
  evaluateMutationGate,
116537
116675
  buildTestImprovementPrompt,
116538
116676
  buildMessage
@@ -116553,8 +116691,8 @@ function evaluateMutationGate(report, passThreshold = PASS_THRESHOLD, warnThresh
116553
116691
  } else {
116554
116692
  verdict = "fail";
116555
116693
  }
116556
- const testImprovementPrompt = _internals64.buildTestImprovementPrompt(report, passThreshold, verdict);
116557
- const message = _internals64.buildMessage(verdict, adjustedKillRate, report.killed, report.totalMutants, report.equivalent, warnThreshold);
116694
+ const testImprovementPrompt = _internals65.buildTestImprovementPrompt(report, passThreshold, verdict);
116695
+ const message = _internals65.buildMessage(verdict, adjustedKillRate, report.killed, report.totalMutants, report.equivalent, warnThreshold);
116558
116696
  return {
116559
116697
  verdict,
116560
116698
  killRate: report.killRate,
@@ -116949,7 +117087,7 @@ function listLaneEvidenceSync(directory, phase) {
116949
117087
  }
116950
117088
  return laneIds;
116951
117089
  }
116952
- var _internals65 = {
117090
+ var _internals66 = {
116953
117091
  listActiveLocks,
116954
117092
  readPersisted: readPersisted2,
116955
117093
  readPlanJson: defaultReadPlanJson,
@@ -117010,7 +117148,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
117010
117148
  reason: "Lean Turbo state unreadable or missing"
117011
117149
  };
117012
117150
  }
117013
- const persisted = _internals65.readPersisted(directory);
117151
+ const persisted = _internals66.readPersisted(directory);
117014
117152
  if (!persisted) {
117015
117153
  return {
117016
117154
  ok: false,
@@ -117074,7 +117212,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
117074
117212
  }
117075
117213
  }
117076
117214
  if (runState.lanes.length > 0) {
117077
- const evidenceLaneIds = new Set(_internals65.listLaneEvidenceSync(directory, phase));
117215
+ const evidenceLaneIds = new Set(_internals66.listLaneEvidenceSync(directory, phase));
117078
117216
  for (const lane of runState.lanes) {
117079
117217
  if ((lane.status === "completed" || lane.status === "failed") && !evidenceLaneIds.has(lane.laneId)) {
117080
117218
  return {
@@ -117084,7 +117222,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
117084
117222
  }
117085
117223
  }
117086
117224
  }
117087
- const activeLocks = _internals65.listActiveLocks(directory);
117225
+ const activeLocks = _internals66.listActiveLocks(directory);
117088
117226
  const phaseLaneIds = new Set(laneIds);
117089
117227
  for (const lock of activeLocks) {
117090
117228
  if (lock.laneId && phaseLaneIds.has(lock.laneId)) {
@@ -117104,7 +117242,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
117104
117242
  }
117105
117243
  const serialDegradedTasks = runState.degradedTasks.filter((dt) => !laneTaskIds.has(dt.taskId));
117106
117244
  if (serialDegradedTasks.length > 0) {
117107
- const plan = _internals65.readPlanJson(directory);
117245
+ const plan = _internals66.readPlanJson(directory);
117108
117246
  if (!plan) {
117109
117247
  return {
117110
117248
  ok: false,
@@ -117148,7 +117286,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
117148
117286
  }
117149
117287
  const serializedTasks = runState.serializedTasks;
117150
117288
  if (Array.isArray(serializedTasks) && serializedTasks.length > 0) {
117151
- const plan = _internals65.readPlanJson(directory);
117289
+ const plan = _internals66.readPlanJson(directory);
117152
117290
  if (!plan) {
117153
117291
  return {
117154
117292
  ok: false,
@@ -117207,7 +117345,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
117207
117345
  }
117208
117346
  let reviewerVerdict = runState.lastReviewerVerdict;
117209
117347
  if (!reviewerVerdict) {
117210
- const evidence = _internals65.readReviewerEvidence(directory, phase);
117348
+ const evidence = _internals66.readReviewerEvidence(directory, phase);
117211
117349
  reviewerVerdict = evidence?.verdict ?? undefined;
117212
117350
  }
117213
117351
  if (mergedConfig.phase_reviewer) {
@@ -117220,7 +117358,7 @@ function verifyLeanTurboPhaseReady(directory, phase, sessionIDOrConfig, config3)
117220
117358
  }
117221
117359
  let criticVerdict = runState.lastCriticVerdict;
117222
117360
  if (!criticVerdict) {
117223
- const evidence = _internals65.readCriticEvidence(directory, phase);
117361
+ const evidence = _internals66.readCriticEvidence(directory, phase);
117224
117362
  criticVerdict = evidence?.verdict ?? undefined;
117225
117363
  }
117226
117364
  if (mergedConfig.phase_critic) {
@@ -118320,7 +118458,7 @@ async function executePhaseComplete(args2, workingDirectory, directory) {
118320
118458
  phase_critic: leanConfig.phase_critic,
118321
118459
  integrated_diff_required: leanConfig.integrated_diff_required
118322
118460
  } : undefined;
118323
- const leanCheck = _internals65.verifyLeanTurboPhaseReady(dir, phase, sessionID, leanPhaseReadyConfig);
118461
+ const leanCheck = _internals66.verifyLeanTurboPhaseReady(dir, phase, sessionID, leanPhaseReadyConfig);
118324
118462
  if (!leanCheck.ok) {
118325
118463
  return JSON.stringify({
118326
118464
  success: false,
@@ -120583,11 +120721,11 @@ var quality_budget = createSwarmTool({
120583
120721
  }).optional().describe("Quality budget thresholds")
120584
120722
  },
120585
120723
  async execute(args2, directory) {
120586
- const result = await _internals67.qualityBudget(args2, directory);
120724
+ const result = await _internals68.qualityBudget(args2, directory);
120587
120725
  return JSON.stringify(result);
120588
120726
  }
120589
120727
  });
120590
- var _internals67 = {
120728
+ var _internals68 = {
120591
120729
  qualityBudget
120592
120730
  };
120593
120731
 
@@ -121316,7 +121454,7 @@ import * as path149 from "node:path";
121316
121454
  var semgrepAvailableCache = null;
121317
121455
  var DEFAULT_RULES_DIR = ".swarm/semgrep-rules";
121318
121456
  var DEFAULT_TIMEOUT_MS3 = 30000;
121319
- var _internals68 = {
121457
+ var _internals69 = {
121320
121458
  isSemgrepAvailable,
121321
121459
  checkSemgrepAvailable,
121322
121460
  resetSemgrepCache,
@@ -121341,7 +121479,7 @@ function isSemgrepAvailable() {
121341
121479
  }
121342
121480
  }
121343
121481
  async function checkSemgrepAvailable() {
121344
- return _internals68.isSemgrepAvailable();
121482
+ return _internals69.isSemgrepAvailable();
121345
121483
  }
121346
121484
  function resetSemgrepCache() {
121347
121485
  semgrepAvailableCache = null;
@@ -121438,12 +121576,12 @@ async function runSemgrep(options) {
121438
121576
  const timeoutMs = options.timeoutMs || DEFAULT_TIMEOUT_MS3;
121439
121577
  if (files.length === 0) {
121440
121578
  return {
121441
- available: _internals68.isSemgrepAvailable(),
121579
+ available: _internals69.isSemgrepAvailable(),
121442
121580
  findings: [],
121443
121581
  engine: "tier_a"
121444
121582
  };
121445
121583
  }
121446
- if (!_internals68.isSemgrepAvailable()) {
121584
+ if (!_internals69.isSemgrepAvailable()) {
121447
121585
  return {
121448
121586
  available: false,
121449
121587
  findings: [],
@@ -121602,7 +121740,7 @@ function assignOccurrenceIndices(findings, directory) {
121602
121740
  }
121603
121741
  const occIdx = countMap.get(baseKey) ?? 0;
121604
121742
  countMap.set(baseKey, occIdx + 1);
121605
- const fp = _internals69.fingerprintFinding(finding, directory, occIdx);
121743
+ const fp = _internals70.fingerprintFinding(finding, directory, occIdx);
121606
121744
  return {
121607
121745
  finding,
121608
121746
  index: occIdx,
@@ -121671,7 +121809,7 @@ async function captureOrMergeBaseline(directory, phase, findings, engine, scanne
121671
121809
  }
121672
121810
  } catch {}
121673
121811
  const scannedRelFiles = new Set(scannedFiles.map((f) => normalizeFindingPath(directory, f)));
121674
- const indexed = _internals69.assignOccurrenceIndices(findings, directory);
121812
+ const indexed = _internals70.assignOccurrenceIndices(findings, directory);
121675
121813
  if (existing && !opts?.force) {
121676
121814
  const prunedFingerprints = existing.fingerprints.filter((fp) => {
121677
121815
  const relFile = fp.slice(0, fp.indexOf("|"));
@@ -121811,7 +121949,7 @@ function loadBaseline(directory, phase) {
121811
121949
  };
121812
121950
  }
121813
121951
  }
121814
- var _internals69 = {
121952
+ var _internals70 = {
121815
121953
  fingerprintFinding,
121816
121954
  assignOccurrenceIndices,
121817
121955
  captureOrMergeBaseline,
@@ -122221,11 +122359,11 @@ var sast_scan = createSwarmTool({
122221
122359
  capture_baseline: safeArgs.capture_baseline,
122222
122360
  phase: safeArgs.phase
122223
122361
  };
122224
- const result = await _internals70.sastScan(input, directory);
122362
+ const result = await _internals71.sastScan(input, directory);
122225
122363
  return JSON.stringify(result, null, 2);
122226
122364
  }
122227
122365
  });
122228
- var _internals70 = {
122366
+ var _internals71 = {
122229
122367
  sastScan,
122230
122368
  sast_scan
122231
122369
  };
@@ -127171,7 +127309,7 @@ var swarm_memory_propose = createSwarmTool({
127171
127309
  evidenceRefs: exports_external.array(exports_external.string().min(1).max(500)).max(20).optional().describe("Evidence refs such as files, commits, test outputs, or URLs")
127172
127310
  },
127173
127311
  execute: async (args2, directory, ctx) => {
127174
- const { config: config3 } = _internals71.loadPluginConfigWithMeta(directory);
127312
+ const { config: config3 } = _internals72.loadPluginConfigWithMeta(directory);
127175
127313
  if (config3.memory?.enabled !== true) {
127176
127314
  return JSON.stringify({
127177
127315
  success: false,
@@ -127187,7 +127325,7 @@ var swarm_memory_propose = createSwarmTool({
127187
127325
  });
127188
127326
  }
127189
127327
  const agent = getContextAgent2(ctx);
127190
- const gateway = _internals71.createMemoryGateway({
127328
+ const gateway = _internals72.createMemoryGateway({
127191
127329
  directory,
127192
127330
  sessionID: ctx?.sessionID,
127193
127331
  agentRole: agent,
@@ -127212,7 +127350,7 @@ var swarm_memory_propose = createSwarmTool({
127212
127350
  }
127213
127351
  }
127214
127352
  });
127215
- var _internals71 = {
127353
+ var _internals72 = {
127216
127354
  loadPluginConfigWithMeta,
127217
127355
  createMemoryGateway
127218
127356
  };
@@ -127250,7 +127388,7 @@ var swarm_memory_recall = createSwarmTool({
127250
127388
  maxItems: exports_external.number().int().min(1).max(20).optional().describe("Maximum memories to return")
127251
127389
  },
127252
127390
  execute: async (args2, directory, ctx) => {
127253
- const { config: config3 } = _internals72.loadPluginConfigWithMeta(directory);
127391
+ const { config: config3 } = _internals73.loadPluginConfigWithMeta(directory);
127254
127392
  if (config3.memory?.enabled !== true) {
127255
127393
  return JSON.stringify({
127256
127394
  success: false,
@@ -127266,7 +127404,7 @@ var swarm_memory_recall = createSwarmTool({
127266
127404
  });
127267
127405
  }
127268
127406
  const agent = getContextAgent3(ctx);
127269
- const gateway = _internals72.createMemoryGateway({
127407
+ const gateway = _internals73.createMemoryGateway({
127270
127408
  directory,
127271
127409
  sessionID: ctx?.sessionID,
127272
127410
  agentRole: agent,
@@ -127299,7 +127437,7 @@ var RecallArgsSchema = exports_external.object({
127299
127437
  kinds: exports_external.array(exports_external.enum(MEMORY_KINDS2)).optional(),
127300
127438
  maxItems: exports_external.number().int().min(1).max(20).optional()
127301
127439
  });
127302
- var _internals72 = {
127440
+ var _internals73 = {
127303
127441
  loadPluginConfigWithMeta,
127304
127442
  createMemoryGateway
127305
127443
  };
@@ -127814,7 +127952,7 @@ import * as path165 from "node:path";
127814
127952
  init_bun_compat();
127815
127953
  import * as fs122 from "node:fs";
127816
127954
  import * as path164 from "node:path";
127817
- var _internals73 = { bunSpawn };
127955
+ var _internals74 = { bunSpawn };
127818
127956
  var _swarmGitExcludedChecked = false;
127819
127957
  function fileCoversSwarm(content) {
127820
127958
  for (const rawLine of content.split(`
@@ -127847,7 +127985,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
127847
127985
  checkIgnoreExitCode
127848
127986
  ] = await Promise.all([
127849
127987
  (async () => {
127850
- const proc = _internals73.bunSpawn(["git", "-C", directory, "rev-parse", "--show-toplevel"], GIT_SPAWN_OPTIONS);
127988
+ const proc = _internals74.bunSpawn(["git", "-C", directory, "rev-parse", "--show-toplevel"], GIT_SPAWN_OPTIONS);
127851
127989
  try {
127852
127990
  return await Promise.all([proc.exited, proc.stdout.text()]);
127853
127991
  } finally {
@@ -127857,7 +127995,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
127857
127995
  }
127858
127996
  })(),
127859
127997
  (async () => {
127860
- const proc = _internals73.bunSpawn(["git", "-C", directory, "rev-parse", "--git-path", "info/exclude"], GIT_SPAWN_OPTIONS);
127998
+ const proc = _internals74.bunSpawn(["git", "-C", directory, "rev-parse", "--git-path", "info/exclude"], GIT_SPAWN_OPTIONS);
127861
127999
  try {
127862
128000
  return await Promise.all([proc.exited, proc.stdout.text()]);
127863
128001
  } finally {
@@ -127867,7 +128005,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
127867
128005
  }
127868
128006
  })(),
127869
128007
  (async () => {
127870
- const proc = _internals73.bunSpawn(["git", "-C", directory, "check-ignore", "-q", ".swarm/.gitkeep"], GIT_SPAWN_OPTIONS);
128008
+ const proc = _internals74.bunSpawn(["git", "-C", directory, "check-ignore", "-q", ".swarm/.gitkeep"], GIT_SPAWN_OPTIONS);
127871
128009
  try {
127872
128010
  return await proc.exited;
127873
128011
  } finally {
@@ -127906,7 +128044,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
127906
128044
  }
127907
128045
  } catch {}
127908
128046
  }
127909
- const trackedProc = _internals73.bunSpawn(["git", "-C", directory, "ls-files", "--", ".swarm"], GIT_SPAWN_OPTIONS);
128047
+ const trackedProc = _internals74.bunSpawn(["git", "-C", directory, "ls-files", "--", ".swarm"], GIT_SPAWN_OPTIONS);
127910
128048
  let trackedExitCode;
127911
128049
  let trackedOutput;
127912
128050
  try {
@@ -127931,7 +128069,7 @@ async function ensureSwarmGitExcluded(directory, options = {}) {
127931
128069
  }
127932
128070
 
127933
128071
  // src/hooks/diff-scope.ts
127934
- var _internals74 = { bunSpawn };
128072
+ var _internals75 = { bunSpawn };
127935
128073
  function getDeclaredScope(taskId, directory) {
127936
128074
  try {
127937
128075
  const planPath = path165.join(directory, ".swarm", "plan.json");
@@ -127966,7 +128104,7 @@ var GIT_DIFF_SPAWN_OPTIONS = {
127966
128104
  };
127967
128105
  async function getChangedFiles(directory) {
127968
128106
  try {
127969
- const proc = _internals74.bunSpawn(["git", "diff", "--name-only", "HEAD~1"], {
128107
+ const proc = _internals75.bunSpawn(["git", "diff", "--name-only", "HEAD~1"], {
127970
128108
  cwd: directory,
127971
128109
  ...GIT_DIFF_SPAWN_OPTIONS
127972
128110
  });
@@ -127983,7 +128121,7 @@ async function getChangedFiles(directory) {
127983
128121
  return stdout.trim().split(`
127984
128122
  `).map((f) => f.trim()).filter((f) => f.length > 0);
127985
128123
  }
127986
- const proc2 = _internals74.bunSpawn(["git", "diff", "--name-only", "HEAD"], {
128124
+ const proc2 = _internals75.bunSpawn(["git", "diff", "--name-only", "HEAD"], {
127987
128125
  cwd: directory,
127988
128126
  ...GIT_DIFF_SPAWN_OPTIONS
127989
128127
  });
@@ -128041,7 +128179,7 @@ init_telemetry();
128041
128179
  init_file_locks();
128042
128180
  import * as fs124 from "node:fs";
128043
128181
  import * as path166 from "node:path";
128044
- var _internals75 = {
128182
+ var _internals76 = {
128045
128183
  listActiveLocks,
128046
128184
  verifyLeanTurboTaskCompletion
128047
128185
  };
@@ -128183,7 +128321,7 @@ function verifyLeanTurboTaskCompletion(directory, taskId, sessionID) {
128183
128321
  }
128184
128322
  };
128185
128323
  }
128186
- const activeLocks = _internals75.listActiveLocks(directory);
128324
+ const activeLocks = _internals76.listActiveLocks(directory);
128187
128325
  const laneLocks = activeLocks.filter((lock) => lock.laneId === lane.laneId);
128188
128326
  if (laneLocks.length > 0) {
128189
128327
  return {
@@ -128573,6 +128711,12 @@ function recoverTaskStateFromDelegations(taskId, directory) {
128573
128711
  advanceTaskState(session, taskId, "coder_delegated");
128574
128712
  } catch {}
128575
128713
  }
128714
+ if (hasReviewer) {
128715
+ recordStageBCompletion(session, taskId, "reviewer");
128716
+ }
128717
+ if (hasTestEngineer) {
128718
+ recordStageBCompletion(session, taskId, "test_engineer");
128719
+ }
128576
128720
  if (hasReviewer) {
128577
128721
  const stateNow = getTaskState(session, taskId);
128578
128722
  if (stateNow === "coder_delegated" || stateNow === "pre_check_passed") {
@@ -129076,7 +129220,7 @@ var web_search = createSwarmTool({
129076
129220
  });
129077
129221
  async function captureSearchEvidence(directory, query, results) {
129078
129222
  try {
129079
- const written = await _internals76.writeEvidenceDocuments(directory, results.map((result) => ({
129223
+ const written = await _internals77.writeEvidenceDocuments(directory, results.map((result) => ({
129080
129224
  sourceType: "web_search",
129081
129225
  query,
129082
129226
  title: result.title,
@@ -129104,7 +129248,7 @@ async function captureSearchEvidence(directory, query, results) {
129104
129248
  };
129105
129249
  }
129106
129250
  }
129107
- var _internals76 = {
129251
+ var _internals77 = {
129108
129252
  writeEvidenceDocuments
129109
129253
  };
129110
129254
 
@@ -130354,7 +130498,7 @@ async function initializeOpenCodeSwarm(ctx) {
130354
130498
  ...opencodeConfig.command || {},
130355
130499
  swarm: {
130356
130500
  template: "/swarm $ARGUMENTS",
130357
- description: "Swarm management commands: /swarm [status|show-plan|plan|agents|history|config|help|evidence|handoff|archive|diagnose|diagnosis|preflight|sync-plan|benchmark|export|reset|rollback|retrieve|clarify|analyze|specify|brainstorm|council|pr-review|issue|qa-gates|dark-matter|knowledge|memory|curate|concurrency|turbo|full-auto|write-retro|reset-session|simulate|promote|checkpoint|acknowledge-spec-drift|doctor tools|finalize|close]"
130501
+ description: "Swarm management commands: /swarm [status|show-plan|plan|agents|history|config|help|evidence|handoff|archive|diagnose|diagnosis|preflight|sync-plan|benchmark|export|reset|rollback|retrieve|clarify|analyze|specify|brainstorm|council|pr-review|pr-feedback|deep-dive|design-docs|issue|qa-gates|dark-matter|knowledge|memory|curate|concurrency|turbo|full-auto|write-retro|reset-session|simulate|promote|checkpoint|acknowledge-spec-drift|doctor tools|finalize|close]"
130358
130502
  },
130359
130503
  "swarm-status": {
130360
130504
  template: "/swarm status",
@@ -130452,10 +130596,18 @@ async function initializeOpenCodeSwarm(ctx) {
130452
130596
  template: "/swarm pr-review $ARGUMENTS",
130453
130597
  description: "Use /swarm pr-review to launch deep PR review with multi-lane analysis"
130454
130598
  },
130599
+ "swarm-pr-feedback": {
130600
+ template: "/swarm pr-feedback $ARGUMENTS",
130601
+ description: "Use /swarm pr-feedback to ingest and close known PR feedback (review comments, CI failures, conflicts) without a fresh broad review"
130602
+ },
130455
130603
  "swarm-deep-dive": {
130456
130604
  template: "/swarm deep-dive $ARGUMENTS",
130457
130605
  description: "Use /swarm deep-dive to launch a read-only deep audit with parallel explorer waves, dual reviewers, and critic challenge"
130458
130606
  },
130607
+ "swarm-design-docs": {
130608
+ template: "/swarm design-docs $ARGUMENTS",
130609
+ description: "Use /swarm design-docs to generate or sync language-agnostic design docs for the project under build"
130610
+ },
130459
130611
  "swarm-issue": {
130460
130612
  template: "/swarm issue $ARGUMENTS",
130461
130613
  description: "Use /swarm issue to ingest a GitHub issue into the swarm workflow"