oh-my-opencode 5.0.0-beta.8 → 5.0.0-beta.80

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 (1229) hide show
  1. package/.agents/command/publish.md +59 -23
  2. package/.agents/command/remove-deadcode.md +1 -1
  3. package/.agents/skills/codex-qa/scripts/lsp-e2e.sh +1 -3
  4. package/.agents/skills/hyperplan/SKILL.md +5 -5
  5. package/.agents/skills/opencode-qa/scripts/lsp-e2e.sh +1 -1
  6. package/.agents/skills/pre-publish-review/SKILL.md +9 -12
  7. package/.agents/skills/publish/SKILL.md +59 -23
  8. package/.agents/skills/remove-deadcode/SKILL.md +1 -1
  9. package/.agents/skills/security-research/SKILL.md +4 -4
  10. package/.agents/skills/senpi-qa/SKILL.md +80 -0
  11. package/.agents/skills/senpi-qa/scripts/resolve-evidence-dir.mjs +65 -0
  12. package/.agents/skills/senpi-qa/scripts/resolve-evidence-dir.test.mjs +171 -0
  13. package/.agents/skills/tech-debt-audit/SKILL.md +6 -76
  14. package/.opencode/command/publish.md +59 -23
  15. package/.opencode/skills/pre-publish-review/SKILL.md +9 -12
  16. package/README.ja.md +66 -61
  17. package/README.ko.md +67 -62
  18. package/README.md +108 -182
  19. package/README.ru.md +63 -61
  20. package/README.zh-cn.md +62 -61
  21. package/THIRD-PARTY-NOTICES.md +35 -105
  22. package/dist/agents/atlas/agent.d.ts +0 -1
  23. package/dist/agents/gpt-prompt-identity.d.ts +1 -1
  24. package/dist/agents/sisyphus-runtime-prompt-reconciler.d.ts +15 -4
  25. package/dist/agents/types.d.ts +4 -2
  26. package/dist/cli/config-manager/parse-opencode-config-file.d.ts +2 -1
  27. package/dist/cli/doctor/checks/browser-provider.d.ts +2 -0
  28. package/dist/cli/doctor/checks/index.d.ts +2 -0
  29. package/dist/cli/doctor/checks/latest-version.d.ts +11 -0
  30. package/dist/cli/doctor/checks/system-plugin.d.ts +4 -3
  31. package/dist/cli/doctor/framework/constants.d.ts +5 -0
  32. package/dist/cli/doctor/framework/types.d.ts +2 -0
  33. package/dist/cli/fallback-lane-policy.d.ts +1 -0
  34. package/dist/cli/index.js +50191 -58043
  35. package/dist/cli/install-codex/install-codex-test-fixtures.d.ts +1 -1
  36. package/dist/cli/run/on-complete-hook.d.ts +2 -0
  37. package/dist/cli/runtime-commands.d.ts +1 -1
  38. package/dist/cli/worktree-sweep/classify.d.ts +16 -0
  39. package/dist/cli/worktree-sweep/format.d.ts +8 -0
  40. package/dist/cli/worktree-sweep/git.d.ts +19 -0
  41. package/dist/cli/worktree-sweep/index.d.ts +7 -0
  42. package/dist/cli/worktree-sweep/options.d.ts +2 -0
  43. package/dist/cli/worktree-sweep/parse-worktree-list.d.ts +8 -0
  44. package/dist/cli/worktree-sweep/sweep.d.ts +2 -0
  45. package/dist/cli/worktree-sweep/types.d.ts +65 -0
  46. package/dist/cli/worktree-sweep/worktree-sweep.d.ts +2 -0
  47. package/dist/cli-node/index.js +51708 -59537
  48. package/dist/config/index.d.ts +1 -1
  49. package/dist/config/schema/agent-names.d.ts +0 -1
  50. package/dist/config/schema/background-task.d.ts +1 -0
  51. package/dist/config/schema/browser-automation.d.ts +0 -2
  52. package/dist/config/schema/commands.d.ts +1 -1
  53. package/dist/config/schema/hooks.d.ts +1 -2
  54. package/dist/config/schema/oh-my-opencode-config.d.ts +5 -12
  55. package/dist/config/schema/ulw-execute.d.ts +5 -0
  56. package/dist/config/schema.d.ts +0 -1
  57. package/dist/config/validate.d.ts +2 -0
  58. package/dist/config-migration/category-deep-split.d.ts +3 -0
  59. package/dist/config-migration/migration-plans.d.ts +1 -0
  60. package/dist/create-hooks.d.ts +3 -2
  61. package/dist/features/background-agent/compaction-aware-message-resolver.d.ts +1 -0
  62. package/dist/features/background-agent/constants.d.ts +0 -7
  63. package/dist/features/background-agent/error-classifier.d.ts +1 -0
  64. package/dist/features/background-agent/manager.d.ts +9 -1
  65. package/dist/features/background-agent/parent-wake-dispatched-tracker.d.ts +0 -1
  66. package/dist/features/background-agent/parent-wake-notifier-types.d.ts +1 -1
  67. package/dist/features/background-agent/parent-wake-prompt-dispatch.d.ts +1 -1
  68. package/dist/features/background-agent/parent-wake-session-inspector.d.ts +1 -1
  69. package/dist/features/background-agent/subagent-spawn-limits.d.ts +8 -0
  70. package/dist/features/background-agent/types.d.ts +4 -0
  71. package/dist/features/boulder-state/storage.d.ts +1 -1
  72. package/dist/features/btw-side/btw-command-draft.d.ts +7 -0
  73. package/dist/features/btw-side/context-injector.d.ts +15 -0
  74. package/dist/features/btw-side/index.d.ts +8 -0
  75. package/dist/features/btw-side/metadata.d.ts +15 -0
  76. package/dist/features/btw-side/parent-context-budget.d.ts +9 -0
  77. package/dist/features/btw-side/server-session-registry.d.ts +8 -0
  78. package/dist/features/btw-side/tui-adoption-cache.d.ts +13 -0
  79. package/dist/features/btw-side/tui-adoption-guard.d.ts +5 -0
  80. package/dist/features/btw-side/tui-controller-types.d.ts +68 -0
  81. package/dist/features/btw-side/tui-controller.d.ts +19 -0
  82. package/dist/features/btw-side/tui-escape-return.d.ts +12 -0
  83. package/dist/features/btw-side/tui-keymap.d.ts +17 -0
  84. package/dist/features/btw-side/tui-parent-validator.d.ts +6 -0
  85. package/dist/features/btw-side/tui-picker-options.d.ts +20 -0
  86. package/dist/features/btw-side/tui-picker.d.ts +9 -0
  87. package/dist/features/btw-side/tui-prompt-queue.d.ts +8 -0
  88. package/dist/features/btw-side/tui-session-bridge.d.ts +11 -0
  89. package/dist/features/btw-side/tui-session-catalog.d.ts +35 -0
  90. package/dist/features/btw-side/tui-side-removal.d.ts +11 -0
  91. package/dist/features/btw-side/tui-side-start.d.ts +9 -0
  92. package/dist/features/btw-side/tui-wiring.d.ts +8 -0
  93. package/dist/features/builtin-commands/templates/hyperplan.d.ts +1 -1
  94. package/dist/features/builtin-commands/templates/refactor-sections/team-mode-addendum.d.ts +1 -1
  95. package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
  96. package/dist/features/builtin-commands/templates/ulw-execute.d.ts +1 -0
  97. package/dist/features/builtin-commands/types.d.ts +1 -1
  98. package/dist/features/claude-tasks/storage.d.ts +7 -2
  99. package/dist/features/hook-message-injector/index.d.ts +1 -0
  100. package/dist/features/hook-message-injector/sdk-message-lookup.d.ts +1 -0
  101. package/dist/features/monitor/manager-internals.d.ts +1 -1
  102. package/dist/features/monitor/output-injector-types.d.ts +1 -1
  103. package/dist/features/opengateway-provider/index.d.ts +13 -0
  104. package/dist/features/task-toast-manager/manager.d.ts +0 -24
  105. package/dist/features/team-mode/tools/messaging-fallback-wake.d.ts +17 -0
  106. package/dist/features/team-mode/tools/messaging-live-delivery-recipient.d.ts +3 -0
  107. package/dist/features/team-mode/tools/messaging-runtime.d.ts +7 -0
  108. package/dist/hooks/anthropic-context-window-limit-recovery/message-storage-directory.d.ts +0 -3
  109. package/dist/hooks/anthropic-context-window-limit-recovery/state.d.ts +1 -0
  110. package/dist/hooks/anthropic-context-window-limit-recovery/storage/empty-messages.d.ts +0 -1
  111. package/dist/hooks/anthropic-context-window-limit-recovery/tool-result-storage.d.ts +11 -0
  112. package/dist/hooks/atlas/atlas-hook.d.ts +1 -0
  113. package/dist/hooks/atlas/atlas-lifecycle-store.d.ts +50 -0
  114. package/dist/hooks/atlas/event-handler.d.ts +1 -0
  115. package/dist/hooks/atlas/final-wave-approval-gate.test-support.d.ts +50 -0
  116. package/dist/hooks/atlas/system-reminder-templates.d.ts +0 -1
  117. package/dist/hooks/atlas/tool-execute-before.d.ts +3 -0
  118. package/dist/hooks/atlas/types.d.ts +1 -0
  119. package/dist/hooks/claude-code-hooks/session-hook-state.d.ts +1 -0
  120. package/dist/hooks/claude-code-hooks/stop.d.ts +2 -0
  121. package/dist/hooks/claude-code-hooks/todo.d.ts +0 -1
  122. package/dist/hooks/claude-code-hooks/transcript.d.ts +2 -0
  123. package/dist/hooks/comment-checker/__fixtures__/download-probe.fixture.d.ts +1 -0
  124. package/dist/hooks/compaction-context-injector/validated-model.d.ts +2 -0
  125. package/dist/hooks/fsync-skip-warning/index.d.ts +4 -0
  126. package/dist/hooks/hashline-edit-diff-enhancer/hook.d.ts +1 -0
  127. package/dist/hooks/hashline-edit-diff-enhancer/pending-captures.d.ts +13 -0
  128. package/dist/hooks/index.d.ts +1 -2
  129. package/dist/hooks/keyword-detector/hook.d.ts +9 -0
  130. package/dist/hooks/keyword-detector/ultrawork/index.d.ts +2 -0
  131. package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +0 -1
  132. package/dist/hooks/model-fallback/hook.d.ts +1 -1
  133. package/dist/hooks/plan-format-validator/hook.d.ts +19 -0
  134. package/dist/hooks/prometheus-md-only/agent-resolution.d.ts +2 -2
  135. package/dist/hooks/runtime-fallback/chat-message-handler.d.ts +2 -0
  136. package/dist/hooks/runtime-fallback/retry-model-payload.d.ts +1 -0
  137. package/dist/hooks/runtime-fallback/runtime-model-settings.d.ts +6 -0
  138. package/dist/hooks/runtime-fallback/session-status-handler.d.ts +1 -1
  139. package/dist/hooks/runtime-fallback/types.d.ts +3 -1
  140. package/dist/hooks/sisyphus-junior-notepad/constants.d.ts +1 -1
  141. package/dist/hooks/todo-continuation-enforcer/types.d.ts +1 -0
  142. package/dist/hooks/{start-work → ulw-execute}/context-info-builder.d.ts +1 -1
  143. package/dist/hooks/{start-work → ulw-execute}/index.d.ts +1 -1
  144. package/dist/hooks/ulw-execute/ulw-execute-hook.d.ts +23 -0
  145. package/dist/hooks/unstable-agent-babysitter/task-message-analyzer.d.ts +1 -0
  146. package/dist/index.js +30870 -27341
  147. package/dist/mcp/index.d.ts +0 -4
  148. package/dist/mcp/types.d.ts +0 -1
  149. package/dist/oh-my-opencode.schema.json +25 -52
  150. package/dist/plugin/chat-message/types.d.ts +6 -4
  151. package/dist/plugin/chat-message/ulw-execute-message.d.ts +5 -0
  152. package/dist/plugin/event-session-lifecycle.d.ts +1 -0
  153. package/dist/plugin/hooks/create-core-hooks.d.ts +2 -2
  154. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -3
  155. package/dist/plugin/hooks/create-transform-hooks.d.ts +2 -0
  156. package/dist/plugin/messages-transform.d.ts +1 -0
  157. package/dist/plugin/stop-continuation.d.ts +3 -0
  158. package/dist/plugin/system-transform.d.ts +5 -1
  159. package/dist/plugin-config/omo-config-chain.d.ts +1 -0
  160. package/dist/plugin-dispose.d.ts +3 -0
  161. package/dist/shared/agent-tool-restrictions.d.ts +0 -1
  162. package/dist/shared/compaction-agent-config-checkpoint.d.ts +1 -0
  163. package/dist/shared/index.d.ts +2 -0
  164. package/dist/shared/legacy-plugin-warning.d.ts +2 -1
  165. package/dist/shared/omo-process-sweep.d.ts +2 -4
  166. package/dist/shared/plugin-entry-migrator.d.ts +4 -3
  167. package/dist/shared/plugin-entry-shape.d.ts +6 -0
  168. package/dist/shared/runtime-fallback-retry-marker.d.ts +16 -0
  169. package/dist/shared/shell-env.d.ts +1 -1
  170. package/dist/skills/ast-grep/AGENTS.md +51 -0
  171. package/dist/skills/ast-grep/SKILL.md +13 -1
  172. package/dist/skills/coding-agent-sessions/AGENTS.md +62 -0
  173. package/dist/skills/coding-agent-sessions/SKILL.md +1 -1
  174. package/dist/skills/data-scientist/SKILL.md +99 -239
  175. package/dist/skills/data-scientist/references/execution-surfaces.md +91 -0
  176. package/dist/skills/data-scientist/references/placement.md +74 -0
  177. package/dist/skills/data-scientist/references/polars-lane.md +95 -0
  178. package/dist/skills/data-scientist/references/uv-setup.md +1 -1
  179. package/dist/skills/data-scientist/references/visualization.md +64 -0
  180. package/dist/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
  181. package/dist/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
  182. package/dist/skills/debugging/SKILL.md +3 -1
  183. package/dist/skills/debugging/references/methodology/00-setup.md +12 -0
  184. package/dist/skills/debugging/references/methodology/02-investigate.md +26 -5
  185. package/dist/skills/debugging/references/runtimes/go.md +15 -1
  186. package/dist/skills/debugging/references/runtimes/native-binary.md +38 -0
  187. package/dist/skills/debugging/references/runtimes/node.md +25 -0
  188. package/dist/skills/debugging/references/runtimes/python.md +13 -0
  189. package/dist/skills/debugging/references/runtimes/rust.md +41 -0
  190. package/dist/skills/debugging/references/scripts/dap.mjs +267 -0
  191. package/dist/skills/debugging/references/scripts/dap.test.ts +86 -0
  192. package/dist/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
  193. package/dist/skills/debugging/references/tools/dap.md +103 -0
  194. package/dist/skills/debugging/references/tools/frida.md +193 -0
  195. package/dist/skills/debugging/references/tools/playwright-cli.md +79 -161
  196. package/dist/skills/frontend/ATTRIBUTION.md +10 -0
  197. package/dist/skills/frontend/SKILL.md +7 -3
  198. package/dist/skills/frontend/references/design/README.md +10 -2
  199. package/dist/skills/frontend/references/design/_INDEX.md +1 -0
  200. package/dist/skills/frontend/references/design/ambience-skill.md +145 -0
  201. package/dist/skills/frontend/references/design/aside.md +1 -1
  202. package/dist/skills/frontend/references/design/clone-from-url.md +1 -1
  203. package/dist/skills/frontend/references/design/interaction-skill.md +2 -0
  204. package/dist/skills/frontend/references/design/print-paged-media.md +76 -0
  205. package/dist/skills/frontend/references/designpowers/README.md +1 -1
  206. package/dist/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
  207. package/dist/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
  208. package/dist/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
  209. package/dist/skills/frontend/references/designpowers/orchestration.md +1 -1
  210. package/dist/skills/frontend/references/designpowers/routing.md +5 -5
  211. package/dist/skills/frontend/scripts/perfection/lighthouse-audit.py +2 -2
  212. package/dist/skills/git-master/SKILL.md +1 -1
  213. package/dist/skills/init-deep/SKILL.md +14 -14
  214. package/dist/skills/lsp-setup/SKILL.md +1 -1
  215. package/dist/skills/programming/SKILL.md +1 -1
  216. package/dist/skills/refactor/SKILL.md +5 -5
  217. package/dist/skills/remove-ai-slops/SKILL.md +5 -5
  218. package/dist/skills/review-work/SKILL.md +101 -419
  219. package/dist/skills/ultimate-browsing/ATTRIBUTION.md +32 -86
  220. package/dist/skills/ultimate-browsing/SKILL.md +32 -27
  221. package/dist/skills/ultimate-browsing/engine/AGENTS.md +111 -0
  222. package/dist/skills/ultimate-browsing/engine/templates/package.json +2 -2
  223. package/dist/skills/ultimate-browsing/engine/templates/playwright_mobile_chrome.js +5 -2
  224. package/dist/skills/ultimate-browsing/engine/templates/playwright_real_chrome.js +8 -6
  225. package/dist/skills/ultimate-browsing/engine/tests/test_playwright_stealth.py +86 -0
  226. package/dist/skills/ultimate-browsing/engine/tests/test_playwright_templates.py +4 -7
  227. package/dist/skills/ultimate-browsing/references/chrome-stealth.md +86 -95
  228. package/dist/skills/ultimate-browsing/references/insane-search/README.md +18 -5
  229. package/dist/skills/ultimate-browsing/references/insane-search/playwright.md +16 -13
  230. package/dist/skills/ultimate-browsing/scripts/extract_cookies.py +3 -3
  231. package/dist/skills/{start-work → ulw-execute}/SKILL.md +24 -22
  232. package/dist/skills/ulw-plan/SKILL.md +5 -6
  233. package/dist/skills/ulw-plan/references/full-workflow.md +6 -5
  234. package/dist/skills/ulw-plan/references/intent-unclear.md +2 -2
  235. package/dist/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -1
  236. package/dist/skills/ulw-research/SKILL.md +10 -5
  237. package/dist/skills/visual-qa/AGENTS.md +58 -0
  238. package/dist/skills/visual-qa/SKILL.md +4 -3
  239. package/dist/skills/visual-qa/references/browser-setup.md +75 -0
  240. package/dist/tools/delegate-task/builtin-categories.d.ts +3 -1
  241. package/dist/tools/delegate-task/builtin-category-definition.d.ts +2 -1
  242. package/dist/tools/delegate-task/constants.d.ts +2 -2
  243. package/dist/tools/delegate-task/openai-categories.d.ts +10 -3
  244. package/dist/tools/delegate-task/sync-session-cleanup.d.ts +3 -0
  245. package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -0
  246. package/dist/tools/delegate-task/tool-description.d.ts +3 -1
  247. package/dist/tools/delegate-task/types.d.ts +4 -0
  248. package/dist/tools/session-manager/directory-filter.d.ts +2 -0
  249. package/dist/tui.d.ts +12 -0
  250. package/dist/tui.js +37073 -46672
  251. package/package.json +44 -45
  252. package/packages/git-bash-mcp/dist/cli.js +6 -1
  253. package/packages/git-bash-mcp/package.json +1 -1
  254. package/packages/lsp-core/src/index.ts +1 -0
  255. package/packages/lsp-core/src/lsp/client-diagnostics-concurrency.integration.test.ts +9 -1
  256. package/packages/lsp-core/src/lsp/client-diagnostics-freshness.integration.test.ts +100 -28
  257. package/packages/lsp-core/src/lsp/client-diagnostics-pull-timeout.test.ts +64 -0
  258. package/packages/lsp-core/src/lsp/client-wrapper-outside-cwd.test.ts +78 -0
  259. package/packages/lsp-core/src/lsp/client-wrapper.test.ts +103 -6
  260. package/packages/lsp-core/src/lsp/client-wrapper.ts +50 -16
  261. package/packages/lsp-core/src/lsp/client.ts +32 -3
  262. package/packages/lsp-core/src/lsp/connection.ts +16 -0
  263. package/packages/lsp-core/src/lsp/constants.ts +6 -0
  264. package/packages/lsp-core/src/lsp/controlled-clock-test-support.ts +90 -0
  265. package/packages/lsp-core/src/lsp/errors.ts +15 -0
  266. package/packages/lsp-core/src/lsp/fixtures/workspace-edit-server.mjs +10 -3
  267. package/packages/lsp-core/src/lsp/format-document.test.ts +143 -0
  268. package/packages/lsp-core/src/lsp/format-document.ts +90 -0
  269. package/packages/lsp-core/src/lsp/json-rpc-connection.ts +11 -6
  270. package/packages/lsp-core/src/lsp/manager-lifecycle.test.ts +262 -0
  271. package/packages/lsp-core/src/lsp/manager-max-clients.test.ts +151 -0
  272. package/packages/lsp-core/src/lsp/manager.ts +138 -12
  273. package/packages/lsp-core/src/lsp/outside-context-workspace.ts +33 -0
  274. package/packages/lsp-core/src/lsp/server-definitions.ts +29 -0
  275. package/packages/lsp-core/src/lsp/server-installation.test.ts +376 -0
  276. package/packages/lsp-core/src/lsp/server-installation.ts +200 -27
  277. package/packages/lsp-core/src/lsp/server-resolution-local-binary.test.ts +170 -0
  278. package/packages/lsp-core/src/lsp/server-resolution.ts +18 -5
  279. package/packages/lsp-core/src/lsp/timer-provider.ts +13 -0
  280. package/packages/lsp-core/src/lsp/transport-request-timeout.test.ts +73 -0
  281. package/packages/lsp-core/src/lsp/transport.ts +16 -2
  282. package/packages/lsp-core/src/lsp/types.ts +8 -0
  283. package/packages/lsp-core/src/lsp/workspace-apply-edit-test-support.ts +29 -1
  284. package/packages/lsp-core/src/lsp/workspace-document-state.test.ts +84 -1
  285. package/packages/lsp-core/src/lsp/workspace-document-state.ts +35 -11
  286. package/packages/lsp-core/src/lsp/workspace-markers.ts +18 -0
  287. package/packages/lsp-core/src/mcp.ts +3 -0
  288. package/packages/lsp-core/src/request-context.test.ts +29 -0
  289. package/packages/lsp-core/src/request-context.ts +1 -1
  290. package/packages/lsp-core/src/tool-surface.test.ts +13 -1
  291. package/packages/lsp-core/src/tools/definitions.ts +14 -0
  292. package/packages/lsp-core/src/tools/format.test.ts +56 -0
  293. package/packages/lsp-core/src/tools/format.ts +56 -0
  294. package/packages/lsp-core/src/tools/index.ts +1 -0
  295. package/packages/lsp-core/src/tools/parameters.test.ts +51 -0
  296. package/packages/lsp-core/src/tools/types.ts +10 -0
  297. package/packages/lsp-daemon/dist/cli.js +904 -479
  298. package/packages/lsp-daemon/dist/client.d.ts +10 -0
  299. package/packages/lsp-daemon/dist/client.js +922 -493
  300. package/packages/lsp-daemon/dist/daemon-client.d.ts +1 -0
  301. package/packages/lsp-daemon/dist/daemon-client.js +3 -0
  302. package/packages/lsp-daemon/dist/ensure-daemon.d.ts +6 -1
  303. package/packages/lsp-daemon/dist/ensure-daemon.js +10 -2
  304. package/packages/lsp-daemon/dist/index.js +826 -402
  305. package/packages/lsp-daemon/dist/ownership.js +2 -2
  306. package/packages/lsp-daemon/dist/proxy.js +3 -0
  307. package/packages/lsp-daemon/dist/version-reap.js +1 -1
  308. package/packages/lsp-daemon/package.json +1 -1
  309. package/packages/lsp-tools-mcp/dist/cli.js +764 -341
  310. package/packages/lsp-tools-mcp/dist/lsp/manager.js +274 -138
  311. package/packages/lsp-tools-mcp/dist/mcp.js +789 -368
  312. package/packages/lsp-tools-mcp/dist/request-context.js +12 -13
  313. package/packages/lsp-tools-mcp/dist/tools.js +719 -302
  314. package/packages/lsp-tools-mcp/package.json +1 -1
  315. package/packages/omo-codex/THIRD-PARTY-NOTICES.md +4 -21
  316. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +4 -6
  317. package/packages/omo-codex/plugin/.mcp.json +0 -6
  318. package/packages/omo-codex/plugin/AGENTS.md +47 -0
  319. package/packages/omo-codex/plugin/README.md +6 -2
  320. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +7175 -408
  321. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  322. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  323. package/packages/omo-codex/plugin/components/bootstrap/src/hook.ts +1 -0
  324. package/packages/omo-codex/plugin/components/bootstrap/src/setup.ts +7 -1
  325. package/packages/omo-codex/plugin/components/comment-checker/AGENTS.md +9 -0
  326. package/packages/omo-codex/plugin/components/comment-checker/biome.json +2 -2
  327. package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +2 -1
  328. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  329. package/packages/omo-codex/plugin/components/comment-checker/package.json +5 -5
  330. package/packages/omo-codex/plugin/components/comment-checker/src/apply-patch.ts +2 -8
  331. package/packages/omo-codex/plugin/components/comment-checker/src/core.ts +1 -2
  332. package/packages/omo-codex/plugin/components/comment-checker/src/request-extractor.ts +1 -1
  333. package/packages/omo-codex/plugin/components/comment-checker/src/runner.ts +1 -0
  334. package/packages/omo-codex/plugin/components/git-bash/AGENTS.md +1 -1
  335. package/packages/omo-codex/plugin/components/git-bash/dist/cli.js +1 -1
  336. package/packages/omo-codex/plugin/components/git-bash/dist/codex-hook.js +2 -1
  337. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  338. package/packages/omo-codex/plugin/components/git-bash/package.json +3 -4
  339. package/packages/omo-codex/plugin/components/git-bash/src/codex-hook.ts +2 -1
  340. package/packages/omo-codex/plugin/components/git-bash/test/codex-hook.test.ts +6 -7
  341. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/AGENTS.md +2 -2
  342. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/biome.json +2 -2
  343. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/directive.md +2 -0
  344. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +36 -29
  345. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +32 -26
  346. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.d.ts +3 -0
  347. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  348. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +5 -5
  349. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +32 -28
  350. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/types.ts +3 -0
  351. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/cli.test.ts +1 -1
  352. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +137 -28
  353. package/packages/omo-codex/plugin/components/lcx/skills/lcx-doctor/SKILL.md +4 -2
  354. package/packages/omo-codex/plugin/components/lsp/AGENTS.md +30 -15
  355. package/packages/omo-codex/plugin/components/lsp/biome.json +2 -2
  356. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +4 -4
  357. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +943 -540
  358. package/packages/omo-codex/plugin/components/lsp/dist/daemon-cli-path.js +1 -1
  359. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  360. package/packages/omo-codex/plugin/components/lsp/package.json +5 -5
  361. package/packages/omo-codex/plugin/components/lsp/src/cli.ts +1 -1
  362. package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +1 -1
  363. package/packages/omo-codex/plugin/components/lsp/src/daemon-cli-path.ts +1 -5
  364. package/packages/omo-codex/plugin/components/lsp/test/codex-hook-unavailable.test.ts +6 -7
  365. package/packages/omo-codex/plugin/components/lsp/test/codex-hook.test.ts +1 -2
  366. package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +11 -1
  367. package/packages/omo-codex/plugin/components/rules/AGENTS.md +12 -0
  368. package/packages/omo-codex/plugin/components/rules/README.md +2 -0
  369. package/packages/omo-codex/plugin/components/rules/biome.json +2 -2
  370. package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus/gpt-6.md +123 -0
  371. package/packages/omo-codex/plugin/components/rules/dist/cli.js +91 -68
  372. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  373. package/packages/omo-codex/plugin/components/rules/package.json +7 -7
  374. package/packages/omo-codex/plugin/components/rules/src/config.ts +1 -2
  375. package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +1 -2
  376. package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +15 -5
  377. package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +1 -4
  378. package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +4 -9
  379. package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +11 -16
  380. package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +17 -25
  381. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +9 -7
  382. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +0 -6
  383. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +6 -4
  384. package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +12 -9
  385. package/packages/omo-codex/plugin/components/rules/test/codex-hook.test.ts +28 -37
  386. package/packages/omo-codex/plugin/components/rules/test/dynamic-target-fingerprints.test.ts +1 -2
  387. package/packages/omo-codex/plugin/components/rules/test/engine.test.ts +7 -4
  388. package/packages/omo-codex/plugin/components/rules/test/finder.test.ts +2 -3
  389. package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +39 -72
  390. package/packages/omo-codex/plugin/components/rules/test/hephaestus-model-variant.test.ts +38 -3
  391. package/packages/omo-codex/plugin/components/rules/test/hook-output.test.ts +2 -3
  392. package/packages/omo-codex/plugin/components/rules/test/matcher.test.ts +2 -3
  393. package/packages/omo-codex/plugin/components/rules/test/package-smoke.test.ts +1 -1
  394. package/packages/omo-codex/plugin/components/rules/test/parser.test.ts +1 -2
  395. package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +29 -6
  396. package/packages/omo-codex/plugin/components/rules/test/rules-engine-consumption.test.ts +3 -6
  397. package/packages/omo-codex/plugin/components/rules/test/scanner.test.ts +1 -2
  398. package/packages/omo-codex/plugin/components/rules/test/sources.test.ts +2 -5
  399. package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +2 -17
  400. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  401. package/packages/omo-codex/plugin/components/teammode/package.json +5 -5
  402. package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +4 -10
  403. package/packages/omo-codex/plugin/components/telemetry/AGENTS.md +8 -0
  404. package/packages/omo-codex/plugin/components/telemetry/biome.json +2 -2
  405. package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +2470 -701
  406. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +2488 -720
  407. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  408. package/packages/omo-codex/plugin/components/telemetry/package.json +5 -5
  409. package/packages/omo-codex/plugin/components/telemetry/src/codex-hook.ts +1 -4
  410. package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +4 -14
  411. package/packages/omo-codex/plugin/components/telemetry/src/product-identity.ts +1 -1
  412. package/packages/omo-codex/plugin/components/telemetry/test/diagnostics.test.ts +2 -5
  413. package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +10 -4
  414. package/packages/omo-codex/plugin/components/ultrawork/README.md +2 -0
  415. package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
  416. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +1 -1
  417. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +1 -1
  418. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +1 -1
  419. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +1 -1
  420. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-high.toml +1 -1
  421. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-low.toml +1 -1
  422. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-worker-medium.toml +1 -1
  423. package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +1 -1
  424. package/packages/omo-codex/plugin/components/ultrawork/agents/metis.toml +1 -1
  425. package/packages/omo-codex/plugin/components/ultrawork/agents/momus.toml +1 -1
  426. package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +4 -4
  427. package/packages/omo-codex/plugin/components/ultrawork/biome.json +2 -2
  428. package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +500 -4
  429. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  430. package/packages/omo-codex/plugin/components/ultrawork/package.json +5 -6
  431. package/packages/omo-codex/plugin/components/ultrawork/scripts/sync-directive.mjs +30 -14
  432. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +4 -5
  433. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +5 -5
  434. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +2 -2
  435. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/scripts/scaffold-plan.mjs +1 -0
  436. package/packages/omo-codex/plugin/components/ultrawork/src/directive-content.ts +4 -0
  437. package/packages/omo-codex/plugin/components/ultrawork/src/directive.ts +5 -2
  438. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +9 -1
  439. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +0 -136
  440. package/packages/omo-codex/plugin/components/ultrawork/test/directive-source.test.ts +14 -8
  441. package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +12 -1
  442. package/packages/omo-codex/plugin/components/ultrawork/test/skill-pointer.test.ts +0 -2
  443. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/AGENTS.md +4 -4
  444. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/NOTICE +1 -1
  445. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/README.md +6 -6
  446. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/biome.json +2 -2
  447. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/directive.md +11 -11
  448. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/dist/cli.js +16 -16
  449. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +16 -0
  450. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/package.json +12 -12
  451. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/boulder-reader.ts +1 -1
  452. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/cli.ts +1 -1
  453. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/codex-hook.ts +4 -4
  454. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/directive.ts +1 -1
  455. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/index.ts +1 -1
  456. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/types.ts +1 -1
  457. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/boulder-reader.test.ts +3 -3
  458. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/cli.test.ts +4 -11
  459. package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/codex-hook.test.ts +24 -22
  460. package/packages/omo-codex/plugin/components/ulw-loop/AGENTS.md +19 -0
  461. package/packages/omo-codex/plugin/components/ulw-loop/CHANGELOG.md +17 -1
  462. package/packages/omo-codex/plugin/components/ulw-loop/README.md +12 -1
  463. package/packages/omo-codex/plugin/components/ulw-loop/biome.json +2 -2
  464. package/packages/omo-codex/plugin/components/ulw-loop/directive.md +44 -27
  465. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.d.ts +18 -0
  466. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.js +30 -0
  467. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-continuation.js +10 -4
  468. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +2 -5
  469. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +5 -78
  470. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.d.ts +12 -0
  471. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.js +114 -0
  472. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +7 -1
  473. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +57 -46
  474. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.js +2 -2
  475. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +21 -8
  476. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +2 -1
  477. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +12 -1
  478. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.d.ts +1 -1
  479. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +40 -37
  480. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +2191 -737
  481. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.d.ts +2 -0
  482. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +28 -8
  483. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.d.ts +8 -5
  484. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.js +35 -23
  485. package/packages/omo-codex/plugin/components/ulw-loop/dist/constants.d.ts +1 -0
  486. package/packages/omo-codex/plugin/components/ulw-loop/dist/constants.js +1 -0
  487. package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +25 -9
  488. package/packages/omo-codex/plugin/components/ulw-loop/dist/driver-objective-ack.d.ts +4 -0
  489. package/packages/omo-codex/plugin/components/ulw-loop/dist/driver-objective-ack.js +18 -0
  490. package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence-artifacts.d.ts +1 -0
  491. package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence-artifacts.js +37 -0
  492. package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.d.ts +1 -0
  493. package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.js +24 -12
  494. package/packages/omo-codex/plugin/components/ulw-loop/dist/ledger.d.ts +4 -0
  495. package/packages/omo-codex/plugin/components/ulw-loop/dist/ledger.js +39 -0
  496. package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.d.ts +2 -0
  497. package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +19 -4
  498. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-commit.d.ts +19 -0
  499. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-commit.js +108 -0
  500. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.d.ts +6 -2
  501. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +54 -25
  502. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-goal-factory.d.ts +10 -3
  503. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-goal-factory.js +38 -31
  504. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.d.ts +10 -7
  505. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.js +121 -100
  506. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-log.d.ts +16 -0
  507. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-log.js +115 -0
  508. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-missing-recovery.d.ts +18 -0
  509. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-missing-recovery.js +41 -0
  510. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.d.ts +7 -0
  511. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.js +9 -0
  512. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.d.ts +12 -0
  513. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.js +104 -0
  514. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.d.ts +13 -1
  515. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +65 -9
  516. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.js +5 -1
  517. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +4 -2
  518. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +72 -117
  519. package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.d.ts +2 -0
  520. package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.js +25 -13
  521. package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/factory.d.ts +2 -0
  522. package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/factory.js +157 -0
  523. package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/manifest.d.ts +381 -0
  524. package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/manifest.js +127 -0
  525. package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/types.d.ts +130 -0
  526. package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk/types.js +1 -0
  527. package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk.d.ts +3 -0
  528. package/packages/omo-codex/plugin/components/ulw-loop/dist/sdk.js +3 -0
  529. package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-budget-io.d.ts +5 -0
  530. package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-budget-io.js +67 -0
  531. package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.d.ts +7 -1
  532. package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-guard.js +188 -59
  533. package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-role-guard.d.ts +2 -0
  534. package/packages/omo-codex/plugin/components/ulw-loop/dist/spawn-role-guard.js +22 -0
  535. package/packages/omo-codex/plugin/components/ulw-loop/dist/state-lock.d.ts +19 -0
  536. package/packages/omo-codex/plugin/components/ulw-loop/dist/state-lock.js +259 -0
  537. package/packages/omo-codex/plugin/components/ulw-loop/dist/status-next-actions.d.ts +7 -0
  538. package/packages/omo-codex/plugin/components/ulw-loop/dist/status-next-actions.js +41 -0
  539. package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-batch.js +4 -4
  540. package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-mutations.d.ts +3 -2
  541. package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-mutations.js +4 -4
  542. package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-types.d.ts +9 -1
  543. package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.d.ts +3 -2
  544. package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.js +11 -11
  545. package/packages/omo-codex/plugin/components/ulw-loop/dist/stop-resume-hook.js +28 -23
  546. package/packages/omo-codex/plugin/components/ulw-loop/dist/success-criteria-input.d.ts +9 -0
  547. package/packages/omo-codex/plugin/components/ulw-loop/dist/success-criteria-input.js +41 -0
  548. package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.d.ts +19 -0
  549. package/packages/omo-codex/plugin/components/ulw-loop/dist/surface.js +83 -0
  550. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +18 -5
  551. package/packages/omo-codex/plugin/components/ulw-loop/package.json +6 -6
  552. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +7 -2
  553. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +33 -10
  554. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-codex-validation.ts +52 -0
  555. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-continuation.ts +8 -6
  556. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +5 -98
  557. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-template.ts +134 -0
  558. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +59 -77
  559. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-arg-parser.ts +10 -4
  560. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +24 -8
  561. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-output.ts +14 -1
  562. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +52 -46
  563. package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +8 -6
  564. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +35 -7
  565. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-snapshot.ts +51 -33
  566. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-hook.ts +3 -1
  567. package/packages/omo-codex/plugin/components/ulw-loop/src/constants.ts +1 -0
  568. package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +27 -9
  569. package/packages/omo-codex/plugin/components/ulw-loop/src/driver-objective-ack.ts +20 -0
  570. package/packages/omo-codex/plugin/components/ulw-loop/src/evidence-artifacts.ts +45 -0
  571. package/packages/omo-codex/plugin/components/ulw-loop/src/evidence.ts +23 -16
  572. package/packages/omo-codex/plugin/components/ulw-loop/src/ledger.ts +38 -0
  573. package/packages/omo-codex/plugin/components/ulw-loop/src/paths.ts +32 -4
  574. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-commit.ts +132 -0
  575. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-crud.ts +67 -54
  576. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-goal-factory.ts +63 -31
  577. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-io.ts +140 -119
  578. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-log.ts +112 -0
  579. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-missing-recovery.ts +61 -0
  580. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-aggregate.ts +11 -0
  581. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-artifacts.ts +123 -0
  582. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +71 -15
  583. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-verdicts.ts +6 -1
  584. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +92 -136
  585. package/packages/omo-codex/plugin/components/ulw-loop/src/review-blockers.ts +38 -13
  586. package/packages/omo-codex/plugin/components/ulw-loop/src/sdk/factory.ts +218 -0
  587. package/packages/omo-codex/plugin/components/ulw-loop/src/sdk/manifest.ts +156 -0
  588. package/packages/omo-codex/plugin/components/ulw-loop/src/sdk/types.ts +143 -0
  589. package/packages/omo-codex/plugin/components/ulw-loop/src/sdk.ts +3 -0
  590. package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-budget-io.ts +59 -0
  591. package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-guard.ts +196 -52
  592. package/packages/omo-codex/plugin/components/ulw-loop/src/spawn-role-guard.ts +22 -0
  593. package/packages/omo-codex/plugin/components/ulw-loop/src/state-lock.ts +257 -0
  594. package/packages/omo-codex/plugin/components/ulw-loop/src/status-next-actions.ts +45 -0
  595. package/packages/omo-codex/plugin/components/ulw-loop/src/steering-batch.ts +4 -4
  596. package/packages/omo-codex/plugin/components/ulw-loop/src/steering-mutations.ts +5 -4
  597. package/packages/omo-codex/plugin/components/ulw-loop/src/steering-types.ts +13 -1
  598. package/packages/omo-codex/plugin/components/ulw-loop/src/steering.ts +12 -10
  599. package/packages/omo-codex/plugin/components/ulw-loop/src/stop-resume-hook.ts +27 -22
  600. package/packages/omo-codex/plugin/components/ulw-loop/src/success-criteria-input.ts +56 -0
  601. package/packages/omo-codex/plugin/components/ulw-loop/src/surface.ts +115 -0
  602. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-continuation.test.ts +0 -1
  603. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +131 -82
  604. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-template.test.ts +147 -0
  605. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint.test.ts +16 -22
  606. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-checkpoint-continuation.test.ts +4 -2
  607. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-checkpoint.test.ts +31 -2
  608. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-commands.test.ts +2 -0
  609. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-complete-goals.test.ts +3 -1
  610. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-create-goals.test.ts +35 -8
  611. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +38 -4
  612. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-json-errors.test.ts +27 -0
  613. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-scope-required.test.ts +144 -0
  614. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-status-next-actions.test.ts +185 -0
  615. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-steering-batch.test.ts +8 -3
  616. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-validation-batch.test.ts +6 -0
  617. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +37 -2
  618. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-snapshot.test.ts +88 -11
  619. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-hook.test.ts +0 -3
  620. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/barrier.ts +13 -0
  621. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/cli-session.ts +4 -0
  622. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/commit-child.ts +65 -0
  623. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/commit-cli-qa.mjs +76 -0
  624. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/commit-crash.ts +23 -0
  625. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/commit-mutations.mjs +58 -0
  626. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/commit-writer.ts +65 -0
  627. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/lease-clock.ts +23 -0
  628. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/quality-gate-builder.ts +9 -4
  629. package/packages/omo-codex/plugin/components/ulw-loop/test/guided-recovery.test.ts +67 -0
  630. package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +5 -37
  631. package/packages/omo-codex/plugin/components/ulw-loop/test/paths.test.ts +9 -0
  632. package/packages/omo-codex/plugin/components/ulw-loop/test/plan-commit-log.test.ts +252 -0
  633. package/packages/omo-codex/plugin/components/ulw-loop/test/plan-commit-recovery.test.ts +190 -0
  634. package/packages/omo-codex/plugin/components/ulw-loop/test/plan-io-cross-process.test.ts +106 -0
  635. package/packages/omo-codex/plugin/components/ulw-loop/test/plan-io.test.ts +74 -25
  636. package/packages/omo-codex/plugin/components/ulw-loop/test/plan-log-legacy-projection.test.ts +228 -0
  637. package/packages/omo-codex/plugin/components/ulw-loop/test/plan-log-newest.test.ts +72 -0
  638. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate-basics.test.ts +258 -0
  639. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-cap-and-dedupe.test.ts +22 -0
  640. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-fields-messages.test.ts +98 -0
  641. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-lazycodex-surface.test.ts +93 -0
  642. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-poisoning-cascades.test.ts +97 -0
  643. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-roles.test.ts +51 -2
  644. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-senpi-surface.test.ts +131 -0
  645. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-single-report.test.ts +241 -0
  646. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +58 -3
  647. package/packages/omo-codex/plugin/components/ulw-loop/test/review-blockers.test.ts +9 -7
  648. package/packages/omo-codex/plugin/components/ulw-loop/test/sdk-completed-plan.test.ts +43 -0
  649. package/packages/omo-codex/plugin/components/ulw-loop/test/sdk-contract.test.ts +137 -0
  650. package/packages/omo-codex/plugin/components/ulw-loop/test/sdk-driver-states.test.ts +174 -0
  651. package/packages/omo-codex/plugin/components/ulw-loop/test/sdk-dx.test.ts +219 -0
  652. package/packages/omo-codex/plugin/components/ulw-loop/test/sdk-session-context.test.ts +169 -0
  653. package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-guard.test.ts +450 -7
  654. package/packages/omo-codex/plugin/components/ulw-loop/test/spawn-role-matrix.test.ts +113 -0
  655. package/packages/omo-codex/plugin/components/ulw-loop/test/state-lock.test.ts +310 -0
  656. package/packages/omo-codex/plugin/components/ulw-loop/test/status-next-actions-surface.test.ts +133 -0
  657. package/packages/omo-codex/plugin/components/ulw-loop/test/steering-batch.test.ts +12 -12
  658. package/packages/omo-codex/plugin/components/ulw-loop/test/steering.test.ts +12 -6
  659. package/packages/omo-codex/plugin/components/ulw-loop/test/stop-resume-hook.test.ts +1 -1
  660. package/packages/omo-codex/plugin/components/ulw-loop/test/surface.test.ts +74 -0
  661. package/packages/omo-codex/plugin/components/ulw-loop/test/ultrawork-directive.test.ts +13 -8
  662. package/packages/omo-codex/plugin/components/ulw-loop/vitest.config.ts +1 -0
  663. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  664. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  665. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  666. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  667. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  668. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  669. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  670. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +18 -0
  671. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  672. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  673. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  674. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  675. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  676. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  677. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  678. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +17 -0
  679. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  680. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  681. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  682. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  683. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  684. package/packages/omo-codex/plugin/model-catalog.json +16 -7
  685. package/packages/omo-codex/plugin/package-lock.json +676 -524
  686. package/packages/omo-codex/plugin/package.json +2 -3
  687. package/packages/omo-codex/plugin/scripts/AGENTS.md +39 -0
  688. package/packages/omo-codex/plugin/scripts/auto-update-plan.mjs +1 -2
  689. package/packages/omo-codex/plugin/scripts/auto-update.mjs +0 -9
  690. package/packages/omo-codex/plugin/scripts/canonical-ultrawork-directive.mjs +17 -0
  691. package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +0 -1
  692. package/packages/omo-codex/plugin/scripts/migrate-codex-config/catalog.mjs +16 -7
  693. package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +8 -4
  694. package/packages/omo-codex/plugin/scripts/migrate-codex-config/subagent-limit-guard.mjs +19 -90
  695. package/packages/omo-codex/plugin/scripts/migrate-codex-config/toml-section-editor.mjs +1 -1
  696. package/packages/omo-codex/plugin/scripts/sync-skills.d.mts +4 -0
  697. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +111 -64
  698. package/packages/omo-codex/plugin/shared/package.json +3 -4
  699. package/packages/omo-codex/plugin/shared/src/config-loader.ts +2 -102
  700. package/packages/omo-codex/plugin/shared/src/config-migration.ts +0 -1
  701. package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +41 -130
  702. package/packages/omo-codex/plugin/skills/ast-grep/AGENTS.md +51 -0
  703. package/packages/omo-codex/plugin/skills/ast-grep/SKILL.md +13 -1
  704. package/packages/omo-codex/plugin/skills/coding-agent-sessions/AGENTS.md +62 -0
  705. package/packages/omo-codex/plugin/skills/coding-agent-sessions/SKILL.md +1 -1
  706. package/packages/omo-codex/plugin/skills/data-scientist/SKILL.md +99 -239
  707. package/packages/omo-codex/plugin/skills/data-scientist/references/execution-surfaces.md +91 -0
  708. package/packages/omo-codex/plugin/skills/data-scientist/references/placement.md +74 -0
  709. package/packages/omo-codex/plugin/skills/data-scientist/references/polars-lane.md +95 -0
  710. package/packages/omo-codex/plugin/skills/data-scientist/references/uv-setup.md +1 -1
  711. package/packages/omo-codex/plugin/skills/data-scientist/references/visualization.md +64 -0
  712. package/packages/omo-codex/plugin/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
  713. package/packages/omo-codex/plugin/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
  714. package/packages/omo-codex/plugin/skills/debugging/SKILL.md +3 -1
  715. package/packages/omo-codex/plugin/skills/debugging/references/methodology/00-setup.md +12 -0
  716. package/packages/omo-codex/plugin/skills/debugging/references/methodology/02-investigate.md +26 -5
  717. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/go.md +15 -1
  718. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/native-binary.md +38 -0
  719. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/node.md +25 -0
  720. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/python.md +13 -0
  721. package/packages/omo-codex/plugin/skills/debugging/references/runtimes/rust.md +41 -0
  722. package/packages/omo-codex/plugin/skills/debugging/references/scripts/dap.mjs +267 -0
  723. package/packages/omo-codex/plugin/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
  724. package/packages/omo-codex/plugin/skills/debugging/references/tools/dap.md +103 -0
  725. package/packages/omo-codex/plugin/skills/debugging/references/tools/frida.md +193 -0
  726. package/packages/omo-codex/plugin/skills/debugging/references/tools/playwright-cli.md +79 -161
  727. package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +10 -0
  728. package/packages/omo-codex/plugin/skills/frontend/SKILL.md +7 -3
  729. package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +10 -2
  730. package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +1 -0
  731. package/packages/omo-codex/plugin/skills/frontend/references/design/ambience-skill.md +145 -0
  732. package/packages/omo-codex/plugin/skills/frontend/references/design/aside.md +1 -1
  733. package/packages/omo-codex/plugin/skills/frontend/references/design/clone-from-url.md +1 -1
  734. package/packages/omo-codex/plugin/skills/frontend/references/design/interaction-skill.md +2 -0
  735. package/packages/omo-codex/plugin/skills/frontend/references/design/print-paged-media.md +76 -0
  736. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/README.md +1 -1
  737. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
  738. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
  739. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
  740. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/orchestration.md +1 -1
  741. package/packages/omo-codex/plugin/skills/frontend/references/designpowers/routing.md +5 -5
  742. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/lighthouse-audit.py +2 -2
  743. package/packages/omo-codex/plugin/skills/git-master/SKILL.md +1 -1
  744. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +20 -18
  745. package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +4 -2
  746. package/packages/omo-codex/plugin/skills/lsp-setup/SKILL.md +1 -1
  747. package/packages/omo-codex/plugin/skills/programming/SKILL.md +1 -1
  748. package/packages/omo-codex/plugin/skills/refactor/SKILL.md +11 -9
  749. package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +11 -9
  750. package/packages/omo-codex/plugin/skills/review-work/SKILL.md +116 -424
  751. package/packages/omo-codex/plugin/skills/ultimate-browsing/ATTRIBUTION.md +32 -86
  752. package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +32 -27
  753. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/AGENTS.md +111 -0
  754. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/package.json +2 -2
  755. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/playwright_mobile_chrome.js +5 -2
  756. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/templates/playwright_real_chrome.js +8 -6
  757. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/tests/test_playwright_stealth.py +86 -0
  758. package/packages/omo-codex/plugin/skills/ultimate-browsing/engine/tests/test_playwright_templates.py +4 -7
  759. package/packages/omo-codex/plugin/skills/ultimate-browsing/references/chrome-stealth.md +86 -95
  760. package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/README.md +18 -5
  761. package/packages/omo-codex/plugin/skills/ultimate-browsing/references/insane-search/playwright.md +16 -13
  762. package/packages/omo-codex/plugin/skills/ultimate-browsing/scripts/extract_cookies.py +3 -3
  763. package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +44 -27
  764. package/packages/omo-codex/plugin/skills/{start-work → ulw-execute}/SKILL.md +35 -36
  765. package/packages/omo-codex/plugin/skills/ulw-execute/agents/openai.yaml +2 -0
  766. package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +31 -2
  767. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +33 -10
  768. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +4 -5
  769. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +5 -5
  770. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +2 -2
  771. package/packages/omo-codex/plugin/skills/ulw-plan/scripts/scaffold-plan.mjs +1 -0
  772. package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +16 -9
  773. package/packages/omo-codex/plugin/skills/visual-qa/AGENTS.md +58 -0
  774. package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +10 -7
  775. package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +75 -0
  776. package/packages/omo-codex/plugin/test/AGENTS.md +47 -0
  777. package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +19 -173
  778. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +16 -51
  779. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +2 -3
  780. package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +2 -7
  781. package/packages/omo-codex/plugin/test/aggregate-model-catalog.test.mjs +14 -4
  782. package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +175 -13
  783. package/packages/omo-codex/plugin/test/aggregate.test.mjs +78 -2
  784. package/packages/omo-codex/plugin/test/auto-update-release-notes.test.mjs +19 -33
  785. package/packages/omo-codex/plugin/test/auto-update.test.mjs +4 -29
  786. package/packages/omo-codex/plugin/test/bootstrap-default-role.test.mjs +66 -0
  787. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +0 -31
  788. package/packages/omo-codex/plugin/test/canonical-ultrawork-directive.test.mjs +53 -0
  789. package/packages/omo-codex/plugin/test/component-bin-names.test.mjs +2 -2
  790. package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +1 -51
  791. package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +100 -2
  792. package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +5 -6
  793. package/packages/omo-codex/plugin/test/lcx-contribute-bug-fix-template.test.mjs +21 -27
  794. package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +1 -3
  795. package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +35 -35
  796. package/packages/omo-codex/plugin/test/multi-agent-v2-regression.test.mjs +1 -1
  797. package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +0 -36
  798. package/packages/omo-codex/plugin/test/subagent-limit-migration.test.mjs +107 -15
  799. package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +168 -0
  800. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +54 -24
  801. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +18 -119
  802. package/packages/omo-codex/plugin/test/teammode-archive-ambiguity.test.mjs +0 -40
  803. package/packages/omo-codex/plugin/test/teammode-communication.test.mjs +6 -62
  804. package/packages/omo-codex/plugin/test/teammode-thread-links.test.mjs +3 -36
  805. package/packages/omo-codex/plugin/test/teammode-transport.test.mjs +0 -44
  806. package/packages/omo-codex/plugin/test/teammode-worktree.test.mjs +2 -6
  807. package/packages/omo-codex/plugin/test/ultrawork-skill-pointer.test.mjs +5 -5
  808. package/packages/omo-codex/plugin/test/ulw-plan-review-state-contract.test.mjs +0 -3
  809. package/packages/omo-codex/scripts/AGENTS.md +36 -0
  810. package/packages/omo-codex/scripts/check-model-catalog-parity.mjs +42 -0
  811. package/packages/omo-codex/scripts/install-cache-copy.test.mjs +27 -1
  812. package/packages/omo-codex/scripts/install-config-autonomous-features.test.mjs +1 -1
  813. package/packages/omo-codex/scripts/install-config-autonomous.test.mjs +2 -1
  814. package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +0 -23
  815. package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +5 -5
  816. package/packages/omo-codex/scripts/install-config.test.mjs +15 -17
  817. package/packages/omo-codex/scripts/install-dist/install-local.mjs +9832 -1445
  818. package/packages/omo-codex/scripts/install-generated-bundle.test.mjs +3 -4
  819. package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +1 -25
  820. package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +7 -2
  821. package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +0 -36
  822. package/packages/omo-codex/scripts/install-packaged-local.test.mjs +1 -6
  823. package/packages/{omo-codex/plugin/components/ultrawork/skills/ultrawork/SKILL.md → prompts-core/prompts/ultrawork/codex.md} +44 -34
  824. package/packages/shared-skills/package.json +7 -1
  825. package/packages/shared-skills/skill-source-filter.d.ts +16 -0
  826. package/packages/shared-skills/skill-source-filter.mjs +44 -0
  827. package/packages/shared-skills/skills/ast-grep/AGENTS.md +51 -0
  828. package/packages/shared-skills/skills/ast-grep/SKILL.md +13 -1
  829. package/packages/shared-skills/skills/coding-agent-sessions/AGENTS.md +62 -0
  830. package/packages/shared-skills/skills/coding-agent-sessions/SKILL.md +1 -1
  831. package/packages/shared-skills/skills/data-scientist/SKILL.md +99 -239
  832. package/packages/shared-skills/skills/data-scientist/references/execution-surfaces.md +91 -0
  833. package/packages/shared-skills/skills/data-scientist/references/placement.md +74 -0
  834. package/packages/shared-skills/skills/data-scientist/references/polars-lane.md +95 -0
  835. package/packages/shared-skills/skills/data-scientist/references/uv-setup.md +1 -1
  836. package/packages/shared-skills/skills/data-scientist/references/visualization.md +64 -0
  837. package/packages/shared-skills/skills/data-scientist/scripts/ensure-js-deps.sh +28 -0
  838. package/packages/shared-skills/skills/data-scientist/scripts/ensure-py-deps.sh +37 -0
  839. package/packages/shared-skills/skills/debugging/SKILL.md +3 -1
  840. package/packages/shared-skills/skills/debugging/references/methodology/00-setup.md +12 -0
  841. package/packages/shared-skills/skills/debugging/references/methodology/02-investigate.md +26 -5
  842. package/packages/shared-skills/skills/debugging/references/runtimes/go.md +15 -1
  843. package/packages/shared-skills/skills/debugging/references/runtimes/native-binary.md +38 -0
  844. package/packages/shared-skills/skills/debugging/references/runtimes/node.md +25 -0
  845. package/packages/shared-skills/skills/debugging/references/runtimes/python.md +13 -0
  846. package/packages/shared-skills/skills/debugging/references/runtimes/rust.md +41 -0
  847. package/packages/shared-skills/skills/debugging/references/scripts/dap.mjs +267 -0
  848. package/packages/shared-skills/skills/debugging/references/scripts/dap.test.ts +86 -0
  849. package/packages/shared-skills/skills/debugging/references/scripts/fixture-adapter.mjs +59 -0
  850. package/packages/shared-skills/skills/debugging/references/tools/dap.md +103 -0
  851. package/packages/shared-skills/skills/debugging/references/tools/frida.md +193 -0
  852. package/packages/shared-skills/skills/debugging/references/tools/playwright-cli.md +79 -161
  853. package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +10 -0
  854. package/packages/shared-skills/skills/frontend/SKILL.md +7 -3
  855. package/packages/shared-skills/skills/frontend/references/design/README.md +10 -2
  856. package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +1 -0
  857. package/packages/shared-skills/skills/frontend/references/design/ambience-skill.md +145 -0
  858. package/packages/shared-skills/skills/frontend/references/design/aside.md +1 -1
  859. package/packages/shared-skills/skills/frontend/references/design/clone-from-url.md +1 -1
  860. package/packages/shared-skills/skills/frontend/references/design/interaction-skill.md +2 -0
  861. package/packages/shared-skills/skills/frontend/references/design/print-paged-media.md +76 -0
  862. package/packages/shared-skills/skills/frontend/references/designpowers/README.md +1 -1
  863. package/packages/shared-skills/skills/frontend/references/designpowers/lane-a-direction.md +1 -1
  864. package/packages/shared-skills/skills/frontend/references/designpowers/lane-b-execution.md +11 -11
  865. package/packages/shared-skills/skills/frontend/references/designpowers/lane-d-memory.md +3 -3
  866. package/packages/shared-skills/skills/frontend/references/designpowers/orchestration.md +1 -1
  867. package/packages/shared-skills/skills/frontend/references/designpowers/routing.md +5 -5
  868. package/packages/shared-skills/skills/frontend/scripts/perfection/lighthouse-audit.py +2 -2
  869. package/packages/shared-skills/skills/git-master/SKILL.md +1 -1
  870. package/packages/shared-skills/skills/init-deep/SKILL.md +14 -14
  871. package/packages/shared-skills/skills/lsp-setup/SKILL.md +1 -1
  872. package/packages/shared-skills/skills/programming/SKILL.md +1 -1
  873. package/packages/shared-skills/skills/refactor/SKILL.md +5 -5
  874. package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +5 -5
  875. package/packages/shared-skills/skills/review-work/SKILL.md +101 -419
  876. package/packages/shared-skills/skills/ultimate-browsing/ATTRIBUTION.md +32 -86
  877. package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +32 -27
  878. package/packages/shared-skills/skills/ultimate-browsing/engine/AGENTS.md +111 -0
  879. package/packages/shared-skills/skills/ultimate-browsing/engine/templates/package.json +2 -2
  880. package/packages/shared-skills/skills/ultimate-browsing/engine/templates/playwright_mobile_chrome.js +5 -2
  881. package/packages/shared-skills/skills/ultimate-browsing/engine/templates/playwright_real_chrome.js +8 -6
  882. package/packages/shared-skills/skills/ultimate-browsing/engine/tests/test_playwright_stealth.py +86 -0
  883. package/packages/shared-skills/skills/ultimate-browsing/engine/tests/test_playwright_templates.py +4 -7
  884. package/packages/shared-skills/skills/ultimate-browsing/references/chrome-stealth.md +86 -95
  885. package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/README.md +18 -5
  886. package/packages/shared-skills/skills/ultimate-browsing/references/insane-search/playwright.md +16 -13
  887. package/packages/shared-skills/skills/ultimate-browsing/scripts/extract_cookies.py +3 -3
  888. package/packages/shared-skills/skills/{start-work → ulw-execute}/SKILL.md +24 -22
  889. package/packages/shared-skills/skills/ulw-plan/SKILL.md +5 -6
  890. package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +6 -5
  891. package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +2 -2
  892. package/packages/shared-skills/skills/ulw-plan/scripts/scaffold-plan.mjs +2 -1
  893. package/packages/shared-skills/skills/ulw-research/SKILL.md +10 -5
  894. package/packages/shared-skills/skills/visual-qa/AGENTS.md +58 -0
  895. package/packages/shared-skills/skills/visual-qa/SKILL.md +4 -3
  896. package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +75 -0
  897. package/postinstall.mjs +2 -0
  898. package/script/qa/web-terminal-visual-qa.mjs +2 -0
  899. package/script/qa/xterm-live-terminal.mjs +18 -2
  900. package/.agents/skills/work-with-pr-workspace/evals/evals.json +0 -76
  901. package/.agents/skills/work-with-pr-workspace/iteration-1/benchmark.json +0 -138
  902. package/.agents/skills/work-with-pr-workspace/iteration-1/benchmark.md +0 -42
  903. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/eval_metadata.json +0 -57
  904. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/grading.json +0 -15
  905. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/code-changes.md +0 -454
  906. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/execution-plan.md +0 -136
  907. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/pr-description.md +0 -47
  908. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/verification-strategy.md +0 -163
  909. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/timing.json +0 -1
  910. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/grading.json +0 -15
  911. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/code-changes.md +0 -615
  912. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/execution-plan.md +0 -99
  913. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/pr-description.md +0 -50
  914. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/verification-strategy.md +0 -111
  915. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/timing.json +0 -1
  916. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/eval_metadata.json +0 -37
  917. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/grading.json +0 -11
  918. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/code-changes.md +0 -205
  919. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/execution-plan.md +0 -78
  920. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/pr-description.md +0 -42
  921. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/verification-strategy.md +0 -87
  922. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/timing.json +0 -1
  923. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/grading.json +0 -11
  924. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/code-changes.md +0 -334
  925. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/execution-plan.md +0 -86
  926. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/pr-description.md +0 -23
  927. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/verification-strategy.md +0 -119
  928. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/timing.json +0 -1
  929. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/eval_metadata.json +0 -32
  930. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/grading.json +0 -10
  931. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/code-changes.md +0 -221
  932. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/execution-plan.md +0 -104
  933. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/pr-description.md +0 -41
  934. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/verification-strategy.md +0 -84
  935. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/timing.json +0 -1
  936. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/grading.json +0 -10
  937. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/code-changes.md +0 -342
  938. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/execution-plan.md +0 -131
  939. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/pr-description.md +0 -39
  940. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/verification-strategy.md +0 -128
  941. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/timing.json +0 -1
  942. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/eval_metadata.json +0 -32
  943. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/grading.json +0 -10
  944. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/code-changes.md +0 -143
  945. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/execution-plan.md +0 -82
  946. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/pr-description.md +0 -51
  947. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/verification-strategy.md +0 -69
  948. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/timing.json +0 -1
  949. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/grading.json +0 -10
  950. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/code-changes.md +0 -252
  951. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/execution-plan.md +0 -83
  952. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/pr-description.md +0 -33
  953. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/verification-strategy.md +0 -101
  954. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/timing.json +0 -1
  955. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/eval_metadata.json +0 -32
  956. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/grading.json +0 -10
  957. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/code-changes.md +0 -387
  958. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/execution-plan.md +0 -112
  959. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/pr-description.md +0 -51
  960. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/verification-strategy.md +0 -75
  961. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/timing.json +0 -1
  962. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/grading.json +0 -10
  963. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/code-changes.md +0 -529
  964. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/execution-plan.md +0 -127
  965. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/pr-description.md +0 -42
  966. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/verification-strategy.md +0 -120
  967. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/timing.json +0 -1
  968. package/.agents/skills/work-with-pr-workspace/iteration-1/review.html +0 -1326
  969. package/.opencode/skills/work-with-pr-workspace/evals/evals.json +0 -76
  970. package/.opencode/skills/work-with-pr-workspace/iteration-1/benchmark.json +0 -138
  971. package/.opencode/skills/work-with-pr-workspace/iteration-1/benchmark.md +0 -42
  972. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/eval_metadata.json +0 -57
  973. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/grading.json +0 -15
  974. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/code-changes.md +0 -454
  975. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/execution-plan.md +0 -136
  976. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/pr-description.md +0 -47
  977. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/outputs/verification-strategy.md +0 -163
  978. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/with_skill/timing.json +0 -1
  979. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/grading.json +0 -15
  980. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/code-changes.md +0 -615
  981. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/execution-plan.md +0 -99
  982. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/pr-description.md +0 -50
  983. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/outputs/verification-strategy.md +0 -111
  984. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-1/without_skill/timing.json +0 -1
  985. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/eval_metadata.json +0 -37
  986. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/grading.json +0 -11
  987. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/code-changes.md +0 -205
  988. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/execution-plan.md +0 -78
  989. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/pr-description.md +0 -42
  990. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/outputs/verification-strategy.md +0 -87
  991. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/with_skill/timing.json +0 -1
  992. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/grading.json +0 -11
  993. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/code-changes.md +0 -334
  994. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/execution-plan.md +0 -86
  995. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/pr-description.md +0 -23
  996. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/outputs/verification-strategy.md +0 -119
  997. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-2/without_skill/timing.json +0 -1
  998. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/eval_metadata.json +0 -32
  999. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/grading.json +0 -10
  1000. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/code-changes.md +0 -221
  1001. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/execution-plan.md +0 -104
  1002. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/pr-description.md +0 -41
  1003. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/outputs/verification-strategy.md +0 -84
  1004. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/with_skill/timing.json +0 -1
  1005. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/grading.json +0 -10
  1006. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/code-changes.md +0 -342
  1007. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/execution-plan.md +0 -131
  1008. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/pr-description.md +0 -39
  1009. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/outputs/verification-strategy.md +0 -128
  1010. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-3/without_skill/timing.json +0 -1
  1011. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/eval_metadata.json +0 -32
  1012. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/grading.json +0 -10
  1013. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/code-changes.md +0 -143
  1014. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/execution-plan.md +0 -82
  1015. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/pr-description.md +0 -51
  1016. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/outputs/verification-strategy.md +0 -69
  1017. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/with_skill/timing.json +0 -1
  1018. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/grading.json +0 -10
  1019. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/code-changes.md +0 -252
  1020. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/execution-plan.md +0 -83
  1021. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/pr-description.md +0 -33
  1022. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/outputs/verification-strategy.md +0 -101
  1023. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-4/without_skill/timing.json +0 -1
  1024. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/eval_metadata.json +0 -32
  1025. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/grading.json +0 -10
  1026. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/code-changes.md +0 -387
  1027. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/execution-plan.md +0 -112
  1028. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/pr-description.md +0 -51
  1029. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/verification-strategy.md +0 -75
  1030. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/timing.json +0 -1
  1031. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/grading.json +0 -10
  1032. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/code-changes.md +0 -529
  1033. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/execution-plan.md +0 -127
  1034. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/pr-description.md +0 -42
  1035. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/outputs/verification-strategy.md +0 -120
  1036. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/without_skill/timing.json +0 -1
  1037. package/.opencode/skills/work-with-pr-workspace/iteration-1/review.html +0 -1326
  1038. package/dist/config/schema/codegraph.d.ts +0 -12
  1039. package/dist/config/schema/start-work.d.ts +0 -5
  1040. package/dist/features/builtin-commands/templates/start-work.d.ts +0 -1
  1041. package/dist/features/builtin-skills/index.d.ts +0 -1
  1042. package/dist/features/builtin-skills/skill-file-loader.d.ts +0 -1
  1043. package/dist/features/builtin-skills/skills/agent-browser-skill.d.ts +0 -1
  1044. package/dist/features/builtin-skills/skills/agent-browser-template.d.ts +0 -1
  1045. package/dist/features/builtin-skills/skills/debugging.d.ts +0 -1
  1046. package/dist/features/builtin-skills/skills/dev-browser.d.ts +0 -1
  1047. package/dist/features/builtin-skills/skills/frontend.d.ts +0 -1
  1048. package/dist/features/builtin-skills/skills/git-master-sections/commit-atomic-planning.d.ts +0 -1
  1049. package/dist/features/builtin-skills/skills/git-master-sections/commit-context-analysis.d.ts +0 -1
  1050. package/dist/features/builtin-skills/skills/git-master-sections/commit-execution-verification.d.ts +0 -1
  1051. package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +0 -1
  1052. package/dist/features/builtin-skills/skills/git-master-sections/history-search-workflow.d.ts +0 -1
  1053. package/dist/features/builtin-skills/skills/git-master-sections/overview.d.ts +0 -1
  1054. package/dist/features/builtin-skills/skills/git-master-sections/quick-reference.d.ts +0 -1
  1055. package/dist/features/builtin-skills/skills/git-master-sections/rebase-workflow.d.ts +0 -1
  1056. package/dist/features/builtin-skills/skills/git-master-skill-metadata.d.ts +0 -1
  1057. package/dist/features/builtin-skills/skills/git-master.d.ts +0 -1
  1058. package/dist/features/builtin-skills/skills/index.d.ts +0 -1
  1059. package/dist/features/builtin-skills/skills/init-deep.d.ts +0 -1
  1060. package/dist/features/builtin-skills/skills/playwright-cli.d.ts +0 -1
  1061. package/dist/features/builtin-skills/skills/playwright-mcp-skill.d.ts +0 -1
  1062. package/dist/features/builtin-skills/skills/playwright.d.ts +0 -1
  1063. package/dist/features/builtin-skills/skills/remove-ai-slops.d.ts +0 -1
  1064. package/dist/features/builtin-skills/skills/review-work.d.ts +0 -1
  1065. package/dist/features/builtin-skills/skills/security-research.d.ts +0 -1
  1066. package/dist/features/builtin-skills/skills/security-review.d.ts +0 -1
  1067. package/dist/features/builtin-skills/skills/team-mode.d.ts +0 -1
  1068. package/dist/features/builtin-skills/skills/visual-qa.d.ts +0 -1
  1069. package/dist/features/builtin-skills/skills.d.ts +0 -1
  1070. package/dist/features/builtin-skills/types.d.ts +0 -1
  1071. package/dist/features/claude-code-plugin-loader/agent-loader.d.ts +0 -1
  1072. package/dist/features/claude-code-plugin-loader/command-loader.d.ts +0 -1
  1073. package/dist/features/claude-code-plugin-loader/discovery-core.d.ts +0 -1
  1074. package/dist/features/claude-code-plugin-loader/discovery-paths.d.ts +0 -1
  1075. package/dist/features/claude-code-plugin-loader/discovery.d.ts +0 -1
  1076. package/dist/features/claude-code-plugin-loader/hook-loader.d.ts +0 -1
  1077. package/dist/features/claude-code-plugin-loader/index.d.ts +0 -1
  1078. package/dist/features/claude-code-plugin-loader/install-path-resolver.d.ts +0 -1
  1079. package/dist/features/claude-code-plugin-loader/installed-plugin-database.d.ts +0 -1
  1080. package/dist/features/claude-code-plugin-loader/loaded-plugin.d.ts +0 -1
  1081. package/dist/features/claude-code-plugin-loader/loader.d.ts +0 -1
  1082. package/dist/features/claude-code-plugin-loader/mcp-server-loader.d.ts +0 -1
  1083. package/dist/features/claude-code-plugin-loader/plugin-key.d.ts +0 -1
  1084. package/dist/features/claude-code-plugin-loader/plugin-manifest.d.ts +0 -1
  1085. package/dist/features/claude-code-plugin-loader/plugin-path-resolver.d.ts +0 -1
  1086. package/dist/features/claude-code-plugin-loader/plugin-settings.d.ts +0 -1
  1087. package/dist/features/claude-code-plugin-loader/scope-filter.d.ts +0 -1
  1088. package/dist/features/claude-code-plugin-loader/skill-loader.d.ts +0 -1
  1089. package/dist/features/claude-code-plugin-loader/types.d.ts +0 -1
  1090. package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +0 -17
  1091. package/dist/hooks/codegraph-bootstrap/hook.d.ts +0 -35
  1092. package/dist/hooks/codegraph-bootstrap/index.d.ts +0 -1
  1093. package/dist/hooks/codegraph-bootstrap/project-root.d.ts +0 -1
  1094. package/dist/hooks/codegraph-bootstrap/status.d.ts +0 -11
  1095. package/dist/hooks/ralph-loop/completion-promise-detector-test-input.d.ts +0 -11
  1096. package/dist/hooks/ralph-loop/loop-session-recovery.d.ts +0 -7
  1097. package/dist/hooks/start-work/start-work-hook.d.ts +0 -23
  1098. package/dist/mcp/codegraph.d.ts +0 -16
  1099. package/dist/plugin/chat-message/start-work-message.d.ts +0 -5
  1100. package/dist/shared/prompt-async-gate/message-inspection-error.d.ts +0 -1
  1101. package/dist/shared/prompt-async-gate/pending-tool-turn.d.ts +0 -1
  1102. package/dist/shared/prompt-async-gate/prompt-message-state.d.ts +0 -1
  1103. package/dist/shared/prompt-async-gate/queue.d.ts +0 -1
  1104. package/dist/shared/prompt-async-gate/recent-dispatches.d.ts +0 -1
  1105. package/dist/shared/prompt-async-gate/reservations.d.ts +0 -1
  1106. package/dist/shared/prompt-async-gate/semantic-dedupe.d.ts +0 -1
  1107. package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +0 -1
  1108. package/dist/shared/prompt-async-gate/timing.d.ts +0 -1
  1109. package/dist/shared/prompt-async-gate/types.d.ts +0 -1
  1110. package/dist/skills/data-scientist/references/common-scenarios.md +0 -176
  1111. package/dist/skills/data-scientist/references/execution-templates.md +0 -197
  1112. package/dist/skills/data-scientist/references/integration-patterns.md +0 -153
  1113. package/dist/skills/data-scientist/references/performance-benchmarks.md +0 -37
  1114. package/dist/skills/visual-qa/references/agent-browser-setup.md +0 -45
  1115. package/dist/tools/call-omo-agent/background-agent-executor.d.ts +0 -5
  1116. package/dist/tools/call-omo-agent/message-storage-directory.d.ts +0 -1
  1117. package/dist/tools/delegate-task/anthropic-categories.d.ts +0 -2
  1118. package/dist/tools/delegate-task/model-string-parser.d.ts +0 -1
  1119. package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.d.ts +0 -1
  1120. package/packages/lsp-tools-mcp/dist/lsp/constants.d.ts +0 -1
  1121. package/packages/lsp-tools-mcp/dist/lsp/language-mappings.d.ts +0 -1
  1122. package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.d.ts +0 -1
  1123. package/packages/lsp-tools-mcp/dist/missing-dependency-result.d.ts +0 -1
  1124. package/packages/omo-codex/plugin/components/codegraph/AGENTS.md +0 -58
  1125. package/packages/omo-codex/plugin/components/codegraph/NODE-RUNTIME-LICENSES.md +0 -2951
  1126. package/packages/omo-codex/plugin/components/codegraph/NOTICE +0 -16
  1127. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +0 -12244
  1128. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +0 -9842
  1129. package/packages/omo-codex/plugin/components/codegraph/package.json +0 -33
  1130. package/packages/omo-codex/plugin/components/codegraph/src/cache-gc.ts +0 -29
  1131. package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +0 -79
  1132. package/packages/omo-codex/plugin/components/codegraph/src/hook-input.ts +0 -33
  1133. package/packages/omo-codex/plugin/components/codegraph/src/hook-sweep.ts +0 -25
  1134. package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +0 -131
  1135. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +0 -258
  1136. package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +0 -309
  1137. package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +0 -80
  1138. package/packages/omo-codex/plugin/components/codegraph/src/post-tool-use-hook.ts +0 -34
  1139. package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +0 -29
  1140. package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +0 -263
  1141. package/packages/omo-codex/plugin/components/codegraph/src/session-start-command.ts +0 -106
  1142. package/packages/omo-codex/plugin/components/codegraph/src/session-start-cooldown.ts +0 -145
  1143. package/packages/omo-codex/plugin/components/codegraph/src/session-start-hook-runtime.ts +0 -21
  1144. package/packages/omo-codex/plugin/components/codegraph/src/session-start-lock.ts +0 -139
  1145. package/packages/omo-codex/plugin/components/codegraph/src/session-start-outcome.ts +0 -15
  1146. package/packages/omo-codex/plugin/components/codegraph/src/session-start-paths.ts +0 -32
  1147. package/packages/omo-codex/plugin/components/codegraph/src/session-start-project.ts +0 -109
  1148. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker-result.ts +0 -148
  1149. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +0 -175
  1150. package/packages/omo-codex/plugin/components/codegraph/src/sweep-cli.ts +0 -81
  1151. package/packages/omo-codex/plugin/components/codegraph/test/cache-gc.test.ts +0 -34
  1152. package/packages/omo-codex/plugin/components/codegraph/test/hook-exclusion.test.ts +0 -112
  1153. package/packages/omo-codex/plugin/components/codegraph/test/hook-registration.test.ts +0 -26
  1154. package/packages/omo-codex/plugin/components/codegraph/test/hook-session-start-guard.test.ts +0 -160
  1155. package/packages/omo-codex/plugin/components/codegraph/test/hook-store-upgrade.test.ts +0 -50
  1156. package/packages/omo-codex/plugin/components/codegraph/test/hook-sweep.test.ts +0 -29
  1157. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +0 -320
  1158. package/packages/omo-codex/plugin/components/codegraph/test/mcp-bridge-fixtures.ts +0 -172
  1159. package/packages/omo-codex/plugin/components/codegraph/test/package-runtime.test.ts +0 -91
  1160. package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +0 -100
  1161. package/packages/omo-codex/plugin/components/codegraph/test/serve-built-wrapper.test.ts +0 -76
  1162. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts +0 -133
  1163. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +0 -245
  1164. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-facade.test.ts +0 -69
  1165. package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +0 -43
  1166. package/packages/omo-codex/plugin/components/codegraph/test/serve-provision.test.ts +0 -147
  1167. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable.test.ts +0 -175
  1168. package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +0 -385
  1169. package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +0 -206
  1170. package/packages/omo-codex/plugin/components/codegraph/test/session-start-project.test.ts +0 -58
  1171. package/packages/omo-codex/plugin/components/codegraph/test/session-start-state.test.ts +0 -104
  1172. package/packages/omo-codex/plugin/components/codegraph/test/session-start-trust-boundary.test.ts +0 -65
  1173. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-availability.test.ts +0 -106
  1174. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-cooldown.test.ts +0 -116
  1175. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +0 -258
  1176. package/packages/omo-codex/plugin/components/codegraph/test/sweep-cli.test.ts +0 -56
  1177. package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +0 -13
  1178. package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +0 -25
  1179. package/packages/omo-codex/plugin/components/start-work-continuation/LICENSE +0 -21
  1180. package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +0 -28
  1181. package/packages/omo-codex/plugin/components/ultrawork/directive.md +0 -477
  1182. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +0 -18
  1183. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +0 -17
  1184. package/packages/omo-codex/plugin/hooks/stop-checking-start-work-continuation.json +0 -17
  1185. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-start-work-continuation.json +0 -17
  1186. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +0 -125
  1187. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +0 -43
  1188. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +0 -29
  1189. package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +0 -121
  1190. package/packages/omo-codex/plugin/skills/data-scientist/references/common-scenarios.md +0 -176
  1191. package/packages/omo-codex/plugin/skills/data-scientist/references/execution-templates.md +0 -197
  1192. package/packages/omo-codex/plugin/skills/data-scientist/references/integration-patterns.md +0 -153
  1193. package/packages/omo-codex/plugin/skills/data-scientist/references/performance-benchmarks.md +0 -37
  1194. package/packages/omo-codex/plugin/skills/start-work/agents/openai.yaml +0 -2
  1195. package/packages/omo-codex/plugin/skills/visual-qa/references/agent-browser-setup.md +0 -45
  1196. package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +0 -92
  1197. package/packages/omo-codex/plugin/test/component-codegraph-mcp-smoke.test.mjs +0 -76
  1198. package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +0 -179
  1199. package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +0 -314
  1200. package/packages/omo-codex/plugin/test/ulw-plan-scope-contract.test.mjs +0 -24
  1201. package/packages/shared-skills/skills/data-scientist/references/common-scenarios.md +0 -176
  1202. package/packages/shared-skills/skills/data-scientist/references/execution-templates.md +0 -197
  1203. package/packages/shared-skills/skills/data-scientist/references/integration-patterns.md +0 -153
  1204. package/packages/shared-skills/skills/data-scientist/references/performance-benchmarks.md +0 -37
  1205. package/packages/shared-skills/skills/visual-qa/references/agent-browser-setup.md +0 -45
  1206. /package/dist/hooks/{start-work → ulw-execute}/context-info-formatters.d.ts +0 -0
  1207. /package/dist/hooks/{start-work → ulw-execute}/explicit-plan-context.d.ts +0 -0
  1208. /package/dist/hooks/{start-work → ulw-execute}/notepad-scaffold.d.ts +0 -0
  1209. /package/dist/hooks/{start-work → ulw-execute}/parse-user-request.d.ts +0 -0
  1210. /package/dist/hooks/{start-work → ulw-execute}/plan-discovery-context.d.ts +0 -0
  1211. /package/dist/hooks/{start-work → ulw-execute}/plan-selection.d.ts +0 -0
  1212. /package/dist/hooks/{start-work → ulw-execute}/session-plan-affinity.d.ts +0 -0
  1213. /package/dist/hooks/{start-work → ulw-execute}/work-initializer.d.ts +0 -0
  1214. /package/dist/hooks/{start-work → ulw-execute}/worktree-block.d.ts +0 -0
  1215. /package/dist/hooks/{start-work → ulw-execute}/worktree-detector.d.ts +0 -0
  1216. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/.gitattributes +0 -0
  1217. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/CHANGELOG.md +0 -0
  1218. /package/packages/omo-codex/plugin/components/{codegraph → ulw-execute-continuation}/LICENSE +0 -0
  1219. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/src/plan-checklist.ts +0 -0
  1220. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-completed.json +0 -0
  1221. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-mixed-platforms.json +0 -0
  1222. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/boulder-single-codex-work.json +0 -0
  1223. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-all-done.md +0 -0
  1224. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-scaffold.md +0 -0
  1225. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-with-nested-checkboxes.md +0 -0
  1226. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/test/fixtures/plan-with-unchecked.md +0 -0
  1227. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/tsconfig.build.json +0 -0
  1228. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/tsconfig.json +0 -0
  1229. /package/packages/omo-codex/plugin/components/{start-work-continuation → ulw-execute-continuation}/vitest.config.ts +0 -0
