oh-my-opencode 5.0.0-beta.1 → 5.0.0-beta.11

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 (202) hide show
  1. package/.agents/command/publish.md +44 -16
  2. package/.agents/skills/publish/SKILL.md +44 -16
  3. package/.agents/skills/work-with-pr/SKILL.md +37 -23
  4. package/.opencode/command/publish.md +44 -16
  5. package/.opencode/skills/work-with-pr/SKILL.md +37 -23
  6. package/README.md +12 -1
  7. package/dist/agents/atlas/agent.d.ts +0 -1
  8. package/dist/agents/sisyphus/grok-4.d.ts +20 -0
  9. package/dist/agents/sisyphus/index.d.ts +2 -0
  10. package/dist/agents/sisyphus-agent-config.d.ts +6 -0
  11. package/dist/agents/sisyphus-agent-factory.d.ts +1 -1
  12. package/dist/agents/sisyphus-runtime-prompt-reconciler.d.ts +15 -4
  13. package/dist/agents/types.d.ts +2 -2
  14. package/dist/cli/index.js +805 -534
  15. package/dist/cli/run/on-complete-hook.d.ts +2 -0
  16. package/dist/cli-node/index.js +805 -534
  17. package/dist/hooks/atlas/final-wave-approval-gate.test-support.d.ts +50 -0
  18. package/dist/hooks/atlas/system-reminder-templates.d.ts +0 -1
  19. package/dist/index.js +1566 -1217
  20. package/dist/shared/normalize-sdk-response.d.ts +1 -0
  21. package/dist/shared/shell-env.d.ts +1 -1
  22. package/dist/skills/coding-agent-sessions/SKILL.md +3 -2
  23. package/dist/skills/coding-agent-sessions/references/all-platforms.md +1 -1
  24. package/dist/skills/coding-agent-sessions/references/senpi.md +4 -4
  25. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
  26. package/dist/skills/frontend/SKILL.md +10 -7
  27. package/dist/skills/frontend/references/design/_INDEX.md +1 -0
  28. package/dist/skills/frontend/references/design/stylegallery.md +80 -0
  29. package/dist/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
  30. package/dist/skills/ultimate-browsing/engine/AGENTS.md +179 -0
  31. package/dist/skills/ultimate-browsing/engine/templates/package.json +1 -1
  32. package/dist/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
  33. package/dist/skills/ulw-plan/SKILL.md +2 -2
  34. package/dist/skills/ulw-plan/references/full-workflow.md +27 -3
  35. package/dist/skills/ulw-plan/references/intent-clear.md +2 -1
  36. package/dist/skills/ulw-plan/references/intent-unclear.md +3 -3
  37. package/dist/tools/delegate-task/builtin-categories.d.ts +1 -0
  38. package/dist/tools/delegate-task/builtin-category-definition.d.ts +1 -0
  39. package/dist/tools/delegate-task/tool-description.d.ts +3 -1
  40. package/dist/tui.js +184 -83
  41. package/package.json +21 -19
  42. package/packages/lsp-core/src/lsp/client-diagnostics-concurrency.integration.test.ts +44 -0
  43. package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +0 -28
  44. package/packages/lsp-core/src/lsp/client-wrapper-outside-cwd.test.ts +78 -0
  45. package/packages/lsp-core/src/lsp/client-wrapper.test.ts +66 -13
  46. package/packages/lsp-core/src/lsp/client-wrapper.ts +70 -18
  47. package/packages/lsp-core/src/lsp/outside-context-workspace.ts +33 -0
  48. package/packages/lsp-core/src/lsp/workspace-edit-adversarial.test.ts +20 -1
  49. package/packages/lsp-core/src/lsp/workspace-markers.ts +1 -0
  50. package/packages/lsp-core/src/tools/diagnostics.ts +3 -3
  51. package/packages/lsp-core/src/tools/navigation.ts +4 -2
  52. package/packages/lsp-core/src/tools/rename.ts +4 -2
  53. package/packages/lsp-core/src/tools/symbols.ts +1 -1
  54. package/packages/lsp-daemon/dist/cli.js +160 -71
  55. package/packages/lsp-daemon/dist/client.js +135 -46
  56. package/packages/lsp-daemon/dist/index.js +143 -54
  57. package/packages/lsp-tools-mcp/dist/cli.js +131 -42
  58. package/packages/lsp-tools-mcp/dist/mcp.js +131 -42
  59. package/packages/lsp-tools-mcp/dist/tools.js +131 -42
  60. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  61. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  62. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  63. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +118 -8
  64. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +118 -8
  65. package/packages/omo-codex/plugin/components/codegraph/package.json +1 -1
  66. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  67. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  68. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  69. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  70. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  71. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  72. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +3 -17
  73. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +3 -3
  74. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +147 -64
  75. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  76. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  77. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  78. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  79. package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +11 -16
  80. package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +16 -23
  81. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +9 -7
  82. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +0 -6
  83. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +6 -4
  84. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +12 -9
  85. package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +28 -37
  86. package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +37 -69
  87. package/packages/omo-codex/plugin/components/rules/test/hook-output.test.ts +2 -3
  88. package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +1 -15
  89. package/packages/omo-codex/plugin/components/start-work-continuation/AGENTS.md +3 -2
  90. package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
  91. package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
  92. package/packages/omo-codex/plugin/components/start-work-continuation/test/cli.test.ts +0 -3
  93. package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +2 -16
  94. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  95. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  96. package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +3 -9
  97. package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +24 -12
  98. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +24 -12
  99. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  100. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  101. package/packages/omo-codex/plugin/components/ultrawork/directive.md +6 -0
  102. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  103. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  104. package/packages/omo-codex/plugin/components/ultrawork/skills/ultrawork/SKILL.md +6 -0
  105. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +2 -2
  106. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +27 -3
  107. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +2 -1
  108. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +3 -3
  109. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +0 -136
  110. package/packages/omo-codex/plugin/components/ultrawork/test/skill-pointer.test.ts +0 -2
  111. package/packages/omo-codex/plugin/components/ulw-loop/directive.md +6 -0
  112. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
  113. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  114. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +3 -2
  115. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/define-goal.md +108 -0
  116. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +1 -0
  117. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-continuation.test.ts +0 -1
  118. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +2 -2
  119. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +0 -3
  120. package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +2 -35
  121. package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +4 -5
  122. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  123. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  124. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  125. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +1 -1
  126. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  127. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  128. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  129. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  130. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  131. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  132. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  133. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  134. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  135. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +1 -1
  136. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  137. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  138. package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +1 -1
  139. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  140. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +1 -1
  141. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  142. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  143. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  144. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  145. package/packages/omo-codex/plugin/package-lock.json +20 -20
  146. package/packages/omo-codex/plugin/package.json +1 -1
  147. package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +3 -2
  148. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +1 -1
  149. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +4 -4
  150. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
  151. package/packages/omo-codex/plugin/skills/frontend/SKILL.md +10 -7
  152. package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +1 -0
  153. package/packages/omo-codex/plugin/skills/frontend/references/design/stylegallery.md +80 -0
  154. package/packages/omo-codex/plugin/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
  155. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/AGENTS.md +179 -0
  156. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/package.json +1 -1
  157. package/packages/omo-codex/plugin/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
  158. package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +6 -0
  159. package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +3 -2
  160. package/packages/omo-codex/plugin/skills/ulw-loop/references/define-goal.md +108 -0
  161. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -0
  162. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +2 -2
  163. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +27 -3
  164. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +2 -1
  165. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +3 -3
  166. package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +19 -173
  167. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +4 -24
  168. package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +175 -13
  169. package/packages/omo-codex/plugin/test/aggregate.test.mjs +78 -2
  170. package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +19 -33
  171. package/packages/omo-codex/plugin/test/lcx-contribute-bug-fix-template.test.mjs +21 -27
  172. package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +0 -36
  173. package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +101 -0
  174. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +1 -119
  175. package/packages/omo-codex/plugin/test/teammode-archive-ambiguity.test.mjs +0 -40
  176. package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +6 -62
  177. package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +3 -36
  178. package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +0 -44
  179. package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +2 -6
  180. package/packages/omo-codex/plugin/test/ultrawork-skill-pointer.test.mjs +0 -3
  181. package/packages/omo-codex/plugin/test/ulw-plan-review-state-contract.test.mjs +0 -3
  182. package/packages/omo-codex/scripts/install-dist/install-local.mjs +57 -19
  183. package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +7 -2
  184. package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +3 -2
  185. package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +1 -1
  186. package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +4 -4
  187. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
  188. package/packages/shared-skills/skills/frontend/SKILL.md +10 -7
  189. package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +1 -0
  190. package/packages/shared-skills/skills/frontend/references/design/stylegallery.md +80 -0
  191. package/packages/shared-skills/skills/ultimate-browsing/ATTRIBUTION.md +37 -10
  192. package/packages/shared-skills/skills/ultimate-browsing/engine/AGENTS.md +179 -0
  193. package/packages/shared-skills/skills/ultimate-browsing/engine/templates/package.json +1 -1
  194. package/packages/shared-skills/skills/ultimate-browsing/references/chrome-stealth.md +11 -11
  195. package/packages/shared-skills/skills/ulw-plan/SKILL.md +2 -2
  196. package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +27 -3
  197. package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +2 -1
  198. package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +3 -3
  199. package/dist/tools/call-omo-agent/background-agent-executor.d.ts +0 -5
  200. package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +0 -92
  201. package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +0 -314
  202. package/packages/omo-codex/plugin/test/ulw-plan-scope-contract.test.mjs +0 -24
