lazycodex-ai 5.0.0-beta.49 → 5.0.0-beta.50

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 (108) hide show
  1. package/dist/cli/index.js +4682 -14969
  2. package/dist/cli-node/index.js +4727 -15014
  3. package/package.json +1 -1
  4. package/packages/lsp-daemon/dist/cli.js +181 -181
  5. package/packages/lsp-daemon/dist/client.js +232 -232
  6. package/packages/lsp-daemon/dist/index.js +132 -132
  7. package/packages/lsp-tools-mcp/dist/cli.js +103 -101
  8. package/packages/lsp-tools-mcp/dist/lsp/manager.js +14 -14
  9. package/packages/lsp-tools-mcp/dist/mcp.js +129 -129
  10. package/packages/lsp-tools-mcp/dist/tools.js +47 -47
  11. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  12. package/packages/omo-codex/plugin/README.md +4 -0
  13. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +151 -102
  14. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  15. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  16. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  17. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  18. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  19. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  20. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/AGENTS.md +2 -2
  21. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/directive.md +2 -0
  22. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +35 -24
  23. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +31 -21
  24. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.d.ts +3 -0
  25. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  26. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  27. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +31 -23
  28. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/types.ts +3 -0
  29. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/cli.test.ts +1 -1
  30. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +133 -7
  31. package/packages/omo-codex/plugin/components/lcx/skills/lcx-doctor/SKILL.md +3 -1
  32. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
  33. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +298 -298
  34. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  35. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  36. package/packages/omo-codex/plugin/components/rules/README.md +2 -0
  37. package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-6.md +123 -0
  38. package/packages/omo-codex/plugin/components/rules/dist/cli.js +38 -30
  39. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  40. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  41. package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +6 -0
  42. package/packages/omo-codex/plugin/components/rules/test/hephaestus-model-variant.test.ts +38 -2
  43. package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +24 -0
  44. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  45. package/packages/omo-codex/plugin/components/teammode/package.json +2 -2
  46. package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +66 -357
  47. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +66 -358
  48. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  49. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  50. package/packages/omo-codex/plugin/components/ultrawork/README.md +2 -0
  51. package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
  52. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +1 -1
  53. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +1 -1
  54. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +1 -1
  55. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +1 -1
  56. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-high.toml +1 -1
  57. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-low.toml +1 -1
  58. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-medium.toml +1 -1
  59. package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +1 -1
  60. package/packages/omo-codex/plugin/components/ultrawork/agents/metis.toml +1 -1
  61. package/packages/omo-codex/plugin/components/ultrawork/agents/momus.toml +1 -1
  62. package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -1
  63. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  64. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  65. package/packages/omo-codex/plugin/components/ulw-execute-continuation/dist/cli.js +3 -3
  66. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
  67. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  68. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +63 -63
  69. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
  70. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  71. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  72. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  73. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  74. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  75. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  76. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  77. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  78. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
  79. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  80. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  81. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  82. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  83. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  84. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  85. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  86. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  87. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  88. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  89. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  90. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  91. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  92. package/packages/omo-codex/plugin/model-catalog.json +16 -7
  93. package/packages/omo-codex/plugin/package-lock.json +16 -16
  94. package/packages/omo-codex/plugin/package.json +1 -1
  95. package/packages/omo-codex/plugin/scripts/migrate-codex-config/catalog.mjs +16 -7
  96. package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +8 -4
  97. package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +18 -90
  98. package/packages/omo-codex/plugin/scripts/migrate-codex-config/toml-section-editor.mjs +1 -1
  99. package/packages/omo-codex/plugin/shared/package.json +1 -1
  100. package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +3 -1
  101. package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +12 -12
  102. package/packages/omo-codex/plugin/test/aggregate-model-catalog.test.mjs +14 -4
  103. package/packages/omo-codex/plugin/test/auto-update.test.mjs +4 -4
  104. package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +25 -1
  105. package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +35 -35
  106. package/packages/omo-codex/plugin/test/multi-agent-v2-regression.test.mjs +1 -1
  107. package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +107 -15
  108. package/packages/omo-codex/scripts/install-dist/install-local.mjs +318 -569