@@ -1,7 +1,11 @@
1
+ // src/client.ts
2
+ import { statSync as statSync5 } from "node:fs";
3
+ import { isAbsolute as isAbsolute6 } from "node:path";
4
+
1
5
  // src/daemon-client.ts
2
6
  import { connect } from "node:net";
3
7
  import { homedir as homedir3 } from "node:os";
4
- import { join as join7 } from "node:path";
8
+ import { join as join8 } from "node:path";
5
9
 
6
10
  // ../lsp-core/src/request-context.ts
7
11
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -10,18 +14,17 @@ import { homedir } from "node:os";
10
14
  import { basename, delimiter, dirname, isAbsolute, join, relative, resolve } from "node:path";
11
15
 
12
16
  class LspRequestContextParseError extends Error {
13
- code;
14
- name = "LspRequestContextParseError";
15
17
  constructor(code, message) {
16
18
  super(message);
17
19
  this.code = code;
20
+ this.name = "LspRequestContextParseError";
18
21
  }
19
22
  }
20
23
 
21
24
  class LspRequestContextUnavailableError extends Error {
22
- name = "LspRequestContextUnavailableError";
23
25
  constructor() {
24
26
  super("LSP request context is required. Standalone MCP startup must install one with runWithRequestContext(createStandaloneMcpRequestContext()).");
27
+ this.name = "LspRequestContextUnavailableError";
25
28
  }
26
29
  }
