oh-my-opencode 5.1.82 → 5.1.84

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.
Files changed (150) hide show
  1. package/dist/cli/cli-program.d.ts +3 -0
  2. package/dist/cli/index.js +202 -193
  3. package/dist/cli-node/index.js +202 -193
  4. package/dist/index.js +28 -22
  5. package/dist/skills/browser/SKILL.md +97 -91
  6. package/dist/skills/browser/references/commands.md +88 -26
  7. package/dist/skills/browser/references/desktop.md +21 -0
  8. package/dist/skills/browser/references/install.md +18 -0
  9. package/dist/skills/browser/references/owned-engine/README.md +5 -2
  10. package/dist/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
  11. package/dist/skills/browser/references/owned-engine/network.md +4 -3
  12. package/dist/skills/browser/references/recipes/1password.md +4 -2
  13. package/dist/skills/browser/runtime/omowright/index.js +7 -7
  14. package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
  15. package/dist/skills/debugging/references/tools/browser-qa.md +1 -1
  16. package/dist/skills/programming/SKILL.md +51 -320
  17. package/dist/skills/programming/references/go/README.md +1 -0
  18. package/dist/skills/programming/references/python/README.md +21 -3
  19. package/dist/skills/programming/references/python/error-handling.md +14 -0
  20. package/dist/skills/programming/references/rust/README.md +5 -1
  21. package/dist/skills/programming/references/typescript/README.md +9 -3
  22. package/dist/skills/programming/references/typescript/error-handling.md +18 -0
  23. package/dist/skills/ultimate-browsing/SKILL.md +1 -1
  24. package/dist/skills/visual-qa/references/browser-setup.md +5 -5
  25. package/dist/tui.js +16 -16
  26. package/package.json +14 -14
  27. package/packages/lsp-core/src/lsp/client-key.ts +14 -0
  28. package/packages/lsp-core/src/lsp/client-startup.ts +139 -0
  29. package/packages/lsp-core/src/lsp/client-wrapper.ts +4 -4
  30. package/packages/lsp-core/src/lsp/config-loader.ts +15 -0
  31. package/packages/lsp-core/src/lsp/directory-diagnostics-group-scan.test.ts +388 -0
  32. package/packages/lsp-core/src/lsp/directory-diagnostics-mixed-typescript.test.ts +124 -0
  33. package/packages/lsp-core/src/lsp/directory-diagnostics.test.ts +4 -4
  34. package/packages/lsp-core/src/lsp/directory-diagnostics.ts +38 -41
  35. package/packages/lsp-core/src/lsp/directory-group-scan.ts +124 -0
  36. package/packages/lsp-core/src/lsp/directory-server-groups.ts +84 -0
  37. package/packages/lsp-core/src/lsp/manager-acquisition.test.ts +115 -0
  38. package/packages/lsp-core/src/lsp/manager-lifecycle.test.ts +9 -9
  39. package/packages/lsp-core/src/lsp/manager-max-clients.test.ts +41 -16
  40. package/packages/lsp-core/src/lsp/manager-reaping.test.ts +119 -0
  41. package/packages/lsp-core/src/lsp/manager-test-support.ts +108 -0
  42. package/packages/lsp-core/src/lsp/manager.ts +80 -249
  43. package/packages/lsp-core/src/lsp/native-typescript.ts +88 -0
  44. package/packages/lsp-core/src/lsp/server-installation.ts +15 -7
  45. package/packages/lsp-core/src/lsp/server-resolution-typescript-native.test.ts +327 -0
  46. package/packages/lsp-core/src/lsp/server-resolution.ts +28 -2
  47. package/packages/lsp-core/src/lsp/timer-provider.ts +17 -0
  48. package/packages/lsp-core/src/lsp/typescript-project-test-support.ts +52 -0
  49. package/packages/lsp-daemon/dist/cli.js +486 -310
  50. package/packages/lsp-daemon/dist/client.js +472 -296
  51. package/packages/lsp-daemon/dist/index.js +476 -300
  52. package/packages/lsp-tools-mcp/dist/cli.js +467 -291
  53. package/packages/lsp-tools-mcp/dist/lsp/manager.js +160 -193
  54. package/packages/lsp-tools-mcp/dist/mcp.js +467 -291
  55. package/packages/lsp-tools-mcp/dist/tools.js +467 -291
  56. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  57. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +2 -2
  58. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  59. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  60. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  61. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  62. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  63. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  64. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  65. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  66. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
  67. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +478 -313
  68. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  69. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  70. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  71. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  72. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  73. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  74. package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +8711 -172
  75. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +8660 -121
  76. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  77. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  78. package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +5 -0
  79. package/packages/omo-codex/plugin/components/telemetry/tsconfig.json +2 -2
  80. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  81. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  82. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
  83. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  84. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
  85. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  86. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  87. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  88. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  89. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  90. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  91. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  92. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  93. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
  94. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  95. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  96. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  97. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  98. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  99. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  100. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  101. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  102. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  103. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  104. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  105. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  106. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  107. package/packages/omo-codex/plugin/package-lock.json +12 -12
  108. package/packages/omo-codex/plugin/package.json +1 -1
  109. package/packages/omo-codex/plugin/shared/src/config-loader.ts +15 -1
  110. package/packages/omo-codex/plugin/skills/browser/SKILL.md +97 -91
  111. package/packages/omo-codex/plugin/skills/browser/references/commands.md +88 -26
  112. package/packages/omo-codex/plugin/skills/browser/references/desktop.md +21 -0
  113. package/packages/omo-codex/plugin/skills/browser/references/install.md +18 -0
  114. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +5 -2
  115. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
  116. package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +4 -3
  117. package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +4 -2
  118. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +7 -7
  119. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +4 -4
  120. package/packages/omo-codex/plugin/skills/debugging/references/tools/browser-qa.md +1 -1
  121. package/packages/omo-codex/plugin/skills/programming/SKILL.md +51 -320
  122. package/packages/omo-codex/plugin/skills/programming/references/go/README.md +1 -0
  123. package/packages/omo-codex/plugin/skills/programming/references/python/README.md +21 -3
  124. package/packages/omo-codex/plugin/skills/programming/references/python/error-handling.md +14 -0
  125. package/packages/omo-codex/plugin/skills/programming/references/rust/README.md +5 -1
  126. package/packages/omo-codex/plugin/skills/programming/references/typescript/README.md +9 -3
  127. package/packages/omo-codex/plugin/skills/programming/references/typescript/error-handling.md +18 -0
  128. package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +1 -1
  129. package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +5 -5
  130. package/packages/omo-codex/scripts/install-dist/install-local.mjs +21189 -20653
  131. package/packages/shared-skills/skills/browser/SKILL.md +97 -91
  132. package/packages/shared-skills/skills/browser/references/commands.md +88 -26
  133. package/packages/shared-skills/skills/browser/references/desktop.md +21 -0
  134. package/packages/shared-skills/skills/browser/references/install.md +18 -0
  135. package/packages/shared-skills/skills/browser/references/owned-engine/README.md +5 -2
  136. package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +7 -2
  137. package/packages/shared-skills/skills/browser/references/owned-engine/network.md +4 -3
  138. package/packages/shared-skills/skills/browser/references/recipes/1password.md +4 -2
  139. package/packages/shared-skills/skills/browser/runtime/omowright/index.js +7 -7
  140. package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +4 -4
  141. package/packages/shared-skills/skills/debugging/references/tools/browser-qa.md +1 -1
  142. package/packages/shared-skills/skills/programming/SKILL.md +51 -320
  143. package/packages/shared-skills/skills/programming/references/go/README.md +1 -0
  144. package/packages/shared-skills/skills/programming/references/python/README.md +21 -3
  145. package/packages/shared-skills/skills/programming/references/python/error-handling.md +14 -0
  146. package/packages/shared-skills/skills/programming/references/rust/README.md +5 -1
  147. package/packages/shared-skills/skills/programming/references/typescript/README.md +9 -3
  148. package/packages/shared-skills/skills/programming/references/typescript/error-handling.md +18 -0
  149. package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +1 -1
  150. package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +5 -5
@@ -21,6 +21,24 @@ var realTimerProvider = {
21
21
  setTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
22
22
  clearTimeout: (handle) => clearTimeout(handle)
23
23
  };
