opencode-swarm 7.71.0 → 7.71.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -52,7 +52,7 @@ var package_default;
52
52
  var init_package = __esm(() => {
53
53
  package_default = {
54
54
  name: "opencode-swarm",
55
- version: "7.71.0",
55
+ version: "7.71.1",
56
56
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
57
57
  main: "dist/index.js",
58
58
  types: "dist/index.d.ts",
@@ -14699,7 +14699,7 @@ var init_plan_schema = __esm(() => {
14699
14699
  ExecutionProfileSchema = exports_external.object({
14700
14700
  parallelization_enabled: exports_external.boolean().default(false),
14701
14701
  max_concurrent_tasks: exports_external.number().int().min(1).max(64).default(1),
14702
- council_parallel: exports_external.boolean().default(false),
14702
+ council_parallel: exports_external.boolean().default(true),
14703
14703
  locked: exports_external.boolean().default(false),
14704
14704
  auto_proceed: exports_external.boolean().default(false)
14705
14705
  });
@@ -22061,6 +22061,22 @@ var init_worktree = __esm(() => {
22061
22061
  init_merge();
22062
22062
  });
22063
22063
 
22064
+ // src/hooks/delegation-gate/worktree-isolation.ts
22065
+ function resetStandardWorktreeIsolationState() {
22066
+ standardWorktreeByCallID.clear();
22067
+ standardWorktreeSerializationSessions.clear();
22068
+ standardWorktreeMergeQueue = Promise.resolve();
22069
+ }
22070
+ var standardWorktreeByCallID, standardWorktreeSerializationSessions, standardWorktreeMergeQueue;
22071
+ var init_worktree_isolation = __esm(() => {
22072
+ init_constants();
22073
+ init_state();
22074
+ init_worktree();
22075
+ standardWorktreeByCallID = new Map;
22076
+ standardWorktreeSerializationSessions = new Set;
22077
+ standardWorktreeMergeQueue = Promise.resolve();
22078
+ });
22079
+
22064
22080
  // node_modules/quick-lru/index.js
22065
22081
  var QuickLRU;
22066
22082
  var init_quick_lru = __esm(() => {
@@ -22335,6 +22351,20 @@ var init_quick_lru = __esm(() => {
22335
22351
  }
22336
22352
  };
22337
22353
  });
22354
+ // src/hooks/guardrails/file-authority.ts
22355
+ var pathNormalizationCache, globMatcherCache;
22356
+ var init_file_authority = __esm(() => {
22357
+ init_quick_lru();
22358
+ init_schema();
22359
+ init_utils();
22360
+ init_bun_compat();
22361
+ pathNormalizationCache = new QuickLRU({
22362
+ maxSize: 500
22363
+ });
22364
+ globMatcherCache = new QuickLRU({
22365
+ maxSize: 200
22366
+ });
22367
+ });
22338
22368
 
22339
22369
  // src/config/index.ts
22340
22370
  var init_config = __esm(() => {
@@ -22852,6 +22882,119 @@ var init_agents2 = __esm(() => {
22852
22882
  "thinking"
22853
22883
  ]);
22854
22884
  });
22885
+
22886
+ // src/hooks/conflict-resolution.ts
22887
+ var init_conflict_resolution = __esm(() => {
22888
+ init_state();
22889
+ init_telemetry();
22890
+ });
22891
+
22892
+ // src/hooks/extractors.ts
22893
+ function extractCurrentPhase(planContent) {
22894
+ if (!planContent) {
22895
+ return null;
22896
+ }
22897
+ const lines = planContent.split(`
22898
+ `);
22899
+ for (let i = 0;i < Math.min(20, lines.length); i++) {
22900
+ const line = lines[i].trim();
22901
+ const progressMatch = line.match(/^## Phase (\d+):?\s*(.*?)\s*\[IN PROGRESS\]/i);
22902
+ if (progressMatch) {
22903
+ const phaseNum = progressMatch[1];
22904
+ const description = progressMatch[2]?.trim() || "";
22905
+ return `Phase ${phaseNum}: ${description} [IN PROGRESS]`;
22906
+ }
22907
+ }
22908
+ for (let i = 0;i < Math.min(3, lines.length); i++) {
22909
+ const line = lines[i].trim();
22910
+ const phaseMatch = line.match(/Phase:\s*(\d+)/i);
22911
+ if (phaseMatch) {
22912
+ const phaseNum = phaseMatch[1];
22913
+ return `Phase ${phaseNum} [PENDING]`;
22914
+ }
22915
+ }
22916
+ return null;
22917
+ }
22918
+ function extractCurrentPhaseFromPlan(plan) {
22919
+ const phase = plan.phases.find((p) => p.id === plan.current_phase);
22920
+ if (!phase)
22921
+ return null;
22922
+ const statusMap = {
22923
+ pending: "PENDING",
22924
+ in_progress: "IN PROGRESS",
22925
+ complete: "COMPLETE",
22926
+ blocked: "BLOCKED"
22927
+ };
22928
+ const statusText = statusMap[phase.status] || "PENDING";
22929
+ return `Phase ${phase.id}: ${phase.name} [${statusText}]`;
22930
+ }
22931
+ var init_extractors = () => {};
22932
+
22933
+ // src/hooks/normalize-tool-name.ts
22934
+ var init_normalize_tool_name = () => {};
22935
+
22936
+ // src/hooks/guardrails/destructive-command.ts
22937
+ var DC_SAFE_TARGETS, DC_FS_ROOTS;
22938
+ var init_destructive_command = __esm(() => {
22939
+ DC_SAFE_TARGETS = new Set([
22940
+ "node_modules",
22941
+ ".git",
22942
+ "dist",
22943
+ "build",
22944
+ "coverage",
22945
+ ".next",
22946
+ ".turbo",
22947
+ ".cache",
22948
+ ".venv",
22949
+ "venv",
22950
+ "__pycache__",
22951
+ "target",
22952
+ "out",
22953
+ ".parcel-cache",
22954
+ ".svelte-kit",
22955
+ ".nuxt",
22956
+ ".output",
22957
+ ".angular",
22958
+ ".gradle",
22959
+ "vendor"
22960
+ ]);
22961
+ DC_FS_ROOTS = new Set(["/", "C:\\", "C:/", "D:\\", "D:/", "E:\\", "E:/"]);
22962
+ });
22963
+
22964
+ // src/hooks/model-limits.ts
22965
+ var loggedFirstCalls;
22966
+ var init_model_limits = __esm(() => {
22967
+ init_utils();
22968
+ loggedFirstCalls = new Set;
22969
+ });
22970
+
22971
+ // src/hooks/guardrails/messages-transform.ts
22972
+ var TRANSIENT_STATUS_CODES;
22973
+ var init_messages_transform = __esm(() => {
22974
+ init_constants();
22975
+ init_schema();
22976
+ init_manager();
22977
+ init_state();
22978
+ init_telemetry();
22979
+ init_utils();
22980
+ init_extractors();
22981
+ init_model_limits();
22982
+ init_file_authority();
22983
+ TRANSIENT_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504, 529]);
22984
+ });
22985
+
22986
+ // src/hooks/guardrails/stored-input-args.ts
22987
+ var storedInputArgs;
22988
+ var init_stored_input_args = __esm(() => {
22989
+ storedInputArgs = new Map;
22990
+ });
22991
+
22992
+ // src/sandbox/executor.ts
22993
+ var init_executor = () => {};
22994
+
22995
+ // src/sandbox/scope-resolver.ts
22996
+ var init_scope_resolver = () => {};
22997
+
22855
22998
  // src/scope/scope-persistence.ts
22856
22999
  import * as fs7 from "fs";
22857
23000
  import * as path10 from "path";
@@ -22897,6 +23040,11 @@ var init_scope_persistence = __esm(() => {
22897
23040
  ]);
22898
23041
  });
22899
23042
 
23043
+ // src/hooks/loop-detector.ts
23044
+ var init_loop_detector = __esm(() => {
23045
+ init_state();
23046
+ });
23047
+
22900
23048
  // src/hooks/shell-write-detect.ts
22901
23049
  import parse5 from "bash-parser";
22902
23050
  var REDIRECT_WRITE_TOKENS, REDIRECT_HERE_TOKENS, REDIRECT_ALL_WRITE_TOKENS, BUILTIN_WRITE_COMMANDS, INPLACE_EDIT_COMMANDS, INTERPRETER_EVAL_COMMANDS, NETWORK_DOWNLOAD_COMMANDS, ARCHIVE_EXTRACT_COMMANDS, _PS_WRITE_CMDLETS, _PS_WRITE_ALIASES, _CMD_WRITE_BUILTINS;
@@ -22964,97 +23112,53 @@ var init_shell_write_detect = __esm(() => {
22964
23112
  ]);
22965
23113
  });
22966
23114
 