@@ -306,8 +306,8 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
306
306
  };
307
307
  }
308
308
  // ../lsp-core/src/lsp/client-wrapper.ts
309
- import { existsSync as existsSync9, statSync as statSync3 } from "node:fs";
310
- import { dirname as dirname6, join as join4, resolve as resolve7 } from "node:path";
309
+ import { existsSync as existsSync10, realpathSync as realpathSync5, statSync as statSync3 } from "node:fs";
310
+ import { basename as basename3, dirname as dirname7, join as join5, resolve as resolve7 } from "node:path";
311
311
 
312
312
  // ../lsp-core/src/request-context.ts
313
313
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -3501,15 +3501,52 @@ async function disposeDefaultLspManager() {
3501
3501
  }
3502
3502
  }
3503
3503
 
3504
+ // ../lsp-core/src/lsp/outside-context-workspace.ts
3505
+ import { existsSync as existsSync6, realpathSync as realpathSync4 } from "node:fs";
3506
+ import { dirname as dirname5, join as join3 } from "node:path";
3507
+
3508
+ // ../lsp-core/src/lsp/workspace-markers.ts
3509
+ var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
3510
+
3511
+ // ../lsp-core/src/lsp/outside-context-workspace.ts
3512
+ function findWorkspaceRootOutsideContext(directory) {
3513
+ const marked = nearestMarkedAncestor(directory);
3514
+ if (marked !== undefined)
3515
+ return marked;
3516
+ return realpathSync4(nearestExistingAncestor(directory));
3517
+ }
3518
+ function nearestMarkedAncestor(directory) {
3519
+ let current = directory;
3520
+ for (;; ) {
3521
+ if (existsSync6(current) && WORKSPACE_MARKERS.some((marker) => existsSync6(join3(current, marker)))) {
3522
+ return realpathSync4(current);
3523
+ }
3524
+ const parent = dirname5(current);
3525
+ if (parent === current)
3526
+ return;
3527
+ current = parent;
3528
+ }
3529
+ }
3530
+ function nearestExistingAncestor(directory) {
3531
+ let current = directory;
3532
+ while (!existsSync6(current)) {
3533
+ const parent = dirname5(current);
3534
+ if (parent === current)
3535
+ return current;
3536
+ current = parent;
3537
+ }
3538
+ return current;
3539
+ }
3540
+
3504
3541
  // ../lsp-core/src/lsp/server-install-state.ts
