oh-my-opencode 5.0.0-beta.4 → 5.0.0-beta.42

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 (892) hide show
  1. package/.agents/command/publish.md +44 -16
  2. package/.agents/skills/codex-qa/scripts/lsp-e2e.sh +1 -3
  3. package/.agents/skills/opencode-qa/scripts/lsp-e2e.sh +1 -1
  4. package/.agents/skills/pre-publish-review/SKILL.md +9 -12
  5. package/.agents/skills/publish/SKILL.md +44 -16
  6. package/.agents/skills/senpi-qa/SKILL.md +80 -0
  7. package/.agents/skills/senpi-qa/scripts/resolve-evidence-dir.mjs +65 -0
  8. package/.agents/skills/senpi-qa/scripts/resolve-evidence-dir.test.mjs +171 -0
  9. package/.agents/skills/tech-debt-audit/SKILL.md +6 -76
  10. package/.agents/skills/work-with-pr/SKILL.md +37 -23
  11. package/.opencode/command/publish.md +44 -16
  12. package/.opencode/skills/pre-publish-review/SKILL.md +9 -12
  13. package/.opencode/skills/work-with-pr/SKILL.md +37 -23
  14. package/README.ja.md +25 -21
  15. package/README.ko.md +25 -21
  16. package/README.md +38 -23
  17. package/README.ru.md +24 -20
  18. package/README.zh-cn.md +25 -21
  19. package/THIRD-PARTY-NOTICES.md +27 -99
  20. package/dist/agents/atlas/agent.d.ts +0 -1
  21. package/dist/agents/sisyphus/grok-4.d.ts +20 -0
  22. package/dist/agents/sisyphus/index.d.ts +2 -0
  23. package/dist/agents/sisyphus-agent-config.d.ts +6 -0
  24. package/dist/agents/sisyphus-agent-factory.d.ts +1 -1
  25. package/dist/agents/sisyphus-runtime-prompt-reconciler.d.ts +15 -4
  26. package/dist/agents/types.d.ts +2 -2
  27. package/dist/cli/config-manager/parse-opencode-config-file.d.ts +2 -1
  28. package/dist/cli/doctor/checks/system-plugin.d.ts +4 -3
  29. package/dist/cli/fallback-lane-policy.d.ts +1 -0
  30. package/dist/cli/index.js +67006 -64814
  31. package/dist/cli/install-codex/install-codex-test-fixtures.d.ts +1 -1
  32. package/dist/cli/run/on-complete-hook.d.ts +2 -0
  33. package/dist/cli/runtime-commands.d.ts +1 -1
  34. package/dist/cli/worktree-sweep/classify.d.ts +16 -0
  35. package/dist/cli/worktree-sweep/format.d.ts +8 -0
  36. package/dist/cli/worktree-sweep/git.d.ts +19 -0
  37. package/dist/cli/worktree-sweep/index.d.ts +7 -0
  38. package/dist/cli/worktree-sweep/options.d.ts +2 -0
  39. package/dist/cli/worktree-sweep/parse-worktree-list.d.ts +8 -0
  40. package/dist/cli/worktree-sweep/sweep.d.ts +2 -0
  41. package/dist/cli/worktree-sweep/types.d.ts +65 -0
  42. package/dist/cli/worktree-sweep/worktree-sweep.d.ts +2 -0
  43. package/dist/cli-node/index.js +67283 -65068
  44. package/dist/config/index.d.ts +1 -1
  45. package/dist/config/schema/background-task.d.ts +1 -0
  46. package/dist/config/schema/commands.d.ts +1 -1
  47. package/dist/config/schema/hooks.d.ts +1 -2
  48. package/dist/config/schema/oh-my-opencode-config.d.ts +5 -11
  49. package/dist/config/schema/ulw-execute.d.ts +5 -0
  50. package/dist/config/schema.d.ts +0 -1
  51. package/dist/config/validate.d.ts +2 -0
  52. package/dist/create-hooks.d.ts +3 -2
  53. package/dist/features/background-agent/compaction-aware-message-resolver.d.ts +1 -0
  54. package/dist/features/background-agent/constants.d.ts +0 -7
  55. package/dist/features/background-agent/manager.d.ts +2 -1
  56. package/dist/features/background-agent/parent-wake-dispatched-tracker.d.ts +0 -1
  57. package/dist/features/background-agent/parent-wake-notifier-types.d.ts +1 -1
  58. package/dist/features/background-agent/parent-wake-prompt-dispatch.d.ts +1 -1
  59. package/dist/features/background-agent/parent-wake-session-inspector.d.ts +1 -1
  60. package/dist/features/background-agent/subagent-spawn-limits.d.ts +8 -0
  61. package/dist/features/btw-side/btw-command-draft.d.ts +7 -0
  62. package/dist/features/btw-side/context-injector.d.ts +15 -0
  63. package/dist/features/btw-side/index.d.ts +8 -0
  64. package/dist/features/btw-side/metadata.d.ts +15 -0
  65. package/dist/features/btw-side/parent-context-budget.d.ts +9 -0
  66. package/dist/features/btw-side/server-session-registry.d.ts +8 -0
  67. package/dist/features/btw-side/tui-adoption-cache.d.ts +13 -0
  68. package/dist/features/btw-side/tui-adoption-guard.d.ts +5 -0
  69. package/dist/features/btw-side/tui-controller-types.d.ts +68 -0
  70. package/dist/features/btw-side/tui-controller.d.ts +19 -0
  71. package/dist/features/btw-side/tui-escape-return.d.ts +12 -0
  72. package/dist/features/btw-side/tui-keymap.d.ts +17 -0
  73. package/dist/features/btw-side/tui-parent-validator.d.ts +6 -0
  74. package/dist/features/btw-side/tui-picker-options.d.ts +20 -0
  75. package/dist/features/btw-side/tui-picker.d.ts +9 -0
  76. package/dist/features/btw-side/tui-prompt-queue.d.ts +8 -0
  77. package/dist/features/btw-side/tui-session-bridge.d.ts +11 -0
  78. package/dist/features/btw-side/tui-session-catalog.d.ts +35 -0
  79. package/dist/features/btw-side/tui-side-removal.d.ts +11 -0
  80. package/dist/features/btw-side/tui-side-start.d.ts +9 -0
  81. package/dist/features/btw-side/tui-wiring.d.ts +8 -0
  82. package/dist/features/builtin-commands/templates/ulw-execute.d.ts +1 -0
  83. package/dist/features/builtin-commands/types.d.ts +1 -1
  84. package/dist/features/monitor/manager-internals.d.ts +1 -1
  85. package/dist/features/monitor/output-injector-types.d.ts +1 -1
  86. package/dist/features/opengateway-provider/index.d.ts +13 -0
  87. package/dist/features/task-toast-manager/manager.d.ts +0 -24
  88. package/dist/features/team-mode/tools/messaging-fallback-wake.d.ts +15 -0
  89. package/dist/features/team-mode/tools/messaging-live-delivery-recipient.d.ts +1 -0
  90. package/dist/features/team-mode/tools/messaging-runtime.d.ts +1 -0
  91. package/dist/hooks/anthropic-context-window-limit-recovery/message-storage-directory.d.ts +0 -3
  92. package/dist/hooks/anthropic-context-window-limit-recovery/state.d.ts +1 -0
  93. package/dist/hooks/anthropic-context-window-limit-recovery/storage/empty-messages.d.ts +0 -1
  94. package/dist/hooks/anthropic-context-window-limit-recovery/tool-result-storage.d.ts +11 -0
  95. package/dist/hooks/atlas/atlas-hook.d.ts +1 -0
  96. package/dist/hooks/atlas/atlas-lifecycle-store.d.ts +50 -0
  97. package/dist/hooks/atlas/event-handler.d.ts +1 -0
  98. package/dist/hooks/atlas/final-wave-approval-gate.test-support.d.ts +50 -0
  99. package/dist/hooks/atlas/system-reminder-templates.d.ts +0 -1
  100. package/dist/hooks/atlas/tool-execute-before.d.ts +3 -0
  101. package/dist/hooks/atlas/types.d.ts +1 -0
  102. package/dist/hooks/claude-code-hooks/session-hook-state.d.ts +1 -0
  103. package/dist/hooks/claude-code-hooks/stop.d.ts +2 -0
  104. package/dist/hooks/claude-code-hooks/todo.d.ts +0 -1
  105. package/dist/hooks/claude-code-hooks/transcript.d.ts +2 -0
  106. package/dist/hooks/compaction-context-injector/validated-model.d.ts +2 -0
  107. package/dist/hooks/fsync-skip-warning/index.d.ts +4 -0
  108. package/dist/hooks/hashline-edit-diff-enhancer/hook.d.ts +1 -0
  109. package/dist/hooks/hashline-edit-diff-enhancer/pending-captures.d.ts +13 -0
  110. package/dist/hooks/index.d.ts +1 -2
  111. package/dist/hooks/keyword-detector/hook.d.ts +7 -0
  112. package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +0 -1
  113. package/dist/hooks/model-fallback/hook.d.ts +1 -1
  114. package/dist/hooks/prometheus-md-only/agent-resolution.d.ts +2 -2
  115. package/dist/hooks/runtime-fallback/chat-message-handler.d.ts +2 -0
  116. package/dist/hooks/runtime-fallback/retry-model-payload.d.ts +1 -0
  117. package/dist/hooks/runtime-fallback/runtime-model-settings.d.ts +6 -0
  118. package/dist/hooks/runtime-fallback/session-status-handler.d.ts +1 -1
  119. package/dist/hooks/runtime-fallback/types.d.ts +3 -1
  120. package/dist/hooks/sisyphus-junior-notepad/constants.d.ts +1 -1
  121. package/dist/hooks/todo-continuation-enforcer/types.d.ts +1 -0
  122. package/dist/hooks/{start-work → ulw-execute}/context-info-builder.d.ts +1 -1
  123. package/dist/hooks/{start-work → ulw-execute}/index.d.ts +1 -1
  124. package/dist/hooks/ulw-execute/ulw-execute-hook.d.ts +23 -0
  125. package/dist/index.js +24677 -20710
  126. package/dist/mcp/index.d.ts +0 -4
  127. package/dist/mcp/types.d.ts +0 -1
  128. package/dist/oh-my-opencode.schema.json +21 -47
  129. package/dist/plugin/chat-message/types.d.ts +3 -3
  130. package/dist/plugin/chat-message/ulw-execute-message.d.ts +5 -0
  131. package/dist/plugin/event-session-lifecycle.d.ts +1 -0
  132. package/dist/plugin/hooks/create-core-hooks.d.ts +2 -2
  133. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -3
  134. package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -0
  135. package/dist/plugin/messages-transform.d.ts +1 -0
  136. package/dist/plugin-dispose.d.ts +3 -0
  137. package/dist/shared/agent-tool-restrictions.d.ts +0 -1
  138. package/dist/shared/compaction-agent-config-checkpoint.d.ts +1 -0
  139. package/dist/shared/index.d.ts +2 -0
  140. package/dist/shared/legacy-plugin-warning.d.ts +2 -1
  141. package/dist/shared/normalize-sdk-response.d.ts +1 -0
  142. package/dist/shared/omo-process-sweep.d.ts +2 -4
  143. package/dist/shared/plugin-entry-migrator.d.ts +4 -3
  144. package/dist/shared/plugin-entry-shape.d.ts +6 -0
  145. package/dist/shared/runtime-fallback-retry-marker.d.ts +16 -0
  146. package/dist/shared/shell-env.d.ts +1 -1
  147. package/dist/skills/ast-grep/AGENTS.md +51 -0
  148. package/dist/skills/ast-grep/SKILL.md +1 -1
  149. package/dist/skills/coding-agent-sessions/AGENTS.md +62 -0
  150. package/dist/skills/coding-agent-sessions/SKILL.md +3 -2
  151. package/dist/skills/coding-agent-sessions/references/all-platforms.md +1 -1
  152. package/dist/skills/coding-agent-sessions/references/senpi.md +4 -4
  153. package/dist/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
  154. package/dist/skills/data-scientist/SKILL.md +99 -239
  155. package/dist/skills/data-scientist/references/execution-surfaces.md +91 -0
  156. package/dist/skills/data-scientist/references/placement.md +74 -0
  157. package/dist/skills/data-scientist/references/polars-lane.md +95 -0
  158. package/dist/skills/data-scientist/references/uv-setup.md +1 -1
  159. package/dist/skills/data-scientist/references/visualization.md +64 -0
  160. package/dist/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
  161. package/dist/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
  162. package/dist/skills/debugging/SKILL.md +3 -1
  163. package/dist/skills/debugging/references/methodology/00-setup.md +12 -0
  164. package/dist/skills/debugging/references/methodology/02-investigate.md +21 -0
  165. package/dist/skills/debugging/references/runtimes/go.md +15 -1
  166. package/dist/skills/debugging/references/runtimes/native-binary.md +38 -0
  167. package/dist/skills/debugging/references/runtimes/node.md +25 -0
  168. package/dist/skills/debugging/references/runtimes/python.md +13 -0
  169. package/dist/skills/debugging/references/runtimes/rust.md +41 -0
  170. package/dist/skills/debugging/references/scripts/dap.mjs +267 -0
  171. package/dist/skills/debugging/references/scripts/dap.test.ts +86 -0
  172. package/dist/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
  173. package/dist/skills/debugging/references/tools/dap.md +103 -0
  174. package/dist/skills/debugging/references/tools/frida.md +193 -0
  175. package/dist/skills/frontend/SKILL.md +12 -8
  176. package/dist/skills/frontend/references/design/_INDEX.md +1 -0
  177. package/dist/skills/frontend/references/design/print-paged-media.md +76 -0
  178. package/dist/skills/frontend/references/design/stylegallery.md +80 -0
  179. package/dist/skills/frontend/references/designpowers/README.md +1 -1
  180. package/dist/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
  181. package/dist/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
  182. package/dist/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
  183. package/dist/skills/frontend/references/designpowers/orchestration.md +1 -1
  184. package/dist/skills/frontend/references/designpowers/routing.md +5 -5
  185. package/dist/skills/git-master/SKILL.md +1 -1
  186. package/dist/skills/init-deep/SKILL.md +14 -14
  187. package/dist/skills/lsp-setup/SKILL.md +1 -1
  188. package/dist/skills/programming/SKILL.md +1 -1
  189. package/dist/skills/refactor/SKILL.md +1 -1
  190. package/dist/skills/remove-ai-slops/SKILL.md +1 -1
  191. package/dist/skills/review-work/SKILL.md +100 -418
  192. package/dist/skills/ultimate-browsing/ATTRIBUTION.md +38 -11
  193. package/dist/skills/ultimate-browsing/SKILL.md +26 -9
  194. package/dist/skills/ultimate-browsing/engine/AGENTS.md +110 -0
  195. package/dist/skills/ultimate-browsing/engine/templates/package.json +1 -1
  196. package/dist/skills/ultimate-browsing/references/chrome-stealth.md +23 -18
  197. package/dist/skills/ultimate-browsing/references/insane-search/README.md +9 -2
  198. package/dist/skills/{start-work → ulw-execute}/SKILL.md +17 -16
  199. package/dist/skills/ulw-plan/SKILL.md +7 -8
  200. package/dist/skills/ulw-plan/references/full-workflow.md +31 -7
  201. package/dist/skills/ulw-plan/references/intent-clear.md +2 -1
  202. package/dist/skills/ulw-plan/references/intent-unclear.md +5 -5
  203. package/dist/skills/ulw-research/SKILL.md +8 -3
  204. package/dist/skills/visual-qa/AGENTS.md +58 -0
  205. package/dist/skills/visual-qa/SKILL.md +4 -3
  206. package/dist/tools/delegate-task/builtin-categories.d.ts +1 -0
  207. package/dist/tools/delegate-task/builtin-category-definition.d.ts +1 -0
  208. package/dist/tools/delegate-task/sync-session-cleanup.d.ts +3 -0
  209. package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -0
  210. package/dist/tools/delegate-task/tool-description.d.ts +3 -1
  211. package/dist/tools/delegate-task/types.d.ts +4 -0
  212. package/dist/tools/session-manager/directory-filter.d.ts +2 -0
  213. package/dist/tui.d.ts +12 -0
  214. package/dist/tui.js +49320 -49316
  215. package/package.json +44 -39
  216. package/packages/git-bash-mcp/dist/cli.js +6 -1
  217. package/packages/git-bash-mcp/package.json +1 -1
  218. package/packages/lsp-core/src/index.ts +1 -0
  219. package/packages/lsp-core/src/lsp/client-diagnostics-concurrency.integration.test.ts +44 -0
  220. package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +47 -47
  221. package/packages/lsp-core/src/lsp/client-diagnostics-pull-timeout.test.ts +64 -0
  222. package/packages/lsp-core/src/lsp/client-wrapper-outside-cwd.test.ts +78 -0
  223. package/packages/lsp-core/src/lsp/client-wrapper.test.ts +163 -13
  224. package/packages/lsp-core/src/lsp/client-wrapper.ts +110 -23
  225. package/packages/lsp-core/src/lsp/client.ts +32 -3
  226. package/packages/lsp-core/src/lsp/connection.ts +16 -0
  227. package/packages/lsp-core/src/lsp/constants.ts +6 -0
  228. package/packages/lsp-core/src/lsp/controlled-clock-test-support.ts +61 -0
  229. package/packages/lsp-core/src/lsp/errors.ts +15 -0
  230. package/packages/lsp-core/src/lsp/fixtures/workspace-edit-server.mjs +10 -3
  231. package/packages/lsp-core/src/lsp/format-document.test.ts +143 -0
  232. package/packages/lsp-core/src/lsp/format-document.ts +90 -0
  233. package/packages/lsp-core/src/lsp/json-rpc-connection.ts +11 -6
  234. package/packages/lsp-core/src/lsp/manager-lifecycle.test.ts +262 -0
  235. package/packages/lsp-core/src/lsp/manager-max-clients.test.ts +151 -0
  236. package/packages/lsp-core/src/lsp/manager.ts +138 -12
  237. package/packages/lsp-core/src/lsp/outside-context-workspace.ts +33 -0
  238. package/packages/lsp-core/src/lsp/server-definitions.ts +29 -0
  239. package/packages/lsp-core/src/lsp/server-installation.test.ts +376 -0
  240. package/packages/lsp-core/src/lsp/server-installation.ts +200 -27
  241. package/packages/lsp-core/src/lsp/server-resolution-local-binary.test.ts +170 -0
  242. package/packages/lsp-core/src/lsp/server-resolution.ts +18 -5
  243. package/packages/lsp-core/src/lsp/timer-provider.ts +13 -0
  244. package/packages/lsp-core/src/lsp/transport-request-timeout.test.ts +73 -0
  245. package/packages/lsp-core/src/lsp/transport.ts +16 -2
  246. package/packages/lsp-core/src/lsp/types.ts +8 -0
  247. package/packages/lsp-core/src/lsp/workspace-document-state.test.ts +84 -1
  248. package/packages/lsp-core/src/lsp/workspace-document-state.ts +30 -11
  249. package/packages/lsp-core/src/lsp/workspace-edit-adversarial.test.ts +20 -1
  250. package/packages/lsp-core/src/lsp/workspace-markers.ts +18 -0
  251. package/packages/lsp-core/src/mcp.ts +3 -0
  252. package/packages/lsp-core/src/request-context.test.ts +29 -0
  253. package/packages/lsp-core/src/request-context.ts +1 -1
  254. package/packages/lsp-core/src/tool-surface.test.ts +13 -1
  255. package/packages/lsp-core/src/tools/definitions.ts +14 -0
  256. package/packages/lsp-core/src/tools/diagnostics.ts +3 -3
  257. package/packages/lsp-core/src/tools/format.test.ts +56 -0
  258. package/packages/lsp-core/src/tools/format.ts +56 -0
  259. package/packages/lsp-core/src/tools/index.ts +1 -0
  260. package/packages/lsp-core/src/tools/navigation.ts +4 -2
  261. package/packages/lsp-core/src/tools/parameters.test.ts +51 -0
  262. package/packages/lsp-core/src/tools/rename.ts +4 -2
  263. package/packages/lsp-core/src/tools/symbols.ts +1 -1
  264. package/packages/lsp-core/src/tools/types.ts +10 -0
  265. package/packages/lsp-daemon/dist/cli.js +804 -329
  266. package/packages/lsp-daemon/dist/client.d.ts +10 -0
  267. package/packages/lsp-daemon/dist/client.js +764 -286
  268. package/packages/lsp-daemon/dist/daemon-client.d.ts +1 -0
  269. package/packages/lsp-daemon/dist/daemon-client.js +3 -0
  270. package/packages/lsp-daemon/dist/ensure-daemon.js +1 -0
  271. package/packages/lsp-daemon/dist/index.js +768 -295
  272. package/packages/lsp-daemon/dist/proxy.js +3 -0
  273. package/packages/lsp-daemon/dist/version-reap.js +1 -1
  274. package/packages/lsp-daemon/package.json +1 -1
  275. package/packages/lsp-tools-mcp/dist/cli.js +723 -250
  276. package/packages/lsp-tools-mcp/dist/lsp/manager.js +259 -125
  277. package/packages/lsp-tools-mcp/dist/mcp.js +725 -252
  278. package/packages/lsp-tools-mcp/dist/request-context.js +12 -13
  279. package/packages/lsp-tools-mcp/dist/tools.js +729 -260
  280. package/packages/lsp-tools-mcp/package.json +1 -1
  281. package/packages/omo-codex/THIRD-PARTY-NOTICES.md +4 -21
  282. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +4 -6
  283. package/packages/omo-codex/plugin/.mcp.json +0 -6
  284. package/packages/omo-codex/plugin/AGENTS.md +47 -0
  285. package/packages/omo-codex/plugin/README.md +2 -2
  286. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +45 -49
  287. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  288. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  289. package/packages/omo-codex/plugin/components/bootstrap/src/hook.ts +1 -0
  290. package/packages/omo-codex/plugin/components/comment-checker/AGENTS.md +9 -0
  291. package/packages/omo-codex/plugin/components/comment-checker/biome.json +2 -2
  292. package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +2 -1
  293. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  294. package/packages/omo-codex/plugin/components/comment-checker/package.json +5 -5
  295. package/packages/omo-codex/plugin/components/comment-checker/src/apply-patch.ts +2 -8
  296. package/packages/omo-codex/plugin/components/comment-checker/src/core.ts +1 -2
  297. package/packages/omo-codex/plugin/components/comment-checker/src/request-extractor.ts +1 -1
  298. package/packages/omo-codex/plugin/components/comment-checker/src/runner.ts +1 -0
  299. package/packages/omo-codex/plugin/components/git-bash/AGENTS.md +1 -1
  300. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  301. package/packages/omo-codex/plugin/components/git-bash/package.json +3 -4
  302. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/biome.json +2 -2
  303. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +1 -5
  304. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +1 -5
  305. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  306. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +5 -5
  307. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +1 -5
  308. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +4 -21
  309. package/packages/omo-codex/plugin/components/lcx/skills/lcx-doctor/SKILL.md +1 -1
  310. package/packages/omo-codex/plugin/components/lsp/AGENTS.md +30 -15
  311. package/packages/omo-codex/plugin/components/lsp/biome.json +2 -2
  312. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +4 -4
  313. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +752 -300
  314. package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.js +1 -1
  315. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  316. package/packages/omo-codex/plugin/components/lsp/package.json +5 -5
  317. package/packages/omo-codex/plugin/components/lsp/src/cli.ts +1 -1
  318. package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +1 -1
  319. package/packages/omo-codex/plugin/components/lsp/src/daemon-cli-path.ts +1 -5
  320. package/packages/omo-codex/plugin/components/lsp/test/codex-hook-unavailable.test.ts +6 -7
  321. package/packages/omo-codex/plugin/components/lsp/test/codex-hook.test.ts +1 -2
  322. package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +11 -1
  323. package/packages/omo-codex/plugin/components/rules/AGENTS.md +12 -0
  324. package/packages/omo-codex/plugin/components/rules/biome.json +2 -2
  325. package/packages/omo-codex/plugin/components/rules/dist/cli.js +60 -45
  326. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  327. package/packages/omo-codex/plugin/components/rules/package.json +7 -7
  328. package/packages/omo-codex/plugin/components/rules/src/config.ts +1 -2
  329. package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +1 -2
  330. package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +9 -5
  331. package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +1 -4
  332. package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +4 -9
  333. package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +11 -16
  334. package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +17 -25
  335. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +9 -7
  336. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +0 -6
  337. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +6 -4
  338. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +12 -9
  339. package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +28 -37
  340. package/packages/omo-codex/plugin/components/rules/test/dynamic-target-fingerprints.test.ts +1 -2
  341. package/packages/omo-codex/plugin/components/rules/test/engine.test.ts +7 -4
  342. package/packages/omo-codex/plugin/components/rules/test/finder.test.ts +2 -3
  343. package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +39 -72
  344. package/packages/omo-codex/plugin/components/rules/test/hephaestus-model-variant.test.ts +1 -2
  345. package/packages/omo-codex/plugin/components/rules/test/hook-output.test.ts +2 -3
  346. package/packages/omo-codex/plugin/components/rules/test/matcher.test.ts +2 -3
  347. package/packages/omo-codex/plugin/components/rules/test/package-smoke.test.ts +1 -1
  348. package/packages/omo-codex/plugin/components/rules/test/parser.test.ts +1 -2
  349. package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +5 -6
  350. package/packages/omo-codex/plugin/components/rules/test/rules-engine-consumption.test.ts +3 -6
  351. package/packages/omo-codex/plugin/components/rules/test/scanner.test.ts +1 -2
  352. package/packages/omo-codex/plugin/components/rules/test/sources.test.ts +2 -5
  353. package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +2 -17
  354. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  355. package/packages/omo-codex/plugin/components/teammode/package.json +5 -5
  356. package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +4 -10
  357. package/packages/omo-codex/plugin/components/telemetry/AGENTS.md +8 -0
  358. package/packages/omo-codex/plugin/components/telemetry/biome.json +2 -2
  359. package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +2463 -437
  360. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +2467 -441
  361. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  362. package/packages/omo-codex/plugin/components/telemetry/package.json +5 -5
  363. package/packages/omo-codex/plugin/components/telemetry/src/codex-hook.ts +1 -4
  364. package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +4 -14
  365. package/packages/omo-codex/plugin/components/telemetry/src/product-identity.ts +1 -1
  366. package/packages/omo-codex/plugin/components/telemetry/test/diagnostics.test.ts +2 -5
  367. package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +10 -4
  368. package/packages/omo-codex/plugin/components/ultrawork/biome.json +2 -2
  369. package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +489 -4
  370. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  371. package/packages/omo-codex/plugin/components/ultrawork/package.json +5 -6
  372. package/packages/omo-codex/plugin/components/ultrawork/scripts/sync-directive.mjs +30 -14
  373. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +6 -7
  374. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +31 -7
  375. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +2 -1
  376. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +5 -5
  377. package/packages/omo-codex/plugin/components/ultrawork/src/directive-content.ts +4 -0
  378. package/packages/omo-codex/plugin/components/ultrawork/src/directive.ts +5 -2
  379. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +9 -1
  380. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +0 -136
  381. package/packages/omo-codex/plugin/components/ultrawork/test/directive-source.test.ts +14 -8
  382. package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +12 -1
  383. package/packages/omo-codex/plugin/components/ultrawork/test/skill-pointer.test.ts +0 -2
  384. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/AGENTS.md +2 -2
  385. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/NOTICE +1 -1
  386. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/README.md +5 -5
  387. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/biome.json +2 -2
  388. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/directive.md +6 -6
  389. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/dist/cli.js +12 -12
  390. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +28 -0
  391. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/package.json +12 -12
  392. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/boulder-reader.ts +1 -1
  393. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/cli.ts +1 -1
  394. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/codex-hook.ts +3 -3
  395. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/directive.ts +1 -1
  396. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/index.ts +1 -1
  397. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/boulder-reader.test.ts +3 -3
  398. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/cli.test.ts +1 -4
  399. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/codex-hook.test.ts +8 -22
  400. package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +19 -0
  401. package/packages/omo-codex/plugin/components/ulw-loop/CHANGELOG.md +1 -1
  402. package/packages/omo-codex/plugin/components/ulw-loop/README.md +12 -1
  403. package/packages/omo-codex/plugin/components/ulw-loop/biome.json +2 -2
  404. package/packages/omo-codex/plugin/components/ulw-loop/directive.md +15 -3
  405. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.d.ts +12 -0
  406. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.js +45 -0
  407. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-continuation.js +9 -0
  408. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +15 -0
  409. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +15 -1
  410. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.d.ts +8 -0
  411. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.js +120 -0
  412. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +40 -39
  413. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +7 -2
  414. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +2 -1
  415. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +12 -1
  416. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +2 -0
  417. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +958 -342
  418. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.d.ts +2 -0
  419. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +27 -6
  420. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.d.ts +13 -0
  421. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.js +15 -1
  422. package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +17 -9
  423. package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +1 -1
  424. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.js +17 -2
  425. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-missing-recovery.d.ts +13 -0
  426. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-missing-recovery.js +19 -0
  427. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.d.ts +7 -0
  428. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.js +9 -0
  429. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.d.ts +12 -0
  430. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.js +104 -0
  431. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.d.ts +13 -1
  432. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +65 -9
  433. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.js +5 -1
  434. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +4 -2
  435. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +69 -111
  436. package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.js +4 -2
  437. package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.js +185 -14
  438. package/packages/omo-codex/plugin/components/ulw-loop/dist/status-next-actions.d.ts +6 -0
  439. package/packages/omo-codex/plugin/components/ulw-loop/dist/status-next-actions.js +33 -0
  440. package/packages/omo-codex/plugin/components/ulw-loop/dist/stop-resume-hook.js +3 -3
  441. package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.d.ts +18 -0
  442. package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.js +65 -0
  443. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
  444. package/packages/omo-codex/plugin/components/ulw-loop/package.json +5 -5
  445. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +4 -3
  446. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/define-goal.md +108 -0
  447. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +22 -1
  448. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-codex-validation.ts +81 -0
  449. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-continuation.ts +7 -0
  450. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +31 -1
  451. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-template.ts +134 -0
  452. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +38 -71
  453. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +7 -2
  454. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-output.ts +14 -1
  455. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +2 -0
  456. package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +3 -5
  457. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +34 -5
  458. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-snapshot.ts +26 -1
  459. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-hook.ts +3 -1
  460. package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +19 -9
  461. package/packages/omo-codex/plugin/components/ulw-loop/src/paths.ts +1 -1
  462. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-io.ts +18 -3
  463. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-missing-recovery.ts +27 -0
  464. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-aggregate.ts +11 -0
  465. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-artifacts.ts +123 -0
  466. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +68 -15
  467. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-verdicts.ts +6 -1
  468. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +82 -131
  469. package/packages/omo-codex/plugin/components/ulw-loop/src/review-blockers.ts +4 -2
  470. package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-guard.ts +187 -12
  471. package/packages/omo-codex/plugin/components/ulw-loop/src/status-next-actions.ts +36 -0
  472. package/packages/omo-codex/plugin/components/ulw-loop/src/stop-resume-hook.ts +3 -3
  473. package/packages/omo-codex/plugin/components/ulw-loop/src/surface.ts +95 -0
  474. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-continuation.test.ts +0 -1
  475. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +133 -1
  476. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-template.test.ts +137 -0
  477. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-create-goals.test.ts +25 -0
  478. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +26 -2
  479. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-status-next-actions.test.ts +183 -0
  480. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +37 -2
  481. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-snapshot.test.ts +18 -0
  482. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +0 -3
  483. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/quality-gate-builder.ts +7 -3
  484. package/packages/omo-codex/plugin/components/ulw-loop/test/guided-recovery.test.ts +105 -0
  485. package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +5 -37
  486. package/packages/omo-codex/plugin/components/ulw-loop/test/paths.test.ts +9 -0
  487. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate-basics.test.ts +258 -0
  488. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-cap-and-dedupe.test.ts +22 -0
  489. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-poisoning-cascades.test.ts +97 -0
  490. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-roles.test.ts +46 -2
  491. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-senpi-surface.test.ts +131 -0
  492. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-single-report.test.ts +241 -0
  493. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +48 -3
  494. package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-guard.test.ts +318 -1
  495. package/packages/omo-codex/plugin/components/ulw-loop/test/steering.test.ts +8 -5
  496. package/packages/omo-codex/plugin/components/ulw-loop/test/stop-resume-hook.test.ts +1 -1
  497. package/packages/omo-codex/plugin/components/ulw-loop/test/surface.test.ts +74 -0
  498. package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +13 -8
  499. package/packages/omo-codex/plugin/components/ulw-loop/vitest.config.ts +1 -0
  500. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  501. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  502. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  503. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  504. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  505. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  506. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  507. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  508. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  509. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  510. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  511. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  512. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  513. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  514. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +17 -0
  515. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  516. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-ulw-execute-continuation.json +17 -0
  517. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  518. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  519. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  520. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  521. package/packages/omo-codex/plugin/model-catalog.json +3 -3
  522. package/packages/omo-codex/plugin/package-lock.json +676 -524
  523. package/packages/omo-codex/plugin/package.json +2 -3
  524. package/packages/omo-codex/plugin/scripts/AGENTS.md +39 -0
  525. package/packages/omo-codex/plugin/scripts/auto-update-plan.mjs +1 -2
  526. package/packages/omo-codex/plugin/scripts/auto-update.mjs +0 -9
  527. package/packages/omo-codex/plugin/scripts/canonical-ultrawork-directive.mjs +17 -0
  528. package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +0 -1
  529. package/packages/omo-codex/plugin/scripts/migrate-codex-config/catalog.mjs +3 -3
  530. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +42 -31
  531. package/packages/omo-codex/plugin/shared/package.json +3 -4
  532. package/packages/omo-codex/plugin/shared/src/config-loader.ts +2 -102
  533. package/packages/omo-codex/plugin/shared/src/config-migration.ts +0 -1
  534. package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +41 -130
  535. package/packages/omo-codex/plugin/skills/ast-grep/AGENTS.md +51 -0
  536. package/packages/omo-codex/plugin/skills/ast-grep/SKILL.md +1 -1
  537. package/packages/omo-codex/plugin/skills/coding-agent-sessions/AGENTS.md +62 -0
  538. package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +3 -2
  539. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/all-platforms.md +1 -1
  540. package/packages/omo-codex/plugin/skills/coding-agent-sessions/references/senpi.md +4 -4
  541. package/packages/omo-codex/plugin/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
  542. package/packages/omo-codex/plugin/skills/data-scientist/SKILL.md +99 -239
  543. package/packages/omo-codex/plugin/skills/data-scientist/references/execution-surfaces.md +91 -0
  544. package/packages/omo-codex/plugin/skills/data-scientist/references/placement.md +74 -0
  545. package/packages/omo-codex/plugin/skills/data-scientist/references/polars-lane.md +95 -0
  546. package/packages/omo-codex/plugin/skills/data-scientist/references/uv-setup.md +1 -1
  547. package/packages/omo-codex/plugin/skills/data-scientist/references/visualization.md +64 -0
  548. package/packages/omo-codex/plugin/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
  549. package/packages/omo-codex/plugin/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
  550. package/packages/omo-codex/plugin/skills/debugging/SKILL.md +3 -1
  551. package/packages/omo-codex/plugin/skills/debugging/references/methodology/00-setup.md +12 -0
  552. package/packages/omo-codex/plugin/skills/debugging/references/methodology/02-investigate.md +21 -0
  553. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/go.md +15 -1
  554. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/native-binary.md +38 -0
  555. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/node.md +25 -0
  556. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/python.md +13 -0
  557. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/rust.md +41 -0
  558. package/packages/omo-codex/plugin/skills/debugging/references/scripts/dap.mjs +267 -0
  559. package/packages/omo-codex/plugin/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
  560. package/packages/omo-codex/plugin/skills/debugging/references/tools/dap.md +103 -0
  561. package/packages/omo-codex/plugin/skills/debugging/references/tools/frida.md +193 -0
  562. package/packages/omo-codex/plugin/skills/frontend/SKILL.md +12 -8
  563. package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +1 -0
  564. package/packages/omo-codex/plugin/skills/frontend/references/design/print-paged-media.md +76 -0
  565. package/packages/omo-codex/plugin/skills/frontend/references/design/stylegallery.md +80 -0
  566. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/README.md +1 -1
  567. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
  568. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
  569. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
  570. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/orchestration.md +1 -1
  571. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/routing.md +5 -5
  572. package/packages/omo-codex/plugin/skills/git-master/SKILL.md +1 -1
  573. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +14 -14
  574. package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +1 -1
  575. package/packages/omo-codex/plugin/skills/lsp-setup/SKILL.md +1 -1
  576. package/packages/omo-codex/plugin/skills/programming/SKILL.md +1 -1
  577. package/packages/omo-codex/plugin/skills/refactor/SKILL.md +1 -1
  578. package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +1 -1
  579. package/packages/omo-codex/plugin/skills/review-work/SKILL.md +101 -419
  580. package/packages/omo-codex/plugin/skills/ultimate-browsing/ATTRIBUTION.md +38 -11
  581. package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +26 -9
  582. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/AGENTS.md +110 -0
  583. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/package.json +1 -1
  584. package/packages/omo-codex/plugin/skills/ultimate-browsing/references/chrome-stealth.md +23 -18
  585. package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/README.md +9 -2
  586. package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +15 -3
  587. package/packages/omo-codex/plugin/skills/{start-work → ulw-execute}/SKILL.md +19 -26
  588. package/packages/omo-codex/plugin/skills/ulw-execute/agents/openai.yaml +2 -0
  589. package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +4 -3
  590. package/packages/omo-codex/plugin/skills/ulw-loop/references/define-goal.md +108 -0
  591. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +22 -1
  592. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +6 -7
  593. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +31 -7
  594. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +2 -1
  595. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +5 -5
  596. package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +8 -3
  597. package/packages/omo-codex/plugin/skills/visual-qa/AGENTS.md +58 -0
  598. package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +4 -3
  599. package/packages/omo-codex/plugin/test/AGENTS.md +47 -0
  600. package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +19 -173
  601. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +9 -48
  602. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +2 -3
  603. package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +2 -7
  604. package/packages/omo-codex/plugin/test/aggregate-model-catalog.test.mjs +1 -1
  605. package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +175 -13
  606. package/packages/omo-codex/plugin/test/aggregate.test.mjs +78 -2
  607. package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +19 -33
  608. package/packages/omo-codex/plugin/test/auto-update.test.mjs +2 -27
  609. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +0 -31
  610. package/packages/omo-codex/plugin/test/canonical-ultrawork-directive.test.mjs +53 -0
  611. package/packages/omo-codex/plugin/test/component-bin-names.test.mjs +2 -2
  612. package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +1 -51
  613. package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +2 -2
  614. package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +4 -5
  615. package/packages/omo-codex/plugin/test/lcx-contribute-bug-fix-template.test.mjs +21 -27
  616. package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +1 -3
  617. package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +8 -8
  618. package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +0 -36
  619. package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +101 -0
  620. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +24 -14
  621. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +14 -119
  622. package/packages/omo-codex/plugin/test/teammode-archive-ambiguity.test.mjs +0 -40
  623. package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +6 -62
  624. package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +3 -36
  625. package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +0 -44
  626. package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +2 -6
  627. package/packages/omo-codex/plugin/test/ultrawork-skill-pointer.test.mjs +5 -5
  628. package/packages/omo-codex/plugin/test/ulw-plan-review-state-contract.test.mjs +0 -3
  629. package/packages/omo-codex/scripts/AGENTS.md +36 -0
  630. package/packages/omo-codex/scripts/install-cache-copy.test.mjs +27 -1
  631. package/packages/omo-codex/scripts/install-config-autonomous-features.test.mjs +1 -1
  632. package/packages/omo-codex/scripts/install-config-autonomous.test.mjs +2 -1
  633. package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +0 -23
  634. package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +2 -2
  635. package/packages/omo-codex/scripts/install-dist/install-local.mjs +2818 -913
  636. package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +1 -25
  637. package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +7 -2
  638. package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +0 -36
  639. package/packages/shared-skills/package.json +7 -1
  640. package/packages/shared-skills/skill-source-filter.d.ts +16 -0
  641. package/packages/shared-skills/skill-source-filter.mjs +44 -0
  642. package/packages/shared-skills/skills/ast-grep/AGENTS.md +51 -0
  643. package/packages/shared-skills/skills/ast-grep/SKILL.md +1 -1
  644. package/packages/shared-skills/skills/coding-agent-sessions/AGENTS.md +62 -0
  645. package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +3 -2
  646. package/packages/shared-skills/skills/coding-agent-sessions/references/all-platforms.md +1 -1
  647. package/packages/shared-skills/skills/coding-agent-sessions/references/senpi.md +4 -4
  648. package/packages/shared-skills/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +1 -1
  649. package/packages/shared-skills/skills/data-scientist/SKILL.md +99 -239
  650. package/packages/shared-skills/skills/data-scientist/references/execution-surfaces.md +91 -0
  651. package/packages/shared-skills/skills/data-scientist/references/placement.md +74 -0
  652. package/packages/shared-skills/skills/data-scientist/references/polars-lane.md +95 -0
  653. package/packages/shared-skills/skills/data-scientist/references/uv-setup.md +1 -1
  654. package/packages/shared-skills/skills/data-scientist/references/visualization.md +64 -0
  655. package/packages/shared-skills/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
  656. package/packages/shared-skills/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
  657. package/packages/shared-skills/skills/debugging/SKILL.md +3 -1
  658. package/packages/shared-skills/skills/debugging/references/methodology/00-setup.md +12 -0
  659. package/packages/shared-skills/skills/debugging/references/methodology/02-investigate.md +21 -0
  660. package/packages/shared-skills/skills/debugging/references/runtimes/go.md +15 -1
  661. package/packages/shared-skills/skills/debugging/references/runtimes/native-binary.md +38 -0
  662. package/packages/shared-skills/skills/debugging/references/runtimes/node.md +25 -0
  663. package/packages/shared-skills/skills/debugging/references/runtimes/python.md +13 -0
  664. package/packages/shared-skills/skills/debugging/references/runtimes/rust.md +41 -0
  665. package/packages/shared-skills/skills/debugging/references/scripts/dap.mjs +267 -0
  666. package/packages/shared-skills/skills/debugging/references/scripts/dap.test.ts +86 -0
  667. package/packages/shared-skills/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
  668. package/packages/shared-skills/skills/debugging/references/tools/dap.md +103 -0
  669. package/packages/shared-skills/skills/debugging/references/tools/frida.md +193 -0
  670. package/packages/shared-skills/skills/frontend/SKILL.md +12 -8
  671. package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +1 -0
  672. package/packages/shared-skills/skills/frontend/references/design/print-paged-media.md +76 -0
  673. package/packages/shared-skills/skills/frontend/references/design/stylegallery.md +80 -0
  674. package/packages/shared-skills/skills/frontend/references/designpowers/README.md +1 -1
  675. package/packages/shared-skills/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
  676. package/packages/shared-skills/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
  677. package/packages/shared-skills/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
  678. package/packages/shared-skills/skills/frontend/references/designpowers/orchestration.md +1 -1
  679. package/packages/shared-skills/skills/frontend/references/designpowers/routing.md +5 -5
  680. package/packages/shared-skills/skills/git-master/SKILL.md +1 -1
  681. package/packages/shared-skills/skills/init-deep/SKILL.md +14 -14
  682. package/packages/shared-skills/skills/lsp-setup/SKILL.md +1 -1
  683. package/packages/shared-skills/skills/programming/SKILL.md +1 -1
  684. package/packages/shared-skills/skills/refactor/SKILL.md +1 -1
  685. package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +1 -1
  686. package/packages/shared-skills/skills/review-work/SKILL.md +100 -418
  687. package/packages/shared-skills/skills/ultimate-browsing/ATTRIBUTION.md +38 -11
  688. package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +26 -9
  689. package/packages/shared-skills/skills/ultimate-browsing/engine/AGENTS.md +110 -0
  690. package/packages/shared-skills/skills/ultimate-browsing/engine/templates/package.json +1 -1
  691. package/packages/shared-skills/skills/ultimate-browsing/references/chrome-stealth.md +23 -18
  692. package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/README.md +9 -2
  693. package/packages/shared-skills/skills/{start-work → ulw-execute}/SKILL.md +17 -16
  694. package/packages/shared-skills/skills/ulw-plan/SKILL.md +7 -8
  695. package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +31 -7
  696. package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +2 -1
  697. package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +5 -5
  698. package/packages/shared-skills/skills/ulw-research/SKILL.md +8 -3
  699. package/packages/shared-skills/skills/visual-qa/AGENTS.md +58 -0
  700. package/packages/shared-skills/skills/visual-qa/SKILL.md +4 -3
  701. package/script/qa/web-terminal-visual-qa.mjs +2 -0
  702. package/script/qa/xterm-live-terminal.mjs +18 -2
  703. package/dist/config/schema/codegraph.d.ts +0 -12
  704. package/dist/config/schema/start-work.d.ts +0 -5
  705. package/dist/features/builtin-commands/templates/start-work.d.ts +0 -1
  706. package/dist/features/builtin-skills/index.d.ts +0 -1
  707. package/dist/features/builtin-skills/skill-file-loader.d.ts +0 -1
  708. package/dist/features/builtin-skills/skills/agent-browser-skill.d.ts +0 -1
  709. package/dist/features/builtin-skills/skills/agent-browser-template.d.ts +0 -1
  710. package/dist/features/builtin-skills/skills/debugging.d.ts +0 -1
  711. package/dist/features/builtin-skills/skills/dev-browser.d.ts +0 -1
  712. package/dist/features/builtin-skills/skills/frontend.d.ts +0 -1
  713. package/dist/features/builtin-skills/skills/git-master-sections/commit-atomic-planning.d.ts +0 -1
  714. package/dist/features/builtin-skills/skills/git-master-sections/commit-context-analysis.d.ts +0 -1
  715. package/dist/features/builtin-skills/skills/git-master-sections/commit-execution-verification.d.ts +0 -1
  716. package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +0 -1
  717. package/dist/features/builtin-skills/skills/git-master-sections/history-search-workflow.d.ts +0 -1
  718. package/dist/features/builtin-skills/skills/git-master-sections/overview.d.ts +0 -1
  719. package/dist/features/builtin-skills/skills/git-master-sections/quick-reference.d.ts +0 -1
  720. package/dist/features/builtin-skills/skills/git-master-sections/rebase-workflow.d.ts +0 -1
  721. package/dist/features/builtin-skills/skills/git-master-skill-metadata.d.ts +0 -1
  722. package/dist/features/builtin-skills/skills/git-master.d.ts +0 -1
  723. package/dist/features/builtin-skills/skills/index.d.ts +0 -1
  724. package/dist/features/builtin-skills/skills/init-deep.d.ts +0 -1
  725. package/dist/features/builtin-skills/skills/playwright-cli.d.ts +0 -1
  726. package/dist/features/builtin-skills/skills/playwright-mcp-skill.d.ts +0 -1
  727. package/dist/features/builtin-skills/skills/playwright.d.ts +0 -1
  728. package/dist/features/builtin-skills/skills/remove-ai-slops.d.ts +0 -1
  729. package/dist/features/builtin-skills/skills/review-work.d.ts +0 -1
  730. package/dist/features/builtin-skills/skills/security-research.d.ts +0 -1
  731. package/dist/features/builtin-skills/skills/security-review.d.ts +0 -1
  732. package/dist/features/builtin-skills/skills/team-mode.d.ts +0 -1
  733. package/dist/features/builtin-skills/skills/visual-qa.d.ts +0 -1
  734. package/dist/features/builtin-skills/skills.d.ts +0 -1
  735. package/dist/features/builtin-skills/types.d.ts +0 -1
  736. package/dist/features/claude-code-plugin-loader/agent-loader.d.ts +0 -1
  737. package/dist/features/claude-code-plugin-loader/command-loader.d.ts +0 -1
  738. package/dist/features/claude-code-plugin-loader/discovery-core.d.ts +0 -1
  739. package/dist/features/claude-code-plugin-loader/discovery-paths.d.ts +0 -1
  740. package/dist/features/claude-code-plugin-loader/discovery.d.ts +0 -1
  741. package/dist/features/claude-code-plugin-loader/hook-loader.d.ts +0 -1
  742. package/dist/features/claude-code-plugin-loader/index.d.ts +0 -1
  743. package/dist/features/claude-code-plugin-loader/install-path-resolver.d.ts +0 -1
  744. package/dist/features/claude-code-plugin-loader/installed-plugin-database.d.ts +0 -1
  745. package/dist/features/claude-code-plugin-loader/loaded-plugin.d.ts +0 -1
  746. package/dist/features/claude-code-plugin-loader/loader.d.ts +0 -1
  747. package/dist/features/claude-code-plugin-loader/mcp-server-loader.d.ts +0 -1
  748. package/dist/features/claude-code-plugin-loader/plugin-key.d.ts +0 -1
  749. package/dist/features/claude-code-plugin-loader/plugin-manifest.d.ts +0 -1
  750. package/dist/features/claude-code-plugin-loader/plugin-path-resolver.d.ts +0 -1
  751. package/dist/features/claude-code-plugin-loader/plugin-settings.d.ts +0 -1
  752. package/dist/features/claude-code-plugin-loader/scope-filter.d.ts +0 -1
  753. package/dist/features/claude-code-plugin-loader/skill-loader.d.ts +0 -1
  754. package/dist/features/claude-code-plugin-loader/types.d.ts +0 -1
  755. package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +0 -17
  756. package/dist/hooks/codegraph-bootstrap/hook.d.ts +0 -35
  757. package/dist/hooks/codegraph-bootstrap/index.d.ts +0 -1
  758. package/dist/hooks/codegraph-bootstrap/project-root.d.ts +0 -1
  759. package/dist/hooks/codegraph-bootstrap/status.d.ts +0 -11
  760. package/dist/hooks/ralph-loop/completion-promise-detector-test-input.d.ts +0 -11
  761. package/dist/hooks/ralph-loop/loop-session-recovery.d.ts +0 -7
  762. package/dist/hooks/start-work/start-work-hook.d.ts +0 -23
  763. package/dist/mcp/codegraph.d.ts +0 -16
  764. package/dist/plugin/chat-message/start-work-message.d.ts +0 -5
  765. package/dist/shared/prompt-async-gate/message-inspection-error.d.ts +0 -1
  766. package/dist/shared/prompt-async-gate/pending-tool-turn.d.ts +0 -1
  767. package/dist/shared/prompt-async-gate/prompt-message-state.d.ts +0 -1
  768. package/dist/shared/prompt-async-gate/queue.d.ts +0 -1
  769. package/dist/shared/prompt-async-gate/recent-dispatches.d.ts +0 -1
  770. package/dist/shared/prompt-async-gate/reservations.d.ts +0 -1
  771. package/dist/shared/prompt-async-gate/semantic-dedupe.d.ts +0 -1
  772. package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +0 -1
  773. package/dist/shared/prompt-async-gate/timing.d.ts +0 -1
  774. package/dist/shared/prompt-async-gate/types.d.ts +0 -1
  775. package/dist/skills/data-scientist/references/common-scenarios.md +0 -176
  776. package/dist/skills/data-scientist/references/execution-templates.md +0 -197
  777. package/dist/skills/data-scientist/references/integration-patterns.md +0 -153
  778. package/dist/skills/data-scientist/references/performance-benchmarks.md +0 -37
  779. package/dist/tools/call-omo-agent/background-agent-executor.d.ts +0 -5
  780. package/dist/tools/call-omo-agent/message-storage-directory.d.ts +0 -1
  781. package/dist/tools/delegate-task/model-string-parser.d.ts +0 -1
  782. package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.d.ts +0 -1
  783. package/packages/lsp-tools-mcp/dist/lsp/constants.d.ts +0 -1
  784. package/packages/lsp-tools-mcp/dist/lsp/language-mappings.d.ts +0 -1
  785. package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.d.ts +0 -1
  786. package/packages/lsp-tools-mcp/dist/missing-dependency-result.d.ts +0 -1
  787. package/packages/omo-codex/plugin/components/codegraph/AGENTS.md +0 -58
  788. package/packages/omo-codex/plugin/components/codegraph/NODE-RUNTIME-LICENSES.md +0 -2951
  789. package/packages/omo-codex/plugin/components/codegraph/NOTICE +0 -16
  790. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +0 -12136
  791. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +0 -9734
  792. package/packages/omo-codex/plugin/components/codegraph/package.json +0 -33
  793. package/packages/omo-codex/plugin/components/codegraph/src/cache-gc.ts +0 -29
  794. package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +0 -79
  795. package/packages/omo-codex/plugin/components/codegraph/src/hook-input.ts +0 -33
  796. package/packages/omo-codex/plugin/components/codegraph/src/hook-sweep.ts +0 -25
  797. package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +0 -131
  798. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +0 -258
  799. package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +0 -309
  800. package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +0 -80
  801. package/packages/omo-codex/plugin/components/codegraph/src/post-tool-use-hook.ts +0 -34
  802. package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +0 -29
  803. package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +0 -263
  804. package/packages/omo-codex/plugin/components/codegraph/src/session-start-command.ts +0 -106
  805. package/packages/omo-codex/plugin/components/codegraph/src/session-start-cooldown.ts +0 -145
  806. package/packages/omo-codex/plugin/components/codegraph/src/session-start-hook-runtime.ts +0 -21
  807. package/packages/omo-codex/plugin/components/codegraph/src/session-start-lock.ts +0 -139
  808. package/packages/omo-codex/plugin/components/codegraph/src/session-start-outcome.ts +0 -15
  809. package/packages/omo-codex/plugin/components/codegraph/src/session-start-paths.ts +0 -32
  810. package/packages/omo-codex/plugin/components/codegraph/src/session-start-project.ts +0 -109
  811. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker-result.ts +0 -148
  812. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +0 -175
  813. package/packages/omo-codex/plugin/components/codegraph/src/sweep-cli.ts +0 -81
  814. package/packages/omo-codex/plugin/components/codegraph/test/cache-gc.test.ts +0 -34
  815. package/packages/omo-codex/plugin/components/codegraph/test/hook-exclusion.test.ts +0 -112
  816. package/packages/omo-codex/plugin/components/codegraph/test/hook-registration.test.ts +0 -26
  817. package/packages/omo-codex/plugin/components/codegraph/test/hook-session-start-guard.test.ts +0 -160
  818. package/packages/omo-codex/plugin/components/codegraph/test/hook-store-upgrade.test.ts +0 -50
  819. package/packages/omo-codex/plugin/components/codegraph/test/hook-sweep.test.ts +0 -29
  820. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +0 -320
  821. package/packages/omo-codex/plugin/components/codegraph/test/mcp-bridge-fixtures.ts +0 -172
  822. package/packages/omo-codex/plugin/components/codegraph/test/package-runtime.test.ts +0 -91
  823. package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +0 -100
  824. package/packages/omo-codex/plugin/components/codegraph/test/serve-built-wrapper.test.ts +0 -76
  825. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts +0 -133
  826. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +0 -245
  827. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-facade.test.ts +0 -69
  828. package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +0 -43
  829. package/packages/omo-codex/plugin/components/codegraph/test/serve-provision.test.ts +0 -147
  830. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable.test.ts +0 -175
  831. package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +0 -385
  832. package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +0 -206
  833. package/packages/omo-codex/plugin/components/codegraph/test/session-start-project.test.ts +0 -58
  834. package/packages/omo-codex/plugin/components/codegraph/test/session-start-state.test.ts +0 -104
  835. package/packages/omo-codex/plugin/components/codegraph/test/session-start-trust-boundary.test.ts +0 -65
  836. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-availability.test.ts +0 -106
  837. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-cooldown.test.ts +0 -116
  838. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +0 -258
  839. package/packages/omo-codex/plugin/components/codegraph/test/sweep-cli.test.ts +0 -56
  840. package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +0 -13
  841. package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +0 -25
  842. package/packages/omo-codex/plugin/components/start-work-continuation/LICENSE +0 -21
  843. package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +0 -28
  844. package/packages/omo-codex/plugin/components/ultrawork/directive.md +0 -471
  845. package/packages/omo-codex/plugin/components/ultrawork/skills/ultrawork/SKILL.md +0 -478
  846. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +0 -18
  847. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +0 -17
  848. package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +0 -17
  849. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +0 -17
  850. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +0 -125
  851. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +0 -43
  852. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +0 -29
  853. package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +0 -121
  854. package/packages/omo-codex/plugin/skills/data-scientist/references/common-scenarios.md +0 -176
  855. package/packages/omo-codex/plugin/skills/data-scientist/references/execution-templates.md +0 -197
  856. package/packages/omo-codex/plugin/skills/data-scientist/references/integration-patterns.md +0 -153
  857. package/packages/omo-codex/plugin/skills/data-scientist/references/performance-benchmarks.md +0 -37
  858. package/packages/omo-codex/plugin/skills/start-work/agents/openai.yaml +0 -2
  859. package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +0 -92
  860. package/packages/omo-codex/plugin/test/component-codegraph-mcp-smoke.test.mjs +0 -76
  861. package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +0 -179
  862. package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +0 -314
  863. package/packages/omo-codex/plugin/test/ulw-plan-scope-contract.test.mjs +0 -24
  864. package/packages/shared-skills/skills/data-scientist/references/common-scenarios.md +0 -176
  865. package/packages/shared-skills/skills/data-scientist/references/execution-templates.md +0 -197
  866. package/packages/shared-skills/skills/data-scientist/references/integration-patterns.md +0 -153
  867. package/packages/shared-skills/skills/data-scientist/references/performance-benchmarks.md +0 -37
  868. /package/dist/hooks/{start-work → ulw-execute}/context-info-formatters.d.ts +0 -0
  869. /package/dist/hooks/{start-work → ulw-execute}/explicit-plan-context.d.ts +0 -0
  870. /package/dist/hooks/{start-work → ulw-execute}/notepad-scaffold.d.ts +0 -0
  871. /package/dist/hooks/{start-work → ulw-execute}/parse-user-request.d.ts +0 -0
  872. /package/dist/hooks/{start-work → ulw-execute}/plan-discovery-context.d.ts +0 -0
  873. /package/dist/hooks/{start-work → ulw-execute}/plan-selection.d.ts +0 -0
  874. /package/dist/hooks/{start-work → ulw-execute}/session-plan-affinity.d.ts +0 -0
  875. /package/dist/hooks/{start-work → ulw-execute}/work-initializer.d.ts +0 -0
  876. /package/dist/hooks/{start-work → ulw-execute}/worktree-block.d.ts +0 -0
  877. /package/dist/hooks/{start-work → ulw-execute}/worktree-detector.d.ts +0 -0
  878. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/.gitattributes +0 -0
  879. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/CHANGELOG.md +0 -0
  880. /package/packages/omo-codex/plugin/components/{codegraph → ulw-execute-continuation}/LICENSE +0 -0
  881. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/plan-checklist.ts +0 -0
  882. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/types.ts +0 -0
  883. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-completed.json +0 -0
  884. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-mixed-platforms.json +0 -0
  885. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-single-codex-work.json +0 -0
  886. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-all-done.md +0 -0
  887. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-scaffold.md +0 -0
  888. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-with-nested-checkboxes.md +0 -0
  889. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-with-unchecked.md +0 -0
  890. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/tsconfig.build.json +0 -0
  891. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/tsconfig.json +0 -0
  892. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/vitest.config.ts +0 -0
