opencode-swarm 7.59.0 → 7.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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.59.0",
55
+ version: "7.60.0",
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",
@@ -17455,7 +17455,7 @@ function getCanonicalAgentRole(agentName, generatedAgentNames) {
17455
17455
  function stripKnownSwarmPrefix(agentName) {
17456
17456
  return getCanonicalAgentRole(agentName);
17457
17457
  }
17458
- var SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentOverrideConfigSchema, SwarmConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, CheckpointConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, ParallelizationConfigSchema, LeanTurboConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, PluginConfigSchema;
17458
+ var SEPARATORS, CANONICAL_ROLES_LONGEST_FIRST, CANONICAL_ROLES_SET, AgentOverrideConfigSchema, SwarmConfigSchema, HooksConfigSchema, ScoringWeightsSchema, DecisionDecaySchema, TokenRatiosSchema, ScoringConfigSchema, ContextBudgetConfigSchema, EvidenceConfigSchema, GateFeatureSchema, PlaceholderScanConfigSchema, QualityBudgetConfigSchema, GateConfigSchema, PipelineConfigSchema, PhaseCompleteConfigSchema, SummaryConfigSchema, ReviewPassesConfigSchema, AdversarialDetectionConfigSchema, AdversarialTestingConfigSchemaBase, AdversarialTestingConfigSchema, IntegrationAnalysisConfigSchema, DocsConfigSchema, DesignDocsConfigSchema, UIReviewConfigSchema, CompactionAdvisoryConfigSchema, LintConfigSchema, SecretscanConfigSchema, GuardrailsProfileSchema, DEFAULT_AGENT_PROFILES, DEFAULT_ARCHITECT_PROFILE, GuardrailsConfigSchema, WatchdogConfigSchema, SelfReviewConfigSchema, ToolFilterConfigSchema, PlanCursorConfigSchema, ContextMapConfigSchema, CheckpointConfigSchema, AutomationModeSchema, AutomationCapabilitiesSchema, AutomationConfigSchemaBase, AutomationConfigSchema, KnowledgeConfigSchema, MemoryConfigSchema, CuratorConfigSchema, ArchitecturalSupervisionConfigSchema, KnowledgeApplicationConfigSchema, SkillPropagationConfigSchema, SkillImproverConfigSchema, SpecWriterConfigSchema, SlopDetectorConfigSchema, IncrementalVerifyConfigSchema, CompactionConfigSchema, PrmConfigSchema, AgentAuthorityRuleSchema, AuthorityConfigSchema, GeneralCouncilMemberConfigSchema, GeneralCouncilConfigSchema, CouncilConfigSchema, ParallelizationConfigSchema, WorktreeIsolationConfigSchema, LeanTurboConfigSchema, StandardTurboConfigSchema, LeanTurboStrategyConfigSchema, TurboConfigSchema, PluginConfigSchema;
17459
17459
  var init_schema = __esm(() => {
17460
17460
  init_zod();
17461
17461
  init_constants();
@@ -18132,6 +18132,12 @@ var init_schema = __esm(() => {
18132
18132
  max_coders: exports_external.number().int().min(1).max(16).default(3),
18133
18133
  max_reviewers: exports_external.number().int().min(1).max(16).default(2)
18134
18134
  });
18135
+ WorktreeIsolationConfigSchema = exports_external.object({
18136
+ policy: exports_external.enum(["auto", "required", "disabled"]).default("auto"),
18137
+ merge_strategy: exports_external.enum(["merge", "rebase", "cherry-pick"]).default("merge"),
18138
+ worktree_dir: exports_external.string().optional(),
18139
+ deps_strategy: exports_external.enum(["skip", "copy", "link"]).default("skip")
18140
+ });
18135
18141
  LeanTurboConfigSchema = exports_external.object({
18136
18142
  max_parallel_coders: exports_external.number().int().min(1).max(6).default(4),
18137
18143
  require_declared_scope: exports_external.boolean().default(true),
@@ -18229,6 +18235,7 @@ var init_schema = __esm(() => {
18229
18235
  prm: PrmConfigSchema.optional(),
18230
18236
  council: CouncilConfigSchema.optional(),
18231
18237
  parallelization: ParallelizationConfigSchema.optional(),
18238
+ worktree: WorktreeIsolationConfigSchema.optional(),
18232
18239
  turbo: TurboConfigSchema.optional(),
18233
18240
  turbo_mode: exports_external.boolean().default(false).optional(),
18234
18241
  quiet: exports_external.boolean().default(true).optional(),
@@ -21171,6 +21178,64 @@ var init_qa_gate_profile = __esm(() => {
21171
21178
  final_council: false
21172
21179
  };
21173
21180
  });
21181
+ // src/worktree/core.ts
21182
+ import * as os3 from "os";
21183
+ async function runGit(args, cwd, timeoutMs = WORKTREE_TIMEOUT_MS) {
21184
+ const proc = _internals8.bunSpawn(["git", ...args], {
21185
+ cwd,
21186
+ timeout: timeoutMs,
21187
+ stdin: "ignore",
21188
+ stdout: "pipe",
21189
+ stderr: "pipe",
21190
+ env: { ...process.env, LC_ALL: "C" }
21191
+ });
21192
+ try {
21193
+ const exitCode = await proc.exited;
21194
+ const stdout = await proc.stdout.text();
21195
+ const stderr = await proc.stderr.text();
21196
+ return { exitCode, stdout, stderr };
21197
+ } finally {
21198
+ try {
21199
+ proc.kill();
21200
+ } catch {}
21201
+ }
21202
+ }
21203
+ var _internals8, WORKTREE_TIMEOUT_MS = 30000;
21204
+ var init_core3 = __esm(() => {
21205
+ init_bun_compat();
21206
+ _internals8 = {
21207
+ bunSpawn,
21208
+ platform: process.platform,
21209
+ sleep: (ms) => new Promise((resolve7) => setTimeout(resolve7, ms)),
21210
+ osTmpdir: () => os3.tmpdir(),
21211
+ getCoreLongPaths: async (directory) => {
21212
+ const result = await runGit(["config", "core.longpaths"], directory);
21213
+ if (result.exitCode !== 0) {
21214
+ return;
21215
+ }
21216
+ const value = result.stdout.trim().toLowerCase();
21217
+ return value === "" ? undefined : value;
21218
+ }
21219
+ };
21220
+ });
21221
+
21222
+ // src/worktree/merge.ts
21223
+ var _internals9;
21224
+ var init_merge = __esm(() => {
21225
+ init_bun_compat();
21226
+ init_core3();
21227
+ _internals9 = {
21228
+ bunSpawn,
21229
+ platform: process.platform,
21230
+ sleep: (ms) => new Promise((resolve7) => setTimeout(resolve7, ms))
21231
+ };
21232
+ });
21233
+ // src/worktree/index.ts
21234
+ var init_worktree = __esm(() => {
21235
+ init_core3();
21236
+ init_merge();
21237
+ });
21238
+
21174
21239
  // node_modules/quick-lru/index.js
21175
21240
  var QuickLRU;
21176
21241
  var init_quick_lru = __esm(() => {
@@ -21904,15 +21969,22 @@ var init_guardrails = __esm(() => {
21904
21969
  function clearPendingCoderScope() {
21905
21970
  pendingCoderScopeByTaskId.clear();
21906
21971
  }
21907
- var EvidenceTaskIdPlanSchema, pendingCoderScopeByTaskId, SWARM_BACKGROUND_TASK_BLOCKED_MESSAGE, ACTIVE_PARALLEL_TASK_STATES;
21972
+ function resetStandardWorktreeIsolationState() {
21973
+ standardWorktreeByCallID.clear();
21974
+ standardWorktreeSerializationSessions.clear();
21975
+ standardWorktreeMergeQueue = Promise.resolve();
21976
+ }
21977
+ var EvidenceTaskIdPlanSchema, pendingCoderScopeByTaskId, SWARM_BACKGROUND_TASK_BLOCKED_MESSAGE, ACTIVE_PARALLEL_TASK_STATES, standardWorktreeByCallID, standardWorktreeSerializationSessions, standardWorktreeMergeQueue;
21908
21978
  var init_delegation_gate = __esm(() => {
21909
21979
  init_zod();
21980
+ init_constants();
21910
21981
  init_schema();
21911
21982
  init_manager();
21912
21983
  init_state();
21913
21984
  init_telemetry();
21914
21985
  init_logger();
21915
21986
  init_task_id();
21987
+ init_worktree();
21916
21988
  init_guardrails();
21917
21989
  init_normalize_tool_name();
21918
21990
  init_utils2();
@@ -21932,6 +22004,9 @@ var init_delegation_gate = __esm(() => {
21932
22004
  "reviewer_run",
21933
22005
  "tests_run"
21934
22006
  ]);
22007
+ standardWorktreeByCallID = new Map;
22008
+ standardWorktreeSerializationSessions = new Set;
22009
+ standardWorktreeMergeQueue = Promise.resolve();
21935
22010
  });
21936
22011
 
21937
22012
  // src/state/agent-run-context.ts
@@ -21976,6 +22051,7 @@ function resetSwarmState() {
21976
22051
  swarmState.fullAutoEnabledInConfig = false;
21977
22052
  swarmState.environmentProfiles.clear();
21978
22053
  clearPendingCoderScope();
22054
+ resetStandardWorktreeIsolationState();
21979
22055
  _councilDisagreementWarned.clear();
21980
22056
  }
21981
22057
  function getAgentSession(sessionId) {
@@ -22451,7 +22527,7 @@ function config2(newConfig) {
22451
22527
  return globalConfig2;
22452
22528
  }
22453
22529
  var NEVER2, $brand2, $ZodAsyncError2, $ZodEncodeError2, globalConfig2;
22454
- var init_core3 = __esm(() => {
22530
+ var init_core4 = __esm(() => {
22455
22531
  NEVER2 = Object.freeze({
22456
22532
  status: "aborted"
22457
22533
  });
@@ -23242,7 +23318,7 @@ var initializer3 = (inst, def) => {
23242
23318
  });
23243
23319
  }, $ZodError2, $ZodRealError2;
23244
23320
  var init_errors4 = __esm(() => {
23245
- init_core3();
23321
+ init_core4();
23246
23322
  init_util2();
23247
23323
  $ZodError2 = $constructor2("$ZodError", initializer3);
23248
23324
  $ZodRealError2 = $constructor2("$ZodError", initializer3, { Parent: Error });
@@ -23313,7 +23389,7 @@ var _parse2 = (_Err) => (schema, value, _ctx, _params) => {
23313
23389
  return _safeParseAsync2(_Err)(schema, value, _ctx);
23314
23390
  }, safeDecodeAsync3;
23315
23391
  var init_parse3 = __esm(() => {
23316
- init_core3();
23392
+ init_core4();
23317
23393
  init_errors4();
23318
23394
  init_util2();
23319
23395
  parse6 = /* @__PURE__ */ _parse2($ZodRealError2);
@@ -23489,7 +23565,7 @@ function handleCheckPropertyResult2(result, payload, property) {
23489
23565
  }
23490
23566
  var $ZodCheck2, numericOriginMap2, $ZodCheckLessThan2, $ZodCheckGreaterThan2, $ZodCheckMultipleOf2, $ZodCheckNumberFormat2, $ZodCheckBigIntFormat2, $ZodCheckMaxSize2, $ZodCheckMinSize2, $ZodCheckSizeEquals2, $ZodCheckMaxLength2, $ZodCheckMinLength2, $ZodCheckLengthEquals2, $ZodCheckStringFormat2, $ZodCheckRegex2, $ZodCheckLowerCase2, $ZodCheckUpperCase2, $ZodCheckIncludes2, $ZodCheckStartsWith2, $ZodCheckEndsWith2, $ZodCheckProperty2, $ZodCheckMimeType2, $ZodCheckOverwrite2;
23491
23567
  var init_checks3 = __esm(() => {
23492
- init_core3();
23568
+ init_core4();
23493
23569
  init_regexes2();
23494
23570
  init_util2();
23495
23571
  $ZodCheck2 = /* @__PURE__ */ $constructor2("$ZodCheck", (inst, def) => {
@@ -24383,7 +24459,7 @@ function handleRefineResult2(result, payload, input, inst) {
24383
24459
  var $ZodType2, $ZodString2, $ZodStringFormat2, $ZodGUID2, $ZodUUID2, $ZodEmail2, $ZodURL2, $ZodEmoji2, $ZodNanoID2, $ZodCUID3, $ZodCUID22, $ZodULID2, $ZodXID2, $ZodKSUID2, $ZodISODateTime2, $ZodISODate2, $ZodISOTime2, $ZodISODuration2, $ZodIPv42, $ZodIPv62, $ZodCIDRv42, $ZodCIDRv62, $ZodBase642, $ZodBase64URL2, $ZodE1642, $ZodJWT2, $ZodCustomStringFormat2, $ZodNumber2, $ZodNumberFormat2, $ZodBoolean2, $ZodBigInt2, $ZodBigIntFormat2, $ZodSymbol2, $ZodUndefined2, $ZodNull2, $ZodAny2, $ZodUnknown2, $ZodNever2, $ZodVoid2, $ZodDate2, $ZodArray2, $ZodObject2, $ZodObjectJIT2, $ZodUnion2, $ZodDiscriminatedUnion2, $ZodIntersection2, $ZodTuple2, $ZodRecord2, $ZodMap2, $ZodSet2, $ZodEnum2, $ZodLiteral2, $ZodFile2, $ZodTransform2, $ZodOptional2, $ZodNullable2, $ZodDefault2, $ZodPrefault2, $ZodNonOptional2, $ZodSuccess2, $ZodCatch2, $ZodNaN2, $ZodPipe2, $ZodCodec2, $ZodReadonly2, $ZodTemplateLiteral2, $ZodFunction2, $ZodPromise2, $ZodLazy2, $ZodCustom2;
24384
24460
  var init_schemas3 = __esm(() => {
24385
24461
  init_checks3();
24386
- init_core3();
24462
+ init_core4();
24387
24463
  init_parse3();
24388
24464
  init_regexes2();
24389
24465
  init_util2();
@@ -32231,10 +32307,10 @@ function _property2(property, schema, params) {
32231
32307
  ...normalizeParams2(params)
32232
32308
  });
32233
32309
  }
32234
- function _mime2(types, params) {
32310
+ function _mime2(types2, params) {
32235
32311
  return new $ZodCheckMimeType2({
32236
32312
  check: "mime_type",
32237
- mime: types,
32313
+ mime: types2,
32238
32314
  ...normalizeParams2(params)
32239
32315
  });
32240
32316
  }
@@ -33630,12 +33706,12 @@ __export(exports_core4, {
33630
33706
  $ZodArray: () => $ZodArray2,
33631
33707
  $ZodAny: () => $ZodAny2
33632
33708
  });
33633
- var init_core4 = __esm(() => {
33709
+ var init_core5 = __esm(() => {
33634
33710
  init_util2();
33635
33711
  init_regexes2();
33636
33712
  init_locales2();
33637
33713
  init_json_schema2();
33638
- init_core3();
33714
+ init_core4();
33639
33715
  init_parse3();
33640
33716
  init_errors4();
33641
33717
  init_schemas3();
@@ -33648,7 +33724,7 @@ var init_core4 = __esm(() => {
33648
33724
 
33649
33725
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/checks.js
33650
33726
  var init_checks4 = __esm(() => {
33651
- init_core4();
33727
+ init_core5();
33652
33728
  });
33653
33729
 
33654
33730
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/iso.js
@@ -33677,7 +33753,7 @@ function duration4(params) {
33677
33753
  }
33678
33754
  var ZodISODateTime2, ZodISODate2, ZodISOTime2, ZodISODuration2;
33679
33755
  var init_iso2 = __esm(() => {
33680
- init_core4();
33756
+ init_core5();
33681
33757
  init_schemas4();
33682
33758
  ZodISODateTime2 = /* @__PURE__ */ $constructor2("ZodISODateTime", (inst, def) => {
33683
33759
  $ZodISODateTime2.init(inst, def);
@@ -33728,8 +33804,8 @@ var initializer4 = (inst, issues) => {
33728
33804
  });
33729
33805
  }, ZodError2, ZodRealError2;
33730
33806
  var init_errors5 = __esm(() => {
33731
- init_core4();
33732
- init_core4();
33807
+ init_core5();
33808
+ init_core5();
33733
33809
  init_util2();
33734
33810
  ZodError2 = $constructor2("ZodError", initializer4);
33735
33811
  ZodRealError2 = $constructor2("ZodError", initializer4, {
@@ -33740,7 +33816,7 @@ var init_errors5 = __esm(() => {
33740
33816
  // node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/parse.js
33741
33817
  var parse8, parseAsync4, safeParse4, safeParseAsync4, encode4, decode4, encodeAsync4, decodeAsync4, safeEncode4, safeDecode4, safeEncodeAsync4, safeDecodeAsync4;
33742
33818
  var init_parse4 = __esm(() => {
33743
- init_core4();
33819
+ init_core5();
33744
33820
  init_errors5();
33745
33821
  parse8 = /* @__PURE__ */ _parse2(ZodRealError2);
33746
33822
  parseAsync4 = /* @__PURE__ */ _parseAsync2(ZodRealError2);
@@ -34189,8 +34265,8 @@ var ZodType2, _ZodString2, ZodString2, ZodStringFormat2, ZodEmail2, ZodGUID2, Zo
34189
34265
  String: ZodString2
34190
34266
  }, ...args);
34191
34267
  var init_schemas4 = __esm(() => {
34192
- init_core4();
34193
- init_core4();
34268
+ init_core5();
34269
+ init_core5();
34194
34270
  init_checks4();
34195
34271
  init_iso2();
34196
34272
  init_parse4();
@@ -34626,7 +34702,7 @@ var init_schemas4 = __esm(() => {
34626
34702
  ZodType2.init(inst, def);
34627
34703
  inst.min = (size, params) => inst.check(_minSize2(size, params));
34628
34704
  inst.max = (size, params) => inst.check(_maxSize2(size, params));
34629
- inst.mime = (types, params) => inst.check(_mime2(Array.isArray(types) ? types : [types], params));
34705
+ inst.mime = (types2, params) => inst.check(_mime2(Array.isArray(types2) ? types2 : [types2], params));
34630
34706
  });
34631
34707
  ZodTransform2 = /* @__PURE__ */ $constructor2("ZodTransform", (inst, def) => {
34632
34708
  $ZodTransform2.init(inst, def);
@@ -34750,7 +34826,7 @@ function getErrorMap2() {
34750
34826
  }
34751
34827
  var ZodIssueCode2, ZodFirstPartyTypeKind2;
34752
34828
  var init_compat2 = __esm(() => {
34753
- init_core4();
34829
+ init_core5();
34754
34830
  ZodIssueCode2 = {
34755
34831
  invalid_type: "invalid_type",
34756
34832
  too_big: "too_big",
@@ -34792,7 +34868,7 @@ function date8(params) {
34792
34868
  return _coercedDate2(ZodDate2, params);
34793
34869
  }
34794
34870
  var init_coerce2 = __esm(() => {
34795
- init_core4();
34871
+ init_core5();
34796
34872
  init_schemas4();
34797
34873
  });
34798
34874
 
@@ -35026,10 +35102,10 @@ __export(exports_external2, {
35026
35102
  $brand: () => $brand2
35027
35103
  });
35028
35104
  var init_external2 = __esm(() => {
35029
- init_core4();
35030
- init_core4();
35105
+ init_core5();
35106
+ init_core5();
35031
35107
  init_en2();
35032
- init_core4();
35108
+ init_core5();
35033
35109
  init_locales2();
35034
35110
  init_iso2();
35035
35111
  init_iso2();
@@ -35624,7 +35700,7 @@ function resetToRemoteBranch(cwd, options) {
35624
35700
  const prunedBranches = [];
35625
35701
  try {
35626
35702
  const currentBranch = getCurrentBranch(cwd);
35627
- const defaultRemoteBranch = _internals8.detectDefaultRemoteBranch(cwd);
35703
+ const defaultRemoteBranch = _internals10.detectDefaultRemoteBranch(cwd);
35628
35704
  if (!defaultRemoteBranch) {
35629
35705
  return {
35630
35706
  success: false,
@@ -35806,7 +35882,7 @@ function resetToRemoteBranch(cwd, options) {
35806
35882
  function resetToMainAfterMerge(cwd, options) {
35807
35883
  const warnings = [];
35808
35884
  try {
35809
- const defaultBranch = _internals8.detectDefaultRemoteBranch(cwd);
35885
+ const defaultBranch = _internals10.detectDefaultRemoteBranch(cwd);
35810
35886
  if (!defaultBranch) {
35811
35887
  return {
35812
35888
  success: false,
@@ -35833,7 +35909,7 @@ function resetToMainAfterMerge(cwd, options) {
35833
35909
  }
35834
35910
  if (currentBranch === defaultBranch) {
35835
35911
  try {
35836
- const logOutput = _internals8.gitExec(["log", `${targetBranch}..HEAD`, "--oneline"], cwd);
35912
+ const logOutput = _internals10.gitExec(["log", `${targetBranch}..HEAD`, "--oneline"], cwd);
35837
35913
  if (logOutput.trim().length > 0) {
35838
35914
  return {
35839
35915
  success: false,
@@ -35848,11 +35924,11 @@ function resetToMainAfterMerge(cwd, options) {
35848
35924
  } catch {}
35849
35925
  } else {
35850
35926
  try {
35851
- _internals8.gitExec(["rev-parse", "--abbrev-ref", `${currentBranch}@{upstream}`], cwd);
35927
+ _internals10.gitExec(["rev-parse", "--abbrev-ref", `${currentBranch}@{upstream}`], cwd);
35852
35928
  } catch {
35853
35929
  try {
35854
- const localSha = _internals8.gitExec(["rev-parse", "HEAD"], cwd).trim();
35855
- const remoteSha = _internals8.gitExec(["rev-parse", targetBranch], cwd).trim();
35930
+ const localSha = _internals10.gitExec(["rev-parse", "HEAD"], cwd).trim();
35931
+ const remoteSha = _internals10.gitExec(["rev-parse", targetBranch], cwd).trim();
35856
35932
  if (localSha !== remoteSha) {
35857
35933
  return {
35858
35934
  success: false,
@@ -35878,7 +35954,7 @@ function resetToMainAfterMerge(cwd, options) {
35878
35954
  }
35879
35955
  }
35880
35956
  try {
35881
- _internals8.gitExec(["fetch", "--prune", "origin"], cwd);
35957
+ _internals10.gitExec(["fetch", "--prune", "origin"], cwd);
35882
35958
  } catch (err) {
35883
35959
  return {
35884
35960
  success: false,
@@ -35894,7 +35970,7 @@ function resetToMainAfterMerge(cwd, options) {
35894
35970
  let switchedBranch = false;
35895
35971
  if (currentBranch !== defaultBranch) {
35896
35972
  try {
35897
- _internals8.gitExec(["checkout", defaultBranch], cwd);
35973
+ _internals10.gitExec(["checkout", defaultBranch], cwd);
35898
35974
  switchedBranch = true;
35899
35975
  } catch (err) {
35900
35976
  return {
@@ -35909,7 +35985,7 @@ function resetToMainAfterMerge(cwd, options) {
35909
35985
  }
35910
35986
  }
35911
35987
  try {
35912
- _internals8.gitExec(["reset", "--hard", targetBranch], cwd);
35988
+ _internals10.gitExec(["reset", "--hard", targetBranch], cwd);
35913
35989
  } catch (err) {
35914
35990
  return {
35915
35991
  success: false,
@@ -35930,7 +36006,7 @@ function resetToMainAfterMerge(cwd, options) {
35930
36006
  while (Date.now() < endTime) {}
35931
36007
  }
35932
36008
  try {
35933
- _internals8.gitExec(["checkout", "--", "."], cwd);
36009
+ _internals10.gitExec(["checkout", "--", "."], cwd);
35934
36010
  discardSucceeded = true;
35935
36011
  break;
35936
36012
  } catch {}
@@ -35941,18 +36017,18 @@ function resetToMainAfterMerge(cwd, options) {
35941
36017
  changesDiscarded = discardSucceeded;
35942
36018
  }
35943
36019
  try {
35944
- _internals8.gitExec(["clean", "-fd"], cwd);
36020
+ _internals10.gitExec(["clean", "-fd"], cwd);
35945
36021
  } catch {
35946
36022
  warnings.push("Could not clean untracked files");
35947
36023
  }
35948
36024
  let branchDeleted = false;
35949
36025
  if (switchedBranch && previousBranch !== defaultBranch) {
35950
36026
  try {
35951
- const mergedOutput = _internals8.gitExec(["branch", "--merged", defaultBranch], cwd);
36027
+ const mergedOutput = _internals10.gitExec(["branch", "--merged", defaultBranch], cwd);
35952
36028
  const isMerged = mergedOutput.split(`
35953
36029
  `).some((line) => line.trim() === previousBranch || line.trim() === `* ${previousBranch}`);
35954
36030
  if (isMerged) {
35955
- _internals8.gitExec(["branch", "-d", previousBranch], cwd);
36031
+ _internals10.gitExec(["branch", "-d", previousBranch], cwd);
35956
36032
  branchDeleted = true;
35957
36033
  } else {
35958
36034
  warnings.push(`Branch ${previousBranch} is not merged into ${defaultBranch} \u2014 keeping it`);
@@ -35963,7 +36039,7 @@ function resetToMainAfterMerge(cwd, options) {
35963
36039
  }
35964
36040
  if (options?.pruneBranches) {
35965
36041
  try {
35966
- const mergedOutput = _internals8.gitExec(["branch", "--merged", defaultBranch], cwd);
36042
+ const mergedOutput = _internals10.gitExec(["branch", "--merged", defaultBranch], cwd);
35967
36043
  const mergedLines = mergedOutput.split(`
35968
36044
  `);
35969
36045
  for (const line of mergedLines) {
@@ -35972,7 +36048,7 @@ function resetToMainAfterMerge(cwd, options) {
35972
36048
  continue;
35973
36049
  }
35974
36050
  try {
35975
- _internals8.gitExec(["branch", "-d", trimmedLine], cwd);
36051
+ _internals10.gitExec(["branch", "-d", trimmedLine], cwd);
35976
36052
  } catch {
35977
36053
  warnings.push(`Could not prune branch: ${trimmedLine}`);
35978
36054
  }
@@ -36002,10 +36078,10 @@ function resetToMainAfterMerge(cwd, options) {
36002
36078
  };
36003
36079
  }
36004
36080
  }
36005
- var GIT_TIMEOUT_MS2 = 30000, _internals8;
36081
+ var GIT_TIMEOUT_MS2 = 30000, _internals10;
36006
36082
  var init_branch = __esm(() => {
36007
36083
  init_logger();
36008
- _internals8 = {
36084
+ _internals10 = {
36009
36085
  gitExec: gitExec2,
36010
36086
  detectDefaultRemoteBranch,
36011
36087
  getDefaultBaseBranch,
@@ -36057,11 +36133,11 @@ class AutomationEventBus {
36057
36133
  }));
36058
36134
  }
36059
36135
  }
36060
- getHistory(types) {
36061
- if (!types || types.length === 0) {
36136
+ getHistory(types2) {
36137
+ if (!types2 || types2.length === 0) {
36062
36138
  return [...this.eventHistory];
36063
36139
  }
36064
- return this.eventHistory.filter((e) => types.includes(e.type));
36140
+ return this.eventHistory.filter((e) => types2.includes(e.type));
36065
36141
  }
36066
36142
  clearHistory() {
36067
36143
  this.eventHistory = [];
@@ -36097,18 +36173,18 @@ async function atomicWriteFile(targetPath, content) {
36097
36173
  const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
36098
36174
  try {
36099
36175
  await bunWrite(tempPath, content);
36100
- _internals9.renameSync(tempPath, targetPath);
36176
+ _internals11.renameSync(tempPath, targetPath);
36101
36177
  } finally {
36102
36178
  try {
36103
- _internals9.unlinkSync(tempPath);
36179
+ _internals11.unlinkSync(tempPath);
36104
36180
  } catch {}
36105
36181
  }
36106
36182
  }
36107
- var _internals9;
36183
+ var _internals11;
36108
36184
  var init_task_file = __esm(() => {
36109
36185
  init_bun_compat();
36110
36186
  init_lock();
36111
- _internals9 = {
36187
+ _internals11 = {
36112
36188
  renameSync: renameSync5,
36113
36189
  unlinkSync: unlinkSync4
36114
36190
  };
@@ -36117,7 +36193,7 @@ var init_task_file = __esm(() => {
36117
36193
  // src/hooks/knowledge-store.ts
36118
36194
  import { existsSync as existsSync8 } from "fs";
36119
36195
  import { appendFile as appendFile2, mkdir as mkdir2, readFile as readFile3 } from "fs/promises";
36120
- import * as os3 from "os";
36196
+ import * as os4 from "os";
36121
36197
  import * as path12 from "path";
36122
36198
  function resolveSwarmKnowledgePath(directory) {
36123
36199
  return path12.join(directory, ".swarm", "knowledge.jsonl");
@@ -36130,7 +36206,7 @@ function resolveSwarmRetractionsPath(directory) {
36130
36206
  }
36131
36207
  function resolveHiveKnowledgePath() {
36132
36208
  const platform = process.platform;
36133
- const home = process.env.HOME || os3.homedir();
36209
+ const home = process.env.HOME || os4.homedir();
36134
36210
  let dataDir;
36135
36211
  if (platform === "win32") {
36136
36212
  dataDir = path12.join(process.env.LOCALAPPDATA || path12.join(home, "AppData", "Local"), "opencode-swarm", "Data");
@@ -36777,7 +36853,7 @@ var init_knowledge_validator = __esm(() => {
36777
36853
  /\bmkfs\b/,
36778
36854
  /\bdd\s+if=/,
36779
36855
  /:\(\)\s*\{/,
36780
- /\bchmod\s+-R\s+777\b/,
36856
+ /\bchmod\s+-R\s+777\b/i,
36781
36857
  /\bdeltree\b/,
36782
36858
  /\brmdir\s+\/s\b/,
36783
36859
  /\bkill\s+-9\b/,
@@ -37304,10 +37380,10 @@ function resolveLogPath(directory) {
37304
37380
  }
37305
37381
  function readSkillUsageEntries(directory, options) {
37306
37382
  const resolved = resolveLogPath(directory);
37307
- if (!_internals10.existsSync(resolved)) {
37383
+ if (!_internals12.existsSync(resolved)) {
37308
37384
  return [];
37309
37385
  }
37310
- const raw = _internals10.readFileSync(resolved, "utf-8");
37386
+ const raw = _internals12.readFileSync(resolved, "utf-8");
37311
37387
  const entries = [];
37312
37388
  for (const line of raw.split(`
37313
37389
  `)) {
@@ -37344,7 +37420,7 @@ function readSkillUsageEntries(directory, options) {
37344
37420
  }
37345
37421
  function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
37346
37422
  const resolved = resolveLogPath(directory);
37347
- if (!_internals10.existsSync(resolved)) {
37423
+ if (!_internals12.existsSync(resolved)) {
37348
37424
  return { pruned: 0, remaining: 0 };
37349
37425
  }
37350
37426
  const allEntries = readSkillUsageEntries(directory);
@@ -37380,13 +37456,13 @@ function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
37380
37456
  `).concat(`
37381
37457
  `);
37382
37458
  try {
37383
- _internals10.writeFileSync(tmpPath, content, "utf-8");
37384
- _internals10.renameSync(tmpPath, resolved);
37459
+ _internals12.writeFileSync(tmpPath, content, "utf-8");
37460
+ _internals12.renameSync(tmpPath, resolved);
37385
37461
  } catch (writeErr) {
37386
37462
  const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
37387
37463
  try {
37388
- if (_internals10.existsSync(tmpPath)) {
37389
- _internals10.writeFileSync(tmpPath, "", "utf-8");
37464
+ if (_internals12.existsSync(tmpPath)) {
37465
+ _internals12.writeFileSync(tmpPath, "", "utf-8");
37390
37466
  }
37391
37467
  } catch {}
37392
37468
  return { pruned: 0, remaining: allEntries.length, error: msg };
@@ -37408,10 +37484,10 @@ async function resolveSourceKnowledgeIds(directory, skillPath) {
37408
37484
  if (!isContained) {
37409
37485
  return [];
37410
37486
  }
37411
- if (!_internals10.existsSync(absolute)) {
37487
+ if (!_internals12.existsSync(absolute)) {
37412
37488
  return [];
37413
37489
  }
37414
- const content = _internals10.readFileSync(absolute, "utf-8");
37490
+ const content = _internals12.readFileSync(absolute, "utf-8");
37415
37491
  return parseGeneratedFromKnowledge(content);
37416
37492
  } catch (err) {
37417
37493
  console.warn("[skill-usage-log] resolveSourceKnowledgeIds failed (fail-open):", err instanceof Error ? err.message : String(err));
@@ -37504,11 +37580,11 @@ async function applySkillUsageFeedback(directory, options) {
37504
37580
  }
37505
37581
  return { processed, bumps };
37506
37582
  }
37507
- var _internals10, TAIL_BYTES_DEFAULT, SKILL_USAGE_LOG_ROTATE_BYTES, COMPLIANCE_BOOST = 0.05, VIOLATION_DECAY = 0.1;
37583
+ var _internals12, TAIL_BYTES_DEFAULT, SKILL_USAGE_LOG_ROTATE_BYTES, COMPLIANCE_BOOST = 0.05, VIOLATION_DECAY = 0.1;
37508
37584
  var init_skill_usage_log = __esm(() => {
37509
37585
  init_knowledge_store();
37510
37586
  init_utils2();
37511
- _internals10 = {
37587
+ _internals12 = {
37512
37588
  generateId: () => crypto3.randomUUID(),
37513
37589
  appendFileSync: fs8.appendFileSync.bind(fs8),
37514
37590
  readFileSync: fs8.readFileSync.bind(fs8),
@@ -38205,7 +38281,7 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
38205
38281
  }
38206
38282
  await enforceKnowledgeCap(knowledgePath, config3.swarm_max_entries);
38207
38283
  if (!options?.skipAutoPromotion) {
38208
- await _internals11.runAutoPromotion(directory, config3);
38284
+ await _internals13.runAutoPromotion(directory, config3);
38209
38285
  }
38210
38286
  return { stored, skipped, rejected };
38211
38287
  }
@@ -38291,7 +38367,7 @@ function createKnowledgeCuratorHook(directory, config3) {
38291
38367
  });
38292
38368
  const projectName2 = evidenceData.project_name ?? "unknown";
38293
38369
  const phaseNumber2 = typeof evidenceData.phase_number === "number" ? evidenceData.phase_number : 1;
38294
- await _internals11.curateAndStoreSwarm(lessons, projectName2, { phase_number: phaseNumber2 }, directory, config3);
38370
+ await _internals13.curateAndStoreSwarm(lessons, projectName2, { phase_number: phaseNumber2 }, directory, config3);
38295
38371
  return;
38296
38372
  }
38297
38373
  const planContent = await readSwarmFileAsync(directory, "plan.md");
@@ -38313,18 +38389,18 @@ function createKnowledgeCuratorHook(directory, config3) {
38313
38389
  const projectName = projectNameMatch ? projectNameMatch[1].trim() : "unknown";
38314
38390
  const phaseMatch = /^Phase:\s*(\d+)/m.exec(planContent);
38315
38391
  const phaseNumber = phaseMatch ? parseInt(phaseMatch[1], 10) : 1;
38316
- await _internals11.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config3);
38392
+ await _internals13.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config3);
38317
38393
  };
38318
38394
  return safeHook(handler);
38319
38395
  }
38320
- var seenRetroSections, OUTCOME_PROMOTION_BLOCK = -0.3, _internals11;
38396
+ var seenRetroSections, OUTCOME_PROMOTION_BLOCK = -0.3, _internals13;
38321
38397
  var init_knowledge_curator = __esm(() => {
38322
38398
  init_knowledge_events();
38323
38399
  init_knowledge_store();
38324
38400
  init_knowledge_validator();
38325
38401
  init_utils2();
38326
38402
  seenRetroSections = new Map;
38327
- _internals11 = {
38403
+ _internals13 = {
38328
38404
  isWriteToEvidenceFile,
38329
38405
  curateAndStoreSwarm,
38330
38406
  runAutoPromotion,
@@ -39258,7 +39334,7 @@ async function executeWriteRetro(args, directory) {
39258
39334
  }, null, 2);
39259
39335
  }
39260
39336
  }
39261
- var write_retro, _internals12;
39337
+ var write_retro, _internals14;
39262
39338
  var init_write_retro = __esm(() => {
39263
39339
  init_zod();
39264
39340
  init_evidence_schema();
@@ -39305,13 +39381,13 @@ var init_write_retro = __esm(() => {
39305
39381
  task_id: args.task_id !== undefined ? String(args.task_id) : undefined,
39306
39382
  metadata: args.metadata
39307
39383
  };
39308
- return await _internals12.executeWriteRetro(writeRetroArgs, directory);
39384
+ return await _internals14.executeWriteRetro(writeRetroArgs, directory);
39309
39385
  } catch {
39310
39386
  return JSON.stringify({ success: false, phase: rawPhase, message: "Invalid arguments" }, null, 2);
39311
39387
  }
39312
39388
  }
39313
39389
  });
39314
- _internals12 = {
39390
+ _internals14 = {
39315
39391
  executeWriteRetro,
39316
39392
  write_retro
39317
39393
  };
@@ -40201,10 +40277,10 @@ var init_concurrency = __esm(() => {
40201
40277
  });
40202
40278
 
40203
40279
  // src/commands/config.ts
40204
- import * as os4 from "os";
40280
+ import * as os5 from "os";
40205
40281
  import * as path21 from "path";
40206
40282
  function getUserConfigDir2() {
40207
- return process.env.XDG_CONFIG_HOME || path21.join(os4.homedir(), ".config");
40283
+ return process.env.XDG_CONFIG_HOME || path21.join(os5.homedir(), ".config");
40208
40284
  }
40209
40285
  async function handleConfigCommand(directory, _args) {
40210
40286
  const config3 = loadPluginConfig(directory);
@@ -40557,9 +40633,9 @@ async function detectDarkMatter(directory, options) {
40557
40633
  } catch {
40558
40634
  return [];
40559
40635
  }
40560
- const commitMap = await _internals13.parseGitLog(directory, maxCommitsToAnalyze);
40561
- const matrix = _internals13.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
40562
- const staticEdges = await _internals13.getStaticEdges(directory);
40636
+ const commitMap = await _internals15.parseGitLog(directory, maxCommitsToAnalyze);
40637
+ const matrix = _internals15.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
40638
+ const staticEdges = await _internals15.getStaticEdges(directory);
40563
40639
  const results = [];
40564
40640
  for (const entry of matrix.values()) {
40565
40641
  const key = `${entry.fileA}::${entry.fileB}`;
@@ -40639,7 +40715,7 @@ ${rows}
40639
40715
  These pairs likely share an architectural concern invisible to static analysis.
40640
40716
  Consider adding explicit documentation or extracting the shared concern.`;
40641
40717
  }
40642
- var co_change_analyzer, _internals13;
40718
+ var co_change_analyzer, _internals15;
40643
40719
  var init_co_change_analyzer = __esm(() => {
40644
40720
  init_zod();
40645
40721
  init_create_tool();
@@ -40671,11 +40747,11 @@ var init_co_change_analyzer = __esm(() => {
40671
40747
  npmiThreshold,
40672
40748
  maxCommitsToAnalyze
40673
40749
  };
40674
- const pairs = await _internals13.detectDarkMatter(directory, options);
40675
- return _internals13.formatDarkMatterOutput(pairs);
40750
+ const pairs = await _internals15.detectDarkMatter(directory, options);
40751
+ return _internals15.formatDarkMatterOutput(pairs);
40676
40752
  }
40677
40753
  });
40678
- _internals13 = {
40754
+ _internals15 = {
40679
40755
  parseGitLog,
40680
40756
  buildCoChangeMatrix,
40681
40757
  getStaticEdges,
@@ -40706,7 +40782,7 @@ async function handleDarkMatterCommand(directory, args) {
40706
40782
  }
40707
40783
  let pairs;
40708
40784
  try {
40709
- pairs = await _internals13.detectDarkMatter(directory, options);
40785
+ pairs = await _internals15.detectDarkMatter(directory, options);
40710
40786
  } catch (err) {
40711
40787
  const errMsg = err instanceof Error ? err.message : String(err);
40712
40788
  return `## Dark Matter Analysis Failed
@@ -40970,13 +41046,13 @@ var init_design_docs = __esm(() => {
40970
41046
  });
40971
41047
 
40972
41048
  // src/config/cache-paths.ts
40973
- import * as os5 from "os";
41049
+ import * as os6 from "os";
40974
41050
  import * as path24 from "path";
40975
41051
  function getPluginConfigDir() {
40976
- return path24.join(process.env.XDG_CONFIG_HOME || path24.join(os5.homedir(), ".config"), "opencode");
41052
+ return path24.join(process.env.XDG_CONFIG_HOME || path24.join(os6.homedir(), ".config"), "opencode");
40977
41053
  }
40978
41054
  function getPluginCachePaths() {
40979
- const cacheBase = process.env.XDG_CACHE_HOME || path24.join(os5.homedir(), ".cache");
41055
+ const cacheBase = process.env.XDG_CACHE_HOME || path24.join(os6.homedir(), ".cache");
40980
41056
  const configDir = getPluginConfigDir();
40981
41057
  const paths = [
40982
41058
  path24.join(cacheBase, "opencode", "node_modules", "opencode-swarm"),
@@ -40984,18 +41060,18 @@ function getPluginCachePaths() {
40984
41060
  path24.join(configDir, "node_modules", "opencode-swarm")
40985
41061
  ];
40986
41062
  if (process.platform === "darwin") {
40987
- const libCaches = path24.join(os5.homedir(), "Library", "Caches");
41063
+ const libCaches = path24.join(os6.homedir(), "Library", "Caches");
40988
41064
  paths.push(path24.join(libCaches, "opencode", "node_modules", "opencode-swarm"), path24.join(libCaches, "opencode", "packages", "opencode-swarm@latest"));
40989
41065
  }
40990
41066
  if (process.platform === "win32") {
40991
- const localAppData = process.env.LOCALAPPDATA || path24.join(os5.homedir(), "AppData", "Local");
40992
- const appData = process.env.APPDATA || path24.join(os5.homedir(), "AppData", "Roaming");
41067
+ const localAppData = process.env.LOCALAPPDATA || path24.join(os6.homedir(), "AppData", "Local");
41068
+ const appData = process.env.APPDATA || path24.join(os6.homedir(), "AppData", "Roaming");
40993
41069
  paths.push(path24.join(localAppData, "opencode", "node_modules", "opencode-swarm"), path24.join(localAppData, "opencode", "packages", "opencode-swarm@latest"), path24.join(appData, "opencode", "node_modules", "opencode-swarm"));
40994
41070
  }
40995
41071
  return paths;
40996
41072
  }
40997
41073
  function getPluginLockFilePaths() {
40998
- const cacheBase = process.env.XDG_CACHE_HOME || path24.join(os5.homedir(), ".cache");
41074
+ const cacheBase = process.env.XDG_CACHE_HOME || path24.join(os6.homedir(), ".cache");
40999
41075
  const configDir = getPluginConfigDir();
41000
41076
  const paths = [
41001
41077
  path24.join(cacheBase, "opencode", "bun.lock"),
@@ -41003,11 +41079,11 @@ function getPluginLockFilePaths() {
41003
41079
  path24.join(configDir, "package-lock.json")
41004
41080
  ];
41005
41081
  if (process.platform === "darwin") {
41006
- const libCaches = path24.join(os5.homedir(), "Library", "Caches");
41082
+ const libCaches = path24.join(os6.homedir(), "Library", "Caches");
41007
41083
  paths.push(path24.join(libCaches, "opencode", "bun.lock"), path24.join(libCaches, "opencode", "bun.lockb"));
41008
41084
  }
41009
41085
  if (process.platform === "win32") {
41010
- const localAppData = process.env.LOCALAPPDATA || path24.join(os5.homedir(), "AppData", "Local");
41086
+ const localAppData = process.env.LOCALAPPDATA || path24.join(os6.homedir(), "AppData", "Local");
41011
41087
  paths.push(path24.join(localAppData, "opencode", "bun.lock"), path24.join(localAppData, "opencode", "bun.lockb"));
41012
41088
  }
41013
41089
  return paths;
@@ -42227,10 +42303,10 @@ __export(exports_config_doctor, {
42227
42303
  });
42228
42304
  import * as crypto4 from "crypto";
42229
42305
  import * as fs10 from "fs";
42230
- import * as os6 from "os";
42306
+ import * as os7 from "os";
42231
42307
  import * as path26 from "path";
42232
42308
  function getUserConfigDir3() {
42233
- return process.env.XDG_CONFIG_HOME || path26.join(os6.homedir(), ".config");
42309
+ return process.env.XDG_CONFIG_HOME || path26.join(os7.homedir(), ".config");
42234
42310
  }
42235
42311
  function getConfigPaths(directory) {
42236
42312
  const userConfigPath = path26.join(getUserConfigDir3(), "opencode", "opencode-swarm.json");
@@ -44068,7 +44144,7 @@ function isCommandAvailable(command) {
44068
44144
  const isWindows = process.platform === "win32";
44069
44145
  const cmd = isWindows ? `${command}.exe` : command;
44070
44146
  try {
44071
- const result = _internals14.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
44147
+ const result = _internals16.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
44072
44148
  cwd: process.cwd(),
44073
44149
  stdin: "ignore",
44074
44150
  stdout: "ignore",
@@ -44218,7 +44294,7 @@ async function discoverBuildCommands(workingDir, options) {
44218
44294
  const scope = options?.scope ?? "all";
44219
44295
  const changedFiles = options?.changedFiles ?? [];
44220
44296
  const _filesToCheck = filterByScope(workingDir, scope, changedFiles);
44221
- const profileResult = await _internals14.discoverBuildCommandsFromProfiles(workingDir);
44297
+ const profileResult = await _internals16.discoverBuildCommandsFromProfiles(workingDir);
44222
44298
  const profileCommands = profileResult.commands;
44223
44299
  const profileSkipped = profileResult.skipped;
44224
44300
  const coveredEcosystems = new Set;
@@ -44281,7 +44357,7 @@ function clearToolchainCache() {
44281
44357
  function getEcosystems() {
44282
44358
  return ECOSYSTEMS.map((e) => e.ecosystem);
44283
44359
  }
44284
- var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals14, build_discovery;
44360
+ var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals16, build_discovery;
44285
44361
  var init_discovery = __esm(() => {
44286
44362
  init_dist();
44287
44363
  init_detector();
@@ -44399,7 +44475,7 @@ var init_discovery = __esm(() => {
44399
44475
  php: ["php-composer"]
44400
44476
  };
44401
44477
  toolchainCache = new Map;
44402
- _internals14 = {
44478
+ _internals16 = {
44403
44479
  isCommandAvailable,
44404
44480
  discoverBuildCommandsFromProfiles,
44405
44481
  discoverBuildCommands,
@@ -44671,7 +44747,7 @@ var exports_evidence_summary_service = {};
44671
44747
  __export(exports_evidence_summary_service, {
44672
44748
  isAutoSummaryEnabled: () => isAutoSummaryEnabled,
44673
44749
  buildEvidenceSummary: () => buildEvidenceSummary,
44674
- _internals: () => _internals15,
44750
+ _internals: () => _internals17,
44675
44751
  REQUIRED_EVIDENCE_TYPES: () => REQUIRED_EVIDENCE_TYPES,
44676
44752
  EVIDENCE_SUMMARY_VERSION: () => EVIDENCE_SUMMARY_VERSION
44677
44753
  });
@@ -44709,7 +44785,7 @@ function getTaskStatus(task, bundle) {
44709
44785
  if (task?.status) {
44710
44786
  return task.status;
44711
44787
  }
44712
- const entries = _internals15.normalizeBundleEntries(bundle);
44788
+ const entries = _internals17.normalizeBundleEntries(bundle);
44713
44789
  if (entries.length > 0) {
44714
44790
  return "completed";
44715
44791
  }
@@ -44735,7 +44811,7 @@ function evidenceCompleteFromEntries(entries) {
44735
44811
  };
44736
44812
  }
44737
44813
  function isEvidenceComplete(bundle) {
44738
- return evidenceCompleteFromEntries(_internals15.normalizeBundleEntries(bundle));
44814
+ return evidenceCompleteFromEntries(_internals17.normalizeBundleEntries(bundle));
44739
44815
  }
44740
44816
  function getTaskBlockers(task, summary, status) {
44741
44817
  const blockers = [];
@@ -44755,9 +44831,9 @@ async function buildTaskSummary(directory, task, taskId) {
44755
44831
  const bundle = result.status === "found" ? result.bundle : null;
44756
44832
  const gateEvidence = await readDurableGateEvidence(directory, taskId);
44757
44833
  const phase = task?.phase ?? 0;
44758
- const status = _internals15.getTaskStatus(task, bundle);
44759
- const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals15.normalizeBundleEntries(bundle), gateEvidence);
44760
- let evidenceCheck = _internals15.evidenceCompleteFromEntries(entries);
44834
+ const status = _internals17.getTaskStatus(task, bundle);
44835
+ const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals17.normalizeBundleEntries(bundle), gateEvidence);
44836
+ let evidenceCheck = _internals17.evidenceCompleteFromEntries(entries);
44761
44837
  if (gateEvidence) {
44762
44838
  const gateStatus = getDurableGateEvidenceStatus(gateEvidence);
44763
44839
  evidenceCheck = gateStatus.isComplete ? { isComplete: true, missingEvidence: [] } : {
@@ -44765,7 +44841,7 @@ async function buildTaskSummary(directory, task, taskId) {
44765
44841
  missingEvidence: gateStatus.missingGates.map((gate) => `gate:${gate}`)
44766
44842
  };
44767
44843
  }
44768
- const blockers = _internals15.getTaskBlockers(task, evidenceCheck, status);
44844
+ const blockers = _internals17.getTaskBlockers(task, evidenceCheck, status);
44769
44845
  const hasReview = entries.some((e) => e.type === "review");
44770
44846
  const hasTest = entries.some((e) => e.type === "test");
44771
44847
  const hasApproval = entries.some((e) => e.type === "approval");
@@ -44794,12 +44870,12 @@ async function buildPhaseSummary(directory, phase) {
44794
44870
  const taskSummaries = [];
44795
44871
  const _taskMap = new Map(phase.tasks.map((t) => [t.id, t]));
44796
44872
  for (const task of phase.tasks) {
44797
- const summary = await _internals15.buildTaskSummary(directory, task, task.id);
44873
+ const summary = await _internals17.buildTaskSummary(directory, task, task.id);
44798
44874
  taskSummaries.push(summary);
44799
44875
  }
44800
44876
  const extraTaskIds = taskIds.filter((id) => !phaseTaskIds.has(id));
44801
44877
  for (const taskId of extraTaskIds) {
44802
- const summary = await _internals15.buildTaskSummary(directory, undefined, taskId);
44878
+ const summary = await _internals17.buildTaskSummary(directory, undefined, taskId);
44803
44879
  if (summary.phase === phase.id) {
44804
44880
  taskSummaries.push(summary);
44805
44881
  }
@@ -44900,7 +44976,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
44900
44976
  let totalTasks = 0;
44901
44977
  let completedTasks = 0;
44902
44978
  for (const phase of phasesToProcess) {
44903
- const summary = await _internals15.buildPhaseSummary(directory, phase);
44979
+ const summary = await _internals17.buildPhaseSummary(directory, phase);
44904
44980
  phaseSummaries.push(summary);
44905
44981
  totalTasks += summary.totalTasks;
44906
44982
  completedTasks += summary.completedTasks;
@@ -44922,7 +44998,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
44922
44998
  overallBlockers,
44923
44999
  summaryText: ""
44924
45000
  };
44925
- artifact.summaryText = _internals15.generateSummaryText(artifact);
45001
+ artifact.summaryText = _internals17.generateSummaryText(artifact);
44926
45002
  log("[EvidenceSummary] Summary built", {
44927
45003
  phases: phaseSummaries.length,
44928
45004
  totalTasks,
@@ -44941,7 +45017,7 @@ function isAutoSummaryEnabled(automationConfig) {
44941
45017
  }
44942
45018
  return automationConfig.capabilities?.evidence_auto_summaries === true;
44943
45019
  }
44944
- var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals15;
45020
+ var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals17;
44945
45021
  var init_evidence_summary_service = __esm(() => {
44946
45022
  init_gate_bridge();
44947
45023
  init_manager2();
@@ -44956,7 +45032,7 @@ var init_evidence_summary_service = __esm(() => {
44956
45032
  "retrospective"
44957
45033
  ]);
44958
45034
  REQUIRED_EVIDENCE_TYPES = ["review", "test"];
44959
- _internals15 = {
45035
+ _internals17 = {
44960
45036
  buildEvidenceSummary,
44961
45037
  isAutoSummaryEnabled,
44962
45038
  normalizeBundleEntries,
@@ -45012,7 +45088,7 @@ function getVerdictEmoji(verdict) {
45012
45088
  return getVerdictIcon(verdict);
45013
45089
  }
45014
45090
  async function getTaskEvidenceData(directory, taskId) {
45015
- const result = await _internals16.loadEvidence(directory, taskId);
45091
+ const result = await _internals18.loadEvidence(directory, taskId);
45016
45092
  if (result.status !== "found") {
45017
45093
  return {
45018
45094
  hasEvidence: false,
@@ -45035,13 +45111,13 @@ async function getTaskEvidenceData(directory, taskId) {
45035
45111
  };
45036
45112
  }
45037
45113
  async function getEvidenceListData(directory) {
45038
- const taskIds = await _internals16.listEvidenceTaskIds(directory);
45114
+ const taskIds = await _internals18.listEvidenceTaskIds(directory);
45039
45115
  if (taskIds.length === 0) {
45040
45116
  return { hasEvidence: false, tasks: [] };
45041
45117
  }
45042
45118
  const tasks = [];
45043
45119
  for (const taskId of taskIds) {
45044
- const result = await _internals16.loadEvidence(directory, taskId);
45120
+ const result = await _internals18.loadEvidence(directory, taskId);
45045
45121
  if (result.status === "found") {
45046
45122
  tasks.push({
45047
45123
  taskId,
@@ -45155,10 +45231,10 @@ async function handleEvidenceSummaryCommand(directory) {
45155
45231
  return lines.join(`
45156
45232
  `);
45157
45233
  }
45158
- var _internals16;
45234
+ var _internals18;
45159
45235
  var init_evidence_service = __esm(() => {
45160
45236
  init_manager2();
45161
- _internals16 = {
45237
+ _internals18 = {
45162
45238
  loadEvidence,
45163
45239
  listEvidenceTaskIds
45164
45240
  };
@@ -45565,7 +45641,7 @@ function extractCurrentPhaseFromPlan2(plan) {
45565
45641
  if (!plan) {
45566
45642
  return { currentPhase: null, currentTask: null, incompleteTasks: [] };
45567
45643
  }
45568
- if (!_internals17.validatePlanPhases(plan)) {
45644
+ if (!_internals19.validatePlanPhases(plan)) {
45569
45645
  return { currentPhase: null, currentTask: null, incompleteTasks: [] };
45570
45646
  }
45571
45647
  let currentPhase = null;
@@ -45707,9 +45783,9 @@ function extractPhaseMetrics(content) {
45707
45783
  async function getHandoffData(directory) {
45708
45784
  const now = new Date().toISOString();
45709
45785
  const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
45710
- const sessionState = _internals17.parseSessionState(sessionContent);
45786
+ const sessionState = _internals19.parseSessionState(sessionContent);
45711
45787
  const plan = await loadPlanJsonOnly(directory);
45712
- const planInfo = _internals17.extractCurrentPhaseFromPlan(plan);
45788
+ const planInfo = _internals19.extractCurrentPhaseFromPlan(plan);
45713
45789
  if (!plan) {
45714
45790
  const planMdContent = await readSwarmFileAsync(directory, "plan.md");
45715
45791
  if (planMdContent) {
@@ -45728,8 +45804,8 @@ async function getHandoffData(directory) {
45728
45804
  }
45729
45805
  }
45730
45806
  const contextContent = await readSwarmFileAsync(directory, "context.md");
45731
- const recentDecisions = _internals17.extractDecisions(contextContent);
45732
- const rawPhaseMetrics = _internals17.extractPhaseMetrics(contextContent);
45807
+ const recentDecisions = _internals19.extractDecisions(contextContent);
45808
+ const rawPhaseMetrics = _internals19.extractPhaseMetrics(contextContent);
45733
45809
  const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
45734
45810
  let delegationState = null;
45735
45811
  if (sessionState?.delegationState) {
@@ -45893,13 +45969,13 @@ ${lines.join(`
45893
45969
  `)}
45894
45970
  \`\`\``;
45895
45971
  }
45896
- var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals17;
45972
+ var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals19;
45897
45973
  var init_handoff_service = __esm(() => {
45898
45974
  init_utils2();
45899
45975
  init_manager();
45900
45976
  init_utils();
45901
45977
  RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
45902
- _internals17 = {
45978
+ _internals19 = {
45903
45979
  getHandoffData,
45904
45980
  formatHandoffMarkdown,
45905
45981
  formatContinuationPrompt,
@@ -46036,22 +46112,22 @@ async function writeSnapshot(directory, state) {
46036
46112
  }
46037
46113
  function createSnapshotWriterHook(directory) {
46038
46114
  return (_input, _output) => {
46039
- _writeInFlight = _writeInFlight.then(() => _internals18.writeSnapshot(directory, swarmState), () => _internals18.writeSnapshot(directory, swarmState));
46115
+ _writeInFlight = _writeInFlight.then(() => _internals20.writeSnapshot(directory, swarmState), () => _internals20.writeSnapshot(directory, swarmState));
46040
46116
  return _writeInFlight;
46041
46117
  };
46042
46118
  }
46043
46119
  async function flushPendingSnapshot(directory) {
46044
- _writeInFlight = _writeInFlight.then(() => _internals18.writeSnapshot(directory, swarmState), () => _internals18.writeSnapshot(directory, swarmState));
46120
+ _writeInFlight = _writeInFlight.then(() => _internals20.writeSnapshot(directory, swarmState), () => _internals20.writeSnapshot(directory, swarmState));
46045
46121
  await _writeInFlight;
46046
46122
  }
46047
- var _writeInFlight, _internals18;
46123
+ var _writeInFlight, _internals20;
46048
46124
  var init_snapshot_writer = __esm(() => {
46049
46125
  init_utils2();
46050
46126
  init_state();
46051
46127
  init_utils();
46052
46128
  init_bun_compat();
46053
46129
  _writeInFlight = Promise.resolve();
46054
- _internals18 = {
46130
+ _internals20 = {
46055
46131
  writeSnapshot,
46056
46132
  createSnapshotWriterHook,
46057
46133
  flushPendingSnapshot
@@ -46519,9 +46595,9 @@ async function migrateContextToKnowledge(directory, config3) {
46519
46595
  skippedReason: "empty-context"
46520
46596
  };
46521
46597
  }
46522
- const rawEntries = _internals19.parseContextMd(contextContent);
46598
+ const rawEntries = _internals21.parseContextMd(contextContent);
46523
46599
  if (rawEntries.length === 0) {
46524
- await _internals19.writeSentinel(sentinelPath, 0, 0);
46600
+ await _internals21.writeSentinel(sentinelPath, 0, 0);
46525
46601
  return {
46526
46602
  migrated: true,
46527
46603
  entriesMigrated: 0,
@@ -46532,10 +46608,10 @@ async function migrateContextToKnowledge(directory, config3) {
46532
46608
  const existing = await readKnowledge(knowledgePath);
46533
46609
  let migrated = 0;
46534
46610
  let dropped = 0;
46535
- const projectName = _internals19.inferProjectName(directory);
46611
+ const projectName = _internals21.inferProjectName(directory);
46536
46612
  for (const raw of rawEntries) {
46537
46613
  if (config3.validation_enabled !== false) {
46538
- const category = raw.categoryHint ?? _internals19.inferCategoryFromText(raw.text);
46614
+ const category = raw.categoryHint ?? _internals21.inferCategoryFromText(raw.text);
46539
46615
  const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
46540
46616
  category,
46541
46617
  scope: "global",
@@ -46555,8 +46631,8 @@ async function migrateContextToKnowledge(directory, config3) {
46555
46631
  const entry = {
46556
46632
  id: randomUUID3(),
46557
46633
  tier: "swarm",
46558
- lesson: _internals19.truncateLesson(raw.text),
46559
- category: raw.categoryHint ?? _internals19.inferCategoryFromText(raw.text),
46634
+ lesson: _internals21.truncateLesson(raw.text),
46635
+ category: raw.categoryHint ?? _internals21.inferCategoryFromText(raw.text),
46560
46636
  tags: [...inferredTags, `migration:${raw.sourceSection}`],
46561
46637
  scope: "global",
46562
46638
  confidence: 0.3,
@@ -46579,7 +46655,7 @@ async function migrateContextToKnowledge(directory, config3) {
46579
46655
  if (migrated > 0) {
46580
46656
  await rewriteKnowledge(knowledgePath, existing);
46581
46657
  }
46582
- await _internals19.writeSentinel(sentinelPath, migrated, dropped);
46658
+ await _internals21.writeSentinel(sentinelPath, migrated, dropped);
46583
46659
  log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
46584
46660
  return {
46585
46661
  migrated: true,
@@ -46589,7 +46665,7 @@ async function migrateContextToKnowledge(directory, config3) {
46589
46665
  };
46590
46666
  }
46591
46667
  function parseContextMd(content) {
46592
- const sections = _internals19.splitIntoSections(content);
46668
+ const sections = _internals21.splitIntoSections(content);
46593
46669
  const entries = [];
46594
46670
  const seen = new Set;
46595
46671
  const sectionPatterns = [
@@ -46605,7 +46681,7 @@ function parseContextMd(content) {
46605
46681
  const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
46606
46682
  if (!match)
46607
46683
  continue;
46608
- const bullets = _internals19.extractBullets(section.body);
46684
+ const bullets = _internals21.extractBullets(section.body);
46609
46685
  for (const bullet of bullets) {
46610
46686
  if (bullet.length < 15)
46611
46687
  continue;
@@ -46614,9 +46690,9 @@ function parseContextMd(content) {
46614
46690
  continue;
46615
46691
  seen.add(normalized);
46616
46692
  entries.push({
46617
- text: _internals19.truncateLesson(bullet),
46693
+ text: _internals21.truncateLesson(bullet),
46618
46694
  sourceSection: match.sourceSection,
46619
- categoryHint: _internals19.inferCategoryFromText(bullet)
46695
+ categoryHint: _internals21.inferCategoryFromText(bullet)
46620
46696
  });
46621
46697
  }
46622
46698
  }
@@ -46709,12 +46785,12 @@ async function writeSentinel(sentinelPath, migrated, dropped) {
46709
46785
  await mkdir8(path30.dirname(sentinelPath), { recursive: true });
46710
46786
  await writeFile7(sentinelPath, JSON.stringify(sentinel, null, 2), "utf-8");
46711
46787
  }
46712
- var _internals19;
46788
+ var _internals21;
46713
46789
  var init_knowledge_migrator = __esm(() => {
46714
46790
  init_logger();
46715
46791
  init_knowledge_store();
46716
46792
  init_knowledge_validator();
46717
- _internals19 = {
46793
+ _internals21 = {
46718
46794
  migrateContextToKnowledge,
46719
46795
  migrateKnowledgeToExternal,
46720
46796
  parseContextMd,
@@ -49337,7 +49413,7 @@ var init_gateway = __esm(() => {
49337
49413
 
49338
49414
  // src/memory/evaluation.ts
49339
49415
  import * as fs13 from "fs/promises";
49340
- import * as os7 from "os";
49416
+ import * as os8 from "os";
49341
49417
  import * as path34 from "path";
49342
49418
  async function evaluateMemoryRecallFixtures(options) {
49343
49419
  const fixtureDirectory = path34.resolve(options.fixtureDirectory);
@@ -49349,7 +49425,7 @@ async function evaluateMemoryRecallFixtures(options) {
49349
49425
  for (const fixture of fixtures) {
49350
49426
  const materialized = materializeFixture(fixture);
49351
49427
  for (const providerName of providers) {
49352
- const tempRoot = await fs13.realpath(await fs13.mkdtemp(path34.join(os7.tmpdir(), "swarm-memory-eval-")));
49428
+ const tempRoot = await fs13.realpath(await fs13.mkdtemp(path34.join(os8.tmpdir(), "swarm-memory-eval-")));
49353
49429
  const provider = createEvaluationProvider(providerName, tempRoot);
49354
49430
  try {
49355
49431
  await provider.initialize?.();
@@ -50181,9 +50257,9 @@ var init_memory2 = __esm(() => {
50181
50257
 
50182
50258
  // src/services/plan-service.ts
50183
50259
  async function getPlanData(directory, phaseArg) {
50184
- const plan = await _internals20.loadPlanJsonOnly(directory);
50260
+ const plan = await _internals22.loadPlanJsonOnly(directory);
50185
50261
  if (plan) {
50186
- const fullMarkdown = _internals20.derivePlanMarkdown(plan);
50262
+ const fullMarkdown = _internals22.derivePlanMarkdown(plan);
50187
50263
  if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
50188
50264
  return {
50189
50265
  hasPlan: true,
@@ -50226,7 +50302,7 @@ async function getPlanData(directory, phaseArg) {
50226
50302
  isLegacy: false
50227
50303
  };
50228
50304
  }
50229
- const planContent = await _internals20.readSwarmFileAsync(directory, "plan.md");
50305
+ const planContent = await _internals22.readSwarmFileAsync(directory, "plan.md");
50230
50306
  if (!planContent) {
50231
50307
  return {
50232
50308
  hasPlan: false,
@@ -50322,11 +50398,11 @@ async function handlePlanCommand(directory, args) {
50322
50398
  const planData = await getPlanData(directory, phaseArg);
50323
50399
  return formatPlanMarkdown(planData);
50324
50400
  }
50325
- var _internals20;
50401
+ var _internals22;
50326
50402
  var init_plan_service = __esm(() => {
50327
50403
  init_utils2();
50328
50404
  init_manager();
50329
- _internals20 = {
50405
+ _internals22 = {
50330
50406
  loadPlanJsonOnly,
50331
50407
  derivePlanMarkdown,
50332
50408
  readSwarmFileAsync
@@ -50462,7 +50538,7 @@ function parsePrRef(input, cwd) {
50462
50538
  }
50463
50539
  function detectGitRemote2(cwd) {
50464
50540
  try {
50465
- const remoteUrl = _internals21.execSync("git remote get-url origin", {
50541
+ const remoteUrl = _internals23.execSync("git remote get-url origin", {
50466
50542
  encoding: "utf-8",
50467
50543
  stdio: ["pipe", "pipe", "pipe"],
50468
50544
  timeout: 5000,
@@ -50518,9 +50594,9 @@ function resolvePrCommandInput(rest, cwd) {
50518
50594
  }
50519
50595
  return { prUrl: result.sanitized, instructions };
50520
50596
  }
50521
- var _internals21, MAX_URL_LEN2 = 2048, MAX_INSTRUCTIONS_LEN = 1000;
50597
+ var _internals23, MAX_URL_LEN2 = 2048, MAX_INSTRUCTIONS_LEN = 1000;
50522
50598
  var init_pr_ref = __esm(() => {
50523
- _internals21 = { execSync: execSync3 };
50599
+ _internals23 = { execSync: execSync3 };
50524
50600
  });
50525
50601
 
50526
50602
  // src/commands/pr-feedback.ts
@@ -50995,7 +51071,7 @@ async function runAdditionalLint(linter, mode, cwd) {
50995
51071
  };
50996
51072
  }
50997
51073
  }
50998
- var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals22;
51074
+ var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals24;
50999
51075
  var init_lint = __esm(() => {
51000
51076
  init_zod();
51001
51077
  init_discovery();
@@ -51027,15 +51103,15 @@ var init_lint = __esm(() => {
51027
51103
  }
51028
51104
  const { mode } = args;
51029
51105
  const cwd = directory;
51030
- const linter = await _internals22.detectAvailableLinter(directory);
51106
+ const linter = await _internals24.detectAvailableLinter(directory);
51031
51107
  if (linter) {
51032
- const result = await _internals22.runLint(linter, mode, directory);
51108
+ const result = await _internals24.runLint(linter, mode, directory);
51033
51109
  return JSON.stringify(result, null, 2);
51034
51110
  }
51035
- const additionalLinter = _internals22.detectAdditionalLinter(cwd);
51111
+ const additionalLinter = _internals24.detectAdditionalLinter(cwd);
51036
51112
  if (additionalLinter) {
51037
51113
  warn(`[lint] Using ${additionalLinter} linter for this project`);
51038
- const result = await _internals22.runAdditionalLint(additionalLinter, mode, cwd);
51114
+ const result = await _internals24.runAdditionalLint(additionalLinter, mode, cwd);
51039
51115
  return JSON.stringify(result, null, 2);
51040
51116
  }
51041
51117
  const errorResult = {
@@ -51049,7 +51125,7 @@ For Rust: rustup component add clippy`
51049
51125
  return JSON.stringify(errorResult, null, 2);
51050
51126
  }
51051
51127
  });
51052
- _internals22 = {
51128
+ _internals24 = {
51053
51129
  detectAvailableLinter,
51054
51130
  runLint,
51055
51131
  detectAdditionalLinter,
@@ -51363,7 +51439,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
51363
51439
  }
51364
51440
  async function runSecretscan(directory) {
51365
51441
  try {
51366
- const result = await _internals23.secretscan.execute({ directory }, {});
51442
+ const result = await _internals25.secretscan.execute({ directory }, {});
51367
51443
  const jsonStr = typeof result === "string" ? result : result.output;
51368
51444
  return JSON.parse(jsonStr);
51369
51445
  } catch (e) {
@@ -51378,7 +51454,7 @@ async function runSecretscan(directory) {
51378
51454
  return errorResult;
51379
51455
  }
51380
51456
  }
51381
- 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, _internals23;
51457
+ 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, _internals25;
51382
51458
  var init_secretscan = __esm(() => {
51383
51459
  init_zod();
51384
51460
  init_path_security();
@@ -51750,7 +51826,7 @@ var init_secretscan = __esm(() => {
51750
51826
  }
51751
51827
  }
51752
51828
  });
51753
- _internals23 = {
51829
+ _internals25 = {
51754
51830
  secretscan,
51755
51831
  runSecretscan
51756
51832
  };
@@ -52342,14 +52418,14 @@ function buildGoBackend() {
52342
52418
  selectEntryPoints
52343
52419
  };
52344
52420
  }
52345
- var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals24;
52421
+ var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals26;
52346
52422
  var init_go = __esm(() => {
52347
52423
  init_default_backend();
52348
52424
  init_profiles();
52349
52425
  IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
52350
52426
  IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
52351
52427
  IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
52352
- _internals24 = { extractImports };
52428
+ _internals26 = { extractImports };
52353
52429
  });
52354
52430
 
52355
52431
  // src/lang/backends/python.ts
@@ -52461,13 +52537,13 @@ function buildPythonBackend() {
52461
52537
  selectEntryPoints: selectEntryPoints2
52462
52538
  };
52463
52539
  }
52464
- var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals25;
52540
+ var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals27;
52465
52541
  var init_python = __esm(() => {
52466
52542
  init_default_backend();
52467
52543
  init_profiles();
52468
52544
  IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
52469
52545
  IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
52470
- _internals25 = { extractImports: extractImports2 };
52546
+ _internals27 = { extractImports: extractImports2 };
52471
52547
  });
52472
52548
 
52473
52549
  // src/test-impact/analyzer.ts
@@ -52691,7 +52767,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
52691
52767
  return;
52692
52768
  }
52693
52769
  if (PYTHON_EXTENSIONS.has(ext)) {
52694
- const modules = _internals25.extractImports(testFile, content);
52770
+ const modules = _internals27.extractImports(testFile, content);
52695
52771
  for (const mod of modules) {
52696
52772
  const resolved = resolvePythonImport(testDir, mod);
52697
52773
  if (resolved !== null)
@@ -52700,7 +52776,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
52700
52776
  return;
52701
52777
  }
52702
52778
  if (GO_EXTENSIONS.has(ext)) {
52703
- const imports = _internals24.extractImports(testFile, content);
52779
+ const imports = _internals26.extractImports(testFile, content);
52704
52780
  for (const importPath of imports) {
52705
52781
  const sourceFiles = resolveGoImport(testDir, importPath);
52706
52782
  for (const source of sourceFiles)
@@ -52727,8 +52803,8 @@ async function buildImpactMapInternal(cwd) {
52727
52803
  return impactMap;
52728
52804
  }
52729
52805
  async function buildImpactMap(cwd) {
52730
- const impactMap = await _internals26.buildImpactMapInternal(cwd);
52731
- await _internals26.saveImpactMap(cwd, impactMap);
52806
+ const impactMap = await _internals28.buildImpactMapInternal(cwd);
52807
+ await _internals28.saveImpactMap(cwd, impactMap);
52732
52808
  return impactMap;
52733
52809
  }
52734
52810
  async function loadImpactMap(cwd, options) {
@@ -52742,7 +52818,7 @@ async function loadImpactMap(cwd, options) {
52742
52818
  const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
52743
52819
  if (hasValidValues) {
52744
52820
  const generatedAt = new Date(data.generatedAt).getTime();
52745
- if (!_internals26.isCacheStale(map3, generatedAt)) {
52821
+ if (!_internals28.isCacheStale(map3, generatedAt)) {
52746
52822
  return map3;
52747
52823
  }
52748
52824
  if (options?.skipRebuild) {
@@ -52762,13 +52838,13 @@ async function loadImpactMap(cwd, options) {
52762
52838
  if (options?.skipRebuild) {
52763
52839
  return {};
52764
52840
  }
52765
- return _internals26.buildImpactMap(cwd);
52841
+ return _internals28.buildImpactMap(cwd);
52766
52842
  }
52767
52843
  async function saveImpactMap(cwd, impactMap) {
52768
52844
  if (!path41.isAbsolute(cwd)) {
52769
52845
  throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
52770
52846
  }
52771
- _internals26.validateProjectRoot(cwd);
52847
+ _internals28.validateProjectRoot(cwd);
52772
52848
  const cacheDir2 = path41.join(cwd, ".swarm", "cache");
52773
52849
  const cachePath = path41.join(cacheDir2, "impact-map.json");
52774
52850
  if (!fs19.existsSync(cacheDir2)) {
@@ -52792,7 +52868,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
52792
52868
  };
52793
52869
  }
52794
52870
  const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
52795
- const impactMap = await _internals26.loadImpactMap(cwd);
52871
+ const impactMap = await _internals28.loadImpactMap(cwd);
52796
52872
  const impactedTestsSet = new Set;
52797
52873
  const untestedFiles = [];
52798
52874
  let visitedCount = 0;
@@ -52877,7 +52953,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
52877
52953
  budgetExceeded
52878
52954
  };
52879
52955
  }
52880
- var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals26;
52956
+ var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals28;
52881
52957
  var init_analyzer = __esm(() => {
52882
52958
  init_manager2();
52883
52959
  init_go();
@@ -52890,7 +52966,7 @@ var init_analyzer = __esm(() => {
52890
52966
  GO_EXTENSIONS = new Set([".go"]);
52891
52967
  EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
52892
52968
  goModuleCache = new Map;
52893
- _internals26 = {
52969
+ _internals28 = {
52894
52970
  validateProjectRoot,
52895
52971
  normalizePath,
52896
52972
  isCacheStale,
@@ -53226,7 +53302,7 @@ function batchAppendTestRuns(records, workingDir) {
53226
53302
  }
53227
53303
  const historyPath = getHistoryPath(workingDir);
53228
53304
  const historyDir = path42.dirname(historyPath);
53229
- _internals27.validateProjectRoot(workingDir);
53305
+ _internals29.validateProjectRoot(workingDir);
53230
53306
  if (!fs20.existsSync(historyDir)) {
53231
53307
  fs20.mkdirSync(historyDir, { recursive: true });
53232
53308
  }
@@ -53349,7 +53425,7 @@ function getAllHistory(workingDir) {
53349
53425
  records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
53350
53426
  return records;
53351
53427
  }
53352
- 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, _internals27;
53428
+ 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, _internals29;
53353
53429
  var init_history_store = __esm(() => {
53354
53430
  init_manager2();
53355
53431
  DANGEROUS_PROPERTY_NAMES = new Set([
@@ -53357,7 +53433,7 @@ var init_history_store = __esm(() => {
53357
53433
  "constructor",
53358
53434
  "prototype"
53359
53435
  ]);
53360
- _internals27 = {
53436
+ _internals29 = {
53361
53437
  validateProjectRoot
53362
53438
  };
53363
53439
  });
@@ -53556,7 +53632,7 @@ function readPackageJsonRaw(dir) {
53556
53632
  }
53557
53633
  }
53558
53634
  function readPackageJson(dir) {
53559
- return _internals28.readPackageJsonRaw(dir);
53635
+ return _internals30.readPackageJsonRaw(dir);
53560
53636
  }
53561
53637
  function readPackageJsonTestScript(dir) {
53562
53638
  return readPackageJson(dir)?.scripts?.test ?? null;
@@ -53726,7 +53802,7 @@ function buildTypescriptBackend() {
53726
53802
  selectEntryPoints: selectEntryPoints3
53727
53803
  };
53728
53804
  }
53729
- var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals28;
53805
+ var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals30;
53730
53806
  var init_typescript = __esm(() => {
53731
53807
  init_default_backend();
53732
53808
  init_profiles();
@@ -53735,7 +53811,7 @@ var init_typescript = __esm(() => {
53735
53811
  IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
53736
53812
  IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
53737
53813
  IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
53738
- _internals28 = {
53814
+ _internals30 = {
53739
53815
  readPackageJsonRaw,
53740
53816
  readPackageJsonTestScript,
53741
53817
  frameworkFromScriptsTest
@@ -53768,7 +53844,7 @@ __export(exports_dispatch, {
53768
53844
  pickedProfiles: () => pickedProfiles,
53769
53845
  pickBackend: () => pickBackend,
53770
53846
  clearDispatchCache: () => clearDispatchCache,
53771
- _internals: () => _internals29
53847
+ _internals: () => _internals31
53772
53848
  });
53773
53849
  import * as fs24 from "fs";
53774
53850
  import * as path46 from "path";
@@ -53823,7 +53899,7 @@ function findManifestRoot(start) {
53823
53899
  return start;
53824
53900
  }
53825
53901
  function evictIfNeeded() {
53826
- if (cache.size <= _internals29.cacheCapacity)
53902
+ if (cache.size <= _internals31.cacheCapacity)
53827
53903
  return;
53828
53904
  let oldestKey;
53829
53905
  let oldestOrder = Infinity;
@@ -53854,7 +53930,7 @@ async function pickBackend(dir) {
53854
53930
  evictIfNeeded();
53855
53931
  return null;
53856
53932
  }
53857
- const profiles = await _internals29.detectProjectLanguages(root);
53933
+ const profiles = await _internals31.detectProjectLanguages(root);
53858
53934
  if (profiles.length === 0) {
53859
53935
  cache.set(cacheKey, {
53860
53936
  hash: hash3,
@@ -53886,12 +53962,12 @@ function clearDispatchCache() {
53886
53962
  manifestRootCache.clear();
53887
53963
  insertCounter = 0;
53888
53964
  }
53889
- var _internals29, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
53965
+ var _internals31, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
53890
53966
  var init_dispatch = __esm(() => {
53891
53967
  init_backends();
53892
53968
  init_detector();
53893
53969
  init_registry_backend();
53894
- _internals29 = {
53970
+ _internals31 = {
53895
53971
  detectProjectLanguages,
53896
53972
  cacheCapacity: 64
53897
53973
  };
@@ -55746,9 +55822,9 @@ function getVersionFileVersion(dir) {
55746
55822
  async function runVersionCheck(dir, _timeoutMs) {
55747
55823
  const startTime = Date.now();
55748
55824
  try {
55749
- const packageVersion = _internals30.getPackageVersion(dir);
55750
- const changelogVersion = _internals30.getChangelogVersion(dir);
55751
- const versionFileVersion = _internals30.getVersionFileVersion(dir);
55825
+ const packageVersion = _internals32.getPackageVersion(dir);
55826
+ const changelogVersion = _internals32.getChangelogVersion(dir);
55827
+ const versionFileVersion = _internals32.getVersionFileVersion(dir);
55752
55828
  const versions3 = [];
55753
55829
  if (packageVersion)
55754
55830
  versions3.push(`package.json: ${packageVersion}`);
@@ -56113,7 +56189,7 @@ async function runPreflight(dir, phase, config3) {
56113
56189
  const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
56114
56190
  let validatedDir;
56115
56191
  try {
56116
- validatedDir = _internals30.validateDirectoryPath(dir);
56192
+ validatedDir = _internals32.validateDirectoryPath(dir);
56117
56193
  } catch (error93) {
56118
56194
  return {
56119
56195
  id: reportId,
@@ -56133,7 +56209,7 @@ async function runPreflight(dir, phase, config3) {
56133
56209
  }
56134
56210
  let validatedTimeout;
56135
56211
  try {
56136
- validatedTimeout = _internals30.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
56212
+ validatedTimeout = _internals32.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
56137
56213
  } catch (error93) {
56138
56214
  return {
56139
56215
  id: reportId,
@@ -56174,12 +56250,12 @@ async function runPreflight(dir, phase, config3) {
56174
56250
  });
56175
56251
  const checks5 = [];
56176
56252
  log("[Preflight] Running lint check...");
56177
- const lintResult = await _internals30.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
56253
+ const lintResult = await _internals32.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
56178
56254
  checks5.push(lintResult);
56179
56255
  log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
56180
56256
  if (!cfg.skipTests) {
56181
56257
  log("[Preflight] Running tests check...");
56182
- const testsResult = await _internals30.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
56258
+ const testsResult = await _internals32.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
56183
56259
  checks5.push(testsResult);
56184
56260
  log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
56185
56261
  } else {
@@ -56191,7 +56267,7 @@ async function runPreflight(dir, phase, config3) {
56191
56267
  }
56192
56268
  if (!cfg.skipSecrets) {
56193
56269
  log("[Preflight] Running secrets check...");
56194
- const secretsResult = await _internals30.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
56270
+ const secretsResult = await _internals32.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
56195
56271
  checks5.push(secretsResult);
56196
56272
  log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
56197
56273
  } else {
@@ -56203,7 +56279,7 @@ async function runPreflight(dir, phase, config3) {
56203
56279
  }
56204
56280
  if (!cfg.skipEvidence) {
56205
56281
  log("[Preflight] Running evidence check...");
56206
- const evidenceResult = await _internals30.runEvidenceCheck(validatedDir);
56282
+ const evidenceResult = await _internals32.runEvidenceCheck(validatedDir);
56207
56283
  checks5.push(evidenceResult);
56208
56284
  log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
56209
56285
  } else {
@@ -56214,12 +56290,12 @@ async function runPreflight(dir, phase, config3) {
56214
56290
  });
56215
56291
  }
56216
56292
  log("[Preflight] Running requirement coverage check...");
56217
- const reqCoverageResult = await _internals30.runRequirementCoverageCheck(validatedDir, phase);
56293
+ const reqCoverageResult = await _internals32.runRequirementCoverageCheck(validatedDir, phase);
56218
56294
  checks5.push(reqCoverageResult);
56219
56295
  log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
56220
56296
  if (!cfg.skipVersion) {
56221
56297
  log("[Preflight] Running version check...");
56222
- const versionResult = await _internals30.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
56298
+ const versionResult = await _internals32.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
56223
56299
  checks5.push(versionResult);
56224
56300
  log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
56225
56301
  } else {
@@ -56282,10 +56358,10 @@ function formatPreflightMarkdown(report) {
56282
56358
  async function handlePreflightCommand(directory, _args) {
56283
56359
  const plan = await loadPlan(directory);
56284
56360
  const phase = plan?.current_phase ?? 1;
56285
- const report = await _internals30.runPreflight(directory, phase);
56286
- return _internals30.formatPreflightMarkdown(report);
56361
+ const report = await _internals32.runPreflight(directory, phase);
56362
+ return _internals32.formatPreflightMarkdown(report);
56287
56363
  }
56288
- var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals30;
56364
+ var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals32;
56289
56365
  var init_preflight_service = __esm(() => {
56290
56366
  init_gate_bridge();
56291
56367
  init_manager2();
@@ -56303,7 +56379,7 @@ var init_preflight_service = __esm(() => {
56303
56379
  testScope: "convention",
56304
56380
  linter: "biome"
56305
56381
  };
56306
- _internals30 = {
56382
+ _internals32 = {
56307
56383
  runPreflight,
56308
56384
  formatPreflightMarkdown,
56309
56385
  handlePreflightCommand,
@@ -57560,7 +57636,7 @@ async function handleSimulateCommand(directory, args) {
57560
57636
  }
57561
57637
  let darkMatterPairs;
57562
57638
  try {
57563
- darkMatterPairs = await _internals13.detectDarkMatter(directory, options);
57639
+ darkMatterPairs = await _internals15.detectDarkMatter(directory, options);
57564
57640
  } catch (err) {
57565
57641
  const errMsg = err instanceof Error ? err.message : String(err);
57566
57642
  return `## Simulate Report
@@ -57925,7 +58001,7 @@ async function getStatusData(directory, agents) {
57925
58001
  }
57926
58002
  function enrichWithLeanTurbo(status, directory) {
57927
58003
  const turboMode = hasActiveTurboMode();
57928
- const leanActive = _internals31.hasActiveLeanTurbo();
58004
+ const leanActive = _internals33.hasActiveLeanTurbo();
57929
58005
  let turboStrategy = "off";
57930
58006
  if (leanActive) {
57931
58007
  turboStrategy = "lean";
@@ -57944,7 +58020,7 @@ function enrichWithLeanTurbo(status, directory) {
57944
58020
  }
57945
58021
  }
57946
58022
  if (leanSessionID) {
57947
- const runState = _internals31.loadLeanTurboRunState(directory, leanSessionID);
58023
+ const runState = _internals33.loadLeanTurboRunState(directory, leanSessionID);
57948
58024
  if (runState) {
57949
58025
  status.leanTurboPhase = runState.phase;
57950
58026
  status.leanMaxParallelCoders = runState.maxParallelCoders;
@@ -57976,7 +58052,7 @@ function enrichWithLeanTurbo(status, directory) {
57976
58052
  }
57977
58053
  }
57978
58054
  }
57979
- status.fullAutoActive = _internals31.hasActiveFullAuto();
58055
+ status.fullAutoActive = _internals33.hasActiveFullAuto();
57980
58056
  return status;
57981
58057
  }
57982
58058
  function formatStatusMarkdown(status) {
@@ -58058,7 +58134,7 @@ async function handleStatusCommand(directory, agents) {
58058
58134
  }
58059
58135
  return formatStatusMarkdown(statusData);
58060
58136
  }
58061
- var _internals31;
58137
+ var _internals33;
58062
58138
  var init_status_service = __esm(() => {
58063
58139
  init_extractors();
58064
58140
  init_utils2();
@@ -58067,7 +58143,7 @@ var init_status_service = __esm(() => {
58067
58143
  init_state3();
58068
58144
  init_compaction_service();
58069
58145
  init_context_budget_service();
58070
- _internals31 = {
58146
+ _internals33 = {
58071
58147
  loadLeanTurboRunState,
58072
58148
  hasActiveLeanTurbo,
58073
58149
  hasActiveFullAuto
@@ -58158,7 +58234,7 @@ async function handleTurboCommand(directory, args, sessionID) {
58158
58234
  if (arg0 === "on") {
58159
58235
  let strategy = "standard";
58160
58236
  try {
58161
- const { config: config3 } = _internals32.loadPluginConfigWithMeta(directory);
58237
+ const { config: config3 } = _internals34.loadPluginConfigWithMeta(directory);
58162
58238
  if (config3.turbo?.strategy === "lean") {
58163
58239
  strategy = "lean";
58164
58240
  }
@@ -58213,7 +58289,7 @@ function enableLeanTurbo(session, directory, sessionID) {
58213
58289
  let maxParallelCoders = 4;
58214
58290
  let conflictPolicy = "serialize";
58215
58291
  try {
58216
- const { config: config3 } = _internals32.loadPluginConfigWithMeta(directory);
58292
+ const { config: config3 } = _internals34.loadPluginConfigWithMeta(directory);
58217
58293
  const leanConfig = config3.turbo?.lean;
58218
58294
  if (leanConfig) {
58219
58295
  maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
@@ -58283,13 +58359,13 @@ function buildStatusMessage2(session, directory, sessionID) {
58283
58359
  ].join(`
58284
58360
  `);
58285
58361
  }
58286
- var _internals32;
58362
+ var _internals34;
58287
58363
  var init_turbo = __esm(() => {
58288
58364
  init_config();
58289
58365
  init_state();
58290
58366
  init_state3();
58291
58367
  init_logger();
58292
- _internals32 = {
58368
+ _internals34 = {
58293
58369
  loadPluginConfigWithMeta
58294
58370
  };
58295
58371
  });
@@ -58382,7 +58458,7 @@ function formatCommandNotFound(tokens) {
58382
58458
  const attemptedCommand = tokens[0] || "";
58383
58459
  const MAX_DISPLAY = 100;
58384
58460
  const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
58385
- const similar = _internals33.findSimilarCommands(attemptedCommand);
58461
+ const similar = _internals35.findSimilarCommands(attemptedCommand);
58386
58462
  const header = `Command \`/swarm ${displayCommand}\` not found.`;
58387
58463
  const suggestions = similar.length > 0 ? `Did you mean:
58388
58464
  ${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
@@ -58889,7 +58965,7 @@ async function buildSwarmCommandPrompt(args) {
58889
58965
  packageRoot,
58890
58966
  registeredAgents
58891
58967
  } = args;
58892
- const resolved = _internals33.resolveCommand(tokens);
58968
+ const resolved = _internals35.resolveCommand(tokens);
58893
58969
  if (!resolved) {
58894
58970
  if (tokens.length === 0) {
58895
58971
  return buildHelpText();
@@ -59057,7 +59133,7 @@ function findSimilarCommands(query) {
59057
59133
  }
59058
59134
  const scored = VALID_COMMANDS.map((cmd) => {
59059
59135
  const cmdLower = cmd.toLowerCase();
59060
- const fullScore = _internals33.levenshteinDistance(q, cmdLower);
59136
+ const fullScore = _internals35.levenshteinDistance(q, cmdLower);
59061
59137
  let tokenScore = Infinity;
59062
59138
  if (cmd.includes(" ") || cmd.includes("-")) {
59063
59139
  const qTokens = q.split(/[\s-]+/);
@@ -59070,7 +59146,7 @@ function findSimilarCommands(query) {
59070
59146
  for (const ct of cmdTokens) {
59071
59147
  if (ct.length === 0)
59072
59148
  continue;
59073
- const dist = _internals33.levenshteinDistance(qt, ct);
59149
+ const dist = _internals35.levenshteinDistance(qt, ct);
59074
59150
  if (dist < minDist)
59075
59151
  minDist = dist;
59076
59152
  }
@@ -59080,7 +59156,7 @@ function findSimilarCommands(query) {
59080
59156
  }
59081
59157
  const dashStrippedQ = q.replace(/-/g, "");
59082
59158
  const dashStrippedCmd = cmdLower.replace(/-/g, "");
59083
- const dashScore = _internals33.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
59159
+ const dashScore = _internals35.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
59084
59160
  const score = Math.min(fullScore, tokenScore, dashScore);
59085
59161
  return { cmd, score };
59086
59162
  });
@@ -59112,11 +59188,11 @@ async function handleHelpCommand(ctx) {
59112
59188
  return buildHelpText2();
59113
59189
  }
59114
59190
  const tokens = targetCommand.split(/\s+/);
59115
- const resolved = _internals33.resolveCommand(tokens);
59191
+ const resolved = _internals35.resolveCommand(tokens);
59116
59192
  if (resolved) {
59117
- return _internals33.buildDetailedHelp(resolved.key, resolved.entry);
59193
+ return _internals35.buildDetailedHelp(resolved.key, resolved.entry);
59118
59194
  }
59119
- const similar = _internals33.findSimilarCommands(targetCommand);
59195
+ const similar = _internals35.findSimilarCommands(targetCommand);
59120
59196
  const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
59121
59197
  if (similar.length > 0) {
59122
59198
  return `Command '/swarm ${targetCommand}' not found.
@@ -59216,7 +59292,7 @@ function resolveCommand(tokens) {
59216
59292
  }
59217
59293
  return null;
59218
59294
  }
59219
- var COMMAND_REGISTRY, VALID_COMMANDS, _internals33, validation;
59295
+ var COMMAND_REGISTRY, VALID_COMMANDS, _internals35, validation;
59220
59296
  var init_registry = __esm(() => {
59221
59297
  init_bundled_skills();
59222
59298
  init_acknowledge_spec_drift();
@@ -59292,7 +59368,7 @@ var init_registry = __esm(() => {
59292
59368
  clashesWithNativeCcCommand: "/agents"
59293
59369
  },
59294
59370
  help: {
59295
- handler: (ctx) => _internals33.handleHelpCommand(ctx),
59371
+ handler: (ctx) => _internals35.handleHelpCommand(ctx),
59296
59372
  description: "Show help for swarm commands",
59297
59373
  category: "core",
59298
59374
  args: "[command]",
@@ -59784,7 +59860,7 @@ Subcommands:
59784
59860
  }
59785
59861
  };
59786
59862
  VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
59787
- _internals33 = {
59863
+ _internals35 = {
59788
59864
  handleHelpCommand,
59789
59865
  validateAliases,
59790
59866
  resolveCommand,
@@ -59792,7 +59868,7 @@ Subcommands:
59792
59868
  findSimilarCommands,
59793
59869
  buildDetailedHelp
59794
59870
  };
59795
- validation = _internals33.validateAliases();
59871
+ validation = _internals35.validateAliases();
59796
59872
  if (!validation.valid) {
59797
59873
  throw new Error(`COMMAND_REGISTRY alias validation failed:
59798
59874
  ${validation.errors.join(`
@@ -59811,7 +59887,7 @@ init_registry();
59811
59887
  init_cache_paths();
59812
59888
  init_constants();
59813
59889
  import * as fs32 from "fs";
59814
- import * as os8 from "os";
59890
+ import * as os9 from "os";
59815
59891
  import * as path56 from "path";
59816
59892
  var { version: version5 } = package_default;
59817
59893
  var CONFIG_DIR = getPluginConfigDir();
@@ -59822,7 +59898,7 @@ var OPENCODE_PLUGIN_CACHE_PATHS = getPluginCachePaths();
59822
59898
  var OPENCODE_PLUGIN_LOCK_FILE_PATHS = getPluginLockFilePaths();
59823
59899
  function isSafeCachePath(p) {
59824
59900
  const resolved = path56.resolve(p);
59825
- const home = path56.resolve(os8.homedir());
59901
+ const home = path56.resolve(os9.homedir());
59826
59902
  if (resolved === "/" || resolved === home || resolved.length <= home.length) {
59827
59903
  return false;
59828
59904
  }
@@ -59846,7 +59922,7 @@ function isSafeCachePath(p) {
59846
59922
  }
59847
59923
  function isSafeLockFilePath(p) {
59848
59924
  const resolved = path56.resolve(p);
59849
- const home = path56.resolve(os8.homedir());
59925
+ const home = path56.resolve(os9.homedir());
59850
59926
  if (resolved === "/" || resolved === home || resolved.length <= home.length) {
59851
59927
  return false;
59852
59928
  }