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
@@ -1,7 +1,7 @@
1
1
  // src/daemon-client.ts
2
2
  import { connect } from "node:net";
3
3
  import { homedir as homedir3 } from "node:os";
4
- import { join as join7 } from "node:path";
4
+ import { join as join8 } from "node:path";
5
5
 
6
6
  // ../lsp-core/src/request-context.ts
7
7
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -1141,8 +1141,8 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
1141
1141
  };
1142
1142
  }
1143
1143
  // ../lsp-core/src/lsp/client-wrapper.ts
1144
- import { existsSync as existsSync10, statSync as statSync4 } from "node:fs";
1145
- import { dirname as dirname8, join as join4, resolve as resolve7 } from "node:path";
1144
+ import { existsSync as existsSync11, realpathSync as realpathSync5, statSync as statSync4 } from "node:fs";
1145
+ import { basename as basename3, dirname as dirname9, join as join5, resolve as resolve7 } from "node:path";
1146
1146
 
1147
1147
  // ../lsp-core/src/lsp/effective-extension.ts
1148
1148
  import { basename as basename2, extname } from "node:path";
@@ -4157,15 +4157,52 @@ async function disposeDefaultLspManager() {
4157
4157
  }
4158
4158
  }
4159
4159
 
4160
+ // ../lsp-core/src/lsp/outside-context-workspace.ts
4161
+ import { existsSync as existsSync7, realpathSync as realpathSync4 } from "node:fs";
4162
+ import { dirname as dirname7, join as join3 } from "node:path";
4163
+
4164
+ // ../lsp-core/src/lsp/workspace-markers.ts
4165
+ var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
4166
+
4167
+ // ../lsp-core/src/lsp/outside-context-workspace.ts
4168
+ function findWorkspaceRootOutsideContext(directory) {
4169
+ const marked = nearestMarkedAncestor(directory);
4170
+ if (marked !== undefined)
4171
+ return marked;
4172
+ return realpathSync4(nearestExistingAncestor(directory));
4173
+ }
4174
+ function nearestMarkedAncestor(directory) {
4175
+ let current = directory;
4176
+ for (;; ) {
4177
+ if (existsSync7(current) && WORKSPACE_MARKERS.some((marker) => existsSync7(join3(current, marker)))) {
4178
+ return realpathSync4(current);
4179
+ }
4180
+ const parent = dirname7(current);
4181
+ if (parent === current)
4182
+ return;
4183
+ current = parent;
4184
+ }
4185
+ }
4186
+ function nearestExistingAncestor(directory) {
4187
+ let current = directory;
4188
+ while (!existsSync7(current)) {
4189
+ const parent = dirname7(current);
4190
+ if (parent === current)
4191
+ return current;
4192
+ current = parent;
4193
+ }
4194
+ return current;
4195
+ }
4196
+
4160
4197
  // ../lsp-core/src/lsp/server-install-state.ts
4161
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
4162
- import { dirname as dirname7 } from "node:path";
4198
+ import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
4199
+ import { dirname as dirname8 } from "node:path";
4163
4200
  function getInstallDecisionsPath() {
4164
4201
  return lspRequestContext().installDecisionsPath;
4165
4202
  }