@@ -8,11 +8,13 @@ import { argv, execPath as execPath2, stderr } from "node:process";
8
8
  import { stdin as processStdin } from "node:process";
9
9
 
10
10
  // src/codex-hook.ts
11
- import { readFileSync as readFileSync9, realpathSync as realpathSync6 } from "node:fs";
11
+ import { readFileSync as readFileSync10, realpathSync as realpathSync8 } from "node:fs";
12
12
  import { homedir as homedir3 } from "node:os";
13
- import { join as join11, resolve as resolve11 } from "node:path";
13
+ import { join as join12, resolve as resolve12 } from "node:path";
14
14
 
15
15
  // ../../../../lsp-daemon/dist/client.js
16
+ import { statSync as statSync5 } from "node:fs";
17
+ import { isAbsolute as isAbsolute6 } from "node:path";
16
18
  import { connect } from "node:net";
17
19
  import { AsyncLocalStorage } from "node:async_hooks";
18
20
  import { existsSync, realpathSync, statSync } from "node:fs";
@@ -42,8 +44,8 @@ import * as path from "node:path";
42
44
  import { fileURLToPath } from "node:url";
43
45
  import { statSync as statSync2 } from "node:fs";
44
46
  import { isAbsolute as isAbsolute2 } from "node:path";