3505
- import { existsSync as existsSync6, mkdirSync, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
3506
- import { dirname as dirname5 } from "node:path";
3542
+ import { existsSync as existsSync7, mkdirSync, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
3543
+ import { dirname as dirname6 } from "node:path";
3507
3544
  function getInstallDecisionsPath() {
3508
3545
  return lspRequestContext().installDecisionsPath;
3509
3546
  }
3510
3547
  function loadInstallDecisions() {
3511
3548
  const path = getInstallDecisionsPath();
3512
- if (!existsSync6(path))
3549
+ if (!existsSync7(path))
3513
3550
  return {};
3514
3551
  try {
3515
3552
  const parsed = JSON.parse(readFileSync3(path, "utf8"));
@@ -3531,7 +3568,7 @@ function isInstallDecision(value) {
3531
3568
  }
3532
3569
  function writeInstallDecisions(decisions) {
3533
3570
  const path = getInstallDecisionsPath();
3534
- mkdirSync(dirname5(path), { recursive: true });
3571
+ mkdirSync(dirname6(path), { recursive: true });
3535
3572
  const tmpPath = `${path}.tmp`;
3536
3573
  writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
3537
3574
  `, "utf8");
@@ -3550,7 +3587,7 @@ function isRecord5(value) {
3550
3587
  }
3551
3588
 
3552
3589
  // ../lsp-core/src/lsp/config-loader.ts
3553
- import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
3590
+ import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
3554
3591
 
3555
3592
  // ../lsp-core/src/lsp/server-definitions.ts
3556
3593
  var LSP_INSTALL_HINTS = {
@@ -3707,7 +3744,7 @@ function getUserConfigPath() {
3707
3744
  return lspRequestContext().userConfigPath;
3708
3745
  }
3709
3746
  function loadJsonFile(path) {
3710
- if (!existsSync7(path))
3747
+ if (!existsSync8(path))
3711
3748
  return null;
3712
3749
  try {
3713
3750
  const parsed = JSON.parse(readFileSync4(path, "utf-8"));
@@ -3895,8 +3932,8 @@ function getDisabledServerIds() {
3895
3932
  }
3896
3933
 
3897
3934
  // ../lsp-core/src/lsp/server-installation.ts
3898
- import { existsSync as existsSync8 } from "node:fs";
3899
- import { delimiter as delimiter3, join as join3 } from "node:path";
3935
+ import { existsSync as existsSync9 } from "node:fs";
3936
+ import { delimiter as delimiter3, join as join4 } from "node:path";
3900
3937
  function isServerInstalled(command, _workingDirectory) {
3901
3938
  if (command.length === 0)
3902
3939
  return false;
@@ -3904,7 +3941,7 @@ function isServerInstalled(command, _workingDirectory) {
3904
3941
  if (!cmd)
3905
3942
  return false;
3906
3943
  if (cmd.includes("/") || cmd.includes("\\")) {
3907
- if (existsSync8(cmd))
3944
+ if (existsSync9(cmd))
3908
3945
  return true;
3909
3946
  }
3910
3947
  const isWindows = process.platform === "win32";
@@ -3925,7 +3962,7 @@ function isServerInstalled(command, _workingDirectory) {
3925
3962
  const paths = pathEnv.split(delimiter3);
3926
3963
  for (const p of paths) {
3927
3964
  for (const suffix of exts) {
3928
- if (existsSync8(join3(p, cmd + suffix))) {
3965
+ if (existsSync9(join4(p, cmd + suffix))) {
3929
3966
  return true;
3930
3967
  }
3931
3968
  }
@@ -4021,7 +4058,6 @@ function getAllServers() {
4021
4058
  }
4022
4059
 
4023
4060
  // ../lsp-core/src/lsp/client-wrapper.ts
4024
- var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
4025
4061
  function isDirectoryPath(filePath) {
4026
4062
  try {
4027
4063
  return statSync3(filePath).isDirectory();
@@ -4030,32 +4066,85 @@ function isDirectoryPath(filePath) {
4030
4066
  }
4031
4067
  }
4032
4068
  function findWorkspaceRoot(filePath) {
4033
- const abs = resolvePathInsideContext(filePath);
4069
+ const cwd = contextCwd();
4070
+ const abs = resolveReadablePathInsideContext(filePath);
4034
4071
  let dir = abs;
4035
4072
  if (!isDirectoryPath(dir)) {
4036
- dir = dirname6(dir);
4037
- }
4038
- let prevDir = "";
4039
- while (dir !== prevDir) {
4040
- for (const marker of WORKSPACE_MARKERS) {
4041
- if (existsSync9(join4(dir, marker))) {
4042
- return dir;
4073
+ dir = dirname7(dir);
4074
+ }
4075
+ if (!isPathInside(cwd, abs))
4076
+ return findWorkspaceRootOutsideContext(dir);
4077
+ const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
4078
+ while (isPathInside(cwd, dir)) {
4079
+ const canonicalDir = existingDirectoryInsideContext(dir, cwd);
4080
+ if (canonicalDir !== undefined) {
4081
+ for (const marker of WORKSPACE_MARKERS) {
4082
+ if (existsSync10(join5(dir, marker))) {
4083
+ return canonicalDir;
4084
+ }
4043
4085
  }
4044
4086
  }
4045
- prevDir = dir;
4046
- dir = dirname6(dir);
4087
+ if (dir === cwd)
4088
+ break;
4089
+ dir = dirname7(dir);
4047
4090
  }
4048
- return dirname6(abs);
4091
+ return fallbackRoot;
4049
4092
  }
4050
- function resolvePathInsideContext(filePath) {
4093
+ function resolveReadablePathInsideContext(filePath) {
4051
4094
  const cwd = contextCwd();
4052
4095
  const abs = resolve7(cwd, filePath);
4096
+ if (isPathInside(cwd, abs))
4097
+ return abs;
4098
+ const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
4099
+ if (rebased !== undefined)
4100
+ return rebased;
4101
+ return canonicalizeExistingOrNearestAncestor(abs);
4102
+ }
4103
+ function resolvePathInsideContext(filePath) {
4104
+ const cwd = contextCwd();
4105
+ const abs = resolveReadablePathInsideContext(filePath);
4053
4106
  const canonical = canonicalizeExistingOrNearestAncestor(abs);
4054
4107
  if (!isPathInside(cwd, canonical)) {
4055
4108
  throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
4056
4109
  }
4057
4110
  return canonical;
4058
4111
  }
4112
+ function rebaseThroughCanonicalAncestor(path, cwd) {
4113
+ let current = path;
4114
+ const suffix = [];
4115
+ while (true) {
4116
+ if (existsSync10(current)) {
4117
+ const canonical = realpathSync5(current);
4118
+ if (isPathInside(cwd, canonical))
4119
+ return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
4120
+ }
4121
+ const parent = dirname7(current);
4122
+ if (parent === current)
4123
+ return;
4124
+ suffix.unshift(basename3(current));
4125
+ current = parent;
4126
+ }
4127
+ }
4128
+ function existingDirectoryInsideContext(directory, cwd) {
4129
+ if (!existsSync10(directory))
4130
+ return;
4131
+ const canonical = realpathSync5(directory);
4132
+ if (!statSync3(canonical).isDirectory())
4133
+ return;
4134
+ return isPathInside(cwd, canonical) ? canonical : undefined;
4135
+ }
4136
+ function nearestExistingDirectoryInsideContext(directory, cwd) {
4137
+ let current = directory;
4138
+ while (isPathInside(cwd, current)) {
4139
+ const canonical = existingDirectoryInsideContext(current, cwd);
4140
+ if (canonical !== undefined)
4141
+ return canonical;
4142
+ if (current === cwd)
4143
+ return;
4144
+ current = dirname7(current);
4145
+ }
4146
+ return;
4147
+ }
4059
4148
  function formatServerLookupError(result) {
4060
4149
  if (result.status === "not_installed") {
4061
4150
  return formatNotInstalled(result);
@@ -4126,7 +4215,7 @@ function formatNotInstalled(result) {
4126
4215
  ].join(`
4127
4216
  `);
4128
4217
  }
4129
- var READ_ONLY_RETRY_TOOLS = new Set([
4218
+ var READ_ONLY_TOOLS = new Set([
4130
4219
  "diagnostics",
4131
4220
  "definition",
4132
4221
  "references",
@@ -4135,7 +4224,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
4135
4224
  "prepareRename"
4136
4225
  ]);
4137
4226
  async function withLspClient(filePath, fn, toolName, options = {}) {
4138
- const absPath = resolvePathInsideContext(filePath);
4227
+ const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
4139
4228
  if (isDirectoryPath(absPath)) {
4140
4229
  throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
4141
4230
  }
@@ -4150,9 +4239,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
4150
4239
  const acquireAndCall = async (allowRetry) => {
4151
4240
  const client = await manager.getClient(root, server2, options.signal);
4152
4241
  try {
4153
- return await fn(client, root);
4242
+ return await fn(client, root, absPath);
4154
4243
  } catch (err) {
4155
- if (allowRetry && READ_ONLY_RETRY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
4244
+ if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
4156
4245
  manager.invalidateClient(root, server2.id, client);
4157
4246
  return acquireAndCall(false);
4158
4247
  }
@@ -4170,8 +4259,8 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
4170
4259
  }
4171
4260
 
4172
4261
  // ../lsp-core/src/lsp/directory-diagnostics.ts
4173
- import { existsSync as existsSync10, lstatSync as lstatSync4, readdirSync as readdirSync3 } from "node:fs";
4174
- import { join as join5, resolve as resolve8 } from "node:path";
4262
+ import { existsSync as existsSync11, lstatSync as lstatSync4, readdirSync as readdirSync3 } from "node:fs";
4263
+ import { join as join6, resolve as resolve8 } from "node:path";
4175
4264
 
4176
4265
  // ../lsp-core/src/lsp/formatters.ts
4177
4266
  import { fileURLToPath as fileURLToPath2 } from "node:url";
@@ -4301,7 +4390,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
4301
4390
  for (const entry of entries) {
4302
4391
  if (files.length >= maxFiles)
4303
4392
  return;
4304
- const fullPath = join5(currentDir, entry);
4393
+ const fullPath = join6(currentDir, entry);
4305
4394
  let stat;
4306
4395
  try {
4307
4396
  stat = lstatSync4(fullPath);
@@ -4327,7 +4416,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
4327
4416
  throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
4328
4417
  }
4329
4418
  const absDir = resolve8(options.workspaceRoot ?? contextCwd(), directory);
4330
- if (!existsSync10(absDir)) {
4419
+ if (!existsSync11(absDir)) {
4331
4420
  throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
4332
4421
  }
4333
4422
  const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
@@ -4414,7 +4503,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
4414
4503
 
4415
4504
  // ../lsp-core/src/lsp/infer-extension.ts
4416
4505
  import { lstatSync as lstatSync5, readdirSync as readdirSync4 } from "node:fs";
4417
- import { join as join6 } from "node:path";
4506
+ import { join as join7 } from "node:path";
4418
4507
  var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
4419
4508
  var MAX_SCAN_ENTRIES = 500;
4420
4509
  function inferExtensionFromDirectory(directory) {
@@ -4432,7 +4521,7 @@ function inferExtensionFromDirectory(directory) {
4432
4521
  for (const entry of entries) {
4433
4522
  if (scanned >= MAX_SCAN_ENTRIES)
4434
4523
  return;
4435
- const fullPath = join6(dir, entry);
4524
+ const fullPath = join7(dir, entry);
4436
4525
  let stat;
4437
4526
  try {
4438
4527
  stat = lstatSync5(fullPath);
@@ -4607,7 +4696,7 @@ async function executeLspDiagnostics(params, signal) {
4607
4696
  const filePath = requireString(params, "filePath");
4608
4697
  const severity = severityFilter(params);
4609
4698
  try {
4610
- const absPath = resolvePathInsideContext(filePath);
4699
+ const absPath = resolveReadablePathInsideContext(filePath);
4611
4700
  if (isDirectoryPath(absPath)) {
4612
4701
  const extension = inferExtensionFromDirectory(absPath);
4613
4702
  if (!extension) {
@@ -4636,7 +4725,7 @@ async function executeLspDiagnostics(params, signal) {
4636
4725
  };
4637
4726
  return text(output2.output, details2);
4638
4727
  }
4639
- const result = await withLspClient(filePath, async (client) => client.diagnostics(filePath, signal), "diagnostics", clientOptions(signal));
4728
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
4640
4729
  if (result.transientError) {
4641
4730
  const message = result.transientError.message;
4642
4731
  const details2 = {
@@ -4711,7 +4800,7 @@ async function executeLspGotoDefinition(params, signal) {
4711
4800
  const line = requireNumber(params, "line");
4712
4801
  const character = requireNumber(params, "character");
4713
4802
  try {
4714
- const result = await withLspClient(filePath, async (client) => client.definition(filePath, line, character, signal), "definition", clientOptions(signal));
4803
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
4715
4804
  const locations = !result ? [] : Array.isArray(result) ? result : [result];
4716
4805
  const details = { filePath, line, character, locations };
4717
4806
  if (locations.length === 0)
@@ -4736,7 +4825,7 @@ async function executeLspFindReferences(params, signal) {
4736
4825
  const character = requireNumber(params, "character");
4737
4826
  const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
4738
4827
  try {
4739
- const result = await withLspClient(filePath, async (client) => client.references(filePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
4828
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
4740
4829
  const references = Array.isArray(result) ? result : [];
4741
4830
  const total = references.length;
4742
4831
  const truncated = total > DEFAULT_MAX_REFERENCES;
@@ -4778,7 +4867,7 @@ async function executeLspPrepareRename(params, signal) {
4778
4867
  const line = requireNumber(params, "line");
4779
4868
  const character = requireNumber(params, "character");
4780
4869
  try {
4781
- const result = await withLspClient(filePath, async (client) => client.prepareRename(filePath, line, character, signal), "prepareRename", clientOptions(signal));
4870
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
4782
4871
  const details = { filePath, line, character, result };
4783
4872
  return text(formatPrepareRenameResult(result), details);
4784
4873
  } catch (error) {
@@ -4799,7 +4888,7 @@ async function executeLspRename(params, signal) {
4799
4888
  const character = requireNumber(params, "character");
4800
4889
  const newName = requireString(params, "newName");
4801
4890
  try {
4802
- const result = await withLspClient(filePath, async (client) => client.rename(filePath, line, character, newName, signal), "rename", clientOptions(signal));
4891
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
4803
4892
  const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
4804
4893
  return text(formatApplyResult(result.apply), details, !result.apply.success);
4805
4894
  } catch (error) {
@@ -4879,7 +4968,7 @@ async function executeLspSymbols(params, signal) {
4879
4968
  const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
4880
4969
  return formatSymbolsResult(filePath, scope, symbols2, limit, query);
4881
4970
  }
4882
- const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(filePath, signal), "documentSymbols", clientOptions(signal));
4971
+ const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
4883
4972
  return formatSymbolsResult(filePath, scope, symbols, limit);
4884
4973
  } catch (error) {
4885
4974
  const query = optionalString(params, "query");