@@ -688,7 +688,7 @@ class JsonRpcConnection {
688
688
  let settled = false;
689
689
  const writeCancel = () => this.writeMessage({ jsonrpc: "2.0", method: "$/cancelRequest", params: { id } });
690
690
  let rejectAfterCancelWrite;
691
- const responsePromise = new Promise((resolve2, reject) => {
691
+ const responsePromise = new Promise((resolve, reject) => {
692
692
  const cleanup = () => {
693
693
  options.signal?.removeEventListener("abort", onAbort);
694
694
  };
@@ -718,7 +718,7 @@ class JsonRpcConnection {
718
718
  resolve(result) {
719
719
  settled = true;
720
720
  cleanup();
721
- resolve2(result);
721
+ resolve(result);
722
722
  },
723
723
  reject(error) {
724
724
  settled = true;
@@ -877,13 +877,13 @@ class JsonRpcConnection {
877
877
  const payload = `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
878
878
  \r
879
879
  ${body}`;
880
- return new Promise((resolve2, reject) => {
880
+ return new Promise((resolve, reject) => {
881
881
  this.writer.write(payload, (error) => {
882
882
  if (error) {
883
883
  reject(error);
884
884
  return;
885
885
  }
886
- resolve2();
886
+ resolve();
887
887
  });
888
888
  });
889
889
  }
@@ -970,9 +970,9 @@ function validateCwd(cwd) {
970
970
  }
971
971
  }
972
972
  function wrap(proc) {
973
- const exitedPromise = new Promise((resolve2) => {
974
- proc.once("close", (code) => resolve2(code ?? 0));
975
- proc.once("error", () => resolve2(1));
973
+ const exitedPromise = new Promise((resolve) => {
974
+ proc.once("close", (code) => resolve(code ?? 0));
975
+ proc.once("error", () => resolve(1));
976
976
  });
977
977
  if (!proc.stdin || !proc.stdout || !proc.stderr) {
978
978
  throw new LspProcessSpawnError("Spawned process is missing one of stdin/stdout/stderr pipes");
@@ -1134,9 +1134,9 @@ class LspClientNotStartedError extends Error {
1134
1134
  }
1135
1135
 
1136
1136
  class LspClientTransport {
1137
- constructor(root, server2, timeouts = {}) {
1137
+ constructor(root, server, timeouts = {}) {
1138
1138
  this.root = root;
1139
- this.server = server2;
1139
+ this.server = server;
1140
1140
  this.proc = null;
1141
1141
  this.connection = null;
1142
1142
  this.stderrBuffer = [];
@@ -1318,8 +1318,8 @@ class LspClientTransport {
1318
1318
  try {
1319
1319
  proc.kill();
1320
1320
  let timeoutId;
1321
- const timeoutPromise = new Promise((resolve2) => {
1322
- timeoutId = setTimeout(resolve2, STOP_HARD_KILL_TIMEOUT_MS);
1321
+ const timeoutPromise = new Promise((resolve) => {
1322
+ timeoutId = setTimeout(resolve, STOP_HARD_KILL_TIMEOUT_MS);
1323
1323
  });
1324
1324
  await Promise.race([
1325
1325
  proc.exited.then(() => {
@@ -1335,7 +1335,7 @@ class LspClientTransport {
1335
1335
  proc.kill("SIGKILL");
1336
1336
  await Promise.race([
1337
1337
  proc.exited,
1338
- new Promise((resolve2) => setTimeout(resolve2, STOP_SIGKILL_GRACE_MS))
1338
+ new Promise((resolve) => setTimeout(resolve, STOP_SIGKILL_GRACE_MS))
1339
1339
  ]);
1340
1340
  } catch (error) {
1341
1341
  reportBestEffortCleanupError("hard process kill", error instanceof Error ? error : String(error));
@@ -2329,14 +2329,14 @@ function parseSinglePathResource(input, kind) {
2329
2329
  return;
2330
2330
  }
2331
2331
  if (kind === "create") {
2332
- const options2 = parseOptions(change["options"], ["overwrite", "ignoreIfExists"], changeIndex);
2332
+ const options = parseOptions(change["options"], ["overwrite", "ignoreIfExists"], changeIndex);
2333
2333
  target.operations.push({
2334
2334
  kind,
2335
2335
  changeIndex,
2336
2336
  path: resolvedPath.path,
2337
2337
  reportedPath: resolvedPath.requestedPath,
2338
- overwrite: options2["overwrite"] ?? false,
2339
- ignoreIfExists: options2["ignoreIfExists"] ?? false,
2338
+ overwrite: options["overwrite"] ?? false,
2339
+ ignoreIfExists: options["ignoreIfExists"] ?? false,
2340
2340
  followedSymbolicLink: resolvedPath.followedSymbolicLink
2341
2341
  });
2342
2342
  return;
@@ -2806,11 +2806,11 @@ class PlanPathIndex {
2806
2806
  }
2807
2807
  }
2808
2808
  }
2809
- add(path, reportedPath2, changeIndex) {
2809
+ add(path, reportedPath, changeIndex) {
2810
2810
  if (!this.firstChangeByPath.has(path))
2811
2811
  this.firstChangeByPath.set(path, changeIndex);
2812
2812
  if (!this.reportedPathByCanonical.has(path))
2813
- this.reportedPathByCanonical.set(path, reportedPath2);
2813
+ this.reportedPathByCanonical.set(path, reportedPath);
2814
2814
  }
2815
2815
  }
2816
2816
  function fingerprintWorkspaceEdit(edit, workspaceRoot) {
@@ -2922,15 +2922,15 @@ class WorkspaceMutationController {
2922
2922
  };
2923
2923
  }
2924
2924
  lease.phase = "applying";
2925
- lease.applyCompletion = new Promise((resolve6) => {
2926
- lease.resolveApply = resolve6;
2925
+ lease.applyCompletion = new Promise((resolve) => {
2926
+ lease.resolveApply = resolve;
2927
2927
  });
2928
2928
  const edit = isRecord4(params) ? params["edit"] : undefined;
2929
- const record2 = edit === undefined ? { fingerprint: null, result: failure("workspace/applyEdit params.edit is required", 0) } : await this.applyEdit(edit, lease);
2930
- lease.serverApply = record2;
2929
+ const record = edit === undefined ? { fingerprint: null, result: failure("workspace/applyEdit params.edit is required", 0) } : await this.applyEdit(edit, lease);
2930
+ lease.serverApply = record;
2931
2931
  lease.phase = "settled";
2932
2932
  lease.resolveApply?.();
2933
- return responseFor(record2.result);
2933
+ return responseFor(record.result);
2934
2934
  }
2935
2935
  async reconcileRename(leaseToken, edit) {
2936
2936
  const lease = this.requireActiveLease(leaseToken);
@@ -2946,16 +2946,16 @@ class WorkspaceMutationController {
2946
2946
  const applied = await this.applyEdit(edit, lease);
2947
2947
  return { edit, apply: applied.result };
2948
2948
  }
2949
- reconcileServerApply(record2, edit) {
2949
+ reconcileServerApply(record, edit) {
2950
2950
  if (!edit)
2951
- return { edit, apply: record2.result };
2951
+ return { edit, apply: record.result };
2952
2952
  const fingerprint = fingerprintWorkspaceEdit(edit, this.workspaceRoot);
2953
- if (fingerprint.success && record2.fingerprint !== null && fingerprint.fingerprint === record2.fingerprint) {
2954
- return { edit, apply: record2.result };
2953
+ if (fingerprint.success && record.fingerprint !== null && fingerprint.fingerprint === record.fingerprint) {
2954
+ return { edit, apply: record.result };
2955
2955
  }
2956
2956
  return {
2957
2957
  edit,
2958
- apply: failure("rename result conflicts with server-applied workspace edit", 0, record2.result)
2958
+ apply: failure("rename result conflicts with server-applied workspace edit", 0, record.result)
2959
2959
  };
2960
2960
  }
2961
2961
  async applyEdit(edit, lease) {
@@ -2996,8 +2996,8 @@ var DIAGNOSTICS_FRESHNESS_TIMEOUT_MS = 3000;
2996
2996
  var VERSIONLESS_PUBLISH_QUIESCENCE_MS = 250;
2997
2997
 
2998
2998
  class LspClient extends LspClientConnection {
2999
- constructor(root, server2, options = {}) {
3000
- super(root, server2, options);
2999
+ constructor(root, server, options = {}) {
3000
+ super(root, server, options);
3001
3001
  this.diagnosticPullErrors = [];
3002
3002
  this.diagnosticsFreshnessTimeoutMs = options.diagnosticsFreshnessTimeoutMs ?? DIAGNOSTICS_FRESHNESS_TIMEOUT_MS;
3003
3003
  this.documents = new WorkspaceDocumentState((method, params) => this.sendNotification(method, params), (uri) => this.diagnosticsStore.delete(uri), {
@@ -3118,13 +3118,13 @@ class LspClient extends LspClientConnection {
3118
3118
  if (!pushFallbackOnly) {
3119
3119
  const cached = this.documents.getPullCache(snapshot);
3120
3120
  try {
3121
- const remainingMs2 = deadlineAt - this.timerProvider.now();
3122
- if (remainingMs2 <= 0)
3121
+ const remainingMs = deadlineAt - this.timerProvider.now();
3122
+ if (remainingMs <= 0)
3123
3123
  return this.freshnessTimeout(absPath);
3124
3124
  const result = await this.sendRequest("textDocument/diagnostic", {
3125
3125
  textDocument: { uri },
3126
3126
  ...cached?.resultId === undefined ? {} : { previousResultId: cached.resultId }
3127
- }, { timeoutMs: remainingMs2, ...signal === undefined ? {} : { signal } });
3127
+ }, { timeoutMs: remainingMs, ...signal === undefined ? {} : { signal } });
3128
3128
  if (!this.documents.isCurrentSnapshot(snapshot))
3129
3129
  continue;
3130
3130
  const report = this.parseDiagnosticPullReport(result);
@@ -3205,7 +3205,7 @@ function waitForDiagnosticsActivity(wait, signal) {
3205
3205
  return wait;
3206
3206
  if (signal.aborted)
3207
3207
  return Promise.reject(abortError2(signal));
3208
- return new Promise((resolve7, reject) => {
3208
+ return new Promise((resolve, reject) => {
3209
3209
  const onAbort = () => {
3210
3210
  signal.removeEventListener("abort", onAbort);
3211
3211
  reject(abortError2(signal));
@@ -3213,7 +3213,7 @@ function waitForDiagnosticsActivity(wait, signal) {
3213
3213
  signal.addEventListener("abort", onAbort, { once: true });
3214
3214
  wait.then(() => {
3215
3215
  signal.removeEventListener("abort", onAbort);
3216
- resolve7();
3216
+ resolve();
3217
3217
  }, (error) => {
3218
3218
  signal.removeEventListener("abort", onAbort);
3219
3219
  reject(error);
@@ -3281,7 +3281,7 @@ async function stopClientBestEffort(client) {
3281
3281
  function awaitWithSignal(promise, signal) {
3282
3282
  if (!signal)
3283
3283
  return promise;
3284
- return new Promise((resolve7, reject) => {
3284
+ return new Promise((resolve, reject) => {
3285
3285
  let settled = false;
3286
3286
  const onAbort = () => {
3287
3287
  if (settled)
@@ -3299,7 +3299,7 @@ function awaitWithSignal(promise, signal) {
3299
3299
  return;
3300
3300
  settled = true;
3301
3301
  signal.removeEventListener("abort", onAbort);
3302
- resolve7(value);
3302
+ resolve(value);
3303
3303
  }, (err) => {
3304
3304
  if (settled)
3305
3305
  return;
@@ -3322,7 +3322,7 @@ class LspManager {
3322
3322
  this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
3323
3323
  this.maxResidentClients = options.maxResidentClients ?? MAX_RESIDENT_CLIENTS;
3324
3324
  this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
3325
- this.clientFactory = options.clientFactory ?? ((root, server2) => new LspClient(root, server2));
3325
+ this.clientFactory = options.clientFactory ?? ((root, server) => new LspClient(root, server));
3326
3326
  this.now = options.now ?? (() => Date.now());
3327
3327
  this.startReaper();
3328
3328
  this.signalDisposer = installProcessSignalCleanup(() => this.stopAll());
@@ -3415,12 +3415,12 @@ class LspManager {
3415
3415
  await this.tombstoneStop(key, managed.client);
3416
3416
  }
3417
3417
  }
3418
- async getClient(root, server2, signal) {
3418
+ async getClient(root, server, signal) {
3419
3419
  if (this.disposed) {
3420
3420
  throw new Error("LspManager has been disposed");
3421
3421
  }
3422
3422
  signal?.throwIfAborted();
3423
- const key = this.getKey(root, server2.id);
3423
+ const key = this.getKey(root, server.id);
3424
3424
  for (;; ) {
3425
3425
  const pendingStop = this.pendingStops.get(key);
3426
3426
  if (pendingStop === undefined)
@@ -3462,7 +3462,7 @@ class LspManager {
3462
3462
  this.clients.delete(key);
3463
3463
  }
3464
3464
  await this.tombstoneStop(key, managed.client);
3465
- return this.getClient(root, server2, signal);
3465
+ return this.getClient(root, server, signal);
3466
3466
  }
3467
3467
  this.markHealthyGeneration(key);
3468
3468
  managed.refCount++;
@@ -3470,8 +3470,8 @@ class LspManager {
3470
3470
  return managed.client;
3471
3471
  }
3472
3472
  this.evictForAdmission();
3473
- this.ensureRespawnAllowed(key, root, server2.id);
3474
- const client = this.clientFactory(root, server2);
3473
+ this.ensureRespawnAllowed(key, root, server.id);
3474
+ const client = this.clientFactory(root, server);
3475
3475
  const initStartedAt = this.now();
3476
3476
  const initPromise = (async () => {
3477
3477
  await client.start();
@@ -3511,7 +3511,7 @@ class LspManager {
3511
3511
  this.clients.delete(key);
3512
3512
  }
3513
3513
  await this.tombstoneStop(key, client);
3514
- return this.getClient(root, server2, signal);
3514
+ return this.getClient(root, server, signal);
3515
3515
  }
3516
3516
  this.markHealthyGeneration(key);
3517
3517
  newManaged.refCount++;
@@ -3536,19 +3536,19 @@ class LspManager {
3536
3536
  this.clients.delete(key);
3537
3537
  this.tombstoneStop(key, managed.client);
3538
3538
  }
3539
- warmupClient(root, server2) {
3539
+ warmupClient(root, server) {
3540
3540
  if (this.disposed)
3541
3541
  return;
3542
- const key = this.getKey(root, server2.id);
3542
+ const key = this.getKey(root, server.id);
3543
3543
  if (this.clients.has(key) || this.pendingStops.has(key))
3544
3544
  return;
3545
3545
  this.evictForAdmission();
3546
3546
  try {
3547
- this.ensureRespawnAllowed(key, root, server2.id);
3547
+ this.ensureRespawnAllowed(key, root, server.id);
3548
3548
  } catch {
3549
3549
  return;
3550
3550
  }
3551
- const client = this.clientFactory(root, server2);
3551
+ const client = this.clientFactory(root, server);
3552
3552
  const initStartedAt = this.now();
3553
3553
  const initPromise = (async () => {
3554
3554
  await client.start();
@@ -3956,10 +3956,10 @@ function getMergedServers() {
3956
3956
  }
3957
3957
  if (seen.has(id))
3958
3958
  continue;
3959
- const server2 = createServerFromEntry(id, entry, source);
3960
- if (!server2)
3959
+ const server = createServerFromEntry(id, entry, source);
3960
+ if (!server)
3961
3961
  continue;
3962
- servers.push(server2);
3962
+ servers.push(server);
3963
3963
  seen.add(id);
3964
3964
  }
3965
3965
  }
@@ -3991,7 +3991,7 @@ function createServerFromEntry(id, entry, source) {
3991
3991
  if (source === "project") {
3992
3992
  if (!builtin)
3993
3993
  return null;
3994
- const server3 = createServer({
3994
+ const server = createServer({
3995
3995
  id,
3996
3996
  command: builtin.command,
3997
3997
  extensions: entry.extensions ?? builtin.extensions,
@@ -3999,35 +3999,35 @@ function createServerFromEntry(id, entry, source) {
3999
3999
  source
4000
4000
  });
4001
4001
  if (entry.initialization !== undefined) {
4002
- server3.initialization = entry.initialization;
4002
+ server.initialization = entry.initialization;
4003
4003
  }
4004
- return server3;
4004
+ return server;
4005
4005
  }
4006
4006
  if (entry.command && entry.extensions) {
4007
- const server3 = createServer({
4007
+ const server = createServer({
4008
4008
  id,
4009
4009
  command: entry.command,
4010
4010
  extensions: entry.extensions,
4011
4011
  priority: entry.priority ?? 0,
4012
4012
  source
4013
4013
  });
4014
- applyOptionalServerFields(server3, entry);
4015
- return server3;
4014
+ applyOptionalServerFields(server, entry);
4015
+ return server;
4016
4016
  }
4017
4017
  if (!builtin)
4018
4018
  return null;
4019
- const server2 = createServer({
4019
+ const server = createServer({
4020
4020
  id,
4021
4021
  command: entry.command ?? builtin.command,
4022
4022
  extensions: entry.extensions ?? builtin.extensions,
4023
4023
  priority: entry.priority ?? 0,
4024
4024
  source
4025
4025
  });
4026
- applyOptionalServerFields(server2, entry);
4027
- return server2;
4026
+ applyOptionalServerFields(server, entry);
4027
+ return server;
4028
4028
  }
4029
4029
  function createServer(input) {
4030
- const server2 = {
4030
+ const server = {
4031
4031
  id: input.id,
4032
4032
  command: input.command,
4033
4033
  extensions: input.extensions,
@@ -4035,19 +4035,19 @@ function createServer(input) {
4035
4035
  source: input.source
4036
4036
  };
4037
4037
  if (input.env !== undefined) {
4038
- server2.env = input.env;
4038
+ server.env = input.env;
4039
4039
  }
4040
4040
  if (input.initialization !== undefined) {
4041
- server2.initialization = input.initialization;
4041
+ server.initialization = input.initialization;
4042
4042
  }
4043
- return server2;
4043
+ return server;
4044
4044
  }
4045
- function applyOptionalServerFields(server2, entry) {
4045
+ function applyOptionalServerFields(server, entry) {
4046
4046
  if (entry.env !== undefined) {
4047
- server2.env = entry.env;
4047
+ server.env = entry.env;
4048
4048
  }
4049
4049
  if (entry.initialization !== undefined) {
4050
- server2.initialization = entry.initialization;
4050
+ server.initialization = entry.initialization;
4051
4051
  }
4052
4052
  }
4053
4053
  function isConfigJson(value) {
@@ -4238,24 +4238,24 @@ function withResolvedCommand(command, binaryPath) {
4238
4238
  function findServerForExtension(ext) {
4239
4239
  const servers = getMergedServers();
4240
4240
  const workingDirectory = contextCwd();
4241
- for (const server2 of servers) {
4242
- if (!server2.extensions.includes(ext))
4241
+ for (const server of servers) {
4242
+ if (!server.extensions.includes(ext))
4243
4243
  continue;
4244
- const binaryPath = resolveServerBinary(server2.command, workingDirectory);
4244
+ const binaryPath = resolveServerBinary(server.command, workingDirectory);
4245
4245
  if (binaryPath !== null) {
4246
4246
  const resolvedServer = {
4247
- id: server2.id,
4248
- command: withResolvedCommand(server2.command, binaryPath),
4249
- extensions: server2.extensions,
4250
- priority: server2.priority
4247
+ id: server.id,
4248
+ command: withResolvedCommand(server.command, binaryPath),
4249
+ extensions: server.extensions,
4250
+ priority: server.priority
4251
4251
  };
4252
- if (server2.env !== undefined) {
4252
+ if (server.env !== undefined) {
4253
4253
  return {
4254
4254
  status: "found",
4255
4255
  server: {
4256
4256
  ...resolvedServer,
4257
- env: server2.env,
4258
- ...server2.initialization === undefined ? {} : { initialization: server2.initialization }
4257
+ env: server.env,
4258
+ ...server.initialization === undefined ? {} : { initialization: server.initialization }
4259
4259
  }
4260
4260
  };
4261
4261
  }
@@ -4263,20 +4263,20 @@ function findServerForExtension(ext) {
4263
4263
  status: "found",
4264
4264
  server: {
4265
4265
  ...resolvedServer,
4266
- ...server2.initialization === undefined ? {} : { initialization: server2.initialization }
4266
+ ...server.initialization === undefined ? {} : { initialization: server.initialization }
4267
4267
  }
4268
4268
  };
4269
4269
  }
4270
4270
  }
4271
- for (const server2 of servers) {
4272
- if (server2.extensions.includes(ext)) {
4273
- const installHint = LSP_INSTALL_HINTS[server2.id] ?? `Install '${server2.command[0]}' and ensure it's in your PATH`;
4271
+ for (const server of servers) {
4272
+ if (server.extensions.includes(ext)) {
4273
+ const installHint = LSP_INSTALL_HINTS[server.id] ?? `Install '${server.command[0]}' and ensure it's in your PATH`;
4274
4274
  return {
4275
4275
  status: "not_installed",
4276
4276
  server: {
4277
- id: server2.id,
4278
- command: server2.command,
4279
- extensions: server2.extensions
4277
+ id: server.id,
4278
+ command: server.command,
4279
+ extensions: server.extensions
4280
4280
  },
4281
4281
  installHint
4282
4282
  };
@@ -4295,18 +4295,18 @@ function getAllServers() {
4295
4295
  const workingDirectory = contextCwd();
4296
4296
  const result = [];
4297
4297
  const seen = new Set;
4298
- for (const server2 of servers) {
4299
- if (seen.has(server2.id))
4298
+ for (const server of servers) {
4299
+ if (seen.has(server.id))
4300
4300
  continue;
4301
4301
  result.push({
4302
- id: server2.id,
4303
- installed: isServerInstalled(server2.command, workingDirectory),
4304
- extensions: server2.extensions,
4302
+ id: server.id,
4303
+ installed: isServerInstalled(server.command, workingDirectory),
4304
+ extensions: server.extensions,
4305
4305
  disabled: false,
4306
- source: server2.source,
4307
- priority: server2.priority
4306
+ source: server.source,
4307
+ priority: server.priority
4308
4308
  });
4309
- seen.add(server2.id);
4309
+ seen.add(server.id);
4310
4310
  }
4311
4311
  for (const id of disabled) {
4312
4312
  if (seen.has(id))
@@ -4454,20 +4454,20 @@ function formatInstallOptions(serverId, installHint) {
4454
4454
  ];
4455
4455
  }
4456
4456
  function formatNotInstalled(result) {
4457
- const { server: server2, installHint } = result;
4458
- const extensions = server2.extensions.join(", ");
4459
- const decision = loadInstallDecision(server2.id)?.decision;
4457
+ const { server, installHint } = result;
4458
+ const extensions = server.extensions.join(", ");
4459
+ const decision = loadInstallDecision(server.id)?.decision;
4460
4460
  const context = lspRequestContext();
4461
4461
  if (decision === "declined") {
4462
- return `LSP server '${server2.id}' (${extensions}) is NOT INSTALLED; user previously declined installation — proceed without LSP.`;
4462
+ return `LSP server '${server.id}' (${extensions}) is NOT INSTALLED; user previously declined installation — proceed without LSP.`;
4463
4463
  }
4464
4464
  const header = [
4465
- `LSP server '${server2.id}' for ${extensions} is NOT INSTALLED.`,
4465
+ `LSP server '${server.id}' for ${extensions} is NOT INSTALLED.`,
4466
4466
  "",
4467
- `Command not found: ${server2.command[0]}`,
4467
+ `Command not found: ${server.command[0]}`,
4468
4468
  ""
4469
4469
  ];
4470
- const installOptions = formatInstallOptions(server2.id, installHint);
4470
+ const installOptions = formatInstallOptions(server.id, installHint);
4471
4471
  if (decision === "allowed") {
4472
4472
  return [
4473
4473
  ...header,
@@ -4493,7 +4493,7 @@ function formatNotInstalled(result) {
4493
4493
  "ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
4494
4494
  "- If the user agrees: run the install command above, then retry this tool.",
4495
4495
  "- If the user declines, OR has NOT explicitly asked for LSP installation:",
4496
- ` call lsp_install_decision { server_id: "${server2.id}", decision: "declined" },`,
4496
+ ` call lsp_install_decision { server_id: "${server.id}", decision: "declined" },`,
4497
4497
  ` which writes to ${context.installDecisionsPath},`,
4498
4498
  " then ignore this message and proceed WITHOUT LSP."
4499
4499
  ].join(`
@@ -4517,26 +4517,26 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
4517
4517
  if (result.status !== "found") {
4518
4518
  throw new LspServerLookupError(formatServerLookupError(result), result);
4519
4519
  }
4520
- const server2 = result.server;
4520
+ const server = result.server;
4521
4521
  const root = findWorkspaceRoot(absPath);
4522
4522
  const manager = options.manager ?? getLspManager();
4523
4523
  const acquireAndCall = async (allowRetry) => {
4524
- const client = await manager.getClient(root, server2, options.signal);
4524
+ const client = await manager.getClient(root, server, options.signal);
4525
4525
  try {
4526
4526
  return await fn(client, root, absPath);
4527
4527
  } catch (err) {
4528
4528
  if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
4529
- manager.invalidateClient(root, server2.id, client);
4529
+ manager.invalidateClient(root, server.id, client);
4530
4530
  return acquireAndCall(false);
4531
4531
  }
4532
4532
  if (err instanceof LspRequestTimeoutError) {
4533
- if (manager.isServerInitializing(root, server2.id)) {
4533
+ if (manager.isServerInitializing(root, server.id)) {
4534
4534
  throw new LspServerInitializingError(err);
4535
4535
  }
4536
4536
  }
4537
4537
  throw err;
4538
4538
  } finally {
4539
- manager.releaseClient(root, server2.id);
4539
+ manager.releaseClient(root, server.id);
4540
4540
  }
4541
4541
  };
4542
4542
  return acquireAndCall(true);
@@ -4559,10 +4559,10 @@ function uriToPath(uri) {
4559
4559
  }
4560
4560
  function formatLocation(loc) {
4561
4561
  if ("targetUri" in loc) {
4562
- const uri2 = uriToPath(loc.targetUri);
4563
- const line2 = loc.targetRange.start.line + 1;
4564
- const char2 = loc.targetRange.start.character;
4565
- return `${uri2}:${line2}:${char2}`;
4562
+ const uri = uriToPath(loc.targetUri);
4563
+ const line = loc.targetRange.start.line + 1;
4564
+ const char = loc.targetRange.start.character;
4565
+ return `${uri}:${line}:${char}`;
4566
4566
  }
4567
4567
  const uri = uriToPath(loc.uri);
4568
4568
  const line = loc.range.start.line + 1;
@@ -4707,7 +4707,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
4707
4707
  if (serverResult.status !== "found") {
4708
4708
  throw new LspServerLookupError(formatServerLookupError(serverResult));
4709
4709
  }
4710
- const server2 = serverResult.server;
4710
+ const server = serverResult.server;
4711
4711
  const allFiles = (options.listFiles ?? collectFilesWithExtension)(absDir, extension, maxFiles + 1);
4712
4712
  const wasCapped = allFiles.length > maxFiles;
4713
4713
  const filesToProcess = allFiles.slice(0, maxFiles);
@@ -4727,7 +4727,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
4727
4727
  const fileErrors = [];
4728
4728
  const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
4729
4729
  options.signal?.throwIfAborted();
4730
- const client = await manager.getClient(root, server2, options.signal);
4730
+ const client = await manager.getClient(root, server, options.signal);
4731
4731
  try {
4732
4732
  let nextIndex = 0;
4733
4733
  const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
@@ -4755,7 +4755,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
4755
4755
  });
4756
4756
  await Promise.all(workers);
4757
4757
  } finally {
4758
- manager.releaseClient(root, server2.id);
4758
+ manager.releaseClient(root, server.id);
4759
4759
  }
4760
4760
  const displayDiagnostics = allDiagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
4761
4761
  const wasDiagCapped = allDiagnostics.length > DEFAULT_MAX_DIAGNOSTICS;
@@ -4964,8 +4964,8 @@ function clientOptions(signal) {
4964
4964
  }
4965
4965
 
4966
4966
  // ../lsp-core/src/tools/result.ts
4967
- function text(text2, details, isError = false) {
4968
- return { content: [{ type: "text", text: text2 }], details, isError };
4967
+ function text(text, details, isError = false) {
4968
+ return { content: [{ type: "text", text }], details, isError };
4969
4969
  }
4970
4970
 
4971
4971
  // ../lsp-core/src/tools/diagnostics.ts
@@ -4985,7 +4985,7 @@ async function executeLspDiagnostics(params, signal) {
4985
4985
  const extension = inferExtensionFromDirectory(absPath);
4986
4986
  if (!extension) {
4987
4987
  const message = `No supported source files found in directory: ${absPath}`;
4988
- const details3 = {
4988
+ const details = {
4989
4989
  filePath,
4990
4990
  severity,
4991
4991
  mode: "directory",
@@ -4995,24 +4995,24 @@ async function executeLspDiagnostics(params, signal) {
4995
4995
  error: message,
4996
4996
  errorKind: "no_files"
4997
4997
  };
4998
- return text(message, details3);
4998
+ return text(message, details);
4999
4999
  }
5000
- const output2 = await aggregateDiagnosticsForDirectory(absPath, extension, severity, undefined, signal === undefined ? {} : { signal });
5001
- const details2 = {
5000
+ const output = await aggregateDiagnosticsForDirectory(absPath, extension, severity, undefined, signal === undefined ? {} : { signal });
5001
+ const details = {
5002
5002
  filePath,
5003
5003
  severity,
5004
5004
  mode: "directory",
5005
5005
  diagnostics: [],
5006
- totalDiagnostics: output2.totalDiagnostics,
5006
+ totalDiagnostics: output.totalDiagnostics,
5007
5007
  truncated: false,
5008
- fileFailures: [...output2.fileFailures]
5008
+ fileFailures: [...output.fileFailures]
5009
5009
  };
5010
- return text(output2.output, details2);
5010
+ return text(output.output, details);
5011
5011
  }
5012
5012
  const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
5013
5013
  if (result.transientError) {
5014
5014
  const message = result.transientError.message;
5015
- const details2 = {
5015
+ const details = {
5016
5016
  filePath,
5017
5017
  severity,
5018
5018
  mode: "file",
@@ -5022,7 +5022,7 @@ async function executeLspDiagnostics(params, signal) {
5022
5022
  error: message,
5023
5023
  errorKind: result.transientError.kind
5024
5024
  };
5025
- return text(message, details2, true);
5025
+ return text(message, details, true);
5026
5026
  }
5027
5027
  const diagnostics = filterDiagnosticsBySeverity(asDiagnosticArray(result), severity);
5028
5028
  const total = diagnostics.length;
@@ -5153,7 +5153,7 @@ async function executeLspInstallDecision(params) {
5153
5153
  if (!isInstallDecision(decision)) {
5154
5154
  return text(`Invalid decision '${String(decision)}'. Expected "declined" or "allowed".`, { serverId, errorKind: "invalid_decision" }, true);
5155
5155
  }
5156
- const serverIds = [...new Set(getMergedServers().map((server2) => server2.id))];
5156
+ const serverIds = [...new Set(getMergedServers().map((server) => server.id))];
5157
5157
  if (!serverIds.includes(serverId)) {
5158
5158
  const preview = serverIds.slice(0, 20).join(", ");
5159
5159
  return text(`Unknown LSP server '${serverId}'. Known servers: ${preview}${serverIds.length > 20 ? "..." : ""}`, { serverId, errorKind: "unknown_server" }, true);
@@ -5293,10 +5293,10 @@ function objectSchema(properties, required = []) {
5293
5293
  async function executeLspStatus() {
5294
5294
  const servers = getAllServers();
5295
5295
  const snapshots = getLspManager().getSnapshot();
5296
- const installed = servers.filter((server2) => server2.installed && !server2.disabled);
5297
- const configuredLines = servers.map((server2) => {
5298
- const state = server2.disabled ? "disabled" : server2.installed ? "installed" : "missing";
5299
- return `- ${server2.id}: ${state}; source=${server2.source}; extensions=${server2.extensions.join(", ")}`;
5296
+ const installed = servers.filter((server) => server.installed && !server.disabled);
5297
+ const configuredLines = servers.map((server) => {
5298
+ const state = server.disabled ? "disabled" : server.installed ? "installed" : "missing";
5299
+ return `- ${server.id}: ${state}; source=${server.source}; extensions=${server.extensions.join(", ")}`;
5300
5300
  });
5301
5301
  const activeLines = snapshots.map((snapshot) => {
5302
5302
  const state = snapshot.alive ? snapshot.isInitializing ? "initializing" : "alive" : "dead";
@@ -5339,8 +5339,8 @@ async function executeLspSymbols(params, signal) {
5339
5339
  errorKind: "missing_query"
5340
5340
  });
5341
5341
  }
5342
- const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
5343
- return formatSymbolsResult(filePath, scope, symbols2, limit, query);
5342
+ const symbols = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
5343
+ return formatSymbolsResult(filePath, scope, symbols, limit, query);
5344
5344
  }
5345
5345
  const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
5346
5346
  return formatSymbolsResult(filePath, scope, symbols, limit);