45
- import { existsSync as existsSync10, statSync as statSync4 } from "node:fs";
46
- import { dirname as dirname8, join as join4, resolve as resolve7 } from "node:path";
47
+ import { existsSync as existsSync11, realpathSync as realpathSync5, statSync as statSync4 } from "node:fs";
48
+ import { basename as basename3, dirname as dirname10, join as join5, resolve as resolve8 } from "node:path";
47
49
  import { basename as basename2, extname } from "node:path";
48
50
  import { resolve as resolve6 } from "node:path";
49
51
  import { pathToFileURL as pathToFileURL3 } from "node:url";
@@ -62,32 +64,32 @@ import { createHash as createHash2 } from "node:crypto";
62
64
  import { dirname as dirname5, relative as relative4, resolve as resolve4 } from "node:path";
63
65
  import { existsSync as existsSync6, lstatSync as lstatSync4, readdirSync as readdirSync2 } from "node:fs";
64
66
  import { dirname as dirname6, resolve as resolve5 } from "node:path";
65
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
66
- import { dirname as dirname7 } from "node:path";
67
- import { existsSync as existsSync8, readFileSync as readFileSync5 } from "node:fs";
68
- import { existsSync as existsSync9 } from "node:fs";
69
- import { delimiter as delimiter3, join as join3 } from "node:path";
70
- import { existsSync as existsSync11, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
71
- import { join as join5, resolve as resolve8 } from "node:path";
67
+ import { existsSync as existsSync7, realpathSync as realpathSync4 } from "node:fs";
68
+ import { dirname as dirname7, join as join3 } from "node:path";
69
+ import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
70
+ import { dirname as dirname8 } from "node:path";
71
+ import { existsSync as existsSync9, readFileSync as readFileSync5 } from "node:fs";
72
+ import { existsSync as existsSync10 } from "node:fs";
73
+ import { delimiter as delimiter3, dirname as dirname9, isAbsolute as isAbsolute5, join as join4, resolve as resolve7 } from "node:path";
74
+ import { existsSync as existsSync12, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
75
+ import { join as join6, resolve as resolve9 } from "node:path";
72
76
  import { fileURLToPath as fileURLToPath3 } from "node:url";
73
77
  import { lstatSync as lstatSync6, readdirSync as readdirSync4 } from "node:fs";
74
- import { join as join6 } from "node:path";
75
- import { statSync as statSync5 } from "node:fs";
76
- import { isAbsolute as isAbsolute5 } from "node:path";
78
+ import { join as join7 } from "node:path";
79
+ import { readFileSync as readFileSync6, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "node:fs";
77
80
 
78
81
  class LspRequestContextParseError extends Error {
79
- code;
80
- name = "LspRequestContextParseError";
81
82
  constructor(code, message) {
82
83
  super(message);
83
84
  this.code = code;
85
+ this.name = "LspRequestContextParseError";
84
86
  }
85
87
  }
86
88
 
87
89
  class LspRequestContextUnavailableError extends Error {
88
- name = "LspRequestContextUnavailableError";
89
90
  constructor() {
90
91
  super("LSP request context is required. Standalone MCP startup must install one with runWithRequestContext(createStandaloneMcpRequestContext()).");
92
+ this.name = "LspRequestContextUnavailableError";
91
93
  }
92
94
  }
93
95
  var storage = new AsyncLocalStorage;
@@ -214,7 +216,6 @@ function isPlainRecord(value) {
214
216
  }
215
217
 
216
218
  class DaemonRequestError extends Error {
217
- requestWritten;
218
219
  constructor(message, requestWritten) {
219
220
  super(message);
220
221
  this.name = "DaemonRequestError";
@@ -237,7 +238,6 @@ class DaemonRequestCancelledError extends DaemonRequestError {
237
238
  }
238
239
 
239
240
  class DaemonRequestTimedOutError extends DaemonRequestError {
240
- timeoutMs;
241
241
  constructor(requestWritten, timeoutMs) {
242
242
  super("daemon request timed out", requestWritten);
243
243
  this.name = "DaemonRequestTimedOutError";
@@ -314,20 +314,18 @@ var OMO_LSP_DAEMON_VERSION = "OMO_LSP_DAEMON_VERSION";
314
314
  var DAEMON_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
315
315
 
316
316
  class InvalidRuntimeOverrideError extends Error {
317
- code = "invalid_runtime_override";
318
- reason;
319
317
  constructor(reason, message) {
320
318
  super(message);
319
+ this.code = "invalid_runtime_override";
321
320
  this.name = "InvalidRuntimeOverrideError";
322
321
  this.reason = reason;
323
322
  }
324
323
  }
325
324
 
326
325
  class InvalidDaemonVersionError extends Error {
327
- code = "invalid_daemon_version";
328
- version;
329
326
  constructor(version) {
330
327
  super("LSP daemon version must match [A-Za-z0-9][A-Za-z0-9._+-]{0,127}");
328
+ this.code = "invalid_daemon_version";
331
329
  this.name = "InvalidDaemonVersionError";
332
330
  this.version = version;
333
331
  }
@@ -371,10 +369,9 @@ var requireFromHere = createRequire(import.meta.url);
371
369
  var MAX_SOCKET_PATH_LENGTH = 100;
372
370
 
373
371
  class InvalidDaemonDirectoryError extends Error {
374
- code = "invalid_daemon_directory";
375
- directory;
376
372
  constructor(directory) {
377
373
  super(`${OMO_LSP_DAEMON_DIR} must be an absolute path`);
374
+ this.code = "invalid_daemon_directory";
378
375
  this.name = "InvalidDaemonDirectoryError";
379
376
  this.directory = directory;
380
377
  }
@@ -565,7 +562,8 @@ function spawnDaemonProcess(paths) {
565
562
  try {
566
563
  const child = spawn(resolveDaemonNodeExecutable(), [paths.cliPath, "daemon"], {
567
564
  detached: true,
568
- stdio: ["ignore", logFd, logFd]
565
+ stdio: ["ignore", logFd, logFd],
566
+ windowsHide: true
569
567
  });
570
568
  child.once("spawn", () => closeSync2(logFd));
571
569
  child.once("error", (error) => {
@@ -686,22 +684,15 @@ function effectiveExtension(filePath) {
686
684
  }
687
685
 
688
686
  class LspConnectionClosedError extends Error {
689
- serverId;
690
- root;
691
- name = "LspConnectionClosedError";
692
687
  constructor(serverId, root, message) {
693
688
  super(message ?? `LSP connection closed for ${serverId} at ${root}`);
694
689
  this.serverId = serverId;
695
690
  this.root = root;
691
+ this.name = "LspConnectionClosedError";
696
692
  }
697
693
  }
698
694
 
699
695
  class LspProcessExitedError extends Error {
700
- serverId;
701
- root;
702
- exitCode;
703
- stderrTail;
704
- name = "LspProcessExitedError";
705
696
  constructor(serverId, root, exitCode, stderrTail) {
706
697
  const stderrSuffix = stderrTail ? `
707
698
  stderr tail: ${stderrTail}` : "";
@@ -710,46 +701,59 @@ stderr tail: ${stderrTail}` : "";
710
701
  this.root = root;
711
702
  this.exitCode = exitCode;
712
703
  this.stderrTail = stderrTail;
704
+ this.name = "LspProcessExitedError";
713
705
  }
714
706
  }
715
707
 
716
708
  class LspRequestTimeoutError extends Error {
717
- method;
718
- stderrTail;
719
- name = "LspRequestTimeoutError";
720
709
  constructor(method, stderrTail) {
721
710
  const stderrSuffix = stderrTail ? `
722
711
  recent stderr: ${stderrTail}` : "";
723
712
  super(`LSP request timeout (method: ${method})${stderrSuffix}`);
724
713
  this.method = method;
725
714
  this.stderrTail = stderrTail;
715
+ this.name = "LspRequestTimeoutError";
726
716
  }
727
717
  }
728
718
 
729
719
  class LspInvalidPathError extends Error {
730
- name = "LspInvalidPathError";
720
+ constructor() {
721
+ super(...arguments);
722
+ this.name = "LspInvalidPathError";
723
+ }
731
724
  }
732
725
 
733
726
  class LspServerLookupError extends Error {
734
- lookup;
735
- name = "LspServerLookupError";
736
727
  constructor(message, lookup) {
737
728
  super(message);
738
729
  this.lookup = lookup;
730
+ this.name = "LspServerLookupError";
739
731
  }
740
732
  }
741
733
 
742
734
  class LspServerInitializingError extends Error {
743
- originalError;
744
- name = "LspServerInitializingError";
745
735
  constructor(originalError) {
746
736
  super(`LSP server is still initializing. Please retry in a few seconds. Original error: ${originalError.message}`);
747
737
  this.originalError = originalError;
738
+ this.name = "LspServerInitializingError";
748
739
  }
749
740
  }
750
741
 
751
742
  class LspProcessSpawnError extends Error {
752
- name = "LspProcessSpawnError";
743
+ constructor() {
744
+ super(...arguments);
745
+ this.name = "LspProcessSpawnError";
746
+ }
747
+ }
748
+
749
+ class LspClientRespawnBudgetExceededError extends Error {
750
+ constructor(serverId, root, retryLimit) {
751
+ super(`LSP server ${serverId} at ${root} failed to stay alive; respawn budget exhausted ` + `(${retryLimit} consecutive dead generations). Retrying after the cooldown may succeed.`);
752
+ this.serverId = serverId;
753
+ this.root = root;
754
+ this.retryLimit = retryLimit;
755
+ this.name = "LspClientRespawnBudgetExceededError";
756
+ }
753
757
  }
754
758
  function isLspDeadConnectionError(err) {
755
759
  return err instanceof LspConnectionClosedError || err instanceof LspProcessExitedError;
@@ -762,6 +766,11 @@ function reportBestEffortCleanupError(operation, error, logger = writeCleanupErr
762
766
  const message = error instanceof Error ? error.message : String(error);
763
767
  logger(`[lsp] ignored ${operation} failure during cleanup: ${message}`);
764
768
  }
769
+ var realTimerProvider = {
770
+ now: () => Date.now(),
771
+ setTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
772
+ clearTimeout: (handle) => clearTimeout(handle)
773
+ };
765
774
  var DEFAULT_MAX_REFERENCES = 200;
766
775
  var DEFAULT_MAX_SYMBOLS = 200;
767
776
  var DEFAULT_MAX_DIAGNOSTICS = 200;
@@ -769,9 +778,12 @@ var DEFAULT_MAX_DIRECTORY_FILES = 50;
769
778
  var REQUEST_TIMEOUT_MS = 15000;
770
779
  var INIT_TIMEOUT_MS = 60000;
771
780
  var IDLE_TIMEOUT_MS = 5 * 60000;
781
+ var MAX_RESIDENT_CLIENTS = 6;
772
782
  var REAPER_INTERVAL_MS = 60000;
773
783
  var STOP_HARD_KILL_TIMEOUT_MS = 5000;
774
784
  var STOP_SIGKILL_GRACE_MS = 1000;
785
+ var CLIENT_RESPAWN_RETRY_LIMIT = 2;
786
+ var CLIENT_RESPAWN_COOLDOWN_MS = 60000;
775
787
  var HEADER_SEPARATOR2 = `\r
776
788
  \r
777
789
  `;
@@ -781,20 +793,31 @@ var METHOD_NOT_FOUND = -32601;
781
793
  var INTERNAL_ERROR = -32603;
782
794
 
783
795
  class JsonRpcConnection {
784
- reader;
785
- writer;
786
- pendingRequests = new Map;
787
- notificationHandlers = new Map;
788
- requestHandlers = new Map;
789
- closeHandlers = [];
790
- errorHandlers = [];
791
- inputBuffer = Buffer.alloc(0);
792
- nextRequestId = 1;
793
- listening = false;
794
- disposed = false;
795
796
  constructor(reader, writer) {
796
797
  this.reader = reader;
797
798
  this.writer = writer;
799
+ this.pendingRequests = new Map;
800
+ this.notificationHandlers = new Map;
801
+ this.requestHandlers = new Map;
802
+ this.closeHandlers = [];
803
+ this.errorHandlers = [];
804
+ this.inputBuffer = Buffer.alloc(0);
805
+ this.nextRequestId = 1;
806
+ this.listening = false;
807
+ this.disposed = false;
808
+ this.handleData = (chunk) => {
809
+ const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
810
+ this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
811
+ this.drainInputBuffer();
812
+ };
813
+ this.handleClose = () => {
814
+ for (const handler of this.closeHandlers) {
815
+ handler();
816
+ }
817
+ };
818
+ this.handleStreamError = (error) => {
819
+ this.emitError(error);
820
+ };
798
821
  }
799
822
  listen() {
800
823
  if (this.listening)
@@ -829,6 +852,7 @@ class JsonRpcConnection {
829
852
  let cancelAfterWrite = false;
830
853
  let settled = false;
831
854
  const writeCancel = () => this.writeMessage({ jsonrpc: "2.0", method: "$/cancelRequest", params: { id } });
855
+ let rejectAfterCancelWrite;
832
856
  const responsePromise = new Promise((resolve22, reject) => {
833
857
  const cleanup = () => {
834
858
  options.signal?.removeEventListener("abort", onAbort);
@@ -840,15 +864,19 @@ class JsonRpcConnection {
840
864
  this.pendingRequests.delete(key);
841
865
  cleanup();
842
866
  const rejectCancelled = () => reject(abortError2(options.signal));
867
+ rejectAfterCancelWrite = async () => {
868
+ try {
869
+ await writeCancel();
870
+ } catch (error) {
871
+ this.emitError(toError(error));
872
+ }
873
+ rejectCancelled();
874
+ };
843
875
  if (!requestWritten) {
844
876
  cancelAfterWrite = true;
845
- rejectCancelled();
846
877
  return;
847
878
  }
848
- writeCancel().then(rejectCancelled, (error) => {
849
- this.emitError(toError(error));
850
- rejectCancelled();
851
- });
879
+ rejectAfterCancelWrite();
852
880
  };
853
881
  const onAbort = () => settleCancel();
854
882
  this.pendingRequests.set(key, {
@@ -876,7 +904,7 @@ class JsonRpcConnection {
876
904
  await this.writeMessage(message);
877
905
  requestWritten = true;
878
906
  if (cancelAfterWrite)
879
- await writeCancel();
907
+ await rejectAfterCancelWrite?.();
880
908
  } catch (error) {
881
909
  if (settled)
882
910
  return responsePromise;
@@ -915,19 +943,6 @@ class JsonRpcConnection {
915
943
  this.notificationHandlers.clear();
916
944
  this.requestHandlers.clear();
917
945
  }
918
- handleData = (chunk) => {
919
- const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
920
- this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
921
- this.drainInputBuffer();
922
- };
923
- handleClose = () => {
924
- for (const handler of this.closeHandlers) {
925
- handler();
926
- }
927
- };
928
- handleStreamError = (error) => {
929
- this.emitError(error);
930
- };
931
946
  drainInputBuffer() {
932
947
  while (true) {
933
948
  const headerEnd = this.inputBuffer.indexOf(HEADER_SEPARATOR2);
@@ -1267,33 +1282,29 @@ function isPosition(value) {
1267
1282
  }
1268
1283
 
1269
1284
  class LspClientNotStartedError extends Error {
1270
- serverId;
1271
- root;
1272
- name = "LspClientNotStartedError";
1273
1285
  constructor(serverId, root) {
1274
1286
  super("LSP client not started");
1275
1287
  this.serverId = serverId;
1276
1288
  this.root = root;
1289
+ this.name = "LspClientNotStartedError";
1277
1290
  }
1278
1291
  }
1279
1292
 
1280
1293
  class LspClientTransport {
1281
- root;
1282
- server;
1283
- proc = null;
1284
- connection = null;
1285
- stderrBuffer = [];
1286
- processExited = false;
1287
- diagnosticsStore = new Map;
1288
- requestTimeoutMs;
1289
- initializeTimeoutMs;
1290
- workspaceApplyEditHandler = null;
1291
- diagnosticPullSupported = false;
1292
1294
  constructor(root, server2, timeouts = {}) {
1293
1295
  this.root = root;
1294
1296
  this.server = server2;
1297
+ this.proc = null;
1298
+ this.connection = null;
1299
+ this.stderrBuffer = [];
1300
+ this.processExited = false;
1301
+ this.diagnosticsStore = new Map;
1302
+ this.workspaceApplyEditHandler = null;
1303
+ this.diagnosticPullSupported = false;
1304
+ this.documentFormattingSupported = false;
1295
1305
  this.requestTimeoutMs = timeouts.requestTimeoutMs ?? REQUEST_TIMEOUT_MS;
1296
1306
  this.initializeTimeoutMs = timeouts.initializeTimeoutMs ?? INIT_TIMEOUT_MS;
1307
+ this.timerProvider = timeouts.timerProvider ?? realTimerProvider;
1297
1308
  }
1298
1309
  pid() {
1299
1310
  return this.proc?.pid;
@@ -1313,6 +1324,12 @@ class LspClientTransport {
1313
1324
  isDiagnosticPullSupported() {
1314
1325
  return this.diagnosticPullSupported;
1315
1326
  }
1327
+ setDocumentFormattingSupported(supported) {
1328
+ this.documentFormattingSupported = supported;
1329
+ }
1330
+ isDocumentFormattingSupported() {
1331
+ return this.documentFormattingSupported;
1332
+ }
1316
1333
  handlePublishDiagnostics(params) {
1317
1334
  this.diagnosticsStore.set(params.uri, [...params.diagnostics]);
1318
1335
  }
@@ -1388,7 +1405,7 @@ class LspClientTransport {
1388
1405
  const options = args[1];
1389
1406
  const timeoutMs = options?.timeoutMs ?? this.requestTimeoutMs;
1390
1407
  const timeoutController = new AbortController;
1391
- const timeoutHandle = setTimeout(() => {
1408
+ const timeoutHandle = this.timerProvider.setTimeout(() => {
1392
1409
  const stderrTail = this.stderrBuffer.slice(-5).join(`
1393
1410
  `);
1394
1411
  timeoutController.abort(new LspRequestTimeoutError(method, stderrTail || undefined));
@@ -1407,7 +1424,7 @@ class LspClientTransport {
1407
1424
  }
1408
1425
  throw error;
1409
1426
  } finally {
1410
- clearTimeout(timeoutHandle);
1427
+ this.timerProvider.clearTimeout(timeoutHandle);
1411
1428
  combinedSignal.dispose();
1412
1429
  }
1413
1430
  }
@@ -1524,6 +1541,14 @@ function supportsDiagnosticPull(capabilities) {
1524
1541
  return false;
1525
1542
  return Object.hasOwn(capabilities, "diagnosticProvider");
1526
1543
  }
1544
+ function supportsDocumentFormatting(capabilities) {
1545
+ if (capabilities === undefined)
1546
+ return false;
1547
+ const provider = capabilities.documentFormattingProvider;
1548
+ if (provider === undefined || provider === null || provider === false)
1549
+ return false;
1550
+ return provider === true || typeof provider === "object";
1551
+ }
1527
1552
 
1528
1553
  class LspClientConnection extends LspClientTransport {
1529
1554
  async initialize() {
@@ -1540,6 +1565,7 @@ class LspClientConnection extends LspClientTransport {
1540
1565
  references: {},
1541
1566
  documentSymbol: { hierarchicalDocumentSymbolSupport: true },
1542
1567
  publishDiagnostics: {},
1568
+ formatting: { dynamicRegistration: false },
1543
1569
  rename: {
1544
1570
  prepareSupport: true,
1545
1571
  prepareSupportDefaultBehavior: 1
@@ -1581,6 +1607,7 @@ class LspClientConnection extends LspClientTransport {
1581
1607
  initializationOptions: this.server.initialization
1582
1608
  }, { timeoutMs: this.initializeTimeoutMs });
1583
1609
  this.setDiagnosticPullSupported(supportsDiagnosticPull(result?.capabilities));
1610
+ this.setDocumentFormattingSupported(supportsDocumentFormatting(result?.capabilities));
1584
1611
  await this.sendNotification("initialized", {});
1585
1612
  await this.sendNotification("workspace/didChangeConfiguration", {
1586
1613
  settings: { json: { validate: { enable: true } } }
@@ -1767,6 +1794,17 @@ function canonicalPath(filePath) {
1767
1794
  return absolute;
1768
1795
  }
1769
1796
  }
1797
+ function normalizeDocumentUri(uri) {
1798
+ let decoded = uri;
1799
+ try {
1800
+ decoded = decodeURIComponent(uri);
1801
+ } catch {
1802
+ decoded = uri;
1803
+ }
1804
+ if (process.platform !== "win32")
1805
+ return decoded;
1806
+ return decoded.replace(/^(file:\/\/\/)([a-z]):/, (_match, prefix, drive) => `${prefix}${drive.toUpperCase()}:`);
1807
+ }
1770
1808
  function isSameOrDescendant(candidate, parent) {
1771
1809
  const suffix = relative2(parent, candidate);
1772
1810
  return suffix === "" || !suffix.startsWith("..") && suffix !== "..";
@@ -1777,17 +1815,18 @@ function movedPath(candidate, oldPath, newPath) {
1777
1815
  }
1778
1816
 
1779
1817
  class WorkspaceDocumentState {
1780
- sendNotification;
1781
- clearDiagnostics;
1782
- openDocuments = new Map;
1783
- openByUri = new Map;
1784
- openPromises = new Map;
1785
- now;
1786
- versionlessPublishQuiescenceMs;
1787
1818
  constructor(sendNotification, clearDiagnostics, options = {}) {
1788
1819
  this.sendNotification = sendNotification;
1789
1820
  this.clearDiagnostics = clearDiagnostics;
1790
- this.now = options.now ?? (() => Date.now());
1821
+ this.openDocuments = new Map;
1822
+ this.openByUri = new Map;
1823
+ this.openPromises = new Map;
1824
+ this.timerProvider = options.timerProvider ?? {
1825
+ now: options.now ?? (() => Date.now()),
1826
+ setTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
1827
+ clearTimeout: (handle) => clearTimeout(handle)
1828
+ };
1829
+ this.now = () => this.timerProvider.now();
1791
1830
  this.versionlessPublishQuiescenceMs = options.versionlessPublishQuiescenceMs ?? DEFAULT_VERSIONLESS_PUBLISH_QUIESCENCE_MS;
1792
1831
  }
1793
1832
  async openFile(filePath) {
@@ -1809,7 +1848,7 @@ class WorkspaceDocumentState {
1809
1848
  return this.openDocuments.get(canonicalPath(filePath))?.version;
1810
1849
  }
1811
1850
  getStoredDiagnostics(uri) {
1812
- const state = this.openByUri.get(uri);
1851
+ const state = this.openByUri.get(normalizeDocumentUri(uri));
1813
1852
  if (!state)
1814
1853
  return [];
1815
1854
  return state.lastPublish?.diagnostics ?? state.pullCache?.diagnostics ?? [];
@@ -1831,13 +1870,13 @@ class WorkspaceDocumentState {
1831
1870
  return state !== undefined && state.uri === snapshot.uri && state.version === snapshot.version && state.generation === snapshot.documentGeneration;
1832
1871
  }
1833
1872
  getPullCache(snapshot) {
1834
- const state = this.openByUri.get(snapshot.uri);
1873
+ const state = this.openByUri.get(normalizeDocumentUri(snapshot.uri));
1835
1874
  if (!state?.pullCache || state.pullCache.documentVersion !== snapshot.version)
1836
1875
  return null;
1837
1876
  return state.pullCache;
1838
1877
  }
1839
1878
  recordPullDiagnostics(snapshot, report) {
1840
- const state = this.openByUri.get(snapshot.uri);
1879
+ const state = this.openByUri.get(normalizeDocumentUri(snapshot.uri));
1841
1880
  if (!state)
1842
1881
  return;
1843
1882
  state.pullCache = {
@@ -1847,7 +1886,7 @@ class WorkspaceDocumentState {
1847
1886
  };
1848
1887
  }
1849
1888
  recordPublishedDiagnostics(params) {
1850
- const state = this.openByUri.get(params.uri);
1889
+ const state = this.openByUri.get(normalizeDocumentUri(params.uri));
1851
1890
  if (!state)
1852
1891
  return;
1853
1892
  state.publishGeneration += 1;
@@ -1861,7 +1900,7 @@ class WorkspaceDocumentState {
1861
1900
  this.notifyWaiters(state);
1862
1901
  }
1863
1902
  resolvePushDiagnostics(snapshot) {
1864
- const state = this.openByUri.get(snapshot.uri);
1903
+ const state = this.openByUri.get(normalizeDocumentUri(snapshot.uri));
1865
1904
  if (!state?.lastPublish)
1866
1905
  return { status: "missing" };
1867
1906
  const publish = state.lastPublish;
@@ -1875,7 +1914,7 @@ class WorkspaceDocumentState {
1875
1914
  return waitMs === 0 ? { status: "ready", diagnostics: publish.diagnostics } : { status: "wait", waitMs };
1876
1915
  }
1877
1916
  waitForDiagnosticsActivity(snapshot, timeoutMs) {
1878
- const state = this.openByUri.get(snapshot.uri);
1917
+ const state = this.openByUri.get(normalizeDocumentUri(snapshot.uri));
1879
1918
  if (!state || timeoutMs <= 0)
1880
1919
  return Promise.resolve();
1881
1920
  return new Promise((resolveActivity) => {
@@ -1884,11 +1923,11 @@ class WorkspaceDocumentState {
1884
1923
  if (settled)
1885
1924
  return;
1886
1925
  settled = true;
1887
- clearTimeout(timer);
1926
+ this.timerProvider.clearTimeout(timer);
1888
1927
  state.waiters.delete(finish);
1889
1928
  resolveActivity();
1890
1929
  };
1891
- const timer = setTimeout(finish, timeoutMs);
1930
+ const timer = this.timerProvider.setTimeout(finish, timeoutMs);
1892
1931
  if (typeof timer.unref === "function")
1893
1932
  timer.unref();
1894
1933
  state.waiters.add(finish);
@@ -1996,7 +2035,7 @@ class WorkspaceDocumentState {
1996
2035
  waiters: new Set
1997
2036
  };
1998
2037
  this.openDocuments.set(path2, state);
1999
- this.openByUri.set(state.uri, state);
2038
+ this.openByUri.set(normalizeDocumentUri(state.uri), state);
2000
2039
  this.notifyWaiters(state);
2001
2040
  await this.sendNotification("textDocument/didOpen", {
2002
2041
  textDocument: { uri: state.uri, languageId: state.languageId, version: state.version, text }
@@ -2021,7 +2060,7 @@ class WorkspaceDocumentState {
2021
2060
  }
2022
2061
  async closeDocument(state) {
2023
2062
  this.openDocuments.delete(state.path);
2024
- this.openByUri.delete(state.uri);
2063
+ this.openByUri.delete(normalizeDocumentUri(state.uri));
2025
2064
  this.clearDiagnostics(state.uri);
2026
2065
  this.notifyWaiters(state);
2027
2066
  await this.sendNotification("textDocument/didClose", { textDocument: { uri: state.uri } });
@@ -2040,13 +2079,11 @@ function workspaceApplyEditConcurrentFailureReason(phase) {
2040
2079
  }
2041
2080
 
2042
2081
  class WorkspaceEditPathError extends Error {
2043
- path;
2044
- detail;
2045
- name = "WorkspaceEditPathError";
2046
2082
  constructor(path2, detail) {
2047
2083
  super(`${detail}: ${path2}`);
2048
2084
  this.path = path2;
2049
2085
  this.detail = detail;
2086
+ this.name = "WorkspaceEditPathError";
2050
2087
  }
2051
2088
  }
2052
2089
  function isPathInsideWorkspace(filePath, workspaceRoot) {
@@ -2332,13 +2369,11 @@ function canonicalFingerprint(operations) {
2332
2369
  }
2333
2370
 
2334
2371
  class WorkspaceEditValidationError extends Error {
2335
- changeIndex;
2336
- detail;
2337
- name = "WorkspaceEditValidationError";
2338
2372
  constructor(changeIndex, detail) {
2339
2373
  super(`change ${changeIndex}: ${detail}`);
2340
2374
  this.changeIndex = changeIndex;
2341
2375
  this.detail = detail;
2376
+ this.name = "WorkspaceEditValidationError";
2342
2377
  }
2343
2378
  }
2344
2379
  function isRecord3(value) {
@@ -2820,10 +2855,9 @@ function simulateDelete(operation, virtual) {
2820
2855
  }
2821
2856
 
2822
2857
  class WorkspaceSnapshotBuilder {
2823
- workspaceRoot;
2824
- snapshots = new Map;
2825
2858
  constructor(workspaceRoot) {
2826
2859
  this.workspaceRoot = workspaceRoot;
2860
+ this.snapshots = new Map;
2827
2861
  }
2828
2862
  build(operations) {
2829
2863
  this.add(this.workspaceRoot, false);
@@ -2866,8 +2900,10 @@ function snapshotOperations(operations, workspaceRoot) {
2866
2900
  }
2867
2901
 
2868
2902
  class PlanPathIndex {
2869
- firstChangeByPath = new Map;
2870
- reportedPathByCanonical = new Map;
2903
+ constructor() {
2904
+ this.firstChangeByPath = new Map;
2905
+ this.reportedPathByCanonical = new Map;
2906
+ }
2871
2907
  build(operations) {
2872
2908
  for (const operation of operations) {
2873
2909
  switch (operation.kind) {
@@ -2954,14 +2990,11 @@ function isRecord4(value) {
2954
2990
  }
2955
2991
 
2956
2992
  class WorkspaceMutationController {
2957
- workspaceRoot;
2958
- documents;
2959
- activeLease = null;
2960
- nextLeaseId = 1;
2961
- io;
2962
2993
  constructor(workspaceRoot, documents) {
2963
2994
  this.workspaceRoot = workspaceRoot;
2964
2995
  this.documents = documents;
2996
+ this.activeLease = null;
2997
+ this.nextLeaseId = 1;
2965
2998
  }
2966
2999
  setIo(io) {
2967
3000
  this.io = io;
@@ -3072,14 +3105,12 @@ var DIAGNOSTICS_FRESHNESS_TIMEOUT_MS = 3000;
3072
3105
  var VERSIONLESS_PUBLISH_QUIESCENCE_MS = 250;
3073
3106
 
3074
3107
  class LspClient extends LspClientConnection {
3075
- diagnosticPullErrors = [];
3076
- documents;
3077
- workspaceMutations;
3078
- diagnosticsFreshnessTimeoutMs;
3079
3108
  constructor(root, server2, options = {}) {
3080
3109
  super(root, server2, options);
3110
+ this.diagnosticPullErrors = [];
3081
3111
  this.diagnosticsFreshnessTimeoutMs = options.diagnosticsFreshnessTimeoutMs ?? DIAGNOSTICS_FRESHNESS_TIMEOUT_MS;
3082
3112
  this.documents = new WorkspaceDocumentState((method, params) => this.sendNotification(method, params), (uri) => this.diagnosticsStore.delete(uri), {
3113
+ timerProvider: this.timerProvider,
3083
3114
  versionlessPublishQuiescenceMs: options.versionlessPublishQuiescenceMs ?? VERSIONLESS_PUBLISH_QUIESCENCE_MS
3084
3115
  });
3085
3116
  this.workspaceMutations = new WorkspaceMutationController(root, this.documents);
@@ -3132,6 +3163,18 @@ class LspClient extends LspClientConnection {
3132
3163
  textDocument: { uri: pathToFileURL3(absPath).href }
3133
3164
  }, options);
3134
3165
  }
3166
+ async formatDocument(filePath, options, signal) {
3167
+ if (!this.isDocumentFormattingSupported())
3168
+ return null;
3169
+ const absPath = this.resolveWorkspacePath(filePath);
3170
+ await this.openFile(absPath);
3171
+ const requestOptions = signal === undefined ? {} : { signal };
3172
+ const edits = await this.sendRequest("textDocument/formatting", {
3173
+ textDocument: { uri: pathToFileURL3(absPath).href },
3174
+ options
3175
+ }, requestOptions);
3176
+ return edits ?? [];
3177
+ }
3135
3178
  async workspaceSymbols(query, signal) {
3136
3179
  const options = signal === undefined ? {} : { signal };
3137
3180
  return this.sendRequest("workspace/symbol", { query }, options);
@@ -3171,7 +3214,7 @@ class LspClient extends LspClientConnection {
3171
3214
  const absPath = this.resolveWorkspacePath(filePath);
3172
3215
  const uri = pathToFileURL3(absPath).href;
3173
3216
  await this.openFile(absPath);
3174
- const deadlineAt = Date.now() + this.diagnosticsFreshnessTimeoutMs;
3217
+ const deadlineAt = this.timerProvider.now() + this.diagnosticsFreshnessTimeoutMs;
3175
3218
  for (;; ) {
3176
3219
  signal?.throwIfAborted();
3177
3220
  const snapshot = this.documents.captureDiagnosticSnapshot(absPath);
@@ -3184,7 +3227,7 @@ class LspClient extends LspClientConnection {
3184
3227
  if (!pushFallbackOnly) {
3185
3228
  const cached = this.documents.getPullCache(snapshot);
3186
3229
  try {
3187
- const remainingMs2 = deadlineAt - Date.now();
3230
+ const remainingMs2 = deadlineAt - this.timerProvider.now();
3188
3231
  if (remainingMs2 <= 0)
3189
3232
  return this.freshnessTimeout(absPath);
3190
3233
  const result = await this.sendRequest("textDocument/diagnostic", {
@@ -3219,7 +3262,7 @@ class LspClient extends LspClientConnection {
3219
3262
  }
3220
3263
  if (!pushFallbackOnly)
3221
3264
  continue;
3222
- const remainingMs = deadlineAt - Date.now();
3265
+ const remainingMs = deadlineAt - this.timerProvider.now();
3223
3266
  if (remainingMs <= 0) {
3224
3267
  if (!this.isDiagnosticPullSupported() && snapshot.publishGeneration === 0) {
3225
3268
  const cached = this.documents.getPullCache(snapshot);
@@ -3373,18 +3416,16 @@ function awaitWithSignal2(promise, signal) {
3373
3416
  }
3374
3417
 
3375
3418
  class LspManager {
3376
- clients = new Map;
3377
- reaperHandle = null;
3378
- signalDisposer = null;
3379
- disposed = false;
3380
- idleTimeoutMs;
3381
- initTimeoutMs;
3382
- reaperIntervalMs;
3383
- clientFactory;
3384
- now;
3385
3419
  constructor(options = {}) {
3420
+ this.clients = new Map;
3421
+ this.pendingStops = new Map;
3422
+ this.respawnBudgets = new Map;
3423
+ this.reaperHandle = null;
3424
+ this.signalDisposer = null;
3425
+ this.disposed = false;
3386
3426
  this.idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
3387
3427
  this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
3428
+ this.maxResidentClients = options.maxResidentClients ?? MAX_RESIDENT_CLIENTS;
3388
3429
  this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
3389
3430
  this.clientFactory = options.clientFactory ?? ((root, server2) => new LspClient(root, server2));
3390
3431
  this.now = options.now ?? (() => Date.now());
@@ -3404,24 +3445,79 @@ class LspManager {
3404
3445
  getKey(root, serverId) {
3405
3446
  return `${root}::${serverId}`;
3406
3447
  }
3448
+ tombstoneStop(key, client) {
3449
+ const stop = stopClientBestEffort(client);
3450
+ this.pendingStops.set(key, stop);
3451
+ stop.finally(() => {
3452
+ if (this.pendingStops.get(key) === stop) {
3453
+ this.pendingStops.delete(key);
3454
+ }
3455
+ });
3456
+ return stop;
3457
+ }
3458
+ recordDeadGeneration(key) {
3459
+ let budget = this.respawnBudgets.get(key);
3460
+ if (budget === undefined) {
3461
+ budget = { deadGenerations: 0, exhaustedAt: null };
3462
+ this.respawnBudgets.set(key, budget);
3463
+ }
3464
+ budget.deadGenerations += 1;
3465
+ }
3466
+ markHealthyGeneration(key) {
3467
+ this.respawnBudgets.delete(key);
3468
+ }
3469
+ ensureRespawnAllowed(key, root, serverId) {
3470
+ const budget = this.respawnBudgets.get(key);
3471
+ if (budget === undefined || budget.deadGenerations < CLIENT_RESPAWN_RETRY_LIMIT)
3472
+ return;
3473
+ if (budget.exhaustedAt === null) {
3474
+ budget.exhaustedAt = this.now();
3475
+ throw new LspClientRespawnBudgetExceededError(serverId, root, CLIENT_RESPAWN_RETRY_LIMIT);
3476
+ }
3477
+ if (this.now() - budget.exhaustedAt < CLIENT_RESPAWN_COOLDOWN_MS) {
3478
+ throw new LspClientRespawnBudgetExceededError(serverId, root, CLIENT_RESPAWN_RETRY_LIMIT);
3479
+ }
3480
+ budget.deadGenerations = 0;
3481
+ budget.exhaustedAt = null;
3482
+ }
3407
3483
  reapStale() {
3408
3484
  const t = this.now();
3409
3485
  for (const [key, managed] of this.clients) {
3410
3486
  if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
3411
- stopClientBestEffort(managed.client);
3412
3487
  this.clients.delete(key);
3488
+ this.tombstoneStop(key, managed.client);
3413
3489
  continue;
3414
3490
  }
3415
3491
  if (!managed.isInitializing && managed.refCount === 0 && managed.pendingWaiters === 0 && t - managed.lastUsedAt > this.idleTimeoutMs) {
3416
- stopClientBestEffort(managed.client);
3417
3492
  this.clients.delete(key);
3493
+ this.tombstoneStop(key, managed.client);
3418
3494
  }
3419
3495
  }
3420
3496
  }
3497
+ evictForAdmission() {
3498
+ while (this.clients.size >= this.maxResidentClients) {
3499
+ const victim = this.leastRecentlyUsedIdleClient();
3500
+ if (!victim)
3501
+ return;
3502
+ this.clients.delete(victim.key);
3503
+ this.tombstoneStop(victim.key, victim.managed.client);
3504
+ }
3505
+ }
3506
+ leastRecentlyUsedIdleClient() {
3507
+ let candidate = null;
3508
+ for (const [key, managed] of this.clients) {
3509
+ if (managed.refCount > 0 || managed.pendingWaiters > 0 || managed.isInitializing)
3510
+ continue;
3511
+ if (candidate === null || managed.lastUsedAt < candidate.managed.lastUsedAt) {
3512
+ candidate = { key, managed };
3513
+ }
3514
+ }
3515
+ return candidate;
3516
+ }
3421
3517
  async tryDeleteIfOrphaned(key, managed) {
3422
3518
  if (managed.refCount === 0 && managed.pendingWaiters === 0 && !managed.isInitializing && this.clients.get(key) === managed) {
3423
3519
  this.clients.delete(key);
3424
- await stopClientBestEffort(managed.client);
3520
+ await this.tombstoneStop(key, managed.client);
3425
3521
  }
3426
3522
  }
3427
3523
  async getClient(root, server2, signal) {
@@ -3430,12 +3526,22 @@ class LspManager {
3430
3526
  }
3431
3527
  signal?.throwIfAborted();
3432
3528
  const key = this.getKey(root, server2.id);
3529
+ for (;; ) {
3530
+ const pendingStop = this.pendingStops.get(key);
3531
+ if (pendingStop === undefined)
3532
+ break;
3533
+ await awaitWithSignal2(pendingStop, signal);
3534
+ signal?.throwIfAborted();
3535
+ }
3536
+ if (this.disposed) {
3537
+ throw new Error("LspManager has been disposed");
3538
+ }
3433
3539
  let managed = this.clients.get(key);
3434
3540
  if (managed) {
3435
3541
  const t = this.now();
3436
3542
  if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
3437
- await stopClientBestEffort(managed.client);
3438
3543
  this.clients.delete(key);
3544
+ await this.tombstoneStop(key, managed.client);
3439
3545
  managed = undefined;
3440
3546
  }
3441
3547
  }
@@ -3456,14 +3562,20 @@ class LspManager {
3456
3562
  signal.throwIfAborted();
3457
3563
  }
3458
3564
  if (!managed.client.isAlive()) {
3459
- await stopClientBestEffort(managed.client);
3460
- this.clients.delete(key);
3565
+ this.recordDeadGeneration(key);
3566
+ if (this.clients.get(key) === managed) {
3567
+ this.clients.delete(key);
3568
+ }
3569
+ await this.tombstoneStop(key, managed.client);
3461
3570
  return this.getClient(root, server2, signal);
3462
3571
  }
3572
+ this.markHealthyGeneration(key);
3463
3573
  managed.refCount++;
3464
3574
  managed.lastUsedAt = this.now();
3465
3575
  return managed.client;
3466
3576
  }
3577
+ this.evictForAdmission();
3578
+ this.ensureRespawnAllowed(key, root, server2.id);
3467
3579
  const client = this.clientFactory(root, server2);
3468
3580
  const initStartedAt = this.now();
3469
3581
  const initPromise = (async () => {
@@ -3487,7 +3599,7 @@ class LspManager {
3487
3599
  if (this.clients.get(key) === newManaged) {
3488
3600
  this.clients.delete(key);
3489
3601
  }
3490
- await stopClientBestEffort(client);
3602
+ await this.tombstoneStop(key, client);
3491
3603
  throw err;
3492
3604
  }
3493
3605
  newManaged.pendingWaiters--;
@@ -3498,6 +3610,15 @@ class LspManager {
3498
3610
  await this.tryDeleteIfOrphaned(key, newManaged);
3499
3611
  signal.throwIfAborted();
3500
3612
  }
3613
+ if (!client.isAlive()) {
3614
+ this.recordDeadGeneration(key);
3615
+ if (this.clients.get(key) === newManaged) {
3616
+ this.clients.delete(key);
3617
+ }
3618
+ await this.tombstoneStop(key, client);
3619
+ return this.getClient(root, server2, signal);
3620
+ }
3621
+ this.markHealthyGeneration(key);
3501
3622
  newManaged.refCount++;
3502
3623
  newManaged.lastUsedAt = this.now();
3503
3624
  return client;
@@ -3518,14 +3639,20 @@ class LspManager {
3518
3639
  if (client && managed.client !== client)
3519
3640
  return;
3520
3641
  this.clients.delete(key);
3521
- stopClientBestEffort(managed.client);
3642
+ this.tombstoneStop(key, managed.client);
3522
3643
  }
3523
3644
  warmupClient(root, server2) {
3524
3645
  if (this.disposed)
3525
3646
  return;
3526
3647
  const key = this.getKey(root, server2.id);
3527
- if (this.clients.has(key))
3648
+ if (this.clients.has(key) || this.pendingStops.has(key))
3528
3649
  return;
3650
+ this.evictForAdmission();
3651
+ try {
3652
+ this.ensureRespawnAllowed(key, root, server2.id);
3653
+ } catch {
3654
+ return;
3655
+ }
3529
3656
  const client = this.clientFactory(root, server2);
3530
3657
  const initStartedAt = this.now();
3531
3658
  const initPromise = (async () => {
@@ -3551,7 +3678,7 @@ class LspManager {
3551
3678
  if (this.clients.get(key) === managed) {
3552
3679
  this.clients.delete(key);
3553
3680
  }
3554
- stopClientBestEffort(client);
3681
+ this.tombstoneStop(key, client);
3555
3682
  });
3556
3683
  }
3557
3684
  isServerInitializing(root, serverId) {
@@ -3595,8 +3722,11 @@ class LspManager {
3595
3722
  for (const managed of this.clients.values()) {
3596
3723
  stopPromises.push(stopClientBestEffort(managed.client));
3597
3724
  }
3725
+ const tombstonedStops = [...this.pendingStops.values()];
3598
3726
  this.clients.clear();
3599
- await Promise.allSettled(stopPromises);
3727
+ this.respawnBudgets.clear();
3728
+ await Promise.allSettled([...stopPromises, ...tombstonedStops]);
3729
+ this.pendingStops.clear();
3600
3730
  }
3601
3731
  }
3602
3732
  var _defaultInstance = null;
@@ -3606,49 +3736,43 @@ function getLspManager() {
3606
3736
  }
3607
3737
  return _defaultInstance;
3608
3738
  }
3609
- function getInstallDecisionsPath() {
3610
- return lspRequestContext().installDecisionsPath;
3611
- }
3612
- function loadInstallDecisions() {
3613
- const path2 = getInstallDecisionsPath();
3614
- if (!existsSync7(path2))
3615
- return {};
3616
- try {
3617
- const parsed = JSON.parse(readFileSync4(path2, "utf8"));
3618
- return isInstallDecisions(parsed) ? parsed : {};
3619
- } catch {
3620
- return {};
3739
+ var GIT_WORKSPACE_MARKER = ".git";
3740
+ var PROJECT_WORKSPACE_MARKERS = [
3741
+ "package.json",
3742
+ "pyproject.toml",
3743
+ "Cargo.toml",
3744
+ "go.mod",
3745
+ "pom.xml",
3746
+ "build.gradle"
3747
+ ];
3748
+ var WORKSPACE_MARKERS = [GIT_WORKSPACE_MARKER, ...PROJECT_WORKSPACE_MARKERS];
3749
+ function findWorkspaceRootOutsideContext(directory) {
3750
+ const marked = nearestMarkedAncestor(directory);
3751
+ if (marked !== undefined)
3752
+ return marked;
3753
+ return realpathSync4(nearestExistingAncestor(directory));
3754
+ }
3755
+ function nearestMarkedAncestor(directory) {
3756
+ let current = directory;
3757
+ for (;; ) {
3758
+ if (existsSync7(current) && WORKSPACE_MARKERS.some((marker) => existsSync7(join3(current, marker)))) {
3759
+ return realpathSync4(current);
3760
+ }
3761
+ const parent = dirname7(current);
3762
+ if (parent === current)
3763
+ return;
3764
+ current = parent;
3621
3765
  }
3622
3766
  }
3623
- function loadInstallDecision(serverId) {
3624
- return loadInstallDecisions()[serverId];
3625
- }
3626
- function recordInstallDecision(serverId, decision, decidedAt = new Date().toISOString()) {
3627
- const decisions = loadInstallDecisions();
3628
- decisions[serverId] = { decision, decidedAt };
3629
- writeInstallDecisions(decisions);
3630
- }
3631
- function isInstallDecision(value) {
3632
- return value === "declined" || value === "allowed";
3633
- }
3634
- function writeInstallDecisions(decisions) {
3635
- const path2 = getInstallDecisionsPath();
3636
- mkdirSync3(dirname7(path2), { recursive: true });
3637
- const tmpPath = `${path2}.tmp`;
3638
- writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
3639
- `, "utf8");
3640
- renameSync2(tmpPath, path2);
3641
- }
3642
- function isInstallDecisions(value) {
3643
- return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
3644
- }
3645
- function isInstallDecisionRecord(value) {
3646
- if (!isRecord5(value))
3647
- return false;
3648
- return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
3649
- }
3650
- function isRecord5(value) {
3651
- return typeof value === "object" && value !== null && !Array.isArray(value);
3767
+ function nearestExistingAncestor(directory) {
3768
+ let current = directory;
3769
+ while (!existsSync7(current)) {
3770
+ const parent = dirname7(current);
3771
+ if (parent === current)
3772
+ return current;
3773
+ current = parent;
3774
+ }
3775
+ return current;
3652
3776
  }
3653
3777
  var LSP_INSTALL_HINTS = {
3654
3778
  typescript: "npm install -g typescript-language-server typescript",
@@ -3694,6 +3818,26 @@ var LSP_INSTALL_HINTS = {
3694
3818
  julials: `julia -e 'using Pkg; Pkg.add("LanguageServer")'`,
3695
3819
  razor: "Razor runs through the Roslyn language server (cohosting). " + "Install: dotnet tool install -g roslyn-language-server --prerelease (requires v5.8.0+). See https://github.com/dotnet/razor"
3696
3820
  };
3821
+ var LSP_LOCAL_INSTALL_HINTS = {
3822
+ typescript: "bun add -d typescript-language-server typescript",
3823
+ vue: "bun add -d @vue/language-server",
3824
+ eslint: "bun add -d vscode-langservers-extracted",
3825
+ oxlint: "bun add -d oxlint",
3826
+ biome: "bun add -d @biomejs/biome",
3827
+ svelte: "bun add -d svelte-language-server",
3828
+ astro: "bun add -d @astrojs/language-server",
3829
+ bash: "bun add -d bash-language-server",
3830
+ "bash-ls": "bun add -d bash-language-server",
3831
+ "yaml-ls": "bun add -d yaml-language-server",
3832
+ php: "bun add -d intelephense",
3833
+ prisma: "bun add -d prisma",
3834
+ dockerfile: "bun add -d dockerfile-language-server-nodejs",
3835
+ pyright: "uv add --dev pyright",
3836
+ basedpyright: "uv add --dev basedpyright",
3837
+ ruff: "uv add --dev ruff",
3838
+ ty: "uv add --dev ty",
3839
+ "ruby-lsp": "bundle add ruby-lsp --group development"
3840
+ };
3697
3841
  var BUILTIN_SERVERS = {
3698
3842
  typescript: {
3699
3843
  command: ["typescript-language-server", "--stdio"],
@@ -3795,6 +3939,50 @@ var BUILTIN_SERVERS = {
3795
3939
  extensions: [".razor", ".cshtml"]
3796
3940
  }
3797
3941
  };
3942
+ function getInstallDecisionsPath() {
3943
+ return lspRequestContext().installDecisionsPath;
3944
+ }
3945
+ function loadInstallDecisions() {
3946
+ const path2 = getInstallDecisionsPath();
3947
+ if (!existsSync8(path2))
3948
+ return {};
3949
+ try {
3950
+ const parsed = JSON.parse(readFileSync4(path2, "utf8"));
3951
+ return isInstallDecisions(parsed) ? parsed : {};
3952
+ } catch {
3953
+ return {};
3954
+ }
3955
+ }
3956
+ function loadInstallDecision(serverId) {
3957
+ return loadInstallDecisions()[serverId];
3958
+ }
3959
+ function recordInstallDecision(serverId, decision, decidedAt = new Date().toISOString()) {
3960
+ const decisions = loadInstallDecisions();
3961
+ decisions[serverId] = { decision, decidedAt };
3962
+ writeInstallDecisions(decisions);
3963
+ }
3964
+ function isInstallDecision(value) {
3965
+ return value === "declined" || value === "allowed";
3966
+ }
3967
+ function writeInstallDecisions(decisions) {
3968
+ const path2 = getInstallDecisionsPath();
3969
+ mkdirSync3(dirname8(path2), { recursive: true });
3970
+ const tmpPath = `${path2}.tmp`;
3971
+ writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
3972
+ `, "utf8");
3973
+ renameSync2(tmpPath, path2);
3974
+ }
3975
+ function isInstallDecisions(value) {
3976
+ return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
3977
+ }
3978
+ function isInstallDecisionRecord(value) {
3979
+ if (!isRecord5(value))
3980
+ return false;
3981
+ return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
3982
+ }
3983
+ function isRecord5(value) {
3984
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3985
+ }
3798
3986
  function getProjectConfigPaths() {
3799
3987
  return lspRequestContext().projectConfigPaths;
3800
3988
  }
@@ -3802,7 +3990,7 @@ function getUserConfigPath() {
3802
3990
  return lspRequestContext().userConfigPath;
3803
3991
  }
3804
3992
  function loadJsonFile(path2) {
3805
- if (!existsSync8(path2))
3993
+ if (!existsSync9(path2))
3806
3994
  return null;
3807
3995
  try {
3808
3996
  const parsed = JSON.parse(readFileSync5(path2, "utf-8"));
@@ -3988,50 +4176,151 @@ function getDisabledServerIds() {
3988
4176
  }
3989
4177
  return disabled;
3990
4178
  }
3991
- function isServerInstalled(command, _workingDirectory) {
3992
- if (command.length === 0)
3993
- return false;
3994
- const [cmd] = command;
3995
- if (!cmd)
3996
- return false;
3997
- if (cmd.includes("/") || cmd.includes("\\")) {
3998
- if (existsSync9(cmd))
3999
- return true;
4179
+ var LOCAL_BIN_RULES = [
4180
+ {
4181
+ markers: ["package.json", "bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"],
4182
+ binDirs: [join4("node_modules", ".bin")]
4183
+ },
4184
+ {
4185
+ markers: [
4186
+ "pyproject.toml",
4187
+ "ty.toml",
4188
+ "requirements.txt",
4189
+ "setup.py",
4190
+ "setup.cfg",
4191
+ "Pipfile",
4192
+ "pyrightconfig.json",
4193
+ "ruff.toml",
4194
+ ".ruff.toml"
4195
+ ],
4196
+ binDirs: [
4197
+ join4(".venv", "bin"),
4198
+ join4(".venv", "Scripts"),
4199
+ join4("venv", "bin"),
4200
+ join4("venv", "Scripts"),
4201
+ join4(".env", "bin"),
4202
+ join4(".env", "Scripts")
4203
+ ]
4204
+ },
4205
+ {
4206
+ markers: ["Gemfile", "Gemfile.lock"],
4207
+ binDirs: [join4("vendor", "bundle", "bin"), "bin"]
4208
+ },
4209
+ {
4210
+ markers: ["go.mod", "go.sum", "go.work"],
4211
+ binDirs: ["bin"]
4212
+ }
4213
+ ];
4214
+ var resolutionCache = new Map;
4215
+ var probeCount = 0;
4216
+ function probe(path2) {
4217
+ probeCount += 1;
4218
+ return existsSync10(path2);
4219
+ }
4220
+ function executableSuffixes(platform, pathExt) {
4221
+ if (platform !== "win32")
4222
+ return [""];
4223
+ const configured = pathExt ?? process.env["PATHEXT"] ?? "";
4224
+ const systemExts = configured.split(";").filter((entry) => entry.length > 0).map((entry) => entry.toLowerCase());
4225
+ return [...new Set(["", ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
4226
+ }
4227
+ function probeWithSuffixes(directory, command, suffixes) {
4228
+ for (const suffix of suffixes) {
4229
+ const candidate = join4(directory, command + suffix);
4230
+ if (probe(candidate))
4231
+ return candidate;
4000
4232
  }
4001
- const isWindows = process.platform === "win32";
4002
- let exts = [""];
4003
- if (isWindows) {
4004
- const pathExt = process.env["PATHEXT"] ?? "";
4005
- if (pathExt) {
4006
- const systemExts = pathExt.split(";").filter(Boolean);
4007
- exts = [...new Set([...exts, ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
4008
- } else {
4009
- exts = ["", ".exe", ".cmd", ".bat", ".ps1"];
4233
+ return null;
4234
+ }
4235
+ function resolveLocal(command, workingDirectory, suffixes, stopAt) {
4236
+ const boundary = stopAt === undefined ? undefined : resolve7(stopAt);
4237
+ let current = resolve7(workingDirectory);
4238
+ while (true) {
4239
+ for (const rule of LOCAL_BIN_RULES) {
4240
+ if (!rule.markers.some((marker) => probe(join4(current, marker))))
4241
+ continue;
4242
+ for (const binDir of rule.binDirs) {
4243
+ const found = probeWithSuffixes(join4(current, binDir), command, suffixes);
4244
+ if (found !== null)
4245
+ return found;
4246
+ }
4010
4247
  }
4248
+ if (probe(join4(current, ".git")))
4249
+ return null;
4250
+ if (boundary !== undefined && current === boundary)
4251
+ return null;
4252
+ const parent = dirname9(current);
4253
+ if (parent === current)
4254
+ return null;
4255
+ current = parent;
4011
4256
  }
4012
- let pathEnv = process.env["PATH"] ?? "";
4013
- if (isWindows && !pathEnv) {
4257
+ }
4258
+ function resolveFromPath(command, suffixes, platform, pathEnvOverride) {
4259
+ let pathEnv = pathEnvOverride ?? process.env["PATH"] ?? "";
4260
+ if (platform === "win32" && !pathEnv) {
4014
4261
  pathEnv = process.env["Path"] ?? "";
4015
4262
  }
4016
- const paths = pathEnv.split(delimiter3);
4017
- for (const p of paths) {
4018
- for (const suffix of exts) {
4019
- if (existsSync9(join3(p, cmd + suffix))) {
4020
- return true;
4021
- }
4022
- }
4263
+ for (const entry of pathEnv.split(delimiter3)) {
4264
+ if (entry.length === 0)
4265
+ continue;
4266
+ const found = probeWithSuffixes(entry, command, suffixes);
4267
+ if (found !== null)
4268
+ return found;
4023
4269
  }
4024
- if (cmd === "node")
4025
- return true;
4026
- return false;
4270
+ return null;
4271
+ }
4272
+ function resolveServerBinary(command, workingDirectory, options = {}) {
4273
+ if (command.length === 0)
4274
+ return null;
4275
+ const [cmd] = command;
4276
+ if (cmd === undefined || cmd.length === 0)
4277
+ return null;
4278
+ const platform = options.platform ?? process.platform;
4279
+ const suffixes = executableSuffixes(platform, options.pathExt);
4280
+ if (cmd.includes("/") || cmd.includes("\\")) {
4281
+ const explicit = isAbsolute5(cmd) ? cmd : resolve7(workingDirectory ?? process.cwd(), cmd);
4282
+ return probe(explicit) ? explicit : null;
4283
+ }
4284
+ const cacheKey = JSON.stringify([
4285
+ workingDirectory ?? "",
4286
+ cmd,
4287
+ platform,
4288
+ options.stopAt ?? "",
4289
+ options.pathExt ?? "",
4290
+ options.pathEnv ?? process.env["PATH"] ?? ""
4291
+ ]);
4292
+ const cached = resolutionCache.get(cacheKey);
4293
+ if (cached !== undefined)
4294
+ return cached;
4295
+ let resolved = null;
4296
+ if (workingDirectory !== undefined && workingDirectory.length > 0) {
4297
+ resolved = resolveLocal(cmd, workingDirectory, suffixes, options.stopAt);
4298
+ }
4299
+ resolved ??= resolveFromPath(cmd, suffixes, platform, options.pathEnv);
4300
+ if (resolved === null && cmd === "node")
4301
+ resolved = cmd;
4302
+ resolutionCache.set(cacheKey, resolved);
4303
+ return resolved;
4304
+ }
4305
+ function isServerInstalled(command, workingDirectory, options = {}) {
4306
+ if (command.length === 0)
4307
+ return false;
4308
+ return resolveServerBinary(command, workingDirectory, options) !== null;
4309
+ }
4310
+ function withResolvedCommand(command, binaryPath) {
4311
+ return [binaryPath, ...command.slice(1)];
4027
4312
  }
4028
4313
  function findServerForExtension(ext) {
4029
4314
  const servers = getMergedServers();
4315
+ const workingDirectory = contextCwd();
4030
4316
  for (const server2 of servers) {
4031
- if (server2.extensions.includes(ext) && isServerInstalled(server2.command)) {
4317
+ if (!server2.extensions.includes(ext))
4318
+ continue;
4319
+ const binaryPath = resolveServerBinary(server2.command, workingDirectory);
4320
+ if (binaryPath !== null) {
4032
4321
  const resolvedServer = {
4033
4322
  id: server2.id,
4034
- command: server2.command,
4323
+ command: withResolvedCommand(server2.command, binaryPath),
4035
4324
  extensions: server2.extensions,
4036
4325
  priority: server2.priority
4037
4326
  };
@@ -4078,6 +4367,7 @@ function findServerForExtension(ext) {
4078
4367
  function getAllServers() {
4079
4368
  const servers = getMergedServers();
4080
4369
  const disabled = getDisabledServerIds();
4370
+ const workingDirectory = contextCwd();
4081
4371
  const result = [];
4082
4372
  const seen = new Set;
4083
4373
  for (const server2 of servers) {
@@ -4085,7 +4375,7 @@ function getAllServers() {
4085
4375
  continue;
4086
4376
  result.push({
4087
4377
  id: server2.id,
4088
- installed: isServerInstalled(server2.command),
4378
+ installed: isServerInstalled(server2.command, workingDirectory),
4089
4379
  extensions: server2.extensions,
4090
4380
  disabled: false,
4091
4381
  source: server2.source,
@@ -4099,7 +4389,7 @@ function getAllServers() {
4099
4389
  const builtin = BUILTIN_SERVERS[id];
4100
4390
  result.push({
4101
4391
  id,
4102
- installed: builtin ? isServerInstalled(builtin.command) : false,
4392
+ installed: builtin ? isServerInstalled(builtin.command, workingDirectory) : false,
4103
4393
  extensions: builtin?.extensions ?? [],
4104
4394
  disabled: true,
4105
4395
  source: "disabled",
@@ -4108,7 +4398,6 @@ function getAllServers() {
4108
4398
  }
4109
4399
  return result;
4110
4400
  }
4111
- var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
4112
4401
  function isDirectoryPath(filePath) {
4113
4402
  try {
4114
4403
  return statSync4(filePath).isDirectory();
@@ -4117,32 +4406,90 @@ function isDirectoryPath(filePath) {
4117
4406
  }
4118
4407
  }
4119
4408
  function findWorkspaceRoot(filePath) {
4120
- const abs = resolvePathInsideContext(filePath);
4409
+ const cwd = contextCwd();
4410
+ const abs = resolveReadablePathInsideContext(filePath);
4121
4411
  let dir = abs;
4122
4412
  if (!isDirectoryPath(dir)) {
4123
- dir = dirname8(dir);
4124
- }
4125
- let prevDir = "";
4126
- while (dir !== prevDir) {
4127
- for (const marker of WORKSPACE_MARKERS) {
4128
- if (existsSync10(join4(dir, marker))) {
4129
- return dir;
4413
+ dir = dirname10(dir);
4414
+ }
4415
+ if (!isPathInside(cwd, abs))
4416
+ return findWorkspaceRootOutsideContext(dir);
4417
+ const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
4418
+ let nearestPackageRoot;
4419
+ while (isPathInside(cwd, dir)) {
4420
+ const canonicalDir = existingDirectoryInsideContext(dir, cwd);
4421
+ if (canonicalDir !== undefined) {
4422
+ if (existsSync11(join5(dir, GIT_WORKSPACE_MARKER))) {
4423
+ return canonicalDir;
4424
+ }
4425
+ if (nearestPackageRoot === undefined && hasProjectWorkspaceMarker(dir)) {
4426
+ nearestPackageRoot = canonicalDir;
4130
4427
  }
4131
4428
  }
4132
- prevDir = dir;
4133
- dir = dirname8(dir);
4429
+ if (dir === cwd)
4430
+ break;
4431
+ dir = dirname10(dir);
4134
4432
  }
4135
- return dirname8(abs);
4433
+ return nearestPackageRoot ?? fallbackRoot;
4434
+ }
4435
+ function hasProjectWorkspaceMarker(directory) {
4436
+ return PROJECT_WORKSPACE_MARKERS.some((marker) => existsSync11(join5(directory, marker)));
4437
+ }
4438
+ function resolveReadablePathInsideContext(filePath) {
4439
+ const cwd = contextCwd();
4440
+ const abs = resolve8(cwd, filePath);
4441
+ if (isPathInside(cwd, abs))
4442
+ return abs;
4443
+ const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
4444
+ if (rebased !== undefined)
4445
+ return rebased;
4446
+ return canonicalizeExistingOrNearestAncestor(abs);
4136
4447
  }
4137
4448
  function resolvePathInsideContext(filePath) {
4138
4449
  const cwd = contextCwd();
4139
- const abs = resolve7(cwd, filePath);
4450
+ const abs = resolveReadablePathInsideContext(filePath);
4140
4451
  const canonical = canonicalizeExistingOrNearestAncestor(abs);
4141
4452
  if (!isPathInside(cwd, canonical)) {
4142
4453
  throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
4143
4454
  }
4144
4455
  return canonical;
4145
4456
  }
4457
+ function rebaseThroughCanonicalAncestor(path2, cwd) {
4458
+ let current = path2;
4459
+ const suffix = [];
4460
+ while (true) {
4461
+ if (existsSync11(current)) {
4462
+ const canonical = realpathSync5(current);
4463
+ if (isPathInside(cwd, canonical))
4464
+ return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
4465
+ }
4466
+ const parent = dirname10(current);
4467
+ if (parent === current)
4468
+ return;
4469
+ suffix.unshift(basename3(current));
4470
+ current = parent;
4471
+ }
4472
+ }
4473
+ function existingDirectoryInsideContext(directory, cwd) {
4474
+ if (!existsSync11(directory))
4475
+ return;
4476
+ const canonical = realpathSync5(directory);
4477
+ if (!statSync4(canonical).isDirectory())
4478
+ return;
4479
+ return isPathInside(cwd, canonical) ? canonical : undefined;
4480
+ }
4481
+ function nearestExistingDirectoryInsideContext(directory, cwd) {
4482
+ let current = directory;
4483
+ while (isPathInside(cwd, current)) {
4484
+ const canonical = existingDirectoryInsideContext(current, cwd);
4485
+ if (canonical !== undefined)
4486
+ return canonical;
4487
+ if (current === cwd)
4488
+ return;
4489
+ current = dirname10(current);
4490
+ }
4491
+ return;
4492
+ }
4146
4493
  function formatServerLookupError(result) {
4147
4494
  if (result.status === "not_installed") {
4148
4495
  return formatNotInstalled(result);
@@ -4166,6 +4513,19 @@ function formatServerLookupError(result) {
4166
4513
  ].join(`
4167
4514
  `);
4168
4515
  }
4516
+ function formatInstallOptions(serverId, installHint) {
4517
+ const localHint = LSP_LOCAL_INSTALL_HINTS[serverId];
4518
+ if (localHint === undefined) {
4519
+ return ["To install, run:", ` ${installHint}`];
4520
+ }
4521
+ return [
4522
+ "To install in THIS repository (preferred — no global install needed):",
4523
+ ` ${localHint}`,
4524
+ "",
4525
+ "Or install it globally:",
4526
+ ` ${installHint}`
4527
+ ];
4528
+ }
4169
4529
  function formatNotInstalled(result) {
4170
4530
  const { server: server2, installHint } = result;
4171
4531
  const extensions = server2.extensions.join(", ");
@@ -4180,19 +4540,19 @@ function formatNotInstalled(result) {
4180
4540
  `Command not found: ${server2.command[0]}`,
4181
4541
  ""
4182
4542
  ];
4543
+ const installOptions = formatInstallOptions(server2.id, installHint);
4183
4544
  if (decision === "allowed") {
4184
4545
  return [
4185
4546
  ...header,
4186
4547
  "The user has pre-authorized LSP installation. Run the install command, then retry this tool:",
4187
- ` ${installHint}`
4548
+ ...installOptions.slice(1)
4188
4549
  ].join(`
4189
4550
  `);
4190
4551
  }
4191
4552
  if (!context.capabilities.installDecisionTool) {
4192
4553
  return [
4193
4554
  ...header,
4194
- "To install, run:",
4195
- ` ${installHint}`,
4555
+ ...installOptions,
4196
4556
  "",
4197
4557
  "ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
4198
4558
  "Install-decision recording is unavailable in this harness; proceed without LSP if the user declines."
@@ -4201,8 +4561,7 @@ function formatNotInstalled(result) {
4201
4561
  }
4202
4562
  return [
4203
4563
  ...header,
4204
- "To install, run:",
4205
- ` ${installHint}`,
4564
+ ...installOptions,
4206
4565
  "",
4207
4566
  "ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
4208
4567
  "- If the user agrees: run the install command above, then retry this tool.",
@@ -4213,7 +4572,7 @@ function formatNotInstalled(result) {
4213
4572
  ].join(`
4214
4573
  `);
4215
4574
  }
4216
- var READ_ONLY_RETRY_TOOLS = new Set([
4575
+ var READ_ONLY_TOOLS = new Set([
4217
4576
  "diagnostics",
4218
4577
  "definition",
4219
4578
  "references",
@@ -4222,7 +4581,7 @@ var READ_ONLY_RETRY_TOOLS = new Set([
4222
4581
  "prepareRename"
4223
4582
  ]);
4224
4583
  async function withLspClient(filePath, fn, toolName, options = {}) {
4225
- const absPath = resolvePathInsideContext(filePath);
4584
+ const absPath = READ_ONLY_TOOLS.has(toolName) ? resolveReadablePathInsideContext(filePath) : resolvePathInsideContext(filePath);
4226
4585
  if (isDirectoryPath(absPath)) {
4227
4586
  throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
4228
4587
  }
@@ -4237,9 +4596,9 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
4237
4596
  const acquireAndCall = async (allowRetry) => {
4238
4597
  const client = await manager.getClient(root, server2, options.signal);
4239
4598
  try {
4240
- return await fn(client, root);
4599
+ return await fn(client, root, absPath);
4241
4600
  } catch (err) {
4242
- if (allowRetry && READ_ONLY_RETRY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
4601
+ if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
4243
4602
  manager.invalidateClient(root, server2.id, client);
4244
4603
  return acquireAndCall(false);
4245
4604
  }
@@ -4379,7 +4738,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
4379
4738
  for (const entry of entries) {
4380
4739
  if (files.length >= maxFiles)
4381
4740
  return;
4382
- const fullPath = join5(currentDir, entry);
4741
+ const fullPath = join6(currentDir, entry);
4383
4742
  let stat;
4384
4743
  try {
4385
4744
  stat = lstatSync5(fullPath);
@@ -4404,8 +4763,8 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
4404
4763
  if (!extension.startsWith(".")) {
4405
4764
  throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
4406
4765
  }
4407
- const absDir = resolve8(options.workspaceRoot ?? contextCwd(), directory);
4408
- if (!existsSync11(absDir)) {
4766
+ const absDir = resolve9(options.workspaceRoot ?? contextCwd(), directory);
4767
+ if (!existsSync12(absDir)) {
4409
4768
  throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
4410
4769
  }
4411
4770
  const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
@@ -4506,7 +4865,7 @@ function inferExtensionFromDirectory(directory) {
4506
4865
  for (const entry of entries) {
4507
4866
  if (scanned >= MAX_SCAN_ENTRIES)
4508
4867
  return;
4509
- const fullPath = join6(dir, entry);
4868
+ const fullPath = join7(dir, entry);
4510
4869
  let stat;
4511
4870
  try {
4512
4871
  stat = lstatSync6(fullPath);
@@ -4669,7 +5028,7 @@ async function executeLspDiagnostics(params, signal) {
4669
5028
  const filePath = requireString(params, "filePath");
4670
5029
  const severity = severityFilter(params);
4671
5030
  try {
4672
- const absPath = resolvePathInsideContext(filePath);
5031
+ const absPath = resolveReadablePathInsideContext(filePath);
4673
5032
  if (isDirectoryPath(absPath)) {
4674
5033
  const extension = inferExtensionFromDirectory(absPath);
4675
5034
  if (!extension) {
@@ -4698,7 +5057,7 @@ async function executeLspDiagnostics(params, signal) {
4698
5057
  };
4699
5058
  return text(output2.output, details2);
4700
5059
  }
4701
- const result = await withLspClient(filePath, async (client) => client.diagnostics(filePath, signal), "diagnostics", clientOptions(signal));
5060
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
4702
5061
  if (result.transientError) {
4703
5062
  const message = result.transientError.message;
4704
5063
  const details2 = {
@@ -4745,6 +5104,91 @@ async function executeLspDiagnostics(params, signal) {
4745
5104
  throw error;
4746
5105
  }
4747
5106
  }
5107
+ var DEFAULT_FORMATTING_OPTIONS = {
5108
+ tabSize: 4,
5109
+ insertSpaces: false,
5110
+ trimTrailingWhitespace: true,
5111
+ insertFinalNewline: true,
5112
+ trimFinalNewlines: true
5113
+ };
5114
+ var UNCHANGED = { status: "unchanged", linesAdded: 0, linesRemoved: 0 };
5115
+ async function formatDocumentWithClient(client, filePath, options = {}) {
5116
+ const edits = await client.formatDocument(filePath, options.formattingOptions ?? DEFAULT_FORMATTING_OPTIONS, options.signal);
5117
+ if (edits === null)
5118
+ return { status: "unavailable", reason: "capability_not_advertised" };
5119
+ if (edits.length === 0)
5120
+ return UNCHANGED;
5121
+ const before = readFileSync6(filePath, "utf-8");
5122
+ const normalized = normalizeTextEdits(before, edits, 0);
5123
+ if (normalized.text === before)
5124
+ return UNCHANGED;
5125
+ writeAtomically(filePath, normalized.text);
5126
+ await client.openFile(filePath);
5127
+ return {
5128
+ status: "formatted",
5129
+ ...lineDelta(normalized.edits)
5130
+ };
5131
+ }
5132
+ function lineDelta(edits) {
5133
+ let linesAdded = 0;
5134
+ let linesRemoved = 0;
5135
+ for (const edit of edits) {
5136
+ linesRemoved += edit.range.end.line - edit.range.start.line + 1;
5137
+ linesAdded += edit.newText.split(`
5138
+ `).length;
5139
+ }
5140
+ return { linesAdded, linesRemoved };
5141
+ }
5142
+ function writeAtomically(filePath, content) {
5143
+ const tempPath = `${filePath}.omo-format.tmp`;
5144
+ writeFileSync3(tempPath, content, "utf-8");
5145
+ try {
5146
+ renameSync3(tempPath, filePath);
5147
+ } catch (error) {
5148
+ try {
5149
+ unlinkSync2(tempPath);
5150
+ } catch {}
5151
+ throw error;
5152
+ }
5153
+ }
5154
+ async function executeLspFormat(params, signal) {
5155
+ const filePath = requireString(params, "filePath");
5156
+ try {
5157
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => formatDocumentWithClient(client, resolvedFilePath, signal === undefined ? {} : { signal }), "format", clientOptions(signal));
5158
+ return text(describeResult(filePath, result), formatDetails(filePath, result));
5159
+ } catch (error) {
5160
+ const missingDependency = missingDependencyResult(error, {
5161
+ filePath,
5162
+ status: "unavailable",
5163
+ reason: "server_unavailable",
5164
+ linesAdded: 0,
5165
+ linesRemoved: 0
5166
+ });
5167
+ if (missingDependency)
5168
+ return missingDependency;
5169
+ throw error;
5170
+ }
5171
+ }
5172
+ function formatDetails(filePath, result) {
5173
+ if (result.status === "unavailable") {
5174
+ return { filePath, status: "unavailable", reason: result.reason, linesAdded: 0, linesRemoved: 0 };
5175
+ }
5176
+ return {
5177
+ filePath,
5178
+ status: result.status,
5179
+ linesAdded: result.linesAdded,
5180
+ linesRemoved: result.linesRemoved
5181
+ };
5182
+ }
5183
+ function describeResult(filePath, result) {
5184
+ if (result.status === "unavailable") {
5185
+ return `Formatting unavailable for ${filePath}: the language server does not advertise documentFormattingProvider.`;
5186
+ }
5187
+ if (result.status === "unchanged") {
5188
+ return `Already formatted: ${filePath}`;
5189
+ }
5190
+ return `Formatted ${filePath} (+${result.linesAdded}/-${result.linesRemoved} lines)`;
5191
+ }
4748
5192
  async function executeLspInstallDecision(params) {
4749
5193
  const serverId = requireString(params, "server_id");
4750
5194
  const decision = params["decision"];
@@ -4770,7 +5214,7 @@ async function executeLspGotoDefinition(params, signal) {
4770
5214
  const line = requireNumber(params, "line");
4771
5215
  const character = requireNumber(params, "character");
4772
5216
  try {
4773
- const result = await withLspClient(filePath, async (client) => client.definition(filePath, line, character, signal), "definition", clientOptions(signal));
5217
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.definition(resolvedFilePath, line, character, signal), "definition", clientOptions(signal));
4774
5218
  const locations = !result ? [] : Array.isArray(result) ? result : [result];
4775
5219
  const details = { filePath, line, character, locations };
4776
5220
  if (locations.length === 0)
@@ -4795,7 +5239,7 @@ async function executeLspFindReferences(params, signal) {
4795
5239
  const character = requireNumber(params, "character");
4796
5240
  const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
4797
5241
  try {
4798
- const result = await withLspClient(filePath, async (client) => client.references(filePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
5242
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.references(resolvedFilePath, line, character, includeDeclaration, signal), "references", clientOptions(signal));
4799
5243
  const references = Array.isArray(result) ? result : [];
4800
5244
  const total = references.length;
4801
5245
  const truncated = total > DEFAULT_MAX_REFERENCES;
@@ -4835,7 +5279,7 @@ async function executeLspPrepareRename(params, signal) {
4835
5279
  const line = requireNumber(params, "line");
4836
5280
  const character = requireNumber(params, "character");
4837
5281
  try {
4838
- const result = await withLspClient(filePath, async (client) => client.prepareRename(filePath, line, character, signal), "prepareRename", clientOptions(signal));
5282
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.prepareRename(resolvedFilePath, line, character, signal), "prepareRename", clientOptions(signal));
4839
5283
  const details = { filePath, line, character, result };
4840
5284
  return text(formatPrepareRenameResult(result), details);
4841
5285
  } catch (error) {
@@ -4856,7 +5300,7 @@ async function executeLspRename(params, signal) {
4856
5300
  const character = requireNumber(params, "character");
4857
5301
  const newName = requireString(params, "newName");
4858
5302
  try {
4859
- const result = await withLspClient(filePath, async (client) => client.rename(filePath, line, character, newName, signal), "rename", clientOptions(signal));
5303
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.rename(resolvedFilePath, line, character, newName, signal), "rename", clientOptions(signal));
4860
5304
  const details = { filePath, line, character, newName, apply: result.apply, edit: result.edit };
4861
5305
  return text(formatApplyResult(result.apply), details, !result.apply.success);
4862
5306
  } catch (error) {
@@ -4930,7 +5374,7 @@ async function executeLspSymbols(params, signal) {
4930
5374
  const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
4931
5375
  return formatSymbolsResult(filePath, scope, symbols2, limit, query);
4932
5376
  }
4933
- const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(filePath, signal), "documentSymbols", clientOptions(signal));
5377
+ const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
4934
5378
  return formatSymbolsResult(filePath, scope, symbols, limit);
4935
5379
  } catch (error) {
4936
5380
  const query = optionalString(params, "query");
@@ -5064,6 +5508,16 @@ var LSP_MCP_TOOLS = [
5064
5508
  }, ["filePath", "line", "character", "newName"]),
5065
5509
  execute: executeLspRename
5066
5510
  },
5511
+ {
5512
+ name: "format",
5513
+ aliases: ["lsp_format"],
5514
+ title: "LSP Format",
5515
+ description: "Format a source file with its language server and write the returned edits to disk.",
5516
+ inputSchema: objectSchema({
5517
+ filePath: { type: "string", description: "Source file path to format." }
5518
+ }, ["filePath"]),
5519
+ execute: executeLspFormat
5520
+ },
5067
5521
  {
5068
5522
  name: "install_decision",
5069
5523
  aliases: ["lsp_install_decision"],
@@ -5130,7 +5584,7 @@ function withContext(args, context) {
5130
5584
  function ensureDaemonAvailable(paths, ensure, signal) {
5131
5585
  if (!signal)
5132
5586
  return ensure(paths);
5133
- return new Promise((resolve9, reject) => {
5587
+ return new Promise((resolve10, reject) => {
5134
5588
  let settled = false;
5135
5589
  const finish = (run) => {
5136
5590
  if (settled)
@@ -5145,11 +5599,11 @@ function ensureDaemonAvailable(paths, ensure, signal) {
5145
5599
  return;
5146
5600
  }
5147
5601
  signal.addEventListener("abort", onAbort, { once: true });
5148
- Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve9()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
5602
+ Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve10()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
5149
5603
  });
5150
5604
  }
5151
5605
  function sendToolCall(paths, token, name, args, options) {
5152
- return new Promise((resolve9, reject) => {
5606
+ return new Promise((resolve10, reject) => {
5153
5607
  const socket = connect(paths.socket);
5154
5608
  const requestId = allocateProxyRequestId();
5155
5609
  let settled = false;
@@ -5202,7 +5656,7 @@ function sendToolCall(paths, token, name, args, options) {
5202
5656
  }
5203
5657
  const result = toToolResult(message, requestId);
5204
5658
  if (result)
5205
- finish(() => resolve9(result));
5659
+ finish(() => resolve10(result));
5206
5660
  else
5207
5661
  finish(() => reject(new DaemonRequestError("invalid daemon response", requestWritten)));
5208
5662
  });
@@ -5251,10 +5705,9 @@ var OMO_LSP_DAEMON_VERSION2 = "OMO_LSP_DAEMON_VERSION";
5251
5705
  var DAEMON_VERSION_PATTERN2 = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
5252
5706
 
5253
5707
  class InvalidRuntimeOverrideError2 extends Error {
5254
- code = "invalid_runtime_override";
5255
- reason;
5256
5708
  constructor(reason, message) {
5257
5709
  super(message);
5710
+ this.code = "invalid_runtime_override";
5258
5711
  this.name = "InvalidRuntimeOverrideError";
5259
5712
  this.reason = reason;
5260
5713
  }
@@ -5274,12 +5727,12 @@ function resolveDaemonRuntime2(env, defaults) {
5274
5727
  throw new InvalidRuntimeOverrideError2("paired_values_required", `${OMO_LSP_DAEMON_CLI2} and ${OMO_LSP_DAEMON_VERSION2} must be set together`);
5275
5728
  }
5276
5729
  if (!hasCliOverride || !hasVersionOverride) {
5277
- if (!isAbsolute5(defaults.cliPath)) {
5730
+ if (!isAbsolute6(defaults.cliPath)) {
5278
5731
  throw new InvalidRuntimeOverrideError2("packaged_cli_must_be_absolute", "Packaged LSP daemon CLI path must be absolute");
5279
5732
  }
5280
5733
  return { cliPath: defaults.cliPath, version: validateDaemonVersion2(defaults.version) };
5281
5734
  }
5282
- if (!isAbsolute5(cliOverride)) {
5735
+ if (!isAbsolute6(cliOverride)) {
5283
5736
  throw new InvalidRuntimeOverrideError2("cli_must_be_absolute", `${OMO_LSP_DAEMON_CLI2} must be an absolute path to an existing regular file`);
5284
5737
  }
5285
5738
  const stat = statSync5(cliOverride, { throwIfNoEntry: false });
@@ -5400,15 +5853,14 @@ function extensionKey(filePath) {
5400
5853
  }
5401
5854
  // ../../../../lsp-core/src/request-context.ts
5402
5855
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
5403
- import { existsSync as existsSync12, realpathSync as realpathSync4, statSync as statSync6 } from "node:fs";
5404
- import { basename as basename3, delimiter as delimiter4, dirname as dirname2, isAbsolute as isAbsolute6, join as join7, relative as relative5, resolve as resolve9 } from "node:path";
5856
+ import { existsSync as existsSync13, realpathSync as realpathSync6, statSync as statSync6 } from "node:fs";
5857
+ import { basename as basename4, delimiter as delimiter4, dirname as dirname2, isAbsolute as isAbsolute7, join as join8, relative as relative5, resolve as resolve10 } from "node:path";
5405
5858
 
5406
5859
  class LspRequestContextParseError2 extends Error {
5407
- code;
5408
- name = "LspRequestContextParseError";
5409
5860
  constructor(code, message) {
5410
5861
  super(message);
5411
5862
  this.code = code;
5863
+ this.name = "LspRequestContextParseError";
5412
5864
  }
5413
5865
  }
5414
5866
  var storage2 = new AsyncLocalStorage2;
@@ -5443,26 +5895,26 @@ function parseLspRequestContext2(value) {
5443
5895
  };
5444
5896
  }
5445
5897
  function canonicalCwd2(cwd) {
5446
- const resolved = resolve9(cwd);
5447
- if (!existsSync12(resolved) || !statSync6(resolved).isDirectory()) {
5898
+ const resolved = resolve10(cwd);
5899
+ if (!existsSync13(resolved) || !statSync6(resolved).isDirectory()) {
5448
5900
  throw new LspRequestContextParseError2("invalid_cwd", `LSP request cwd must be an existing directory: ${cwd}`);
5449
5901
  }
5450
- return realpathSync4(resolved);
5902
+ return realpathSync6(resolved);
5451
5903
  }
5452
5904
  function canonicalizeExistingOrNearestAncestor2(path2) {
5453
- let current = resolve9(path2);
5905
+ let current = resolve10(path2);
5454
5906
  const suffix = [];
5455
5907
  while (true) {
5456
5908
  try {
5457
- const existing = realpathSync4(current);
5458
- return suffix.length === 0 ? existing : join7(existing, ...suffix);
5909
+ const existing = realpathSync6(current);
5910
+ return suffix.length === 0 ? existing : join8(existing, ...suffix);
5459
5911
  } catch (error) {
5460
5912
  if (!isMissingPathError2(error))
5461
5913
  throw error;
5462
5914
  const parent = dirname2(current);
5463
5915
  if (parent === current)
5464
5916
  throw error;
5465
- suffix.unshift(basename3(current));
5917
+ suffix.unshift(basename4(current));
5466
5918
  current = parent;
5467
5919
  }
5468
5920
  }
@@ -5493,14 +5945,14 @@ function stringArrayField2(value, field) {
5493
5945
  return fieldValue;
5494
5946
  }
5495
5947
  function requireAbsolutePath2(path2, field) {
5496
- if (!isAbsolute6(path2)) {
5948
+ if (!isAbsolute7(path2)) {
5497
5949
  throw new LspRequestContextParseError2("relative_path", `LSP request context.${field} must be absolute: ${path2}`);
5498
5950
  }
5499
5951
  }
5500
5952
  function isPathInside2(parent, child) {
5501
- const childPath = resolve9(child);
5953
+ const childPath = resolve10(child);
5502
5954
  const relativePath = relative5(parent, childPath);
5503
- return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute6(relativePath);
5955
+ return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute7(relativePath);
5504
5956
  }
5505
5957
  function isMissingPathError2(error) {
5506
5958
  const code = errorCode2(error);
@@ -5523,9 +5975,9 @@ function errorCode2(error) {
5523
5975
  }
5524
5976
 
5525
5977
  // src/daemon-cli-path.ts
5526
- import { existsSync as existsSync14, readFileSync as readFileSync6 } from "node:fs";
5978
+ import { existsSync as existsSync15, readFileSync as readFileSync7 } from "node:fs";
5527
5979
  import { createRequire as createRequire2 } from "node:module";
5528
- import { dirname as dirname9, join as join9 } from "node:path";
5980
+ import { dirname as dirname11, join as join10 } from "node:path";
5529
5981
  import { fileURLToPath as fileURLToPath4 } from "node:url";
5530
5982
  var requireFromHere2 = createRequire2(import.meta.url);
5531
5983
  var PACKAGE_LSP_DAEMON_CLI = "@code-yeongyu/lsp-daemon/cli";
@@ -5547,7 +5999,7 @@ function resolveLspDaemonCli() {
5547
5999
  if (packageCli !== null)
5548
6000
  return resolveConfiguredLspDaemonCli(packageCli);
5549
6001
  const bundledCli = fileURLToPath4(new URL("../../lsp-daemon/dist/cli.js", import.meta.url));
5550
- if (existsSync14(bundledCli))
6002
+ if (existsSync15(bundledCli))
5551
6003
  return resolveConfiguredLspDaemonCli(bundledCli);
5552
6004
  return resolveConfiguredLspDaemonCli(bundledCli);
5553
6005
  }
@@ -5572,7 +6024,7 @@ function resolveConfiguredLspDaemonCli(cliPath) {
5572
6024
  }
5573
6025
  function readDaemonPackageVersion(cliPath) {
5574
6026
  try {
5575
- const parsed = JSON.parse(readFileSync6(join9(dirname9(cliPath), "package.json"), "utf8"));
6027
+ const parsed = JSON.parse(readFileSync7(join10(dirname11(cliPath), "package.json"), "utf8"));
5576
6028
  if (isRecord9(parsed) && typeof parsed["version"] === "string" && parsed["version"].length > 0) {
5577
6029
  return parsed["version"];
5578
6030
  }
@@ -5587,9 +6039,9 @@ function isRecord9(value) {
5587
6039
  }
5588
6040
 
5589
6041
  // src/lsp-session-state.ts
5590
- import { mkdirSync as mkdirSync4, readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "node:fs";
6042
+ import { mkdirSync as mkdirSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs";
5591
6043
  import { homedir } from "node:os";
5592
- import { dirname as dirname11, join as join10 } from "node:path";
6044
+ import { dirname as dirname13, join as join11 } from "node:path";
5593
6045
  function sessionIdFrom(input) {
5594
6046
  return typeof input.session_id === "string" && input.session_id.length > 0 ? input.session_id : undefined;
5595
6047
  }
@@ -5615,12 +6067,12 @@ function isLspDaemonUnreachableDiagnostics(diagnostics) {
5615
6067
  return diagnostics.includes("LSP daemon unreachable");
5616
6068
  }
5617
6069
  function sessionStatePath(sessionId) {
5618
- const root = process.env["PLUGIN_DATA"] ?? join10(homedir(), ".codex", "codex-lsp");
5619
- return join10(root, "sessions", `${safePathSegment(sessionId)}.json`);
6070
+ const root = process.env["PLUGIN_DATA"] ?? join11(homedir(), ".codex", "codex-lsp");
6071
+ return join11(root, "sessions", `${safePathSegment(sessionId)}.json`);
5620
6072
  }
5621
6073
  function readSessionState(path2) {
5622
6074
  try {
5623
- const parsed = JSON.parse(readFileSync8(path2, "utf8"));
6075
+ const parsed = JSON.parse(readFileSync9(path2, "utf8"));
5624
6076
  if (isRecord10(parsed) && isLspSessionState(parsed))
5625
6077
  return normalizeSessionState(parsed);
5626
6078
  return emptyState();
@@ -5631,8 +6083,8 @@ function readSessionState(path2) {
5631
6083
  }
5632
6084
  }
5633
6085
  function writeSessionState(path2, state) {
5634
- mkdirSync4(dirname11(path2), { recursive: true });
5635
- writeFileSync3(path2, `${JSON.stringify(state)}
6086
+ mkdirSync4(dirname13(path2), { recursive: true });
6087
+ writeFileSync4(path2, `${JSON.stringify(state)}
5636
6088
  `);
5637
6089
  }
5638
6090
  function emptyState() {
@@ -5775,13 +6227,13 @@ function notConfiguredAvailability(details) {
5775
6227
  return typeof extension === "string" && extension.length > 0 ? { extension } : undefined;
5776
6228
  }
5777
6229
  function codexLspRequestContext(env = process.env, cwd = process.cwd()) {
5778
- const canonicalCwd3 = realpathSync6(resolve11(cwd));
5779
- const codexHome = resolve11(env["CODEX_HOME"]?.trim() || join11(homedir3(), ".codex"));
6230
+ const canonicalCwd3 = realpathSync8(resolve12(cwd));
6231
+ const codexHome = resolve12(env["CODEX_HOME"]?.trim() || join12(homedir3(), ".codex"));
5780
6232
  return parseLspRequestContext2({
5781
6233
  cwd: canonicalCwd3,
5782
- projectConfigPaths: [join11(canonicalCwd3, ".codex", "lsp-client.json")],
5783
- userConfigPath: join11(codexHome, "lsp-client.json"),
5784
- installDecisionsPath: join11(codexHome, "lsp-install-decisions.json"),
6234
+ projectConfigPaths: [join12(canonicalCwd3, ".codex", "lsp-client.json")],
6235
+ userConfigPath: join12(codexHome, "lsp-client.json"),
6236
+ installDecisionsPath: join12(codexHome, "lsp-install-decisions.json"),
5785
6237
  capabilities: { installDecisionTool: true }
5786
6238
  });
5787
6239
  }
@@ -5875,7 +6327,7 @@ function isContextPressureTranscript(transcriptPath) {
5875
6327
  if (typeof transcriptPath !== "string")
5876
6328
  return false;
5877
6329
  try {
5878
- return hasContextPressureMarker(readFileSync9(transcriptPath, "utf8"));
6330
+ return hasContextPressureMarker(readFileSync10(transcriptPath, "utf8"));
5879
6331
  } catch (error) {
5880
6332
  if (error instanceof Error)
5881
6333
  return false;
@@ -5957,15 +6409,15 @@ main().catch((error) => {
5957
6409
  });
5958
6410
  async function runPackageLspMcpCli() {
5959
6411
  const cliPath = resolveLspDaemonCliPath();
5960
- const child = spawn3(execPath2, [cliPath, "mcp"], { stdio: "inherit" });
5961
- await new Promise((resolve10, reject) => {
6412
+ const child = spawn3(execPath2, [cliPath, "mcp"], { stdio: "inherit", windowsHide: true });
6413
+ await new Promise((resolve11, reject) => {
5962
6414
  child.once("error", reject);
5963
6415
  child.once("exit", (code, signal) => {
5964
6416
  if (code !== null && code !== 0)
5965
6417
  process.exitCode = code;
5966
6418
  if (code === null && signal !== null)
5967
6419
  process.exitCode = 1;
5968
- resolve10();
6420
+ resolve11();
5969
6421
  });
5970
6422
  });
5971
6423
  }