24
+ function repeatEvery(timers, intervalMs, tick) {
25
+ let handle = null;
26
+ const arm = () => {
27
+ handle = timers.setTimeout(() => {
28
+ tick();
29
+ if (handle !== null)
30
+ arm();
31
+ }, intervalMs);
32
+ if (typeof handle.unref === "function")
33
+ handle.unref();
34
+ };
35
+ arm();
36
+ return () => {
37
+ if (handle !== null)
38
+ timers.clearTimeout(handle);
39
+ handle = null;
40
+ };
41
+ }
24
42
 
25
43
  // ../lsp-core/src/lsp/constants.ts
26
44
  var DEFAULT_MAX_REFERENCES = 200;
@@ -2770,30 +2788,54 @@ function abortError2(signal) {
2770
2788
  return error;
2771
2789
  }
2772
2790
 
2773
- // ../lsp-core/src/lsp/process-signal-cleanup.ts
2774
- function installProcessSignalCleanup(cleanup) {
2775
- const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM"];
2776
- const handler = () => {
2777
- cleanup().catch((error) => {
2778
- reportBestEffortCleanupError("signal cleanup", error);
2779
- });
2780
- };
2781
- for (const signal of signals) {
2782
- process.on(signal, handler);
2783
- }
2784
- return () => {
2785
- for (const signal of signals) {
2786
- process.removeListener(signal, handler);
2787
- }
2788
- };
2791
+ // ../lsp-core/src/lsp/client-key.ts
2792
+ function lspClientKey(root, server) {
2793
+ return JSON.stringify([root, server.id, server.command]);
2789
2794
  }
2790
2795
 
2791
- // ../lsp-core/src/lsp/manager.ts
2792
- async function stopClientBestEffort(client) {
2793
- try {
2794
- await client.stop();
2795
- } catch (error) {
2796
- reportBestEffortCleanupError("client stop", error);
2796
+ // ../lsp-core/src/lsp/client-startup.ts
2797
+ class ClientStartups {
2798
+ constructor(now, discard) {
2799
+ this.now = now;
2800
+ this.discard = discard;
2801
+ }
2802
+ begin(request) {
2803
+ const { client } = request;
2804
+ const startedAt = this.now();
2805
+ const initPromise = (async () => {
2806
+ await client.start();
2807
+ await client.initialize();
2808
+ })();
2809
+ const managed = {
2810
+ ...request,
2811
+ refCount: 0,
2812
+ pendingWaiters: 0,
2813
+ lastUsedAt: startedAt,
2814
+ initPromise,
2815
+ isInitializing: true,
2816
+ initializingSince: startedAt
2817
+ };
2818
+ initPromise.then(() => {
2819
+ managed.isInitializing = false;
2820
+ managed.initializingSince = null;
2821
+ managed.initPromise = null;
2822
+ managed.lastUsedAt = this.now();
2823
+ }, () => this.discard(managed));
2824
+ return managed;
2825
+ }
2826
+ async wait(managed, initPromise, signal) {
2827
+ managed.pendingWaiters++;
2828
+ try {
2829
+ await awaitWithSignal(initPromise, signal);
2830
+ } catch (error) {
2831
+ this.detach(managed);
2832
+ throw error;
2833
+ }
2834
+ }
2835
+ detach(managed) {
2836
+ managed.pendingWaiters--;
2837
+ if (managed.pendingWaiters === 0 && managed.refCount === 0 && managed.heldByWaiters)
2838
+ this.discard(managed);
2797
2839
  }
2798
2840
  }
2799
2841
  function awaitWithSignal(promise, signal) {
@@ -2828,36 +2870,50 @@ function awaitWithSignal(promise, signal) {
2828
2870
  });
2829
2871
  }
2830
2872
 
2873
+ // ../lsp-core/src/lsp/process-signal-cleanup.ts
2874
+ function installProcessSignalCleanup(cleanup) {
2875
+ const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM"];
2876
+ const handler = () => {
2877
+ cleanup().catch((error) => {
2878
+ reportBestEffortCleanupError("signal cleanup", error);
2879
+ });
2880
+ };
2881
+ for (const signal of signals) {
2882
+ process.on(signal, handler);
2883
+ }
2884
+ return () => {
2885
+ for (const signal of signals) {
2886
+ process.removeListener(signal, handler);
2887
+ }
2888
+ };
2889
+ }
2890
+
2891
+ // ../lsp-core/src/lsp/manager.ts
2892
+ async function stopClientBestEffort(client) {
2893
+ try {
2894
+ await client.stop();
2895
+ } catch (error) {
2896
+ reportBestEffortCleanupError("client stop", error);
2897
+ }
2898
+ }
2899
+
2831
2900
  class LspManager {
2832
2901
  constructor(options = {}) {
2833
2902
  this.clients = new Map;
2834
2903
  this.pendingStops = new Map;
2835
2904
  this.respawnBudgets = new Map;
2836
- this.reaperHandle = null;
2837
2905
  this.signalDisposer = null;
2838
2906
  this.disposed = false;
2839
2907
  this.idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
2840
2908
  this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
2841
2909
  this.maxResidentClients = options.maxResidentClients ?? MAX_RESIDENT_CLIENTS;
2842
- this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
2843
2910
  this.clientFactory = options.clientFactory ?? ((root, server) => new LspClient(root, server));
2844
2911
  this.now = options.now ?? (() => Date.now());
2845
- this.startReaper();
2912
+ this.startups = new ClientStartups(this.now, (managed) => this.discard(managed));
2913
+ const reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
2914
+ this.stopReaper = repeatEvery(options.timers ?? realTimerProvider, reaperIntervalMs, () => this.reapStale());
2846
2915
  this.signalDisposer = installProcessSignalCleanup(() => this.stopAll());
2847
2916
  }
2848
- startReaper() {
2849
- if (this.reaperHandle)
2850
- return;
2851
- this.reaperHandle = setInterval(() => {
2852
- this.reapStale();
2853
- }, this.reaperIntervalMs);
2854
- if (typeof this.reaperHandle.unref === "function") {
2855
- this.reaperHandle.unref();
2856
- }
2857
- }
2858
- getKey(root, serverId) {
2859
- return `${root}::${serverId}`;
2860
- }
2861
2917
  tombstoneStop(key, client) {
2862
2918
  const stop = stopClientBestEffort(client);
2863
2919
  this.pendingStops.set(key, stop);
@@ -2893,18 +2949,15 @@ class LspManager {
2893
2949
  budget.deadGenerations = 0;
2894
2950
  budget.exhaustedAt = null;
2895
2951
  }
2952
+ startupExpired(managed, t) {
2953
+ return managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs;
2954
+ }
2896
2955
  reapStale() {
2897
2956
  const t = this.now();
2898
- for (const [key, managed] of this.clients) {
2899
- if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
2900
- this.clients.delete(key);
2901
- this.tombstoneStop(key, managed.client);
2902
- continue;
2903
- }
2904
- if (!managed.isInitializing && managed.refCount === 0 && managed.pendingWaiters === 0 && t - managed.lastUsedAt > this.idleTimeoutMs) {
2905
- this.clients.delete(key);
2906
- this.tombstoneStop(key, managed.client);
2907
- }
2957
+ for (const managed of [...this.clients.values()]) {
2958
+ const idle = !managed.isInitializing && managed.refCount === 0 && managed.pendingWaiters === 0 && t - managed.lastUsedAt > this.idleTimeoutMs;
2959
+ if (idle || this.startupExpired(managed, t))
2960
+ this.discard(managed);
2908
2961
  }
2909
2962
  }
2910
2963
  evictForAdmission() {
@@ -2912,152 +2965,96 @@ class LspManager {
2912
2965
  const victim = this.leastRecentlyUsedIdleClient();
2913
2966
  if (!victim)
2914
2967
  return;
2915
- this.clients.delete(victim.key);
2916
- this.tombstoneStop(victim.key, victim.managed.client);
2968
+ this.discard(victim);
2917
2969
  }
2918
2970
  }
2919
2971
  leastRecentlyUsedIdleClient() {
2920
2972
  let candidate = null;
2921
- for (const [key, managed] of this.clients) {
2973
+ for (const managed of this.clients.values()) {
2922
2974
  if (managed.refCount > 0 || managed.pendingWaiters > 0 || managed.isInitializing)
2923
2975
  continue;
2924
- if (candidate === null || managed.lastUsedAt < candidate.managed.lastUsedAt) {
2925
- candidate = { key, managed };
2926
- }
2976
+ if (candidate === null || managed.lastUsedAt < candidate.lastUsedAt)
2977
+ candidate = managed;
2927
2978
  }
2928
2979
  return candidate;
2929
2980
  }
2930
- async tryDeleteIfOrphaned(key, managed) {
2931
- if (managed.refCount === 0 && managed.pendingWaiters === 0 && !managed.isInitializing && this.clients.get(key) === managed) {
2932
- this.clients.delete(key);
2933
- await this.tombstoneStop(key, managed.client);
2934
- }
2981
+ discard(managed) {
2982
+ if (this.clients.get(managed.key) !== managed)
2983
+ return;
2984
+ this.clients.delete(managed.key);
2985
+ this.tombstoneStop(managed.key, managed.client);
2935
2986
  }
2936
2987
  async getClient(root, server, signal) {
2937
- if (this.disposed) {
2938
- throw new Error("LspManager has been disposed");
2939
- }
2940
- signal?.throwIfAborted();
2941
- const key = this.getKey(root, server.id);
2988
+ const key = lspClientKey(root, server);
2942
2989
  for (;; ) {
2943
- const pendingStop = this.pendingStops.get(key);
2944
- if (pendingStop === undefined)
2945
- break;
2946
- await awaitWithSignal(pendingStop, signal);
2990
+ if (this.disposed) {
2991
+ throw new Error("LspManager has been disposed");
2992
+ }
2947
2993
  signal?.throwIfAborted();
2948
- }
2949
- if (this.disposed) {
2950
- throw new Error("LspManager has been disposed");
2951
- }
2952
- let managed = this.clients.get(key);
2953
- if (managed) {
2954
- const t = this.now();
2955
- if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
2956
- this.clients.delete(key);
2957
- await this.tombstoneStop(key, managed.client);
2958
- managed = undefined;
2994
+ const pendingStop = this.pendingStops.get(key);
2995
+ if (pendingStop !== undefined) {
2996
+ await awaitWithSignal(pendingStop, signal);
2997
+ continue;
2959
2998
  }
2960
- }
2961
- if (managed) {
2962
- if (managed.initPromise) {
2963
- managed.pendingWaiters++;
2964
- try {
2965
- await awaitWithSignal(managed.initPromise, signal);
2966
- } catch (err) {
2967
- managed.pendingWaiters--;
2968
- await this.tryDeleteIfOrphaned(key, managed);
2969
- throw err;
2999
+ let managed = this.clients.get(key);
3000
+ if (managed !== undefined && this.startupExpired(managed, this.now())) {
3001
+ this.discard(managed);
3002
+ continue;
3003
+ }
3004
+ if (managed === undefined) {
3005
+ this.evictForAdmission();
3006
+ this.ensureRespawnAllowed(key, root, server.id);
3007
+ managed = this.startClient(key, root, server, true);
3008
+ }
3009
+ const { initPromise } = managed;
3010
+ if (initPromise !== null) {
3011
+ await this.startups.wait(managed, initPromise, signal);
3012
+ if (signal?.aborted) {
3013
+ this.startups.detach(managed);
3014
+ signal.throwIfAborted();
2970
3015
  }
2971
3016
  managed.pendingWaiters--;
2972
3017
  }
2973
- if (signal?.aborted) {
2974
- await this.tryDeleteIfOrphaned(key, managed);
2975
- signal.throwIfAborted();
2976
- }
3018
+ if (this.clients.get(key) !== managed)
3019
+ continue;
2977
3020
  if (!managed.client.isAlive()) {
2978
3021
  this.recordDeadGeneration(key);
2979
- if (this.clients.get(key) === managed) {
2980
- this.clients.delete(key);
2981
- }
2982
- await this.tombstoneStop(key, managed.client);
2983
- return this.getClient(root, server, signal);
3022
+ this.discard(managed);
3023
+ continue;
2984
3024
  }
2985
3025
  this.markHealthyGeneration(key);
2986
3026
  managed.refCount++;
2987
3027
  managed.lastUsedAt = this.now();
2988
3028
  return managed.client;
2989
3029
  }
2990
- this.evictForAdmission();
2991
- this.ensureRespawnAllowed(key, root, server.id);
3030
+ }
3031
+ startClient(key, root, server, heldByWaiters) {
2992
3032
  const client = this.clientFactory(root, server);
2993
- const initStartedAt = this.now();
2994
- const initPromise = (async () => {
2995
- await client.start();
2996
- await client.initialize();
2997
- })();
2998
- const newManaged = {
2999
- client,
3000
- refCount: 0,
3001
- pendingWaiters: 1,
3002
- lastUsedAt: initStartedAt,
3003
- initPromise,
3004
- isInitializing: true,
3005
- initializingSince: initStartedAt
3006
- };
3007
- this.clients.set(key, newManaged);
3008
- try {
3009
- await awaitWithSignal(initPromise, signal);
3010
- } catch (err) {
3011
- newManaged.pendingWaiters--;
3012
- if (this.clients.get(key) === newManaged) {
3013
- this.clients.delete(key);
3014
- }
3015
- await this.tombstoneStop(key, client);
3016
- throw err;
3017
- }
3018
- newManaged.pendingWaiters--;
3019
- newManaged.isInitializing = false;
3020
- newManaged.initializingSince = null;
3021
- newManaged.initPromise = null;
3022
- if (signal?.aborted) {
3023
- await this.tryDeleteIfOrphaned(key, newManaged);
3024
- signal.throwIfAborted();
3025
- }
3026
- if (!client.isAlive()) {
3027
- this.recordDeadGeneration(key);
3028
- if (this.clients.get(key) === newManaged) {
3029
- this.clients.delete(key);
3030
- }
3031
- await this.tombstoneStop(key, client);
3032
- return this.getClient(root, server, signal);
3033
- }
3034
- this.markHealthyGeneration(key);
3035
- newManaged.refCount++;
3036
- newManaged.lastUsedAt = this.now();
3037
- return client;
3033
+ const managed = this.startups.begin({ key, root, serverId: server.id, client, heldByWaiters });
3034
+ this.clients.set(key, managed);
3035
+ return managed;
3038
3036
  }
3039
- releaseClient(root, serverId) {
3040
- const key = this.getKey(root, serverId);
3041
- const managed = this.clients.get(key);
3037
+ releaseClient(root, server, client) {
3038
+ const managed = this.clients.get(lspClientKey(root, server));
3039
+ if (client !== undefined && managed?.client !== client)
3040
+ return;
3042
3041
  if (managed && managed.refCount > 0) {
3043
3042
  managed.refCount--;
3044
3043
  managed.lastUsedAt = this.now();
3045
3044
  }
3046
3045
  }
3047
- invalidateClient(root, serverId, client) {
3048
- const key = this.getKey(root, serverId);
3049
- const managed = this.clients.get(key);
3046
+ invalidateClient(root, server, client) {
3047
+ const managed = this.clients.get(lspClientKey(root, server));
3050
3048
  if (!managed)
3051
3049
  return;
3052
3050
  if (client && managed.client !== client)
3053
3051
  return;
3054
- this.clients.delete(key);
3055
- this.tombstoneStop(key, managed.client);
3052
+ this.discard(managed);
3056
3053
  }
3057
3054
  warmupClient(root, server) {
3058
3055
  if (this.disposed)
3059
3056
  return;
3060
- const key = this.getKey(root, server.id);
3057
+ const key = lspClientKey(root, server);
3061
3058
  if (this.clients.has(key) || this.pendingStops.has(key))
3062
3059
  return;
3063
3060
  this.evictForAdmission();
@@ -3066,45 +3063,18 @@ class LspManager {
3066
3063
  } catch {
3067
3064
  return;
3068
3065
  }
3069
- const client = this.clientFactory(root, server);
3070
- const initStartedAt = this.now();
3071
- const initPromise = (async () => {
3072
- await client.start();
3073
- await client.initialize();
3074
- })();
3075
- const managed = {
3076
- client,
3077
- refCount: 0,
3078
- pendingWaiters: 0,
3079
- lastUsedAt: initStartedAt,
3080
- initPromise,
3081
- isInitializing: true,
3082
- initializingSince: initStartedAt
3083
- };
3084
- this.clients.set(key, managed);
3085
- initPromise.then(() => {
3086
- managed.isInitializing = false;
3087
- managed.initializingSince = null;
3088
- managed.initPromise = null;
3089
- managed.lastUsedAt = this.now();
3090
- }, () => {
3091
- if (this.clients.get(key) === managed) {
3092
- this.clients.delete(key);
3093
- }
3094
- this.tombstoneStop(key, client);
3095
- });
3066
+ this.startClient(key, root, server, false);
3096
3067
  }
3097
- isServerInitializing(root, serverId) {
3098
- const managed = this.clients.get(this.getKey(root, serverId));
3068
+ isServerInitializing(root, server) {
3069
+ const managed = this.clients.get(lspClientKey(root, server));
3099
3070
  return managed?.isInitializing ?? false;
3100
3071
  }
3101
3072
  getSnapshot() {
3102
3073
  const snapshots = [];
3103
- for (const [key, managed] of this.clients) {
3104
- const [root, serverId] = key.split("::");
3074
+ for (const managed of this.clients.values()) {
3105
3075
  snapshots.push({
3106
- root,
3107
- serverId,
3076
+ root: managed.root,
3077
+ serverId: managed.serverId,
3108
3078
  refCount: managed.refCount,
3109
3079
  pendingWaiters: managed.pendingWaiters,
3110
3080
  lastUsedAt: managed.lastUsedAt,
@@ -3115,18 +3085,15 @@ class LspManager {
3115
3085
  }
3116
3086
  return snapshots;
3117
3087
  }
3118
- hasClient(root, serverId) {
3119
- return this.clients.has(this.getKey(root, serverId));
3088
+ hasClient(root, server) {
3089
+ return this.clients.has(lspClientKey(root, server));
3120
3090
  }
3121
3091
  clientCount() {
3122
3092
  return this.clients.size;
3123
3093
  }
3124
3094
  async stopAll() {
3125
3095
  this.disposed = true;
3126
- if (this.reaperHandle) {
3127
- clearInterval(this.reaperHandle);
3128
- this.reaperHandle = null;
3129
- }
3096
+ this.stopReaper();
3130
3097
  if (this.signalDisposer) {
3131
3098
  this.signalDisposer();
3132
3099
  this.signalDisposer = null;
@@ -3159,7 +3126,7 @@ async function disposeDefaultLspManager() {
3159
3126
  // src/daemon-client.ts
3160
3127
  import { connect } from "node:net";
3161
3128
  import { homedir as homedir4 } from "node:os";
3162
- import { join as join9 } from "node:path";
3129
+ import { join as join10 } from "node:path";
3163
3130
  import { setTimeout as delay } from "node:timers/promises";
3164
3131
 
3165
3132
  // ../lsp-core/src/request-context.ts
@@ -4314,8 +4281,8 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
4314
4281
  };
4315
4282
  }
4316
4283
  // ../lsp-core/src/lsp/client-wrapper.ts
4317
- import { existsSync as existsSync11, realpathSync as realpathSync6, statSync as statSync4 } from "node:fs";
4318
- import { basename as basename3, dirname as dirname10, join as join5, resolve as resolve8 } from "node:path";
4284
+ import { existsSync as existsSync12, realpathSync as realpathSync7, statSync as statSync5 } from "node:fs";
4285
+ import { basename as basename3, dirname as dirname11, join as join6, resolve as resolve9 } from "node:path";
4319
4286
 
4320
4287
  // ../lsp-core/src/lsp/outside-context-workspace.ts
4321
4288
  import { existsSync as existsSync7, realpathSync as realpathSync4 } from "node:fs";
@@ -4655,6 +4622,7 @@ function getMergedServers() {
4655
4622
  extensions: config.extensions,
4656
4623
  priority: -100,
4657
4624
  source: "builtin",
4625
+ inheritsBuiltinCommand: true,
4658
4626
  ...config.initialization === undefined ? {} : { initialization: config.initialization }
4659
4627
  });
4660
4628
  }
@@ -4680,8 +4648,11 @@ function createServerFromEntry(id, entry, source) {
4680
4648
  command: builtin.command,
4681
4649
  extensions: entry.extensions ?? builtin.extensions,
4682
4650
  priority: entry.priority ?? 0,
4683
- source
4651
+ source,
4652
+ inheritsBuiltinCommand: true
4684
4653
  });
4654
+ if (entry.initialization !== undefined)
4655
+ server.configuredInitialization = entry.initialization;
4685
4656
  const initialization = mergeInitialization(builtin.initialization, entry.initialization);
4686
4657
  if (initialization !== undefined) {
4687
4658
  server.initialization = initialization;
@@ -4694,7 +4665,8 @@ function createServerFromEntry(id, entry, source) {
4694
4665
  command: entry.command,
4695
4666
  extensions: entry.extensions,
4696
4667
  priority: entry.priority ?? 0,
4697
- source
4668
+ source,
4669
+ inheritsBuiltinCommand: false
4698
4670
  });
4699
4671
  applyOptionalServerFields(server, entry);
4700
4672
  return server;
@@ -4706,7 +4678,8 @@ function createServerFromEntry(id, entry, source) {
4706
4678
  command: entry.command ?? builtin.command,
4707
4679
  extensions: entry.extensions ?? builtin.extensions,
4708
4680
  priority: entry.priority ?? 0,
4709
- source
4681
+ source,
4682
+ inheritsBuiltinCommand: entry.command === undefined
4710
4683
  });
4711
4684
  applyOptionalServerFields(server, entry);
4712
4685
  const builtinInitialization = entry.command === undefined ? builtin.initialization : undefined;
@@ -4729,7 +4702,8 @@ function createServer(input) {
4729
4702
  command: input.command,
4730
4703
  extensions: input.extensions,
4731
4704
  priority: input.priority,
4732
- source: input.source
4705
+ source: input.source,
4706
+ inheritsBuiltinCommand: input.inheritsBuiltinCommand
4733
4707
  };
4734
4708
  if (input.env !== undefined) {
4735
4709
  server.env = input.env;
@@ -4745,6 +4719,7 @@ function applyOptionalServerFields(server, entry) {
4745
4719
  }
4746
4720
  if (entry.initialization !== undefined) {
4747
4721
  server.initialization = entry.initialization;
4722
+ server.configuredInitialization = entry.initialization;
4748
4723
  }
4749
4724
  }
4750
4725
  function isConfigJson(value) {
@@ -4836,14 +4811,24 @@ function readHead(path) {
4836
4811
  }
4837
4812
  }
4838
4813
 
4814
+ // ../lsp-core/src/lsp/native-typescript.ts
4815
+ import { existsSync as existsSync11, realpathSync as realpathSync6, statSync as statSync4 } from "node:fs";
4816
+ import { dirname as dirname10, join as join5, resolve as resolve8 } from "node:path";
4817
+
4839
4818
  // ../lsp-core/src/lsp/server-installation.ts
4840
4819
  import { existsSync as existsSync10 } from "node:fs";
4841
4820
  import { delimiter as delimiter3, dirname as dirname9, isAbsolute as isAbsolute5, join as join4, resolve as resolve7 } from "node:path";
4821
+ var NODE_PROJECT_MARKERS = [
4822
+ "package.json",
4823
+ "bun.lock",
4824
+ "bun.lockb",
4825
+ "package-lock.json",
4826
+ "yarn.lock",
4827
+ "pnpm-lock.yaml"
4828
+ ];
4829
+ var NODE_LOCAL_BIN_DIR = join4("node_modules", ".bin");
4842
4830
  var LOCAL_BIN_RULES = [
4843
- {
4844
- markers: ["package.json", "bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"],
4845
- binDirs: [join4("node_modules", ".bin")]
4846
- },
4831
+ { markers: NODE_PROJECT_MARKERS, binDirs: [NODE_LOCAL_BIN_DIR] },
4847
4832
  {
4848
4833
  markers: [
4849
4834
  "pyproject.toml",
@@ -4971,6 +4956,57 @@ function isServerInstalled(command, workingDirectory, options = {}) {
4971
4956
  return resolveServerBinary(command, workingDirectory, options) !== null;
4972
4957
  }
4973
4958
 
4959
+ // ../lsp-core/src/lsp/native-typescript.ts
4960
+ function nativeTypescriptSearchDirectory(targetPath, workingDirectory) {
4961
+ try {
4962
+ const session = realpathSync6(workingDirectory);
4963
+ if (targetPath === undefined)
4964
+ return session;
4965
+ const target = canonicalizeExistingOrNearestAncestor(resolve8(workingDirectory, targetPath));
4966
+ if (!isPathInside(session, target))
4967
+ return session;
4968
+ return statSync4(target, { throwIfNoEntry: false })?.isDirectory() === true ? target : dirname10(target);
4969
+ } catch {
4970
+ return workingDirectory;
4971
+ }
4972
+ }
4973
+ function nativeTypescriptCommand(server, searchDirectory) {
4974
+ if (server.id !== "typescript" || !server.inheritsBuiltinCommand)
4975
+ return null;
4976
+ const found = findProjectTsc(searchDirectory);
4977
+ if (found === null)
4978
+ return null;
4979
+ const speaksLsp = !existsSync11(join5(found.packageDir, "lib", "tsserver.js"));
4980
+ return speaksLsp ? [found.tsc, "--lsp", "--stdio"] : null;
4981
+ }
4982
+ function findProjectTsc(searchDirectory) {
4983
+ const suffixes = executableSuffixes(process.platform, undefined);
4984
+ let current = searchDirectory;
4985
+ for (;; ) {
4986
+ if (NODE_PROJECT_MARKERS.some((marker) => probe(join5(current, marker)))) {
4987
+ const binDir = join5(current, NODE_LOCAL_BIN_DIR);
4988
+ const tsc = probeWithSuffixes(binDir, "tsc", suffixes);
4989
+ const packageDir = join5(binDir, "..", "typescript");
4990
+ if (tsc !== null && isRealDirectory(binDir) && existsSync11(join5(packageDir, "package.json"))) {
4991
+ return { tsc, packageDir };
4992
+ }
4993
+ }
4994
+ if (probe(join5(current, ".git")))
4995
+ return null;
4996
+ const parent = dirname10(current);
4997
+ if (parent === current)
4998
+ return null;
4999
+ current = parent;
5000
+ }
5001
+ }
5002
+ function isRealDirectory(directory) {
5003
+ try {
5004
+ return realpathSync6(directory) === directory;
5005
+ } catch {
5006
+ return false;
5007
+ }
5008
+ }
5009
+
4974
5010
  // ../lsp-core/src/lsp/server-resolution.ts
4975
5011
  function withResolvedCommand(command, binaryPath) {
4976
5012
  return [binaryPath, ...command.slice(1)];
@@ -4979,12 +5015,27 @@ function usesBuiltinCommand(id, command) {
4979
5015
  const builtin = BUILTIN_SERVERS[id]?.command;
4980
5016
  return builtin !== undefined && builtin.length === command.length && builtin.every((part, index) => part === command[index]);
4981
5017
  }
4982
- function findServerForExtension(ext) {
5018
+ function findServerForExtension(ext, targetPath) {
4983
5019
  const servers = getMergedServers();
4984
5020
  const workingDirectory = contextCwd();
5021
+ const searchDirectory = nativeTypescriptSearchDirectory(targetPath, workingDirectory);
4985
5022
  for (const server of servers) {
4986
5023
  if (!server.extensions.includes(ext))
4987
5024
  continue;
5025
+ const nativeTypescript = nativeTypescriptCommand(server, searchDirectory);
5026
+ if (nativeTypescript !== null) {
5027
+ return {
5028
+ status: "found",
5029
+ server: {
5030
+ id: server.id,
5031
+ command: withHostJsRuntime(server.id, nativeTypescript),
5032
+ extensions: server.extensions,
5033
+ priority: server.priority,
5034
+ ...server.env === undefined ? {} : { env: server.env },
5035
+ ...server.configuredInitialization === undefined ? {} : { initialization: server.configuredInitialization }
5036
+ }
5037
+ };
5038
+ }
4988
5039
  const binaryPath = resolveServerBinary(server.command, workingDirectory);
4989
5040
  if (binaryPath !== null) {
4990
5041
  const resolvedServer = {
@@ -5037,6 +5088,7 @@ function getAllServers() {
5037
5088
  const servers = getMergedServers();
5038
5089
  const disabled = getDisabledServerIds();
5039
5090
  const workingDirectory = contextCwd();
5091
+ const nativeSearchDirectory = nativeTypescriptSearchDirectory(undefined, workingDirectory);
5040
5092
  const result = [];
5041
5093
  const seen = new Set;
5042
5094
  for (const server of servers) {
@@ -5044,7 +5096,7 @@ function getAllServers() {
5044
5096
  continue;
5045
5097
  result.push({
5046
5098
  id: server.id,
5047
- installed: isServerInstalled(server.command, workingDirectory),
5099
+ installed: isServerInstalled(server.command, workingDirectory) || nativeTypescriptCommand(server, nativeSearchDirectory) !== null,
5048
5100
  extensions: server.extensions,
5049
5101
  disabled: false,
5050
5102
  source: server.source,
@@ -5071,7 +5123,7 @@ function getAllServers() {
5071
5123
  // ../lsp-core/src/lsp/client-wrapper.ts
5072
5124
  function isDirectoryPath(filePath) {
5073
5125
  try {
5074
- return statSync4(filePath).isDirectory();
5126
+ return statSync5(filePath).isDirectory();
5075
5127
  } catch {
5076
5128
  return false;
5077
5129
  }
@@ -5081,7 +5133,7 @@ function findWorkspaceRoot(filePath) {
5081
5133
  const abs = resolveReadablePathInsideContext(filePath);
5082
5134
  let dir = abs;
5083
5135
  if (!isDirectoryPath(dir)) {
5084
- dir = dirname10(dir);
5136
+ dir = dirname11(dir);
5085
5137
  }
5086
5138
  if (!isPathInside(cwd, abs))
5087
5139
  return findWorkspaceRootOutsideContext(dir);
@@ -5090,7 +5142,7 @@ function findWorkspaceRoot(filePath) {
5090
5142
  while (isPathInside(cwd, dir)) {
5091
5143
  const canonicalDir = existingDirectoryInsideContext(dir, cwd);
5092
5144
  if (canonicalDir !== undefined) {
5093
- if (existsSync11(join5(dir, GIT_WORKSPACE_MARKER))) {
5145
+ if (existsSync12(join6(dir, GIT_WORKSPACE_MARKER))) {
5094
5146
  return canonicalDir;
5095
5147
  }
5096
5148
  if (nearestPackageRoot === undefined && hasProjectWorkspaceMarker(dir)) {
@@ -5099,16 +5151,16 @@ function findWorkspaceRoot(filePath) {
5099
5151
  }
5100
5152
  if (dir === cwd)
5101
5153
  break;
5102
- dir = dirname10(dir);
5154
+ dir = dirname11(dir);
5103
5155
  }
5104
5156
  return nearestPackageRoot ?? fallbackRoot;
5105
5157
  }
5106
5158
  function hasProjectWorkspaceMarker(directory) {
5107
- return PROJECT_WORKSPACE_MARKERS.some((marker) => existsSync11(join5(directory, marker)));
5159
+ return PROJECT_WORKSPACE_MARKERS.some((marker) => existsSync12(join6(directory, marker)));
5108
5160
  }
5109
5161
  function resolveReadablePathInsideContext(filePath) {
5110
5162
  const cwd = contextCwd();
5111
- const abs = resolve8(cwd, filePath);
5163
+ const abs = resolve9(cwd, filePath);
5112
5164
  if (isPathInside(cwd, abs))
5113
5165
  return abs;
5114
5166
  const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
@@ -5129,12 +5181,12 @@ function rebaseThroughCanonicalAncestor(path, cwd) {
5129
5181
  let current = path;
5130
5182
  const suffix = [];
5131
5183
  while (true) {
5132
- if (existsSync11(current)) {
5133
- const canonical = realpathSync6(current);
5184
+ if (existsSync12(current)) {
5185
+ const canonical = realpathSync7(current);
5134
5186
  if (isPathInside(cwd, canonical))
5135
- return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
5187
+ return suffix.length === 0 ? canonical : join6(canonical, ...suffix);
5136
5188
  }
5137
- const parent = dirname10(current);
5189
+ const parent = dirname11(current);
5138
5190
  if (parent === current)
5139
5191
  return;
5140
5192
  suffix.unshift(basename3(current));
@@ -5142,10 +5194,10 @@ function rebaseThroughCanonicalAncestor(path, cwd) {
5142
5194
  }
5143
5195
  }
5144
5196
  function existingDirectoryInsideContext(directory, cwd) {
5145
- if (!existsSync11(directory))
5197
+ if (!existsSync12(directory))
5146
5198
  return;
5147
- const canonical = realpathSync6(directory);
5148
- if (!statSync4(canonical).isDirectory())
5199
+ const canonical = realpathSync7(directory);
5200
+ if (!statSync5(canonical).isDirectory())
5149
5201
  return;
5150
5202
  return isPathInside(cwd, canonical) ? canonical : undefined;
5151
5203
  }
@@ -5157,7 +5209,7 @@ function nearestExistingDirectoryInsideContext(directory, cwd) {
5157
5209
  return canonical;
5158
5210
  if (current === cwd)
5159
5211
  return;
5160
- current = dirname10(current);
5212
+ current = dirname11(current);
5161
5213
  }
5162
5214
  return;
5163
5215
  }
@@ -5257,7 +5309,7 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
5257
5309
  throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
5258
5310
  }
5259
5311
  const ext = effectiveExtension(absPath);
5260
- const result = findServerForExtension(ext);
5312
+ const result = findServerForExtension(ext, absPath);
5261
5313
  if (result.status !== "found") {
5262
5314
  throw new LspServerLookupError(formatServerLookupError(result), result);
5263
5315
  }
@@ -5270,25 +5322,153 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
5270
5322
  return await fn(client, root, absPath);
5271
5323
  } catch (err) {
5272
5324
  if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
5273
- manager.invalidateClient(root, server.id, client);
5325
+ manager.invalidateClient(root, server, client);
5274
5326
  return acquireAndCall(false);
5275
5327
  }
5276
5328
  if (err instanceof LspRequestTimeoutError) {
5277
- if (manager.isServerInitializing(root, server.id)) {
5329
+ if (manager.isServerInitializing(root, server)) {
5278
5330
  throw new LspServerInitializingError(err);
5279
5331
  }
5280
5332
  }
5281
5333
  throw err;
5282
5334
  } finally {
5283
- manager.releaseClient(root, server.id);
5335
+ manager.releaseClient(root, server, client);
5284
5336
  }
5285
5337
  };
5286
5338
  return acquireAndCall(true);
5287
5339
  }
5288
5340
 
5289
5341
  // ../lsp-core/src/lsp/directory-diagnostics.ts
5290
- import { existsSync as existsSync12, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
5291
- import { join as join6, resolve as resolve9 } from "node:path";
5342
+ import { existsSync as existsSync13, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
5343
+ import { join as join7, resolve as resolve10 } from "node:path";
5344
+
5345
+ // ../lsp-core/src/lsp/directory-group-scan.ts
5346
+ async function scanServedGroups(options) {
5347
+ const { groups, signal } = options;
5348
+ const limit = Math.max(1, options.maxConcurrency);
5349
+ const fileSlots = createSlots(limit);
5350
+ let nextGroup = 0;
5351
+ let startedGroups = 0;
5352
+ let firstError;
5353
+ const runners = Array.from({ length: Math.min(limit, groups.length) }, async () => {
5354
+ for (;; ) {
5355
+ if (signal?.aborted)
5356
+ return;
5357
+ const group = groups[nextGroup];
5358
+ nextGroup += 1;
5359
+ if (group === undefined)
5360
+ return;
5361
+ let client;
5362
+ try {
5363
+ client = await acquireWithinInitTimeout(options, group);
5364
+ } catch (error) {
5365
+ if (signal?.aborted)
5366
+ return;
5367
+ firstError ??= error;
5368
+ options.onGroupUnavailable(group, error instanceof Error ? error.message : String(error));
5369
+ continue;
5370
+ }
5371
+ startedGroups += 1;
5372
+ try {
5373
+ await Promise.all(group.files.map(async (file) => {
5374
+ const release = await fileSlots.acquire();
5375
+ try {
5376
+ if (!signal?.aborted)
5377
+ await options.checkFile(client, file);
5378
+ } finally {
5379
+ release();
5380
+ }
5381
+ }));
5382
+ } finally {
5383
+ options.manager.releaseClient(group.root, group.server, client);
5384
+ }
5385
+ }
5386
+ });
5387
+ await Promise.all(runners);
5388
+ signal?.throwIfAborted();
5389
+ if (startedGroups === 0 && firstError !== undefined)
5390
+ throw firstError;
5391
+ }
5392
+ async function acquireWithinInitTimeout(options, group) {
5393
+ const { signal } = options;
5394
+ const timers = options.timers ?? realTimerProvider;
5395
+ const controller = new AbortController;
5396
+ const forwardAbort = () => controller.abort(signal?.reason);
5397
+ signal?.addEventListener("abort", forwardAbort, { once: true });
5398
+ if (signal?.aborted)
5399
+ forwardAbort();
5400
+ let timedOut = false;
5401
+ const timer = timers.setTimeout(() => {
5402
+ timedOut = true;
5403
+ controller.abort();
5404
+ }, INIT_TIMEOUT_MS);
5405
+ try {
5406
+ return await options.manager.getClient(group.root, group.server, controller.signal);
5407
+ } catch (error) {
5408
+ if (timedOut && signal?.aborted !== true) {
5409
+ throw new Error(`${group.server.id} did not start within ${INIT_TIMEOUT_MS}ms`);
5410
+ }
5411
+ throw error;
5412
+ } finally {
5413
+ timers.clearTimeout(timer);
5414
+ signal?.removeEventListener("abort", forwardAbort);
5415
+ }
5416
+ }
5417
+ function createSlots(limit) {
5418
+ let free = limit;
5419
+ const waiting = [];
5420
+ const release = () => {
5421
+ const next = waiting.shift();
5422
+ if (next === undefined)
5423
+ free += 1;
5424
+ else
5425
+ next();
5426
+ };
5427
+ return {
5428
+ acquire() {
5429
+ if (free > 0) {
5430
+ free -= 1;
5431
+ return Promise.resolve(release);
5432
+ }
5433
+ return new Promise((resolve) => waiting.push(() => resolve(release)));
5434
+ }
5435
+ };
5436
+ }
5437
+
5438
+ // ../lsp-core/src/lsp/directory-server-groups.ts
5439
+ import { dirname as dirname12 } from "node:path";
5440
+ function groupFilesByClient(files, extension, fixed = {}) {
5441
+ const byDirectory = new Map;
5442
+ const served = new Map;
5443
+ const unserved = new Map;
5444
+ for (const file of files) {
5445
+ const directory = dirname12(file);
5446
+ let resolution = byDirectory.get(directory);
5447
+ if (resolution === undefined) {
5448
+ resolution = resolveDirectory(directory, extension, fixed);
5449
+ byDirectory.set(directory, resolution);
5450
+ }
5451
+ if (resolution.kind === "served") {
5452
+ const group = served.get(resolution.key) ?? { root: resolution.root, server: resolution.server, files: [] };
5453
+ group.files.push(file);
5454
+ served.set(resolution.key, group);
5455
+ } else {
5456
+ const group = unserved.get(resolution.key) ?? { lookup: resolution.lookup, files: [] };
5457
+ group.files.push(file);
5458
+ unserved.set(resolution.key, group);
5459
+ }
5460
+ }
5461
+ return { served: [...served.values()], unserved: [...unserved.values()] };
5462
+ }
5463
+ function resolveDirectory(directory, extension, fixed) {
5464
+ const lookup = fixed.server === undefined ? findServerForExtension(extension, directory) : { status: "found", server: fixed.server };
5465
+ if (lookup.status !== "found") {
5466
+ const serverId = lookup.status === "not_installed" ? lookup.server.id : "";
5467
+ return { kind: "unserved", key: JSON.stringify([lookup.status, serverId]), lookup };
5468
+ }
5469
+ const root = fixed.workspaceRoot ?? findWorkspaceRoot(directory);
5470
+ return { kind: "served", key: lspClientKey(root, lookup.server), root, server: lookup.server };
5471
+ }
5292
5472
 
5293
5473
  // ../lsp-core/src/lsp/formatters.ts
5294
5474
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -5418,7 +5598,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
5418
5598
  for (const entry of entries) {
5419
5599
  if (files.length >= maxFiles)
5420
5600
  return;
5421
- const fullPath = join6(currentDir, entry);
5601
+ const fullPath = join7(currentDir, entry);
5422
5602
  let stat;
5423
5603
  try {
5424
5604
  stat = lstatSync5(fullPath);
@@ -5443,15 +5623,10 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
5443
5623
  if (!extension.startsWith(".")) {
5444
5624
  throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
5445
5625
  }
5446
- const absDir = resolve9(options.workspaceRoot ?? contextCwd(), directory);
5447
- if (!existsSync12(absDir)) {
5626
+ const absDir = resolve10(options.workspaceRoot ?? contextCwd(), directory);
5627
+ if (!existsSync13(absDir)) {
5448
5628
  throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
5449
5629
  }
5450
- const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
5451
- if (serverResult.status !== "found") {
5452
- throw new LspServerLookupError(formatServerLookupError(serverResult));
5453
- }
5454
- const server = serverResult.server;
5455
5630
  const allFiles = (options.listFiles ?? collectFilesWithExtension)(absDir, extension, maxFiles + 1);
5456
5631
  const wasCapped = allFiles.length > maxFiles;
5457
5632
  const filesToProcess = allFiles.slice(0, maxFiles);
@@ -5465,42 +5640,43 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
5465
5640
  `);
5466
5641
  return { output, totalDiagnostics: 0, fileFailures: [] };
5467
5642
  }
5468
- const root = options.workspaceRoot ?? findWorkspaceRoot(absDir);
5643
+ const groups = groupFilesByClient(filesToProcess, extension, {
5644
+ ...options.server === undefined ? {} : { server: options.server },
5645
+ ...options.workspaceRoot === undefined ? {} : { workspaceRoot: options.workspaceRoot }
5646
+ });
5647
+ const firstUnserved = groups.unserved[0];
5648
+ if (groups.served.length === 0 && firstUnserved !== undefined) {
5649
+ throw new LspServerLookupError(formatServerLookupError(firstUnserved.lookup));
5650
+ }
5469
5651
  const manager = options.manager ?? getLspManager();
5470
5652
  const allDiagnostics = [];
5471
5653
  const fileErrors = [];
5472
5654
  const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
5655
+ for (const group of groups.unserved) {
5656
+ const error = formatServerLookupError(group.lookup).split(`
5657
+ `)[0] ?? "No LSP server";
5658
+ fileErrors.push(...group.files.map((file) => ({ file, error })));
5659
+ }
5473
5660
  options.signal?.throwIfAborted();
5474
- const client = await manager.getClient(root, server, options.signal);
5475
- try {
5476
- let nextIndex = 0;
5477
- const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
5478
- for (;; ) {
5479
- if (options.signal?.aborted)
5480
- return;
5481
- const file = filesToProcess[nextIndex];
5482
- nextIndex += 1;
5483
- if (file === undefined)
5484
- return;
5485
- try {
5486
- const result = await client.diagnostics(file, options.signal);
5487
- const filtered = filterDiagnosticsBySeverity(result.items, severity);
5488
- allDiagnostics.push(...filtered.map((diagnostic) => ({
5489
- filePath: file,
5490
- diagnostic
5491
- })));
5492
- } catch (e) {
5493
- fileErrors.push({
5494
- file,
5495
- error: e instanceof Error ? e.message : String(e)
5496
- });
5497
- }
5661
+ await scanServedGroups({
5662
+ manager,
5663
+ groups: groups.served,
5664
+ maxConcurrency,
5665
+ ...options.signal === undefined ? {} : { signal: options.signal },
5666
+ ...options.timers === undefined ? {} : { timers: options.timers },
5667
+ onGroupUnavailable: (group, error) => {
5668
+ fileErrors.push(...group.files.map((file) => ({ file, error })));
5669
+ },
5670
+ checkFile: async (client, file) => {
5671
+ try {
5672
+ const result = await client.diagnostics(file, options.signal);
5673
+ const filtered = filterDiagnosticsBySeverity(result.items, severity);
5674
+ allDiagnostics.push(...filtered.map((diagnostic) => ({ filePath: file, diagnostic })));
5675
+ } catch (e) {
5676
+ fileErrors.push({ file, error: e instanceof Error ? e.message : String(e) });
5498
5677
  }
5499
- });
5500
- await Promise.all(workers);
5501
- } finally {
5502
- manager.releaseClient(root, server.id);
5503
- }
5678
+ }
5679
+ });
5504
5680
  const displayDiagnostics = allDiagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
5505
5681
  const wasDiagCapped = allDiagnostics.length > DEFAULT_MAX_DIAGNOSTICS;
5506
5682
  const lines = [
@@ -5531,7 +5707,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
5531
5707
 
5532
5708
  // ../lsp-core/src/lsp/infer-extension.ts
5533
5709
  import { lstatSync as lstatSync6, readdirSync as readdirSync4 } from "node:fs";
5534
- import { join as join7 } from "node:path";
5710
+ import { join as join8 } from "node:path";
5535
5711
  var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
5536
5712
  var MAX_SCAN_ENTRIES = 500;
5537
5713
  function inferExtensionFromDirectory(directory) {
@@ -5549,7 +5725,7 @@ function inferExtensionFromDirectory(directory) {
5549
5725
  for (const entry of entries) {
5550
5726
  if (scanned >= MAX_SCAN_ENTRIES)
5551
5727
  return;
5552
- const fullPath = join7(dir, entry);
5728
+ const fullPath = join8(dir, entry);
5553
5729
  let stat;
5554
5730
  try {
5555
5731
  stat = lstatSync6(fullPath);
@@ -5668,7 +5844,7 @@ function missingDependencyAvailability(error) {
5668
5844
  }
5669
5845
 
5670
5846
  // ../lsp-core/src/lsp/bun-command-output.ts
5671
- import { resolve as resolve10 } from "node:path";
5847
+ import { resolve as resolve11 } from "node:path";
5672
5848
  var TSC_LINE = /^(.+?)\((\d+),(\d+)\): (error|warning|message) (TS\d+): (.*)$/;
5673
5849
  var TSC_SEVERITY = { error: 1, warning: 2, message: 3 };
5674
5850
  function parseBunCheckOutput(stdout, cwd) {
@@ -5679,7 +5855,7 @@ function parseBunCheckOutput(stdout, cwd) {
5679
5855
  const [, path, lineNumber, column, severity, code, message] = match;
5680
5856
  const start = { line: Number(lineNumber) - 1, character: Number(column) - 1 };
5681
5857
  results.push({
5682
- file: resolve10(cwd, path ?? ""),
5858
+ file: resolve11(cwd, path ?? ""),
5683
5859
  diagnostic: {
5684
5860
  range: { start, end: start },
5685
5861
  severity: TSC_SEVERITY[severity ?? "error"] ?? 1,
@@ -5738,9 +5914,9 @@ function parseBunLintJson(stdout) {
5738
5914
 
5739
5915
  // ../lsp-core/src/lsp/bun-project-checks.ts
5740
5916
  import { spawn as spawn3 } from "node:child_process";
5741
- import { existsSync as existsSync13, mkdtempSync, readFileSync as readFileSync6, rmSync as rmSync2, statSync as statSync5, writeFileSync as writeFileSync3 } from "node:fs";
5917
+ import { existsSync as existsSync14, mkdtempSync, readFileSync as readFileSync6, rmSync as rmSync2, statSync as statSync6, writeFileSync as writeFileSync3 } from "node:fs";
5742
5918
  import { homedir as homedir3, tmpdir as tmpdir2 } from "node:os";
5743
- import { dirname as dirname11, join as join8, resolve as resolve11 } from "node:path";
5919
+ import { dirname as dirname13, join as join9, resolve as resolve12 } from "node:path";
5744
5920
  var BUN_LOCKFILES = ["bun.lock", "bun.lockb", "bunfig.toml"];
5745
5921
  var RUNNABLE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".cts", ".cjs", ".js", ".mjs", ".mts"];
5746
5922
  var BIN_SUFFIXES = process.platform === "win32" ? [".exe", ".bunx", ".cmd", ""] : [""];
@@ -5749,18 +5925,18 @@ var UNFORMATTED_PROBE = `const a=1
5749
5925
  `;
5750
5926
  var probeCache = new Map;
5751
5927
  function findBunProjectRoot(start, home = homedir3()) {
5752
- const stopAt = resolve11(home);
5753
- let dir = resolve11(start);
5928
+ const stopAt = resolve12(home);
5929
+ let dir = resolve12(start);
5754
5930
  for (;; ) {
5755
5931
  if (dir === stopAt)
5756
5932
  return;
5757
- if (BUN_LOCKFILES.some((name) => existsSync13(join8(dir, name))))
5933
+ if (BUN_LOCKFILES.some((name) => existsSync14(join9(dir, name))))
5758
5934
  return dir;
5759
- if (packageManagerIsBun(join8(dir, "package.json")))
5935
+ if (packageManagerIsBun(join9(dir, "package.json")))
5760
5936
  return dir;
5761
- if (existsSync13(join8(dir, ".git")))
5937
+ if (existsSync14(join9(dir, ".git")))
5762
5938
  return;
5763
- const parent = dirname11(dir);
5939
+ const parent = dirname13(dir);
5764
5940
  if (parent === dir)
5765
5941
  return;
5766
5942
  dir = parent;
@@ -5772,7 +5948,7 @@ function packageManagerIsBun(packageJsonPath) {
5772
5948
  return typeof packageManager === "string" && packageManager.startsWith("bun@");
5773
5949
  }
5774
5950
  function readJsonObject(path) {
5775
- if (!existsSync13(path))
5951
+ if (!existsSync14(path))
5776
5952
  return;
5777
5953
  try {
5778
5954
  const parsed = JSON.parse(readFileSync6(path, "utf8"));
@@ -5783,14 +5959,14 @@ function readJsonObject(path) {
5783
5959
  }
5784
5960
  function isFile(path) {
5785
5961
  try {
5786
- return statSync5(path).isFile();
5962
+ return statSync6(path).isFile();
5787
5963
  } catch {
5788
5964
  return false;
5789
5965
  }
5790
5966
  }
5791
5967
  function isDirectory(path) {
5792
5968
  try {
5793
- return statSync5(path).isDirectory();
5969
+ return statSync6(path).isDirectory();
5794
5970
  } catch {
5795
5971
  return false;
5796
5972
  }
@@ -5798,35 +5974,35 @@ function isDirectory(path) {
5798
5974
  function projectShadowsBunCommand(command, cwd) {
5799
5975
  const packageJsonDir = nearestPackageJsonDir(cwd);
5800
5976
  if (packageJsonDir !== undefined) {
5801
- const scripts = readJsonObject(join8(packageJsonDir, "package.json"))?.["scripts"];
5977
+ const scripts = readJsonObject(join9(packageJsonDir, "package.json"))?.["scripts"];
5802
5978
  if (scripts !== null && typeof scripts === "object" && typeof scripts[command] === "string") {
5803
5979
  return true;
5804
5980
  }
5805
5981
  }
5806
5982
  if (command === "check")
5807
5983
  return false;
5808
- const base = join8(cwd, command);
5984
+ const base = join9(cwd, command);
5809
5985
  if (isFile(base) || RUNNABLE_EXTENSIONS.some((extension) => isFile(`${base}${extension}`)))
5810
5986
  return true;
5811
- if (isDirectory(base) && (isFile(join8(base, "package.json")) || RUNNABLE_EXTENSIONS.some((extension) => isFile(join8(base, `index${extension}`))))) {
5987
+ if (isDirectory(base) && (isFile(join9(base, "package.json")) || RUNNABLE_EXTENSIONS.some((extension) => isFile(join9(base, `index${extension}`))))) {
5812
5988
  return true;
5813
5989
  }
5814
- let dir = resolve11(cwd);
5990
+ let dir = resolve12(cwd);
5815
5991
  for (;; ) {
5816
- if (BIN_SUFFIXES.some((suffix) => existsSync13(join8(dir, "node_modules", ".bin", `${command}${suffix}`))))
5992
+ if (BIN_SUFFIXES.some((suffix) => existsSync14(join9(dir, "node_modules", ".bin", `${command}${suffix}`))))
5817
5993
  return true;
5818
- const parent = dirname11(dir);
5994
+ const parent = dirname13(dir);
5819
5995
  if (parent === dir)
5820
5996
  return false;
5821
5997
  dir = parent;
5822
5998
  }
5823
5999
  }
5824
6000
  function nearestPackageJsonDir(start) {
5825
- let dir = resolve11(start);
6001
+ let dir = resolve12(start);
5826
6002
  for (;; ) {
5827
- if (existsSync13(join8(dir, "package.json")))
6003
+ if (existsSync14(join9(dir, "package.json")))
5828
6004
  return dir;
5829
- const parent = dirname11(dir);
6005
+ const parent = dirname13(dir);
5830
6006
  if (parent === dir)
5831
6007
  return;
5832
6008
  dir = parent;
@@ -5834,7 +6010,7 @@ function nearestPackageJsonDir(start) {
5834
6010
  }
5835
6011
  function binaryIdentity(bunPath) {
5836
6012
  try {
5837
- const stats = statSync5(bunPath);
6013
+ const stats = statSync6(bunPath);
5838
6014
  return `${stats.mtimeMs}:${stats.size}`;
5839
6015
  } catch {
5840
6016
  return "missing";
@@ -5854,7 +6030,7 @@ function bunHasCommand(bunPath, command, timeoutMs = PROBE_TIMEOUT_MS2) {
5854
6030
  return probe;
5855
6031
  }
5856
6032
  async function probeOnce(bunPath, command, timeoutMs) {
5857
- const emptyDir = mkdtempSync(join8(tmpdir2(), "omo-bun-probe-"));
6033
+ const emptyDir = mkdtempSync(join9(tmpdir2(), "omo-bun-probe-"));
5858
6034
  const timeout = AbortSignal.timeout(timeoutMs);
5859
6035
  try {
5860
6036
  const help = await runBunCommand(bunPath, [command, "--help"], emptyDir, timeout);
@@ -5864,7 +6040,7 @@ async function probeOnce(bunPath, command, timeoutMs) {
5864
6040
  return false;
5865
6041
  if (command !== "format")
5866
6042
  return true;
5867
- const probeFile = join8(emptyDir, "probe.ts");
6043
+ const probeFile = join9(emptyDir, "probe.ts");
5868
6044
  writeFileSync3(probeFile, UNFORMATTED_PROBE);
5869
6045
  const write = await runBunCommand(bunPath, ["format", "--write", "probe.ts"], emptyDir, timeout);
5870
6046
  if (write.exitCode === null)
@@ -6809,9 +6985,9 @@ function currentRequestContext(env = process.env) {
6809
6985
  const home = env["HOME"] ?? homedir4();
6810
6986
  return parseLspRequestContext({
6811
6987
  cwd,
6812
- projectConfigPaths: [join9(cwd, ".codex", "lsp-client.json")],
6813
- userConfigPath: join9(home, ".codex", "lsp-client.json"),
6814
- installDecisionsPath: join9(home, ".codex", "lsp-install-decisions.json"),
6988
+ projectConfigPaths: [join10(cwd, ".codex", "lsp-client.json")],
6989
+ userConfigPath: join10(home, ".codex", "lsp-client.json"),
6990
+ installDecisionsPath: join10(home, ".codex", "lsp-install-decisions.json"),
6815
6991
  capabilities: { installDecisionTool: true }
6816
6992
  });
6817
6993
  }
@@ -6943,8 +7119,8 @@ function isRetryableTool(name) {
6943
7119
  return name !== "rename" && name !== "lsp_rename";
6944
7120
  }
6945
7121
  // src/proxy.ts
6946
- import { existsSync as existsSync14, realpathSync as realpathSync7 } from "node:fs";
6947
- import { basename as basename4, delimiter as delimiter4, dirname as dirname12, isAbsolute as isAbsolute6 } from "node:path";
7122
+ import { existsSync as existsSync15, realpathSync as realpathSync8 } from "node:fs";
7123
+ import { basename as basename4, delimiter as delimiter4, dirname as dirname14, isAbsolute as isAbsolute6 } from "node:path";
6948
7124
  var DEFAULT_STARTUP_TIMEOUT_MS = 1e4;
6949
7125
  async function runMcpStdioProxy(options = {}) {
6950
7126
  const input = options.input ?? process.stdin;
@@ -7067,18 +7243,18 @@ function canonicalizePathList(value) {
7067
7243
  return value.split(delimiter4).map((entry) => canonicalizePath(entry) ?? entry).join(delimiter4);
7068
7244
  }
7069
7245
  function canonicalizePath(value) {
7070
- if (value === undefined || !isAbsolute6(value) || !existsSync14(value))
7246
+ if (value === undefined || !isAbsolute6(value) || !existsSync15(value))
7071
7247
  return value;
7072
- return realpathSync7(value);
7248
+ return realpathSync8(value);
7073
7249
  }
7074
7250
  function projectRootFromOpenCodeConfigPath(path) {
7075
7251
  if (basename4(path) !== "lsp.json" && basename4(path) !== "lsp-client.json")
7076
7252
  return;
7077
- const configDir = dirname12(path);
7253
+ const configDir = dirname14(path);
7078
7254
  const configDirName = basename4(configDir);
7079
7255
  if (configDirName !== ".opencode" && configDirName !== ".omo")
7080
7256
  return;
7081
- return dirname12(configDir);
7257
+ return dirname14(configDir);
7082
7258
  }
7083
7259
  export {
7084
7260
  InvalidDaemonDirectoryError,