22967
- // src/sandbox/executor.ts
22968
- var init_executor = () => {};
22969
-
22970
- // src/sandbox/scope-resolver.ts
22971
- var init_scope_resolver = () => {};
22972
-
22973
- // src/hooks/conflict-resolution.ts
22974
- var init_conflict_resolution = __esm(() => {
22975
- init_state();
22976
- init_telemetry();
23115
+ // src/hooks/guardrails/helpers.ts
23116
+ var init_helpers = __esm(() => {
23117
+ init_constants();
23118
+ init_normalize_tool_name();
23119
+ init_file_authority();
22977
23120
  });
22978
23121
 
22979
- // src/hooks/extractors.ts
22980
- function extractCurrentPhase(planContent) {
22981
- if (!planContent) {
22982
- return null;
22983
- }
22984
- const lines = planContent.split(`
22985
- `);
22986
- for (let i = 0;i < Math.min(20, lines.length); i++) {
22987
- const line = lines[i].trim();
22988
- const progressMatch = line.match(/^## Phase (\d+):?\s*(.*?)\s*\[IN PROGRESS\]/i);
22989
- if (progressMatch) {
22990
- const phaseNum = progressMatch[1];
22991
- const description = progressMatch[2]?.trim() || "";
22992
- return `Phase ${phaseNum}: ${description} [IN PROGRESS]`;
22993
- }
22994
- }
22995
- for (let i = 0;i < Math.min(3, lines.length); i++) {
22996
- const line = lines[i].trim();
22997
- const phaseMatch = line.match(/Phase:\s*(\d+)/i);
22998
- if (phaseMatch) {
22999
- const phaseNum = phaseMatch[1];
23000
- return `Phase ${phaseNum} [PENDING]`;
23001
- }
23002
- }
23003
- return null;
23004
- }
23005
- function extractCurrentPhaseFromPlan(plan) {
23006
- const phase = plan.phases.find((p) => p.id === plan.current_phase);
23007
- if (!phase)
23008
- return null;
23009
- const statusMap = {
23010
- pending: "PENDING",
23011
- in_progress: "IN PROGRESS",
23012
- complete: "COMPLETE",
23013
- blocked: "BLOCKED"
23014
- };
23015
- const statusText = statusMap[phase.status] || "PENDING";
23016
- return `Phase ${phase.id}: ${phase.name} [${statusText}]`;
23017
- }
23018
- var init_extractors = () => {};
23019
-
23020
- // src/hooks/loop-detector.ts
23021
- var init_loop_detector = __esm(() => {
23122
+ // src/hooks/guardrails/tool-before.ts
23123
+ var init_tool_before = __esm(() => {
23124
+ init_constants();
23125
+ init_schema();
23126
+ init_executor();
23127
+ init_scope_resolver();
23128
+ init_scope_persistence();
23022
23129
  init_state();
23023
- });
23024
-
23025
- // src/hooks/model-limits.ts
23026
- var loggedFirstCalls;
23027
- var init_model_limits = __esm(() => {
23130
+ init_telemetry();
23028
23131
  init_utils();
23029
- loggedFirstCalls = new Set;
23132
+ init_delegation_gate();
23133
+ init_loop_detector();
23134
+ init_normalize_tool_name();
23135
+ init_shell_write_detect();
23136
+ init_destructive_command();
23137
+ init_file_authority();
23138
+ init_guardrails();
23139
+ init_stored_input_args();
23140
+ init_helpers();
23030
23141
  });
23031
23142
 
23032
- // src/hooks/normalize-tool-name.ts
23033
- var init_normalize_tool_name = () => {};
23034
-
23035
- // src/hooks/guardrails.ts
23036
- var SPEC_DRIFT_BLOCKED_TOOLS, storedInputArgs, TRANSIENT_STATUS_CODES, toolCallsSinceLastWrite, noOpWarningIssued, consecutiveNoToolTurns, DC_SAFE_TARGETS, DC_FS_ROOTS, pathNormalizationCache, globMatcherCache;
23143
+ // src/hooks/guardrails/index.ts
23144
+ var SPEC_DRIFT_BLOCKED_TOOLS, TRANSIENT_STATUS_CODES2, toolCallsSinceLastWrite, noOpWarningIssued;
23037
23145
  var init_guardrails = __esm(() => {
23038
- init_quick_lru();
23039
23146
  init_agents2();
23040
23147
  init_constants();
23041
23148
  init_schema();
23042
23149
  init_manager();
23043
- init_scope_persistence();
23044
23150
  init_state();
23045
23151
  init_telemetry();
23046
23152
  init_utils();
23047
- init_shell_write_detect();
23048
- init_executor();
23049
- init_scope_resolver();
23050
- init_bun_compat();
23051
23153
  init_logger();
23052
23154
  init_conflict_resolution();
23053
- init_delegation_gate();
23054
23155
  init_extractors();
23055
- init_loop_detector();
23056
- init_model_limits();
23057
23156
  init_normalize_tool_name();
23157
+ init_destructive_command();
23158
+ init_file_authority();
23159
+ init_messages_transform();
23160
+ init_stored_input_args();
23161
+ init_tool_before();
23058
23162
  SPEC_DRIFT_BLOCKED_TOOLS = new Set([
23059
23163
  "save_plan",
23060
23164
  "update_task_status",
@@ -23062,63 +23166,34 @@ var init_guardrails = __esm(() => {
23062
23166
  "lean_turbo_run_phase",
23063
23167
  "lean_turbo_acquire_locks"
23064
23168
  ]);
23065
- storedInputArgs = new Map;
23066
- TRANSIENT_STATUS_CODES = new Set([408, 429, 500, 502, 503, 504, 529]);
23169
+ TRANSIENT_STATUS_CODES2 = new Set([408, 429, 500, 502, 503, 504, 529]);
23067
23170
  toolCallsSinceLastWrite = new Map;
23068
23171
  noOpWarningIssued = new Set;
23069
- consecutiveNoToolTurns = new Map;
23070
- DC_SAFE_TARGETS = new Set([
23071
- "node_modules",
23072
- ".git",
23073
- "dist",
23074
- "build",
23075
- "coverage",
23076
- ".next",
23077
- ".turbo",
23078
- ".cache",
23079
- ".venv",
23080
- "venv",
23081
- "__pycache__",
23082
- "target",
23083
- "out",
23084
- ".parcel-cache",
23085
- ".svelte-kit",
23086
- ".nuxt",
23087
- ".output",
23088
- ".angular",
23089
- ".gradle",
23090
- "vendor"
23091
- ]);
23092
- DC_FS_ROOTS = new Set(["/", "C:\\", "C:/", "D:\\", "D:/", "E:\\", "E:/"]);
23093
- pathNormalizationCache = new QuickLRU({
23094
- maxSize: 500
23095
- });
23096
- globMatcherCache = new QuickLRU({
23097
- maxSize: 200
23098
- });
23172
+ });
23173
+
23174
+ // src/hooks/guardrails.ts
23175
+ var init_guardrails2 = __esm(() => {
23176
+ init_file_authority();
23177
+ init_guardrails();
23178
+ init_stored_input_args();
23099
23179
  });
23100
23180
 
23101
23181
  // src/hooks/delegation-gate.ts
23102
23182
  function clearPendingCoderScope() {
23103
23183
  pendingCoderScopeByTaskId.clear();
23104
23184
  }
23105
- function resetStandardWorktreeIsolationState() {
23106
- standardWorktreeByCallID.clear();
23107
- standardWorktreeSerializationSessions.clear();
23108
- standardWorktreeMergeQueue = Promise.resolve();
23109
- }
23110
- var EvidenceTaskIdPlanSchema, pendingCoderScopeByTaskId, SWARM_BACKGROUND_TASK_BLOCKED_MESSAGE, ACTIVE_PARALLEL_TASK_STATES, standardWorktreeByCallID, standardWorktreeSerializationSessions, standardWorktreeMergeQueue;
23185
+ var EvidenceTaskIdPlanSchema, pendingCoderScopeByTaskId, SWARM_BACKGROUND_TASK_BLOCKED_MESSAGE, ACTIVE_PARALLEL_TASK_STATES;
23111
23186
  var init_delegation_gate = __esm(() => {
23112
23187
  init_zod();
23113
- init_constants();
23114
23188
  init_schema();
23115
23189
  init_manager();
23116
23190
  init_state();
23117
23191
  init_telemetry();
23118
23192
  init_logger();
23119
23193
  init_task_id();
23120
- init_worktree();
23121
- init_guardrails();
23194
+ init_worktree_isolation();
23195
+ init_worktree_isolation();
23196
+ init_guardrails2();
23122
23197
  init_normalize_tool_name();
23123
23198
  init_utils2();
23124
23199
  EvidenceTaskIdPlanSchema = exports_external.object({
@@ -23137,9 +23212,6 @@ var init_delegation_gate = __esm(() => {
23137
23212
  "reviewer_run",
23138
23213
  "tests_run"
23139
23214
  ]);
23140
- standardWorktreeByCallID = new Map;
23141
- standardWorktreeSerializationSessions = new Set;
23142
- standardWorktreeMergeQueue = Promise.resolve();
23143
23215
  });
23144
23216
 
23145
23217
  // src/state/agent-run-context.ts
@@ -36893,7 +36965,7 @@ function resetToRemoteBranch(cwd, options) {
36893
36965
  const prunedBranches = [];
36894
36966
  try {
36895
36967
  const currentBranch = getCurrentBranch(cwd);
36896
- const defaultRemoteBranch = _internals11.detectDefaultRemoteBranch(cwd);
36968
+ const defaultRemoteBranch = _internals13.detectDefaultRemoteBranch(cwd);
36897
36969
  if (!defaultRemoteBranch) {
36898
36970
  return {
36899
36971
  success: false,
@@ -37075,7 +37147,7 @@ function resetToRemoteBranch(cwd, options) {
37075
37147
  function resetToMainAfterMerge(cwd, options) {
37076
37148
  const warnings = [];
37077
37149
  try {
37078
- const defaultBranch = _internals11.detectDefaultRemoteBranch(cwd);
37150
+ const defaultBranch = _internals13.detectDefaultRemoteBranch(cwd);
37079
37151
  if (!defaultBranch) {
37080
37152
  return {
37081
37153
  success: false,
@@ -37102,7 +37174,7 @@ function resetToMainAfterMerge(cwd, options) {
37102
37174
  }
37103
37175
  if (currentBranch === defaultBranch) {
37104
37176
  try {
37105
- const logOutput = _internals11.gitExec(["log", `${targetBranch}..HEAD`, "--oneline"], cwd);
37177
+ const logOutput = _internals13.gitExec(["log", `${targetBranch}..HEAD`, "--oneline"], cwd);
37106
37178
  if (logOutput.trim().length > 0) {
37107
37179
  return {
37108
37180
  success: false,
@@ -37117,11 +37189,11 @@ function resetToMainAfterMerge(cwd, options) {
37117
37189
  } catch {}
37118
37190
  } else {
37119
37191
  try {
37120
- _internals11.gitExec(["rev-parse", "--abbrev-ref", `${currentBranch}@{upstream}`], cwd);
37192
+ _internals13.gitExec(["rev-parse", "--abbrev-ref", `${currentBranch}@{upstream}`], cwd);
37121
37193
  } catch {
37122
37194
  try {
37123
- const localSha = _internals11.gitExec(["rev-parse", "HEAD"], cwd).trim();
37124
- const remoteSha = _internals11.gitExec(["rev-parse", targetBranch], cwd).trim();
37195
+ const localSha = _internals13.gitExec(["rev-parse", "HEAD"], cwd).trim();
37196
+ const remoteSha = _internals13.gitExec(["rev-parse", targetBranch], cwd).trim();
37125
37197
  if (localSha !== remoteSha) {
37126
37198
  return {
37127
37199
  success: false,
@@ -37147,7 +37219,7 @@ function resetToMainAfterMerge(cwd, options) {
37147
37219
  }
37148
37220
  }
37149
37221
  try {
37150
- _internals11.gitExec(["fetch", "--prune", "origin"], cwd);
37222
+ _internals13.gitExec(["fetch", "--prune", "origin"], cwd);
37151
37223
  } catch (err) {
37152
37224
  return {
37153
37225
  success: false,
@@ -37163,7 +37235,7 @@ function resetToMainAfterMerge(cwd, options) {
37163
37235
  let switchedBranch = false;
37164
37236
  if (currentBranch !== defaultBranch) {
37165
37237
  try {
37166
- _internals11.gitExec(["checkout", defaultBranch], cwd);
37238
+ _internals13.gitExec(["checkout", defaultBranch], cwd);
37167
37239
  switchedBranch = true;
37168
37240
  } catch (err) {
37169
37241
  return {
@@ -37178,7 +37250,7 @@ function resetToMainAfterMerge(cwd, options) {
37178
37250
  }
37179
37251
  }
37180
37252
  try {
37181
- _internals11.gitExec(["reset", "--hard", targetBranch], cwd);
37253
+ _internals13.gitExec(["reset", "--hard", targetBranch], cwd);
37182
37254
  } catch (err) {
37183
37255
  return {
37184
37256
  success: false,
@@ -37199,7 +37271,7 @@ function resetToMainAfterMerge(cwd, options) {
37199
37271
  while (Date.now() < endTime) {}
37200
37272
  }
37201
37273
  try {
37202
- _internals11.gitExec(["checkout", "--", "."], cwd);
37274
+ _internals13.gitExec(["checkout", "--", "."], cwd);
37203
37275
  discardSucceeded = true;
37204
37276
  break;
37205
37277
  } catch {}
@@ -37210,18 +37282,18 @@ function resetToMainAfterMerge(cwd, options) {
37210
37282
  changesDiscarded = discardSucceeded;
37211
37283
  }
37212
37284
  try {
37213
- _internals11.gitExec(["clean", "-fd"], cwd);
37285
+ _internals13.gitExec(["clean", "-fd"], cwd);
37214
37286
  } catch {
37215
37287
  warnings.push("Could not clean untracked files");
37216
37288
  }
37217
37289
  let branchDeleted = false;
37218
37290
  if (switchedBranch && previousBranch !== defaultBranch) {
37219
37291
  try {
37220
- const mergedOutput = _internals11.gitExec(["branch", "--merged", defaultBranch], cwd);
37292
+ const mergedOutput = _internals13.gitExec(["branch", "--merged", defaultBranch], cwd);
37221
37293
  const isMerged = mergedOutput.split(`
37222
37294
  `).some((line) => line.trim() === previousBranch || line.trim() === `* ${previousBranch}`);
37223
37295
  if (isMerged) {
37224
- _internals11.gitExec(["branch", "-d", previousBranch], cwd);
37296
+ _internals13.gitExec(["branch", "-d", previousBranch], cwd);
37225
37297
  branchDeleted = true;
37226
37298
  } else {
37227
37299
  warnings.push(`Branch ${previousBranch} is not merged into ${defaultBranch} \u2014 keeping it`);
@@ -37232,7 +37304,7 @@ function resetToMainAfterMerge(cwd, options) {
37232
37304
  }
37233
37305
  if (options?.pruneBranches) {
37234
37306
  try {
37235
- const mergedOutput = _internals11.gitExec(["branch", "--merged", defaultBranch], cwd);
37307
+ const mergedOutput = _internals13.gitExec(["branch", "--merged", defaultBranch], cwd);
37236
37308
  const mergedLines = mergedOutput.split(`
37237
37309
  `);
37238
37310
  for (const line of mergedLines) {
@@ -37241,7 +37313,7 @@ function resetToMainAfterMerge(cwd, options) {
37241
37313
  continue;
37242
37314
  }
37243
37315
  try {
37244
- _internals11.gitExec(["branch", "-d", trimmedLine], cwd);
37316
+ _internals13.gitExec(["branch", "-d", trimmedLine], cwd);
37245
37317
  } catch {
37246
37318
  warnings.push(`Could not prune branch: ${trimmedLine}`);
37247
37319
  }
@@ -37271,10 +37343,10 @@ function resetToMainAfterMerge(cwd, options) {
37271
37343
  };
37272
37344
  }
37273
37345
  }
37274
- var GIT_TIMEOUT_MS2 = 30000, _internals11;
37346
+ var GIT_TIMEOUT_MS2 = 30000, _internals13;
37275
37347
  var init_branch = __esm(() => {
37276
37348
  init_logger();
37277
- _internals11 = {
37349
+ _internals13 = {
37278
37350
  gitExec: gitExec2,
37279
37351
  detectDefaultRemoteBranch,
37280
37352
  getDefaultBaseBranch,
@@ -37685,18 +37757,18 @@ async function atomicWriteFile(targetPath, content) {
37685
37757
  const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
37686
37758
  try {
37687
37759
  await bunWrite(tempPath, content);
37688
- _internals12.renameSync(tempPath, targetPath);
37760
+ _internals14.renameSync(tempPath, targetPath);
37689
37761
  } finally {
37690
37762
  try {
37691
- _internals12.unlinkSync(tempPath);
37763
+ _internals14.unlinkSync(tempPath);
37692
37764
  } catch {}
37693
37765
  }
37694
37766
  }
37695
- var _internals12;
37767
+ var _internals14;
37696
37768
  var init_task_file = __esm(() => {
37697
37769
  init_bun_compat();
37698
37770
  init_lock();
37699
- _internals12 = {
37771
+ _internals14 = {
37700
37772
  renameSync: renameSync6,
37701
37773
  unlinkSync: unlinkSync4
37702
37774
  };
@@ -39503,7 +39575,7 @@ async function activateProposal(directory, slug, force = false) {
39503
39575
  try {
39504
39576
  await stampSourceEntries(directory, cleanSlug, fm.sourceKnowledgeIds);
39505
39577
  try {
39506
- _internals13.unlinkSync(from);
39578
+ _internals15.unlinkSync(from);
39507
39579
  } catch {}
39508
39580
  return {
39509
39581
  activated: true,
@@ -39603,7 +39675,7 @@ async function autoApplyProposals(directory, llmDelegate) {
39603
39675
  }
39604
39676
  } else if (verdict === "REJECT") {
39605
39677
  try {
39606
- _internals13.unlinkSync(proposal.path);
39678
+ _internals15.unlinkSync(proposal.path);
39607
39679
  warn(`[skill-generator] auto-apply rejected proposal "${proposal.slug}"; deleted ${proposal.path}`);
39608
39680
  result.rejected.push(proposal.slug);
39609
39681
  } catch (delErr) {
@@ -39713,7 +39785,7 @@ async function regenerateSkill(directory, slug) {
39713
39785
  matchedEntries = all.filter((e) => idSet.has(e.id));
39714
39786
  if (matchedEntries.length === idSet.size && idSet.size > 0 && matchedEntries.every((e) => e.status === "archived")) {
39715
39787
  try {
39716
- await _internals13.retireSkill(directory, cleanSlug, "auto-retire: all source knowledge entries archived at regeneration time");
39788
+ await _internals15.retireSkill(directory, cleanSlug, "auto-retire: all source knowledge entries archived at regeneration time");
39717
39789
  } catch {}
39718
39790
  return {
39719
39791
  regenerated: false,
@@ -39736,7 +39808,7 @@ async function regenerateSkill(directory, slug) {
39736
39808
  const activeEntries = matchedEntries.filter((e) => e.status !== "archived");
39737
39809
  if (activeEntries.length === 0) {
39738
39810
  try {
39739
- await _internals13.retireSkill(directory, cleanSlug, "auto-retire: all matched source knowledge entries archived at regeneration time");
39811
+ await _internals15.retireSkill(directory, cleanSlug, "auto-retire: all matched source knowledge entries archived at regeneration time");
39740
39812
  } catch {}
39741
39813
  return {
39742
39814
  regenerated: false,
@@ -39826,14 +39898,14 @@ async function regenerateSkill(directory, slug) {
39826
39898
  entryCount: matchedEntries.length
39827
39899
  };
39828
39900
  }
39829
- var SLUG_PATTERN, MIN_CLUSTER_SIZE = 2, JACCARD_THRESHOLD = 0.5, AUTO_APPLY_BATCH_LIMIT = 5, _internals13;
39901
+ var SLUG_PATTERN, MIN_CLUSTER_SIZE = 2, JACCARD_THRESHOLD = 0.5, AUTO_APPLY_BATCH_LIMIT = 5, _internals15;
39830
39902
  var init_skill_generator = __esm(() => {
39831
39903
  init_knowledge_store();
39832
39904
  init_knowledge_validator();
39833
39905
  init_logger();
39834
39906
  init_skill_changelog();
39835
39907
  SLUG_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
39836
- _internals13 = {
39908
+ _internals15 = {
39837
39909
  sanitizeSlug,
39838
39910
  isValidSlug,
39839
39911
  selectCandidateEntries,
@@ -40035,11 +40107,11 @@ function appendSkillUsageEntry(directory, entry) {
40035
40107
  }
40036
40108
  const resolved = validateSwarmPath(directory, "skill-usage.jsonl");
40037
40109
  const dir = path19.dirname(resolved);
40038
- if (!_internals14.existsSync(dir)) {
40039
- _internals14.mkdirSync(dir, { recursive: true });
40110
+ if (!_internals16.existsSync(dir)) {
40111
+ _internals16.mkdirSync(dir, { recursive: true });
40040
40112
  }
40041
40113
  const fullEntry = {
40042
- id: _internals14.generateId(),
40114
+ id: _internals16.generateId(),
40043
40115
  skillPath,
40044
40116
  agentName,
40045
40117
  taskID,
@@ -40049,21 +40121,21 @@ function appendSkillUsageEntry(directory, entry) {
40049
40121
  ...reviewerNotes !== undefined && { reviewerNotes },
40050
40122
  ...skillVersion !== undefined && { skillVersion }
40051
40123
  };
40052
- _internals14.appendFileSync(resolved, `${JSON.stringify(fullEntry)}
40124
+ _internals16.appendFileSync(resolved, `${JSON.stringify(fullEntry)}
40053
40125
  `, "utf-8");
40054
40126
  try {
40055
- const stat2 = _internals14.statSync(resolved);
40127
+ const stat2 = _internals16.statSync(resolved);
40056
40128
  if (stat2.size > SKILL_USAGE_LOG_ROTATE_BYTES) {
40057
- _internals14.pruneSkillUsageLog(directory, SKILL_USAGE_LOG_MAX_ENTRIES_PER_SKILL);
40129
+ _internals16.pruneSkillUsageLog(directory, SKILL_USAGE_LOG_MAX_ENTRIES_PER_SKILL);
40058
40130
  }
40059
40131
  } catch {}
40060
40132
  }
40061
40133
  function readSkillUsageEntries(directory, options) {
40062
40134
  const resolved = resolveLogPath(directory);
40063
- if (!_internals14.existsSync(resolved)) {
40135
+ if (!_internals16.existsSync(resolved)) {
40064
40136
  return [];
40065
40137
  }
40066
- const raw = _internals14.readFileSync(resolved, "utf-8");
40138
+ const raw = _internals16.readFileSync(resolved, "utf-8");
40067
40139
  const entries = [];
40068
40140
  for (const line of raw.split(`
40069
40141
  `)) {
@@ -40100,20 +40172,20 @@ function readSkillUsageEntries(directory, options) {
40100
40172
  }
40101
40173
  function readSkillUsageEntriesTail(directory, filters, maxBytes = TAIL_BYTES_DEFAULT) {
40102
40174
  const logPath = resolveLogPath(directory);
40103
- if (!_internals14.existsSync(logPath))
40175
+ if (!_internals16.existsSync(logPath))
40104
40176
  return [];
40105
40177
  try {
40106
40178
  const normalizedMaxBytes = Number.isFinite(maxBytes) ? maxBytes : TAIL_BYTES_DEFAULT;
40107
40179
  const boundedMaxBytes = Math.min(Math.max(1, normalizedMaxBytes), MAX_TAIL_BYTES);
40108
- const stat2 = _internals14.statSync(logPath);
40180
+ const stat2 = _internals16.statSync(logPath);
40109
40181
  const start = Math.max(0, stat2.size - boundedMaxBytes);
40110
- const fd = _internals14.openSync(logPath, "r");
40182
+ const fd = _internals16.openSync(logPath, "r");
40111
40183
  try {
40112
40184
  const readLen = stat2.size - start;
40113
40185
  if (readLen === 0)
40114
40186
  return [];
40115
40187
  const buf = Buffer.alloc(readLen);
40116
- _internals14.readSync(fd, buf, 0, buf.length, start);
40188
+ _internals16.readSync(fd, buf, 0, buf.length, start);
40117
40189
  const content = buf.toString("utf-8");
40118
40190
  let usable;
40119
40191
  if (start > 0) {
@@ -40138,7 +40210,7 @@ function readSkillUsageEntriesTail(directory, filters, maxBytes = TAIL_BYTES_DEF
40138
40210
  }
40139
40211
  return entries;
40140
40212
  } finally {
40141
- _internals14.closeSync(fd);
40213
+ _internals16.closeSync(fd);
40142
40214
  }
40143
40215
  } catch {
40144
40216
  return [];
@@ -40174,7 +40246,7 @@ function computeComplianceByVersion(entries, skillPath) {
40174
40246
  }
40175
40247
  function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
40176
40248
  const resolved = resolveLogPath(directory);
40177
- if (!_internals14.existsSync(resolved)) {
40249
+ if (!_internals16.existsSync(resolved)) {
40178
40250
  return { pruned: 0, remaining: 0 };
40179
40251
  }
40180
40252
  const allEntries = readSkillUsageEntries(directory);
@@ -40210,13 +40282,13 @@ function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
40210
40282
  `).concat(`
40211
40283
  `);
40212
40284
  try {
40213
- _internals14.writeFileSync(tmpPath, content, "utf-8");
40214
- _internals14.renameSync(tmpPath, resolved);
40285
+ _internals16.writeFileSync(tmpPath, content, "utf-8");
40286
+ _internals16.renameSync(tmpPath, resolved);
40215
40287
  } catch (writeErr) {
40216
40288
  const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
40217
40289
  try {
40218
- if (_internals14.existsSync(tmpPath)) {
40219
- _internals14.writeFileSync(tmpPath, "", "utf-8");
40290
+ if (_internals16.existsSync(tmpPath)) {
40291
+ _internals16.writeFileSync(tmpPath, "", "utf-8");
40220
40292
  }
40221
40293
  } catch {}
40222
40294
  return { pruned: 0, remaining: allEntries.length, error: msg };
@@ -40238,10 +40310,10 @@ async function resolveSourceKnowledgeIds(directory, skillPath) {
40238
40310
  if (!isContained) {
40239
40311
  return [];
40240
40312
  }
40241
- if (!_internals14.existsSync(absolute)) {
40313
+ if (!_internals16.existsSync(absolute)) {
40242
40314
  return [];
40243
40315
  }
40244
- const content = _internals14.readFileSync(absolute, "utf-8");
40316
+ const content = _internals16.readFileSync(absolute, "utf-8");
40245
40317
  return parseGeneratedFromKnowledge(content);
40246
40318
  } catch (err) {
40247
40319
  console.warn("[skill-usage-log] resolveSourceKnowledgeIds failed (fail-open):", err instanceof Error ? err.message : String(err));
@@ -40334,11 +40406,11 @@ async function applySkillUsageFeedback(directory, options) {
40334
40406
  }
40335
40407
  return { processed, bumps };
40336
40408
  }
40337
- var _internals14, TAIL_BYTES_DEFAULT, MAX_TAIL_BYTES, SKILL_USAGE_LOG_ROTATE_BYTES, SKILL_USAGE_LOG_MAX_ENTRIES_PER_SKILL = 500, COMPLIANCE_BOOST = 0.05, VIOLATION_DECAY = 0.1;
40409
+ var _internals16, TAIL_BYTES_DEFAULT, MAX_TAIL_BYTES, SKILL_USAGE_LOG_ROTATE_BYTES, SKILL_USAGE_LOG_MAX_ENTRIES_PER_SKILL = 500, COMPLIANCE_BOOST = 0.05, VIOLATION_DECAY = 0.1;
40338
40410
  var init_skill_usage_log = __esm(() => {
40339
40411
  init_knowledge_store();
40340
40412
  init_utils2();
40341
- _internals14 = {
40413
+ _internals16 = {
40342
40414
  generateId: () => crypto3.randomUUID(),
40343
40415
  appendFileSync: fs9.appendFileSync.bind(fs9),
40344
40416
  readFileSync: fs9.readFileSync.bind(fs9),
@@ -40999,7 +41071,7 @@ function rankSkillsForContext(skills, taskContext, directory) {
40999
41071
  const results = [];
41000
41072
  for (const skillPath of skills) {
41001
41073
  const skillEntries = allEntries.filter((e) => e.skillPath === skillPath);
41002
- const metadata = _internals15.readSkillMetadata(skillPath, directory);
41074
+ const metadata = _internals17.readSkillMetadata(skillPath, directory);
41003
41075
  const score = computeSkillRelevanceScore(skillPath, taskContext, skillEntries, metadata);
41004
41076
  const entriesWithVerdict = skillEntries.filter((e) => e.complianceVerdict !== undefined && e.complianceVerdict !== "not_checked");
41005
41077
  const compliantCount = entriesWithVerdict.filter((e) => e.complianceVerdict === "compliant").length;
@@ -41054,7 +41126,7 @@ function formatSkillIndexWithContext(skills, directory) {
41054
41126
  } catch {}
41055
41127
  if (!hasHistory) {
41056
41128
  return skills.map((sp) => {
41057
- const meta3 = _internals15.readSkillMetadata(sp, directory);
41129
+ const meta3 = _internals17.readSkillMetadata(sp, directory);
41058
41130
  return ` - file:${meta3.path} - ${meta3.name}: ${meta3.description}`;
41059
41131
  }).join(`
41060
41132
  `);
@@ -41062,7 +41134,7 @@ function formatSkillIndexWithContext(skills, directory) {
41062
41134
  const lines = [];
41063
41135
  for (const skillPath of skills) {
41064
41136
  const stats = getSkillStats(skillPath, directory);
41065
- const meta3 = _internals15.readSkillMetadata(skillPath, directory);
41137
+ const meta3 = _internals17.readSkillMetadata(skillPath, directory);
41066
41138
  const compliancePct = Math.round(stats.complianceRate * 100);
41067
41139
  const topAgentNames = stats.topAgents.slice(0, 3).map((a) => a.agent).join(", ");
41068
41140
  lines.push(` - file:${meta3.path} - ${meta3.name}: ${meta3.description} (used: ${stats.totalUsage}, compliance: ${compliancePct}%)` + (stats.topAgents.length > 0 ? ` \u2192 ${topAgentNames}` : ""));
@@ -41070,12 +41142,12 @@ function formatSkillIndexWithContext(skills, directory) {
41070
41142
  return lines.join(`
41071
41143
  `);
41072
41144
  }
41073
- var FREQUENCY_CAP = 10, FREQUENCY_WEIGHT = 0.3, COMPLIANCE_WEIGHT = 0.3, RECENCY_WEIGHT = 0.15, TASK_DIVERSITY_WEIGHT = 0.05, CONTEXT_WEIGHT = 0.2, WORKFLOW_BOOST = 0.1, WORKFLOW_BOOST_MIN_CONTEXT = 0.05, RECENCY_DECAY_MS, SKILL_FRONTMATTER_READ_BYTES, _internals15, MIN_KEYWORD_LENGTH = 3;
41145
+ var FREQUENCY_CAP = 10, FREQUENCY_WEIGHT = 0.3, COMPLIANCE_WEIGHT = 0.3, RECENCY_WEIGHT = 0.15, TASK_DIVERSITY_WEIGHT = 0.05, CONTEXT_WEIGHT = 0.2, WORKFLOW_BOOST = 0.1, WORKFLOW_BOOST_MIN_CONTEXT = 0.05, RECENCY_DECAY_MS, SKILL_FRONTMATTER_READ_BYTES, _internals17, MIN_KEYWORD_LENGTH = 3;
41074
41146
  var init_skill_scoring = __esm(() => {
41075
41147
  init_skill_usage_log();
41076
41148
  RECENCY_DECAY_MS = 30 * 24 * 60 * 60 * 1000;
41077
41149
  SKILL_FRONTMATTER_READ_BYTES = 16 * 1024;
41078
- _internals15 = {
41150
+ _internals17 = {
41079
41151
  computeSkillRelevanceScore: null,
41080
41152
  rankSkillsForContext: null,
41081
41153
  getSkillStats: null,
@@ -41086,15 +41158,15 @@ var init_skill_scoring = __esm(() => {
41086
41158
  computeRecencyScore: null,
41087
41159
  computeContextMatchScore: null
41088
41160
  };
41089
- _internals15.computeSkillRelevanceScore = computeSkillRelevanceScore;
41090
- _internals15.rankSkillsForContext = rankSkillsForContext;
41091
- _internals15.getSkillStats = getSkillStats;
41092
- _internals15.formatSkillIndexWithContext = formatSkillIndexWithContext;
41093
- _internals15.parseSkillFrontmatter = parseSkillFrontmatter;
41094
- _internals15.readSkillMetadata = readSkillMetadata;
41095
- _internals15.extractSkillName = extractSkillName;
41096
- _internals15.computeRecencyScore = computeRecencyScore;
41097
- _internals15.computeContextMatchScore = computeContextMatchScore;
41161
+ _internals17.computeSkillRelevanceScore = computeSkillRelevanceScore;
41162
+ _internals17.rankSkillsForContext = rankSkillsForContext;
41163
+ _internals17.getSkillStats = getSkillStats;
41164
+ _internals17.formatSkillIndexWithContext = formatSkillIndexWithContext;
41165
+ _internals17.parseSkillFrontmatter = parseSkillFrontmatter;
41166
+ _internals17.readSkillMetadata = readSkillMetadata;
41167
+ _internals17.extractSkillName = extractSkillName;
41168
+ _internals17.computeRecencyScore = computeRecencyScore;
41169
+ _internals17.computeContextMatchScore = computeContextMatchScore;
41098
41170
  });
41099
41171
 
41100
41172
  // src/hooks/skill-propagation-gate.ts
@@ -41199,10 +41271,10 @@ function parseYamlValue(value) {
41199
41271
  }
41200
41272
  function loadRoutingSkills(directory, targetAgent) {
41201
41273
  const routingPath = path23.join(directory, ".opencode", "skill-routing.yaml");
41202
- if (!_internals16.existsSync(routingPath))
41274
+ if (!_internals18.existsSync(routingPath))
41203
41275
  return [];
41204
41276
  try {
41205
- const content = _internals16.readFileSync(routingPath, "utf-8");
41277
+ const content = _internals18.readFileSync(routingPath, "utf-8");
41206
41278
  const config3 = parseSimpleYaml(content);
41207
41279
  if (!config3?.routing)
41208
41280
  return [];
@@ -41219,11 +41291,11 @@ function discoverAvailableSkills(directory) {
41219
41291
  const results = [];
41220
41292
  for (const root of SKILL_SEARCH_ROOTS) {
41221
41293
  const rootPath = path23.join(directory, root);
41222
- if (!_internals16.existsSync(rootPath))
41294
+ if (!_internals18.existsSync(rootPath))
41223
41295
  continue;
41224
41296
  let entries;
41225
41297
  try {
41226
- entries = _internals16.readdirSync(rootPath);
41298
+ entries = _internals18.readdirSync(rootPath);
41227
41299
  } catch {
41228
41300
  continue;
41229
41301
  }
@@ -41231,11 +41303,11 @@ function discoverAvailableSkills(directory) {
41231
41303
  if (entry.startsWith("."))
41232
41304
  continue;
41233
41305
  const skillDir = path23.join(rootPath, entry);
41234
- if (_internals16.existsSync(path23.join(skillDir, "retired.marker")))
41306
+ if (_internals18.existsSync(path23.join(skillDir, "retired.marker")))
41235
41307
  continue;
41236
41308
  const skillFile = path23.join(skillDir, "SKILL.md");
41237
41309
  try {
41238
- if (_internals16.statSync(skillDir).isDirectory() && _internals16.existsSync(skillFile)) {
41310
+ if (_internals18.statSync(skillDir).isDirectory() && _internals18.existsSync(skillFile)) {
41239
41311
  results.push(path23.join(root, entry, "SKILL.md").replace(/\\/g, "/"));
41240
41312
  }
41241
41313
  } catch (err) {
@@ -41267,7 +41339,7 @@ function parseDelegationArgs(args) {
41267
41339
  }
41268
41340
  if (!targetAgent)
41269
41341
  return null;
41270
- const skillsField = prompt ? _internals16.extractSkillsFieldFromPrompt(prompt) : "";
41342
+ const skillsField = prompt ? _internals18.extractSkillsFieldFromPrompt(prompt) : "";
41271
41343
  return { targetAgent, skillsField };
41272
41344
  }
41273
41345
  function extractSkillsFieldFromPrompt(prompt) {
@@ -41308,10 +41380,10 @@ function writeWarnEvent(directory, record3) {
41308
41380
  const filePath = path23.join(directory, ".swarm", "events.jsonl");
41309
41381
  try {
41310
41382
  const dir = path23.dirname(filePath);
41311
- if (!_internals16.existsSync(dir)) {
41312
- _internals16.mkdirSync(dir, { recursive: true });
41383
+ if (!_internals18.existsSync(dir)) {
41384
+ _internals18.mkdirSync(dir, { recursive: true });
41313
41385
  }
41314
- _internals16.appendFileSync(filePath, `${JSON.stringify(record3)}
41386
+ _internals18.appendFileSync(filePath, `${JSON.stringify(record3)}
41315
41387
  `, "utf-8");
41316
41388
  } catch (err) {
41317
41389
  warn(`[skill-propagation-gate] failed to write warning event: ${err instanceof Error ? err.message : String(err)}`);
@@ -41362,19 +41434,19 @@ async function skillPropagationGateBefore(directory, input, config3) {
41362
41434
  const baseAgent = stripKnownSwarmPrefix(agentRaw);
41363
41435
  if (baseAgent !== "architect")
41364
41436
  return { blocked: false, reason: null, recommendedSkills: undefined };
41365
- const parsed = _internals16.parseDelegationArgs(input.args);
41437
+ const parsed = _internals18.parseDelegationArgs(input.args);
41366
41438
  if (!parsed)
41367
41439
  return { blocked: false, reason: null, recommendedSkills: undefined };
41368
41440
  const targetBase = stripKnownSwarmPrefix(parsed.targetAgent);
41369
- if (!_internals16.SKILL_CAPABLE_AGENTS.has(targetBase))
41441
+ if (!_internals18.SKILL_CAPABLE_AGENTS.has(targetBase))
41370
41442
  return { blocked: false, reason: null, recommendedSkills: undefined };
41371
41443
  const sessionID = typeof input.sessionID === "string" ? input.sessionID : "unknown";
41372
- const availableSkills = _internals16.discoverAvailableSkills(directory);
41444
+ const availableSkills = _internals18.discoverAvailableSkills(directory);
41373
41445
  const skillsValue = parsed.skillsField.trim();
41374
41446
  if (skillsValue && skillsValue.toLowerCase() !== "none") {
41375
41447
  const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
41376
- const taskId = _internals16.extractTaskIdFromPrompt(prompt);
41377
- const skillPaths = _internals16.parseSkillPaths(skillsValue);
41448
+ const taskId = _internals18.extractTaskIdFromPrompt(prompt);
41449
+ const skillPaths = _internals18.parseSkillPaths(skillsValue);
41378
41450
  let coderSkillPaths = [];
41379
41451
  if (prompt) {
41380
41452
  for (const line of prompt.split(`
@@ -41382,7 +41454,7 @@ async function skillPropagationGateBefore(directory, input, config3) {
41382
41454
  const trimmed = line.trim();
41383
41455
  if (trimmed.startsWith("SKILLS_USED_BY_CODER:")) {
41384
41456
  const fieldVal = trimmed.slice("SKILLS_USED_BY_CODER:".length).trim();
41385
- coderSkillPaths = _internals16.parseSkillPaths(fieldVal);
41457
+ coderSkillPaths = _internals18.parseSkillPaths(fieldVal);
41386
41458
  break;
41387
41459
  }
41388
41460
  }
@@ -41390,7 +41462,7 @@ async function skillPropagationGateBefore(directory, input, config3) {
41390
41462
  const allPaths = [...new Set([...skillPaths, ...coderSkillPaths])];
41391
41463
  for (const skillPath of allPaths) {
41392
41464
  try {
41393
- _internals16.appendSkillUsageEntry(directory, {
41465
+ _internals18.appendSkillUsageEntry(directory, {
41394
41466
  skillPath,
41395
41467
  agentName: targetBase,
41396
41468
  taskID: taskId,
@@ -41407,17 +41479,17 @@ async function skillPropagationGateBefore(directory, input, config3) {
41407
41479
  let scored = [];
41408
41480
  if (skillsValue.toLowerCase() !== "none" && availableSkills.length > 0) {
41409
41481
  try {
41410
- const sessionEntries = _internals16.readSkillUsageEntriesTail(directory, {
41482
+ const sessionEntries = _internals18.readSkillUsageEntriesTail(directory, {
41411
41483
  sessionID
41412
41484
  });
41413
- if (sessionEntries.length > _internals16.MAX_SCORING_SESSION_ENTRIES) {
41485
+ if (sessionEntries.length > _internals18.MAX_SCORING_SESSION_ENTRIES) {
41414
41486
  scoringSkipped = true;
41415
- warn(`[skill-propagation-gate] skipping scoring \u2014 tail window has ${sessionEntries.length} session entries (limit: ${_internals16.MAX_SCORING_SESSION_ENTRIES})`);
41487
+ warn(`[skill-propagation-gate] skipping scoring \u2014 tail window has ${sessionEntries.length} session entries (limit: ${_internals18.MAX_SCORING_SESSION_ENTRIES})`);
41416
41488
  } else {
41417
41489
  const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
41418
41490
  scored = availableSkills.map((skillPath) => {
41419
41491
  const skillEntries = sessionEntries.filter((e) => e.skillPath === skillPath);
41420
- const score = _internals16.computeSkillRelevanceScore(skillPath, prompt, skillEntries);
41492
+ const score = _internals18.computeSkillRelevanceScore(skillPath, prompt, skillEntries);
41421
41493
  return { skillPath, score, usageCount: skillEntries.length };
41422
41494
  }).sort((a, b) => b.score - a.score || b.usageCount - a.usageCount);
41423
41495
  if (scored.length > 0) {
@@ -41431,12 +41503,12 @@ async function skillPropagationGateBefore(directory, input, config3) {
41431
41503
  }
41432
41504
  }
41433
41505
  try {
41434
- const routingPaths = _internals16.loadRoutingSkills(directory, targetBase);
41506
+ const routingPaths = _internals18.loadRoutingSkills(directory, targetBase);
41435
41507
  if (routingPaths.length > 0) {
41436
41508
  const existingPaths = new Set(scored.map((s) => s.skillPath));
41437
41509
  for (const routingPath of routingPaths) {
41438
41510
  const routedSkillDir = path23.dirname(path23.join(directory, routingPath));
41439
- if (_internals16.existsSync(path23.join(routedSkillDir, "retired.marker")))
41511
+ if (_internals18.existsSync(path23.join(routedSkillDir, "retired.marker")))
41440
41512
  continue;
41441
41513
  if (!existingPaths.has(routingPath)) {
41442
41514
  scored.push({
@@ -41462,12 +41534,12 @@ async function skillPropagationGateBefore(directory, input, config3) {
41462
41534
  } else if (typeof scored !== "undefined" && scored.length > 0) {
41463
41535
  skillsForIndex = scored.map((r) => r.skillPath);
41464
41536
  }
41465
- const formattedIndex = _internals16.formatSkillIndexWithContext(skillsForIndex, directory);
41537
+ const formattedIndex = _internals18.formatSkillIndexWithContext(skillsForIndex, directory);
41466
41538
  if (formattedIndex.length > 0) {
41467
41539
  const contextPath = path23.join(directory, ".swarm", "context.md");
41468
41540
  let existingContent = "";
41469
- if (_internals16.existsSync(contextPath)) {
41470
- existingContent = _internals16.readFileSync(contextPath, "utf-8");
41541
+ if (_internals18.existsSync(contextPath)) {
41542
+ existingContent = _internals18.readFileSync(contextPath, "utf-8");
41471
41543
  }
41472
41544
  const sectionHeader = "## Available Skills";
41473
41545
  const newSection = `${sectionHeader}
@@ -41487,10 +41559,10 @@ ${newSection}`;
41487
41559
  }
41488
41560
  }
41489
41561
  const swarmDir = path23.dirname(contextPath);
41490
- if (!_internals16.existsSync(swarmDir)) {
41491
- _internals16.mkdirSync(swarmDir, { recursive: true });
41562
+ if (!_internals18.existsSync(swarmDir)) {
41563
+ _internals18.mkdirSync(swarmDir, { recursive: true });
41492
41564
  }
41493
- _internals16.writeFileSync(contextPath, updatedContent, "utf-8");
41565
+ _internals18.writeFileSync(contextPath, updatedContent, "utf-8");
41494
41566
  }
41495
41567
  } catch (err) {
41496
41568
  warn(`[skill-propagation-gate] failed to write skill index to context.md: ${err instanceof Error ? err.message : String(err)}`);
@@ -41516,7 +41588,7 @@ ${newSection}`;
41516
41588
  });
41517
41589
  const warningMsg = `Skill propagation warning: Delegating to ${targetBase} without SKILLS field. ` + `Available skills: ${skillNames.join(", ")}`;
41518
41590
  try {
41519
- _internals16.writeWarnEvent(directory, {
41591
+ _internals18.writeWarnEvent(directory, {
41520
41592
  type: "skill_propagation_warn",
41521
41593
  timestamp: new Date().toISOString(),
41522
41594
  tool: toolName,
@@ -41543,7 +41615,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
41543
41615
  let dedupKeys = new Set;
41544
41616
  let existingEntries = [];
41545
41617
  try {
41546
- existingEntries = _internals16.readSkillUsageEntriesTail(directory, {
41618
+ existingEntries = _internals18.readSkillUsageEntriesTail(directory, {
41547
41619
  sessionID
41548
41620
  });
41549
41621
  dedupKeys = new Set(existingEntries.map((e, i) => {
@@ -41575,7 +41647,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
41575
41647
  `)) {
41576
41648
  const coderMatch = line.trim().match(CODER_SKILLS_PATTERN);
41577
41649
  if (coderMatch) {
41578
- const parsed = _internals16.parseSkillPaths(coderMatch[1]);
41650
+ const parsed = _internals18.parseSkillPaths(coderMatch[1]);
41579
41651
  skillPaths.push(...parsed);
41580
41652
  }
41581
41653
  }
@@ -41606,7 +41678,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
41606
41678
  if (isDuplicate(skillPath, "reviewer", resolvedTaskID))
41607
41679
  continue;
41608
41680
  try {
41609
- _internals16.appendSkillUsageEntry(directory, {
41681
+ _internals18.appendSkillUsageEntry(directory, {
41610
41682
  skillPath,
41611
41683
  agentName: "reviewer",
41612
41684
  taskID: resolvedTaskID,
@@ -41650,15 +41722,15 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
41650
41722
  skillsField = trimmed.slice("SKILLS:".length).trim();
41651
41723
  }
41652
41724
  if (currentTargetAgent && skillsField && skillsField.toLowerCase() !== "none") {
41653
- const skillPaths = _internals16.parseSkillPaths(skillsField);
41654
- const taskId = _internals16.extractTaskIdFromPrompt(text);
41725
+ const skillPaths = _internals18.parseSkillPaths(skillsField);
41726
+ const taskId = _internals18.extractTaskIdFromPrompt(text);
41655
41727
  for (const skillPath of skillPaths) {
41656
41728
  if (hadRecordingError)
41657
41729
  break;
41658
41730
  if (isDuplicate(skillPath, currentTargetAgent, taskId))
41659
41731
  continue;
41660
41732
  try {
41661
- _internals16.appendSkillUsageEntry(directory, {
41733
+ _internals18.appendSkillUsageEntry(directory, {
41662
41734
  skillPath,
41663
41735
  agentName: currentTargetAgent,
41664
41736
  taskID: taskId,
@@ -41678,7 +41750,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
41678
41750
  break;
41679
41751
  }
41680
41752
  }
41681
- var SKILL_CAPABLE_AGENTS, SKILL_SEARCH_ROOTS, MAX_SCORING_SESSION_ENTRIES = 500, _internals16, COMPLIANCE_PATTERN, CODER_SKILLS_PATTERN;
41753
+ var SKILL_CAPABLE_AGENTS, SKILL_SEARCH_ROOTS, MAX_SCORING_SESSION_ENTRIES = 500, _internals18, COMPLIANCE_PATTERN, CODER_SKILLS_PATTERN;
41682
41754
  var init_skill_propagation_gate = __esm(() => {
41683
41755
  init_schema();
41684
41756
  init_logger();
@@ -41697,7 +41769,7 @@ var init_skill_propagation_gate = __esm(() => {
41697
41769
  ".opencode/skills/generated",
41698
41770
  ".claude/skills"
41699
41771
  ];
41700
- _internals16 = {
41772
+ _internals18 = {
41701
41773
  readdirSync: fs11.readdirSync.bind(fs11),
41702
41774
  existsSync: fs11.existsSync.bind(fs11),
41703
41775
  statSync: fs11.statSync.bind(fs11),
@@ -41724,16 +41796,16 @@ var init_skill_propagation_gate = __esm(() => {
41724
41796
  };
41725
41797
  COMPLIANCE_PATTERN = /SKILL_COMPLIANCE\s*:\s*(COMPLIANT|PARTIAL|VIOLATED)(?:\s*(?:\u2014|-)\s*(.*))? \s*$/i;
41726
41798
  CODER_SKILLS_PATTERN = /SKILLS_USED_BY_CODER\s*:\s*(.+)/i;
41727
- _internals16.skillPropagationGateBefore = skillPropagationGateBefore;
41728
- _internals16.skillPropagationTransformScan = skillPropagationTransformScan;
41729
- _internals16.writeWarnEvent = writeWarnEvent;
41730
- _internals16.discoverAvailableSkills = discoverAvailableSkills;
41731
- _internals16.parseDelegationArgs = parseDelegationArgs;
41732
- _internals16.parseSkillPaths = parseSkillPaths;
41733
- _internals16.extractTaskIdFromPrompt = extractTaskIdFromPrompt;
41734
- _internals16.extractSkillsFieldFromPrompt = extractSkillsFieldFromPrompt;
41735
- _internals16.formatSkillIndexWithContext = formatSkillIndexWithContext;
41736
- _internals16.loadRoutingSkills = loadRoutingSkills;
41799
+ _internals18.skillPropagationGateBefore = skillPropagationGateBefore;
41800
+ _internals18.skillPropagationTransformScan = skillPropagationTransformScan;
41801
+ _internals18.writeWarnEvent = writeWarnEvent;
41802
+ _internals18.discoverAvailableSkills = discoverAvailableSkills;
41803
+ _internals18.parseDelegationArgs = parseDelegationArgs;
41804
+ _internals18.parseSkillPaths = parseSkillPaths;
41805
+ _internals18.extractTaskIdFromPrompt = extractTaskIdFromPrompt;
41806
+ _internals18.extractSkillsFieldFromPrompt = extractSkillsFieldFromPrompt;
41807
+ _internals18.formatSkillIndexWithContext = formatSkillIndexWithContext;
41808
+ _internals18.loadRoutingSkills = loadRoutingSkills;
41737
41809
  });
41738
41810
 
41739
41811
  // src/hooks/micro-reflector.ts
@@ -42296,7 +42368,7 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
42296
42368
  } catch {}
42297
42369
  }
42298
42370
  if (!options?.skipAutoPromotion) {
42299
- await _internals17.runAutoPromotion(directory, config3);
42371
+ await _internals19.runAutoPromotion(directory, config3);
42300
42372
  }
42301
42373
  return { stored, skipped, rejected, quarantined };
42302
42374
  }
@@ -42379,7 +42451,7 @@ function createKnowledgeCuratorHook(directory, config3) {
42379
42451
  recordSeenRetroSection(evidenceKey, evidenceHash, Date.now());
42380
42452
  const projectName2 = evidenceData.project_name ?? "unknown";
42381
42453
  const phaseNumber2 = typeof evidenceData.phase_number === "number" ? evidenceData.phase_number : 1;
42382
- await _internals17.curateAndStoreSwarm(lessons, projectName2, { phase_number: phaseNumber2 }, directory, config3);
42454
+ await _internals19.curateAndStoreSwarm(lessons, projectName2, { phase_number: phaseNumber2 }, directory, config3);
42383
42455
  return;
42384
42456
  }
42385
42457
  const planContent = await readSwarmFileAsync(directory, "plan.md");
@@ -42401,11 +42473,11 @@ function createKnowledgeCuratorHook(directory, config3) {
42401
42473
  const projectName = projectNameMatch ? projectNameMatch[1].trim() : "unknown";
42402
42474
  const phaseMatch = /^Phase:\s*(\d+)/m.exec(planContent);
42403
42475
  const phaseNumber = phaseMatch ? parseInt(phaseMatch[1], 10) : 1;
42404
- await _internals17.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config3);
42476
+ await _internals19.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config3);
42405
42477
  };
42406
42478
  return safeHook(handler);
42407
42479
  }
42408
- var seenRetroSections, MAX_TRACKED_RETRO_SECTIONS = 500, ENRICHMENT_ALLOWED_FIELDS, ENRICHMENT_LLM_TIMEOUT_MS = 60000, MESO_INSIGHT_BATCH_LIMIT = 20, KNOWLEDGE_CATEGORIES, OUTCOME_PROMOTION_BLOCK = -0.3, _internals17;
42480
+ var seenRetroSections, MAX_TRACKED_RETRO_SECTIONS = 500, ENRICHMENT_ALLOWED_FIELDS, ENRICHMENT_LLM_TIMEOUT_MS = 60000, MESO_INSIGHT_BATCH_LIMIT = 20, KNOWLEDGE_CATEGORIES, OUTCOME_PROMOTION_BLOCK = -0.3, _internals19;
42409
42481
  var init_knowledge_curator = __esm(() => {
42410
42482
  init_skill_improver_quota();
42411
42483
  init_synonym_map();
@@ -42437,7 +42509,7 @@ var init_knowledge_curator = __esm(() => {
42437
42509
  "todo",
42438
42510
  "other"
42439
42511
  ]);
42440
- _internals17 = {
42512
+ _internals19 = {
42441
42513
  isWriteToEvidenceFile,
42442
42514
  curateAndStoreSwarm,
42443
42515
  runAutoPromotion,
@@ -43681,7 +43753,7 @@ async function executeWriteRetro(args, directory) {
43681
43753
  }, null, 2);
43682
43754
  }
43683
43755
  }
43684
- var write_retro, _internals18;
43756
+ var write_retro, _internals20;
43685
43757
  var init_write_retro = __esm(() => {
43686
43758
  init_zod();
43687
43759
  init_evidence_schema();
@@ -43728,13 +43800,13 @@ var init_write_retro = __esm(() => {
43728
43800
  task_id: args.task_id !== undefined ? String(args.task_id) : undefined,
43729
43801
  metadata: args.metadata
43730
43802
  };
43731
- return await _internals18.executeWriteRetro(writeRetroArgs, directory);
43803
+ return await _internals20.executeWriteRetro(writeRetroArgs, directory);
43732
43804
  } catch {
43733
43805
  return JSON.stringify({ success: false, phase: rawPhase, message: "Invalid arguments" }, null, 2);
43734
43806
  }
43735
43807
  }
43736
43808
  });
43737
- _internals18 = {
43809
+ _internals20 = {
43738
43810
  executeWriteRetro,
43739
43811
  write_retro
43740
43812
  };
@@ -43744,7 +43816,7 @@ var init_write_retro = __esm(() => {
43744
43816
  var exports_curator_postmortem = {};
43745
43817
  __export(exports_curator_postmortem, {
43746
43818
  runCuratorPostMortem: () => runCuratorPostMortem,
43747
- _internals: () => _internals19
43819
+ _internals: () => _internals21
43748
43820
  });
43749
43821
  import { existsSync as existsSync19, readdirSync as readdirSync7, readFileSync as readFileSync9 } from "fs";
43750
43822
  import * as path28 from "path";
@@ -44098,13 +44170,13 @@ ${llmOutput}`;
44098
44170
  warnings
44099
44171
  };
44100
44172
  }
44101
- var _internals19;
44173
+ var _internals21;
44102
44174
  var init_curator_postmortem = __esm(() => {
44103
44175
  init_manager();
44104
44176
  init_knowledge_events();
44105
44177
  init_knowledge_store();
44106
44178
  init_utils2();
44107
- _internals19 = {
44179
+ _internals21 = {
44108
44180
  collectKnowledgeSummary,
44109
44181
  collectRetrospectives,
44110
44182
  collectDriftReports,
@@ -45402,9 +45474,9 @@ async function detectDarkMatter(directory, options) {
45402
45474
  } catch {
45403
45475
  return [];
45404
45476
  }
45405
- const commitMap = await _internals20.parseGitLog(directory, maxCommitsToAnalyze);
45406
- const matrix = _internals20.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
45407
- const staticEdges = await _internals20.getStaticEdges(directory);
45477
+ const commitMap = await _internals22.parseGitLog(directory, maxCommitsToAnalyze);
45478
+ const matrix = _internals22.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
45479
+ const staticEdges = await _internals22.getStaticEdges(directory);
45408
45480
  const results = [];
45409
45481
  for (const entry of matrix.values()) {
45410
45482
  const key = `${entry.fileA}::${entry.fileB}`;
@@ -45492,7 +45564,7 @@ ${rows}
45492
45564
  These pairs likely share an architectural concern invisible to static analysis.
45493
45565
  Consider adding explicit documentation or extracting the shared concern.`;
45494
45566
  }
45495
- var co_change_analyzer, _internals20;
45567
+ var co_change_analyzer, _internals22;
45496
45568
  var init_co_change_analyzer = __esm(() => {
45497
45569
  init_zod();
45498
45570
  init_create_tool();
@@ -45524,11 +45596,11 @@ var init_co_change_analyzer = __esm(() => {
45524
45596
  npmiThreshold,
45525
45597
  maxCommitsToAnalyze
45526
45598
  };
45527
- const pairs = await _internals20.detectDarkMatter(directory, options);
45528
- return _internals20.formatDarkMatterOutput(pairs);
45599
+ const pairs = await _internals22.detectDarkMatter(directory, options);
45600
+ return _internals22.formatDarkMatterOutput(pairs);
45529
45601
  }
45530
45602
  });
45531
- _internals20 = {
45603
+ _internals22 = {
45532
45604
  parseGitLog,
45533
45605
  buildCoChangeMatrix,
45534
45606
  getStaticEdges,
@@ -45559,7 +45631,7 @@ async function handleDarkMatterCommand(directory, args) {
45559
45631
  }
45560
45632
  let pairs;
45561
45633
  try {
45562
- pairs = await _internals20.detectDarkMatter(directory, options);
45634
+ pairs = await _internals22.detectDarkMatter(directory, options);
45563
45635
  } catch (err) {
45564
45636
  const errMsg = err instanceof Error ? err.message : String(err);
45565
45637
  return `## Dark Matter Analysis Failed
@@ -48987,7 +49059,7 @@ function isCommandAvailable(command) {
48987
49059
  const isWindows = process.platform === "win32";
48988
49060
  const cmd = isWindows ? `${command}.exe` : command;
48989
49061
  try {
48990
- const result = _internals21.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
49062
+ const result = _internals23.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
48991
49063
  cwd: process.cwd(),
48992
49064
  stdin: "ignore",
48993
49065
  stdout: "ignore",
@@ -49137,7 +49209,7 @@ async function discoverBuildCommands(workingDir, options) {
49137
49209
  const scope = options?.scope ?? "all";
49138
49210
  const changedFiles = options?.changedFiles ?? [];
49139
49211
  const _filesToCheck = filterByScope(workingDir, scope, changedFiles);
49140
- const profileResult = await _internals21.discoverBuildCommandsFromProfiles(workingDir);
49212
+ const profileResult = await _internals23.discoverBuildCommandsFromProfiles(workingDir);
49141
49213
  const profileCommands = profileResult.commands;
49142
49214
  const profileSkipped = profileResult.skipped;
49143
49215
  const coveredEcosystems = new Set;
@@ -49200,7 +49272,7 @@ function clearToolchainCache() {
49200
49272
  function getEcosystems() {
49201
49273
  return ECOSYSTEMS.map((e) => e.ecosystem);
49202
49274
  }
49203
- var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals21, build_discovery;
49275
+ var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals23, build_discovery;
49204
49276
  var init_discovery = __esm(() => {
49205
49277
  init_dist();
49206
49278
  init_detector();
@@ -49318,7 +49390,7 @@ var init_discovery = __esm(() => {
49318
49390
  php: ["php-composer"]
49319
49391
  };
49320
49392
  toolchainCache = new Map;
49321
- _internals21 = {
49393
+ _internals23 = {
49322
49394
  isCommandAvailable,
49323
49395
  discoverBuildCommandsFromProfiles,
49324
49396
  discoverBuildCommands,
@@ -49590,7 +49662,7 @@ var exports_evidence_summary_service = {};
49590
49662
  __export(exports_evidence_summary_service, {
49591
49663
  isAutoSummaryEnabled: () => isAutoSummaryEnabled,
49592
49664
  buildEvidenceSummary: () => buildEvidenceSummary,
49593
- _internals: () => _internals22,
49665
+ _internals: () => _internals24,
49594
49666
  REQUIRED_EVIDENCE_TYPES: () => REQUIRED_EVIDENCE_TYPES,
49595
49667
  EVIDENCE_SUMMARY_VERSION: () => EVIDENCE_SUMMARY_VERSION
49596
49668
  });
@@ -49628,7 +49700,7 @@ function getTaskStatus(task, bundle) {
49628
49700
  if (task?.status) {
49629
49701
  return task.status;
49630
49702
  }
49631
- const entries = _internals22.normalizeBundleEntries(bundle);
49703
+ const entries = _internals24.normalizeBundleEntries(bundle);
49632
49704
  if (entries.length > 0) {
49633
49705
  return "completed";
49634
49706
  }
@@ -49654,7 +49726,7 @@ function evidenceCompleteFromEntries(entries) {
49654
49726
  };
49655
49727
  }
49656
49728
  function isEvidenceComplete(bundle) {
49657
- return evidenceCompleteFromEntries(_internals22.normalizeBundleEntries(bundle));
49729
+ return evidenceCompleteFromEntries(_internals24.normalizeBundleEntries(bundle));
49658
49730
  }
49659
49731
  function getTaskBlockers(task, summary, status) {
49660
49732
  const blockers = [];
@@ -49674,9 +49746,9 @@ async function buildTaskSummary(directory, task, taskId) {
49674
49746
  const bundle = result.status === "found" ? result.bundle : null;
49675
49747
  const gateEvidence = await readDurableGateEvidence(directory, taskId);
49676
49748
  const phase = task?.phase ?? 0;
49677
- const status = _internals22.getTaskStatus(task, bundle);
49678
- const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals22.normalizeBundleEntries(bundle), gateEvidence);
49679
- let evidenceCheck = _internals22.evidenceCompleteFromEntries(entries);
49749
+ const status = _internals24.getTaskStatus(task, bundle);
49750
+ const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals24.normalizeBundleEntries(bundle), gateEvidence);
49751
+ let evidenceCheck = _internals24.evidenceCompleteFromEntries(entries);
49680
49752
  if (gateEvidence) {
49681
49753
  const gateStatus = getDurableGateEvidenceStatus(gateEvidence);
49682
49754
  evidenceCheck = gateStatus.isComplete ? { isComplete: true, missingEvidence: [] } : {
@@ -49684,7 +49756,7 @@ async function buildTaskSummary(directory, task, taskId) {
49684
49756
  missingEvidence: gateStatus.missingGates.map((gate) => `gate:${gate}`)
49685
49757
  };
49686
49758
  }
49687
- const blockers = _internals22.getTaskBlockers(task, evidenceCheck, status);
49759
+ const blockers = _internals24.getTaskBlockers(task, evidenceCheck, status);
49688
49760
  const hasReview = entries.some((e) => e.type === "review");
49689
49761
  const hasTest = entries.some((e) => e.type === "test");
49690
49762
  const hasApproval = entries.some((e) => e.type === "approval");
@@ -49713,12 +49785,12 @@ async function buildPhaseSummary(directory, phase) {
49713
49785
  const taskSummaries = [];
49714
49786
  const _taskMap = new Map(phase.tasks.map((t) => [t.id, t]));
49715
49787
  for (const task of phase.tasks) {
49716
- const summary = await _internals22.buildTaskSummary(directory, task, task.id);
49788
+ const summary = await _internals24.buildTaskSummary(directory, task, task.id);
49717
49789
  taskSummaries.push(summary);
49718
49790
  }
49719
49791
  const extraTaskIds = taskIds.filter((id) => !phaseTaskIds.has(id));
49720
49792
  for (const taskId of extraTaskIds) {
49721
- const summary = await _internals22.buildTaskSummary(directory, undefined, taskId);
49793
+ const summary = await _internals24.buildTaskSummary(directory, undefined, taskId);
49722
49794
  if (summary.phase === phase.id) {
49723
49795
  taskSummaries.push(summary);
49724
49796
  }
@@ -49819,7 +49891,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
49819
49891
  let totalTasks = 0;
49820
49892
  let completedTasks = 0;
49821
49893
  for (const phase of phasesToProcess) {
49822
- const summary = await _internals22.buildPhaseSummary(directory, phase);
49894
+ const summary = await _internals24.buildPhaseSummary(directory, phase);
49823
49895
  phaseSummaries.push(summary);
49824
49896
  totalTasks += summary.totalTasks;
49825
49897
  completedTasks += summary.completedTasks;
@@ -49841,7 +49913,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
49841
49913
  overallBlockers,
49842
49914
  summaryText: ""
49843
49915
  };
49844
- artifact.summaryText = _internals22.generateSummaryText(artifact);
49916
+ artifact.summaryText = _internals24.generateSummaryText(artifact);
49845
49917
  log("[EvidenceSummary] Summary built", {
49846
49918
  phases: phaseSummaries.length,
49847
49919
  totalTasks,
@@ -49860,7 +49932,7 @@ function isAutoSummaryEnabled(automationConfig) {
49860
49932
  }
49861
49933
  return automationConfig.capabilities?.evidence_auto_summaries === true;
49862
49934
  }
49863
- var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals22;
49935
+ var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals24;
49864
49936
  var init_evidence_summary_service = __esm(() => {
49865
49937
  init_gate_bridge();
49866
49938
  init_manager2();
@@ -49875,7 +49947,7 @@ var init_evidence_summary_service = __esm(() => {
49875
49947
  "retrospective"
49876
49948
  ]);
49877
49949
  REQUIRED_EVIDENCE_TYPES = ["review", "test"];
49878
- _internals22 = {
49950
+ _internals24 = {
49879
49951
  buildEvidenceSummary,
49880
49952
  isAutoSummaryEnabled,
49881
49953
  normalizeBundleEntries,
@@ -49931,7 +50003,7 @@ function getVerdictEmoji(verdict) {
49931
50003
  return getVerdictIcon(verdict);
49932
50004
  }
49933
50005
  async function getTaskEvidenceData(directory, taskId) {
49934
- const result = await _internals23.loadEvidence(directory, taskId);
50006
+ const result = await _internals25.loadEvidence(directory, taskId);
49935
50007
  if (result.status !== "found") {
49936
50008
  return {
49937
50009
  hasEvidence: false,
@@ -49954,13 +50026,13 @@ async function getTaskEvidenceData(directory, taskId) {
49954
50026
  };
49955
50027
  }
49956
50028
  async function getEvidenceListData(directory) {
49957
- const taskIds = await _internals23.listEvidenceTaskIds(directory);
50029
+ const taskIds = await _internals25.listEvidenceTaskIds(directory);
49958
50030
  if (taskIds.length === 0) {
49959
50031
  return { hasEvidence: false, tasks: [] };
49960
50032
  }
49961
50033
  const tasks = [];
49962
50034
  for (const taskId of taskIds) {
49963
- const result = await _internals23.loadEvidence(directory, taskId);
50035
+ const result = await _internals25.loadEvidence(directory, taskId);
49964
50036
  if (result.status === "found") {
49965
50037
  tasks.push({
49966
50038
  taskId,
@@ -50074,10 +50146,10 @@ async function handleEvidenceSummaryCommand(directory) {
50074
50146
  return lines.join(`
50075
50147
  `);
50076
50148
  }
50077
- var _internals23;
50149
+ var _internals25;
50078
50150
  var init_evidence_service = __esm(() => {
50079
50151
  init_manager2();
50080
- _internals23 = {
50152
+ _internals25 = {
50081
50153
  loadEvidence,
50082
50154
  listEvidenceTaskIds
50083
50155
  };
@@ -50484,7 +50556,7 @@ function extractCurrentPhaseFromPlan2(plan) {
50484
50556
  if (!plan) {
50485
50557
  return { currentPhase: null, currentTask: null, incompleteTasks: [] };
50486
50558
  }
50487
- if (!_internals24.validatePlanPhases(plan)) {
50559
+ if (!_internals26.validatePlanPhases(plan)) {
50488
50560
  return { currentPhase: null, currentTask: null, incompleteTasks: [] };
50489
50561
  }
50490
50562
  let currentPhase = null;
@@ -50626,9 +50698,9 @@ function extractPhaseMetrics(content) {
50626
50698
  async function getHandoffData(directory) {
50627
50699
  const now = new Date().toISOString();
50628
50700
  const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
50629
- const sessionState = _internals24.parseSessionState(sessionContent);
50701
+ const sessionState = _internals26.parseSessionState(sessionContent);
50630
50702
  const plan = await loadPlanJsonOnly(directory);
50631
- const planInfo = _internals24.extractCurrentPhaseFromPlan(plan);
50703
+ const planInfo = _internals26.extractCurrentPhaseFromPlan(plan);
50632
50704
  if (!plan) {
50633
50705
  const planMdContent = await readSwarmFileAsync(directory, "plan.md");
50634
50706
  if (planMdContent) {
@@ -50647,8 +50719,8 @@ async function getHandoffData(directory) {
50647
50719
  }
50648
50720
  }
50649
50721
  const contextContent = await readSwarmFileAsync(directory, "context.md");
50650
- const recentDecisions = _internals24.extractDecisions(contextContent);
50651
- const rawPhaseMetrics = _internals24.extractPhaseMetrics(contextContent);
50722
+ const recentDecisions = _internals26.extractDecisions(contextContent);
50723
+ const rawPhaseMetrics = _internals26.extractPhaseMetrics(contextContent);
50652
50724
  const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
50653
50725
  let delegationState = null;
50654
50726
  if (sessionState?.delegationState) {
@@ -50812,13 +50884,13 @@ ${lines.join(`
50812
50884
  `)}
50813
50885
  \`\`\``;
50814
50886
  }
50815
- var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals24;
50887
+ var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals26;
50816
50888
  var init_handoff_service = __esm(() => {
50817
50889
  init_utils2();
50818
50890
  init_manager();
50819
50891
  init_utils();
50820
50892
  RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
50821
- _internals24 = {
50893
+ _internals26 = {
50822
50894
  getHandoffData,
50823
50895
  formatHandoffMarkdown,
50824
50896
  formatContinuationPrompt,
@@ -50961,22 +51033,22 @@ async function writeSnapshot(directory, state) {
50961
51033
  }
50962
51034
  function createSnapshotWriterHook(directory) {
50963
51035
  return (_input, _output) => {
50964
- _writeInFlight = _writeInFlight.then(() => _internals25.writeSnapshot(directory, swarmState), () => _internals25.writeSnapshot(directory, swarmState));
51036
+ _writeInFlight = _writeInFlight.then(() => _internals27.writeSnapshot(directory, swarmState), () => _internals27.writeSnapshot(directory, swarmState));
50965
51037
  return _writeInFlight;
50966
51038
  };
50967
51039
  }
50968
51040
  async function flushPendingSnapshot(directory) {
50969
- _writeInFlight = _writeInFlight.then(() => _internals25.writeSnapshot(directory, swarmState), () => _internals25.writeSnapshot(directory, swarmState));
51041
+ _writeInFlight = _writeInFlight.then(() => _internals27.writeSnapshot(directory, swarmState), () => _internals27.writeSnapshot(directory, swarmState));
50970
51042
  await _writeInFlight;
50971
51043
  }
50972
- var _writeInFlight, _internals25;
51044
+ var _writeInFlight, _internals27;
50973
51045
  var init_snapshot_writer = __esm(() => {
50974
51046
  init_utils2();
50975
51047
  init_state();
50976
51048
  init_utils();
50977
51049
  init_bun_compat();
50978
51050
  _writeInFlight = Promise.resolve();
50979
- _internals25 = {
51051
+ _internals27 = {
50980
51052
  writeSnapshot,
50981
51053
  createSnapshotWriterHook,
50982
51054
  flushPendingSnapshot
@@ -51309,7 +51381,7 @@ function parsePrRef(input, cwd) {
51309
51381
  }
51310
51382
  function detectGitRemote(cwd) {
51311
51383
  try {
51312
- const remoteUrl = _internals26.execSync("git remote get-url origin", {
51384
+ const remoteUrl = _internals28.execSync("git remote get-url origin", {
51313
51385
  encoding: "utf-8",
51314
51386
  stdio: ["pipe", "pipe", "pipe"],
51315
51387
  timeout: 5000,
@@ -51365,9 +51437,9 @@ function resolvePrCommandInput(rest, cwd) {
51365
51437
  }
51366
51438
  return { prUrl: result.sanitized, instructions };
51367
51439
  }
51368
- var _internals26, MAX_URL_LEN = 2048, MAX_INSTRUCTIONS_LEN = 1000;
51440
+ var _internals28, MAX_URL_LEN = 2048, MAX_INSTRUCTIONS_LEN = 1000;
51369
51441
  var init_pr_ref = __esm(() => {
51370
- _internals26 = { execSync: execSync2 };
51442
+ _internals28 = { execSync: execSync2 };
51371
51443
  });
51372
51444
 
51373
51445
  // src/commands/issue.ts
@@ -51614,9 +51686,9 @@ async function migrateContextToKnowledge(directory, config3) {
51614
51686
  skippedReason: "empty-context"
51615
51687
  };
51616
51688
  }
51617
- const rawEntries = _internals27.parseContextMd(contextContent);
51689
+ const rawEntries = _internals29.parseContextMd(contextContent);
51618
51690
  if (rawEntries.length === 0) {
51619
- await _internals27.writeSentinel(sentinelPath, 0, 0);
51691
+ await _internals29.writeSentinel(sentinelPath, 0, 0);
51620
51692
  return {
51621
51693
  migrated: true,
51622
51694
  entriesMigrated: 0,
@@ -51627,10 +51699,10 @@ async function migrateContextToKnowledge(directory, config3) {
51627
51699
  const existing = await readKnowledge(knowledgePath);
51628
51700
  let migrated = 0;
51629
51701
  let dropped = 0;
51630
- const projectName = _internals27.inferProjectName(directory);
51702
+ const projectName = _internals29.inferProjectName(directory);
51631
51703
  for (const raw of rawEntries) {
51632
51704
  if (config3.validation_enabled !== false) {
51633
- const category = raw.categoryHint ?? _internals27.inferCategoryFromText(raw.text);
51705
+ const category = raw.categoryHint ?? _internals29.inferCategoryFromText(raw.text);
51634
51706
  const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
51635
51707
  category,
51636
51708
  scope: "global",
@@ -51650,8 +51722,8 @@ async function migrateContextToKnowledge(directory, config3) {
51650
51722
  const entry = {
51651
51723
  id: randomUUID3(),
51652
51724
  tier: "swarm",
51653
- lesson: _internals27.truncateLesson(raw.text),
51654
- category: raw.categoryHint ?? _internals27.inferCategoryFromText(raw.text),
51725
+ lesson: _internals29.truncateLesson(raw.text),
51726
+ category: raw.categoryHint ?? _internals29.inferCategoryFromText(raw.text),
51655
51727
  tags: [...inferredTags, `migration:${raw.sourceSection}`],
51656
51728
  scope: "global",
51657
51729
  confidence: 0.3,
@@ -51674,7 +51746,7 @@ async function migrateContextToKnowledge(directory, config3) {
51674
51746
  if (migrated > 0) {
51675
51747
  await rewriteKnowledge(knowledgePath, existing);
51676
51748
  }
51677
- await _internals27.writeSentinel(sentinelPath, migrated, dropped);
51749
+ await _internals29.writeSentinel(sentinelPath, migrated, dropped);
51678
51750
  log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
51679
51751
  return {
51680
51752
  migrated: true,
@@ -51684,7 +51756,7 @@ async function migrateContextToKnowledge(directory, config3) {
51684
51756
  };
51685
51757
  }
51686
51758
  async function migrateHiveKnowledgeLegacy(config3) {
51687
- const legacyHivePath = _internals27.resolveLegacyHiveKnowledgePath();
51759
+ const legacyHivePath = _internals29.resolveLegacyHiveKnowledgePath();
51688
51760
  const canonicalHivePath = resolveHiveKnowledgePath();
51689
51761
  const sentinelPath = path39.join(path39.dirname(canonicalHivePath), ".hive-knowledge-migrated");
51690
51762
  if (existsSync26(sentinelPath)) {
@@ -51707,7 +51779,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
51707
51779
  }
51708
51780
  const legacyEntries = await readKnowledge(legacyHivePath);
51709
51781
  if (legacyEntries.length === 0) {
51710
- await _internals27.writeSentinel(sentinelPath, 0, 0);
51782
+ await _internals29.writeSentinel(sentinelPath, 0, 0);
51711
51783
  return {
51712
51784
  migrated: true,
51713
51785
  entriesMigrated: 0,
@@ -51755,7 +51827,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
51755
51827
  const newHiveEntry = {
51756
51828
  id: resolvedId,
51757
51829
  tier: "hive",
51758
- lesson: _internals27.truncateLesson(lesson),
51830
+ lesson: _internals29.truncateLesson(lesson),
51759
51831
  category,
51760
51832
  tags: ["migration:legacy-hive"],
51761
51833
  scope: scopeTag,
@@ -51774,7 +51846,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
51774
51846
  encounter_score: 1
51775
51847
  };
51776
51848
  try {
51777
- await _internals27.appendKnowledge(canonicalHivePath, newHiveEntry);
51849
+ await _internals29.appendKnowledge(canonicalHivePath, newHiveEntry);
51778
51850
  existingHiveEntries.push(newHiveEntry);
51779
51851
  migrated++;
51780
51852
  } catch (appendError) {
@@ -51790,7 +51862,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
51790
51862
  dropped++;
51791
51863
  }
51792
51864
  }
51793
- await _internals27.writeSentinel(sentinelPath, migrated, dropped);
51865
+ await _internals29.writeSentinel(sentinelPath, migrated, dropped);
51794
51866
  log(`[knowledge-migrator] Migrated ${migrated} legacy hive entries, dropped ${dropped}`);
51795
51867
  return {
51796
51868
  migrated: true,
@@ -51801,7 +51873,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
51801
51873
  };
51802
51874
  }
51803
51875
  function parseContextMd(content) {
51804
- const sections = _internals27.splitIntoSections(content);
51876
+ const sections = _internals29.splitIntoSections(content);
51805
51877
  const entries = [];
51806
51878
  const seen = new Set;
51807
51879
  const sectionPatterns = [
@@ -51817,7 +51889,7 @@ function parseContextMd(content) {
51817
51889
  const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
51818
51890
  if (!match)
51819
51891
  continue;
51820
- const bullets = _internals27.extractBullets(section.body);
51892
+ const bullets = _internals29.extractBullets(section.body);
51821
51893
  for (const bullet of bullets) {
51822
51894
  if (bullet.length < 15)
51823
51895
  continue;
@@ -51826,9 +51898,9 @@ function parseContextMd(content) {
51826
51898
  continue;
51827
51899
  seen.add(normalized);
51828
51900
  entries.push({
51829
- text: _internals27.truncateLesson(bullet),
51901
+ text: _internals29.truncateLesson(bullet),
51830
51902
  sourceSection: match.sourceSection,
51831
- categoryHint: _internals27.inferCategoryFromText(bullet)
51903
+ categoryHint: _internals29.inferCategoryFromText(bullet)
51832
51904
  });
51833
51905
  }
51834
51906
  }
@@ -51934,12 +52006,12 @@ function resolveLegacyHiveKnowledgePath() {
51934
52006
  }
51935
52007
  return path39.join(dataDir, "hive-knowledge.jsonl");
51936
52008
  }
51937
- var _internals27;
52009
+ var _internals29;
51938
52010
  var init_knowledge_migrator = __esm(() => {
51939
52011
  init_logger();
51940
52012
  init_knowledge_store();
51941
52013
  init_knowledge_validator();
51942
- _internals27 = {
52014
+ _internals29 = {
51943
52015
  appendKnowledge,
51944
52016
  migrateContextToKnowledge,
51945
52017
  migrateKnowledgeToExternal,
@@ -55533,9 +55605,9 @@ var init_memory2 = __esm(() => {
55533
55605
 
55534
55606
  // src/services/plan-service.ts
55535
55607
  async function getPlanData(directory, phaseArg) {
55536
- const plan = await _internals28.loadPlanJsonOnly(directory);
55608
+ const plan = await _internals30.loadPlanJsonOnly(directory);
55537
55609
  if (plan) {
55538
- const fullMarkdown = _internals28.derivePlanMarkdown(plan);
55610
+ const fullMarkdown = _internals30.derivePlanMarkdown(plan);
55539
55611
  if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
55540
55612
  return {
55541
55613
  hasPlan: true,
@@ -55578,7 +55650,7 @@ async function getPlanData(directory, phaseArg) {
55578
55650
  isLegacy: false
55579
55651
  };
55580
55652
  }
55581
- const planContent = await _internals28.readSwarmFileAsync(directory, "plan.md");
55653
+ const planContent = await _internals30.readSwarmFileAsync(directory, "plan.md");
55582
55654
  if (!planContent) {
55583
55655
  return {
55584
55656
  hasPlan: false,
@@ -55674,11 +55746,11 @@ async function handlePlanCommand(directory, args) {
55674
55746
  const planData = await getPlanData(directory, phaseArg);
55675
55747
  return formatPlanMarkdown(planData);
55676
55748
  }
55677
- var _internals28;
55749
+ var _internals30;
55678
55750
  var init_plan_service = __esm(() => {
55679
55751
  init_utils2();
55680
55752
  init_manager();
55681
- _internals28 = {
55753
+ _internals30 = {
55682
55754
  loadPlanJsonOnly,
55683
55755
  derivePlanMarkdown,
55684
55756
  readSwarmFileAsync
@@ -55939,7 +56011,7 @@ function formatRelativeTime(epochMs) {
55939
56011
  return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
55940
56012
  }
55941
56013
  async function handlePrMonitorStatusCommand(directory, _args, sessionID) {
55942
- const allActive = await _internals29.listActive(directory);
56014
+ const allActive = await _internals31.listActive(directory);
55943
56015
  const sessionSubs = allActive.filter((record3) => record3.sessionID === sessionID);
55944
56016
  if (sessionSubs.length === 0) {
55945
56017
  return "No active PR subscriptions for this session.";
@@ -55968,10 +56040,10 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID) {
55968
56040
  return lines.join(`
55969
56041
  `);
55970
56042
  }
55971
- var _internals29;
56043
+ var _internals31;
55972
56044
  var init_pr_monitor_status = __esm(() => {
55973
56045
  init_pr_subscriptions();
55974
- _internals29 = {
56046
+ _internals31 = {
55975
56047
  formatRelativeTime,
55976
56048
  listActive
55977
56049
  };
@@ -56076,7 +56148,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
56076
56148
  const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
56077
56149
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
56078
56150
  try {
56079
- const config3 = _internals30.loadPluginConfig(directory);
56151
+ const config3 = _internals32.loadPluginConfig(directory);
56080
56152
  const prMonitorConfig = config3.pr_monitor;
56081
56153
  if (!prMonitorConfig?.enabled) {
56082
56154
  return [
@@ -56086,7 +56158,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
56086
56158
  ].join(`
56087
56159
  `);
56088
56160
  }
56089
- await _internals30.subscribe(directory, {
56161
+ await _internals32.subscribe(directory, {
56090
56162
  sessionID,
56091
56163
  prNumber: prInfo.number,
56092
56164
  repoFullName,
@@ -56110,12 +56182,12 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
56110
56182
  `);
56111
56183
  }
56112
56184
  }
56113
- var _internals30;
56185
+ var _internals32;
56114
56186
  var init_pr_subscribe = __esm(() => {
56115
56187
  init_pr_subscriptions();
56116
56188
  init_loader();
56117
56189
  init_pr_ref();
56118
- _internals30 = {
56190
+ _internals32 = {
56119
56191
  loadPluginConfig,
56120
56192
  subscribe
56121
56193
  };
@@ -56139,9 +56211,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
56139
56211
  `);
56140
56212
  }
56141
56213
  const refToken = rest[0];
56142
- const prInfo = _internals31.parsePrRef(refToken, directory);
56214
+ const prInfo = _internals33.parsePrRef(refToken, directory);
56143
56215
  if (!prInfo) {
56144
- if (_internals31.looksLikePrRef(refToken)) {
56216
+ if (_internals33.looksLikePrRef(refToken)) {
56145
56217
  return [
56146
56218
  `Error: Could not resolve PR reference from "${refToken}".`,
56147
56219
  "",
@@ -56162,8 +56234,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
56162
56234
  const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
56163
56235
  const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
56164
56236
  try {
56165
- const correlationId = _internals31.buildCorrelationId(sessionID, repoFullName, prInfo.number);
56166
- const result = await _internals31.unsubscribe(directory, correlationId);
56237
+ const correlationId = _internals33.buildCorrelationId(sessionID, repoFullName, prInfo.number);
56238
+ const result = await _internals33.unsubscribe(directory, correlationId);
56167
56239
  if (!result) {
56168
56240
  return [
56169
56241
  `Not subscribed to ${prUrl}`,
@@ -56190,11 +56262,11 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
56190
56262
  `);
56191
56263
  }
56192
56264
  }
56193
- var _internals31;
56265
+ var _internals33;
56194
56266
  var init_pr_unsubscribe = __esm(() => {
56195
56267
  init_pr_subscriptions();
56196
56268
  init_pr_ref();
56197
- _internals31 = {
56269
+ _internals33 = {
56198
56270
  unsubscribe,
56199
56271
  buildCorrelationId,
56200
56272
  parsePrRef,
@@ -56587,7 +56659,7 @@ async function runAdditionalLint(linter, mode, cwd) {
56587
56659
  };
56588
56660
  }
56589
56661
  }
56590
- var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals32;
56662
+ var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals34;
56591
56663
  var init_lint = __esm(() => {
56592
56664
  init_zod();
56593
56665
  init_discovery();
@@ -56619,15 +56691,15 @@ var init_lint = __esm(() => {
56619
56691
  }
56620
56692
  const { mode } = args;
56621
56693
  const cwd = directory;
56622
- const linter = await _internals32.detectAvailableLinter(directory);
56694
+ const linter = await _internals34.detectAvailableLinter(directory);
56623
56695
  if (linter) {
56624
- const result = await _internals32.runLint(linter, mode, directory);
56696
+ const result = await _internals34.runLint(linter, mode, directory);
56625
56697
  return JSON.stringify(result, null, 2);
56626
56698
  }
56627
- const additionalLinter = _internals32.detectAdditionalLinter(cwd);
56699
+ const additionalLinter = _internals34.detectAdditionalLinter(cwd);
56628
56700
  if (additionalLinter) {
56629
56701
  warn(`[lint] Using ${additionalLinter} linter for this project`);
56630
- const result = await _internals32.runAdditionalLint(additionalLinter, mode, cwd);
56702
+ const result = await _internals34.runAdditionalLint(additionalLinter, mode, cwd);
56631
56703
  return JSON.stringify(result, null, 2);
56632
56704
  }
56633
56705
  const errorResult = {
@@ -56641,7 +56713,7 @@ For Rust: rustup component add clippy`
56641
56713
  return JSON.stringify(errorResult, null, 2);
56642
56714
  }
56643
56715
  });
56644
- _internals32 = {
56716
+ _internals34 = {
56645
56717
  detectAvailableLinter,
56646
56718
  runLint,
56647
56719
  detectAdditionalLinter,
@@ -56955,7 +57027,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
56955
57027
  }
56956
57028
  async function runSecretscan(directory) {
56957
57029
  try {
56958
- const result = await _internals33.secretscan.execute({ directory }, {});
57030
+ const result = await _internals35.secretscan.execute({ directory }, {});
56959
57031
  const jsonStr = typeof result === "string" ? result : result.output;
56960
57032
  return JSON.parse(jsonStr);
56961
57033
  } catch (e) {
@@ -56970,7 +57042,7 @@ async function runSecretscan(directory) {
56970
57042
  return errorResult;
56971
57043
  }
56972
57044
  }
56973
- 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;
57045
+ 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, _internals35;
56974
57046
  var init_secretscan = __esm(() => {
56975
57047
  init_zod();
56976
57048
  init_path_security();
@@ -57342,7 +57414,7 @@ var init_secretscan = __esm(() => {
57342
57414
  }
57343
57415
  }
57344
57416
  });
57345
- _internals33 = {
57417
+ _internals35 = {
57346
57418
  secretscan,
57347
57419
  runSecretscan
57348
57420
  };
@@ -57934,14 +58006,14 @@ function buildGoBackend() {
57934
58006
  selectEntryPoints
57935
58007
  };
57936
58008
  }
57937
- var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals34;
58009
+ var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals36;
57938
58010
  var init_go = __esm(() => {
57939
58011
  init_default_backend();
57940
58012
  init_profiles();
57941
58013
  IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
57942
58014
  IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
57943
58015
  IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
57944
- _internals34 = { extractImports };
58016
+ _internals36 = { extractImports };
57945
58017
  });
57946
58018
 
57947
58019
  // src/lang/backends/python.ts
@@ -58053,13 +58125,13 @@ function buildPythonBackend() {
58053
58125
  selectEntryPoints: selectEntryPoints2
58054
58126
  };
58055
58127
  }
58056
- var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals35;
58128
+ var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals37;
58057
58129
  var init_python = __esm(() => {
58058
58130
  init_default_backend();
58059
58131
  init_profiles();
58060
58132
  IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
58061
58133
  IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
58062
- _internals35 = { extractImports: extractImports2 };
58134
+ _internals37 = { extractImports: extractImports2 };
58063
58135
  });
58064
58136
 
58065
58137
  // src/test-impact/analyzer.ts
@@ -58283,7 +58355,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
58283
58355
  return;
58284
58356
  }
58285
58357
  if (PYTHON_EXTENSIONS.has(ext)) {
58286
- const modules = _internals35.extractImports(testFile, content);
58358
+ const modules = _internals37.extractImports(testFile, content);
58287
58359
  for (const mod of modules) {
58288
58360
  const resolved = resolvePythonImport(testDir, mod);
58289
58361
  if (resolved !== null)
@@ -58292,7 +58364,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
58292
58364
  return;
58293
58365
  }
58294
58366
  if (GO_EXTENSIONS.has(ext)) {
58295
- const imports = _internals34.extractImports(testFile, content);
58367
+ const imports = _internals36.extractImports(testFile, content);
58296
58368
  for (const importPath of imports) {
58297
58369
  const sourceFiles = resolveGoImport(testDir, importPath);
58298
58370
  for (const source of sourceFiles)
@@ -58319,8 +58391,8 @@ async function buildImpactMapInternal(cwd) {
58319
58391
  return impactMap;
58320
58392
  }
58321
58393
  async function buildImpactMap(cwd) {
58322
- const impactMap = await _internals36.buildImpactMapInternal(cwd);
58323
- await _internals36.saveImpactMap(cwd, impactMap);
58394
+ const impactMap = await _internals38.buildImpactMapInternal(cwd);
58395
+ await _internals38.saveImpactMap(cwd, impactMap);
58324
58396
  return impactMap;
58325
58397
  }
58326
58398
  async function loadImpactMap(cwd, options) {
@@ -58334,7 +58406,7 @@ async function loadImpactMap(cwd, options) {
58334
58406
  const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
58335
58407
  if (hasValidValues) {
58336
58408
  const generatedAt = new Date(data.generatedAt).getTime();
58337
- if (!_internals36.isCacheStale(map3, generatedAt)) {
58409
+ if (!_internals38.isCacheStale(map3, generatedAt)) {
58338
58410
  return map3;
58339
58411
  }
58340
58412
  if (options?.skipRebuild) {
@@ -58354,13 +58426,13 @@ async function loadImpactMap(cwd, options) {
58354
58426
  if (options?.skipRebuild) {
58355
58427
  return {};
58356
58428
  }
58357
- return _internals36.buildImpactMap(cwd);
58429
+ return _internals38.buildImpactMap(cwd);
58358
58430
  }
58359
58431
  async function saveImpactMap(cwd, impactMap) {
58360
58432
  if (!path51.isAbsolute(cwd)) {
58361
58433
  throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
58362
58434
  }
58363
- _internals36.validateProjectRoot(cwd);
58435
+ _internals38.validateProjectRoot(cwd);
58364
58436
  const cacheDir2 = path51.join(cwd, ".swarm", "cache");
58365
58437
  const cachePath = path51.join(cacheDir2, "impact-map.json");
58366
58438
  if (!fs23.existsSync(cacheDir2)) {
@@ -58384,7 +58456,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
58384
58456
  };
58385
58457
  }
58386
58458
  const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
58387
- const impactMap = await _internals36.loadImpactMap(cwd);
58459
+ const impactMap = await _internals38.loadImpactMap(cwd);
58388
58460
  const impactedTestsSet = new Set;
58389
58461
  const untestedFiles = [];
58390
58462
  let visitedCount = 0;
@@ -58469,7 +58541,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
58469
58541
  budgetExceeded
58470
58542
  };
58471
58543
  }
58472
- var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals36;
58544
+ var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals38;
58473
58545
  var init_analyzer = __esm(() => {
58474
58546
  init_manager2();
58475
58547
  init_go();
@@ -58482,7 +58554,7 @@ var init_analyzer = __esm(() => {
58482
58554
  GO_EXTENSIONS = new Set([".go"]);
58483
58555
  EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
58484
58556
  goModuleCache = new Map;
58485
- _internals36 = {
58557
+ _internals38 = {
58486
58558
  validateProjectRoot,
58487
58559
  normalizePath,
58488
58560
  isCacheStale,
@@ -58818,7 +58890,7 @@ function batchAppendTestRuns(records, workingDir) {
58818
58890
  }
58819
58891
  const historyPath = getHistoryPath(workingDir);
58820
58892
  const historyDir = path52.dirname(historyPath);
58821
- _internals37.validateProjectRoot(workingDir);
58893
+ _internals39.validateProjectRoot(workingDir);
58822
58894
  if (!fs24.existsSync(historyDir)) {
58823
58895
  fs24.mkdirSync(historyDir, { recursive: true });
58824
58896
  }
@@ -58941,7 +59013,7 @@ function getAllHistory(workingDir) {
58941
59013
  records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
58942
59014
  return records;
58943
59015
  }
58944
- 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;
59016
+ 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, _internals39;
58945
59017
  var init_history_store = __esm(() => {
58946
59018
  init_manager2();
58947
59019
  DANGEROUS_PROPERTY_NAMES = new Set([
@@ -58949,7 +59021,7 @@ var init_history_store = __esm(() => {
58949
59021
  "constructor",
58950
59022
  "prototype"
58951
59023
  ]);
58952
- _internals37 = {
59024
+ _internals39 = {
58953
59025
  validateProjectRoot
58954
59026
  };
58955
59027
  });
@@ -59154,7 +59226,7 @@ function readPackageJsonRaw(dir) {
59154
59226
  }
59155
59227
  }
59156
59228
  function readPackageJson(dir) {
59157
- return _internals38.readPackageJsonRaw(dir);
59229
+ return _internals40.readPackageJsonRaw(dir);
59158
59230
  }
59159
59231
  function readPackageJsonTestScript(dir) {
59160
59232
  return readPackageJson(dir)?.scripts?.test ?? null;
@@ -59324,7 +59396,7 @@ function buildTypescriptBackend() {
59324
59396
  selectEntryPoints: selectEntryPoints3
59325
59397
  };
59326
59398
  }
59327
- var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals38;
59399
+ var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals40;
59328
59400
  var init_typescript = __esm(() => {
59329
59401
  init_default_backend();
59330
59402
  init_profiles();
@@ -59333,7 +59405,7 @@ var init_typescript = __esm(() => {
59333
59405
  IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
59334
59406
  IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
59335
59407
  IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
59336
- _internals38 = {
59408
+ _internals40 = {
59337
59409
  readPackageJsonRaw,
59338
59410
  readPackageJsonTestScript,
59339
59411
  frameworkFromScriptsTest
@@ -59366,7 +59438,7 @@ __export(exports_dispatch, {
59366
59438
  pickedProfiles: () => pickedProfiles,
59367
59439
  pickBackend: () => pickBackend,
59368
59440
  clearDispatchCache: () => clearDispatchCache,
59369
- _internals: () => _internals39
59441
+ _internals: () => _internals41
59370
59442
  });
59371
59443
  import * as fs28 from "fs";
59372
59444
  import * as path56 from "path";
@@ -59421,7 +59493,7 @@ function findManifestRoot(start) {
59421
59493
  return start;
59422
59494
  }
59423
59495
  function evictIfNeeded() {
59424
- if (cache.size <= _internals39.cacheCapacity)
59496
+ if (cache.size <= _internals41.cacheCapacity)
59425
59497
  return;
59426
59498
  let oldestKey;
59427
59499
  let oldestOrder = Infinity;
@@ -59452,7 +59524,7 @@ async function pickBackend(dir) {
59452
59524
  evictIfNeeded();
59453
59525
  return null;
59454
59526
  }
59455
- const profiles = await _internals39.detectProjectLanguages(root);
59527
+ const profiles = await _internals41.detectProjectLanguages(root);
59456
59528
  if (profiles.length === 0) {
59457
59529
  cache.set(cacheKey, {
59458
59530
  hash: hash4,
@@ -59484,12 +59556,12 @@ function clearDispatchCache() {
59484
59556
  manifestRootCache.clear();
59485
59557
  insertCounter = 0;
59486
59558
  }
59487
- var _internals39, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
59559
+ var _internals41, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
59488
59560
  var init_dispatch = __esm(() => {
59489
59561
  init_backends();
59490
59562
  init_detector();
59491
59563
  init_registry_backend();
59492
- _internals39 = {
59564
+ _internals41 = {
59493
59565
  detectProjectLanguages,
59494
59566
  cacheCapacity: 64
59495
59567
  };
@@ -61344,9 +61416,9 @@ function getVersionFileVersion(dir) {
61344
61416
  async function runVersionCheck(dir, _timeoutMs) {
61345
61417
  const startTime = Date.now();
61346
61418
  try {
61347
- const packageVersion = _internals40.getPackageVersion(dir);
61348
- const changelogVersion = _internals40.getChangelogVersion(dir);
61349
- const versionFileVersion = _internals40.getVersionFileVersion(dir);
61419
+ const packageVersion = _internals42.getPackageVersion(dir);
61420
+ const changelogVersion = _internals42.getChangelogVersion(dir);
61421
+ const versionFileVersion = _internals42.getVersionFileVersion(dir);
61350
61422
  const versions3 = [];
61351
61423
  if (packageVersion)
61352
61424
  versions3.push(`package.json: ${packageVersion}`);
@@ -61710,7 +61782,7 @@ async function runPreflight(dir, phase, config3) {
61710
61782
  const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
61711
61783
  let validatedDir;
61712
61784
  try {
61713
- validatedDir = _internals40.validateDirectoryPath(dir);
61785
+ validatedDir = _internals42.validateDirectoryPath(dir);
61714
61786
  } catch (error93) {
61715
61787
  return {
61716
61788
  id: reportId,
@@ -61730,7 +61802,7 @@ async function runPreflight(dir, phase, config3) {
61730
61802
  }
61731
61803
  let validatedTimeout;
61732
61804
  try {
61733
- validatedTimeout = _internals40.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
61805
+ validatedTimeout = _internals42.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
61734
61806
  } catch (error93) {
61735
61807
  return {
61736
61808
  id: reportId,
@@ -61771,12 +61843,12 @@ async function runPreflight(dir, phase, config3) {
61771
61843
  });
61772
61844
  const checks5 = [];
61773
61845
  log("[Preflight] Running lint check...");
61774
- const lintResult = await _internals40.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
61846
+ const lintResult = await _internals42.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
61775
61847
  checks5.push(lintResult);
61776
61848
  log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
61777
61849
  if (!cfg.skipTests) {
61778
61850
  log("[Preflight] Running tests check...");
61779
- const testsResult = await _internals40.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
61851
+ const testsResult = await _internals42.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
61780
61852
  checks5.push(testsResult);
61781
61853
  log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
61782
61854
  } else {
@@ -61788,7 +61860,7 @@ async function runPreflight(dir, phase, config3) {
61788
61860
  }
61789
61861
  if (!cfg.skipSecrets) {
61790
61862
  log("[Preflight] Running secrets check...");
61791
- const secretsResult = await _internals40.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
61863
+ const secretsResult = await _internals42.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
61792
61864
  checks5.push(secretsResult);
61793
61865
  log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
61794
61866
  } else {
@@ -61800,7 +61872,7 @@ async function runPreflight(dir, phase, config3) {
61800
61872
  }
61801
61873
  if (!cfg.skipEvidence) {
61802
61874
  log("[Preflight] Running evidence check...");
61803
- const evidenceResult = await _internals40.runEvidenceCheck(validatedDir);
61875
+ const evidenceResult = await _internals42.runEvidenceCheck(validatedDir);
61804
61876
  checks5.push(evidenceResult);
61805
61877
  log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
61806
61878
  } else {
@@ -61811,12 +61883,12 @@ async function runPreflight(dir, phase, config3) {
61811
61883
  });
61812
61884
  }
61813
61885
  log("[Preflight] Running requirement coverage check...");
61814
- const reqCoverageResult = await _internals40.runRequirementCoverageCheck(validatedDir, phase);
61886
+ const reqCoverageResult = await _internals42.runRequirementCoverageCheck(validatedDir, phase);
61815
61887
  checks5.push(reqCoverageResult);
61816
61888
  log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
61817
61889
  if (!cfg.skipVersion) {
61818
61890
  log("[Preflight] Running version check...");
61819
- const versionResult = await _internals40.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
61891
+ const versionResult = await _internals42.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
61820
61892
  checks5.push(versionResult);
61821
61893
  log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
61822
61894
  } else {
@@ -61879,10 +61951,10 @@ function formatPreflightMarkdown(report) {
61879
61951
  async function handlePreflightCommand(directory, _args) {
61880
61952
  const plan = await loadPlan(directory);
61881
61953
  const phase = plan?.current_phase ?? 1;
61882
- const report = await _internals40.runPreflight(directory, phase);
61883
- return _internals40.formatPreflightMarkdown(report);
61954
+ const report = await _internals42.runPreflight(directory, phase);
61955
+ return _internals42.formatPreflightMarkdown(report);
61884
61956
  }
61885
- var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals40;
61957
+ var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals42;
61886
61958
  var init_preflight_service = __esm(() => {
61887
61959
  init_gate_bridge();
61888
61960
  init_manager2();
@@ -61901,7 +61973,7 @@ var init_preflight_service = __esm(() => {
61901
61973
  testScope: "convention",
61902
61974
  linter: "biome"
61903
61975
  };
61904
- _internals40 = {
61976
+ _internals42 = {
61905
61977
  runPreflight,
61906
61978
  formatPreflightMarkdown,
61907
61979
  handlePreflightCommand,
@@ -63326,7 +63398,7 @@ async function handleSimulateCommand(directory, args) {
63326
63398
  }
63327
63399
  let darkMatterPairs;
63328
63400
  try {
63329
- darkMatterPairs = await _internals20.detectDarkMatter(directory, options);
63401
+ darkMatterPairs = await _internals22.detectDarkMatter(directory, options);
63330
63402
  } catch (err) {
63331
63403
  const errMsg = err instanceof Error ? err.message : String(err);
63332
63404
  return `## Simulate Report
@@ -63696,7 +63768,7 @@ async function getStatusData(directory, agents) {
63696
63768
  }
63697
63769
  function enrichWithLeanTurbo(status, directory) {
63698
63770
  const turboMode = hasActiveTurboMode();
63699
- const leanActive = _internals41.hasActiveLeanTurbo();
63771
+ const leanActive = _internals43.hasActiveLeanTurbo();
63700
63772
  let turboStrategy = "off";
63701
63773
  if (leanActive) {
63702
63774
  turboStrategy = "lean";
@@ -63715,7 +63787,7 @@ function enrichWithLeanTurbo(status, directory) {
63715
63787
  }
63716
63788
  }
63717
63789
  if (leanSessionID) {
63718
- const runState = _internals41.loadLeanTurboRunState(directory, leanSessionID);
63790
+ const runState = _internals43.loadLeanTurboRunState(directory, leanSessionID);
63719
63791
  if (runState) {
63720
63792
  status.leanTurboPhase = runState.phase;
63721
63793
  status.leanMaxParallelCoders = runState.maxParallelCoders;
@@ -63747,7 +63819,7 @@ function enrichWithLeanTurbo(status, directory) {
63747
63819
  }
63748
63820
  }
63749
63821
  }
63750
- status.fullAutoActive = _internals41.hasActiveFullAuto();
63822
+ status.fullAutoActive = _internals43.hasActiveFullAuto();
63751
63823
  return status;
63752
63824
  }
63753
63825
  function formatStatusMarkdown(status) {
@@ -63875,7 +63947,7 @@ async function countProposals(directory) {
63875
63947
  return 0;
63876
63948
  }
63877
63949
  }
63878
- var _internals41;
63950
+ var _internals43;
63879
63951
  var init_status_service = __esm(() => {
63880
63952
  init_extractors();
63881
63953
  init_knowledge_escalator();
@@ -63885,7 +63957,7 @@ var init_status_service = __esm(() => {
63885
63957
  init_state3();
63886
63958
  init_compaction_service();
63887
63959
  init_context_budget_service();
63888
- _internals41 = {
63960
+ _internals43 = {
63889
63961
  loadLeanTurboRunState,
63890
63962
  hasActiveLeanTurbo,
63891
63963
  hasActiveFullAuto
@@ -63976,7 +64048,7 @@ async function handleTurboCommand(directory, args, sessionID) {
63976
64048
  if (arg0 === "on") {
63977
64049
  let strategy = "standard";
63978
64050
  try {
63979
- const { config: config3 } = _internals42.loadPluginConfigWithMeta(directory);
64051
+ const { config: config3 } = _internals44.loadPluginConfigWithMeta(directory);
63980
64052
  if (config3.turbo?.strategy === "lean") {
63981
64053
  strategy = "lean";
63982
64054
  }
@@ -64031,7 +64103,7 @@ function enableLeanTurbo(session, directory, sessionID) {
64031
64103
  let maxParallelCoders = 4;
64032
64104
  let conflictPolicy = "serialize";
64033
64105
  try {
64034
- const { config: config3 } = _internals42.loadPluginConfigWithMeta(directory);
64106
+ const { config: config3 } = _internals44.loadPluginConfigWithMeta(directory);
64035
64107
  const leanConfig = config3.turbo?.lean;
64036
64108
  if (leanConfig) {
64037
64109
  maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
@@ -64101,13 +64173,13 @@ function buildStatusMessage2(session, directory, sessionID) {
64101
64173
  ].join(`
64102
64174
  `);
64103
64175
  }
64104
- var _internals42;
64176
+ var _internals44;
64105
64177
  var init_turbo = __esm(() => {
64106
64178
  init_config();
64107
64179
  init_state();
64108
64180
  init_state3();
64109
64181
  init_logger();
64110
- _internals42 = {
64182
+ _internals44 = {
64111
64183
  loadPluginConfigWithMeta
64112
64184
  };
64113
64185
  });
@@ -64200,7 +64272,7 @@ function formatCommandNotFound(tokens) {
64200
64272
  const attemptedCommand = tokens[0] || "";
64201
64273
  const MAX_DISPLAY = 100;
64202
64274
  const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
64203
- const similar = _internals43.findSimilarCommands(attemptedCommand);
64275
+ const similar = _internals45.findSimilarCommands(attemptedCommand);
64204
64276
  const header = `Command \`/swarm ${displayCommand}\` not found.`;
64205
64277
  const suggestions = similar.length > 0 ? `Did you mean:
64206
64278
  ${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
@@ -64748,7 +64820,7 @@ async function buildSwarmCommandPrompt(args) {
64748
64820
  packageRoot,
64749
64821
  registeredAgents
64750
64822
  } = args;
64751
- const resolved = _internals43.resolveCommand(tokens);
64823
+ const resolved = _internals45.resolveCommand(tokens);
64752
64824
  if (!resolved) {
64753
64825
  if (tokens.length === 0) {
64754
64826
  return buildHelpText();
@@ -64919,7 +64991,7 @@ function findSimilarCommands(query) {
64919
64991
  }
64920
64992
  const scored = VALID_COMMANDS.map((cmd) => {
64921
64993
  const cmdLower = cmd.toLowerCase();
64922
- const fullScore = _internals43.levenshteinDistance(q, cmdLower);
64994
+ const fullScore = _internals45.levenshteinDistance(q, cmdLower);
64923
64995
  let tokenScore = Infinity;
64924
64996
  if (cmd.includes(" ") || cmd.includes("-")) {
64925
64997
  const qTokens = q.split(/[\s-]+/);
@@ -64932,7 +65004,7 @@ function findSimilarCommands(query) {
64932
65004
  for (const ct of cmdTokens) {
64933
65005
  if (ct.length === 0)
64934
65006
  continue;
64935
- const dist = _internals43.levenshteinDistance(qt, ct);
65007
+ const dist = _internals45.levenshteinDistance(qt, ct);
64936
65008
  if (dist < minDist)
64937
65009
  minDist = dist;
64938
65010
  }
@@ -64942,7 +65014,7 @@ function findSimilarCommands(query) {
64942
65014
  }
64943
65015
  const dashStrippedQ = q.replace(/-/g, "");
64944
65016
  const dashStrippedCmd = cmdLower.replace(/-/g, "");
64945
- const dashScore = _internals43.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
65017
+ const dashScore = _internals45.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
64946
65018
  const score = Math.min(fullScore, tokenScore, dashScore);
64947
65019
  return { cmd, score };
64948
65020
  });
@@ -64974,11 +65046,11 @@ async function handleHelpCommand(ctx) {
64974
65046
  return buildHelpText2();
64975
65047
  }
64976
65048
  const tokens = targetCommand.split(/\s+/);
64977
- const resolved = _internals43.resolveCommand(tokens);
65049
+ const resolved = _internals45.resolveCommand(tokens);
64978
65050
  if (resolved) {
64979
- return _internals43.buildDetailedHelp(resolved.key, resolved.entry);
65051
+ return _internals45.buildDetailedHelp(resolved.key, resolved.entry);
64980
65052
  }
64981
- const similar = _internals43.findSimilarCommands(targetCommand);
65053
+ const similar = _internals45.findSimilarCommands(targetCommand);
64982
65054
  const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
64983
65055
  if (similar.length > 0) {
64984
65056
  return `Command '/swarm ${targetCommand}' not found.
@@ -65078,7 +65150,7 @@ function resolveCommand(tokens) {
65078
65150
  }
65079
65151
  return null;
65080
65152
  }
65081
- var COMMAND_REGISTRY, VALID_COMMANDS, _internals43, validation;
65153
+ var COMMAND_REGISTRY, VALID_COMMANDS, _internals45, validation;
65082
65154
  var init_registry = __esm(() => {
65083
65155
  init_bundled_skills();
65084
65156
  init_acknowledge_spec_drift();
@@ -65161,7 +65233,7 @@ var init_registry = __esm(() => {
65161
65233
  clashesWithNativeCcCommand: "/agents"
65162
65234
  },
65163
65235
  help: {
65164
- handler: (ctx) => _internals43.handleHelpCommand(ctx),
65236
+ handler: (ctx) => _internals45.handleHelpCommand(ctx),
65165
65237
  description: "Show help for swarm commands",
65166
65238
  category: "core",
65167
65239
  args: "[command]",
@@ -65740,7 +65812,7 @@ Subcommands:
65740
65812
  }
65741
65813
  };
65742
65814
  VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
65743
- _internals43 = {
65815
+ _internals45 = {
65744
65816
  handleHelpCommand,
65745
65817
  validateAliases,
65746
65818
  resolveCommand,
@@ -65748,7 +65820,7 @@ Subcommands:
65748
65820
  findSimilarCommands,
65749
65821
  buildDetailedHelp
65750
65822
  };
65751
- validation = _internals43.validateAliases();
65823
+ validation = _internals45.validateAliases();
65752
65824
  if (!validation.valid) {
65753
65825
  throw new Error(`COMMAND_REGISTRY alias validation failed:
65754
65826
  ${validation.errors.join(`