27
30
  var storage = new AsyncLocalStorage;
@@ -41,7 +44,7 @@ function contextCwd() {
41
44
  }
42
45
  function createStandaloneMcpRequestContext(input = {}) {
43
46
  const env = input.env ?? process.env;
44
- const cwd = canonicalCwd(input.cwd ?? process.cwd());
47
+ const cwd = canonicalCwd(input.cwd ?? env["LSP_TOOLS_MCP_CWD"] ?? process.cwd());
45
48
  const home = input.homeDir ?? homedir();
46
49
  const projectConfigPaths = translateProjectConfigEnv(env["LSP_TOOLS_MCP_PROJECT_CONFIG"], cwd);
47
50
  const userConfigPath = translateHomeConfigEnv(env["LSP_TOOLS_MCP_USER_CONFIG"], home, ".codex/lsp-client.json");
@@ -179,7 +182,6 @@ function isPlainRecord(value) {
179
182
 
180
183
  // src/daemon-request-error.ts
181
184
  class DaemonRequestError extends Error {
182
- requestWritten;
183
185
  constructor(message, requestWritten) {
184
186
  super(message);
185
187
  this.name = "DaemonRequestError";
@@ -202,7 +204,6 @@ class DaemonRequestCancelledError extends DaemonRequestError {
202
204
  }
203
205
 
204
206
  class DaemonRequestTimedOutError extends DaemonRequestError {
205
- timeoutMs;
206
207
  constructor(requestWritten, timeoutMs) {
207
208
  super("daemon request timed out", requestWritten);
208
209
  this.name = "DaemonRequestTimedOutError";
@@ -281,14 +282,12 @@ var PROTOCOL_ERROR_CODE = -32002;
281
282
  var AUTH_TOKEN_BYTES = 32;
282
283
 
283
284
  class UnsafePrivateDirectoryError extends Error {
284
- path;
285
- reason;
286
- name = "UnsafePrivateDirectoryError";
287
- code = "unsafe_private_directory";
288
285
  constructor(path, reason) {
289
286
  super(`unsafe private directory ${path}: ${reason}`);
290
287
  this.path = path;
291
288
  this.reason = reason;
289
+ this.name = "UnsafePrivateDirectoryError";
290
+ this.code = "unsafe_private_directory";
292
291
  }
293
292
  }
294
293
  function authEnvelope(token) {
@@ -472,20 +471,18 @@ var OMO_LSP_DAEMON_VERSION = "OMO_LSP_DAEMON_VERSION";
472
471
  var DAEMON_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
473
472
 
474
473
  class InvalidRuntimeOverrideError extends Error {
475
- code = "invalid_runtime_override";
476
- reason;
477
474
  constructor(reason, message) {
478
475
  super(message);
476
+ this.code = "invalid_runtime_override";
479
477
  this.name = "InvalidRuntimeOverrideError";
480
478
  this.reason = reason;
481
479
  }
482
480
  }
483
481
 
484
482
  class InvalidDaemonVersionError extends Error {
485
- code = "invalid_daemon_version";
486
- version;
487
483
  constructor(version) {
488
484
  super("LSP daemon version must match [A-Za-z0-9][A-Za-z0-9._+-]{0,127}");
485
+ this.code = "invalid_daemon_version";
489
486
  this.name = "InvalidDaemonVersionError";
490
487
  this.version = version;
491
488
  }
@@ -531,10 +528,9 @@ var requireFromHere = createRequire(import.meta.url);
531
528
  var MAX_SOCKET_PATH_LENGTH = 100;
532
529
 
533
530
  class InvalidDaemonDirectoryError extends Error {
534
- code = "invalid_daemon_directory";
535
- directory;
536
531
  constructor(directory) {
537
532
  super(`${OMO_LSP_DAEMON_DIR} must be an absolute path`);
533
+ this.code = "invalid_daemon_directory";
538
534
  this.name = "InvalidDaemonDirectoryError";
539
535
  this.directory = directory;
540
536
  }
@@ -688,7 +684,7 @@ async function probeDaemon(paths, timeoutMs = PROBE_TIMEOUT_MS, signal) {
688
684
  return await pingDaemon(paths, token, timeoutMs, signal) !== null;
689
685
  }
690
686
  function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
691
- return new Promise((resolve2) => {
687
+ return new Promise((resolve) => {
692
688
  const socket = new Socket;
693
689
  let settled = false;
694
690
  let timer;
@@ -700,7 +696,7 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
700
696
  clearTimeout(timer);
701
697
  signal?.removeEventListener("abort", onAbort);
702
698
  socket.destroy();
703
- resolve2(value);
699
+ resolve(value);
704
700
  };
705
701
  const onAbort = () => finish(null);
706
702
  const decoder = createLineDecoder((message) => {
@@ -723,13 +719,17 @@ function pingDaemon(paths, token, timeoutMs = PROBE_TIMEOUT_MS, signal) {
723
719
  socket.connect(paths.socket);
724
720
  });
725
721
  }
726
- function spawnDaemonProcess(paths) {
722
+ function spawnDaemonProcess(paths, deps = {}) {
727
723
  mkdirSync2(dirname3(paths.log), { recursive: true });
728
724
  const logFd = openSync2(paths.log, "a");
729
725
  try {
730
- const child = spawn(resolveDaemonNodeExecutable(), [paths.cliPath, "daemon"], {
726
+ const spawnDaemonChild = deps.spawn ?? spawn;
727
+ const executable = deps.resolveExecutable?.() ?? resolveDaemonNodeExecutable();
728
+ const child = spawnDaemonChild(executable, [paths.cliPath, "daemon"], {
731
729
  detached: true,
732
- stdio: ["ignore", logFd, logFd]
730
+ stdio: ["ignore", logFd, logFd],
731
+ windowsHide: true,
732
+ env: { ...process.env, BUN_BE_BUN: "1" }
733
733
  });
734
734
  child.once("spawn", () => closeSync2(logFd));
735
735
  child.once("error", (error) => {
@@ -759,7 +759,7 @@ function defaultEnsureDaemonDeps() {
759
759
  };
760
760
  }
761
761
  function sleepWithSignal(ms, signal) {
762
- return new Promise((resolve2) => {
762
+ return new Promise((resolve) => {
763
763
  let settled = false;
764
764
  const finish = () => {
765
765
  if (settled)
@@ -767,7 +767,7 @@ function sleepWithSignal(ms, signal) {
767
767
  settled = true;
768
768
  clearTimeout(timer);
769
769
  signal?.removeEventListener("abort", finish);
770
- resolve2();
770
+ resolve();
771
771
  };
772
772
  const timer = setTimeout(finish, ms);
773
773
  if (signal?.aborted) {
@@ -782,7 +782,7 @@ function awaitWithSignal(promise, signal) {
782
782
  return promise;
783
783
  if (signal.aborted)
784
784
  return Promise.reject(abortError(signal));
785
- return new Promise((resolve2, reject) => {
785
+ return new Promise((resolve, reject) => {
786
786
  let settled = false;
787
787
  const finish = (run) => {
788
788
  if (settled)
@@ -793,7 +793,7 @@ function awaitWithSignal(promise, signal) {
793
793
  };
794
794
  const onAbort = () => finish(() => reject(abortError(signal)));
795
795
  signal.addEventListener("abort", onAbort, { once: true });
796
- promise.then((value) => finish(() => resolve2(value)), (error) => finish(() => reject(error)));
796
+ promise.then((value) => finish(() => resolve(value)), (error) => finish(() => reject(error)));
797
797
  });
798
798
  }
799
799
  function throwIfAborted(signal) {
@@ -822,18 +822,18 @@ function parsePingResponse(message) {
822
822
  return null;
823
823
  if (!endpoint || typeof endpoint !== "object" || Array.isArray(endpoint))
824
824
  return null;
825
- const path2 = Reflect.get(endpoint, "path");
825
+ const path = Reflect.get(endpoint, "path");
826
826
  const kind = Reflect.get(endpoint, "kind");
827
- if (typeof path2 !== "string")
827
+ if (typeof path !== "string")
828
828
  return null;
829
829
  if (kind === "windows")
830
- return { pid, nonce, startedAt, endpoint: { kind, path: path2 } };
830
+ return { pid, nonce, startedAt, endpoint: { kind, path } };
831
831
  if (kind === "missing")
832
- return { pid, nonce, startedAt, endpoint: { kind, path: path2 } };
832
+ return { pid, nonce, startedAt, endpoint: { kind, path } };
833
833
  const dev = Reflect.get(endpoint, "dev");
834
834
  const ino = Reflect.get(endpoint, "ino");
835
835
  if (kind === "unix" && typeof dev === "number" && typeof ino === "number") {
836
- return { pid, nonce, startedAt, endpoint: { kind, path: path2, dev, ino } };
836
+ return { pid, nonce, startedAt, endpoint: { kind, path, dev, ino } };
837
837
  }
838
838
  return null;
839
839
  }
@@ -881,7 +881,7 @@ ${body}` : `${body}
881
881
  await writeChunk(output, payload);
882
882
  }
883
883
  function writeChunk(output, chunk) {
884
- return new Promise((resolve2, reject) => {
884
+ return new Promise((resolve, reject) => {
885
885
  let settled = false;
886
886
  const onError = (error) => {
887
887
  if (settled)
@@ -901,7 +901,7 @@ function writeChunk(output, chunk) {
901
901
  return;
902
902
  }
903
903
  output.removeListener("error", onError);
904
- resolve2();
904
+ resolve();
905
905
  });
906
906
  } catch (error) {
907
907
  output.removeListener("error", onError);
@@ -1010,6 +1010,7 @@ async function runJsonRpcStdioServer(config) {
1010
1010
  const idleTimer = createIdleTimer(idleTimeoutMs, log, () => {
1011
1011
  isClosed = true;
1012
1012
  config.onIdleTimeout?.();
1013
+ config.input.destroy();
1013
1014
  });
1014
1015
  const watchdog = createParentWatchdog(config.parentWatchdog, (parentPid, pollIntervalMs) => {
1015
1016
  isClosed = true;
@@ -1106,7 +1107,11 @@ function createParentWatchdog(config, onDeadParent) {
1106
1107
  const probeAlive = config.probeAlive ?? isProcessAlive;
1107
1108
  let fired = false;
1108
1109
  const timer = setInterval(() => {
1109
- if (fired || probeAlive(parentPid))
1110
+ if (fired)
1111
+ return;
1112
+ const alive = probeAlive(parentPid);
1113
+ config.onPoll?.(alive);
1114
+ if (alive)
1110
1115
  return;
1111
1116
  fired = true;
1112
1117
  onDeadParent(parentPid, pollIntervalMs);
@@ -1141,8 +1146,8 @@ function createIdleTimer(idleTimeoutMs, log, onTimeout) {
1141
1146
  };
1142
1147
  }
1143
1148
  // ../lsp-core/src/lsp/client-wrapper.ts
1144
- import { existsSync as existsSync10, realpathSync as realpathSync4, statSync as statSync4 } from "node:fs";
1145
- import { basename as basename3, dirname as dirname8, join as join4, resolve as resolve7 } from "node:path";
1149
+ import { existsSync as existsSync11, realpathSync as realpathSync5, statSync as statSync4 } from "node:fs";
1150
+ import { basename as basename3, dirname as dirname10, join as join5, resolve as resolve8 } from "node:path";
1146
1151
 
1147
1152
  // ../lsp-core/src/lsp/effective-extension.ts
1148
1153
  import { basename as basename2, extname } from "node:path";
@@ -1156,22 +1161,15 @@ function effectiveExtension(filePath) {
1156
1161
 
1157
1162
  // ../lsp-core/src/lsp/errors.ts
1158
1163
  class LspConnectionClosedError extends Error {
1159
- serverId;
1160
- root;
1161
- name = "LspConnectionClosedError";
1162
1164
  constructor(serverId, root, message) {
1163
1165
  super(message ?? `LSP connection closed for ${serverId} at ${root}`);
1164
1166
  this.serverId = serverId;
1165
1167
  this.root = root;
1168
+ this.name = "LspConnectionClosedError";
1166
1169
  }
1167
1170
  }
1168
1171
 
1169
1172
  class LspProcessExitedError extends Error {
1170
- serverId;
1171
- root;
1172
- exitCode;
1173
- stderrTail;
1174
- name = "LspProcessExitedError";
1175
1173
  constructor(serverId, root, exitCode, stderrTail) {
1176
1174
  const stderrSuffix = stderrTail ? `
1177
1175
  stderr tail: ${stderrTail}` : "";
@@ -1180,46 +1178,59 @@ stderr tail: ${stderrTail}` : "";
1180
1178
  this.root = root;
1181
1179
  this.exitCode = exitCode;
1182
1180
  this.stderrTail = stderrTail;
1181
+ this.name = "LspProcessExitedError";
1183
1182
  }
1184
1183
  }
1185
1184
 
1186
1185
  class LspRequestTimeoutError extends Error {
1187
- method;
1188
- stderrTail;
1189
- name = "LspRequestTimeoutError";
1190
1186
  constructor(method, stderrTail) {
1191
1187
  const stderrSuffix = stderrTail ? `
1192
1188
  recent stderr: ${stderrTail}` : "";
1193
1189
  super(`LSP request timeout (method: ${method})${stderrSuffix}`);
1194
1190
  this.method = method;
1195
1191
  this.stderrTail = stderrTail;
1192
+ this.name = "LspRequestTimeoutError";
1196
1193
  }
1197
1194
  }
1198
1195
 
1199
1196
  class LspInvalidPathError extends Error {
1200
- name = "LspInvalidPathError";
1197
+ constructor() {
1198
+ super(...arguments);
1199
+ this.name = "LspInvalidPathError";
1200
+ }
1201
1201
  }
1202
1202
 
1203
1203
  class LspServerLookupError extends Error {
1204
- lookup;
1205
- name = "LspServerLookupError";
1206
1204
  constructor(message, lookup) {
1207
1205
  super(message);
1208
1206
  this.lookup = lookup;
1207
+ this.name = "LspServerLookupError";
1209
1208
  }
1210
1209
  }
1211
1210
 
1212
1211
  class LspServerInitializingError extends Error {
1213
- originalError;
1214
- name = "LspServerInitializingError";
1215
1212
  constructor(originalError) {
1216
1213
  super(`LSP server is still initializing. Please retry in a few seconds. Original error: ${originalError.message}`);
1217
1214
  this.originalError = originalError;
1215
+ this.name = "LspServerInitializingError";
1218
1216
  }
1219
1217
  }
1220
1218
 
1221
1219
  class LspProcessSpawnError extends Error {
1222
- name = "LspProcessSpawnError";
1220
+ constructor() {
1221
+ super(...arguments);
1222
+ this.name = "LspProcessSpawnError";
1223
+ }
1224
+ }
1225
+
1226
+ class LspClientRespawnBudgetExceededError extends Error {
1227
+ constructor(serverId, root, retryLimit) {
1228
+ super(`LSP server ${serverId} at ${root} failed to stay alive; respawn budget exhausted ` + `(${retryLimit} consecutive dead generations). Retrying after the cooldown may succeed.`);
1229
+ this.serverId = serverId;
1230
+ this.root = root;
1231
+ this.retryLimit = retryLimit;
1232
+ this.name = "LspClientRespawnBudgetExceededError";
1233
+ }
1223
1234
  }
1224
1235
  function isLspDeadConnectionError(err) {
1225
1236
  return err instanceof LspConnectionClosedError || err instanceof LspProcessExitedError;
@@ -1242,6 +1253,13 @@ import { pathToFileURL as pathToFileURL3 } from "node:url";
1242
1253
  // ../lsp-core/src/lsp/connection.ts
1243
1254
  import { pathToFileURL } from "node:url";
1244
1255
 
1256
+ // ../lsp-core/src/lsp/timer-provider.ts
1257
+ var realTimerProvider = {
1258
+ now: () => Date.now(),
1259
+ setTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
1260
+ clearTimeout: (handle) => clearTimeout(handle)
1261
+ };
1262
+
1245
1263
  // ../lsp-core/src/lsp/constants.ts
1246
1264
  var DEFAULT_MAX_REFERENCES = 200;
1247
1265
  var DEFAULT_MAX_SYMBOLS = 200;
@@ -1250,9 +1268,12 @@ var DEFAULT_MAX_DIRECTORY_FILES = 50;
1250
1268
  var REQUEST_TIMEOUT_MS = 15000;
1251
1269
  var INIT_TIMEOUT_MS = 60000;
1252
1270
  var IDLE_TIMEOUT_MS = 5 * 60000;
1271
+ var MAX_RESIDENT_CLIENTS = 6;
1253
1272
  var REAPER_INTERVAL_MS = 60000;
1254
1273
  var STOP_HARD_KILL_TIMEOUT_MS = 5000;
1255
1274
  var STOP_SIGKILL_GRACE_MS = 1000;
1275
+ var CLIENT_RESPAWN_RETRY_LIMIT = 2;
1276
+ var CLIENT_RESPAWN_COOLDOWN_MS = 60000;
1256
1277
 
1257
1278
  // ../lsp-core/src/lsp/json-rpc-connection.ts
1258
1279
  var HEADER_SEPARATOR2 = `\r
@@ -1264,20 +1285,31 @@ var METHOD_NOT_FOUND = -32601;
1264
1285
  var INTERNAL_ERROR = -32603;
1265
1286
 
1266
1287
  class JsonRpcConnection {
1267
- reader;
1268
- writer;
1269
- pendingRequests = new Map;
1270
- notificationHandlers = new Map;
1271
- requestHandlers = new Map;
1272
- closeHandlers = [];
1273
- errorHandlers = [];
1274
- inputBuffer = Buffer.alloc(0);
1275
- nextRequestId = 1;
1276
- listening = false;
1277
- disposed = false;
1278
1288
  constructor(reader, writer) {
1279
1289
  this.reader = reader;
1280
1290
  this.writer = writer;
1291
+ this.pendingRequests = new Map;
1292
+ this.notificationHandlers = new Map;
1293
+ this.requestHandlers = new Map;
1294
+ this.closeHandlers = [];
1295
+ this.errorHandlers = [];
1296
+ this.inputBuffer = Buffer.alloc(0);
1297
+ this.nextRequestId = 1;
1298
+ this.listening = false;
1299
+ this.disposed = false;
1300
+ this.handleData = (chunk) => {
1301
+ const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
1302
+ this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
1303
+ this.drainInputBuffer();
1304
+ };
1305
+ this.handleClose = () => {
1306
+ for (const handler of this.closeHandlers) {
1307
+ handler();
1308
+ }
1309
+ };
1310
+ this.handleStreamError = (error) => {
1311
+ this.emitError(error);
1312
+ };
1281
1313
  }
1282
1314
  listen() {
1283
1315
  if (this.listening)
@@ -1312,7 +1344,8 @@ class JsonRpcConnection {
1312
1344
  let cancelAfterWrite = false;
1313
1345
  let settled = false;
1314
1346
  const writeCancel = () => this.writeMessage({ jsonrpc: "2.0", method: "$/cancelRequest", params: { id } });
1315
- const responsePromise = new Promise((resolve2, reject) => {
1347
+ let rejectAfterCancelWrite;
1348
+ const responsePromise = new Promise((resolve, reject) => {
1316
1349
  const cleanup = () => {
1317
1350
  options.signal?.removeEventListener("abort", onAbort);
1318
1351
  };
@@ -1323,22 +1356,26 @@ class JsonRpcConnection {
1323
1356
  this.pendingRequests.delete(key);
1324
1357
  cleanup();
1325
1358
  const rejectCancelled = () => reject(abortError2(options.signal));
1359
+ rejectAfterCancelWrite = async () => {
1360
+ try {
1361
+ await writeCancel();
1362
+ } catch (error) {
1363
+ this.emitError(toError(error));
1364
+ }
1365
+ rejectCancelled();
1366
+ };
1326
1367
  if (!requestWritten) {
1327
1368
  cancelAfterWrite = true;
1328
- rejectCancelled();
1329
1369
  return;
1330
1370
  }
1331
- writeCancel().then(rejectCancelled, (error) => {
1332
- this.emitError(toError(error));
1333
- rejectCancelled();
1334
- });
1371
+ rejectAfterCancelWrite();
1335
1372
  };
1336
1373
  const onAbort = () => settleCancel();
1337
1374
  this.pendingRequests.set(key, {
1338
1375
  resolve(result) {
1339
1376
  settled = true;
1340
1377
  cleanup();
1341
- resolve2(result);
1378
+ resolve(result);
1342
1379
  },
1343
1380
  reject(error) {
1344
1381
  settled = true;
@@ -1359,7 +1396,7 @@ class JsonRpcConnection {
1359
1396
  await this.writeMessage(message);
1360
1397
  requestWritten = true;
1361
1398
  if (cancelAfterWrite)
1362
- await writeCancel();
1399
+ await rejectAfterCancelWrite?.();
1363
1400
  } catch (error) {
1364
1401
  if (settled)
1365
1402
  return responsePromise;
@@ -1398,19 +1435,6 @@ class JsonRpcConnection {
1398
1435
  this.notificationHandlers.clear();
1399
1436
  this.requestHandlers.clear();
1400
1437
  }
1401
- handleData = (chunk) => {
1402
- const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
1403
- this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
1404
- this.drainInputBuffer();
1405
- };
1406
- handleClose = () => {
1407
- for (const handler of this.closeHandlers) {
1408
- handler();
1409
- }
1410
- };
1411
- handleStreamError = (error) => {
1412
- this.emitError(error);
1413
- };
1414
1438
  drainInputBuffer() {
1415
1439
  while (true) {
1416
1440
  const headerEnd = this.inputBuffer.indexOf(HEADER_SEPARATOR2);
@@ -1510,13 +1534,13 @@ class JsonRpcConnection {
1510
1534
  const payload = `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
1511
1535
  \r
1512
1536
  ${body}`;
1513
- return new Promise((resolve2, reject) => {
1537
+ return new Promise((resolve, reject) => {
1514
1538
  this.writer.write(payload, (error) => {
1515
1539
  if (error) {
1516
1540
  reject(error);
1517
1541
  return;
1518
1542
  }
1519
- resolve2();
1543
+ resolve();
1520
1544
  });
1521
1545
  });
1522
1546
  }
@@ -1603,9 +1627,9 @@ function validateCwd(cwd) {
1603
1627
  }
1604
1628
  }
1605
1629
  function wrap(proc) {
1606
- const exitedPromise = new Promise((resolve2) => {
1607
- proc.once("close", (code) => resolve2(code ?? 0));
1608
- proc.once("error", () => resolve2(1));
1630
+ const exitedPromise = new Promise((resolve) => {
1631
+ proc.once("close", (code) => resolve(code ?? 0));
1632
+ proc.once("error", () => resolve(1));
1609
1633
  });
1610
1634
  if (!proc.stdin || !proc.stdout || !proc.stderr) {
1611
1635
  throw new LspProcessSpawnError("Spawned process is missing one of stdin/stdout/stderr pipes");
@@ -1758,33 +1782,29 @@ function isPosition(value) {
1758
1782
 
1759
1783
  // ../lsp-core/src/lsp/transport.ts
1760
1784
  class LspClientNotStartedError extends Error {
1761
- serverId;
1762
- root;
1763
- name = "LspClientNotStartedError";
1764
1785
  constructor(serverId, root) {
1765
1786
  super("LSP client not started");
1766
1787
  this.serverId = serverId;
1767
1788
  this.root = root;
1789
+ this.name = "LspClientNotStartedError";
1768
1790
  }
1769
1791
  }
1770
1792
 
1771
1793
  class LspClientTransport {
1772
- root;
1773
- server;
1774
- proc = null;
1775
- connection = null;
1776
- stderrBuffer = [];
1777
- processExited = false;
1778
- diagnosticsStore = new Map;
1779
- requestTimeoutMs;
1780
- initializeTimeoutMs;
1781
- workspaceApplyEditHandler = null;
1782
- diagnosticPullSupported = false;
1783
- constructor(root, server2, timeouts = {}) {
1794
+ constructor(root, server, timeouts = {}) {
1784
1795
  this.root = root;
1785
- this.server = server2;
1796
+ this.server = server;
1797
+ this.proc = null;
1798
+ this.connection = null;
1799
+ this.stderrBuffer = [];
1800
+ this.processExited = false;
1801
+ this.diagnosticsStore = new Map;
1802
+ this.workspaceApplyEditHandler = null;
1803
+ this.diagnosticPullSupported = false;
1804
+ this.documentFormattingSupported = false;
1786
1805
  this.requestTimeoutMs = timeouts.requestTimeoutMs ?? REQUEST_TIMEOUT_MS;
1787
1806
  this.initializeTimeoutMs = timeouts.initializeTimeoutMs ?? INIT_TIMEOUT_MS;
1807
+ this.timerProvider = timeouts.timerProvider ?? realTimerProvider;
1788
1808
  }
1789
1809
  pid() {
1790
1810
  return this.proc?.pid;
@@ -1804,6 +1824,12 @@ class LspClientTransport {
1804
1824
  isDiagnosticPullSupported() {
1805
1825
  return this.diagnosticPullSupported;
1806
1826
  }
1827
+ setDocumentFormattingSupported(supported) {
1828
+ this.documentFormattingSupported = supported;
1829
+ }
1830
+ isDocumentFormattingSupported() {
1831
+ return this.documentFormattingSupported;
1832
+ }
1807
1833
  handlePublishDiagnostics(params) {
1808
1834
  this.diagnosticsStore.set(params.uri, [...params.diagnostics]);
1809
1835
  }
@@ -1879,7 +1905,7 @@ class LspClientTransport {
1879
1905
  const options = args[1];
1880
1906
  const timeoutMs = options?.timeoutMs ?? this.requestTimeoutMs;
1881
1907
  const timeoutController = new AbortController;
1882
- const timeoutHandle = setTimeout(() => {
1908
+ const timeoutHandle = this.timerProvider.setTimeout(() => {
1883
1909
  const stderrTail = this.stderrBuffer.slice(-5).join(`
1884
1910
  `);
1885
1911
  timeoutController.abort(new LspRequestTimeoutError(method, stderrTail || undefined));
@@ -1898,7 +1924,7 @@ class LspClientTransport {
1898
1924
  }
1899
1925
  throw error;
1900
1926
  } finally {
1901
- clearTimeout(timeoutHandle);
1927
+ this.timerProvider.clearTimeout(timeoutHandle);
1902
1928
  combinedSignal.dispose();
1903
1929
  }
1904
1930
  }
@@ -1949,8 +1975,8 @@ class LspClientTransport {
1949
1975
  try {
1950
1976
  proc.kill();
1951
1977
  let timeoutId;
1952
- const timeoutPromise = new Promise((resolve2) => {
1953
- timeoutId = setTimeout(resolve2, STOP_HARD_KILL_TIMEOUT_MS);
1978
+ const timeoutPromise = new Promise((resolve) => {
1979
+ timeoutId = setTimeout(resolve, STOP_HARD_KILL_TIMEOUT_MS);
1954
1980
  });
1955
1981
  await Promise.race([
1956
1982
  proc.exited.then(() => {
@@ -1966,7 +1992,7 @@ class LspClientTransport {
1966
1992
  proc.kill("SIGKILL");
1967
1993
  await Promise.race([
1968
1994
  proc.exited,
1969
- new Promise((resolve2) => setTimeout(resolve2, STOP_SIGKILL_GRACE_MS))
1995
+ new Promise((resolve) => setTimeout(resolve, STOP_SIGKILL_GRACE_MS))
1970
1996
  ]);
1971
1997
  } catch (error) {
1972
1998
  reportBestEffortCleanupError("hard process kill", error instanceof Error ? error : String(error));
@@ -2017,6 +2043,14 @@ function supportsDiagnosticPull(capabilities) {
2017
2043
  return false;
2018
2044
  return Object.hasOwn(capabilities, "diagnosticProvider");
2019
2045
  }
2046
+ function supportsDocumentFormatting(capabilities) {
2047
+ if (capabilities === undefined)
2048
+ return false;
2049
+ const provider = capabilities.documentFormattingProvider;
2050
+ if (provider === undefined || provider === null || provider === false)
2051
+ return false;
2052
+ return provider === true || typeof provider === "object";
2053
+ }
2020
2054
 
2021
2055
  class LspClientConnection extends LspClientTransport {
2022
2056
  async initialize() {
@@ -2033,6 +2067,7 @@ class LspClientConnection extends LspClientTransport {
2033
2067
  references: {},
2034
2068
  documentSymbol: { hierarchicalDocumentSymbolSupport: true },
2035
2069
  publishDiagnostics: {},
2070
+ formatting: { dynamicRegistration: false },
2036
2071
  rename: {
2037
2072
  prepareSupport: true,
2038
2073
  prepareSupportDefaultBehavior: 1
@@ -2074,6 +2109,7 @@ class LspClientConnection extends LspClientTransport {
2074
2109
  initializationOptions: this.server.initialization
2075
2110
  }, { timeoutMs: this.initializeTimeoutMs });
2076
2111
  this.setDiagnosticPullSupported(supportsDiagnosticPull(result?.capabilities));
2112
+ this.setDocumentFormattingSupported(supportsDocumentFormatting(result?.capabilities));
2077
2113
  await this.sendNotification("initialized", {});
2078
2114
  await this.sendNotification("workspace/didChangeConfiguration", {
2079
2115
  settings: { json: { validate: { enable: true } } }
@@ -2269,6 +2305,17 @@ function canonicalPath(filePath) {
2269
2305
  return absolute;
2270
2306
  }
2271
2307
  }
2308
+ function normalizeDocumentUri(uri) {
2309
+ let decoded = uri;
2310
+ try {
2311
+ decoded = decodeURIComponent(uri);
2312
+ } catch {
2313
+ decoded = uri;
2314
+ }
2315
+ if (process.platform !== "win32")
2316
+ return decoded;
2317
+ return decoded.replace(/^(file:\/\/\/)([a-z]):/, (_match, prefix, drive) => `${prefix}${drive.toUpperCase()}:`);
2318
+ }
2272
2319
  function isSameOrDescendant(candidate, parent) {
2273
2320
  const suffix = relative2(parent, candidate);
2274
2321
  return suffix === "" || !suffix.startsWith("..") && suffix !== "..";
@@ -2279,30 +2326,31 @@ function movedPath(candidate, oldPath, newPath) {
2279
2326
  }
2280
2327
 
2281
2328
  class WorkspaceDocumentState {
2282
- sendNotification;
2283
- clearDiagnostics;
2284
- openDocuments = new Map;
2285
- openByUri = new Map;
2286
- openPromises = new Map;
2287
- now;
2288
- versionlessPublishQuiescenceMs;
2289
2329
  constructor(sendNotification, clearDiagnostics, options = {}) {
2290
2330
  this.sendNotification = sendNotification;
2291
2331
  this.clearDiagnostics = clearDiagnostics;
2292
- this.now = options.now ?? (() => Date.now());
2332
+ this.openDocuments = new Map;
2333
+ this.openByUri = new Map;
2334
+ this.openPromises = new Map;
2335
+ this.timerProvider = options.timerProvider ?? {
2336
+ now: options.now ?? (() => Date.now()),
2337
+ setTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
2338
+ clearTimeout: (handle) => clearTimeout(handle)
2339
+ };
2340
+ this.now = () => this.timerProvider.now();
2293
2341
  this.versionlessPublishQuiescenceMs = options.versionlessPublishQuiescenceMs ?? DEFAULT_VERSIONLESS_PUBLISH_QUIESCENCE_MS;
2294
2342
  }
2295
2343
  async openFile(filePath) {
2296
- const path2 = canonicalPath(filePath);
2297
- const existingOpen = this.openPromises.get(path2);
2344
+ const path = canonicalPath(filePath);
2345
+ const existingOpen = this.openPromises.get(path);
2298
2346
  if (existingOpen) {
2299
2347
  await existingOpen;
2300
- return this.openFile(path2);
2348
+ return this.openFile(path);
2301
2349
  }
2302
- const text = readFileSync2(path2, "utf-8");
2303
- const existing = this.openDocuments.get(path2);
2350
+ const text = readFileSync2(path, "utf-8");
2351
+ const existing = this.openDocuments.get(path);
2304
2352
  if (!existing)
2305
- return this.openDocumentSingleFlight(path2, text);
2353
+ return this.openDocumentSingleFlight(path, text);
2306
2354
  if (existing.text === text)
2307
2355
  return;
2308
2356
  await this.changeDocument(existing, text);
@@ -2311,7 +2359,7 @@ class WorkspaceDocumentState {
2311
2359
  return this.openDocuments.get(canonicalPath(filePath))?.version;
2312
2360
  }
2313
2361
  getStoredDiagnostics(uri) {
2314
- const state = this.openByUri.get(uri);
2362
+ const state = this.openByUri.get(normalizeDocumentUri(uri));
2315
2363
  if (!state)
2316
2364
  return [];
2317
2365
  return state.lastPublish?.diagnostics ?? state.pullCache?.diagnostics ?? [];
@@ -2333,13 +2381,13 @@ class WorkspaceDocumentState {
2333
2381
  return state !== undefined && state.uri === snapshot.uri && state.version === snapshot.version && state.generation === snapshot.documentGeneration;
2334
2382
  }
2335
2383
  getPullCache(snapshot) {
2336
- const state = this.openByUri.get(snapshot.uri);
2384
+ const state = this.openByUri.get(normalizeDocumentUri(snapshot.uri));
2337
2385
  if (!state?.pullCache || state.pullCache.documentVersion !== snapshot.version)
2338
2386
  return null;
2339
2387
  return state.pullCache;
2340
2388
  }
2341
2389
  recordPullDiagnostics(snapshot, report) {
2342
- const state = this.openByUri.get(snapshot.uri);
2390
+ const state = this.openByUri.get(normalizeDocumentUri(snapshot.uri));
2343
2391
  if (!state)
2344
2392
  return;
2345
2393
  state.pullCache = {
@@ -2349,7 +2397,7 @@ class WorkspaceDocumentState {
2349
2397
  };
2350
2398
  }
2351
2399
  recordPublishedDiagnostics(params) {
2352
- const state = this.openByUri.get(params.uri);
2400
+ const state = this.openByUri.get(normalizeDocumentUri(params.uri));
2353
2401
  if (!state)
2354
2402
  return;
2355
2403
  state.publishGeneration += 1;
@@ -2363,7 +2411,7 @@ class WorkspaceDocumentState {
2363
2411
  this.notifyWaiters(state);
2364
2412
  }
2365
2413
  resolvePushDiagnostics(snapshot) {
2366
- const state = this.openByUri.get(snapshot.uri);
2414
+ const state = this.openByUri.get(normalizeDocumentUri(snapshot.uri));
2367
2415
  if (!state?.lastPublish)
2368
2416
  return { status: "missing" };
2369
2417
  const publish = state.lastPublish;
@@ -2377,27 +2425,29 @@ class WorkspaceDocumentState {
2377
2425
  return waitMs === 0 ? { status: "ready", diagnostics: publish.diagnostics } : { status: "wait", waitMs };
2378
2426
  }
2379
2427
  waitForDiagnosticsActivity(snapshot, timeoutMs) {
2380
- const state = this.openByUri.get(snapshot.uri);
2428
+ const state = this.openByUri.get(normalizeDocumentUri(snapshot.uri));
2381
2429
  if (!state || timeoutMs <= 0)
2382
2430
  return Promise.resolve();
2431
+ if (state.publishGeneration !== snapshot.publishGeneration)
2432
+ return Promise.resolve();
2383
2433
  return new Promise((resolveActivity) => {
2384
2434
  let settled = false;
2385
2435
  const finish = () => {
2386
2436
  if (settled)
2387
2437
  return;
2388
2438
  settled = true;
2389
- clearTimeout(timer);
2439
+ this.timerProvider.clearTimeout(timer);
2390
2440
  state.waiters.delete(finish);
2391
2441
  resolveActivity();
2392
2442
  };
2393
- const timer = setTimeout(finish, timeoutMs);
2443
+ const timer = this.timerProvider.setTimeout(finish, timeoutMs);
2394
2444
  if (typeof timer.unref === "function")
2395
2445
  timer.unref();
2396
2446
  state.waiters.add(finish);
2397
2447
  });
2398
2448
  }
2399
2449
  validateVersions(operations) {
2400
- const versions = new Map([...this.openDocuments].map(([path2, state]) => [path2, state.version]));
2450
+ const versions = new Map([...this.openDocuments].map(([path, state]) => [path, state.version]));
2401
2451
  for (const operation of operations) {
2402
2452
  if (operation.kind === "text") {
2403
2453
  const current = versions.get(operation.path);
@@ -2413,17 +2463,17 @@ class WorkspaceDocumentState {
2413
2463
  continue;
2414
2464
  }
2415
2465
  if (operation.kind === "rename") {
2416
- const moved = [...versions].filter(([path2]) => isSameOrDescendant(path2, operation.oldPath));
2417
- for (const [path2] of moved)
2418
- versions.delete(path2);
2419
- for (const [path2] of moved)
2420
- versions.set(movedPath(path2, operation.oldPath, operation.newPath), 1);
2466
+ const moved = [...versions].filter(([path]) => isSameOrDescendant(path, operation.oldPath));
2467
+ for (const [path] of moved)
2468
+ versions.delete(path);
2469
+ for (const [path] of moved)
2470
+ versions.set(movedPath(path, operation.oldPath, operation.newPath), 1);
2421
2471
  continue;
2422
2472
  }
2423
2473
  if (operation.kind === "delete") {
2424
- for (const path2 of [...versions.keys()]) {
2425
- if (isSameOrDescendant(path2, operation.path))
2426
- versions.delete(path2);
2474
+ for (const path of [...versions.keys()]) {
2475
+ if (isSameOrDescendant(path, operation.path))
2476
+ versions.delete(path);
2427
2477
  }
2428
2478
  continue;
2429
2479
  }
@@ -2467,8 +2517,8 @@ class WorkspaceDocumentState {
2467
2517
  for (const state of moved)
2468
2518
  await this.closeDocument(state);
2469
2519
  for (const state of moved) {
2470
- const path2 = movedPath(state.path, mutation.oldPath, mutation.newPath);
2471
- await this.openDocumentSingleFlight(path2, readFileSync2(path2, "utf-8"));
2520
+ const path = movedPath(state.path, mutation.oldPath, mutation.newPath);
2521
+ await this.openDocumentSingleFlight(path, readFileSync2(path, "utf-8"));
2472
2522
  }
2473
2523
  if (moved.length === 0) {
2474
2524
  watched.push({ uri: pathToFileURL2(mutation.oldPath).href, type: 3 });
@@ -2482,31 +2532,31 @@ class WorkspaceDocumentState {
2482
2532
  if (removed.length === 0)
2483
2533
  watched.push({ uri: pathToFileURL2(mutation.path).href, type: 3 });
2484
2534
  }
2485
- async openDocumentSingleFlight(path2, text) {
2486
- const existing = this.openPromises.get(path2);
2535
+ async openDocumentSingleFlight(path, text) {
2536
+ const existing = this.openPromises.get(path);
2487
2537
  if (existing)
2488
2538
  return existing;
2489
2539
  const open = (async () => {
2490
2540
  const state = {
2491
- path: path2,
2492
- uri: pathToFileURL2(path2).href,
2493
- languageId: getLanguageId(effectiveExtension(path2)),
2541
+ path,
2542
+ uri: pathToFileURL2(path).href,
2543
+ languageId: getLanguageId(effectiveExtension(path)),
2494
2544
  text,
2495
2545
  version: 1,
2496
2546
  generation: 1,
2497
2547
  publishGeneration: 0,
2498
2548
  waiters: new Set
2499
2549
  };
2500
- this.openDocuments.set(path2, state);
2501
- this.openByUri.set(state.uri, state);
2550
+ this.openDocuments.set(path, state);
2551
+ this.openByUri.set(normalizeDocumentUri(state.uri), state);
2502
2552
  this.notifyWaiters(state);
2503
2553
  await this.sendNotification("textDocument/didOpen", {
2504
2554
  textDocument: { uri: state.uri, languageId: state.languageId, version: state.version, text }
2505
2555
  });
2506
2556
  })().finally(() => {
2507
- this.openPromises.delete(path2);
2557
+ this.openPromises.delete(path);
2508
2558
  });
2509
- this.openPromises.set(path2, open);
2559
+ this.openPromises.set(path, open);
2510
2560
  return open;
2511
2561
  }
2512
2562
  async changeDocument(state, text) {
@@ -2523,7 +2573,7 @@ class WorkspaceDocumentState {
2523
2573
  }
2524
2574
  async closeDocument(state) {
2525
2575
  this.openDocuments.delete(state.path);
2526
- this.openByUri.delete(state.uri);
2576
+ this.openByUri.delete(normalizeDocumentUri(state.uri));
2527
2577
  this.clearDiagnostics(state.uri);
2528
2578
  this.notifyWaiters(state);
2529
2579
  await this.sendNotification("textDocument/didClose", { textDocument: { uri: state.uri } });
@@ -2552,13 +2602,11 @@ import { dirname as dirname4, isAbsolute as isAbsolute4, relative as relative3,
2552
2602
  import { fileURLToPath as fileURLToPath2 } from "node:url";
2553
2603
 
2554
2604
  class WorkspaceEditPathError extends Error {
2555
- path;
2556
- detail;
2557
- name = "WorkspaceEditPathError";
2558
- constructor(path2, detail) {
2559
- super(`${detail}: ${path2}`);
2560
- this.path = path2;
2605
+ constructor(path, detail) {
2606
+ super(`${detail}: ${path}`);
2607
+ this.path = path;
2561
2608
  this.detail = detail;
2609
+ this.name = "WorkspaceEditPathError";
2562
2610
  }
2563
2611
  }
2564
2612
  function isPathInsideWorkspace(filePath, workspaceRoot) {
@@ -2620,28 +2668,28 @@ function uriToCanonicalWorkspacePath(uri, workspaceRoot) {
2620
2668
  return { success: false, error: `${requestedPath}: ${detail}` };
2621
2669
  }
2622
2670
  }
2623
- function snapshotPath(path2, includeChildren) {
2624
- if (!existsSync4(path2))
2671
+ function snapshotPath(path, includeChildren) {
2672
+ if (!existsSync4(path))
2625
2673
  return { kind: "missing" };
2626
- const stats = lstatSync2(path2);
2674
+ const stats = lstatSync2(path);
2627
2675
  if (stats.isFile())
2628
- return { kind: "file", content: readFileSync3(path2, "utf-8") };
2676
+ return { kind: "file", content: readFileSync3(path, "utf-8") };
2629
2677
  if (stats.isDirectory()) {
2630
- return includeChildren ? { kind: "directory", children: readdirSync(path2).sort() } : { kind: "directory" };
2678
+ return includeChildren ? { kind: "directory", children: readdirSync(path).sort() } : { kind: "directory" };
2631
2679
  }
2632
- throw new WorkspaceEditPathError(path2, "unsupported filesystem entry");
2680
+ throw new WorkspaceEditPathError(path, "unsupported filesystem entry");
2633
2681
  }
2634
2682
 
2635
2683
  // ../lsp-core/src/lsp/workspace-edit-commit.ts
2636
2684
  var DEFAULT_IO = {
2637
- writeFile(path2, content) {
2638
- writeFileSync(path2, content, "utf-8");
2685
+ writeFile(path, content) {
2686
+ writeFileSync(path, content, "utf-8");
2639
2687
  },
2640
2688
  rename(oldPath, newPath) {
2641
2689
  renameSync(oldPath, newPath);
2642
2690
  },
2643
- remove(path2, recursive) {
2644
- rmSync(path2, { recursive, force: false });
2691
+ remove(path, recursive) {
2692
+ rmSync(path, { recursive, force: false });
2645
2693
  }
2646
2694
  };
2647
2695
  function snapshotsEqual(expected, actual) {
@@ -2654,8 +2702,8 @@ function snapshotsEqual(expected, actual) {
2654
2702
  }
2655
2703
  return true;
2656
2704
  }
2657
- function liveSnapshot(path2, expected) {
2658
- return snapshotPath(path2, expected.kind === "directory" && expected.children !== undefined);
2705
+ function liveSnapshot(path, expected) {
2706
+ return snapshotPath(path, expected.kind === "directory" && expected.children !== undefined);
2659
2707
  }
2660
2708
  function firstOperationIndex(plan) {
2661
2709
  return plan.operations[0]?.changeIndex ?? 0;
@@ -2676,28 +2724,28 @@ function failedCommit(plan, failure) {
2676
2724
  };
2677
2725
  }
2678
2726
  function verifySnapshots(plan) {
2679
- for (const [path2, expected] of plan.snapshots) {
2727
+ for (const [path, expected] of plan.snapshots) {
2680
2728
  let actual;
2681
2729
  try {
2682
- actual = liveSnapshot(path2, expected);
2730
+ actual = liveSnapshot(path, expected);
2683
2731
  } catch (error) {
2684
- const changeIndex = plan.firstChangeByPath.get(path2) ?? firstOperationIndex(plan);
2732
+ const changeIndex = plan.firstChangeByPath.get(path) ?? firstOperationIndex(plan);
2685
2733
  const detail = error instanceof Error ? error.message : String(error);
2686
- return failedCommit(plan, { message: `cannot verify snapshot for ${path2}: ${detail}`, changeIndex });
2734
+ return failedCommit(plan, { message: `cannot verify snapshot for ${path}: ${detail}`, changeIndex });
2687
2735
  }
2688
2736
  if (!snapshotsEqual(expected, actual)) {
2689
- const changeIndex = plan.firstChangeByPath.get(path2) ?? firstOperationIndex(plan);
2690
- return failedCommit(plan, { message: `workspace state changed before commit: ${path2}`, changeIndex });
2737
+ const changeIndex = plan.firstChangeByPath.get(path) ?? firstOperationIndex(plan);
2738
+ return failedCommit(plan, { message: `workspace state changed before commit: ${path}`, changeIndex });
2691
2739
  }
2692
2740
  }
2693
2741
  return null;
2694
2742
  }
2695
- function addModifiedPath(paths, path2) {
2696
- if (!paths.includes(path2))
2697
- paths.push(path2);
2743
+ function addModifiedPath(paths, path) {
2744
+ if (!paths.includes(path))
2745
+ paths.push(path);
2698
2746
  }
2699
- function reportedPath(plan, path2) {
2700
- return plan.reportedPathByCanonical.get(path2) ?? path2;
2747
+ function reportedPath(plan, path) {
2748
+ return plan.reportedPathByCanonical.get(path) ?? path;
2701
2749
  }
2702
2750
  function changedPathsForMutation(mutation) {
2703
2751
  return mutation.kind === "rename" ? [mutation.oldPath, mutation.newPath] : [mutation.path];
@@ -2705,8 +2753,8 @@ function changedPathsForMutation(mutation) {
2705
2753
  function mutationDelta(operations) {
2706
2754
  const changedPaths = new Set;
2707
2755
  for (const operation of operations) {
2708
- for (const path2 of changedPathsForMutation(operation))
2709
- changedPaths.add(path2);
2756
+ for (const path of changedPathsForMutation(operation))
2757
+ changedPaths.add(path);
2710
2758
  }
2711
2759
  return { operations, changedPaths: [...changedPaths].sort() };
2712
2760
  }
@@ -2850,13 +2898,11 @@ function canonicalFingerprint(operations) {
2850
2898
 
2851
2899
  // ../lsp-core/src/lsp/workspace-edit-types.ts
2852
2900
  class WorkspaceEditValidationError extends Error {
2853
- changeIndex;
2854
- detail;
2855
- name = "WorkspaceEditValidationError";
2856
2901
  constructor(changeIndex, detail) {
2857
2902
  super(`change ${changeIndex}: ${detail}`);
2858
2903
  this.changeIndex = changeIndex;
2859
2904
  this.detail = detail;
2905
+ this.name = "WorkspaceEditValidationError";
2860
2906
  }
2861
2907
  }
2862
2908
 
@@ -2942,14 +2988,14 @@ function parseSinglePathResource(input, kind) {
2942
2988
  return;
2943
2989
  }
2944
2990
  if (kind === "create") {
2945
- const options2 = parseOptions(change["options"], ["overwrite", "ignoreIfExists"], changeIndex);
2991
+ const options = parseOptions(change["options"], ["overwrite", "ignoreIfExists"], changeIndex);
2946
2992
  target.operations.push({
2947
2993
  kind,
2948
2994
  changeIndex,
2949
2995
  path: resolvedPath.path,
2950
2996
  reportedPath: resolvedPath.requestedPath,
2951
- overwrite: options2["overwrite"] ?? false,
2952
- ignoreIfExists: options2["ignoreIfExists"] ?? false,
2997
+ overwrite: options["overwrite"] ?? false,
2998
+ ignoreIfExists: options["ignoreIfExists"] ?? false,
2953
2999
  followedSymbolicLink: resolvedPath.followedSymbolicLink
2954
3000
  });
2955
3001
  return;
@@ -3207,12 +3253,12 @@ function isSameOrDescendant2(candidate, parent) {
3207
3253
  const relativePath = relative4(parent, candidate);
3208
3254
  return relativePath === "" || !relativePath.startsWith("..") && relativePath !== "..";
3209
3255
  }
3210
- function removeVirtualSubtree(virtual, path2) {
3256
+ function removeVirtualSubtree(virtual, path) {
3211
3257
  for (const candidate of [...virtual.keys()]) {
3212
- if (isSameOrDescendant2(candidate, path2))
3258
+ if (isSameOrDescendant2(candidate, path))
3213
3259
  virtual.delete(candidate);
3214
3260
  }
3215
- virtual.set(path2, { kind: "missing" });
3261
+ virtual.set(path, { kind: "missing" });
3216
3262
  }
3217
3263
  function moveVirtualSubtree(virtual, oldPath, newPath) {
3218
3264
  const moved = [...virtual.entries()].filter(([candidate]) => isSameOrDescendant2(candidate, oldPath));
@@ -3223,16 +3269,16 @@ function moveVirtualSubtree(virtual, oldPath, newPath) {
3223
3269
  virtual.set(suffix === "" ? newPath : resolve4(newPath, suffix), entry);
3224
3270
  }
3225
3271
  }
3226
- function virtualDirectoryHasChildren(virtual, path2) {
3272
+ function virtualDirectoryHasChildren(virtual, path) {
3227
3273
  for (const [candidate, entry] of virtual) {
3228
- if (candidate !== path2 && entry.kind !== "missing" && isSameOrDescendant2(candidate, path2))
3274
+ if (candidate !== path && entry.kind !== "missing" && isSameOrDescendant2(candidate, path))
3229
3275
  return true;
3230
3276
  }
3231
3277
  return false;
3232
3278
  }
3233
- function requireVirtualParent(virtual, path2, changeIndex) {
3234
- if (virtual.get(dirname5(path2))?.kind !== "directory") {
3235
- throw new WorkspaceEditValidationError(changeIndex, `parent directory does not exist for ${path2}`);
3279
+ function requireVirtualParent(virtual, path, changeIndex) {
3280
+ if (virtual.get(dirname5(path))?.kind !== "directory") {
3281
+ throw new WorkspaceEditValidationError(changeIndex, `parent directory does not exist for ${path}`);
3236
3282
  }
3237
3283
  }
3238
3284
  function simulateOperations(parsed, snapshots) {
@@ -3354,10 +3400,9 @@ function simulateDelete(operation, virtual) {
3354
3400
  import { existsSync as existsSync6, lstatSync as lstatSync4, readdirSync as readdirSync2 } from "node:fs";
3355
3401
  import { dirname as dirname6, resolve as resolve5 } from "node:path";
3356
3402
  class WorkspaceSnapshotBuilder {
3357
- workspaceRoot;
3358
- snapshots = new Map;
3359
3403
  constructor(workspaceRoot) {
3360
3404
  this.workspaceRoot = workspaceRoot;
3405
+ this.snapshots = new Map;
3361
3406
  }
3362
3407
  build(operations) {
3363
3408
  this.add(this.workspaceRoot, false);
@@ -3378,21 +3423,21 @@ class WorkspaceSnapshotBuilder {
3378
3423
  }
3379
3424
  return this.snapshots;
3380
3425
  }
3381
- add(path2, includeChildren) {
3382
- let candidate = path2;
3426
+ add(path, includeChildren) {
3427
+ let candidate = path;
3383
3428
  while (true) {
3384
3429
  const existing = this.snapshots.get(candidate);
3385
3430
  if (existing === undefined || includeChildren && existing.kind === "directory" && existing.children === undefined) {
3386
- this.snapshots.set(candidate, snapshotPath(candidate, includeChildren && candidate === path2));
3431
+ this.snapshots.set(candidate, snapshotPath(candidate, includeChildren && candidate === path));
3387
3432
  }
3388
3433
  if (candidate === this.workspaceRoot)
3389
3434
  break;
3390
3435
  candidate = dirname6(candidate);
3391
3436
  }
3392
- if (!includeChildren || !existsSync6(path2) || !lstatSync4(path2).isDirectory())
3437
+ if (!includeChildren || !existsSync6(path) || !lstatSync4(path).isDirectory())
3393
3438
  return;
3394
- for (const child of readdirSync2(path2))
3395
- this.add(resolve5(path2, child), true);
3439
+ for (const child of readdirSync2(path))
3440
+ this.add(resolve5(path, child), true);
3396
3441
  }
3397
3442
  }
3398
3443
  function snapshotOperations(operations, workspaceRoot) {
@@ -3401,8 +3446,10 @@ function snapshotOperations(operations, workspaceRoot) {
3401
3446
 
3402
3447
  // ../lsp-core/src/lsp/workspace-edit-plan.ts
3403
3448
  class PlanPathIndex {
3404
- firstChangeByPath = new Map;
3405
- reportedPathByCanonical = new Map;
3449
+ constructor() {
3450
+ this.firstChangeByPath = new Map;
3451
+ this.reportedPathByCanonical = new Map;
3452
+ }
3406
3453
  build(operations) {
3407
3454
  for (const operation of operations) {
3408
3455
  switch (operation.kind) {
@@ -3418,11 +3465,11 @@ class PlanPathIndex {
3418
3465
  }
3419
3466
  }
3420
3467
  }
3421
- add(path2, reportedPath2, changeIndex) {
3422
- if (!this.firstChangeByPath.has(path2))
3423
- this.firstChangeByPath.set(path2, changeIndex);
3424
- if (!this.reportedPathByCanonical.has(path2))
3425
- this.reportedPathByCanonical.set(path2, reportedPath2);
3468
+ add(path, reportedPath, changeIndex) {
3469
+ if (!this.firstChangeByPath.has(path))
3470
+ this.firstChangeByPath.set(path, changeIndex);
3471
+ if (!this.reportedPathByCanonical.has(path))
3472
+ this.reportedPathByCanonical.set(path, reportedPath);
3426
3473
  }
3427
3474
  }
3428
3475
  function fingerprintWorkspaceEdit(edit, workspaceRoot) {
@@ -3491,14 +3538,11 @@ function isRecord4(value) {
3491
3538
  }
3492
3539
 
3493
3540
  class WorkspaceMutationController {
3494
- workspaceRoot;
3495
- documents;
3496
- activeLease = null;
3497
- nextLeaseId = 1;
3498
- io;
3499
3541
  constructor(workspaceRoot, documents) {
3500
3542
  this.workspaceRoot = workspaceRoot;
3501
3543
  this.documents = documents;
3544
+ this.activeLease = null;
3545
+ this.nextLeaseId = 1;
3502
3546
  }
3503
3547
  setIo(io) {
3504
3548
  this.io = io;
@@ -3537,15 +3581,15 @@ class WorkspaceMutationController {
3537
3581
  };
3538
3582
  }
3539
3583
  lease.phase = "applying";
3540
- lease.applyCompletion = new Promise((resolve6) => {
3541
- lease.resolveApply = resolve6;
3584
+ lease.applyCompletion = new Promise((resolve) => {
3585
+ lease.resolveApply = resolve;
3542
3586
  });
3543
3587
  const edit = isRecord4(params) ? params["edit"] : undefined;
3544
- const record2 = edit === undefined ? { fingerprint: null, result: failure("workspace/applyEdit params.edit is required", 0) } : await this.applyEdit(edit, lease);
3545
- lease.serverApply = record2;
3588
+ const record = edit === undefined ? { fingerprint: null, result: failure("workspace/applyEdit params.edit is required", 0) } : await this.applyEdit(edit, lease);
3589
+ lease.serverApply = record;
3546
3590
  lease.phase = "settled";
3547
3591
  lease.resolveApply?.();
3548
- return responseFor(record2.result);
3592
+ return responseFor(record.result);
3549
3593
  }
3550
3594
  async reconcileRename(leaseToken, edit) {
3551
3595
  const lease = this.requireActiveLease(leaseToken);
@@ -3561,16 +3605,16 @@ class WorkspaceMutationController {
3561
3605
  const applied = await this.applyEdit(edit, lease);
3562
3606
  return { edit, apply: applied.result };
3563
3607
  }
3564
- reconcileServerApply(record2, edit) {
3608
+ reconcileServerApply(record, edit) {
3565
3609
  if (!edit)
3566
- return { edit, apply: record2.result };
3610
+ return { edit, apply: record.result };
3567
3611
  const fingerprint = fingerprintWorkspaceEdit(edit, this.workspaceRoot);
3568
- if (fingerprint.success && record2.fingerprint !== null && fingerprint.fingerprint === record2.fingerprint) {
3569
- return { edit, apply: record2.result };
3612
+ if (fingerprint.success && record.fingerprint !== null && fingerprint.fingerprint === record.fingerprint) {
3613
+ return { edit, apply: record.result };
3570
3614
  }
3571
3615
  return {
3572
3616
  edit,
3573
- apply: failure("rename result conflicts with server-applied workspace edit", 0, record2.result)
3617
+ apply: failure("rename result conflicts with server-applied workspace edit", 0, record.result)
3574
3618
  };
3575
3619
  }
3576
3620
  async applyEdit(edit, lease) {
@@ -3611,14 +3655,12 @@ var DIAGNOSTICS_FRESHNESS_TIMEOUT_MS = 3000;
3611
3655
  var VERSIONLESS_PUBLISH_QUIESCENCE_MS = 250;
3612
3656
 
3613
3657
  class LspClient extends LspClientConnection {
3614
- diagnosticPullErrors = [];
3615
- documents;
3616
- workspaceMutations;
3617
- diagnosticsFreshnessTimeoutMs;
3618
- constructor(root, server2, options = {}) {
3619
- super(root, server2, options);
3658
+ constructor(root, server, options = {}) {
3659
+ super(root, server, options);
3660
+ this.diagnosticPullErrors = [];
3620
3661
  this.diagnosticsFreshnessTimeoutMs = options.diagnosticsFreshnessTimeoutMs ?? DIAGNOSTICS_FRESHNESS_TIMEOUT_MS;
3621
3662
  this.documents = new WorkspaceDocumentState((method, params) => this.sendNotification(method, params), (uri) => this.diagnosticsStore.delete(uri), {
3663
+ timerProvider: this.timerProvider,
3622
3664
  versionlessPublishQuiescenceMs: options.versionlessPublishQuiescenceMs ?? VERSIONLESS_PUBLISH_QUIESCENCE_MS
3623
3665
  });
3624
3666
  this.workspaceMutations = new WorkspaceMutationController(root, this.documents);
@@ -3671,6 +3713,18 @@ class LspClient extends LspClientConnection {
3671
3713
  textDocument: { uri: pathToFileURL3(absPath).href }
3672
3714
  }, options);
3673
3715
  }
3716
+ async formatDocument(filePath, options, signal) {
3717
+ if (!this.isDocumentFormattingSupported())
3718
+ return null;
3719
+ const absPath = this.resolveWorkspacePath(filePath);
3720
+ await this.openFile(absPath);
3721
+ const requestOptions = signal === undefined ? {} : { signal };
3722
+ const edits = await this.sendRequest("textDocument/formatting", {
3723
+ textDocument: { uri: pathToFileURL3(absPath).href },
3724
+ options
3725
+ }, requestOptions);
3726
+ return edits ?? [];
3727
+ }
3674
3728
  async workspaceSymbols(query, signal) {
3675
3729
  const options = signal === undefined ? {} : { signal };
3676
3730
  return this.sendRequest("workspace/symbol", { query }, options);
@@ -3710,7 +3764,7 @@ class LspClient extends LspClientConnection {
3710
3764
  const absPath = this.resolveWorkspacePath(filePath);
3711
3765
  const uri = pathToFileURL3(absPath).href;
3712
3766
  await this.openFile(absPath);
3713
- const deadlineAt = Date.now() + this.diagnosticsFreshnessTimeoutMs;
3767
+ const deadlineAt = this.timerProvider.now() + this.diagnosticsFreshnessTimeoutMs;
3714
3768
  for (;; ) {
3715
3769
  signal?.throwIfAborted();
3716
3770
  const snapshot = this.documents.captureDiagnosticSnapshot(absPath);
@@ -3723,13 +3777,13 @@ class LspClient extends LspClientConnection {
3723
3777
  if (!pushFallbackOnly) {
3724
3778
  const cached = this.documents.getPullCache(snapshot);
3725
3779
  try {
3726
- const remainingMs2 = deadlineAt - Date.now();
3727
- if (remainingMs2 <= 0)
3780
+ const remainingMs = deadlineAt - this.timerProvider.now();
3781
+ if (remainingMs <= 0)
3728
3782
  return this.freshnessTimeout(absPath);
3729
3783
  const result = await this.sendRequest("textDocument/diagnostic", {
3730
3784
  textDocument: { uri },
3731
3785
  ...cached?.resultId === undefined ? {} : { previousResultId: cached.resultId }
3732
- }, { timeoutMs: remainingMs2, ...signal === undefined ? {} : { signal } });
3786
+ }, { timeoutMs: remainingMs, ...signal === undefined ? {} : { signal } });
3733
3787
  if (!this.documents.isCurrentSnapshot(snapshot))
3734
3788
  continue;
3735
3789
  const report = this.parseDiagnosticPullReport(result);
@@ -3758,7 +3812,7 @@ class LspClient extends LspClientConnection {
3758
3812
  }
3759
3813
  if (!pushFallbackOnly)
3760
3814
  continue;
3761
- const remainingMs = deadlineAt - Date.now();
3815
+ const remainingMs = deadlineAt - this.timerProvider.now();
3762
3816
  if (remainingMs <= 0) {
3763
3817
  if (!this.isDiagnosticPullSupported() && snapshot.publishGeneration === 0) {
3764
3818
  const cached = this.documents.getPullCache(snapshot);
@@ -3810,7 +3864,7 @@ function waitForDiagnosticsActivity(wait, signal) {
3810
3864
  return wait;
3811
3865
  if (signal.aborted)
3812
3866
  return Promise.reject(abortError3(signal));
3813
- return new Promise((resolve7, reject) => {
3867
+ return new Promise((resolve, reject) => {
3814
3868
  const onAbort = () => {
3815
3869
  signal.removeEventListener("abort", onAbort);
3816
3870
  reject(abortError3(signal));
@@ -3818,7 +3872,7 @@ function waitForDiagnosticsActivity(wait, signal) {
3818
3872
  signal.addEventListener("abort", onAbort, { once: true });
3819
3873
  wait.then(() => {
3820
3874
  signal.removeEventListener("abort", onAbort);
3821
- resolve7();
3875
+ resolve();
3822
3876
  }, (error) => {
3823
3877
  signal.removeEventListener("abort", onAbort);
3824
3878
  reject(error);
@@ -3886,7 +3940,7 @@ async function stopClientBestEffort(client) {
3886
3940
  function awaitWithSignal2(promise, signal) {
3887
3941
  if (!signal)
3888
3942
  return promise;
3889
- return new Promise((resolve7, reject) => {
3943
+ return new Promise((resolve, reject) => {
3890
3944
  let settled = false;
3891
3945
  const onAbort = () => {
3892
3946
  if (settled)
@@ -3904,7 +3958,7 @@ function awaitWithSignal2(promise, signal) {
3904
3958
  return;
3905
3959
  settled = true;
3906
3960
  signal.removeEventListener("abort", onAbort);
3907
- resolve7(value);
3961
+ resolve(value);
3908
3962
  }, (err) => {
3909
3963
  if (settled)
3910
3964
  return;
@@ -3916,20 +3970,18 @@ function awaitWithSignal2(promise, signal) {
3916
3970
  }
3917
3971
 
3918
3972
  class LspManager {
3919
- clients = new Map;
3920
- reaperHandle = null;
3921
- signalDisposer = null;
3922
- disposed = false;
3923
- idleTimeoutMs;
3924
- initTimeoutMs;
3925
- reaperIntervalMs;
3926
- clientFactory;
3927
- now;
3928
3973
  constructor(options = {}) {
3974
+ this.clients = new Map;
3975
+ this.pendingStops = new Map;
3976
+ this.respawnBudgets = new Map;
3977
+ this.reaperHandle = null;
3978
+ this.signalDisposer = null;
3979
+ this.disposed = false;
3929
3980
  this.idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
3930
3981
  this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
3982
+ this.maxResidentClients = options.maxResidentClients ?? MAX_RESIDENT_CLIENTS;
3931
3983
  this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
3932
- this.clientFactory = options.clientFactory ?? ((root, server2) => new LspClient(root, server2));
3984
+ this.clientFactory = options.clientFactory ?? ((root, server) => new LspClient(root, server));
3933
3985
  this.now = options.now ?? (() => Date.now());
3934
3986
  this.startReaper();
3935
3987
  this.signalDisposer = installProcessSignalCleanup(() => this.stopAll());
@@ -3947,38 +3999,103 @@ class LspManager {
3947
3999
  getKey(root, serverId) {
3948
4000
  return `${root}::${serverId}`;
3949
4001
  }
4002
+ tombstoneStop(key, client) {
4003
+ const stop = stopClientBestEffort(client);
4004
+ this.pendingStops.set(key, stop);
4005
+ stop.finally(() => {
4006
+ if (this.pendingStops.get(key) === stop) {
4007
+ this.pendingStops.delete(key);
4008
+ }
4009
+ });
4010
+ return stop;
4011
+ }
4012
+ recordDeadGeneration(key) {
4013
+ let budget = this.respawnBudgets.get(key);
4014
+ if (budget === undefined) {
4015
+ budget = { deadGenerations: 0, exhaustedAt: null };
4016
+ this.respawnBudgets.set(key, budget);
4017
+ }
4018
+ budget.deadGenerations += 1;
4019
+ }
4020
+ markHealthyGeneration(key) {
4021
+ this.respawnBudgets.delete(key);
4022
+ }
4023
+ ensureRespawnAllowed(key, root, serverId) {
4024
+ const budget = this.respawnBudgets.get(key);
4025
+ if (budget === undefined || budget.deadGenerations < CLIENT_RESPAWN_RETRY_LIMIT)
4026
+ return;
4027
+ if (budget.exhaustedAt === null) {
4028
+ budget.exhaustedAt = this.now();
4029
+ throw new LspClientRespawnBudgetExceededError(serverId, root, CLIENT_RESPAWN_RETRY_LIMIT);
4030
+ }
4031
+ if (this.now() - budget.exhaustedAt < CLIENT_RESPAWN_COOLDOWN_MS) {
4032
+ throw new LspClientRespawnBudgetExceededError(serverId, root, CLIENT_RESPAWN_RETRY_LIMIT);
4033
+ }
4034
+ budget.deadGenerations = 0;
4035
+ budget.exhaustedAt = null;
4036
+ }
3950
4037
  reapStale() {
3951
4038
  const t = this.now();
3952
4039
  for (const [key, managed] of this.clients) {
3953
4040
  if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
3954
- stopClientBestEffort(managed.client);
3955
4041
  this.clients.delete(key);
4042
+ this.tombstoneStop(key, managed.client);
3956
4043
  continue;
3957
4044
  }
3958
4045
  if (!managed.isInitializing && managed.refCount === 0 && managed.pendingWaiters === 0 && t - managed.lastUsedAt > this.idleTimeoutMs) {
3959
- stopClientBestEffort(managed.client);
3960
4046
  this.clients.delete(key);
4047
+ this.tombstoneStop(key, managed.client);
3961
4048
  }
3962
4049
  }
3963
4050
  }
4051
+ evictForAdmission() {
4052
+ while (this.clients.size >= this.maxResidentClients) {
4053
+ const victim = this.leastRecentlyUsedIdleClient();
4054
+ if (!victim)
4055
+ return;
4056
+ this.clients.delete(victim.key);
4057
+ this.tombstoneStop(victim.key, victim.managed.client);
4058
+ }
4059
+ }
4060
+ leastRecentlyUsedIdleClient() {
4061
+ let candidate = null;
4062
+ for (const [key, managed] of this.clients) {
4063
+ if (managed.refCount > 0 || managed.pendingWaiters > 0 || managed.isInitializing)
4064
+ continue;
4065
+ if (candidate === null || managed.lastUsedAt < candidate.managed.lastUsedAt) {
4066
+ candidate = { key, managed };
4067
+ }
4068
+ }
4069
+ return candidate;
4070
+ }
3964
4071
  async tryDeleteIfOrphaned(key, managed) {
3965
4072
  if (managed.refCount === 0 && managed.pendingWaiters === 0 && !managed.isInitializing && this.clients.get(key) === managed) {
3966
4073
  this.clients.delete(key);
3967
- await stopClientBestEffort(managed.client);
4074
+ await this.tombstoneStop(key, managed.client);
3968
4075
  }
3969
4076
  }
3970
- async getClient(root, server2, signal) {
4077
+ async getClient(root, server, signal) {
3971
4078
  if (this.disposed) {
3972
4079
  throw new Error("LspManager has been disposed");
3973
4080
  }
3974
4081
  signal?.throwIfAborted();
3975
- const key = this.getKey(root, server2.id);
4082
+ const key = this.getKey(root, server.id);
4083
+ for (;; ) {
4084
+ const pendingStop = this.pendingStops.get(key);
4085
+ if (pendingStop === undefined)
4086
+ break;
4087
+ await awaitWithSignal2(pendingStop, signal);
4088
+ signal?.throwIfAborted();
4089
+ }
4090
+ if (this.disposed) {
4091
+ throw new Error("LspManager has been disposed");
4092
+ }
3976
4093
  let managed = this.clients.get(key);
3977
4094
  if (managed) {
3978
4095
  const t = this.now();
3979
4096
  if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
3980
- await stopClientBestEffort(managed.client);
3981
4097
  this.clients.delete(key);
4098
+ await this.tombstoneStop(key, managed.client);
3982
4099
  managed = undefined;
3983
4100
  }
3984
4101
  }
@@ -3999,15 +4116,21 @@ class LspManager {
3999
4116
  signal.throwIfAborted();
4000
4117
  }
4001
4118
  if (!managed.client.isAlive()) {
4002
- await stopClientBestEffort(managed.client);
4003
- this.clients.delete(key);
4004
- return this.getClient(root, server2, signal);
4119
+ this.recordDeadGeneration(key);
4120
+ if (this.clients.get(key) === managed) {
4121
+ this.clients.delete(key);
4122
+ }
4123
+ await this.tombstoneStop(key, managed.client);
4124
+ return this.getClient(root, server, signal);
4005
4125
  }
4126
+ this.markHealthyGeneration(key);
4006
4127
  managed.refCount++;
4007
4128
  managed.lastUsedAt = this.now();
4008
4129
  return managed.client;
4009
4130
  }
4010
- const client = this.clientFactory(root, server2);
4131
+ this.evictForAdmission();
4132
+ this.ensureRespawnAllowed(key, root, server.id);
4133
+ const client = this.clientFactory(root, server);
4011
4134
  const initStartedAt = this.now();
4012
4135
  const initPromise = (async () => {
4013
4136
  await client.start();
@@ -4030,7 +4153,7 @@ class LspManager {
4030
4153
  if (this.clients.get(key) === newManaged) {
4031
4154
  this.clients.delete(key);
4032
4155
  }
4033
- await stopClientBestEffort(client);
4156
+ await this.tombstoneStop(key, client);
4034
4157
  throw err;
4035
4158
  }
4036
4159
  newManaged.pendingWaiters--;
@@ -4041,6 +4164,15 @@ class LspManager {
4041
4164
  await this.tryDeleteIfOrphaned(key, newManaged);
4042
4165
  signal.throwIfAborted();
4043
4166
  }
4167
+ if (!client.isAlive()) {
4168
+ this.recordDeadGeneration(key);
4169
+ if (this.clients.get(key) === newManaged) {
4170
+ this.clients.delete(key);
4171
+ }
4172
+ await this.tombstoneStop(key, client);
4173
+ return this.getClient(root, server, signal);
4174
+ }
4175
+ this.markHealthyGeneration(key);
4044
4176
  newManaged.refCount++;
4045
4177
  newManaged.lastUsedAt = this.now();
4046
4178
  return client;
@@ -4061,15 +4193,21 @@ class LspManager {
4061
4193
  if (client && managed.client !== client)
4062
4194
  return;
4063
4195
  this.clients.delete(key);
4064
- stopClientBestEffort(managed.client);
4196
+ this.tombstoneStop(key, managed.client);
4065
4197
  }
4066
- warmupClient(root, server2) {
4198
+ warmupClient(root, server) {
4067
4199
  if (this.disposed)
4068
4200
  return;
4069
- const key = this.getKey(root, server2.id);
4070
- if (this.clients.has(key))
4201
+ const key = this.getKey(root, server.id);
4202
+ if (this.clients.has(key) || this.pendingStops.has(key))
4203
+ return;
4204
+ this.evictForAdmission();
4205
+ try {
4206
+ this.ensureRespawnAllowed(key, root, server.id);
4207
+ } catch {
4071
4208
  return;
4072
- const client = this.clientFactory(root, server2);
4209
+ }
4210
+ const client = this.clientFactory(root, server);
4073
4211
  const initStartedAt = this.now();
4074
4212
  const initPromise = (async () => {
4075
4213
  await client.start();
@@ -4094,7 +4232,7 @@ class LspManager {
4094
4232
  if (this.clients.get(key) === managed) {
4095
4233
  this.clients.delete(key);
4096
4234
  }
4097
- stopClientBestEffort(client);
4235
+ this.tombstoneStop(key, client);
4098
4236
  });
4099
4237
  }
4100
4238
  isServerInitializing(root, serverId) {
@@ -4138,8 +4276,11 @@ class LspManager {
4138
4276
  for (const managed of this.clients.values()) {
4139
4277
  stopPromises.push(stopClientBestEffort(managed.client));
4140
4278
  }
4279
+ const tombstonedStops = [...this.pendingStops.values()];
4141
4280
  this.clients.clear();
4142
- await Promise.allSettled(stopPromises);
4281
+ this.respawnBudgets.clear();
4282
+ await Promise.allSettled([...stopPromises, ...tombstonedStops]);
4283
+ this.pendingStops.clear();
4143
4284
  }
4144
4285
  }
4145
4286
  var _defaultInstance = null;
@@ -4157,57 +4298,52 @@ async function disposeDefaultLspManager() {
4157
4298
  }
4158
4299
  }
4159
4300
 
4160
- // ../lsp-core/src/lsp/server-install-state.ts
4161
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
4162
- import { dirname as dirname7 } from "node:path";
4163
- function getInstallDecisionsPath() {
4164
- return lspRequestContext().installDecisionsPath;
4165
- }
4166
- function loadInstallDecisions() {
4167
- const path2 = getInstallDecisionsPath();
4168
- if (!existsSync7(path2))
4169
- return {};
4170
- try {
4171
- const parsed = JSON.parse(readFileSync4(path2, "utf8"));
4172
- return isInstallDecisions(parsed) ? parsed : {};
4173
- } catch {
4174
- return {};
4301
+ // ../lsp-core/src/lsp/outside-context-workspace.ts
4302
+ import { existsSync as existsSync7, realpathSync as realpathSync4 } from "node:fs";
4303
+ import { dirname as dirname7, join as join3 } from "node:path";
4304
+
4305
+ // ../lsp-core/src/lsp/workspace-markers.ts
4306
+ var GIT_WORKSPACE_MARKER = ".git";
4307
+ var PROJECT_WORKSPACE_MARKERS = [
4308
+ "package.json",
4309
+ "pyproject.toml",
4310
+ "Cargo.toml",
4311
+ "go.mod",
4312
+ "pom.xml",
4313
+ "build.gradle"
4314
+ ];
4315
+ var WORKSPACE_MARKERS = [GIT_WORKSPACE_MARKER, ...PROJECT_WORKSPACE_MARKERS];
4316
+
4317
+ // ../lsp-core/src/lsp/outside-context-workspace.ts
4318
+ function findWorkspaceRootOutsideContext(directory) {
4319
+ const marked = nearestMarkedAncestor(directory);
4320
+ if (marked !== undefined)
4321
+ return marked;
4322
+ return realpathSync4(nearestExistingAncestor(directory));
4323
+ }
4324
+ function nearestMarkedAncestor(directory) {
4325
+ let current = directory;
4326
+ for (;; ) {
4327
+ if (existsSync7(current) && WORKSPACE_MARKERS.some((marker) => existsSync7(join3(current, marker)))) {
4328
+ return realpathSync4(current);
4329
+ }
4330
+ const parent = dirname7(current);
4331
+ if (parent === current)
4332
+ return;
4333
+ current = parent;
4175
4334
  }
4176
4335
  }
4177
- function loadInstallDecision(serverId) {
4178
- return loadInstallDecisions()[serverId];
4179
- }
4180
- function recordInstallDecision(serverId, decision, decidedAt = new Date().toISOString()) {
4181
- const decisions = loadInstallDecisions();
4182
- decisions[serverId] = { decision, decidedAt };
4183
- writeInstallDecisions(decisions);
4184
- }
4185
- function isInstallDecision(value) {
4186
- return value === "declined" || value === "allowed";
4187
- }
4188
- function writeInstallDecisions(decisions) {
4189
- const path2 = getInstallDecisionsPath();
4190
- mkdirSync3(dirname7(path2), { recursive: true });
4191
- const tmpPath = `${path2}.tmp`;
4192
- writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
4193
- `, "utf8");
4194
- renameSync2(tmpPath, path2);
4195
- }
4196
- function isInstallDecisions(value) {
4197
- return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
4198
- }
4199
- function isInstallDecisionRecord(value) {
4200
- if (!isRecord5(value))
4201
- return false;
4202
- return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
4203
- }
4204
- function isRecord5(value) {
4205
- return typeof value === "object" && value !== null && !Array.isArray(value);
4336
+ function nearestExistingAncestor(directory) {
4337
+ let current = directory;
4338
+ while (!existsSync7(current)) {
4339
+ const parent = dirname7(current);
4340
+ if (parent === current)
4341
+ return current;
4342
+ current = parent;
4343
+ }
4344
+ return current;
4206
4345
  }
4207
4346
 
4208
- // ../lsp-core/src/lsp/config-loader.ts
4209
- import { existsSync as existsSync8, readFileSync as readFileSync5 } from "node:fs";
4210
-
4211
4347
  // ../lsp-core/src/lsp/server-definitions.ts
4212
4348
  var LSP_INSTALL_HINTS = {
4213
4349
  typescript: "npm install -g typescript-language-server typescript",
@@ -4253,6 +4389,26 @@ var LSP_INSTALL_HINTS = {
4253
4389
  julials: `julia -e 'using Pkg; Pkg.add("LanguageServer")'`,
4254
4390
  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"
4255
4391
  };
4392
+ var LSP_LOCAL_INSTALL_HINTS = {
4393
+ typescript: "bun add -d typescript-language-server typescript",
4394
+ vue: "bun add -d @vue/language-server",
4395
+ eslint: "bun add -d vscode-langservers-extracted",
4396
+ oxlint: "bun add -d oxlint",
4397
+ biome: "bun add -d @biomejs/biome",
4398
+ svelte: "bun add -d svelte-language-server",
4399
+ astro: "bun add -d @astrojs/language-server",
4400
+ bash: "bun add -d bash-language-server",
4401
+ "bash-ls": "bun add -d bash-language-server",
4402
+ "yaml-ls": "bun add -d yaml-language-server",
4403
+ php: "bun add -d intelephense",
4404
+ prisma: "bun add -d prisma",
4405
+ dockerfile: "bun add -d dockerfile-language-server-nodejs",
4406
+ pyright: "uv add --dev pyright",
4407
+ basedpyright: "uv add --dev basedpyright",
4408
+ ruff: "uv add --dev ruff",
4409
+ ty: "uv add --dev ty",
4410
+ "ruby-lsp": "bundle add ruby-lsp --group development"
4411
+ };
4256
4412
  var BUILTIN_SERVERS = {
4257
4413
  typescript: {
4258
4414
  command: ["typescript-language-server", "--stdio"],
@@ -4355,18 +4511,67 @@ var BUILTIN_SERVERS = {
4355
4511
  }
4356
4512
  };
4357
4513
 
4514
+ // ../lsp-core/src/lsp/server-install-state.ts
4515
+ import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "node:fs";
4516
+ import { dirname as dirname8 } from "node:path";
4517
+ function getInstallDecisionsPath() {
4518
+ return lspRequestContext().installDecisionsPath;
4519
+ }
4520
+ function loadInstallDecisions() {
4521
+ const path = getInstallDecisionsPath();
4522
+ if (!existsSync8(path))
4523
+ return {};
4524
+ try {
4525
+ const parsed = JSON.parse(readFileSync4(path, "utf8"));
4526
+ return isInstallDecisions(parsed) ? parsed : {};
4527
+ } catch {
4528
+ return {};
4529
+ }
4530
+ }
4531
+ function loadInstallDecision(serverId) {
4532
+ return loadInstallDecisions()[serverId];
4533
+ }
4534
+ function recordInstallDecision(serverId, decision, decidedAt = new Date().toISOString()) {
4535
+ const decisions = loadInstallDecisions();
4536
+ decisions[serverId] = { decision, decidedAt };
4537
+ writeInstallDecisions(decisions);
4538
+ }
4539
+ function isInstallDecision(value) {
4540
+ return value === "declined" || value === "allowed";
4541
+ }
4542
+ function writeInstallDecisions(decisions) {
4543
+ const path = getInstallDecisionsPath();
4544
+ mkdirSync3(dirname8(path), { recursive: true });
4545
+ const tmpPath = `${path}.tmp`;
4546
+ writeFileSync2(tmpPath, `${JSON.stringify(decisions, null, 2)}
4547
+ `, "utf8");
4548
+ renameSync2(tmpPath, path);
4549
+ }
4550
+ function isInstallDecisions(value) {
4551
+ return isRecord5(value) && Object.values(value).every(isInstallDecisionRecord);
4552
+ }
4553
+ function isInstallDecisionRecord(value) {
4554
+ if (!isRecord5(value))
4555
+ return false;
4556
+ return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
4557
+ }
4558
+ function isRecord5(value) {
4559
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4560
+ }
4561
+
4358
4562
  // ../lsp-core/src/lsp/config-loader.ts
4563
+ import { existsSync as existsSync9, readFileSync as readFileSync5 } from "node:fs";
4359
4564
  function getProjectConfigPaths() {
4360
4565
  return lspRequestContext().projectConfigPaths;
4361
4566
  }
4362
4567
  function getUserConfigPath() {
4363
4568
  return lspRequestContext().userConfigPath;
4364
4569
  }
4365
- function loadJsonFile(path2) {
4366
- if (!existsSync8(path2))
4570
+ function loadJsonFile(path) {
4571
+ if (!existsSync9(path))
4367
4572
  return null;
4368
4573
  try {
4369
- const parsed = JSON.parse(readFileSync5(path2, "utf-8"));
4574
+ const parsed = JSON.parse(readFileSync5(path, "utf-8"));
4370
4575
  return isConfigJson(parsed) ? parsed : null;
4371
4576
  } catch {
4372
4577
  return null;
@@ -4383,8 +4588,8 @@ function loadAllConfigs() {
4383
4588
  return configs;
4384
4589
  }
4385
4590
  function loadFirstJsonFile(paths) {
4386
- for (const path2 of paths) {
4387
- const config = loadJsonFile(path2);
4591
+ for (const path of paths) {
4592
+ const config = loadJsonFile(path);
4388
4593
  if (config)
4389
4594
  return config;
4390
4595
  }
@@ -4410,10 +4615,10 @@ function getMergedServers() {
4410
4615
  }
4411
4616
  if (seen.has(id))
4412
4617
  continue;
4413
- const server2 = createServerFromEntry(id, entry, source);
4414
- if (!server2)
4618
+ const server = createServerFromEntry(id, entry, source);
4619
+ if (!server)
4415
4620
  continue;
4416
- servers.push(server2);
4621
+ servers.push(server);
4417
4622
  seen.add(id);
4418
4623
  }
4419
4624
  }
@@ -4445,7 +4650,7 @@ function createServerFromEntry(id, entry, source) {
4445
4650
  if (source === "project") {
4446
4651
  if (!builtin)
4447
4652
  return null;
4448
- const server3 = createServer({
4653
+ const server = createServer({
4449
4654
  id,
4450
4655
  command: builtin.command,
4451
4656
  extensions: entry.extensions ?? builtin.extensions,
@@ -4453,35 +4658,35 @@ function createServerFromEntry(id, entry, source) {
4453
4658
  source
4454
4659
  });
4455
4660
  if (entry.initialization !== undefined) {
4456
- server3.initialization = entry.initialization;
4661
+ server.initialization = entry.initialization;
4457
4662
  }
4458
- return server3;
4663
+ return server;
4459
4664
  }
4460
4665
  if (entry.command && entry.extensions) {
4461
- const server3 = createServer({
4666
+ const server = createServer({
4462
4667
  id,
4463
4668
  command: entry.command,
4464
4669
  extensions: entry.extensions,
4465
4670
  priority: entry.priority ?? 0,
4466
4671
  source
4467
4672
  });
4468
- applyOptionalServerFields(server3, entry);
4469
- return server3;
4673
+ applyOptionalServerFields(server, entry);
4674
+ return server;
4470
4675
  }
4471
4676
  if (!builtin)
4472
4677
  return null;
4473
- const server2 = createServer({
4678
+ const server = createServer({
4474
4679
  id,
4475
4680
  command: entry.command ?? builtin.command,
4476
4681
  extensions: entry.extensions ?? builtin.extensions,
4477
4682
  priority: entry.priority ?? 0,
4478
4683
  source
4479
4684
  });
4480
- applyOptionalServerFields(server2, entry);
4481
- return server2;
4685
+ applyOptionalServerFields(server, entry);
4686
+ return server;
4482
4687
  }
4483
4688
  function createServer(input) {
4484
- const server2 = {
4689
+ const server = {
4485
4690
  id: input.id,
4486
4691
  command: input.command,
4487
4692
  extensions: input.extensions,
@@ -4489,19 +4694,19 @@ function createServer(input) {
4489
4694
  source: input.source
4490
4695
  };
4491
4696
  if (input.env !== undefined) {
4492
- server2.env = input.env;
4697
+ server.env = input.env;
4493
4698
  }
4494
4699
  if (input.initialization !== undefined) {
4495
- server2.initialization = input.initialization;
4700
+ server.initialization = input.initialization;
4496
4701
  }
4497
- return server2;
4702
+ return server;
4498
4703
  }
4499
- function applyOptionalServerFields(server2, entry) {
4704
+ function applyOptionalServerFields(server, entry) {
4500
4705
  if (entry.env !== undefined) {
4501
- server2.env = entry.env;
4706
+ server.env = entry.env;
4502
4707
  }
4503
4708
  if (entry.initialization !== undefined) {
4504
- server2.initialization = entry.initialization;
4709
+ server.initialization = entry.initialization;
4505
4710
  }
4506
4711
  }
4507
4712
  function isConfigJson(value) {
@@ -4551,64 +4756,165 @@ function getDisabledServerIds() {
4551
4756
  }
4552
4757
 
4553
4758
  // ../lsp-core/src/lsp/server-installation.ts
4554
- import { existsSync as existsSync9 } from "node:fs";
4555
- import { delimiter as delimiter3, join as join3 } from "node:path";
4556
- function isServerInstalled(command, _workingDirectory) {
4557
- if (command.length === 0)
4558
- return false;
4559
- const [cmd] = command;
4560
- if (!cmd)
4561
- return false;
4562
- if (cmd.includes("/") || cmd.includes("\\")) {
4563
- if (existsSync9(cmd))
4564
- return true;
4759
+ import { existsSync as existsSync10 } from "node:fs";
4760
+ import { delimiter as delimiter3, dirname as dirname9, isAbsolute as isAbsolute5, join as join4, resolve as resolve7 } from "node:path";
4761
+ var LOCAL_BIN_RULES = [
4762
+ {
4763
+ markers: ["package.json", "bun.lock", "bun.lockb", "package-lock.json", "yarn.lock", "pnpm-lock.yaml"],
4764
+ binDirs: [join4("node_modules", ".bin")]
4765
+ },
4766
+ {
4767
+ markers: [
4768
+ "pyproject.toml",
4769
+ "ty.toml",
4770
+ "requirements.txt",
4771
+ "setup.py",
4772
+ "setup.cfg",
4773
+ "Pipfile",
4774
+ "pyrightconfig.json",
4775
+ "ruff.toml",
4776
+ ".ruff.toml"
4777
+ ],
4778
+ binDirs: [
4779
+ join4(".venv", "bin"),
4780
+ join4(".venv", "Scripts"),
4781
+ join4("venv", "bin"),
4782
+ join4("venv", "Scripts"),
4783
+ join4(".env", "bin"),
4784
+ join4(".env", "Scripts")
4785
+ ]
4786
+ },
4787
+ {
4788
+ markers: ["Gemfile", "Gemfile.lock"],
4789
+ binDirs: [join4("vendor", "bundle", "bin"), "bin"]
4790
+ },
4791
+ {
4792
+ markers: ["go.mod", "go.sum", "go.work"],
4793
+ binDirs: ["bin"]
4565
4794
  }
4566
- const isWindows = process.platform === "win32";
4567
- let exts = [""];
4568
- if (isWindows) {
4569
- const pathExt = process.env["PATHEXT"] ?? "";
4570
- if (pathExt) {
4571
- const systemExts = pathExt.split(";").filter(Boolean);
4572
- exts = [...new Set([...exts, ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
4573
- } else {
4574
- exts = ["", ".exe", ".cmd", ".bat", ".ps1"];
4795
+ ];
4796
+ var resolutionCache = new Map;
4797
+ var probeCount = 0;
4798
+ function probe(path) {
4799
+ probeCount += 1;
4800
+ return existsSync10(path);
4801
+ }
4802
+ function executableSuffixes(platform, pathExt) {
4803
+ if (platform !== "win32")
4804
+ return [""];
4805
+ const configured = pathExt ?? process.env["PATHEXT"] ?? "";
4806
+ const systemExts = configured.split(";").filter((entry) => entry.length > 0).map((entry) => entry.toLowerCase());
4807
+ return [...new Set(["", ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
4808
+ }
4809
+ function probeWithSuffixes(directory, command, suffixes) {
4810
+ for (const suffix of suffixes) {
4811
+ const candidate = join4(directory, command + suffix);
4812
+ if (probe(candidate))
4813
+ return candidate;
4814
+ }
4815
+ return null;
4816
+ }
4817
+ function resolveLocal(command, workingDirectory, suffixes, stopAt) {
4818
+ const boundary = stopAt === undefined ? undefined : resolve7(stopAt);
4819
+ let current = resolve7(workingDirectory);
4820
+ while (true) {
4821
+ for (const rule of LOCAL_BIN_RULES) {
4822
+ if (!rule.markers.some((marker) => probe(join4(current, marker))))
4823
+ continue;
4824
+ for (const binDir of rule.binDirs) {
4825
+ const found = probeWithSuffixes(join4(current, binDir), command, suffixes);
4826
+ if (found !== null)
4827
+ return found;
4828
+ }
4575
4829
  }
4830
+ if (probe(join4(current, ".git")))
4831
+ return null;
4832
+ if (boundary !== undefined && current === boundary)
4833
+ return null;
4834
+ const parent = dirname9(current);
4835
+ if (parent === current)
4836
+ return null;
4837
+ current = parent;
4576
4838
  }
4577
- let pathEnv = process.env["PATH"] ?? "";
4578
- if (isWindows && !pathEnv) {
4839
+ }
4840
+ function resolveFromPath(command, suffixes, platform, pathEnvOverride) {
4841
+ let pathEnv = pathEnvOverride ?? process.env["PATH"] ?? "";
4842
+ if (platform === "win32" && !pathEnv) {
4579
4843
  pathEnv = process.env["Path"] ?? "";
4580
4844
  }
4581
- const paths = pathEnv.split(delimiter3);
4582
- for (const p of paths) {
4583
- for (const suffix of exts) {
4584
- if (existsSync9(join3(p, cmd + suffix))) {
4585
- return true;
4586
- }
4587
- }
4845
+ for (const entry of pathEnv.split(delimiter3)) {
4846
+ if (entry.length === 0)
4847
+ continue;
4848
+ const found = probeWithSuffixes(entry, command, suffixes);
4849
+ if (found !== null)
4850
+ return found;
4588
4851
  }
4589
- if (cmd === "node")
4590
- return true;
4591
- return false;
4852
+ return null;
4853
+ }
4854
+ function resolveServerBinary(command, workingDirectory, options = {}) {
4855
+ if (command.length === 0)
4856
+ return null;
4857
+ const [cmd] = command;
4858
+ if (cmd === undefined || cmd.length === 0)
4859
+ return null;
4860
+ const platform = options.platform ?? process.platform;
4861
+ const suffixes = executableSuffixes(platform, options.pathExt);
4862
+ if (cmd.includes("/") || cmd.includes("\\")) {
4863
+ const explicit = isAbsolute5(cmd) ? cmd : resolve7(workingDirectory ?? process.cwd(), cmd);
4864
+ return probe(explicit) ? explicit : null;
4865
+ }
4866
+ const cacheKey = JSON.stringify([
4867
+ workingDirectory ?? "",
4868
+ cmd,
4869
+ platform,
4870
+ options.stopAt ?? "",
4871
+ options.pathExt ?? "",
4872
+ options.pathEnv ?? process.env["PATH"] ?? ""
4873
+ ]);
4874
+ const cached = resolutionCache.get(cacheKey);
4875
+ if (cached !== undefined)
4876
+ return cached;
4877
+ let resolved = null;
4878
+ if (workingDirectory !== undefined && workingDirectory.length > 0) {
4879
+ resolved = resolveLocal(cmd, workingDirectory, suffixes, options.stopAt);
4880
+ }
4881
+ resolved ??= resolveFromPath(cmd, suffixes, platform, options.pathEnv);
4882
+ if (resolved === null && cmd === "node")
4883
+ resolved = cmd;
4884
+ resolutionCache.set(cacheKey, resolved);
4885
+ return resolved;
4886
+ }
4887
+ function isServerInstalled(command, workingDirectory, options = {}) {
4888
+ if (command.length === 0)
4889
+ return false;
4890
+ return resolveServerBinary(command, workingDirectory, options) !== null;
4592
4891
  }
4593
4892
 
4594
4893
  // ../lsp-core/src/lsp/server-resolution.ts
4894
+ function withResolvedCommand(command, binaryPath) {
4895
+ return [binaryPath, ...command.slice(1)];
4896
+ }
4595
4897
  function findServerForExtension(ext) {
4596
4898
  const servers = getMergedServers();
4597
- for (const server2 of servers) {
4598
- if (server2.extensions.includes(ext) && isServerInstalled(server2.command)) {
4899
+ const workingDirectory = contextCwd();
4900
+ for (const server of servers) {
4901
+ if (!server.extensions.includes(ext))
4902
+ continue;
4903
+ const binaryPath = resolveServerBinary(server.command, workingDirectory);
4904
+ if (binaryPath !== null) {
4599
4905
  const resolvedServer = {
4600
- id: server2.id,
4601
- command: server2.command,
4602
- extensions: server2.extensions,
4603
- priority: server2.priority
4906
+ id: server.id,
4907
+ command: withResolvedCommand(server.command, binaryPath),
4908
+ extensions: server.extensions,
4909
+ priority: server.priority
4604
4910
  };
4605
- if (server2.env !== undefined) {
4911
+ if (server.env !== undefined) {
4606
4912
  return {
4607
4913
  status: "found",
4608
4914
  server: {
4609
4915
  ...resolvedServer,
4610
- env: server2.env,
4611
- ...server2.initialization === undefined ? {} : { initialization: server2.initialization }
4916
+ env: server.env,
4917
+ ...server.initialization === undefined ? {} : { initialization: server.initialization }
4612
4918
  }
4613
4919
  };
4614
4920
  }
@@ -4616,20 +4922,20 @@ function findServerForExtension(ext) {
4616
4922
  status: "found",
4617
4923
  server: {
4618
4924
  ...resolvedServer,
4619
- ...server2.initialization === undefined ? {} : { initialization: server2.initialization }
4925
+ ...server.initialization === undefined ? {} : { initialization: server.initialization }
4620
4926
  }
4621
4927
  };
4622
4928
  }
4623
4929
  }
4624
- for (const server2 of servers) {
4625
- if (server2.extensions.includes(ext)) {
4626
- const installHint = LSP_INSTALL_HINTS[server2.id] ?? `Install '${server2.command[0]}' and ensure it's in your PATH`;
4930
+ for (const server of servers) {
4931
+ if (server.extensions.includes(ext)) {
4932
+ const installHint = LSP_INSTALL_HINTS[server.id] ?? `Install '${server.command[0]}' and ensure it's in your PATH`;
4627
4933
  return {
4628
4934
  status: "not_installed",
4629
4935
  server: {
4630
- id: server2.id,
4631
- command: server2.command,
4632
- extensions: server2.extensions
4936
+ id: server.id,
4937
+ command: server.command,
4938
+ extensions: server.extensions
4633
4939
  },
4634
4940
  installHint
4635
4941
  };
@@ -4645,20 +4951,21 @@ function findServerForExtension(ext) {
4645
4951
  function getAllServers() {
4646
4952
  const servers = getMergedServers();
4647
4953
  const disabled = getDisabledServerIds();
4954
+ const workingDirectory = contextCwd();
4648
4955
  const result = [];
4649
4956
  const seen = new Set;
4650
- for (const server2 of servers) {
4651
- if (seen.has(server2.id))
4957
+ for (const server of servers) {
4958
+ if (seen.has(server.id))
4652
4959
  continue;
4653
4960
  result.push({
4654
- id: server2.id,
4655
- installed: isServerInstalled(server2.command),
4656
- extensions: server2.extensions,
4961
+ id: server.id,
4962
+ installed: isServerInstalled(server.command, workingDirectory),
4963
+ extensions: server.extensions,
4657
4964
  disabled: false,
4658
- source: server2.source,
4659
- priority: server2.priority
4965
+ source: server.source,
4966
+ priority: server.priority
4660
4967
  });
4661
- seen.add(server2.id);
4968
+ seen.add(server.id);
4662
4969
  }
4663
4970
  for (const id of disabled) {
4664
4971
  if (seen.has(id))
@@ -4666,7 +4973,7 @@ function getAllServers() {
4666
4973
  const builtin = BUILTIN_SERVERS[id];
4667
4974
  result.push({
4668
4975
  id,
4669
- installed: builtin ? isServerInstalled(builtin.command) : false,
4976
+ installed: builtin ? isServerInstalled(builtin.command, workingDirectory) : false,
4670
4977
  extensions: builtin?.extensions ?? [],
4671
4978
  disabled: true,
4672
4979
  source: "disabled",
@@ -4677,7 +4984,6 @@ function getAllServers() {
4677
4984
  }
4678
4985
 
4679
4986
  // ../lsp-core/src/lsp/client-wrapper.ts
4680
- var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
4681
4987
  function isDirectoryPath(filePath) {
4682
4988
  try {
4683
4989
  return statSync4(filePath).isDirectory();
@@ -4690,36 +4996,40 @@ function findWorkspaceRoot(filePath) {
4690
4996
  const abs = resolveReadablePathInsideContext(filePath);
4691
4997
  let dir = abs;
4692
4998
  if (!isDirectoryPath(dir)) {
4693
- dir = dirname8(dir);
4999
+ dir = dirname10(dir);
4694
5000
  }
5001
+ if (!isPathInside(cwd, abs))
5002
+ return findWorkspaceRootOutsideContext(dir);
4695
5003
  const fallbackRoot = nearestExistingDirectoryInsideContext(dir, cwd) ?? cwd;
5004
+ let nearestPackageRoot;
4696
5005
  while (isPathInside(cwd, dir)) {
4697
5006
  const canonicalDir = existingDirectoryInsideContext(dir, cwd);
4698
5007
  if (canonicalDir !== undefined) {
4699
- for (const marker of WORKSPACE_MARKERS) {
4700
- if (existsSync10(join4(dir, marker))) {
4701
- return canonicalDir;
4702
- }
5008
+ if (existsSync11(join5(dir, GIT_WORKSPACE_MARKER))) {
5009
+ return canonicalDir;
5010
+ }
5011
+ if (nearestPackageRoot === undefined && hasProjectWorkspaceMarker(dir)) {
5012
+ nearestPackageRoot = canonicalDir;
4703
5013
  }
4704
5014
  }
4705
5015
  if (dir === cwd)
4706
5016
  break;
4707
- dir = dirname8(dir);
5017
+ dir = dirname10(dir);
4708
5018
  }
4709
- return fallbackRoot;
5019
+ return nearestPackageRoot ?? fallbackRoot;
5020
+ }
5021
+ function hasProjectWorkspaceMarker(directory) {
5022
+ return PROJECT_WORKSPACE_MARKERS.some((marker) => existsSync11(join5(directory, marker)));
4710
5023
  }
4711
5024
  function resolveReadablePathInsideContext(filePath) {
4712
5025
  const cwd = contextCwd();
4713
- const abs = resolve7(cwd, filePath);
5026
+ const abs = resolve8(cwd, filePath);
4714
5027
  if (isPathInside(cwd, abs))
4715
5028
  return abs;
4716
5029
  const rebased = rebaseThroughCanonicalAncestor(abs, cwd);
4717
5030
  if (rebased !== undefined)
4718
5031
  return rebased;
4719
- const canonical = canonicalizeExistingOrNearestAncestor(abs);
4720
- if (isPathInside(cwd, canonical))
4721
- return canonical;
4722
- throw new LspInvalidPathError(`LSP file path must be inside request cwd: ${filePath}`);
5032
+ return canonicalizeExistingOrNearestAncestor(abs);
4723
5033
  }
4724
5034
  function resolvePathInsideContext(filePath) {
4725
5035
  const cwd = contextCwd();
@@ -4730,16 +5040,16 @@ function resolvePathInsideContext(filePath) {
4730
5040
  }
4731
5041
  return canonical;
4732
5042
  }
4733
- function rebaseThroughCanonicalAncestor(path2, cwd) {
4734
- let current = path2;
5043
+ function rebaseThroughCanonicalAncestor(path, cwd) {
5044
+ let current = path;
4735
5045
  const suffix = [];
4736
5046
  while (true) {
4737
- if (existsSync10(current)) {
4738
- const canonical = realpathSync4(current);
5047
+ if (existsSync11(current)) {
5048
+ const canonical = realpathSync5(current);
4739
5049
  if (isPathInside(cwd, canonical))
4740
- return suffix.length === 0 ? canonical : join4(canonical, ...suffix);
5050
+ return suffix.length === 0 ? canonical : join5(canonical, ...suffix);
4741
5051
  }
4742
- const parent = dirname8(current);
5052
+ const parent = dirname10(current);
4743
5053
  if (parent === current)
4744
5054
  return;
4745
5055
  suffix.unshift(basename3(current));
@@ -4747,9 +5057,9 @@ function rebaseThroughCanonicalAncestor(path2, cwd) {
4747
5057
  }
4748
5058
  }
4749
5059
  function existingDirectoryInsideContext(directory, cwd) {
4750
- if (!existsSync10(directory))
5060
+ if (!existsSync11(directory))
4751
5061
  return;
4752
- const canonical = realpathSync4(directory);
5062
+ const canonical = realpathSync5(directory);
4753
5063
  if (!statSync4(canonical).isDirectory())
4754
5064
  return;
4755
5065
  return isPathInside(cwd, canonical) ? canonical : undefined;
@@ -4762,7 +5072,7 @@ function nearestExistingDirectoryInsideContext(directory, cwd) {
4762
5072
  return canonical;
4763
5073
  if (current === cwd)
4764
5074
  return;
4765
- current = dirname8(current);
5075
+ current = dirname10(current);
4766
5076
  }
4767
5077
  return;
4768
5078
  }
@@ -4789,33 +5099,46 @@ function formatServerLookupError(result) {
4789
5099
  ].join(`
4790
5100
  `);
4791
5101
  }
5102
+ function formatInstallOptions(serverId, installHint) {
5103
+ const localHint = LSP_LOCAL_INSTALL_HINTS[serverId];
5104
+ if (localHint === undefined) {
5105
+ return ["To install, run:", ` ${installHint}`];
5106
+ }
5107
+ return [
5108
+ "To install in THIS repository (preferred — no global install needed):",
5109
+ ` ${localHint}`,
5110
+ "",
5111
+ "Or install it globally:",
5112
+ ` ${installHint}`
5113
+ ];
5114
+ }
4792
5115
  function formatNotInstalled(result) {
4793
- const { server: server2, installHint } = result;
4794
- const extensions = server2.extensions.join(", ");
4795
- const decision = loadInstallDecision(server2.id)?.decision;
5116
+ const { server, installHint } = result;
5117
+ const extensions = server.extensions.join(", ");
5118
+ const decision = loadInstallDecision(server.id)?.decision;
4796
5119
  const context = lspRequestContext();
4797
5120
  if (decision === "declined") {
4798
- return `LSP server '${server2.id}' (${extensions}) is NOT INSTALLED; user previously declined installation — proceed without LSP.`;
5121
+ return `LSP server '${server.id}' (${extensions}) is NOT INSTALLED; user previously declined installation — proceed without LSP.`;
4799
5122
  }
4800
5123
  const header = [
4801
- `LSP server '${server2.id}' for ${extensions} is NOT INSTALLED.`,
5124
+ `LSP server '${server.id}' for ${extensions} is NOT INSTALLED.`,
4802
5125
  "",
4803
- `Command not found: ${server2.command[0]}`,
5126
+ `Command not found: ${server.command[0]}`,
4804
5127
  ""
4805
5128
  ];
5129
+ const installOptions = formatInstallOptions(server.id, installHint);
4806
5130
  if (decision === "allowed") {
4807
5131
  return [
4808
5132
  ...header,
4809
5133
  "The user has pre-authorized LSP installation. Run the install command, then retry this tool:",
4810
- ` ${installHint}`
5134
+ ...installOptions.slice(1)
4811
5135
  ].join(`
4812
5136
  `);
4813
5137
  }
4814
5138
  if (!context.capabilities.installDecisionTool) {
4815
5139
  return [
4816
5140
  ...header,
4817
- "To install, run:",
4818
- ` ${installHint}`,
5141
+ ...installOptions,
4819
5142
  "",
4820
5143
  "ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
4821
5144
  "Install-decision recording is unavailable in this harness; proceed without LSP if the user declines."
@@ -4824,13 +5147,12 @@ function formatNotInstalled(result) {
4824
5147
  }
4825
5148
  return [
4826
5149
  ...header,
4827
- "To install, run:",
4828
- ` ${installHint}`,
5150
+ ...installOptions,
4829
5151
  "",
4830
5152
  "ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
4831
5153
  "- If the user agrees: run the install command above, then retry this tool.",
4832
5154
  "- If the user declines, OR has NOT explicitly asked for LSP installation:",
4833
- ` call lsp_install_decision { server_id: "${server2.id}", decision: "declined" },`,
5155
+ ` call lsp_install_decision { server_id: "${server.id}", decision: "declined" },`,
4834
5156
  ` which writes to ${context.installDecisionsPath},`,
4835
5157
  " then ignore this message and proceed WITHOUT LSP."
4836
5158
  ].join(`
@@ -4854,34 +5176,34 @@ async function withLspClient(filePath, fn, toolName, options = {}) {
4854
5176
  if (result.status !== "found") {
4855
5177
  throw new LspServerLookupError(formatServerLookupError(result), result);
4856
5178
  }
4857
- const server2 = result.server;
5179
+ const server = result.server;
4858
5180
  const root = findWorkspaceRoot(absPath);
4859
5181
  const manager = options.manager ?? getLspManager();
4860
5182
  const acquireAndCall = async (allowRetry) => {
4861
- const client = await manager.getClient(root, server2, options.signal);
5183
+ const client = await manager.getClient(root, server, options.signal);
4862
5184
  try {
4863
5185
  return await fn(client, root, absPath);
4864
5186
  } catch (err) {
4865
5187
  if (allowRetry && READ_ONLY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
4866
- manager.invalidateClient(root, server2.id, client);
5188
+ manager.invalidateClient(root, server.id, client);
4867
5189
  return acquireAndCall(false);
4868
5190
  }
4869
5191
  if (err instanceof LspRequestTimeoutError) {
4870
- if (manager.isServerInitializing(root, server2.id)) {
5192
+ if (manager.isServerInitializing(root, server.id)) {
4871
5193
  throw new LspServerInitializingError(err);
4872
5194
  }
4873
5195
  }
4874
5196
  throw err;
4875
5197
  } finally {
4876
- manager.releaseClient(root, server2.id);
5198
+ manager.releaseClient(root, server.id);
4877
5199
  }
4878
5200
  };
4879
5201
  return acquireAndCall(true);
4880
5202
  }
4881
5203
 
4882
5204
  // ../lsp-core/src/lsp/directory-diagnostics.ts
4883
- import { existsSync as existsSync11, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
4884
- import { join as join5, resolve as resolve8 } from "node:path";
5205
+ import { existsSync as existsSync12, lstatSync as lstatSync5, readdirSync as readdirSync3 } from "node:fs";
5206
+ import { join as join6, resolve as resolve9 } from "node:path";
4885
5207
 
4886
5208
  // ../lsp-core/src/lsp/formatters.ts
4887
5209
  import { fileURLToPath as fileURLToPath3 } from "node:url";
@@ -4896,10 +5218,10 @@ function uriToPath(uri) {
4896
5218
  }
4897
5219
  function formatLocation(loc) {
4898
5220
  if ("targetUri" in loc) {
4899
- const uri2 = uriToPath(loc.targetUri);
4900
- const line2 = loc.targetRange.start.line + 1;
4901
- const char2 = loc.targetRange.start.character;
4902
- return `${uri2}:${line2}:${char2}`;
5221
+ const uri = uriToPath(loc.targetUri);
5222
+ const line = loc.targetRange.start.line + 1;
5223
+ const char = loc.targetRange.start.character;
5224
+ return `${uri}:${line}:${char}`;
4903
5225
  }
4904
5226
  const uri = uriToPath(loc.uri);
4905
5227
  const line = loc.range.start.line + 1;
@@ -5011,7 +5333,7 @@ function collectFilesWithExtension(dir, extension, maxFiles) {
5011
5333
  for (const entry of entries) {
5012
5334
  if (files.length >= maxFiles)
5013
5335
  return;
5014
- const fullPath = join5(currentDir, entry);
5336
+ const fullPath = join6(currentDir, entry);
5015
5337
  let stat;
5016
5338
  try {
5017
5339
  stat = lstatSync5(fullPath);
@@ -5036,15 +5358,15 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
5036
5358
  if (!extension.startsWith(".")) {
5037
5359
  throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
5038
5360
  }
5039
- const absDir = resolve8(options.workspaceRoot ?? contextCwd(), directory);
5040
- if (!existsSync11(absDir)) {
5361
+ const absDir = resolve9(options.workspaceRoot ?? contextCwd(), directory);
5362
+ if (!existsSync12(absDir)) {
5041
5363
  throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
5042
5364
  }
5043
5365
  const serverResult = options.server === undefined ? findServerForExtension(extension) : { status: "found", server: options.server };
5044
5366
  if (serverResult.status !== "found") {
5045
5367
  throw new LspServerLookupError(formatServerLookupError(serverResult));
5046
5368
  }
5047
- const server2 = serverResult.server;
5369
+ const server = serverResult.server;
5048
5370
  const allFiles = (options.listFiles ?? collectFilesWithExtension)(absDir, extension, maxFiles + 1);
5049
5371
  const wasCapped = allFiles.length > maxFiles;
5050
5372
  const filesToProcess = allFiles.slice(0, maxFiles);
@@ -5064,7 +5386,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
5064
5386
  const fileErrors = [];
5065
5387
  const maxConcurrency = Math.max(1, options.maxConcurrency ?? DIRECTORY_DIAGNOSTICS_MAX_CONCURRENCY);
5066
5388
  options.signal?.throwIfAborted();
5067
- const client = await manager.getClient(root, server2, options.signal);
5389
+ const client = await manager.getClient(root, server, options.signal);
5068
5390
  try {
5069
5391
  let nextIndex = 0;
5070
5392
  const workers = Array.from({ length: Math.min(maxConcurrency, filesToProcess.length) }, async () => {
@@ -5092,7 +5414,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
5092
5414
  });
5093
5415
  await Promise.all(workers);
5094
5416
  } finally {
5095
- manager.releaseClient(root, server2.id);
5417
+ manager.releaseClient(root, server.id);
5096
5418
  }
5097
5419
  const displayDiagnostics = allDiagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
5098
5420
  const wasDiagCapped = allDiagnostics.length > DEFAULT_MAX_DIAGNOSTICS;
@@ -5124,7 +5446,7 @@ async function aggregateDiagnosticsForDirectory(directory, extension, severity,
5124
5446
 
5125
5447
  // ../lsp-core/src/lsp/infer-extension.ts
5126
5448
  import { lstatSync as lstatSync6, readdirSync as readdirSync4 } from "node:fs";
5127
- import { join as join6 } from "node:path";
5449
+ import { join as join7 } from "node:path";
5128
5450
  var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
5129
5451
  var MAX_SCAN_ENTRIES = 500;
5130
5452
  function inferExtensionFromDirectory(directory) {
@@ -5142,7 +5464,7 @@ function inferExtensionFromDirectory(directory) {
5142
5464
  for (const entry of entries) {
5143
5465
  if (scanned >= MAX_SCAN_ENTRIES)
5144
5466
  return;
5145
- const fullPath = join6(dir, entry);
5467
+ const fullPath = join7(dir, entry);
5146
5468
  let stat;
5147
5469
  try {
5148
5470
  stat = lstatSync6(fullPath);
@@ -5301,8 +5623,8 @@ function clientOptions(signal) {
5301
5623
  }
5302
5624
 
5303
5625
  // ../lsp-core/src/tools/result.ts
5304
- function text(text2, details, isError = false) {
5305
- return { content: [{ type: "text", text: text2 }], details, isError };
5626
+ function text(text, details, isError = false) {
5627
+ return { content: [{ type: "text", text }], details, isError };
5306
5628
  }
5307
5629
 
5308
5630
  // ../lsp-core/src/tools/diagnostics.ts
@@ -5322,7 +5644,7 @@ async function executeLspDiagnostics(params, signal) {
5322
5644
  const extension = inferExtensionFromDirectory(absPath);
5323
5645
  if (!extension) {
5324
5646
  const message = `No supported source files found in directory: ${absPath}`;
5325
- const details3 = {
5647
+ const details = {
5326
5648
  filePath,
5327
5649
  severity,
5328
5650
  mode: "directory",
@@ -5332,24 +5654,24 @@ async function executeLspDiagnostics(params, signal) {
5332
5654
  error: message,
5333
5655
  errorKind: "no_files"
5334
5656
  };
5335
- return text(message, details3);
5657
+ return text(message, details);
5336
5658
  }
5337
- const output2 = await aggregateDiagnosticsForDirectory(absPath, extension, severity, undefined, signal === undefined ? {} : { signal });
5338
- const details2 = {
5659
+ const output = await aggregateDiagnosticsForDirectory(absPath, extension, severity, undefined, signal === undefined ? {} : { signal });
5660
+ const details = {
5339
5661
  filePath,
5340
5662
  severity,
5341
5663
  mode: "directory",
5342
5664
  diagnostics: [],
5343
- totalDiagnostics: output2.totalDiagnostics,
5665
+ totalDiagnostics: output.totalDiagnostics,
5344
5666
  truncated: false,
5345
- fileFailures: [...output2.fileFailures]
5667
+ fileFailures: [...output.fileFailures]
5346
5668
  };
5347
- return text(output2.output, details2);
5669
+ return text(output.output, details);
5348
5670
  }
5349
5671
  const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.diagnostics(resolvedFilePath, signal), "diagnostics", clientOptions(signal));
5350
5672
  if (result.transientError) {
5351
5673
  const message = result.transientError.message;
5352
- const details2 = {
5674
+ const details = {
5353
5675
  filePath,
5354
5676
  severity,
5355
5677
  mode: "file",
@@ -5359,7 +5681,7 @@ async function executeLspDiagnostics(params, signal) {
5359
5681
  error: message,
5360
5682
  errorKind: result.transientError.kind
5361
5683
  };
5362
- return text(message, details2, true);
5684
+ return text(message, details, true);
5363
5685
  }
5364
5686
  const diagnostics = filterDiagnosticsBySeverity(asDiagnosticArray(result), severity);
5365
5687
  const total = diagnostics.length;
@@ -5393,6 +5715,96 @@ async function executeLspDiagnostics(params, signal) {
5393
5715
  throw error;
5394
5716
  }
5395
5717
  }
5718
+ // ../lsp-core/src/lsp/format-document.ts
5719
+ import { readFileSync as readFileSync6, renameSync as renameSync3, unlinkSync as unlinkSync2, writeFileSync as writeFileSync3 } from "node:fs";
5720
+ var DEFAULT_FORMATTING_OPTIONS = {
5721
+ tabSize: 4,
5722
+ insertSpaces: false,
5723
+ trimTrailingWhitespace: true,
5724
+ insertFinalNewline: true,
5725
+ trimFinalNewlines: true
5726
+ };
5727
+ var UNCHANGED = { status: "unchanged", linesAdded: 0, linesRemoved: 0 };
5728
+ async function formatDocumentWithClient(client, filePath, options = {}) {
5729
+ const edits = await client.formatDocument(filePath, options.formattingOptions ?? DEFAULT_FORMATTING_OPTIONS, options.signal);
5730
+ if (edits === null)
5731
+ return { status: "unavailable", reason: "capability_not_advertised" };
5732
+ if (edits.length === 0)
5733
+ return UNCHANGED;
5734
+ const before = readFileSync6(filePath, "utf-8");
5735
+ const normalized = normalizeTextEdits(before, edits, 0);
5736
+ if (normalized.text === before)
5737
+ return UNCHANGED;
5738
+ writeAtomically(filePath, normalized.text);
5739
+ await client.openFile(filePath);
5740
+ return {
5741
+ status: "formatted",
5742
+ ...lineDelta(normalized.edits)
5743
+ };
5744
+ }
5745
+ function lineDelta(edits) {
5746
+ let linesAdded = 0;
5747
+ let linesRemoved = 0;
5748
+ for (const edit of edits) {
5749
+ linesRemoved += edit.range.end.line - edit.range.start.line + 1;
5750
+ linesAdded += edit.newText.split(`
5751
+ `).length;
5752
+ }
5753
+ return { linesAdded, linesRemoved };
5754
+ }
5755
+ function writeAtomically(filePath, content) {
5756
+ const tempPath = `${filePath}.omo-format.tmp`;
5757
+ writeFileSync3(tempPath, content, "utf-8");
5758
+ try {
5759
+ renameSync3(tempPath, filePath);
5760
+ } catch (error) {
5761
+ try {
5762
+ unlinkSync2(tempPath);
5763
+ } catch {}
5764
+ throw error;
5765
+ }
5766
+ }
5767
+
5768
+ // ../lsp-core/src/tools/format.ts
5769
+ async function executeLspFormat(params, signal) {
5770
+ const filePath = requireString(params, "filePath");
5771
+ try {
5772
+ const result = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => formatDocumentWithClient(client, resolvedFilePath, signal === undefined ? {} : { signal }), "format", clientOptions(signal));
5773
+ return text(describeResult(filePath, result), formatDetails(filePath, result));
5774
+ } catch (error) {
5775
+ const missingDependency = missingDependencyResult(error, {
5776
+ filePath,
5777
+ status: "unavailable",
5778
+ reason: "server_unavailable",
5779
+ linesAdded: 0,
5780
+ linesRemoved: 0
5781
+ });
5782
+ if (missingDependency)
5783
+ return missingDependency;
5784
+ throw error;
5785
+ }
5786
+ }
5787
+ function formatDetails(filePath, result) {
5788
+ if (result.status === "unavailable") {
5789
+ return { filePath, status: "unavailable", reason: result.reason, linesAdded: 0, linesRemoved: 0 };
5790
+ }
5791
+ return {
5792
+ filePath,
5793
+ status: result.status,
5794
+ linesAdded: result.linesAdded,
5795
+ linesRemoved: result.linesRemoved
5796
+ };
5797
+ }
5798
+ function describeResult(filePath, result) {
5799
+ if (result.status === "unavailable") {
5800
+ return `Formatting unavailable for ${filePath}: the language server does not advertise documentFormattingProvider.`;
5801
+ }
5802
+ if (result.status === "unchanged") {
5803
+ return `Already formatted: ${filePath}`;
5804
+ }
5805
+ return `Formatted ${filePath} (+${result.linesAdded}/-${result.linesRemoved} lines)`;
5806
+ }
5807
+
5396
5808
  // ../lsp-core/src/tools/install-decision.ts
5397
5809
  async function executeLspInstallDecision(params) {
5398
5810
  const serverId = requireString(params, "server_id");
@@ -5400,7 +5812,7 @@ async function executeLspInstallDecision(params) {
5400
5812
  if (!isInstallDecision(decision)) {
5401
5813
  return text(`Invalid decision '${String(decision)}'. Expected "declined" or "allowed".`, { serverId, errorKind: "invalid_decision" }, true);
5402
5814
  }
5403
- const serverIds = [...new Set(getMergedServers().map((server2) => server2.id))];
5815
+ const serverIds = [...new Set(getMergedServers().map((server) => server.id))];
5404
5816
  if (!serverIds.includes(serverId)) {
5405
5817
  const preview = serverIds.slice(0, 20).join(", ");
5406
5818
  return text(`Unknown LSP server '${serverId}'. Known servers: ${preview}${serverIds.length > 20 ? "..." : ""}`, { serverId, errorKind: "unknown_server" }, true);
@@ -5540,10 +5952,10 @@ function objectSchema(properties, required = []) {
5540
5952
  async function executeLspStatus() {
5541
5953
  const servers = getAllServers();
5542
5954
  const snapshots = getLspManager().getSnapshot();
5543
- const installed = servers.filter((server2) => server2.installed && !server2.disabled);
5544
- const configuredLines = servers.map((server2) => {
5545
- const state = server2.disabled ? "disabled" : server2.installed ? "installed" : "missing";
5546
- return `- ${server2.id}: ${state}; source=${server2.source}; extensions=${server2.extensions.join(", ")}`;
5955
+ const installed = servers.filter((server) => server.installed && !server.disabled);
5956
+ const configuredLines = servers.map((server) => {
5957
+ const state = server.disabled ? "disabled" : server.installed ? "installed" : "missing";
5958
+ return `- ${server.id}: ${state}; source=${server.source}; extensions=${server.extensions.join(", ")}`;
5547
5959
  });
5548
5960
  const activeLines = snapshots.map((snapshot) => {
5549
5961
  const state = snapshot.alive ? snapshot.isInitializing ? "initializing" : "alive" : "dead";
@@ -5586,8 +5998,8 @@ async function executeLspSymbols(params, signal) {
5586
5998
  errorKind: "missing_query"
5587
5999
  });
5588
6000
  }
5589
- const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
5590
- return formatSymbolsResult(filePath, scope, symbols2, limit, query);
6001
+ const symbols = await withLspClient(filePath, async (client) => client.workspaceSymbols(query, signal), "workspaceSymbols", clientOptions(signal));
6002
+ return formatSymbolsResult(filePath, scope, symbols, limit, query);
5591
6003
  }
5592
6004
  const symbols = await withLspClient(filePath, async (client, _workspaceRoot, resolvedFilePath) => client.documentSymbols(resolvedFilePath, signal), "documentSymbols", clientOptions(signal));
5593
6005
  return formatSymbolsResult(filePath, scope, symbols, limit);
@@ -5725,6 +6137,16 @@ var LSP_MCP_TOOLS = [
5725
6137
  }, ["filePath", "line", "character", "newName"]),
5726
6138
  execute: executeLspRename
5727
6139
  },
6140
+ {
6141
+ name: "format",
6142
+ aliases: ["lsp_format"],
6143
+ title: "LSP Format",
6144
+ description: "Format a source file with its language server and write the returned edits to disk.",
6145
+ inputSchema: objectSchema({
6146
+ filePath: { type: "string", description: "Source file path to format." }
6147
+ }, ["filePath"]),
6148
+ execute: executeLspFormat
6149
+ },
5728
6150
  {
5729
6151
  name: "install_decision",
5730
6152
  aliases: ["lsp_install_decision"],
@@ -5825,7 +6247,10 @@ function requestedProtocolVersion(params) {
5825
6247
  var CONTEXT_KEY = "_context";
5826
6248
 
5827
6249
  class InvalidDaemonRequestError extends Error {
5828
- name = "InvalidDaemonRequestError";
6250
+ constructor() {
6251
+ super(...arguments);
6252
+ this.name = "InvalidDaemonRequestError";
6253
+ }
5829
6254
  }
5830
6255
  function extractRequestContext(raw) {
5831
6256
  if (!isPlainRecord(raw) || raw["method"] !== "tools/call")
@@ -5941,14 +6366,17 @@ async function callToolViaDaemon(name, args, options) {
5941
6366
  function callDiagnosticsViaDaemon(filePath, options) {
5942
6367
  return callToolViaDaemon("diagnostics", { filePath, severity: "error" }, options);
5943
6368
  }
6369
+ function callFormatViaDaemon(filePath, options) {
6370
+ return callToolViaDaemon("format", { filePath }, options);
6371
+ }
5944
6372
  function currentRequestContext(env = process.env) {
5945
6373
  const cwd = process.cwd();
5946
6374
  const home = env["HOME"] ?? homedir3();
5947
6375
  return parseLspRequestContext({
5948
6376
  cwd,
5949
- projectConfigPaths: [join7(cwd, ".codex", "lsp-client.json")],
5950
- userConfigPath: join7(home, ".codex", "lsp-client.json"),
5951
- installDecisionsPath: join7(home, ".codex", "lsp-install-decisions.json"),
6377
+ projectConfigPaths: [join8(cwd, ".codex", "lsp-client.json")],
6378
+ userConfigPath: join8(home, ".codex", "lsp-client.json"),
6379
+ installDecisionsPath: join8(home, ".codex", "lsp-install-decisions.json"),
5952
6380
  capabilities: { installDecisionTool: true }
5953
6381
  });
5954
6382
  }
@@ -5963,7 +6391,7 @@ function withContext(args, context) {
5963
6391
  function ensureDaemonAvailable(paths, ensure, signal) {
5964
6392
  if (!signal)
5965
6393
  return ensure(paths);
5966
- return new Promise((resolve9, reject) => {
6394
+ return new Promise((resolve, reject) => {
5967
6395
  let settled = false;
5968
6396
  const finish = (run) => {
5969
6397
  if (settled)
@@ -5978,11 +6406,11 @@ function ensureDaemonAvailable(paths, ensure, signal) {
5978
6406
  return;
5979
6407
  }
5980
6408
  signal.addEventListener("abort", onAbort, { once: true });
5981
- Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve9()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
6409
+ Promise.resolve().then(() => ensure(paths, signal)).then(() => finish(() => resolve()), (error) => finish(() => reject(signal.aborted ? new DaemonRequestCancelledError(false) : error)));
5982
6410
  });
5983
6411
  }
5984
6412
  function sendToolCall(paths, token, name, args, options) {
5985
- return new Promise((resolve9, reject) => {
6413
+ return new Promise((resolve, reject) => {
5986
6414
  const socket = connect(paths.socket);
5987
6415
  const requestId = allocateProxyRequestId();
5988
6416
  let settled = false;
@@ -6035,7 +6463,7 @@ function sendToolCall(paths, token, name, args, options) {
6035
6463
  }
6036
6464
  const result = toToolResult(message, requestId);
6037
6465
  if (result)
6038
- finish(() => resolve9(result));
6466
+ finish(() => resolve(result));
6039
6467
  else
6040
6468
  finish(() => reject(new DaemonRequestError("invalid daemon response", requestWritten)));
6041
6469
  });
@@ -6081,18 +6509,15 @@ function isRetryableTool(name) {
6081
6509
  }
6082
6510
 
6083
6511
  // src/client.ts
6084
- import { statSync as statSync5 } from "node:fs";
6085
- import { isAbsolute as isAbsolute5 } from "node:path";
6086
6512
  var OMO_LSP_DAEMON_DIR2 = "OMO_LSP_DAEMON_DIR";
6087
6513
  var OMO_LSP_DAEMON_CLI2 = "OMO_LSP_DAEMON_CLI";
6088
6514
  var OMO_LSP_DAEMON_VERSION2 = "OMO_LSP_DAEMON_VERSION";
6089
6515
  var DAEMON_VERSION_PATTERN2 = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
6090
6516
 
6091
6517
  class InvalidRuntimeOverrideError2 extends Error {
6092
- code = "invalid_runtime_override";
6093
- reason;
6094
6518
  constructor(reason, message) {
6095
6519
  super(message);
6520
+ this.code = "invalid_runtime_override";
6096
6521
  this.name = "InvalidRuntimeOverrideError";
6097
6522
  this.reason = reason;
6098
6523
  }
@@ -6112,12 +6537,12 @@ function resolveDaemonRuntime2(env, defaults) {
6112
6537
  throw new InvalidRuntimeOverrideError2("paired_values_required", `${OMO_LSP_DAEMON_CLI2} and ${OMO_LSP_DAEMON_VERSION2} must be set together`);
6113
6538
  }
6114
6539
  if (!hasCliOverride || !hasVersionOverride) {
6115
- if (!isAbsolute5(defaults.cliPath)) {
6540
+ if (!isAbsolute6(defaults.cliPath)) {
6116
6541
  throw new InvalidRuntimeOverrideError2("packaged_cli_must_be_absolute", "Packaged LSP daemon CLI path must be absolute");
6117
6542
  }
6118
6543
  return { cliPath: defaults.cliPath, version: validateDaemonVersion2(defaults.version) };
6119
6544
  }
6120
- if (!isAbsolute5(cliOverride)) {
6545
+ if (!isAbsolute6(cliOverride)) {
6121
6546
  throw new InvalidRuntimeOverrideError2("cli_must_be_absolute", `${OMO_LSP_DAEMON_CLI2} must be an absolute path to an existing regular file`);
6122
6547
  }
6123
6548
  const stat = statSync5(cliOverride, { throwIfNoEntry: false });
@@ -6135,17 +6560,21 @@ function callToolViaDaemon2(name, args, options) {
6135
6560
  function callDiagnosticsViaDaemon2(filePath, options) {
6136
6561
  return callDiagnosticsViaDaemon(filePath, options);
6137
6562
  }
6563
+ function callFormatViaDaemon2(filePath, options) {
6564
+ return callFormatViaDaemon(filePath, options);
6565
+ }
6138
6566
  function currentRequestContext2(env = process.env) {
6139
6567
  return currentRequestContext(env);
6140
6568
  }
6141
6569
  export {
6142
- validateDaemonVersion2 as validateDaemonVersion,
6143
- resolveDaemonRuntime2 as resolveDaemonRuntime,
6144
- currentRequestContext2 as currentRequestContext,
6145
- callToolViaDaemon2 as callToolViaDaemon,
6146
- callDiagnosticsViaDaemon2 as callDiagnosticsViaDaemon,
6147
- OMO_LSP_DAEMON_VERSION2 as OMO_LSP_DAEMON_VERSION,
6148
- OMO_LSP_DAEMON_DIR2 as OMO_LSP_DAEMON_DIR,
6570
+ InvalidRuntimeOverrideError2 as InvalidRuntimeOverrideError,
6149
6571
  OMO_LSP_DAEMON_CLI2 as OMO_LSP_DAEMON_CLI,
6150
- InvalidRuntimeOverrideError2 as InvalidRuntimeOverrideError
6572
+ OMO_LSP_DAEMON_DIR2 as OMO_LSP_DAEMON_DIR,
6573
+ OMO_LSP_DAEMON_VERSION2 as OMO_LSP_DAEMON_VERSION,
6574
+ callDiagnosticsViaDaemon2 as callDiagnosticsViaDaemon,
6575
+ callFormatViaDaemon2 as callFormatViaDaemon,
6576
+ callToolViaDaemon2 as callToolViaDaemon,
6577
+ currentRequestContext2 as currentRequestContext,
6578
+ resolveDaemonRuntime2 as resolveDaemonRuntime,
6579
+ validateDaemonVersion2 as validateDaemonVersion
6151
6580
  };