4166
4203
  function loadInstallDecisions() {
4167
4204
  const path2 = getInstallDecisionsPath();
4168
- if (!existsSync7(path2))
4205
+ if (!existsSync8(path2))
4169
4206
  return {};
4170
4207
  try {
4171
4208
  const parsed = JSON.parse(readFileSync4(path2, "utf8"));
@@ -4187,7 +4224,7 @@ function isInstallDecision(value) {
4187
4224
  }
4188
4225
  function writeInstallDecisions(decisions) {
4189
4226
  const path2 = getInstallDecisionsPath();
4190
- mkdirSync3(dirname7(path2), { recursive: true });
4227
+ mkdirSync3(dirname8(path2), { recursive: true });
4191
4228
  const tmpPath = `${path2}.tmp`;
4192
4229
  writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
4193
4230
  `, "utf8");
@@ -4206,7 +4243,7 @@ function isRecord5(value) {
4206
4243
  }
4207
4244
 
4208
4245
  // ../lsp-core/src/lsp/config-loader.ts
4209
- import { existsSync as existsSync8, readFileSync as readFileSync5 } from "node:fs";
4246
+ import { existsSync as existsSync9, readFileSync as readFileSync5 } from "node:fs";
4210
4247
 
4211
4248
  // ../lsp-core/src/lsp/server-definitions.ts
4212
4249
  var LSP_INSTALL_HINTS = {
@@ -4363,7 +4400,7 @@ function getUserConfigPath() {
4363
4400
  return lspRequestContext().userConfigPath;
4364
4401
  }
4365
4402
  function loadJsonFile(path2) {
4366
- if (!existsSync8(path2))
4403
+ if (!existsSync9(path2))
4367
4404
  return null;
4368
4405
  try {
4369
4406
  const parsed = JSON.parse(readFileSync5(path2, "utf-8"));
@@ -4551,8 +4588,8 @@ function getDisabledServerIds() {
4551
4588
  }
4552
4589
 
4553
4590
  // ../lsp-core/src/lsp/server-installation.ts
4554
- import { existsSync as existsSync9 } from "node:fs";
4555
- import { delimiter as delimiter3, join as join3 } from "node:path";
4591
+ import { existsSync as existsSync10 } from "node:fs";
4592
+ import { delimiter as delimiter3, join as join4 } from "node:path";
4556
4593
  function isServerInstalled(command, _workingDirectory) {
4557
4594
  if (command.length === 0)
4558
4595
  return false;
@@ -4560,7 +4597,7 @@ function isServerInstalled(command, _workingDirectory) {
4560
4597
  if (!cmd)
4561
4598
  return false;
4562
4599
  if (cmd.includes("/") || cmd.includes("\\")) {
4563
- if (existsSync9(cmd))
4600
+ if (existsSync10(cmd))
4564
4601
  return true;
4565
4602
  }
4566
4603
  const isWindows = process.platform === "win32";
@@ -4581,7 +4618,7 @@ function isServerInstalled(command, _workingDirectory) {
4581
4618
  const paths = pathEnv.split(delimiter3);
4582
4619
  for (const p of paths) {
4583
4620
  for (const suffix of exts) {
4584
- if (existsSync9(join3(p, cmd + suffix))) {
4621
+ if (existsSync10(join4(p, cmd + suffix))) {
4585
4622
  return true;
4586
4623
  }
4587
4624
  }
@@ -4677,7 +4714,6 @@ function getAllServers() {
4677
4714
  }
4678
4715
 
4679
4716
  // ../lsp-core/src/lsp/client-wrapper.ts
4680
- var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
4681
4717
  function isDirectoryPath(filePath) {
4682
4718
  try {
4683
4719
  return statSync4(filePath).isDirectory();
@@ -4686,32 +4722,85 @@ function isDirectoryPath(filePath) {
4686
4722
  }
4687
4723
  }
4688
4724
  function findWorkspaceRoot(filePath) {
4689
- const abs = resolvePathInsideContext(filePath);
4725
+ const cwd = contextCwd();
4726
+ const abs = resolveReadablePathInsideContext(filePath);
4690
4727
  let dir = abs;
4691
4728
  if (!isDirectoryPath(dir)) {
4692
- dir = dirname8(dir);
4693
- }
4694
- let prevDir = "";
4695
- while (dir !== prevDir) {
4696
- for (const marker of WORKSPACE_MARKERS) {
4697
- if (existsSync10(join4(dir, marker))) {
4698
- return dir;
4729
+ dir = dirname9(dir);
4730
+ }
4731
+ if (!isPathInside(cwd, abs))
4732
+ return findWorkspaceRootOutsideContext(dir);
4733
+ const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
4734
+ while (isPathInside(cwd, dir)) {
4735
+ const canonicalDir = existingDirectoryInsideContext(dir, cwd);
4736
+ if (canonicalDir !== undefined) {
4737
+ for (const marker of WORKSPACE_MARKERS) {
4738
+ if (existsSync11(join5(dir, marker))) {
4739
+ return canonicalDir;
4740
+ }
4699
4741
  }
4700
4742
  }
4701
- prevDir = dir;
4702
- dir = dirname8(dir);
4743
+ if (dir === cwd)
4744
+ break;
4745
+ dir = dirname9(dir);
4703
4746
  }
4704
- return dirname8(abs);
4747
+ return fallbackRoot;
4705
4748
  }
4706
- function resolvePathInsideContext(filePath) {
4749
+ function resolveReadablePathInsideContext(filePath) {
4707
4750
  const cwd = contextCwd();
4708
4751
  const abs = resolve7(cwd, filePath);
4752
+ if (isPathInside(cwd, abs))
4753
+ return abs;
4754
+ const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
4755
+ if (rebased !== undefined)
4756
+ return rebased;
4757
+ return canonicalizeExistingOrNearestAncestor(abs);
4758
+ }
4759
+ function resolvePathInsideContext(filePath) {
4760
+ const cwd = contextCwd();
4761
+ const abs = resolveReadablePathInsideContext(filePath);
4709
4762
  const canonical = canonicalizeExistingOrNearestAncestor(abs);
4710
4763
  if (!isPathInside(cwd, canonical)) {
4711
4764
  throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
4712
4765
  }
4713
4766
  return canonical;
4714
4767
  }
4768
+ function rebaseThroughCanonicalAncestor(path2, cwd) {
4769
+ let current = path2;
4770
+ const suffix = [];
4771
+ while (true) {
4772
+ if (existsSync11(current)) {
4773
+ const canonical = realpathSync5(current);
4774
+ if (isPathInside(cwd, canonical))
4775
+ return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
4776
+ }
4777
+ const parent = dirname9(current);
4778
+ if (parent === current)
4779
+ return;
4780
+ suffix.unshift(basename3(current));
4781
+ current = parent;
4782
+ }
4783
+ }
4784
+ function existingDirectoryInsideContext(directory, cwd) {
4785
+ if (!existsSync11(directory))
4786
+ return;
4787
+ const canonical = realpathSync5(directory);
4788
+ if (!statSync4(canonical).isDirectory())
4789
+ return;
4790
+ return isPathInside(cwd, canonical) ? canonical : undefined;
4791
+ }
4792
+ function nearestExistingDirectoryInsideContext(directory, cwd) {
4793
+ let current = directory;
4794
+ while (isPathInside(cwd, current)) {
4795
+ const canonical = existingDirectoryInsideContext(current, cwd);
4796
+ if (canonical !== undefined)
4797
+ return canonical;
4798
+ if (current === cwd)
4799
+ return;
4800
+ current = dirname9(current);
4801
+ }
4802
+ return;
4803
+ }
4715
4804
  function formatServerLookupError(result) {
4716
4805
  if (result.status === "not_installed") {
4717
4806
  return formatNotInstalled(result);
@@ -4782,7 +4871,7 @@ function formatNotInstalled(result) {
4782
4871
  ].join(`
4783
4872
  `);
4784
4873
  }
4785
- var READ_ONLY_RETRY_TOOLS = new Set([
4874
+ var READ_ONLY_TOOLS = new Set([
4786
4875
  "diagnostics",
4787
4876
  "definition",
4788
4877
  "references",
@@ -4791,7 +4880,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
4791
4880
  "prepareRename"
4792
4881
  ]);
4793
4882
  async function withLspClient(filePath, fn, toolName, options = {}) {
4794
- const absPath = resolvePathInsideContext(filePath);
4883
+ const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
4795
4884
  if (isDirectoryPath(absPath)) {
4796
4885
  throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
4797
4886
  }
@@ -4806,9 +4895,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
4806
4895
  const acquireAndCall = async (allowRetry) => {
4807
4896
  const client = await manager.getClient(root, server2, options.signal);
4808
4897
  try {
4809
- return await fn(client, root);
4898
+ return await fn(client, root, absPath);
4810
4899
  } catch (err) {
4811
- if (allowRetry && READ_ONLY_RETRY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
4900
+ if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
4812
4901
  manager.invalidateClient(root, server2.id, client);
4813
4902
  return acquireAndCall(false);
4814
4903
  }
@@ -4826,8 +4915,8 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
4826
4915
  }
4827
4916
 
4828
4917
  // ../lsp-core/src/lsp/directory-diagnostics.ts
4829
- import { existsSync as existsSync11, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
4830
- import { join as join5, resolve as resolve8 } from "node:path";
4918
+ import { existsSync as existsSync12, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
4919
+ import { join as join6, resolve as resolve8 } from "node:path";
4831
4920
 
4832
4921
  // ../lsp-core/src/lsp/formatters.ts
4833
4922
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -4957,7 +5046,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
4957
5046
  for (const entry of entries) {
4958
5047
  if (files.length >= maxFiles)
4959
5048
  return;
4960
- const fullPath = join5(currentDir, entry);
5049
+ const fullPath = join6(currentDir, entry);
4961
5050
  let stat;
4962
5051
  try {
4963
5052
  stat = lstatSync5(fullPath);
@@ -4983,7 +5072,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
4983
5072
  throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
4984
5073
  }
4985
5074
  const absDir = resolve8(options.workspaceRoot ?? contextCwd(), directory);
4986
- if (!existsSync11(absDir)) {
5075
+ if (!existsSync12(absDir)) {
4987
5076
  throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
4988
5077
  }
4989
5078
  const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
@@ -5070,7 +5159,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
5070
5159
 
5071
5160
  // ../lsp-core/src/lsp/infer-extension.ts
5072
5161
  import { lstatSync as lstatSync6, readdirSync as readdirSync4 } from "node:fs";
5073
- import { join as join6 } from "node:path";
5162
+ import { join as join7 } from "node:path";
5074
5163
  var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
5075
5164
  var MAX_SCAN_ENTRIES = 500;
5076
5165
  function inferExtensionFromDirectory(directory) {
@@ -5088,7 +5177,7 @@ function inferExtensionFromDirectory(directory) {
5088
5177
  for (const entry of entries) {
5089
5178
  if (scanned >= MAX_SCAN_ENTRIES)
5090
5179
  return;
5091
- const fullPath = join6(dir, entry);
5180
+ const fullPath = join7(dir, entry);
5092
5181
  let stat;
5093
5182
  try {
5094
5183
  stat = lstatSync6(fullPath);
@@ -5263,7 +5352,7 @@ async function executeLspDiagnostics(params, signal) {
5263
5352
  const filePath = requireString(params, "filePath");
5264
5353
  const severity = severityFilter(params);
5265
5354
  try {
5266
- const absPath = resolvePathInsideContext(filePath);
5355
+ const absPath = resolveReadablePathInsideContext(filePath);
5267
5356
  if (isDirectoryPath(absPath)) {
5268
5357
  const extension = inferExtensionFromDirectory(absPath);
5269
5358
  if (!extension) {
@@ -5292,7 +5381,7 @@ async function executeLspDiagnostics(params, signal) {
5292
5381
  };
5293
5382
  return text(output2.output, details2);
5294
5383
  }
5295
- const result = await withLspClient(filePath, async (client) => client.diagnostics(filePath, signal), "diagnostics", clientOptions(signal));
5384
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
5296
5385
  if (result.transientError) {
5297
5386
  const message = result.transientError.message;
5298
5387
  const details2 = {
@@ -5367,7 +5456,7 @@ async function executeLspGotoDefinition(params, signal) {
5367
5456
  const line = requireNumber(params, "line");
5368
5457
  const character = requireNumber(params, "character");
5369
5458
  try {
5370
- const result = await withLspClient(filePath, async (client) => client.definition(filePath, line, character, signal), "definition", clientOptions(signal));
5459
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
5371
5460
  const locations = !result ? [] : Array.isArray(result) ? result : [result];
5372
5461
  const details = { filePath, line, character, locations };
5373
5462
  if (locations.length === 0)
@@ -5392,7 +5481,7 @@ async function executeLspFindReferences(params, signal) {
5392
5481
  const character = requireNumber(params, "character");
5393
5482
  const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
5394
5483
  try {
5395
- const result = await withLspClient(filePath, async (client) => client.references(filePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
5484
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
5396
5485
  const references = Array.isArray(result) ? result : [];
5397
5486
  const total = references.length;
5398
5487
  const truncated = total > DEFAULT_MAX_REFERENCES;
@@ -5434,7 +5523,7 @@ async function executeLspPrepareRename(params, signal) {
5434
5523
  const line = requireNumber(params, "line");
5435
5524
  const character = requireNumber(params, "character");
5436
5525
  try {
5437
- const result = await withLspClient(filePath, async (client) => client.prepareRename(filePath, line, character, signal), "prepareRename", clientOptions(signal));
5526
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
5438
5527
  const details = { filePath, line, character, result };
5439
5528
  return text(formatPrepareRenameResult(result), details);
5440
5529
  } catch (error) {
@@ -5455,7 +5544,7 @@ async function executeLspRename(params, signal) {
5455
5544
  const character = requireNumber(params, "character");
5456
5545
  const newName = requireString(params, "newName");
5457
5546
  try {
5458
- const result = await withLspClient(filePath, async (client) => client.rename(filePath, line, character, newName, signal), "rename", clientOptions(signal));
5547
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
5459
5548
  const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
5460
5549
  return text(formatApplyResult(result.apply), details, !result.apply.success);
5461
5550
  } catch (error) {
@@ -5535,7 +5624,7 @@ async function executeLspSymbols(params, signal) {
5535
5624
  const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
5536
5625
  return formatSymbolsResult(filePath, scope, symbols2, limit, query);
5537
5626
  }
5538
- const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(filePath, signal), "documentSymbols", clientOptions(signal));
5627
+ const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
5539
5628
  return formatSymbolsResult(filePath, scope, symbols, limit);
5540
5629
  } catch (error) {
5541
5630
  const query = optionalString(params, "query");
@@ -5892,9 +5981,9 @@ function currentRequestContext(env = process.env) {
5892
5981
  const home = env["HOME"] ?? homedir3();
5893
5982
  return parseLspRequestContext({
5894
5983
  cwd,
5895
- projectConfigPaths: [join7(cwd, ".codex", "lsp-client.json")],
5896
- userConfigPath: join7(home, ".codex", "lsp-client.json"),
5897
- installDecisionsPath: join7(home, ".codex", "lsp-install-decisions.json"),
5984
+ projectConfigPaths: [join8(cwd, ".codex", "lsp-client.json")],
5985
+ userConfigPath: join8(home, ".codex", "lsp-client.json"),
5986
+ installDecisionsPath: join8(home, ".codex", "lsp-install-decisions.json"),
5898
5987
  capabilities: { installDecisionTool: true }
5899
5988
  });
5900
5989
  }