oh-my-opencode 4.9.2 → 4.11.0

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 (1799) hide show
  1. package/.agents/skills/codex-qa/SKILL.md +96 -0
  2. package/.agents/skills/codex-qa/references/app-server.md +63 -0
  3. package/.agents/skills/codex-qa/references/components-hooks.md +38 -0
  4. package/.agents/skills/codex-qa/references/docker-qa.md +62 -0
  5. package/.agents/skills/codex-qa/references/install-verify.md +57 -0
  6. package/.agents/skills/codex-qa/references/isolation.md +57 -0
  7. package/.agents/skills/codex-qa/references/logging-debug.md +60 -0
  8. package/.agents/skills/codex-qa/scripts/app-server-drive.sh +76 -0
  9. package/.agents/skills/codex-qa/scripts/hook-unit-probe.sh +69 -0
  10. package/.agents/skills/codex-qa/scripts/install-verify.sh +60 -0
  11. package/.agents/skills/codex-qa/scripts/lib/app-server-client.mjs +117 -0
  12. package/.agents/skills/codex-qa/scripts/lib/common.sh +180 -0
  13. package/.agents/skills/codex-qa/scripts/lib/mock-model.mjs +56 -0
  14. package/.agents/skills/codex-qa/scripts/tui-smoke.sh +71 -0
  15. package/.agents/skills/opencode-qa/SKILL.md +8 -1
  16. package/.agents/skills/opencode-qa/references/docker-qa.md +72 -0
  17. package/.agents/skills/opencode-qa/scripts/lib/common.sh +39 -1
  18. package/.agents/skills/tech-debt-audit/SKILL.md +277 -0
  19. package/.agents/skills/work-with-pr/SKILL.md +77 -53
  20. package/.agents/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/execution-plan.md +1 -1
  21. package/.opencode/skills/work-with-pr/SKILL.md +79 -55
  22. package/.opencode/skills/work-with-pr-workspace/iteration-1/eval-5/with_skill/outputs/execution-plan.md +1 -1
  23. package/README.ja.md +3 -3
  24. package/README.ko.md +3 -3
  25. package/README.md +2 -2
  26. package/README.ru.md +3 -3
  27. package/README.zh-cn.md +3 -3
  28. package/THIRD-PARTY-NOTICES.md +205 -0
  29. package/bin/platform.js +5 -0
  30. package/bin/platform.test.ts +56 -0
  31. package/dist/agents/atlas/agent.d.ts +4 -3
  32. package/dist/agents/dynamic-agent-prompt-types.d.ts +1 -1
  33. package/dist/agents/gpt-apply-patch-guard.d.ts +2 -2
  34. package/dist/agents/hephaestus/agent.d.ts +5 -0
  35. package/dist/agents/hephaestus/index.d.ts +1 -1
  36. package/dist/agents/index.d.ts +0 -1
  37. package/dist/agents/metis.d.ts +1 -0
  38. package/dist/agents/prometheus/index.d.ts +0 -1
  39. package/dist/agents/prometheus/system-prompt.d.ts +0 -2
  40. package/dist/agents/sisyphus/kimi-k2-7.d.ts +17 -0
  41. package/dist/agents/sisyphus-junior/agent.d.ts +1 -1
  42. package/dist/agents/sisyphus-junior/kimi-k2-7.d.ts +11 -0
  43. package/dist/agents/types.d.ts +2 -2
  44. package/dist/cli/config-manager/add-tui-plugin-to-tui-config.d.ts +7 -0
  45. package/dist/cli/doctor/checks/codex-components.d.ts +13 -0
  46. package/dist/cli/doctor/checks/codex-runtime-wrapper.d.ts +7 -0
  47. package/dist/cli/doctor/checks/codex.d.ts +1 -1
  48. package/dist/cli/doctor/checks/config.d.ts +1 -1
  49. package/dist/cli/doctor/checks/dependencies.d.ts +1 -2
  50. package/dist/cli/doctor/checks/index.d.ts +1 -1
  51. package/dist/cli/doctor/checks/model-resolution.d.ts +1 -1
  52. package/dist/cli/doctor/checks/system.d.ts +1 -1
  53. package/dist/cli/doctor/checks/team-mode.d.ts +1 -1
  54. package/dist/cli/doctor/checks/tools-gh.d.ts +1 -1
  55. package/dist/cli/doctor/checks/tools-mcp.d.ts +1 -1
  56. package/dist/cli/doctor/checks/tools.d.ts +2 -1
  57. package/dist/cli/doctor/checks/tui-plugin-config.d.ts +8 -1
  58. package/dist/cli/doctor/framework/constants.d.ts +32 -0
  59. package/dist/cli/doctor/framework/spawn-with-timeout.d.ts +8 -0
  60. package/dist/cli/doctor/framework/types.d.ts +147 -0
  61. package/dist/cli/doctor/index.d.ts +4 -4
  62. package/dist/cli/doctor/runner.d.ts +1 -1
  63. package/dist/cli/index.js +10353 -7521
  64. package/dist/cli/install-ast-grep-sg.d.ts +10 -0
  65. package/dist/cli/install-codex/codex-cache-bins.d.ts +1 -21
  66. package/dist/cli/install-codex/codex-cache-bundled-mcps.d.ts +1 -5
  67. package/dist/cli/install-codex/codex-cache-command-shim.d.ts +1 -1
  68. package/dist/cli/install-codex/codex-cache-fs.d.ts +1 -3
  69. package/dist/cli/install-codex/codex-cache-install.d.ts +1 -13
  70. package/dist/cli/install-codex/codex-cache-legacy-bins.d.ts +1 -3
  71. package/dist/cli/install-codex/codex-cache-local-dependencies.d.ts +1 -1
  72. package/dist/cli/install-codex/codex-cache-mcp-manifest.d.ts +1 -2
  73. package/dist/cli/install-codex/codex-cache-paths.d.ts +1 -2
  74. package/dist/cli/install-codex/codex-cache-prune.d.ts +1 -10
  75. package/dist/cli/install-codex/codex-cache.d.ts +1 -4
  76. package/dist/cli/install-codex/codex-cached-marketplace-manifest.d.ts +1 -6
  77. package/dist/cli/install-codex/codex-cleanup-config.d.ts +1 -6
  78. package/dist/cli/install-codex/codex-cleanup.d.ts +1 -21
  79. package/dist/cli/install-codex/codex-config-agents.d.ts +1 -3
  80. package/dist/cli/install-codex/codex-config-features.d.ts +1 -1
  81. package/dist/cli/install-codex/codex-config-marketplaces.d.ts +1 -6
  82. package/dist/cli/install-codex/codex-config-permissions.d.ts +1 -1
  83. package/dist/cli/install-codex/codex-config-plugins.d.ts +1 -9
  84. package/dist/cli/install-codex/codex-config-reasoning.d.ts +1 -2
  85. package/dist/cli/install-codex/codex-config-toml-sections.d.ts +1 -9
  86. package/dist/cli/install-codex/codex-config-toml.d.ts +1 -13
  87. package/dist/cli/install-codex/codex-hook-trust.d.ts +1 -6
  88. package/dist/cli/install-codex/codex-installation-detection.d.ts +1 -36
  89. package/dist/cli/install-codex/codex-installer-bin-dir.d.ts +1 -8
  90. package/dist/cli/install-codex/codex-marketplace-snapshot.d.ts +1 -15
  91. package/dist/cli/install-codex/codex-marketplace.d.ts +1 -9
  92. package/dist/cli/install-codex/codex-model-catalog.d.ts +1 -13
  93. package/dist/cli/install-codex/codex-multi-agent-v2-config.d.ts +1 -12
  94. package/dist/cli/install-codex/codex-package-layout.d.ts +1 -1
  95. package/dist/cli/install-codex/codex-process.d.ts +1 -7
  96. package/dist/cli/install-codex/codex-project-local-cleanup-best-effort.d.ts +1 -7
  97. package/dist/cli/install-codex/codex-project-local-cleanup.d.ts +1 -35
  98. package/dist/cli/install-codex/git-bash.d.ts +1 -35
  99. package/dist/cli/install-codex/index.d.ts +1 -11
  100. package/dist/cli/install-codex/install-codex-test-fixtures.d.ts +34 -0
  101. package/dist/cli/install-codex/install-codex.d.ts +1 -10
  102. package/dist/cli/install-codex/lazycodex-version-stamp.d.ts +1 -19
  103. package/dist/cli/install-codex/link-cached-plugin-agents.d.ts +1 -16
  104. package/dist/cli/install-codex/lsp-daemon-reaper.d.ts +1 -5
  105. package/dist/cli/install-codex/toml-section-editor.d.ts +1 -11
  106. package/dist/cli/install-codex/types.d.ts +1 -76
  107. package/dist/cli/mcp-oauth/login.d.ts +1 -1
  108. package/dist/cli/model-fallback.d.ts +1 -0
  109. package/dist/cli/provider-availability.d.ts +2 -0
  110. package/dist/cli-node/index.js +10433 -7546
  111. package/dist/config/index.d.ts +1 -1
  112. package/dist/config/schema/agent-names.d.ts +1 -1
  113. package/dist/config/schema/agent-overrides.d.ts +80 -16
  114. package/dist/config/schema/codegraph.d.ts +9 -0
  115. package/dist/config/schema/experimental.d.ts +0 -1
  116. package/dist/config/schema/git-env-prefix.d.ts +1 -5
  117. package/dist/config/schema/hooks.d.ts +3 -1
  118. package/dist/config/schema/internal/permission.d.ts +5 -1
  119. package/dist/config/schema/monitor.d.ts +15 -0
  120. package/dist/config/schema/oh-my-opencode-config.d.ts +102 -32
  121. package/dist/config/schema/openclaw.d.ts +5 -4
  122. package/dist/config/schema/team-mode.d.ts +1 -16
  123. package/dist/config/schema/tmux.d.ts +4 -5
  124. package/dist/config/schema/tui.d.ts +10 -0
  125. package/dist/config/schema.d.ts +2 -0
  126. package/dist/config/validate.d.ts +8 -0
  127. package/dist/create-hooks.d.ts +5 -1
  128. package/dist/create-managers.d.ts +7 -0
  129. package/dist/create-runtime-tmux-config.d.ts +1 -1
  130. package/dist/create-tools.d.ts +1 -1
  131. package/dist/features/background-agent/error-classifier.d.ts +2 -2
  132. package/dist/features/background-agent/index.d.ts +1 -1
  133. package/dist/features/background-agent/manager.d.ts +35 -2
  134. package/dist/features/background-agent/parent-wake-dispatched-tracker.d.ts +8 -0
  135. package/dist/features/background-agent/parent-wake-notifier.d.ts +4 -0
  136. package/dist/features/background-agent/spawner/fallback-agent.d.ts +3 -2
  137. package/dist/features/background-agent/spawner/task-prompt-body.d.ts +5 -6
  138. package/dist/features/background-agent/task-snapshot.d.ts +2 -0
  139. package/dist/features/background-agent/types.d.ts +9 -0
  140. package/dist/features/builtin-commands/templates/refactor-sections/intro-and-analysis.d.ts +1 -1
  141. package/dist/features/builtin-commands/templates/refactor-sections/plan-and-execution.d.ts +1 -1
  142. package/dist/features/builtin-commands/templates/refactor-sections/team-mode-addendum.d.ts +1 -1
  143. package/dist/features/builtin-commands/templates/refactor-sections/verification-and-tooling.d.ts +1 -1
  144. package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -1
  145. package/dist/features/builtin-skills/index.d.ts +1 -2
  146. package/dist/features/builtin-skills/skill-file-loader.d.ts +1 -4
  147. package/dist/features/builtin-skills/skills/agent-browser-skill.d.ts +1 -2
  148. package/dist/features/builtin-skills/skills/agent-browser-template.d.ts +1 -2
  149. package/dist/features/builtin-skills/skills/debugging.d.ts +1 -2
  150. package/dist/features/builtin-skills/skills/dev-browser.d.ts +1 -2
  151. package/dist/features/builtin-skills/skills/frontend.d.ts +1 -0
  152. package/dist/features/builtin-skills/skills/git-master-sections/commit-atomic-planning.d.ts +1 -1
  153. package/dist/features/builtin-skills/skills/git-master-sections/commit-context-analysis.d.ts +1 -1
  154. package/dist/features/builtin-skills/skills/git-master-sections/commit-execution-verification.d.ts +1 -1
  155. package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +1 -1
  156. package/dist/features/builtin-skills/skills/git-master-sections/history-search-workflow.d.ts +1 -1
  157. package/dist/features/builtin-skills/skills/git-master-sections/overview.d.ts +1 -1
  158. package/dist/features/builtin-skills/skills/git-master-sections/quick-reference.d.ts +1 -1
  159. package/dist/features/builtin-skills/skills/git-master-sections/rebase-workflow.d.ts +1 -1
  160. package/dist/features/builtin-skills/skills/git-master-skill-metadata.d.ts +1 -2
  161. package/dist/features/builtin-skills/skills/git-master.d.ts +1 -2
  162. package/dist/features/builtin-skills/skills/index.d.ts +1 -13
  163. package/dist/features/builtin-skills/skills/init-deep.d.ts +1 -2
  164. package/dist/features/builtin-skills/skills/playwright-cli.d.ts +1 -10
  165. package/dist/features/builtin-skills/skills/playwright-mcp-skill.d.ts +1 -2
  166. package/dist/features/builtin-skills/skills/playwright.d.ts +1 -2
  167. package/dist/features/builtin-skills/skills/remove-ai-slops.d.ts +1 -2
  168. package/dist/features/builtin-skills/skills/review-work.d.ts +1 -2
  169. package/dist/features/builtin-skills/skills/security-research.d.ts +1 -2
  170. package/dist/features/builtin-skills/skills/security-review.d.ts +1 -2
  171. package/dist/features/builtin-skills/skills/team-mode.d.ts +1 -2
  172. package/dist/features/builtin-skills/skills/visual-qa.d.ts +1 -2
  173. package/dist/features/builtin-skills/skills.d.ts +1 -12
  174. package/dist/features/builtin-skills/types.d.ts +1 -15
  175. package/dist/features/claude-code-agent-loader/agent-definitions-loader.d.ts +1 -3
  176. package/dist/features/claude-code-agent-loader/claude-model-mapper.d.ts +1 -4
  177. package/dist/features/claude-code-agent-loader/index.d.ts +1 -5
  178. package/dist/features/claude-code-agent-loader/json-agent-loader.d.ts +1 -2
  179. package/dist/features/claude-code-agent-loader/loader.d.ts +1 -5
  180. package/dist/features/claude-code-agent-loader/opencode-config-agents-reader.d.ts +1 -2
  181. package/dist/features/claude-code-agent-loader/types.d.ts +1 -29
  182. package/dist/features/claude-code-command-loader/index.d.ts +1 -2
  183. package/dist/features/claude-code-command-loader/loader-cache.d.ts +1 -6
  184. package/dist/features/claude-code-command-loader/loader.d.ts +1 -8
  185. package/dist/features/claude-code-command-loader/types.d.ts +1 -42
  186. package/dist/features/claude-code-mcp-loader/configure-allowed-env-vars.d.ts +1 -5
  187. package/dist/features/claude-code-mcp-loader/index.d.ts +1 -11
  188. package/dist/features/claude-code-mcp-loader/loader.d.ts +1 -4
  189. package/dist/features/claude-code-mcp-loader/scope-filter.d.ts +1 -2
  190. package/dist/features/claude-code-mcp-loader/transformer.d.ts +1 -2
  191. package/dist/features/claude-code-mcp-loader/types.d.ts +1 -43
  192. package/dist/features/claude-code-plugin-loader/agent-loader.d.ts +1 -3
  193. package/dist/features/claude-code-plugin-loader/command-loader.d.ts +1 -3
  194. package/dist/features/claude-code-plugin-loader/discovery-core.d.ts +1 -2
  195. package/dist/features/claude-code-plugin-loader/discovery-paths.d.ts +1 -3
  196. package/dist/features/claude-code-plugin-loader/discovery.d.ts +1 -3
  197. package/dist/features/claude-code-plugin-loader/hook-loader.d.ts +1 -2
  198. package/dist/features/claude-code-plugin-loader/index.d.ts +1 -10
  199. package/dist/features/claude-code-plugin-loader/install-path-resolver.d.ts +1 -1
  200. package/dist/features/claude-code-plugin-loader/installed-plugin-database.d.ts +1 -3
  201. package/dist/features/claude-code-plugin-loader/loaded-plugin.d.ts +1 -2
  202. package/dist/features/claude-code-plugin-loader/loader.d.ts +1 -36
  203. package/dist/features/claude-code-plugin-loader/mcp-server-loader.d.ts +1 -3
  204. package/dist/features/claude-code-plugin-loader/plugin-key.d.ts +1 -1
  205. package/dist/features/claude-code-plugin-loader/plugin-manifest.d.ts +1 -4
  206. package/dist/features/claude-code-plugin-loader/plugin-path-resolver.d.ts +1 -2
  207. package/dist/features/claude-code-plugin-loader/plugin-settings.d.ts +1 -3
  208. package/dist/features/claude-code-plugin-loader/scope-filter.d.ts +1 -2
  209. package/dist/features/claude-code-plugin-loader/skill-loader.d.ts +1 -3
  210. package/dist/features/claude-code-plugin-loader/types.d.ts +1 -237
  211. package/dist/features/claude-code-session-state/state.d.ts +1 -0
  212. package/dist/features/claude-tasks/types.d.ts +4 -4
  213. package/dist/features/hook-message-injector/sdk-message-lookup.d.ts +9 -2
  214. package/dist/features/mcp-oauth/callback-server.d.ts +1 -19
  215. package/dist/features/mcp-oauth/dcr.d.ts +1 -34
  216. package/dist/features/mcp-oauth/discovery.d.ts +1 -8
  217. package/dist/features/mcp-oauth/oauth-authorization-flow.d.ts +1 -26
  218. package/dist/features/mcp-oauth/provider.d.ts +1 -30
  219. package/dist/features/mcp-oauth/refresh-mutex.d.ts +1 -26
  220. package/dist/features/mcp-oauth/resource-indicator.d.ts +1 -0
  221. package/dist/features/mcp-oauth/schema.d.ts +1 -0
  222. package/dist/features/mcp-oauth/step-up.d.ts +1 -8
  223. package/dist/features/mcp-oauth/storage.d.ts +1 -17
  224. package/dist/features/monitor/batcher.d.ts +36 -0
  225. package/dist/features/monitor/envelope.d.ts +9 -0
  226. package/dist/features/monitor/filter.d.ts +10 -0
  227. package/dist/features/monitor/index.d.ts +2 -0
  228. package/dist/features/monitor/line-stream.d.ts +29 -0
  229. package/dist/features/monitor/manager-internals.d.ts +65 -0
  230. package/dist/features/monitor/manager.d.ts +35 -0
  231. package/dist/features/monitor/monitor-state-factory.d.ts +24 -0
  232. package/dist/features/monitor/output-injector-session-inspect.d.ts +9 -0
  233. package/dist/features/monitor/output-injector-types.d.ts +48 -0
  234. package/dist/features/monitor/output-injector.d.ts +21 -0
  235. package/dist/features/monitor/permission.d.ts +33 -0
  236. package/dist/features/monitor/pipeline.d.ts +26 -0
  237. package/dist/features/monitor/process.d.ts +21 -0
  238. package/dist/features/monitor/ring-buffer.d.ts +25 -0
  239. package/dist/features/monitor/types.d.ts +83 -0
  240. package/dist/features/opencode-runtime-skills/index.d.ts +1 -2
  241. package/dist/features/opencode-runtime-skills/runtime-skill-config.d.ts +1 -17
  242. package/dist/features/opencode-runtime-skills/skill-markdown.d.ts +1 -7
  243. package/dist/features/opencode-runtime-skills/source-server.d.ts +1 -24
  244. package/dist/features/opencode-skill-loader/allowed-tools-parser.d.ts +1 -1
  245. package/dist/features/opencode-skill-loader/config-source-discovery.d.ts +1 -7
  246. package/dist/features/opencode-skill-loader/git-master-template-injection.d.ts +1 -20
  247. package/dist/features/opencode-skill-loader/index.d.ts +1 -16
  248. package/dist/features/opencode-skill-loader/loaded-skill-from-path.d.ts +1 -9
  249. package/dist/features/opencode-skill-loader/loaded-skill-template-extractor.d.ts +1 -2
  250. package/dist/features/opencode-skill-loader/loader.d.ts +1 -21
  251. package/dist/features/opencode-skill-loader/merger/builtin-skill-converter.d.ts +1 -3
  252. package/dist/features/opencode-skill-loader/merger/config-skill-entry-loader.d.ts +1 -3
  253. package/dist/features/opencode-skill-loader/merger/scope-priority.d.ts +1 -2
  254. package/dist/features/opencode-skill-loader/merger/skill-definition-merger.d.ts +1 -3
  255. package/dist/features/opencode-skill-loader/merger/skills-config-normalizer.d.ts +1 -11
  256. package/dist/features/opencode-skill-loader/merger.d.ts +1 -7
  257. package/dist/features/opencode-skill-loader/opencode-config-skills-reader.d.ts +1 -5
  258. package/dist/features/opencode-skill-loader/skill-content.d.ts +1 -5
  259. package/dist/features/opencode-skill-loader/skill-deduplication.d.ts +1 -2
  260. package/dist/features/opencode-skill-loader/skill-definition-record.d.ts +1 -5
  261. package/dist/features/opencode-skill-loader/skill-directory-loader.d.ts +1 -8
  262. package/dist/features/opencode-skill-loader/skill-discovery.d.ts +1 -4
  263. package/dist/features/opencode-skill-loader/skill-mcp-config.d.ts +1 -3
  264. package/dist/features/opencode-skill-loader/skill-resolution-options.d.ts +1 -9
  265. package/dist/features/opencode-skill-loader/skill-template-resolver.d.ts +1 -11
  266. package/dist/features/opencode-skill-loader/types.d.ts +1 -34
  267. package/dist/features/skill-mcp-manager/cleanup.d.ts +1 -8
  268. package/dist/features/skill-mcp-manager/connection-type.d.ts +1 -7
  269. package/dist/features/skill-mcp-manager/connection.d.ts +1 -14
  270. package/dist/features/skill-mcp-manager/env-cleaner.d.ts +1 -2
  271. package/dist/features/skill-mcp-manager/error-redaction.d.ts +1 -10
  272. package/dist/features/skill-mcp-manager/http-client.d.ts +1 -19
  273. package/dist/features/skill-mcp-manager/index.d.ts +1 -2
  274. package/dist/features/skill-mcp-manager/manager.d.ts +1 -23
  275. package/dist/features/skill-mcp-manager/oauth-handler.d.ts +1 -17
  276. package/dist/features/skill-mcp-manager/stdio-client.d.ts +1 -16
  277. package/dist/features/skill-mcp-manager/types.d.ts +1 -79
  278. package/dist/features/team-mode/member-parser.d.ts +1 -16
  279. package/dist/features/team-mode/team-layout-tmux/close-team-member-pane.d.ts +1 -4
  280. package/dist/features/team-mode/team-layout-tmux/index.d.ts +1 -1
  281. package/dist/features/team-mode/team-layout-tmux/layout.d.ts +1 -37
  282. package/dist/features/team-mode/team-layout-tmux/rebalance-team-window.d.ts +1 -9
  283. package/dist/features/team-mode/team-layout-tmux/resolve-caller-tmux-session.d.ts +1 -9
  284. package/dist/features/team-mode/team-layout-tmux/sweep-stale-team-sessions.d.ts +1 -8
  285. package/dist/features/team-mode/team-mailbox/ack.d.ts +1 -2
  286. package/dist/features/team-mode/team-mailbox/inbox.d.ts +1 -3
  287. package/dist/features/team-mode/team-mailbox/index.d.ts +1 -7
  288. package/dist/features/team-mode/team-mailbox/pending-delivery-recovery.d.ts +1 -0
  289. package/dist/features/team-mode/team-mailbox/poll.d.ts +1 -10
  290. package/dist/features/team-mode/team-mailbox/reservation.d.ts +1 -11
  291. package/dist/features/team-mode/team-mailbox/send.d.ts +1 -30
  292. package/dist/features/team-mode/team-registry/index.d.ts +1 -3
  293. package/dist/features/team-mode/team-registry/loader.d.ts +1 -12
  294. package/dist/features/team-mode/team-registry/paths.d.ts +1 -28
  295. package/dist/features/team-mode/team-registry/team-spec-input-normalizer.d.ts +1 -6
  296. package/dist/features/team-mode/team-registry/validator.d.ts +1 -10
  297. package/dist/features/team-mode/team-runtime/delete-team.d.ts +2 -1
  298. package/dist/features/team-mode/team-runtime/shutdown-helpers.d.ts +1 -1
  299. package/dist/features/team-mode/team-state-store/active-resume.d.ts +1 -5
  300. package/dist/features/team-mode/team-state-store/creating-resume.d.ts +1 -4
  301. package/dist/features/team-mode/team-state-store/deleting-resume.d.ts +1 -4
  302. package/dist/features/team-mode/team-state-store/error-normalization.d.ts +1 -2
  303. package/dist/features/team-mode/team-state-store/index.d.ts +1 -1
  304. package/dist/features/team-mode/team-state-store/locks.d.ts +1 -15
  305. package/dist/features/team-mode/team-state-store/reservation-reconciliation.d.ts +1 -4
  306. package/dist/features/team-mode/team-state-store/resume-report.d.ts +1 -7
  307. package/dist/features/team-mode/team-state-store/resume.d.ts +1 -5
  308. package/dist/features/team-mode/team-state-store/runtime-cleanup.d.ts +1 -4
  309. package/dist/features/team-mode/team-state-store/session-liveness.d.ts +1 -9
  310. package/dist/features/team-mode/team-state-store/store.d.ts +1 -21
  311. package/dist/features/team-mode/team-state-store/worker-resume-status.d.ts +1 -9
  312. package/dist/features/team-mode/team-tasklist/claim.d.ts +1 -10
  313. package/dist/features/team-mode/team-tasklist/dependencies.d.ts +1 -2
  314. package/dist/features/team-mode/team-tasklist/get.d.ts +1 -3
  315. package/dist/features/team-mode/team-tasklist/index.d.ts +1 -6
  316. package/dist/features/team-mode/team-tasklist/list.d.ts +1 -8
  317. package/dist/features/team-mode/team-tasklist/store.d.ts +1 -3
  318. package/dist/features/team-mode/team-tasklist/test-support.d.ts +1 -9
  319. package/dist/features/team-mode/team-tasklist/update.d.ts +1 -9
  320. package/dist/features/team-mode/team-worktree/cleanup.d.ts +1 -3
  321. package/dist/features/team-mode/team-worktree/index.d.ts +1 -2
  322. package/dist/features/team-mode/team-worktree/manager.d.ts +1 -15
  323. package/dist/features/team-mode/tools/lifecycle-create-tool.d.ts +2 -2
  324. package/dist/features/team-mode/tools/lifecycle-inline-spec.d.ts +4 -4
  325. package/dist/features/team-mode/tools/lifecycle-participant.d.ts +2 -2
  326. package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +8 -8
  327. package/dist/features/team-mode/tools/messaging-live-delivery-recipient.d.ts +2 -2
  328. package/dist/features/team-mode/tools/messaging-live-delivery-reservation.d.ts +1 -1
  329. package/dist/features/team-mode/tools/messaging-live-delivery-state.d.ts +1 -1
  330. package/dist/features/team-mode/tools/messaging-live-delivery.d.ts +1 -1
  331. package/dist/features/team-mode/tools/messaging-runtime.d.ts +2 -2
  332. package/dist/features/team-mode/tools/query.d.ts +3 -3
  333. package/dist/features/team-mode/tools/tasks.d.ts +2 -2
  334. package/dist/features/team-mode/types.d.ts +1 -343
  335. package/dist/features/tmux-subagent/stale-tmux-resource-sweeper.d.ts +12 -0
  336. package/dist/features/tool-metadata-store/store.d.ts +5 -0
  337. package/dist/features/tui-sidebar/compute-view.d.ts +10 -0
  338. package/dist/features/tui-sidebar/config-validator.d.ts +2 -0
  339. package/dist/features/tui-sidebar/constants.d.ts +10 -0
  340. package/dist/features/tui-sidebar/derivers.d.ts +10 -0
  341. package/dist/features/tui-sidebar/element-helpers.d.ts +9 -0
  342. package/dist/features/tui-sidebar/loop-reader.d.ts +2 -0
  343. package/dist/features/tui-sidebar/mirror-io.d.ts +3 -0
  344. package/dist/features/tui-sidebar/mirror-manager.d.ts +28 -0
  345. package/dist/features/tui-sidebar/mirror-path.d.ts +3 -0
  346. package/dist/features/tui-sidebar/render-view.d.ts +15 -0
  347. package/dist/features/tui-sidebar/roster-resolver.d.ts +2 -0
  348. package/dist/features/tui-sidebar/snapshot-builder.d.ts +28 -0
  349. package/dist/features/tui-sidebar/snapshot-schema.d.ts +41 -0
  350. package/dist/features/tui-sidebar/state-types.d.ts +72 -0
  351. package/dist/hooks/anthropic-context-window-limit-recovery/storage/constants.d.ts +3 -0
  352. package/dist/hooks/anthropic-context-window-limit-recovery/storage/messages-reader.d.ts +6 -0
  353. package/dist/hooks/anthropic-context-window-limit-recovery/storage/part-content.d.ts +3 -0
  354. package/dist/hooks/anthropic-context-window-limit-recovery/storage/parts-reader.d.ts +6 -0
  355. package/dist/hooks/anthropic-context-window-limit-recovery/storage/types.d.ts +92 -0
  356. package/dist/hooks/ast-grep-sg-provision/hook.d.ts +19 -0
  357. package/dist/hooks/ast-grep-sg-provision/index.d.ts +1 -0
  358. package/dist/hooks/auto-slash-command/constants.d.ts +1 -5
  359. package/dist/hooks/auto-slash-command/detector.d.ts +1 -15
  360. package/dist/hooks/auto-slash-command/processed-command-store.d.ts +1 -7
  361. package/dist/hooks/auto-slash-command/types.d.ts +1 -48
  362. package/dist/hooks/auto-update-checker/checker/bundled-version.d.ts +1 -0
  363. package/dist/hooks/auto-update-checker/checker.d.ts +1 -0
  364. package/dist/hooks/auto-update-checker/constants.d.ts +3 -3
  365. package/dist/hooks/auto-update-checker/hook.d.ts +2 -1
  366. package/dist/hooks/claude-code-hooks/types.d.ts +4 -0
  367. package/dist/hooks/codegraph-bootstrap/command-runner.d.ts +16 -0
  368. package/dist/hooks/codegraph-bootstrap/hook.d.ts +34 -0
  369. package/dist/hooks/codegraph-bootstrap/index.d.ts +1 -0
  370. package/dist/hooks/codegraph-bootstrap/project-root.d.ts +1 -0
  371. package/dist/hooks/codegraph-bootstrap/status.d.ts +11 -0
  372. package/dist/hooks/delegate-task-retry/guidance.d.ts +1 -2
  373. package/dist/hooks/delegate-task-retry/patterns.d.ts +2 -11
  374. package/dist/hooks/index.d.ts +3 -1
  375. package/dist/hooks/monitor-status-injector/hook.d.ts +30 -0
  376. package/dist/hooks/monitor-status-injector/index.d.ts +2 -0
  377. package/dist/hooks/runtime-fallback/auto-retry-signal.d.ts +1 -4
  378. package/dist/hooks/runtime-fallback/error-classifier.d.ts +7 -6
  379. package/dist/hooks/runtime-fallback/fallback-state.d.ts +3 -2
  380. package/dist/hooks/runtime-fallback/test-timeout-clock.test-support.d.ts +6 -0
  381. package/dist/hooks/team-session-events/team-idle-wake-hint.d.ts +5 -0
  382. package/dist/hooks/tool-pair-validator/tool-part-ids.d.ts +2 -1
  383. package/dist/index.js +89683 -94718
  384. package/dist/interactive-bash-availability.d.ts +1 -0
  385. package/dist/mcp/codegraph.d.ts +16 -0
  386. package/dist/mcp/index.d.ts +10 -2
  387. package/dist/mcp/shared/ancestor-cli-resolver.d.ts +25 -0
  388. package/dist/mcp/types.d.ts +1 -1
  389. package/dist/oh-my-opencode.schema.json +259 -34
  390. package/dist/openclaw/config.d.ts +1 -8
  391. package/dist/openclaw/daemon.d.ts +1 -1
  392. package/dist/openclaw/dispatcher.d.ts +1 -12
  393. package/dist/openclaw/gateway-url-validation.d.ts +1 -1
  394. package/dist/openclaw/index.d.ts +1 -5
  395. package/dist/openclaw/reply-listener-discord.d.ts +1 -4
  396. package/dist/openclaw/reply-listener-injection.d.ts +1 -10
  397. package/dist/openclaw/reply-listener-log.d.ts +1 -2
  398. package/dist/openclaw/reply-listener-paths.d.ts +1 -7
  399. package/dist/openclaw/reply-listener-poll-loop.d.ts +1 -3
  400. package/dist/openclaw/reply-listener-process.d.ts +1 -4
  401. package/dist/openclaw/reply-listener-signature.d.ts +1 -2
  402. package/dist/openclaw/reply-listener-sleep.d.ts +1 -1
  403. package/dist/openclaw/reply-listener-spawn.d.ts +1 -5
  404. package/dist/openclaw/reply-listener-start.d.ts +1 -9
  405. package/dist/openclaw/reply-listener-startup.d.ts +1 -12
  406. package/dist/openclaw/reply-listener-state.d.ts +1 -29
  407. package/dist/openclaw/reply-listener-status.d.ts +1 -4
  408. package/dist/openclaw/reply-listener-stop.d.ts +1 -7
  409. package/dist/openclaw/reply-listener-telegram.d.ts +1 -4
  410. package/dist/openclaw/reply-listener.d.ts +1 -5
  411. package/dist/openclaw/runtime-dispatch.d.ts +1 -17
  412. package/dist/openclaw/session-registry-lock.d.ts +1 -2
  413. package/dist/openclaw/session-registry-paths.d.ts +1 -9
  414. package/dist/openclaw/session-registry-storage.d.ts +1 -4
  415. package/dist/openclaw/session-registry-types.d.ts +1 -11
  416. package/dist/openclaw/session-registry.d.ts +1 -8
  417. package/dist/openclaw/tmux.d.ts +1 -8
  418. package/dist/openclaw/types.d.ts +1 -42
  419. package/dist/plugin/build-team-idle-wake-hint-client.d.ts +2 -0
  420. package/dist/plugin/event-error-utils.d.ts +2 -1
  421. package/dist/plugin/event-session-lifecycle.d.ts +0 -3
  422. package/dist/plugin/hooks/create-continuation-hooks.d.ts +0 -6
  423. package/dist/plugin/hooks/create-core-hooks.d.ts +5 -1
  424. package/dist/plugin/hooks/create-session-hooks.d.ts +3 -2
  425. package/dist/plugin/hooks/create-transform-hooks.d.ts +4 -1
  426. package/dist/plugin/messages-transform.d.ts +1 -0
  427. package/dist/plugin/skill-context.d.ts +2 -0
  428. package/dist/plugin/tool-registry-factories.d.ts +2 -1
  429. package/dist/plugin/tool-registry-gated-tools.d.ts +7 -0
  430. package/dist/plugin/tool-registry.d.ts +1 -1
  431. package/dist/plugin/types.d.ts +2 -9
  432. package/dist/plugin-handlers/prometheus-agent-config-builder.d.ts +1 -0
  433. package/dist/shared/archive-entry-validator.d.ts +1 -6
  434. package/dist/shared/bun-file-shim.d.ts +1 -8
  435. package/dist/shared/bun-spawn-shim.d.ts +1 -43
  436. package/dist/shared/bun-which-shim.d.ts +1 -1
  437. package/dist/shared/classify-path-environment.d.ts +1 -3
  438. package/dist/shared/command-executor/embedded-commands.d.ts +1 -7
  439. package/dist/shared/command-executor/execute-command.d.ts +1 -1
  440. package/dist/shared/command-executor/execute-hook-command.d.ts +1 -16
  441. package/dist/shared/command-executor/home-directory.d.ts +1 -1
  442. package/dist/shared/command-executor/resolve-commands-in-text.d.ts +1 -1
  443. package/dist/shared/command-executor/shell-path.d.ts +1 -2
  444. package/dist/shared/command-executor.d.ts +1 -4
  445. package/dist/shared/git-worktree/collect-git-diff-stats.d.ts +1 -2
  446. package/dist/shared/git-worktree/format-file-changes.d.ts +1 -2
  447. package/dist/shared/git-worktree/index.d.ts +1 -7
  448. package/dist/shared/git-worktree/parse-diff-numstat.d.ts +1 -2
  449. package/dist/shared/git-worktree/parse-status-porcelain-line.d.ts +1 -6
  450. package/dist/shared/git-worktree/parse-status-porcelain.d.ts +1 -2
  451. package/dist/shared/git-worktree/types.d.ts +1 -7
  452. package/dist/shared/internal-initiator-marker.d.ts +1 -46
  453. package/dist/shared/logger.d.ts +3 -11
  454. package/dist/shared/migration/agent-category.d.ts +1 -19
  455. package/dist/shared/migration/agent-names.d.ts +1 -6
  456. package/dist/shared/migration/config-migration.d.ts +1 -1
  457. package/dist/shared/migration/hook-names.d.ts +1 -6
  458. package/dist/shared/migration/migrations-sidecar.d.ts +1 -41
  459. package/dist/shared/migration/model-versions.d.ts +1 -22
  460. package/dist/shared/migration.d.ts +1 -5
  461. package/dist/shared/model-suggestion-retry.d.ts +39 -17
  462. package/dist/shared/plugin-identity.d.ts +8 -8
  463. package/dist/shared/posthog.d.ts +3 -0
  464. package/dist/shared/process-stream-reader.d.ts +1 -3
  465. package/dist/shared/prompt-async-gate/message-inspection-error.d.ts +1 -1
  466. package/dist/shared/prompt-async-gate/pending-tool-turn.d.ts +1 -11
  467. package/dist/shared/prompt-async-gate/prompt-message-state.d.ts +1 -9
  468. package/dist/shared/prompt-async-gate/queue.d.ts +1 -8
  469. package/dist/shared/prompt-async-gate/recent-dispatches.d.ts +1 -14
  470. package/dist/shared/prompt-async-gate/reservations.d.ts +1 -9
  471. package/dist/shared/prompt-async-gate/semantic-dedupe.d.ts +1 -7
  472. package/dist/shared/prompt-async-gate/session-idle-dispatch.d.ts +1 -16
  473. package/dist/shared/prompt-async-gate/timing.d.ts +1 -9
  474. package/dist/shared/prompt-async-gate/types.d.ts +1 -123
  475. package/dist/shared/prompt-async-gate.d.ts +3 -7
  476. package/dist/shared/prompt-failure-classifier.d.ts +1 -9
  477. package/dist/shared/session-idle-settle.d.ts +1 -12
  478. package/dist/shared/shell-env.d.ts +1 -1
  479. package/dist/shared/skill-path-resolver.d.ts +1 -1
  480. package/dist/shared/tmux/cmux-detect.d.ts +1 -8
  481. package/dist/shared/tmux/constants.d.ts +1 -5
  482. package/dist/shared/tmux/runner.d.ts +2 -13
  483. package/dist/shared/tmux/tmux-utils/adapter-deps.d.ts +9 -0
  484. package/dist/shared/tmux/tmux-utils/environment.d.ts +2 -4
  485. package/dist/shared/tmux/tmux-utils/layout.d.ts +4 -17
  486. package/dist/shared/tmux/tmux-utils/pane-close.d.ts +3 -10
  487. package/dist/shared/tmux/tmux-utils/pane-command.d.ts +1 -2
  488. package/dist/shared/tmux/tmux-utils/pane-dimensions.d.ts +2 -4
  489. package/dist/shared/tmux/tmux-utils/pane-replace.d.ts +1 -11
  490. package/dist/shared/tmux/tmux-utils/pane-spawn.d.ts +1 -13
  491. package/dist/shared/tmux/tmux-utils/server-health.d.ts +2 -14
  492. package/dist/shared/tmux/tmux-utils/session-spawn.d.ts +3 -14
  493. package/dist/shared/tmux/tmux-utils/spawn-process.d.ts +1 -1
  494. package/dist/shared/tmux/tmux-utils/stale-attach-pane-sweep.d.ts +16 -0
  495. package/dist/shared/tmux/tmux-utils/stale-session-sweep.d.ts +4 -17
  496. package/dist/shared/tmux/tmux-utils/window-spawn.d.ts +1 -13
  497. package/dist/shared/tmux/tmux-utils.d.ts +1 -0
  498. package/dist/shared/tmux/types.d.ts +1 -4
  499. package/dist/shared/write-file-atomically.d.ts +2 -0
  500. package/dist/shared/zip-entry-listing/powershell-zip-entry-listing.d.ts +1 -4
  501. package/dist/shared/zip-entry-listing/python-zip-entry-listing.d.ts +1 -3
  502. package/dist/shared/zip-entry-listing/read-zip-symlink-target.d.ts +1 -1
  503. package/dist/shared/zip-entry-listing/tar-zip-entry-listing.d.ts +1 -3
  504. package/dist/shared/zip-entry-listing/zipinfo-zip-entry-listing.d.ts +1 -4
  505. package/dist/shared/zip-entry-listing.d.ts +1 -4
  506. package/dist/skills/ast-grep/LICENSE +21 -0
  507. package/dist/skills/ast-grep/README.md +136 -0
  508. package/dist/skills/ast-grep/SKILL.md +272 -0
  509. package/dist/skills/ast-grep/SOURCE +1 -0
  510. package/dist/skills/ast-grep/install.ps1 +235 -0
  511. package/dist/skills/ast-grep/install.sh +286 -0
  512. package/dist/skills/ast-grep/references/cli.md +231 -0
  513. package/dist/skills/ast-grep/references/install.md +166 -0
  514. package/dist/skills/ast-grep/references/patterns.md +147 -0
  515. package/dist/skills/ast-grep/references/pitfalls.md +303 -0
  516. package/dist/skills/ast-grep/references/recipes.md +402 -0
  517. package/dist/skills/ast-grep/references/sgconfig.md +248 -0
  518. package/dist/skills/ast-grep/references/yaml-rules.md +509 -0
  519. package/dist/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
  520. package/dist/skills/ast-grep/tests/smoke.ps1 +123 -0
  521. package/dist/skills/ast-grep/tests/smoke.sh +212 -0
  522. package/dist/skills/debugging/SKILL.md +116 -0
  523. package/dist/skills/debugging/references/methodology/00-setup.md +108 -0
  524. package/dist/skills/debugging/references/methodology/02-investigate.md +130 -0
  525. package/dist/skills/debugging/references/methodology/04-oracle-triple.md +136 -0
  526. package/dist/skills/debugging/references/methodology/05-escalate.md +69 -0
  527. package/dist/skills/debugging/references/methodology/06-fix.md +116 -0
  528. package/dist/skills/debugging/references/methodology/08-qa.md +94 -0
  529. package/dist/skills/debugging/references/methodology/09-cleanup.md +164 -0
  530. package/dist/skills/debugging/references/methodology/partial-runtime-evidence.md +229 -0
  531. package/dist/skills/debugging/references/runtimes/bundled-js-binary.md +415 -0
  532. package/dist/skills/debugging/references/runtimes/go.md +252 -0
  533. package/dist/skills/debugging/references/runtimes/native-binary.md +484 -0
  534. package/dist/skills/debugging/references/runtimes/node.md +260 -0
  535. package/dist/skills/debugging/references/runtimes/python.md +248 -0
  536. package/dist/skills/debugging/references/runtimes/rust.md +234 -0
  537. package/dist/skills/debugging/references/tools/ghidra.md +212 -0
  538. package/dist/skills/debugging/references/tools/playwright-cli.md +194 -0
  539. package/dist/skills/debugging/references/tools/pwndbg.md +263 -0
  540. package/dist/skills/debugging/references/tools/pwntools.md +265 -0
  541. package/dist/skills/frontend/ATTRIBUTION.md +127 -0
  542. package/dist/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
  543. package/dist/skills/frontend/SKILL.md +113 -0
  544. package/dist/skills/frontend/references/design/README.md +240 -0
  545. package/dist/skills/frontend/references/design/_INDEX.md +189 -0
  546. package/dist/skills/frontend/references/design/airbnb.md +390 -0
  547. package/dist/skills/frontend/references/design/airtable.md +89 -0
  548. package/dist/skills/frontend/references/design/apple.md +247 -0
  549. package/dist/skills/frontend/references/design/binance.md +345 -0
  550. package/dist/skills/frontend/references/design/bmw.md +180 -0
  551. package/dist/skills/frontend/references/design/brutalist-skill.md +92 -0
  552. package/dist/skills/frontend/references/design/bugatti.md +268 -0
  553. package/dist/skills/frontend/references/design/cal.md +259 -0
  554. package/dist/skills/frontend/references/design/claude.md +312 -0
  555. package/dist/skills/frontend/references/design/clay.md +304 -0
  556. package/dist/skills/frontend/references/design/clickhouse.md +281 -0
  557. package/dist/skills/frontend/references/design/cohere.md +266 -0
  558. package/dist/skills/frontend/references/design/coinbase.md +129 -0
  559. package/dist/skills/frontend/references/design/composio.md +307 -0
  560. package/dist/skills/frontend/references/design/cursor.md +309 -0
  561. package/dist/skills/frontend/references/design/design-system-architecture.md +217 -0
  562. package/dist/skills/frontend/references/design/elevenlabs.md +265 -0
  563. package/dist/skills/frontend/references/design/expo.md +281 -0
  564. package/dist/skills/frontend/references/design/ferrari.md +314 -0
  565. package/dist/skills/frontend/references/design/figma.md +220 -0
  566. package/dist/skills/frontend/references/design/framer.md +246 -0
  567. package/dist/skills/frontend/references/design/gpt-tasteskill.md +74 -0
  568. package/dist/skills/frontend/references/design/hashicorp.md +278 -0
  569. package/dist/skills/frontend/references/design/ibm.md +332 -0
  570. package/dist/skills/frontend/references/design/image-to-code-skill.md +1228 -0
  571. package/dist/skills/frontend/references/design/imagegen-brandkit.md +798 -0
  572. package/dist/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
  573. package/dist/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
  574. package/dist/skills/frontend/references/design/intercom.md +146 -0
  575. package/dist/skills/frontend/references/design/kraken.md +125 -0
  576. package/dist/skills/frontend/references/design/lamborghini.md +288 -0
  577. package/dist/skills/frontend/references/design/linear.app.md +367 -0
  578. package/dist/skills/frontend/references/design/lovable.md +298 -0
  579. package/dist/skills/frontend/references/design/mastercard.md +365 -0
  580. package/dist/skills/frontend/references/design/meta.md +366 -0
  581. package/dist/skills/frontend/references/design/minimalist-skill.md +85 -0
  582. package/dist/skills/frontend/references/design/minimax.md +257 -0
  583. package/dist/skills/frontend/references/design/mintlify.md +326 -0
  584. package/dist/skills/frontend/references/design/miro.md +108 -0
  585. package/dist/skills/frontend/references/design/mistral.ai.md +261 -0
  586. package/dist/skills/frontend/references/design/mongodb.md +266 -0
  587. package/dist/skills/frontend/references/design/nike.md +363 -0
  588. package/dist/skills/frontend/references/design/notion.md +309 -0
  589. package/dist/skills/frontend/references/design/nvidia.md +293 -0
  590. package/dist/skills/frontend/references/design/ollama.md +267 -0
  591. package/dist/skills/frontend/references/design/opencode.ai.md +281 -0
  592. package/dist/skills/frontend/references/design/output-skill.md +49 -0
  593. package/dist/skills/frontend/references/design/pinterest.md +230 -0
  594. package/dist/skills/frontend/references/design/playstation.md +364 -0
  595. package/dist/skills/frontend/references/design/posthog.md +256 -0
  596. package/dist/skills/frontend/references/design/raycast.md +268 -0
  597. package/dist/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
  598. package/dist/skills/frontend/references/design/redesign-skill.md +178 -0
  599. package/dist/skills/frontend/references/design/renault.md +311 -0
  600. package/dist/skills/frontend/references/design/replicate.md +261 -0
  601. package/dist/skills/frontend/references/design/resend.md +303 -0
  602. package/dist/skills/frontend/references/design/revolut.md +185 -0
  603. package/dist/skills/frontend/references/design/runwayml.md +244 -0
  604. package/dist/skills/frontend/references/design/sanity.md +357 -0
  605. package/dist/skills/frontend/references/design/sentry.md +262 -0
  606. package/dist/skills/frontend/references/design/shopify.md +350 -0
  607. package/dist/skills/frontend/references/design/soft-skill.md +98 -0
  608. package/dist/skills/frontend/references/design/spacex.md +194 -0
  609. package/dist/skills/frontend/references/design/spotify.md +246 -0
  610. package/dist/skills/frontend/references/design/starbucks.md +580 -0
  611. package/dist/skills/frontend/references/design/stitch-skill.md +184 -0
  612. package/dist/skills/frontend/references/design/stripe.md +322 -0
  613. package/dist/skills/frontend/references/design/supabase.md +255 -0
  614. package/dist/skills/frontend/references/design/superhuman.md +252 -0
  615. package/dist/skills/frontend/references/design/taste-skill.md +226 -0
  616. package/dist/skills/frontend/references/design/tesla.md +286 -0
  617. package/dist/skills/frontend/references/design/theverge.md +339 -0
  618. package/dist/skills/frontend/references/design/together.ai.md +263 -0
  619. package/dist/skills/frontend/references/design/uber.md +295 -0
  620. package/dist/skills/frontend/references/design/vercel.md +310 -0
  621. package/dist/skills/frontend/references/design/vodafone.md +423 -0
  622. package/dist/skills/frontend/references/design/voltagent.md +323 -0
  623. package/dist/skills/frontend/references/design/warp.md +253 -0
  624. package/dist/skills/frontend/references/design/webflow.md +92 -0
  625. package/dist/skills/frontend/references/design/wired.md +278 -0
  626. package/dist/skills/frontend/references/design/wise.md +173 -0
  627. package/dist/skills/frontend/references/design/x.ai.md +257 -0
  628. package/dist/skills/frontend/references/design/zapier.md +328 -0
  629. package/dist/skills/frontend/references/perfection/README.md +160 -0
  630. package/dist/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
  631. package/dist/skills/frontend/references/ui-ux-db/README.md +273 -0
  632. package/dist/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
  633. package/dist/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
  634. package/dist/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
  635. package/dist/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
  636. package/dist/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
  637. package/dist/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
  638. package/dist/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
  639. package/dist/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
  640. package/dist/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
  641. package/dist/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
  642. package/dist/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
  643. package/dist/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
  644. package/dist/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
  645. package/dist/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
  646. package/dist/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
  647. package/dist/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
  648. package/dist/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
  649. package/dist/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
  650. package/dist/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
  651. package/dist/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
  652. package/dist/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
  653. package/dist/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
  654. package/dist/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
  655. package/dist/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
  656. package/dist/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
  657. package/dist/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
  658. package/dist/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
  659. package/dist/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
  660. package/dist/skills/git-master/SKILL.md +100 -0
  661. package/dist/skills/git-master/agents/openai.yaml +13 -0
  662. package/dist/skills/init-deep/SKILL.md +309 -0
  663. package/dist/skills/lcx-contribute-bug-fix/SKILL.md +242 -0
  664. package/dist/skills/lcx-contribute-bug-fix/agents/openai.yaml +12 -0
  665. package/dist/skills/lcx-contribute-bug-fix/scripts/create-pr-body.mjs +107 -0
  666. package/dist/skills/lcx-doctor/SKILL.md +93 -0
  667. package/dist/skills/lcx-doctor/agents/openai.yaml +11 -0
  668. package/dist/skills/lcx-report-bug/SKILL.md +237 -0
  669. package/dist/skills/lcx-report-bug/agents/openai.yaml +11 -0
  670. package/dist/skills/lsp-setup/SKILL.md +139 -0
  671. package/dist/skills/lsp-setup/references/bash/README.md +60 -0
  672. package/dist/skills/lsp-setup/references/c-cpp/README.md +61 -0
  673. package/dist/skills/lsp-setup/references/csharp/README.md +71 -0
  674. package/dist/skills/lsp-setup/references/dart/README.md +48 -0
  675. package/dist/skills/lsp-setup/references/elixir/README.md +51 -0
  676. package/dist/skills/lsp-setup/references/go/README.md +57 -0
  677. package/dist/skills/lsp-setup/references/haskell/README.md +57 -0
  678. package/dist/skills/lsp-setup/references/java/README.md +57 -0
  679. package/dist/skills/lsp-setup/references/julia/README.md +60 -0
  680. package/dist/skills/lsp-setup/references/kotlin/README.md +59 -0
  681. package/dist/skills/lsp-setup/references/lua/README.md +66 -0
  682. package/dist/skills/lsp-setup/references/php/README.md +62 -0
  683. package/dist/skills/lsp-setup/references/python/README.md +71 -0
  684. package/dist/skills/lsp-setup/references/ruby/README.md +53 -0
  685. package/dist/skills/lsp-setup/references/rust/README.md +59 -0
  686. package/dist/skills/lsp-setup/references/swift/README.md +51 -0
  687. package/dist/skills/lsp-setup/references/terraform/README.md +62 -0
  688. package/dist/skills/lsp-setup/references/typescript/README.md +77 -0
  689. package/dist/skills/lsp-setup/references/yaml/README.md +70 -0
  690. package/dist/skills/lsp-setup/references/zig/README.md +49 -0
  691. package/dist/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
  692. package/dist/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
  693. package/dist/skills/lsp-setup/scripts/tsconfig.json +17 -0
  694. package/dist/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
  695. package/dist/skills/programming/SKILL.md +463 -0
  696. package/dist/skills/programming/references/go/README.md +90 -0
  697. package/dist/skills/programming/references/go/backend-stack.md +641 -0
  698. package/dist/skills/programming/references/go/bootstrap.md +328 -0
  699. package/dist/skills/programming/references/go/bubbletea-v2.md +360 -0
  700. package/dist/skills/programming/references/go/cobra-stack.md +468 -0
  701. package/dist/skills/programming/references/go/concurrency.md +362 -0
  702. package/dist/skills/programming/references/go/data-modeling.md +329 -0
  703. package/dist/skills/programming/references/go/error-handling.md +359 -0
  704. package/dist/skills/programming/references/go/golangci-strict.md +236 -0
  705. package/dist/skills/programming/references/go/grpc-connect.md +375 -0
  706. package/dist/skills/programming/references/go/libraries.md +337 -0
  707. package/dist/skills/programming/references/go/one-liners.md +202 -0
  708. package/dist/skills/programming/references/go/sqlc-pgx.md +471 -0
  709. package/dist/skills/programming/references/go/testing.md +467 -0
  710. package/dist/skills/programming/references/go/type-patterns.md +298 -0
  711. package/dist/skills/programming/references/python/README.md +314 -0
  712. package/dist/skills/programming/references/python/async-anyio.md +442 -0
  713. package/dist/skills/programming/references/python/data-modeling.md +233 -0
  714. package/dist/skills/programming/references/python/data-processing.md +133 -0
  715. package/dist/skills/programming/references/python/error-handling.md +218 -0
  716. package/dist/skills/programming/references/python/fastapi-stack.md +316 -0
  717. package/dist/skills/programming/references/python/httpx2-optimization.md +360 -0
  718. package/dist/skills/programming/references/python/libraries.md +307 -0
  719. package/dist/skills/programming/references/python/one-liners.md +268 -0
  720. package/dist/skills/programming/references/python/orjson-stack.md +378 -0
  721. package/dist/skills/programming/references/python/pydantic-ai.md +285 -0
  722. package/dist/skills/programming/references/python/pyproject-strict.md +232 -0
  723. package/dist/skills/programming/references/python/textual-tui.md +201 -0
  724. package/dist/skills/programming/references/python/type-patterns.md +176 -0
  725. package/dist/skills/programming/references/rust/README.md +317 -0
  726. package/dist/skills/programming/references/rust/async-tokio.md +299 -0
  727. package/dist/skills/programming/references/rust/axum-stack.md +467 -0
  728. package/dist/skills/programming/references/rust/cargo-strict.md +317 -0
  729. package/dist/skills/programming/references/rust/clap-stack.md +409 -0
  730. package/dist/skills/programming/references/rust/concurrency.md +375 -0
  731. package/dist/skills/programming/references/rust/libraries.md +439 -0
  732. package/dist/skills/programming/references/rust/one-liners.md +291 -0
  733. package/dist/skills/programming/references/rust/proptest-insta.md +429 -0
  734. package/dist/skills/programming/references/rust/type-state.md +354 -0
  735. package/dist/skills/programming/references/rust/unsafe-discipline.md +250 -0
  736. package/dist/skills/programming/references/rust/zero-cost-safety.md +527 -0
  737. package/dist/skills/programming/references/rust-ub/README.md +289 -0
  738. package/dist/skills/programming/references/rust-ub/miri-sanitizers-loom.md +411 -0
  739. package/dist/skills/programming/references/rust-ub/ub-taxonomy.md +269 -0
  740. package/dist/skills/programming/references/typescript/README.md +195 -0
  741. package/dist/skills/programming/references/typescript/backend-hono.md +672 -0
  742. package/dist/skills/programming/references/typescript/bootstrap.md +199 -0
  743. package/dist/skills/programming/references/typescript/data-modeling.md +202 -0
  744. package/dist/skills/programming/references/typescript/error-handling.md +169 -0
  745. package/dist/skills/programming/references/typescript/tsconfig-strict.md +152 -0
  746. package/dist/skills/programming/references/typescript/type-patterns.md +196 -0
  747. package/dist/skills/programming/scripts/go/check-no-excuse-rules.sh +173 -0
  748. package/dist/skills/programming/scripts/go/new-project.py +138 -0
  749. package/dist/skills/programming/scripts/go/templates/.editorconfig +13 -0
  750. package/dist/skills/programming/scripts/go/templates/.golangci.yml +95 -0
  751. package/dist/skills/programming/scripts/go/templates/AGENTS.md.tmpl +24 -0
  752. package/dist/skills/programming/scripts/go/templates/README.md.tmpl +12 -0
  753. package/dist/skills/programming/scripts/go/templates/Taskfile.yml +40 -0
  754. package/dist/skills/programming/scripts/go/templates/ci.yml +37 -0
  755. package/dist/skills/programming/scripts/go/templates/config.go +24 -0
  756. package/dist/skills/programming/scripts/go/templates/gitignore +15 -0
  757. package/dist/skills/programming/scripts/go/templates/main.go.tmpl +22 -0
  758. package/dist/skills/programming/scripts/go/templates/run.go +15 -0
  759. package/dist/skills/programming/scripts/python/check-no-excuse-rules.py +687 -0
  760. package/dist/skills/programming/scripts/python/new-project.py +172 -0
  761. package/dist/skills/programming/scripts/python/new-script.py +116 -0
  762. package/dist/skills/programming/scripts/rust/check-no-excuse-rules.py +296 -0
  763. package/dist/skills/programming/scripts/rust/check-no-excuse-rules.sh +158 -0
  764. package/dist/skills/programming/scripts/rust/new-project.py +175 -0
  765. package/dist/skills/programming/scripts/typescript/check-no-excuse-rules.ts +282 -0
  766. package/dist/skills/programming/scripts/typescript/new-project.ts +177 -0
  767. package/dist/skills/refactor/SKILL.md +754 -0
  768. package/dist/skills/remove-ai-slops/SKILL.md +317 -0
  769. package/dist/skills/review-work/SKILL.md +594 -0
  770. package/dist/skills/start-work/SKILL.md +178 -0
  771. package/dist/skills/ultraresearch/SKILL.md +230 -0
  772. package/dist/skills/ulw-plan/SKILL.md +69 -0
  773. package/dist/skills/ulw-plan/agents/openai.yaml +7 -0
  774. package/dist/skills/ulw-plan/references/full-workflow.md +99 -0
  775. package/dist/skills/ulw-plan/references/intent-clear.md +44 -0
  776. package/dist/skills/ulw-plan/references/intent-unclear.md +44 -0
  777. package/dist/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
  778. package/dist/skills/visual-qa/SKILL.md +235 -0
  779. package/dist/skills/visual-qa/references/agent-browser-setup.md +44 -0
  780. package/dist/skills/visual-qa/scripts/ansi.test.ts +45 -0
  781. package/dist/skills/visual-qa/scripts/ansi.ts +17 -0
  782. package/dist/skills/visual-qa/scripts/cli.test.ts +73 -0
  783. package/dist/skills/visual-qa/scripts/cli.ts +82 -0
  784. package/dist/skills/visual-qa/scripts/east-asian-width.test.ts +60 -0
  785. package/dist/skills/visual-qa/scripts/east-asian-width.ts +72 -0
  786. package/dist/skills/visual-qa/scripts/image-diff.test.ts +70 -0
  787. package/dist/skills/visual-qa/scripts/image-diff.ts +109 -0
  788. package/dist/skills/visual-qa/scripts/png-crc.ts +27 -0
  789. package/dist/skills/visual-qa/scripts/png-decode.test.ts +44 -0
  790. package/dist/skills/visual-qa/scripts/png-decode.ts +206 -0
  791. package/dist/skills/visual-qa/scripts/png-synth.ts +57 -0
  792. package/dist/skills/visual-qa/scripts/skill-prompt-contract.test.ts +127 -0
  793. package/dist/skills/visual-qa/scripts/tui-grid.test.ts +57 -0
  794. package/dist/skills/visual-qa/scripts/tui-grid.ts +88 -0
  795. package/dist/skills/visual-qa/scripts/types.ts +54 -0
  796. package/dist/tools/background-task/clients.d.ts +2 -0
  797. package/dist/tools/background-task/full-session-format.d.ts +1 -0
  798. package/dist/tools/background-task/types.d.ts +1 -0
  799. package/dist/tools/delegate-task/background-task-description.d.ts +2 -0
  800. package/dist/tools/delegate-task/constants.d.ts +13 -1
  801. package/dist/tools/delegate-task/model-selection.d.ts +3 -17
  802. package/dist/tools/delegate-task/model-string-parser.d.ts +1 -9
  803. package/dist/tools/delegate-task/sync-prompt-sender.d.ts +1 -1
  804. package/dist/tools/delegate-task/sync-result-fetcher.d.ts +1 -0
  805. package/dist/tools/delegate-task/sync-session-lifecycle.d.ts +2 -1
  806. package/dist/tools/delegate-task/sync-session-poller.d.ts +1 -0
  807. package/dist/tools/delegate-task/types.d.ts +59 -2
  808. package/dist/tools/index.d.ts +1 -0
  809. package/dist/tools/look-at/look-at-input-preparer.d.ts +6 -2
  810. package/dist/tools/look-at/look-at-prompt.d.ts +2 -1
  811. package/dist/tools/look-at/look-at-session-runner.d.ts +3 -4
  812. package/dist/tools/look-at/types.d.ts +2 -0
  813. package/dist/tools/monitor/create-monitor-tools.d.ts +4 -0
  814. package/dist/tools/monitor/index.d.ts +1 -0
  815. package/dist/tools/monitor/monitor-list.d.ts +7 -0
  816. package/dist/tools/monitor/monitor-output.d.ts +3 -0
  817. package/dist/tools/monitor/monitor-start.d.ts +9 -0
  818. package/dist/tools/monitor/monitor-stop.d.ts +16 -0
  819. package/dist/tools/session-manager/types.d.ts +1 -0
  820. package/dist/tools/skill/native-skills.d.ts +2 -2
  821. package/dist/tools/skill/scope-priority.d.ts +1 -4
  822. package/dist/tools/skill/skill-matcher.d.ts +1 -5
  823. package/dist/tools/skill-mcp/types.d.ts +1 -0
  824. package/dist/tools/task/types.d.ts +10 -10
  825. package/dist/tui.d.ts +4 -0
  826. package/dist/tui.js +69330 -0
  827. package/package.json +58 -36
  828. package/packages/git-bash-mcp/dist/cli.js +225 -55
  829. package/packages/lsp-core/package.json +41 -0
  830. package/packages/lsp-core/src/index.ts +28 -0
  831. package/packages/lsp-core/src/lsp/cleanup-errors.ts +5 -0
  832. package/packages/lsp-core/src/lsp/client-wrapper.ts +173 -0
  833. package/packages/lsp-core/src/lsp/client.ts +172 -0
  834. package/packages/lsp-core/src/lsp/config-loader.ts +266 -0
  835. package/packages/lsp-core/src/lsp/connection.ts +73 -0
  836. package/packages/lsp-core/src/lsp/constants.ts +11 -0
  837. package/packages/lsp-core/src/lsp/directory-diagnostics.ts +154 -0
  838. package/packages/lsp-core/src/lsp/effective-extension.ts +10 -0
  839. package/packages/lsp-core/src/lsp/errors.ts +63 -0
  840. package/packages/lsp-core/src/lsp/formatters.ts +141 -0
  841. package/packages/lsp-core/src/lsp/infer-extension.ts +66 -0
  842. package/packages/lsp-core/src/lsp/json-rpc-connection.ts +296 -0
  843. package/packages/lsp-core/src/lsp/language-mappings.ts +173 -0
  844. package/packages/lsp-core/src/lsp/manager.ts +369 -0
  845. package/packages/lsp-core/src/lsp/process-signal-cleanup.ts +21 -0
  846. package/packages/lsp-core/src/lsp/process.ts +202 -0
  847. package/packages/lsp-core/src/lsp/server-definitions.ts +176 -0
  848. package/packages/lsp-core/src/lsp/server-install-state.ts +70 -0
  849. package/packages/lsp-core/src/lsp/server-installation.ts +45 -0
  850. package/packages/lsp-core/src/lsp/server-resolution.ts +104 -0
  851. package/packages/lsp-core/src/lsp/startup-failure.ts +1 -0
  852. package/packages/lsp-core/src/lsp/transport.ts +299 -0
  853. package/packages/lsp-core/src/lsp/types.ts +126 -0
  854. package/packages/lsp-core/src/lsp/utils.test.ts +72 -0
  855. package/packages/lsp-core/src/lsp/utils.ts +40 -0
  856. package/packages/lsp-core/src/lsp/workspace-edit.ts +206 -0
  857. package/packages/lsp-core/src/mcp-protocol-pin.test.ts +68 -0
  858. package/packages/lsp-core/src/mcp.ts +95 -0
  859. package/packages/lsp-core/src/missing-dependency-result.ts +19 -0
  860. package/packages/lsp-core/src/request-context.ts +22 -0
  861. package/packages/lsp-core/src/tool-surface.test.ts +157 -0
  862. package/packages/lsp-core/src/tools/definitions.ts +141 -0
  863. package/packages/lsp-core/src/tools/diagnostics.ts +97 -0
  864. package/packages/lsp-core/src/tools/index.ts +10 -0
  865. package/packages/lsp-core/src/tools/install-decision.ts +39 -0
  866. package/packages/lsp-core/src/tools/navigation.ts +86 -0
  867. package/packages/lsp-core/src/tools/parameters.ts +49 -0
  868. package/packages/lsp-core/src/tools/rename.ts +72 -0
  869. package/packages/lsp-core/src/tools/result.ts +5 -0
  870. package/packages/lsp-core/src/tools/runtime.ts +21 -0
  871. package/packages/lsp-core/src/tools/schema.ts +9 -0
  872. package/packages/lsp-core/src/tools/status.ts +28 -0
  873. package/packages/lsp-core/src/tools/symbols.ts +99 -0
  874. package/packages/lsp-core/src/tools/types.ts +104 -0
  875. package/packages/lsp-core/src/tools.ts +1 -0
  876. package/packages/lsp-daemon/dist/cli.js +800 -612
  877. package/packages/lsp-daemon/dist/daemon-client.d.ts +1 -1
  878. package/packages/lsp-daemon/dist/daemon-server.js +1 -1
  879. package/packages/lsp-daemon/dist/index.d.ts +1 -1
  880. package/packages/lsp-daemon/dist/index.js +695 -505
  881. package/packages/lsp-daemon/dist/proxy.d.ts +3 -2
  882. package/packages/lsp-daemon/dist/proxy.js +16 -40
  883. package/packages/lsp-daemon/dist/request-routing.d.ts +2 -2
  884. package/packages/lsp-daemon/dist/request-routing.js +2 -2
  885. package/packages/lsp-daemon/package.json +2 -1
  886. package/packages/lsp-tools-mcp/dist/cli.js +3348 -15
  887. package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.d.ts +1 -1
  888. package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.d.ts +1 -13
  889. package/packages/lsp-tools-mcp/dist/lsp/client.d.ts +1 -20
  890. package/packages/lsp-tools-mcp/dist/lsp/config-loader.d.ts +1 -16
  891. package/packages/lsp-tools-mcp/dist/lsp/connection.d.ts +1 -4
  892. package/packages/lsp-tools-mcp/dist/lsp/constants.d.ts +1 -10
  893. package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.d.ts +1 -3
  894. package/packages/lsp-tools-mcp/dist/lsp/effective-extension.d.ts +1 -1
  895. package/packages/lsp-tools-mcp/dist/lsp/errors.d.ts +1 -35
  896. package/packages/lsp-tools-mcp/dist/lsp/formatters.d.ts +1 -12
  897. package/packages/lsp-tools-mcp/dist/lsp/infer-extension.d.ts +1 -1
  898. package/packages/lsp-tools-mcp/dist/lsp/json-rpc-connection.d.ts +1 -36
  899. package/packages/lsp-tools-mcp/dist/lsp/language-mappings.d.ts +1 -4
  900. package/packages/lsp-tools-mcp/dist/lsp/manager.d.ts +1 -46
  901. package/packages/lsp-tools-mcp/dist/lsp/manager.js +1390 -265
  902. package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.d.ts +1 -1
  903. package/packages/lsp-tools-mcp/dist/lsp/process.d.ts +1 -25
  904. package/packages/lsp-tools-mcp/dist/lsp/server-definitions.d.ts +1 -4
  905. package/packages/lsp-tools-mcp/dist/lsp/server-install-state.d.ts +1 -12
  906. package/packages/lsp-tools-mcp/dist/lsp/server-installation.d.ts +1 -1
  907. package/packages/lsp-tools-mcp/dist/lsp/server-resolution.d.ts +1 -11
  908. package/packages/lsp-tools-mcp/dist/lsp/startup-failure.d.ts +1 -3
  909. package/packages/lsp-tools-mcp/dist/lsp/transport.d.ts +1 -26
  910. package/packages/lsp-tools-mcp/dist/lsp/types.d.ts +1 -124
  911. package/packages/lsp-tools-mcp/dist/lsp/utils.d.ts +1 -0
  912. package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.d.ts +1 -11
  913. package/packages/lsp-tools-mcp/dist/mcp.d.ts +1 -30
  914. package/packages/lsp-tools-mcp/dist/mcp.js +3312 -70
  915. package/packages/lsp-tools-mcp/dist/missing-dependency-result.d.ts +1 -2
  916. package/packages/lsp-tools-mcp/dist/request-context.d.ts +1 -7
  917. package/packages/lsp-tools-mcp/dist/request-context.js +16 -10
  918. package/packages/lsp-tools-mcp/dist/tools.d.ts +1 -90
  919. package/packages/lsp-tools-mcp/dist/tools.js +3028 -439
  920. package/packages/lsp-tools-mcp/package.json +3 -1
  921. package/packages/omo-codex/THIRD-PARTY-NOTICES.md +155 -0
  922. package/packages/omo-codex/lazycodex-repository/.github/workflows/pr-source-guidance.yml +11 -12
  923. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  924. package/packages/omo-codex/plugin/.mcp.json +6 -5
  925. package/packages/omo-codex/plugin/README.md +1 -1
  926. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +2975 -0
  927. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +17 -0
  928. package/packages/omo-codex/plugin/components/bootstrap/manifests/node.json +10 -0
  929. package/packages/omo-codex/plugin/components/bootstrap/package.json +20 -0
  930. package/packages/omo-codex/plugin/components/bootstrap/scripts/bootstrap.ps1 +310 -0
  931. package/packages/omo-codex/plugin/components/bootstrap/scripts/build.mjs +35 -0
  932. package/packages/omo-codex/plugin/components/bootstrap/scripts/generate-manifests.mjs +71 -0
  933. package/packages/omo-codex/plugin/components/bootstrap/src/cli.ts +153 -0
  934. package/packages/omo-codex/plugin/components/bootstrap/src/download.ts +212 -0
  935. package/packages/omo-codex/plugin/components/bootstrap/src/environment.ts +286 -0
  936. package/packages/omo-codex/plugin/components/bootstrap/src/hook.ts +108 -0
  937. package/packages/omo-codex/plugin/components/bootstrap/src/provision.ts +135 -0
  938. package/packages/omo-codex/plugin/components/bootstrap/src/setup.ts +294 -0
  939. package/packages/omo-codex/plugin/components/bootstrap/src/worker.ts +279 -0
  940. package/packages/omo-codex/plugin/components/bootstrap/test/download.test.ts +295 -0
  941. package/packages/omo-codex/plugin/components/bootstrap/test/environment.test.ts +376 -0
  942. package/packages/omo-codex/plugin/components/bootstrap/test/provision.test.ts +464 -0
  943. package/packages/omo-codex/plugin/components/bootstrap/tsconfig.json +25 -0
  944. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +2205 -0
  945. package/packages/omo-codex/plugin/components/codegraph/dist/serve.d.ts +32 -0
  946. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +1603 -0
  947. package/packages/omo-codex/plugin/components/codegraph/package.json +27 -0
  948. package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +55 -0
  949. package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +83 -0
  950. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +108 -0
  951. package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +191 -0
  952. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +213 -0
  953. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +563 -0
  954. package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +401 -0
  955. package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +13 -0
  956. package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +25 -0
  957. package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +610 -7
  958. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  959. package/packages/omo-codex/plugin/components/comment-checker/package.json +7 -6
  960. package/packages/omo-codex/plugin/components/comment-checker/src/apply-patch.ts +28 -156
  961. package/packages/omo-codex/plugin/components/comment-checker/src/core-values.ts +1 -1
  962. package/packages/omo-codex/plugin/components/comment-checker/src/core.ts +2 -2
  963. package/packages/omo-codex/plugin/components/comment-checker/src/request-extractor.ts +1 -1
  964. package/packages/omo-codex/plugin/components/comment-checker/src/runner.ts +6 -2
  965. package/packages/omo-codex/plugin/components/comment-checker/test/core.test.ts +38 -35
  966. package/packages/omo-codex/plugin/components/comment-checker/test/fixtures/apply-patch-mixed-requests.ts +60 -0
  967. package/packages/omo-codex/plugin/components/git-bash/dist/cli.js +155 -26
  968. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  969. package/packages/omo-codex/plugin/components/git-bash/package.json +3 -2
  970. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/biome.json +48 -0
  971. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/directive.md +11 -0
  972. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/cli.js +223 -0
  973. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.d.ts +2 -0
  974. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/codex-hook.js +123 -0
  975. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/directive.d.ts +2 -0
  976. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/directive.js +5 -0
  977. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/index.d.ts +4 -0
  978. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/index.js +3 -0
  979. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/state.d.ts +9 -0
  980. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/state.js +45 -0
  981. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.d.ts +39 -0
  982. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/dist/types.js +1 -0
  983. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +17 -0
  984. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +44 -0
  985. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/cli.ts +56 -0
  986. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/codex-hook.ts +129 -0
  987. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/directive.ts +13 -0
  988. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/index.ts +4 -0
  989. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/state.ts +62 -0
  990. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/src/types.ts +38 -0
  991. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/cli.test.ts +124 -0
  992. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/test/codex-hook.test.ts +346 -0
  993. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/tsconfig.build.json +12 -0
  994. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/tsconfig.json +27 -0
  995. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/vitest.config.ts +10 -0
  996. package/packages/omo-codex/plugin/components/lsp/dist/cli.js +3738 -28
  997. package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.js +6 -10
  998. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  999. package/packages/omo-codex/plugin/components/lsp/package.json +4 -4
  1000. package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-tools.test.mjs +8 -3
  1001. package/packages/omo-codex/plugin/components/lsp/src/codex-hook-cli.ts +5 -8
  1002. package/packages/omo-codex/plugin/components/lsp/test/codex-hook-cli.test.ts +24 -1
  1003. package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +1 -1
  1004. package/packages/omo-codex/plugin/components/rules/bundled-rules/windows-git-bash.md +3 -1
  1005. package/packages/omo-codex/plugin/components/rules/dist/cli.js +4565 -89
  1006. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  1007. package/packages/omo-codex/plugin/components/rules/package.json +7 -6
  1008. package/packages/omo-codex/plugin/components/rules/src/cli.ts +16 -3
  1009. package/packages/omo-codex/plugin/components/rules/src/config.ts +3 -3
  1010. package/packages/omo-codex/plugin/components/rules/src/dynamic-target-fingerprints.ts +6 -6
  1011. package/packages/omo-codex/plugin/components/rules/src/event-budget.ts +1 -1
  1012. package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +1 -1
  1013. package/packages/omo-codex/plugin/components/rules/src/post-compact-budget.ts +1 -1
  1014. package/packages/omo-codex/plugin/components/rules/src/rules-engine-factory.ts +9 -4
  1015. package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +3 -3
  1016. package/packages/omo-codex/plugin/components/rules/src/transcript-rule-filter.ts +1 -1
  1017. package/packages/omo-codex/plugin/components/rules/test/bundled-rules-priority.test.ts +4 -4
  1018. package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +1 -1
  1019. package/packages/omo-codex/plugin/components/rules/test/dynamic-target-fingerprints.test.ts +1 -1
  1020. package/packages/omo-codex/plugin/components/rules/test/engine.test.ts +3 -3
  1021. package/packages/omo-codex/plugin/components/rules/test/finder.test.ts +2 -2
  1022. package/packages/omo-codex/plugin/components/rules/test/formatter.test.ts +2 -2
  1023. package/packages/omo-codex/plugin/components/rules/test/matcher.test.ts +2 -2
  1024. package/packages/omo-codex/plugin/components/rules/test/parser.test.ts +1 -1
  1025. package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +1 -1
  1026. package/packages/omo-codex/plugin/components/rules/test/rules-engine-consumption.test.ts +92 -0
  1027. package/packages/omo-codex/plugin/components/rules/test/scanner.test.ts +1 -1
  1028. package/packages/omo-codex/plugin/components/rules/test/sources.test.ts +4 -4
  1029. package/packages/omo-codex/plugin/components/rules/test/windows-git-bash-bundled-rule.test.ts +36 -2
  1030. package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +394 -37
  1031. package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
  1032. package/packages/omo-codex/plugin/components/start-work-continuation/package.json +7 -6
  1033. package/packages/omo-codex/plugin/components/start-work-continuation/src/boulder-reader.ts +20 -147
  1034. package/packages/omo-codex/plugin/components/start-work-continuation/src/codex-hook.ts +1 -1
  1035. package/packages/omo-codex/plugin/components/start-work-continuation/src/index.ts +1 -1
  1036. package/packages/omo-codex/plugin/components/start-work-continuation/test/boulder-reader.test.ts +151 -27
  1037. package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +87 -49
  1038. package/packages/omo-codex/plugin/components/telemetry/LICENSE +21 -0
  1039. package/packages/omo-codex/plugin/components/telemetry/NOTICE +6 -0
  1040. package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +5869 -42
  1041. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +5783 -108
  1042. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  1043. package/packages/omo-codex/plugin/components/telemetry/package.json +7 -8
  1044. package/packages/omo-codex/plugin/components/telemetry/src/codex-hook.ts +3 -3
  1045. package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +92 -142
  1046. package/packages/omo-codex/plugin/components/telemetry/src/product-identity.ts +59 -3
  1047. package/packages/omo-codex/plugin/components/telemetry/test/codex-hook-diagnostics.test.ts +3 -3
  1048. package/packages/omo-codex/plugin/components/telemetry/test/diagnostics.test.ts +13 -7
  1049. package/packages/omo-codex/plugin/components/ultrawork/AGENTS.md +2 -2
  1050. package/packages/omo-codex/plugin/components/ultrawork/README.md +1 -1
  1051. package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +1 -1
  1052. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-clone-fidelity-reviewer.toml +31 -0
  1053. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-code-reviewer.toml +29 -0
  1054. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-executor.toml +24 -0
  1055. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-gate-reviewer.toml +23 -0
  1056. package/packages/omo-codex/plugin/components/ultrawork/agents/lazycodex-qa-executor.toml +22 -0
  1057. package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +1 -1
  1058. package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -1
  1059. package/packages/omo-codex/plugin/components/ultrawork/biome.json +1 -1
  1060. package/packages/omo-codex/plugin/components/ultrawork/directive.md +5 -1
  1061. package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +162 -37
  1062. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  1063. package/packages/omo-codex/plugin/components/ultrawork/package.json +7 -6
  1064. package/packages/omo-codex/plugin/components/ultrawork/scripts/sync-directive.mjs +11 -0
  1065. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +42 -47
  1066. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +64 -102
  1067. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-clear.md +44 -0
  1068. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/intent-unclear.md +44 -0
  1069. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
  1070. package/packages/omo-codex/plugin/components/ultrawork/src/codex-hook.ts +2 -2
  1071. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-test-helpers.ts +101 -0
  1072. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook-trigger-policy.test.ts +111 -0
  1073. package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +39 -124
  1074. package/packages/omo-codex/plugin/components/ultrawork/test/directive-source.test.ts +16 -0
  1075. package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +4 -3
  1076. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +5 -0
  1077. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +79 -0
  1078. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +1 -1
  1079. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +56 -82
  1080. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +45 -143
  1081. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +1 -0
  1082. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +18 -0
  1083. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.d.ts +10 -0
  1084. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-subcommands.js +173 -0
  1085. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +2419 -32
  1086. package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +13 -9
  1087. package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +60 -12
  1088. package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.d.ts +3 -0
  1089. package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.js +67 -10
  1090. package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.d.ts +3 -0
  1091. package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.js +14 -0
  1092. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.d.ts +2 -6
  1093. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +50 -42
  1094. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-goal-factory.d.ts +8 -0
  1095. package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-goal-factory.js +109 -0
  1096. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-blockers.d.ts +5 -0
  1097. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-blockers.js +41 -0
  1098. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.d.ts +8 -0
  1099. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +39 -0
  1100. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +13 -6
  1101. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +176 -105
  1102. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
  1103. package/packages/omo-codex/plugin/components/ulw-loop/package.json +4 -4
  1104. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +17 -17
  1105. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +100 -0
  1106. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +162 -85
  1107. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +64 -134
  1108. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-output.ts +19 -0
  1109. package/packages/omo-codex/plugin/components/ulw-loop/src/cli-subcommands.ts +250 -0
  1110. package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +18 -9
  1111. package/packages/omo-codex/plugin/components/ulw-loop/src/domain-types.ts +67 -4
  1112. package/packages/omo-codex/plugin/components/ulw-loop/src/evidence.ts +124 -18
  1113. package/packages/omo-codex/plugin/components/ulw-loop/src/goal-status.ts +16 -0
  1114. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-crud.ts +132 -55
  1115. package/packages/omo-codex/plugin/components/ulw-loop/src/plan-goal-factory.ts +124 -0
  1116. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-blockers.ts +48 -0
  1117. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +44 -0
  1118. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +230 -138
  1119. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +186 -0
  1120. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-status.test.ts +85 -0
  1121. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint.test.ts +120 -192
  1122. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-checkpoint.test.ts +215 -0
  1123. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-commands.test.ts +7 -195
  1124. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-complete-goals.test.ts +41 -1
  1125. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-create-goals.test.ts +172 -0
  1126. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-helpers.test.ts +0 -6
  1127. package/packages/omo-codex/plugin/components/ulw-loop/test/cli-json-errors.test.ts +89 -0
  1128. package/packages/omo-codex/plugin/components/ulw-loop/test/codex-goal-instruction.test.ts +39 -8
  1129. package/packages/omo-codex/plugin/components/ulw-loop/test/evidence-criteria-gate.test.ts +29 -1
  1130. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/browser-screenshot.txt +1 -0
  1131. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/cli-pass.txt +1 -0
  1132. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/code-review.md +1 -0
  1133. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/data-diff.txt +5 -0
  1134. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/gate-review.md +1 -0
  1135. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/http-dump.txt +4 -0
  1136. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/artifacts/rejection.txt +1 -0
  1137. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/checkpoint-builders.ts +98 -0
  1138. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/quality-gate-builder.ts +91 -0
  1139. package/packages/omo-codex/plugin/components/ulw-loop/test/fixtures/sample-quality-gate.json +110 -8
  1140. package/packages/omo-codex/plugin/components/ulw-loop/test/goal-status.test.ts +35 -0
  1141. package/packages/omo-codex/plugin/components/ulw-loop/test/plan-crud.test.ts +11 -1
  1142. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-blockers.test.ts +102 -0
  1143. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-doc.test.ts +38 -0
  1144. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-roles.test.ts +131 -0
  1145. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +150 -176
  1146. package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +12 -0
  1147. package/packages/omo-codex/plugin/hooks/hooks.json +48 -16
  1148. package/packages/omo-codex/plugin/package-lock.json +327 -232
  1149. package/packages/omo-codex/plugin/package.json +4 -2
  1150. package/packages/omo-codex/plugin/scripts/auto-update-state.d.mts +20 -0
  1151. package/packages/omo-codex/plugin/scripts/auto-update.mjs +30 -8
  1152. package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +0 -5
  1153. package/packages/omo-codex/plugin/scripts/build-components.mjs +60 -5
  1154. package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +2 -0
  1155. package/packages/omo-codex/plugin/scripts/install-flow.mjs +43 -0
  1156. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +125 -0
  1157. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +43 -0
  1158. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +29 -0
  1159. package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +121 -0
  1160. package/packages/omo-codex/plugin/scripts/sync-skills.mjs +5 -5
  1161. package/packages/omo-codex/plugin/shared/package.json +24 -0
  1162. package/packages/omo-codex/plugin/shared/src/config-loader.ts +28 -0
  1163. package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +105 -0
  1164. package/packages/omo-codex/plugin/shared/tsconfig.build.json +9 -0
  1165. package/packages/omo-codex/plugin/shared/tsconfig.json +16 -0
  1166. package/packages/omo-codex/plugin/skills/ast-grep/LICENSE +21 -0
  1167. package/packages/omo-codex/plugin/skills/ast-grep/README.md +136 -0
  1168. package/packages/omo-codex/plugin/skills/ast-grep/SKILL.md +272 -0
  1169. package/packages/omo-codex/plugin/skills/ast-grep/SOURCE +1 -0
  1170. package/packages/omo-codex/plugin/skills/ast-grep/install.ps1 +235 -0
  1171. package/packages/omo-codex/plugin/skills/ast-grep/install.sh +286 -0
  1172. package/packages/omo-codex/plugin/skills/ast-grep/references/cli.md +231 -0
  1173. package/packages/omo-codex/plugin/skills/ast-grep/references/install.md +166 -0
  1174. package/packages/omo-codex/plugin/skills/ast-grep/references/patterns.md +147 -0
  1175. package/packages/omo-codex/plugin/skills/ast-grep/references/pitfalls.md +303 -0
  1176. package/packages/omo-codex/plugin/skills/ast-grep/references/recipes.md +402 -0
  1177. package/packages/omo-codex/plugin/skills/ast-grep/references/sgconfig.md +248 -0
  1178. package/packages/omo-codex/plugin/skills/ast-grep/references/yaml-rules.md +509 -0
  1179. package/packages/omo-codex/plugin/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
  1180. package/packages/omo-codex/plugin/skills/ast-grep/tests/smoke.ps1 +123 -0
  1181. package/packages/omo-codex/plugin/skills/ast-grep/tests/smoke.sh +212 -0
  1182. package/packages/omo-codex/plugin/skills/frontend/ATTRIBUTION.md +127 -0
  1183. package/packages/omo-codex/plugin/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
  1184. package/packages/omo-codex/plugin/skills/frontend/SKILL.md +113 -0
  1185. package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +240 -0
  1186. package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +189 -0
  1187. package/packages/omo-codex/plugin/skills/frontend/references/design/airbnb.md +390 -0
  1188. package/packages/omo-codex/plugin/skills/frontend/references/design/airtable.md +89 -0
  1189. package/packages/omo-codex/plugin/skills/frontend/references/design/apple.md +247 -0
  1190. package/packages/omo-codex/plugin/skills/frontend/references/design/binance.md +345 -0
  1191. package/packages/omo-codex/plugin/skills/frontend/references/design/bmw.md +180 -0
  1192. package/packages/omo-codex/plugin/skills/frontend/references/design/brutalist-skill.md +92 -0
  1193. package/packages/omo-codex/plugin/skills/frontend/references/design/bugatti.md +268 -0
  1194. package/packages/omo-codex/plugin/skills/frontend/references/design/cal.md +259 -0
  1195. package/packages/omo-codex/plugin/skills/frontend/references/design/claude.md +312 -0
  1196. package/packages/omo-codex/plugin/skills/frontend/references/design/clay.md +304 -0
  1197. package/packages/omo-codex/plugin/skills/frontend/references/design/clickhouse.md +281 -0
  1198. package/packages/omo-codex/plugin/skills/frontend/references/design/cohere.md +266 -0
  1199. package/packages/omo-codex/plugin/skills/frontend/references/design/coinbase.md +129 -0
  1200. package/packages/omo-codex/plugin/skills/frontend/references/design/composio.md +307 -0
  1201. package/packages/omo-codex/plugin/skills/frontend/references/design/cursor.md +309 -0
  1202. package/packages/omo-codex/plugin/skills/frontend/references/design/design-system-architecture.md +217 -0
  1203. package/packages/omo-codex/plugin/skills/frontend/references/design/elevenlabs.md +265 -0
  1204. package/packages/omo-codex/plugin/skills/frontend/references/design/expo.md +281 -0
  1205. package/packages/omo-codex/plugin/skills/frontend/references/design/ferrari.md +314 -0
  1206. package/packages/omo-codex/plugin/skills/frontend/references/design/figma.md +220 -0
  1207. package/packages/omo-codex/plugin/skills/frontend/references/design/framer.md +246 -0
  1208. package/packages/omo-codex/plugin/skills/frontend/references/design/gpt-tasteskill.md +74 -0
  1209. package/packages/omo-codex/plugin/skills/frontend/references/design/hashicorp.md +278 -0
  1210. package/packages/omo-codex/plugin/skills/frontend/references/design/ibm.md +332 -0
  1211. package/packages/omo-codex/plugin/skills/frontend/references/design/image-to-code-skill.md +1228 -0
  1212. package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-brandkit.md +798 -0
  1213. package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
  1214. package/packages/omo-codex/plugin/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
  1215. package/packages/omo-codex/plugin/skills/frontend/references/design/intercom.md +146 -0
  1216. package/packages/omo-codex/plugin/skills/frontend/references/design/kraken.md +125 -0
  1217. package/packages/omo-codex/plugin/skills/frontend/references/design/lamborghini.md +288 -0
  1218. package/packages/omo-codex/plugin/skills/frontend/references/design/linear.app.md +367 -0
  1219. package/packages/omo-codex/plugin/skills/frontend/references/design/lovable.md +298 -0
  1220. package/packages/omo-codex/plugin/skills/frontend/references/design/mastercard.md +365 -0
  1221. package/packages/omo-codex/plugin/skills/frontend/references/design/meta.md +366 -0
  1222. package/packages/omo-codex/plugin/skills/frontend/references/design/minimalist-skill.md +85 -0
  1223. package/packages/omo-codex/plugin/skills/frontend/references/design/minimax.md +257 -0
  1224. package/packages/omo-codex/plugin/skills/frontend/references/design/mintlify.md +326 -0
  1225. package/packages/omo-codex/plugin/skills/frontend/references/design/miro.md +108 -0
  1226. package/packages/omo-codex/plugin/skills/frontend/references/design/mistral.ai.md +261 -0
  1227. package/packages/omo-codex/plugin/skills/frontend/references/design/mongodb.md +266 -0
  1228. package/packages/omo-codex/plugin/skills/frontend/references/design/nike.md +363 -0
  1229. package/packages/omo-codex/plugin/skills/frontend/references/design/notion.md +309 -0
  1230. package/packages/omo-codex/plugin/skills/frontend/references/design/nvidia.md +293 -0
  1231. package/packages/omo-codex/plugin/skills/frontend/references/design/ollama.md +267 -0
  1232. package/packages/omo-codex/plugin/skills/frontend/references/design/opencode.ai.md +281 -0
  1233. package/packages/omo-codex/plugin/skills/frontend/references/design/output-skill.md +49 -0
  1234. package/packages/omo-codex/plugin/skills/frontend/references/design/pinterest.md +230 -0
  1235. package/packages/omo-codex/plugin/skills/frontend/references/design/playstation.md +364 -0
  1236. package/packages/omo-codex/plugin/skills/frontend/references/design/posthog.md +256 -0
  1237. package/packages/omo-codex/plugin/skills/frontend/references/design/raycast.md +268 -0
  1238. package/packages/omo-codex/plugin/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
  1239. package/packages/omo-codex/plugin/skills/frontend/references/design/redesign-skill.md +178 -0
  1240. package/packages/omo-codex/plugin/skills/frontend/references/design/renault.md +311 -0
  1241. package/packages/omo-codex/plugin/skills/frontend/references/design/replicate.md +261 -0
  1242. package/packages/omo-codex/plugin/skills/frontend/references/design/resend.md +303 -0
  1243. package/packages/omo-codex/plugin/skills/frontend/references/design/revolut.md +185 -0
  1244. package/packages/omo-codex/plugin/skills/frontend/references/design/runwayml.md +244 -0
  1245. package/packages/omo-codex/plugin/skills/frontend/references/design/sanity.md +357 -0
  1246. package/packages/omo-codex/plugin/skills/frontend/references/design/sentry.md +262 -0
  1247. package/packages/omo-codex/plugin/skills/frontend/references/design/shopify.md +350 -0
  1248. package/packages/omo-codex/plugin/skills/frontend/references/design/soft-skill.md +98 -0
  1249. package/packages/omo-codex/plugin/skills/frontend/references/design/spacex.md +194 -0
  1250. package/packages/omo-codex/plugin/skills/frontend/references/design/spotify.md +246 -0
  1251. package/packages/omo-codex/plugin/skills/frontend/references/design/starbucks.md +580 -0
  1252. package/packages/omo-codex/plugin/skills/frontend/references/design/stitch-skill.md +184 -0
  1253. package/packages/omo-codex/plugin/skills/frontend/references/design/stripe.md +322 -0
  1254. package/packages/omo-codex/plugin/skills/frontend/references/design/supabase.md +255 -0
  1255. package/packages/omo-codex/plugin/skills/frontend/references/design/superhuman.md +252 -0
  1256. package/packages/omo-codex/plugin/skills/frontend/references/design/taste-skill.md +226 -0
  1257. package/packages/omo-codex/plugin/skills/frontend/references/design/tesla.md +286 -0
  1258. package/packages/omo-codex/plugin/skills/frontend/references/design/theverge.md +339 -0
  1259. package/packages/omo-codex/plugin/skills/frontend/references/design/together.ai.md +263 -0
  1260. package/packages/omo-codex/plugin/skills/frontend/references/design/uber.md +295 -0
  1261. package/packages/omo-codex/plugin/skills/frontend/references/design/vercel.md +310 -0
  1262. package/packages/omo-codex/plugin/skills/frontend/references/design/vodafone.md +423 -0
  1263. package/packages/omo-codex/plugin/skills/frontend/references/design/voltagent.md +323 -0
  1264. package/packages/omo-codex/plugin/skills/frontend/references/design/warp.md +253 -0
  1265. package/packages/omo-codex/plugin/skills/frontend/references/design/webflow.md +92 -0
  1266. package/packages/omo-codex/plugin/skills/frontend/references/design/wired.md +278 -0
  1267. package/packages/omo-codex/plugin/skills/frontend/references/design/wise.md +173 -0
  1268. package/packages/omo-codex/plugin/skills/frontend/references/design/x.ai.md +257 -0
  1269. package/packages/omo-codex/plugin/skills/frontend/references/design/zapier.md +328 -0
  1270. package/packages/omo-codex/plugin/skills/frontend/references/perfection/README.md +160 -0
  1271. package/packages/omo-codex/plugin/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
  1272. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/README.md +273 -0
  1273. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
  1274. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
  1275. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
  1276. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
  1277. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
  1278. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
  1279. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
  1280. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
  1281. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
  1282. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
  1283. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
  1284. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
  1285. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
  1286. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
  1287. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
  1288. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
  1289. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
  1290. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
  1291. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
  1292. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
  1293. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
  1294. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
  1295. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
  1296. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
  1297. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
  1298. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
  1299. package/packages/omo-codex/plugin/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
  1300. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
  1301. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +3 -3
  1302. package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/SKILL.md +79 -28
  1303. package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/agents/openai.yaml +2 -2
  1304. package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +7 -6
  1305. package/packages/omo-codex/plugin/skills/lcx-report-bug/agents/openai.yaml +1 -1
  1306. package/packages/omo-codex/plugin/skills/refactor/SKILL.md +14 -23
  1307. package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +2 -2
  1308. package/packages/omo-codex/plugin/skills/review-work/SKILL.md +2 -2
  1309. package/packages/omo-codex/plugin/skills/start-work/SKILL.md +3 -3
  1310. package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +2 -2
  1311. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +17 -17
  1312. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +42 -47
  1313. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +64 -102
  1314. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-clear.md +44 -0
  1315. package/packages/omo-codex/plugin/skills/ulw-plan/references/intent-unclear.md +44 -0
  1316. package/packages/omo-codex/plugin/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
  1317. package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +19 -3
  1318. package/packages/omo-codex/plugin/skills/visual-qa/references/agent-browser-setup.md +44 -0
  1319. package/packages/omo-codex/plugin/test/aggregate-agents.test.mjs +119 -11
  1320. package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +2 -4
  1321. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +29 -2
  1322. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +3 -0
  1323. package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +12 -12
  1324. package/packages/omo-codex/plugin/test/auto-update.test.mjs +171 -0
  1325. package/packages/omo-codex/plugin/test/bootstrap-binlinks.test.mjs +250 -0
  1326. package/packages/omo-codex/plugin/test/bootstrap-hooks.test.mjs +166 -0
  1327. package/packages/omo-codex/plugin/test/bootstrap-orchestration.test.mjs +371 -0
  1328. package/packages/omo-codex/plugin/test/bootstrap-ps-guard.test.mjs +134 -0
  1329. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +249 -0
  1330. package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +287 -0
  1331. package/packages/omo-codex/plugin/test/component-hook-contract-cases.mjs +199 -0
  1332. package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +38 -2
  1333. package/packages/omo-codex/plugin/test/index.js +13 -0
  1334. package/packages/omo-codex/plugin/test/install-time-build-runtime.test.mjs +4 -5
  1335. package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +10 -1
  1336. package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +5 -3
  1337. package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +179 -0
  1338. package/packages/omo-codex/plugin/test/payload-equivalence.test.mjs +109 -0
  1339. package/packages/omo-codex/plugin/test/scaffold-plan.test.mjs +165 -0
  1340. package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +6 -6
  1341. package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -3
  1342. package/packages/omo-codex/plugin/test/sync-skills.test.mjs +37 -1
  1343. package/packages/omo-codex/scripts/install-agent-links.test.mjs +41 -0
  1344. package/packages/omo-codex/scripts/install-bin-links.test.mjs +3 -3
  1345. package/packages/omo-codex/scripts/install-cache-copy.test.mjs +1 -1
  1346. package/packages/omo-codex/scripts/install-cli-args.test.mjs +1 -1
  1347. package/packages/omo-codex/scripts/install-config-autonomous-features.test.mjs +1 -1
  1348. package/packages/omo-codex/scripts/install-config-autonomous.test.mjs +1 -1
  1349. package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +1 -1
  1350. package/packages/omo-codex/scripts/install-config-preservation.test.mjs +1 -1
  1351. package/packages/omo-codex/scripts/install-config-reasoning.test.mjs +1 -2
  1352. package/packages/omo-codex/scripts/install-config.test.mjs +8 -6
  1353. package/packages/omo-codex/scripts/install-delegated-command.test.mjs +1 -1
  1354. package/packages/omo-codex/scripts/install-dist/install-local.mjs +13377 -0
  1355. package/packages/omo-codex/scripts/install-generated-bundle.test.mjs +55 -0
  1356. package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +3 -4
  1357. package/packages/omo-codex/scripts/install-hook-targets.test.mjs +1 -1
  1358. package/packages/omo-codex/scripts/install-local.mjs +54 -236
  1359. package/packages/omo-codex/scripts/install-local.test.mjs +8 -1
  1360. package/packages/omo-codex/scripts/install-marketplace-cache.test.mjs +3 -3
  1361. package/packages/omo-codex/scripts/install-mcp-runtime.test.mjs +34 -77
  1362. package/packages/omo-codex/scripts/install-packaged-local.test.mjs +8 -4
  1363. package/packages/omo-codex/scripts/install-project-local-cleanup.test.mjs +1 -1
  1364. package/packages/shared-skills/package.json +6 -1
  1365. package/packages/shared-skills/skills/ast-grep/LICENSE +21 -0
  1366. package/packages/shared-skills/skills/ast-grep/README.md +136 -0
  1367. package/packages/shared-skills/skills/ast-grep/SKILL.md +272 -0
  1368. package/packages/shared-skills/skills/ast-grep/SOURCE +1 -0
  1369. package/packages/shared-skills/skills/ast-grep/install.ps1 +235 -0
  1370. package/packages/shared-skills/skills/ast-grep/install.sh +286 -0
  1371. package/packages/shared-skills/skills/ast-grep/references/cli.md +231 -0
  1372. package/packages/shared-skills/skills/ast-grep/references/install.md +166 -0
  1373. package/packages/shared-skills/skills/ast-grep/references/patterns.md +147 -0
  1374. package/packages/shared-skills/skills/ast-grep/references/pitfalls.md +303 -0
  1375. package/packages/shared-skills/skills/ast-grep/references/recipes.md +402 -0
  1376. package/packages/shared-skills/skills/ast-grep/references/sgconfig.md +248 -0
  1377. package/packages/shared-skills/skills/ast-grep/references/yaml-rules.md +509 -0
  1378. package/packages/shared-skills/skills/ast-grep/scripts/ast_grep_helper.py +748 -0
  1379. package/packages/shared-skills/skills/ast-grep/tests/smoke.ps1 +123 -0
  1380. package/packages/shared-skills/skills/ast-grep/tests/smoke.sh +212 -0
  1381. package/packages/shared-skills/skills/frontend/ATTRIBUTION.md +127 -0
  1382. package/packages/shared-skills/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
  1383. package/packages/shared-skills/skills/frontend/SKILL.md +113 -0
  1384. package/packages/shared-skills/skills/frontend/references/design/README.md +240 -0
  1385. package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +189 -0
  1386. package/packages/shared-skills/skills/frontend/references/design/airbnb.md +390 -0
  1387. package/packages/shared-skills/skills/frontend/references/design/airtable.md +89 -0
  1388. package/packages/shared-skills/skills/frontend/references/design/apple.md +247 -0
  1389. package/packages/shared-skills/skills/frontend/references/design/binance.md +345 -0
  1390. package/packages/shared-skills/skills/frontend/references/design/bmw.md +180 -0
  1391. package/packages/shared-skills/skills/frontend/references/design/brutalist-skill.md +92 -0
  1392. package/packages/shared-skills/skills/frontend/references/design/bugatti.md +268 -0
  1393. package/packages/shared-skills/skills/frontend/references/design/cal.md +259 -0
  1394. package/packages/shared-skills/skills/frontend/references/design/claude.md +312 -0
  1395. package/packages/shared-skills/skills/frontend/references/design/clay.md +304 -0
  1396. package/packages/shared-skills/skills/frontend/references/design/clickhouse.md +281 -0
  1397. package/packages/shared-skills/skills/frontend/references/design/cohere.md +266 -0
  1398. package/packages/shared-skills/skills/frontend/references/design/coinbase.md +129 -0
  1399. package/packages/shared-skills/skills/frontend/references/design/composio.md +307 -0
  1400. package/packages/shared-skills/skills/frontend/references/design/cursor.md +309 -0
  1401. package/packages/shared-skills/skills/frontend/references/design/design-system-architecture.md +217 -0
  1402. package/packages/shared-skills/skills/frontend/references/design/elevenlabs.md +265 -0
  1403. package/packages/shared-skills/skills/frontend/references/design/expo.md +281 -0
  1404. package/packages/shared-skills/skills/frontend/references/design/ferrari.md +314 -0
  1405. package/packages/shared-skills/skills/frontend/references/design/figma.md +220 -0
  1406. package/packages/shared-skills/skills/frontend/references/design/framer.md +246 -0
  1407. package/packages/shared-skills/skills/frontend/references/design/gpt-tasteskill.md +74 -0
  1408. package/packages/shared-skills/skills/frontend/references/design/hashicorp.md +278 -0
  1409. package/packages/shared-skills/skills/frontend/references/design/ibm.md +332 -0
  1410. package/packages/shared-skills/skills/frontend/references/design/image-to-code-skill.md +1228 -0
  1411. package/packages/shared-skills/skills/frontend/references/design/imagegen-brandkit.md +798 -0
  1412. package/packages/shared-skills/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
  1413. package/packages/shared-skills/skills/frontend/references/design/imagegen-frontend-web.md +686 -0
  1414. package/packages/shared-skills/skills/frontend/references/design/intercom.md +146 -0
  1415. package/packages/shared-skills/skills/frontend/references/design/kraken.md +125 -0
  1416. package/packages/shared-skills/skills/frontend/references/design/lamborghini.md +288 -0
  1417. package/packages/shared-skills/skills/frontend/references/design/linear.app.md +367 -0
  1418. package/packages/shared-skills/skills/frontend/references/design/lovable.md +298 -0
  1419. package/packages/shared-skills/skills/frontend/references/design/mastercard.md +365 -0
  1420. package/packages/shared-skills/skills/frontend/references/design/meta.md +366 -0
  1421. package/packages/shared-skills/skills/frontend/references/design/minimalist-skill.md +85 -0
  1422. package/packages/shared-skills/skills/frontend/references/design/minimax.md +257 -0
  1423. package/packages/shared-skills/skills/frontend/references/design/mintlify.md +326 -0
  1424. package/packages/shared-skills/skills/frontend/references/design/miro.md +108 -0
  1425. package/packages/shared-skills/skills/frontend/references/design/mistral.ai.md +261 -0
  1426. package/packages/shared-skills/skills/frontend/references/design/mongodb.md +266 -0
  1427. package/packages/shared-skills/skills/frontend/references/design/nike.md +363 -0
  1428. package/packages/shared-skills/skills/frontend/references/design/notion.md +309 -0
  1429. package/packages/shared-skills/skills/frontend/references/design/nvidia.md +293 -0
  1430. package/packages/shared-skills/skills/frontend/references/design/ollama.md +267 -0
  1431. package/packages/shared-skills/skills/frontend/references/design/opencode.ai.md +281 -0
  1432. package/packages/shared-skills/skills/frontend/references/design/output-skill.md +49 -0
  1433. package/packages/shared-skills/skills/frontend/references/design/pinterest.md +230 -0
  1434. package/packages/shared-skills/skills/frontend/references/design/playstation.md +364 -0
  1435. package/packages/shared-skills/skills/frontend/references/design/posthog.md +256 -0
  1436. package/packages/shared-skills/skills/frontend/references/design/raycast.md +268 -0
  1437. package/packages/shared-skills/skills/frontend/references/design/react-dev-tooling-skill.md +230 -0
  1438. package/packages/shared-skills/skills/frontend/references/design/redesign-skill.md +178 -0
  1439. package/packages/shared-skills/skills/frontend/references/design/renault.md +311 -0
  1440. package/packages/shared-skills/skills/frontend/references/design/replicate.md +261 -0
  1441. package/packages/shared-skills/skills/frontend/references/design/resend.md +303 -0
  1442. package/packages/shared-skills/skills/frontend/references/design/revolut.md +185 -0
  1443. package/packages/shared-skills/skills/frontend/references/design/runwayml.md +244 -0
  1444. package/packages/shared-skills/skills/frontend/references/design/sanity.md +357 -0
  1445. package/packages/shared-skills/skills/frontend/references/design/sentry.md +262 -0
  1446. package/packages/shared-skills/skills/frontend/references/design/shopify.md +350 -0
  1447. package/packages/shared-skills/skills/frontend/references/design/soft-skill.md +98 -0
  1448. package/packages/shared-skills/skills/frontend/references/design/spacex.md +194 -0
  1449. package/packages/shared-skills/skills/frontend/references/design/spotify.md +246 -0
  1450. package/packages/shared-skills/skills/frontend/references/design/starbucks.md +580 -0
  1451. package/packages/shared-skills/skills/frontend/references/design/stitch-skill.md +184 -0
  1452. package/packages/shared-skills/skills/frontend/references/design/stripe.md +322 -0
  1453. package/packages/shared-skills/skills/frontend/references/design/supabase.md +255 -0
  1454. package/packages/shared-skills/skills/frontend/references/design/superhuman.md +252 -0
  1455. package/packages/shared-skills/skills/frontend/references/design/taste-skill.md +226 -0
  1456. package/packages/shared-skills/skills/frontend/references/design/tesla.md +286 -0
  1457. package/packages/shared-skills/skills/frontend/references/design/theverge.md +339 -0
  1458. package/packages/shared-skills/skills/frontend/references/design/together.ai.md +263 -0
  1459. package/packages/shared-skills/skills/frontend/references/design/uber.md +295 -0
  1460. package/packages/shared-skills/skills/frontend/references/design/vercel.md +310 -0
  1461. package/packages/shared-skills/skills/frontend/references/design/vodafone.md +423 -0
  1462. package/packages/shared-skills/skills/frontend/references/design/voltagent.md +323 -0
  1463. package/packages/shared-skills/skills/frontend/references/design/warp.md +253 -0
  1464. package/packages/shared-skills/skills/frontend/references/design/webflow.md +92 -0
  1465. package/packages/shared-skills/skills/frontend/references/design/wired.md +278 -0
  1466. package/packages/shared-skills/skills/frontend/references/design/wise.md +173 -0
  1467. package/packages/shared-skills/skills/frontend/references/design/x.ai.md +257 -0
  1468. package/packages/shared-skills/skills/frontend/references/design/zapier.md +328 -0
  1469. package/packages/shared-skills/skills/frontend/references/perfection/README.md +160 -0
  1470. package/packages/shared-skills/skills/frontend/references/perfection/react-perf-tooling.md +127 -0
  1471. package/packages/shared-skills/skills/frontend/references/ui-ux-db/README.md +273 -0
  1472. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
  1473. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/colors.csv +97 -0
  1474. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/icons.csv +101 -0
  1475. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/landing.csv +31 -0
  1476. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/products.csv +97 -0
  1477. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
  1478. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
  1479. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
  1480. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
  1481. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
  1482. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
  1483. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
  1484. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
  1485. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
  1486. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
  1487. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
  1488. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
  1489. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
  1490. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
  1491. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/styles.csv +68 -0
  1492. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/typography.csv +58 -0
  1493. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +101 -0
  1494. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
  1495. package/packages/shared-skills/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
  1496. package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/core.py +253 -0
  1497. package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/design_system.py +1067 -0
  1498. package/packages/shared-skills/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
  1499. package/packages/shared-skills/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
  1500. package/packages/shared-skills/skills/init-deep/SKILL.md +1 -1
  1501. package/packages/shared-skills/skills/lcx-contribute-bug-fix/SKILL.md +79 -28
  1502. package/packages/shared-skills/skills/lcx-contribute-bug-fix/agents/openai.yaml +2 -2
  1503. package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +7 -6
  1504. package/packages/shared-skills/skills/lcx-report-bug/agents/openai.yaml +1 -1
  1505. package/packages/shared-skills/skills/refactor/SKILL.md +12 -21
  1506. package/packages/shared-skills/skills/review-work/SKILL.md +11 -9
  1507. package/packages/shared-skills/skills/start-work/SKILL.md +5 -4
  1508. package/packages/shared-skills/skills/ultraresearch/SKILL.md +9 -8
  1509. package/packages/shared-skills/skills/ulw-plan/SKILL.md +69 -0
  1510. package/packages/shared-skills/skills/ulw-plan/agents/openai.yaml +7 -0
  1511. package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +99 -0
  1512. package/packages/shared-skills/skills/ulw-plan/references/intent-clear.md +44 -0
  1513. package/packages/shared-skills/skills/ulw-plan/references/intent-unclear.md +44 -0
  1514. package/packages/shared-skills/skills/ulw-plan/scripts/scaffold-plan.mjs +301 -0
  1515. package/packages/shared-skills/skills/visual-qa/SKILL.md +17 -1
  1516. package/packages/shared-skills/skills/visual-qa/references/agent-browser-setup.md +44 -0
  1517. package/packages/shared-skills/skills/visual-qa/scripts/skill-prompt-contract.test.ts +48 -4
  1518. package/dist/cli/doctor/constants.d.ts +0 -32
  1519. package/dist/cli/doctor/spawn-with-timeout.d.ts +0 -8
  1520. package/dist/cli/doctor/types.d.ts +0 -148
  1521. package/dist/features/builtin-skills/skills/frontend-ui-ux.d.ts +0 -2
  1522. package/dist/hooks/session-recovery/constants.d.ts +0 -4
  1523. package/dist/hooks/session-recovery/detect-error-type.d.ts +0 -4
  1524. package/dist/hooks/session-recovery/error-recovery.d.ts +0 -4
  1525. package/dist/hooks/session-recovery/hook-types.d.ts +0 -22
  1526. package/dist/hooks/session-recovery/hook.d.ts +0 -4
  1527. package/dist/hooks/session-recovery/index.d.ts +0 -5
  1528. package/dist/hooks/session-recovery/interrupted-idle-message-fetch-timeout.d.ts +0 -7
  1529. package/dist/hooks/session-recovery/interrupted-tool-results.d.ts +0 -3
  1530. package/dist/hooks/session-recovery/message-state.d.ts +0 -4
  1531. package/dist/hooks/session-recovery/recover-thinking-block-order.d.ts +0 -5
  1532. package/dist/hooks/session-recovery/recover-thinking-disabled-violation.d.ts +0 -5
  1533. package/dist/hooks/session-recovery/recover-tool-result-missing.d.ts +0 -10
  1534. package/dist/hooks/session-recovery/recover-unavailable-tool.d.ts +0 -5
  1535. package/dist/hooks/session-recovery/resume.d.ts +0 -7
  1536. package/dist/hooks/session-recovery/storage/latest-assistant-message.d.ts +0 -5
  1537. package/dist/hooks/session-recovery/storage/messages-reader.d.ts +0 -6
  1538. package/dist/hooks/session-recovery/storage/orphan-thinking-search.d.ts +0 -2
  1539. package/dist/hooks/session-recovery/storage/part-content.d.ts +0 -3
  1540. package/dist/hooks/session-recovery/storage/parts-reader.d.ts +0 -6
  1541. package/dist/hooks/session-recovery/storage/thinking-block-search.d.ts +0 -2
  1542. package/dist/hooks/session-recovery/storage/thinking-prepend.d.ts +0 -33
  1543. package/dist/hooks/session-recovery/storage/thinking-strip.d.ts +0 -11
  1544. package/dist/hooks/session-recovery/storage.d.ts +0 -20
  1545. package/dist/hooks/session-recovery/types.d.ts +0 -105
  1546. package/dist/mcp/ast-grep.d.ts +0 -11
  1547. package/dist/plugin/event-session-recovery.d.ts +0 -9
  1548. package/dist/plugin/user-abort-interrupted-recovery-guard.d.ts +0 -6
  1549. package/packages/ast-grep-mcp/dist/cli.js +0 -1126
  1550. package/packages/lsp-tools-mcp/dist/lsp/cleanup-errors.js +0 -6
  1551. package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.js +0 -132
  1552. package/packages/lsp-tools-mcp/dist/lsp/client.js +0 -131
  1553. package/packages/lsp-tools-mcp/dist/lsp/config-loader.js +0 -220
  1554. package/packages/lsp-tools-mcp/dist/lsp/connection.js +0 -66
  1555. package/packages/lsp-tools-mcp/dist/lsp/constants.js +0 -10
  1556. package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.js +0 -125
  1557. package/packages/lsp-tools-mcp/dist/lsp/effective-extension.js +0 -8
  1558. package/packages/lsp-tools-mcp/dist/lsp/errors.js +0 -56
  1559. package/packages/lsp-tools-mcp/dist/lsp/formatters.js +0 -106
  1560. package/packages/lsp-tools-mcp/dist/lsp/infer-extension.js +0 -59
  1561. package/packages/lsp-tools-mcp/dist/lsp/json-rpc-connection.js +0 -247
  1562. package/packages/lsp-tools-mcp/dist/lsp/language-mappings.js +0 -170
  1563. package/packages/lsp-tools-mcp/dist/lsp/process-signal-cleanup.js +0 -17
  1564. package/packages/lsp-tools-mcp/dist/lsp/process.js +0 -153
  1565. package/packages/lsp-tools-mcp/dist/lsp/server-definitions.js +0 -170
  1566. package/packages/lsp-tools-mcp/dist/lsp/server-install-state.js +0 -51
  1567. package/packages/lsp-tools-mcp/dist/lsp/server-installation.js +0 -40
  1568. package/packages/lsp-tools-mcp/dist/lsp/server-resolution.js +0 -86
  1569. package/packages/lsp-tools-mcp/dist/lsp/startup-failure.js +0 -35
  1570. package/packages/lsp-tools-mcp/dist/lsp/transport.js +0 -238
  1571. package/packages/lsp-tools-mcp/dist/lsp/types.js +0 -1
  1572. package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.js +0 -175
  1573. package/packages/lsp-tools-mcp/dist/missing-dependency-result.js +0 -14
  1574. package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.d.ts +0 -7
  1575. package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.js +0 -173
  1576. package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.d.ts +0 -22
  1577. package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.js +0 -165
  1578. package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.d.ts +0 -1
  1579. package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.js +0 -1
  1580. package/packages/omo-codex/plugin/components/comment-checker/dist/core.d.ts +0 -5
  1581. package/packages/omo-codex/plugin/components/comment-checker/dist/core.js +0 -4
  1582. package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.d.ts +0 -6
  1583. package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.js +0 -10
  1584. package/packages/omo-codex/plugin/components/comment-checker/dist/record.d.ts +0 -2
  1585. package/packages/omo-codex/plugin/components/comment-checker/dist/record.js +0 -11
  1586. package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.d.ts +0 -3
  1587. package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.js +0 -104
  1588. package/packages/omo-codex/plugin/components/comment-checker/dist/runner.d.ts +0 -26
  1589. package/packages/omo-codex/plugin/components/comment-checker/dist/runner.js +0 -144
  1590. package/packages/omo-codex/plugin/components/comment-checker/dist/types.d.ts +0 -43
  1591. package/packages/omo-codex/plugin/components/comment-checker/dist/types.js +0 -1
  1592. package/packages/omo-codex/plugin/components/comment-checker/src/record.ts +0 -11
  1593. package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.d.ts +0 -5
  1594. package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.js +0 -1
  1595. package/packages/omo-codex/plugin/components/rules/dist/codex-hook.d.ts +0 -47
  1596. package/packages/omo-codex/plugin/components/rules/dist/codex-hook.js +0 -127
  1597. package/packages/omo-codex/plugin/components/rules/dist/config.d.ts +0 -2
  1598. package/packages/omo-codex/plugin/components/rules/dist/config.js +0 -100
  1599. package/packages/omo-codex/plugin/components/rules/dist/context-pressure.d.ts +0 -2
  1600. package/packages/omo-codex/plugin/components/rules/dist/context-pressure.js +0 -26
  1601. package/packages/omo-codex/plugin/components/rules/dist/debug-log.d.ts +0 -8
  1602. package/packages/omo-codex/plugin/components/rules/dist/debug-log.js +0 -36
  1603. package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.d.ts +0 -7
  1604. package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.js +0 -65
  1605. package/packages/omo-codex/plugin/components/rules/dist/event-budget.d.ts +0 -3
  1606. package/packages/omo-codex/plugin/components/rules/dist/event-budget.js +0 -14
  1607. package/packages/omo-codex/plugin/components/rules/dist/hook-output.d.ts +0 -2
  1608. package/packages/omo-codex/plugin/components/rules/dist/hook-output.js +0 -24
  1609. package/packages/omo-codex/plugin/components/rules/dist/path-utils.d.ts +0 -4
  1610. package/packages/omo-codex/plugin/components/rules/dist/path-utils.js +0 -24
  1611. package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.d.ts +0 -13
  1612. package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.js +0 -172
  1613. package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.d.ts +0 -6
  1614. package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.js +0 -74
  1615. package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.d.ts +0 -4
  1616. package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.js +0 -6
  1617. package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.d.ts +0 -1
  1618. package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.js +0 -32
  1619. package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.d.ts +0 -13
  1620. package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.js +0 -29
  1621. package/packages/omo-codex/plugin/components/rules/dist/rules/cache.d.ts +0 -9
  1622. package/packages/omo-codex/plugin/components/rules/dist/rules/cache.js +0 -51
  1623. package/packages/omo-codex/plugin/components/rules/dist/rules/constants.d.ts +0 -70
  1624. package/packages/omo-codex/plugin/components/rules/dist/rules/constants.js +0 -101
  1625. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.d.ts +0 -5
  1626. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.js +0 -60
  1627. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.d.ts +0 -6
  1628. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.js +0 -61
  1629. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.d.ts +0 -7
  1630. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.js +0 -60
  1631. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.d.ts +0 -11
  1632. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.js +0 -75
  1633. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.d.ts +0 -6
  1634. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.js +0 -29
  1635. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.d.ts +0 -44
  1636. package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.js +0 -1
  1637. package/packages/omo-codex/plugin/components/rules/dist/rules/engine.d.ts +0 -5
  1638. package/packages/omo-codex/plugin/components/rules/dist/rules/engine.js +0 -85
  1639. package/packages/omo-codex/plugin/components/rules/dist/rules/errors.d.ts +0 -6
  1640. package/packages/omo-codex/plugin/components/rules/dist/rules/errors.js +0 -12
  1641. package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.d.ts +0 -14
  1642. package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.js +0 -51
  1643. package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.d.ts +0 -6
  1644. package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.js +0 -33
  1645. package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.d.ts +0 -5
  1646. package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.js +0 -40
  1647. package/packages/omo-codex/plugin/components/rules/dist/rules/finder.d.ts +0 -28
  1648. package/packages/omo-codex/plugin/components/rules/dist/rules/finder.js +0 -146
  1649. package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.d.ts +0 -7
  1650. package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.js +0 -112
  1651. package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.d.ts +0 -18
  1652. package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.js +0 -93
  1653. package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.d.ts +0 -3
  1654. package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.js +0 -27
  1655. package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.d.ts +0 -7
  1656. package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.js +0 -30
  1657. package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.d.ts +0 -2
  1658. package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.js +0 -237
  1659. package/packages/omo-codex/plugin/components/rules/dist/rules/parser.d.ts +0 -3
  1660. package/packages/omo-codex/plugin/components/rules/dist/rules/parser.js +0 -31
  1661. package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.d.ts +0 -1
  1662. package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.js +0 -48
  1663. package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.d.ts +0 -1
  1664. package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.js +0 -23
  1665. package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.d.ts +0 -14
  1666. package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.js +0 -111
  1667. package/packages/omo-codex/plugin/components/rules/dist/rules/sources.d.ts +0 -3
  1668. package/packages/omo-codex/plugin/components/rules/dist/rules/sources.js +0 -9
  1669. package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.d.ts +0 -18
  1670. package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.js +0 -59
  1671. package/packages/omo-codex/plugin/components/rules/dist/rules/types.d.ts +0 -126
  1672. package/packages/omo-codex/plugin/components/rules/dist/rules/types.js +0 -8
  1673. package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.d.ts +0 -6
  1674. package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.js +0 -20
  1675. package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.d.ts +0 -3
  1676. package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.js +0 -41
  1677. package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.d.ts +0 -10
  1678. package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.js +0 -90
  1679. package/packages/omo-codex/plugin/components/rules/dist/static-injection.d.ts +0 -3
  1680. package/packages/omo-codex/plugin/components/rules/dist/static-injection.js +0 -128
  1681. package/packages/omo-codex/plugin/components/rules/dist/tool-paths.d.ts +0 -6
  1682. package/packages/omo-codex/plugin/components/rules/dist/tool-paths.js +0 -168
  1683. package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.d.ts +0 -4
  1684. package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.js +0 -49
  1685. package/packages/omo-codex/plugin/components/rules/dist/transcript-search.d.ts +0 -4
  1686. package/packages/omo-codex/plugin/components/rules/dist/transcript-search.js +0 -91
  1687. package/packages/omo-codex/plugin/components/rules/src/rules/cache.ts +0 -64
  1688. package/packages/omo-codex/plugin/components/rules/src/rules/constants.ts +0 -122
  1689. package/packages/omo-codex/plugin/components/rules/src/rules/engine-dynamic-cache.ts +0 -87
  1690. package/packages/omo-codex/plugin/components/rules/src/rules/engine-dynamic-loader.ts +0 -94
  1691. package/packages/omo-codex/plugin/components/rules/src/rules/engine-loader.ts +0 -84
  1692. package/packages/omo-codex/plugin/components/rules/src/rules/engine-paths.ts +0 -103
  1693. package/packages/omo-codex/plugin/components/rules/src/rules/engine-static-loader.ts +0 -43
  1694. package/packages/omo-codex/plugin/components/rules/src/rules/engine-types.ts +0 -45
  1695. package/packages/omo-codex/plugin/components/rules/src/rules/engine.ts +0 -123
  1696. package/packages/omo-codex/plugin/components/rules/src/rules/errors.ts +0 -13
  1697. package/packages/omo-codex/plugin/components/rules/src/rules/finder-cache.ts +0 -73
  1698. package/packages/omo-codex/plugin/components/rules/src/rules/finder-paths.ts +0 -47
  1699. package/packages/omo-codex/plugin/components/rules/src/rules/finder-sources.ts +0 -45
  1700. package/packages/omo-codex/plugin/components/rules/src/rules/finder.ts +0 -220
  1701. package/packages/omo-codex/plugin/components/rules/src/rules/formatter.ts +0 -149
  1702. package/packages/omo-codex/plugin/components/rules/src/rules/matcher.ts +0 -142
  1703. package/packages/omo-codex/plugin/components/rules/src/rules/ordering.ts +0 -33
  1704. package/packages/omo-codex/plugin/components/rules/src/rules/parser-frontmatter.ts +0 -39
  1705. package/packages/omo-codex/plugin/components/rules/src/rules/parser-yaml.ts +0 -271
  1706. package/packages/omo-codex/plugin/components/rules/src/rules/parser.ts +0 -35
  1707. package/packages/omo-codex/plugin/components/rules/src/rules/plugin-root.ts +0 -55
  1708. package/packages/omo-codex/plugin/components/rules/src/rules/project-root.ts +0 -30
  1709. package/packages/omo-codex/plugin/components/rules/src/rules/scanner.ts +0 -162
  1710. package/packages/omo-codex/plugin/components/rules/src/rules/sources.ts +0 -13
  1711. package/packages/omo-codex/plugin/components/rules/src/rules/truncator.ts +0 -84
  1712. package/packages/omo-codex/plugin/components/rules/src/rules/types.ts +0 -141
  1713. package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.d.ts +0 -16
  1714. package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.js +0 -146
  1715. package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.d.ts +0 -2
  1716. package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.d.ts +0 -2
  1717. package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.js +0 -80
  1718. package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.d.ts +0 -1
  1719. package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.js +0 -2
  1720. package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.d.ts +0 -5
  1721. package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.js +0 -3
  1722. package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.d.ts +0 -20
  1723. package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.js +0 -1
  1724. package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.d.ts +0 -1
  1725. package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.js +0 -18
  1726. package/packages/omo-codex/plugin/components/telemetry/dist/cli.d.ts +0 -2
  1727. package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.d.ts +0 -15
  1728. package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.js +0 -42
  1729. package/packages/omo-codex/plugin/components/telemetry/dist/data-path.d.ts +0 -10
  1730. package/packages/omo-codex/plugin/components/telemetry/dist/data-path.js +0 -35
  1731. package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.d.ts +0 -12
  1732. package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.js +0 -108
  1733. package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.d.ts +0 -4
  1734. package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.js +0 -31
  1735. package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.d.ts +0 -8
  1736. package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.js +0 -68
  1737. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.d.ts +0 -21
  1738. package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.d.ts +0 -8
  1739. package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.js +0 -29
  1740. package/packages/omo-codex/plugin/components/telemetry/src/atomic-write.ts +0 -22
  1741. package/packages/omo-codex/plugin/components/telemetry/src/data-path.ts +0 -45
  1742. package/packages/omo-codex/plugin/components/telemetry/src/diagnostics.ts +0 -154
  1743. package/packages/omo-codex/plugin/components/telemetry/src/env-flags.ts +0 -43
  1744. package/packages/omo-codex/plugin/components/telemetry/src/posthog-activity-state.ts +0 -97
  1745. package/packages/omo-codex/plugin/components/ultrawork/agents/codex-ultrawork-reviewer.toml +0 -21
  1746. package/packages/omo-codex/plugin/components/ultrawork/dist/cli.d.ts +0 -2
  1747. package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.d.ts +0 -7
  1748. package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.js +0 -122
  1749. package/packages/omo-codex/plugin/components/ultrawork/dist/directive.d.ts +0 -1
  1750. package/packages/omo-codex/plugin/components/ultrawork/dist/directive.js +0 -2
  1751. package/packages/omo-codex/plugin/skills/frontend-ui-ux/SKILL.md +0 -77
  1752. package/packages/omo-codex/plugin/test/start-work-skill.test.mjs +0 -85
  1753. package/packages/omo-codex/plugin/test/ulw-plan-skill.test.mjs +0 -43
  1754. package/packages/omo-codex/scripts/install/agent-source-roots.mjs +0 -13
  1755. package/packages/omo-codex/scripts/install/agents.mjs +0 -154
  1756. package/packages/omo-codex/scripts/install/bin-dir.mjs +0 -20
  1757. package/packages/omo-codex/scripts/install/bin-links.mjs +0 -276
  1758. package/packages/omo-codex/scripts/install/cache.mjs +0 -295
  1759. package/packages/omo-codex/scripts/install/cached-marketplace-manifest.mjs +0 -21
  1760. package/packages/omo-codex/scripts/install/cli-args.mjs +0 -149
  1761. package/packages/omo-codex/scripts/install/command-shim.mjs +0 -1
  1762. package/packages/omo-codex/scripts/install/config.mjs +0 -257
  1763. package/packages/omo-codex/scripts/install/delegated-command.mjs +0 -29
  1764. package/packages/omo-codex/scripts/install/git-bash-mcp-env.mjs +0 -28
  1765. package/packages/omo-codex/scripts/install/git-bash.mjs +0 -107
  1766. package/packages/omo-codex/scripts/install/git-bash.test.mjs +0 -209
  1767. package/packages/omo-codex/scripts/install/hook-targets.mjs +0 -46
  1768. package/packages/omo-codex/scripts/install/hook-trust.mjs +0 -84
  1769. package/packages/omo-codex/scripts/install/lazycodex-version-stamp.mjs +0 -102
  1770. package/packages/omo-codex/scripts/install/legacy-bins.mjs +0 -66
  1771. package/packages/omo-codex/scripts/install/marketplace.mjs +0 -104
  1772. package/packages/omo-codex/scripts/install/mcp-runtime-cache.mjs +0 -81
  1773. package/packages/omo-codex/scripts/install/model-catalog.mjs +0 -74
  1774. package/packages/omo-codex/scripts/install/multi-agent-v2-config.mjs +0 -50
  1775. package/packages/omo-codex/scripts/install/permissions.d.mts +0 -1
  1776. package/packages/omo-codex/scripts/install/permissions.mjs +0 -37
  1777. package/packages/omo-codex/scripts/install/process.mjs +0 -22
  1778. package/packages/omo-codex/scripts/install/project-local-cleanup.mjs +0 -228
  1779. package/packages/omo-codex/scripts/install/reasoning-config.mjs +0 -72
  1780. package/packages/omo-codex/scripts/install/snapshot.mjs +0 -53
  1781. package/packages/omo-codex/scripts/install/source-package-build.mjs +0 -20
  1782. package/packages/omo-codex/scripts/install/toml-editor.mjs +0 -64
  1783. package/packages/omo-codex/scripts/install/utils.mjs +0 -15
  1784. package/packages/omo-codex/scripts/sync-telemetry-component.mjs +0 -116
  1785. package/packages/omo-codex/scripts/sync-telemetry-component.test.mjs +0 -94
  1786. package/packages/shared-skills/skills/frontend-ui-ux/SKILL.md +0 -77
  1787. /package/dist/cli/doctor/{doctor-target.d.ts → framework/doctor-target.d.ts} +0 -0
  1788. /package/dist/cli/doctor/{format-default.d.ts → framework/format-default.d.ts} +0 -0
  1789. /package/dist/cli/doctor/{format-shared.d.ts → framework/format-shared.d.ts} +0 -0
  1790. /package/dist/cli/doctor/{format-status.d.ts → framework/format-status.d.ts} +0 -0
  1791. /package/dist/cli/doctor/{format-verbose.d.ts → framework/format-verbose.d.ts} +0 -0
  1792. /package/dist/cli/doctor/{formatter.d.ts → framework/formatter.d.ts} +0 -0
  1793. /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/empty-messages.d.ts +0 -0
  1794. /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/empty-text.d.ts +0 -0
  1795. /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/message-dir.d.ts +0 -0
  1796. /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/part-id.d.ts +0 -0
  1797. /package/dist/hooks/{session-recovery → anthropic-context-window-limit-recovery}/storage/text-part-injector.d.ts +0 -0
  1798. /package/packages/omo-codex/plugin/components/{comment-checker → codegraph}/dist/cli.d.ts +0 -0
  1799. /package/packages/omo-codex/plugin/components/{rules → lazycodex-executor-verify}/dist/cli.d.ts +0 -0
@@ -1,95 +1,3337 @@
1
- import { createInterface } from "node:readline";
2
- import { coerceToolArguments, executeLspTool, LSP_MCP_TOOLS } from "./tools.js";
3
- const SERVER_NAME = "lsp";
4
- const SERVER_VERSION = "0.1.0";
5
- export async function handleLspMcpRequest(input) {
6
- if (!isRecord(input)) {
7
- return errorResponse(null, -32600, "Invalid Request");
8
- }
9
- const id = jsonRpcId(input["id"]);
10
- const method = input["method"];
11
- if (method === "notifications/initialized")
12
- return undefined;
13
- if (method === "ping")
14
- return successResponse(id, {});
15
- if (method === "initialize") {
16
- const protocolVersion = requestedProtocolVersion(input["params"]);
17
- return successResponse(id, {
18
- capabilities: { tools: { listChanged: false } },
19
- serverInfo: { name: SERVER_NAME, version: SERVER_VERSION },
20
- protocolVersion,
1
+ // ../mcp-stdio-core/src/record.ts
2
+ function isPlainRecord(value) {
3
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4
+ }
5
+ // ../mcp-stdio-core/src/responses.ts
6
+ function successResponse(id, result) {
7
+ return { jsonrpc: "2.0", id, result };
8
+ }
9
+ function errorResponse(id, code, message, data) {
10
+ return { jsonrpc: "2.0", id, error: data === undefined ? { code, message } : { code, message, data } };
11
+ }
12
+ function jsonRpcId(value) {
13
+ return typeof value === "string" || typeof value === "number" || value === null ? value : null;
14
+ }
15
+ function messageFromError(error) {
16
+ return error instanceof Error ? error.message : String(error);
17
+ }
18
+ // ../mcp-stdio-core/src/transport.ts
19
+ var HEADER_SEPARATOR = Buffer.from(`\r
20
+ \r
21
+ `);
22
+ async function* readStdioJsonRpcMessages(input) {
23
+ let buffer = Buffer.alloc(0);
24
+ for await (const chunk of input) {
25
+ buffer = Buffer.concat([buffer, bufferFromChunk(chunk)]);
26
+ while (true) {
27
+ const result = readNextMessage(buffer);
28
+ if (result.kind === "incomplete")
29
+ break;
30
+ buffer = result.remaining;
31
+ if (result.message)
32
+ yield result.message;
33
+ }
34
+ }
35
+ const trailing = buffer.toString("utf8").trim();
36
+ if (trailing.length > 0) {
37
+ yield parseJsonPayload(trailing, "line");
38
+ }
39
+ }
40
+ function writeStdioJsonRpcResponse(output, response, responseMode) {
41
+ const body = JSON.stringify(response);
42
+ if (responseMode === "framed") {
43
+ output.write(`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
44
+ \r
45
+ ${body}`);
46
+ return;
47
+ }
48
+ output.write(`${body}
49
+ `);
50
+ }
51
+ function readNextMessage(buffer) {
52
+ if (buffer.length === 0)
53
+ return { kind: "incomplete" };
54
+ return startsWithContentLength(buffer) ? readFramedMessage(buffer) : readLineMessage(buffer);
55
+ }
56
+ function readLineMessage(buffer) {
57
+ const newlineIndex = buffer.indexOf(10);
58
+ if (newlineIndex === -1)
59
+ return { kind: "incomplete" };
60
+ const line = buffer.subarray(0, newlineIndex).toString("utf8").replace(/\r$/, "");
61
+ if (line.trim().length === 0) {
62
+ return { kind: "complete", remaining: buffer.subarray(newlineIndex + 1) };
63
+ }
64
+ return {
65
+ kind: "complete",
66
+ message: parseJsonPayload(line, "line"),
67
+ remaining: buffer.subarray(newlineIndex + 1)
68
+ };
69
+ }
70
+ function readFramedMessage(buffer) {
71
+ const separatorIndex = buffer.indexOf(HEADER_SEPARATOR);
72
+ if (separatorIndex === -1)
73
+ return { kind: "incomplete" };
74
+ const headers = buffer.subarray(0, separatorIndex).toString("ascii");
75
+ const contentLength = parseContentLength(headers);
76
+ const bodyStart = separatorIndex + HEADER_SEPARATOR.length;
77
+ if (contentLength === undefined) {
78
+ return {
79
+ kind: "complete",
80
+ message: {
81
+ kind: "parse_error",
82
+ message: "Missing or invalid Content-Length header",
83
+ responseMode: "framed"
84
+ },
85
+ remaining: buffer.subarray(bodyStart)
86
+ };
87
+ }
88
+ const bodyEnd = bodyStart + contentLength;
89
+ if (buffer.length < bodyEnd)
90
+ return { kind: "incomplete" };
91
+ const body = buffer.subarray(bodyStart, bodyEnd).toString("utf8");
92
+ return {
93
+ kind: "complete",
94
+ message: parseJsonPayload(body, "framed"),
95
+ remaining: buffer.subarray(bodyEnd)
96
+ };
97
+ }
98
+ function startsWithContentLength(buffer) {
99
+ const prefix = buffer.subarray(0, "content-length:".length).toString("ascii").toLowerCase();
100
+ return prefix === "content-length:";
101
+ }
102
+ function parseContentLength(headers) {
103
+ for (const line of headers.split(`\r
104
+ `)) {
105
+ const match = /^content-length:\s*(\d+)$/i.exec(line);
106
+ if (match === null)
107
+ continue;
108
+ const value = match[1];
109
+ if (value === undefined)
110
+ return;
111
+ return Number(value);
112
+ }
113
+ return;
114
+ }
115
+ function parseJsonPayload(payload, responseMode) {
116
+ try {
117
+ return { kind: "request", payload: JSON.parse(payload), responseMode };
118
+ } catch (error) {
119
+ return { kind: "parse_error", message: error instanceof Error ? error.message : String(error), responseMode };
120
+ }
121
+ }
122
+ function bufferFromChunk(chunk) {
123
+ if (Buffer.isBuffer(chunk))
124
+ return chunk;
125
+ if (typeof chunk === "string")
126
+ return Buffer.from(chunk);
127
+ throw new TypeError(`Unsupported stdio chunk type: ${typeof chunk}`);
128
+ }
129
+
130
+ // ../mcp-stdio-core/src/server.ts
131
+ var DEFAULT_IDLE_TIMEOUT_MS = 10 * 60000;
132
+ var noopLog = () => {};
133
+ async function runJsonRpcStdioServer(config) {
134
+ const log = config.log ?? noopLog;
135
+ const idleTimeoutMs = config.idleTimeoutMs ?? DEFAULT_IDLE_TIMEOUT_MS;
136
+ const idleTimer = createIdleTimer(idleTimeoutMs, log, config.onIdleTimeout);
137
+ log("stdio_started", { cwd: process.cwd(), idle_timeout_ms: idleTimeoutMs });
138
+ idleTimer.arm();
139
+ try {
140
+ for await (const message of readStdioJsonRpcMessages(config.input)) {
141
+ if (idleTimer.closed())
142
+ break;
143
+ idleTimer.arm();
144
+ if (message.kind === "parse_error") {
145
+ handleParseError(message, config, log);
146
+ continue;
147
+ }
148
+ await handleRequest(message, config, log);
149
+ }
150
+ } finally {
151
+ idleTimer.clear();
152
+ log("stdio_stopped");
153
+ }
154
+ }
155
+ function handleParseError(message, config, log) {
156
+ log("parse_error", { message: message.message });
157
+ const response = config.parseErrorResponse?.(message.message) ?? errorResponse(null, -32700, "Parse error", message.message);
158
+ if (response !== undefined) {
159
+ writeStdioJsonRpcResponse(config.output, response, message.responseMode);
160
+ }
161
+ }
162
+ async function handleRequest(message, config, log) {
163
+ const parsed = message.payload;
164
+ const id = isPlainRecord(parsed) ? jsonRpcId(parsed["id"]) : null;
165
+ const method = isPlainRecord(parsed) && typeof parsed["method"] === "string" ? parsed["method"] : null;
166
+ log("request", { id: id === null ? null : String(id), method });
167
+ try {
168
+ const response = await config.handler(parsed, config.handlerOptions);
169
+ if (response === undefined)
170
+ return;
171
+ writeStdioJsonRpcResponse(config.output, response, message.responseMode);
172
+ log("response", { id: String(response.id), method, is_error: response.error !== undefined });
173
+ } catch (error) {
174
+ if (config.onHandlerError === undefined)
175
+ throw error;
176
+ config.onHandlerError(error);
177
+ }
178
+ }
179
+ function createIdleTimer(idleTimeoutMs, log, onIdleTimeout) {
180
+ let timer = null;
181
+ let isClosed = false;
182
+ return {
183
+ arm: () => {
184
+ if (timer !== null)
185
+ clearTimeout(timer);
186
+ if (idleTimeoutMs <= 0)
187
+ return;
188
+ timer = setTimeout(() => {
189
+ isClosed = true;
190
+ log("idle_timeout", { idle_timeout_ms: idleTimeoutMs });
191
+ onIdleTimeout?.();
192
+ }, idleTimeoutMs);
193
+ timer.unref();
194
+ },
195
+ clear: () => {
196
+ if (timer === null)
197
+ return;
198
+ clearTimeout(timer);
199
+ timer = null;
200
+ },
201
+ closed: () => isClosed
202
+ };
203
+ }
204
+ // ../lsp-core/src/tools/diagnostics.ts
205
+ import { resolve as resolve4 } from "node:path";
206
+
207
+ // ../lsp-core/src/lsp/client-wrapper.ts
208
+ import { existsSync as existsSync5, statSync as statSync2 } from "node:fs";
209
+ import { dirname as dirname2, join as join5, resolve as resolve2 } from "node:path";
210
+
211
+ // ../lsp-core/src/request-context.ts
212
+ import { AsyncLocalStorage } from "node:async_hooks";
213
+ var storage = new AsyncLocalStorage;
214
+ function runWithRequestContext(context, fn) {
215
+ return storage.run(context, fn);
216
+ }
217
+ function contextCwd() {
218
+ return storage.getStore()?.cwd ?? process.cwd();
219
+ }
220
+ function contextEnv(key) {
221
+ const store = storage.getStore();
222
+ if (store?.env)
223
+ return store.env[key];
224
+ return process.env[key];
225
+ }
226
+
227
+ // ../lsp-core/src/lsp/effective-extension.ts
228
+ import { basename, extname } from "node:path";
229
+ var BASENAME_EXTENSIONS = {
230
+ Dockerfile: ".dockerfile",
231
+ Containerfile: ".dockerfile"
232
+ };
233
+ function effectiveExtension(filePath) {
234
+ return BASENAME_EXTENSIONS[basename(filePath)] ?? extname(filePath);
235
+ }
236
+
237
+ // ../lsp-core/src/lsp/errors.ts
238
+ class LspConnectionClosedError extends Error {
239
+ serverId;
240
+ root;
241
+ name = "LspConnectionClosedError";
242
+ constructor(serverId, root, message) {
243
+ super(message ?? `LSP connection closed for ${serverId} at ${root}`);
244
+ this.serverId = serverId;
245
+ this.root = root;
246
+ }
247
+ }
248
+
249
+ class LspProcessExitedError extends Error {
250
+ serverId;
251
+ root;
252
+ exitCode;
253
+ stderrTail;
254
+ name = "LspProcessExitedError";
255
+ constructor(serverId, root, exitCode, stderrTail) {
256
+ const stderrSuffix = stderrTail ? `
257
+ stderr tail: ${stderrTail}` : "";
258
+ super(`LSP server ${serverId} at ${root} exited with code ${exitCode ?? "null"}${stderrSuffix}`);
259
+ this.serverId = serverId;
260
+ this.root = root;
261
+ this.exitCode = exitCode;
262
+ this.stderrTail = stderrTail;
263
+ }
264
+ }
265
+
266
+ class LspRequestTimeoutError extends Error {
267
+ method;
268
+ stderrTail;
269
+ name = "LspRequestTimeoutError";
270
+ constructor(method, stderrTail) {
271
+ const stderrSuffix = stderrTail ? `
272
+ recent stderr: ${stderrTail}` : "";
273
+ super(`LSP request timeout (method: ${method})${stderrSuffix}`);
274
+ this.method = method;
275
+ this.stderrTail = stderrTail;
276
+ }
277
+ }
278
+
279
+ class LspInvalidPathError extends Error {
280
+ name = "LspInvalidPathError";
281
+ }
282
+
283
+ class LspServerLookupError extends Error {
284
+ name = "LspServerLookupError";
285
+ }
286
+
287
+ class LspServerInitializingError extends Error {
288
+ originalError;
289
+ name = "LspServerInitializingError";
290
+ constructor(originalError) {
291
+ super(`LSP server is still initializing. Please retry in a few seconds. Original error: ${originalError.message}`);
292
+ this.originalError = originalError;
293
+ }
294
+ }
295
+
296
+ class LspProcessSpawnError extends Error {
297
+ name = "LspProcessSpawnError";
298
+ }
299
+ function isLspDeadConnectionError(err) {
300
+ return err instanceof LspConnectionClosedError || err instanceof LspProcessExitedError;
301
+ }
302
+
303
+ // ../lsp-core/src/lsp/cleanup-errors.ts
304
+ function reportBestEffortCleanupError(operation, error) {
305
+ if (process.env["CODEX_LSP_DEBUG_CLEANUP"] !== "1")
306
+ return;
307
+ const message = error instanceof Error ? error.message : String(error);
308
+ console.error(`[codex-lsp] ignored ${operation} failure during cleanup: ${message}`);
309
+ }
310
+
311
+ // ../lsp-core/src/lsp/client.ts
312
+ import { readFileSync } from "node:fs";
313
+ import { resolve } from "node:path";
314
+ import { pathToFileURL as pathToFileURL2 } from "node:url";
315
+
316
+ // ../lsp-core/src/lsp/connection.ts
317
+ import { pathToFileURL } from "node:url";
318
+
319
+ // ../lsp-core/src/lsp/constants.ts
320
+ var DEFAULT_MAX_REFERENCES = 200;
321
+ var DEFAULT_MAX_SYMBOLS = 200;
322
+ var DEFAULT_MAX_DIAGNOSTICS = 200;
323
+ var DEFAULT_MAX_DIRECTORY_FILES = 50;
324
+ var REQUEST_TIMEOUT_MS = 15000;
325
+ var INIT_TIMEOUT_MS = 60000;
326
+ var IDLE_TIMEOUT_MS = 5 * 60000;
327
+ var REAPER_INTERVAL_MS = 60000;
328
+ var STOP_HARD_KILL_TIMEOUT_MS = 5000;
329
+ var STOP_SIGKILL_GRACE_MS = 1000;
330
+
331
+ // ../lsp-core/src/lsp/json-rpc-connection.ts
332
+ var HEADER_SEPARATOR2 = `\r
333
+ \r
334
+ `;
335
+ var PARSE_ERROR = -32700;
336
+ var INVALID_REQUEST = -32600;
337
+ var METHOD_NOT_FOUND = -32601;
338
+ var INTERNAL_ERROR = -32603;
339
+
340
+ class JsonRpcConnection {
341
+ reader;
342
+ writer;
343
+ pendingRequests = new Map;
344
+ notificationHandlers = new Map;
345
+ requestHandlers = new Map;
346
+ closeHandlers = [];
347
+ errorHandlers = [];
348
+ inputBuffer = Buffer.alloc(0);
349
+ nextRequestId = 1;
350
+ listening = false;
351
+ disposed = false;
352
+ constructor(reader, writer) {
353
+ this.reader = reader;
354
+ this.writer = writer;
355
+ }
356
+ listen() {
357
+ if (this.listening)
358
+ return;
359
+ this.listening = true;
360
+ this.reader.on("data", this.handleData);
361
+ this.reader.on("close", this.handleClose);
362
+ this.reader.on("end", this.handleClose);
363
+ this.reader.on("error", this.handleStreamError);
364
+ this.writer.on("error", this.handleStreamError);
365
+ }
366
+ onNotification(method, handler) {
367
+ this.notificationHandlers.set(method, handler);
368
+ }
369
+ onRequest(method, handler) {
370
+ this.requestHandlers.set(method, handler);
371
+ }
372
+ onClose(handler) {
373
+ this.closeHandlers.push(handler);
374
+ }
375
+ onError(handler) {
376
+ this.errorHandlers.push(handler);
377
+ }
378
+ async sendRequest(method, params) {
379
+ if (this.disposed)
380
+ throw new Error("JSON-RPC connection is disposed");
381
+ const id = this.nextRequestId;
382
+ this.nextRequestId += 1;
383
+ const message = params === undefined ? { jsonrpc: "2.0", id, method } : { jsonrpc: "2.0", id, method, params };
384
+ const responsePromise = new Promise((resolve, reject) => {
385
+ this.pendingRequests.set(String(id), {
386
+ resolve(result) {
387
+ resolve(result);
388
+ },
389
+ reject
390
+ });
391
+ });
392
+ try {
393
+ await this.writeMessage(message);
394
+ } catch (error) {
395
+ this.pendingRequests.delete(String(id));
396
+ throw error;
397
+ }
398
+ return responsePromise;
399
+ }
400
+ async sendNotification(method, params) {
401
+ if (this.disposed)
402
+ return;
403
+ const message = params === undefined ? { jsonrpc: "2.0", method } : { jsonrpc: "2.0", method, params };
404
+ await this.writeMessage(message);
405
+ }
406
+ dispose() {
407
+ if (this.disposed)
408
+ return;
409
+ this.disposed = true;
410
+ this.reader.off("data", this.handleData);
411
+ this.reader.off("close", this.handleClose);
412
+ this.reader.off("end", this.handleClose);
413
+ this.reader.off("error", this.handleStreamError);
414
+ this.writer.off("error", this.handleStreamError);
415
+ for (const pending of this.pendingRequests.values()) {
416
+ pending.reject(new Error("JSON-RPC connection disposed"));
417
+ }
418
+ this.pendingRequests.clear();
419
+ this.notificationHandlers.clear();
420
+ this.requestHandlers.clear();
421
+ }
422
+ handleData = (chunk) => {
423
+ const chunkBuffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
424
+ this.inputBuffer = Buffer.concat([this.inputBuffer, chunkBuffer]);
425
+ this.drainInputBuffer();
426
+ };
427
+ handleClose = () => {
428
+ for (const handler of this.closeHandlers) {
429
+ handler();
430
+ }
431
+ };
432
+ handleStreamError = (error) => {
433
+ this.emitError(error);
434
+ };
435
+ drainInputBuffer() {
436
+ while (true) {
437
+ const headerEnd = this.inputBuffer.indexOf(HEADER_SEPARATOR2);
438
+ if (headerEnd === -1)
439
+ return;
440
+ const headers = this.inputBuffer.subarray(0, headerEnd).toString("ascii");
441
+ const contentLength = parseContentLength2(headers);
442
+ if (contentLength === null) {
443
+ this.inputBuffer = Buffer.alloc(0);
444
+ this.emitError(new Error("JSON-RPC message is missing Content-Length header"));
445
+ return;
446
+ }
447
+ const bodyStart = headerEnd + Buffer.byteLength(HEADER_SEPARATOR2);
448
+ const bodyEnd = bodyStart + contentLength;
449
+ if (this.inputBuffer.length < bodyEnd)
450
+ return;
451
+ const body = this.inputBuffer.subarray(bodyStart, bodyEnd).toString("utf8");
452
+ this.inputBuffer = this.inputBuffer.subarray(bodyEnd);
453
+ this.dispatchBody(body);
454
+ }
455
+ }
456
+ dispatchBody(body) {
457
+ let parsed;
458
+ try {
459
+ parsed = JSON.parse(body);
460
+ } catch (error) {
461
+ this.writeError(null, PARSE_ERROR, error instanceof Error ? error.message : "Parse error").catch((writeError) => this.emitError(toError(writeError)));
462
+ return;
463
+ }
464
+ if (!isJsonRpcObject(parsed)) {
465
+ this.writeError(null, INVALID_REQUEST, "Invalid JSON-RPC message").catch((error) => this.emitError(toError(error)));
466
+ return;
467
+ }
468
+ if ("id" in parsed && (("result" in parsed) || ("error" in parsed))) {
469
+ this.handleResponse(parsed);
470
+ return;
471
+ }
472
+ if (typeof parsed["method"] !== "string") {
473
+ const id = getMessageId(parsed) ?? null;
474
+ this.writeError(id, INVALID_REQUEST, "Invalid JSON-RPC method").catch((error) => this.emitError(toError(error)));
475
+ return;
476
+ }
477
+ if ("id" in parsed) {
478
+ this.handleRequest(parsed);
479
+ return;
480
+ }
481
+ this.handleNotification(parsed["method"], parsed["params"]);
482
+ }
483
+ handleResponse(message) {
484
+ const id = getMessageId(message);
485
+ if (id === undefined)
486
+ return;
487
+ const pending = this.pendingRequests.get(String(id));
488
+ if (!pending)
489
+ return;
490
+ this.pendingRequests.delete(String(id));
491
+ if ("error" in message) {
492
+ pending.reject(jsonRpcErrorToError(message["error"]));
493
+ return;
494
+ }
495
+ pending.resolve(message["result"]);
496
+ }
497
+ handleNotification(method, params) {
498
+ const handler = this.notificationHandlers.get(method);
499
+ if (!handler)
500
+ return;
501
+ try {
502
+ handler(params);
503
+ } catch (error) {
504
+ this.emitError(toError(error));
505
+ }
506
+ }
507
+ handleRequest(message) {
508
+ const id = getMessageId(message);
509
+ if (id === undefined) {
510
+ this.writeError(null, INVALID_REQUEST, "Invalid JSON-RPC id").catch((error) => this.emitError(toError(error)));
511
+ return;
512
+ }
513
+ const method = typeof message["method"] === "string" ? message["method"] : "";
514
+ const handler = this.requestHandlers.get(method);
515
+ if (!handler) {
516
+ this.writeError(id, METHOD_NOT_FOUND, `Method not found: ${method}`).catch((error) => this.emitError(toError(error)));
517
+ return;
518
+ }
519
+ Promise.resolve().then(() => handler(message["params"])).then((result) => this.writeMessage({ jsonrpc: "2.0", id, result }), (error) => this.writeError(id, INTERNAL_ERROR, toError(error).message)).catch((error) => this.emitError(toError(error)));
520
+ }
521
+ async writeError(id, code, message) {
522
+ await this.writeMessage({ jsonrpc: "2.0", id, error: { code, message } });
523
+ }
524
+ writeMessage(message) {
525
+ const body = JSON.stringify(message);
526
+ const payload = `Content-Length: ${Buffer.byteLength(body, "utf8")}\r
527
+ \r
528
+ ${body}`;
529
+ return new Promise((resolve, reject) => {
530
+ this.writer.write(payload, (error) => {
531
+ if (error) {
532
+ reject(error);
533
+ return;
534
+ }
535
+ resolve();
536
+ });
537
+ });
538
+ }
539
+ emitError(error) {
540
+ for (const handler of this.errorHandlers) {
541
+ handler(error);
542
+ }
543
+ }
544
+ }
545
+ function parseContentLength2(headers) {
546
+ for (const line of headers.split(`\r
547
+ `)) {
548
+ const separatorIndex = line.indexOf(":");
549
+ if (separatorIndex === -1)
550
+ continue;
551
+ const name = line.slice(0, separatorIndex).trim().toLowerCase();
552
+ if (name !== "content-length")
553
+ continue;
554
+ const value = Number.parseInt(line.slice(separatorIndex + 1).trim(), 10);
555
+ return Number.isFinite(value) && value >= 0 ? value : null;
556
+ }
557
+ return null;
558
+ }
559
+ function isJsonRpcObject(value) {
560
+ return typeof value === "object" && value !== null && !Array.isArray(value);
561
+ }
562
+ function getMessageId(message) {
563
+ const id = message["id"];
564
+ if (typeof id === "number" || typeof id === "string" || id === null)
565
+ return id;
566
+ return;
567
+ }
568
+ function jsonRpcErrorToError(value) {
569
+ if (!isJsonRpcObject(value))
570
+ return new Error("JSON-RPC request failed");
571
+ const message = typeof value["message"] === "string" ? value["message"] : "JSON-RPC request failed";
572
+ const error = new Error(message);
573
+ if (typeof value["code"] === "number") {
574
+ error.name = `JsonRpcError(${value["code"]})`;
575
+ }
576
+ return error;
577
+ }
578
+ function toError(error) {
579
+ return error instanceof Error ? error : new Error(String(error));
580
+ }
581
+
582
+ // ../lsp-core/src/lsp/process.ts
583
+ import { spawn, spawnSync } from "node:child_process";
584
+ import { existsSync, statSync } from "node:fs";
585
+ import { delimiter, join } from "node:path";
586
+ function isMissingProcessError(error) {
587
+ if (!(error instanceof Error) || !("code" in error))
588
+ return false;
589
+ return error.code === "ESRCH";
590
+ }
591
+ function reportKillError(context, error) {
592
+ if (!isMissingProcessError(error)) {
593
+ reportBestEffortCleanupError(context, error);
594
+ }
595
+ }
596
+ function validateCwd(cwd) {
597
+ try {
598
+ if (!existsSync(cwd)) {
599
+ return { valid: false, error: `Working directory does not exist: ${cwd}` };
600
+ }
601
+ const stats = statSync(cwd);
602
+ if (!stats.isDirectory()) {
603
+ return { valid: false, error: `Path is not a directory: ${cwd}` };
604
+ }
605
+ return { valid: true };
606
+ } catch (err) {
607
+ return {
608
+ valid: false,
609
+ error: `Cannot access working directory: ${cwd} (${err instanceof Error ? err.message : String(err)})`
610
+ };
611
+ }
612
+ }
613
+ function wrap(proc) {
614
+ const exitedPromise = new Promise((resolve) => {
615
+ proc.once("close", (code) => resolve(code ?? 0));
616
+ proc.once("error", () => resolve(1));
617
+ });
618
+ if (!proc.stdin || !proc.stdout || !proc.stderr) {
619
+ throw new LspProcessSpawnError("Spawned process is missing one of stdin/stdout/stderr pipes");
620
+ }
621
+ return {
622
+ stdin: proc.stdin,
623
+ stdout: proc.stdout,
624
+ stderr: proc.stderr,
625
+ get pid() {
626
+ return proc.pid ?? undefined;
627
+ },
628
+ get exitCode() {
629
+ return proc.exitCode;
630
+ },
631
+ get killed() {
632
+ return proc.killed;
633
+ },
634
+ exited: exitedPromise,
635
+ kill(signal) {
636
+ killProcessTree(proc, signal ?? "SIGTERM");
637
+ }
638
+ };
639
+ }
640
+ function killProcessTree(proc, signal) {
641
+ if (process.platform === "win32" && proc.pid) {
642
+ const result = spawnSync("taskkill", ["/pid", String(proc.pid), "/f", "/t"], { stdio: "ignore" });
643
+ if (!result.error && result.status === 0)
644
+ return;
645
+ if (result.error)
646
+ reportKillError("windows process tree kill", result.error);
647
+ }
648
+ if (process.platform !== "win32" && proc.pid) {
649
+ try {
650
+ process.kill(-proc.pid, signal);
651
+ return;
652
+ } catch (error) {
653
+ reportKillError("process group kill", error);
654
+ }
655
+ }
656
+ try {
657
+ proc.kill(signal);
658
+ } catch (error) {
659
+ reportKillError("process kill", error);
660
+ }
661
+ }
662
+ function isWindowsShellShim(command) {
663
+ const lowerCommand = command.toLowerCase();
664
+ return lowerCommand.endsWith(".cmd") || lowerCommand.endsWith(".bat");
665
+ }
666
+ function splitPath(pathValue, platform) {
667
+ const separator = platform === "win32" ? ";" : delimiter;
668
+ return pathValue.split(separator).filter(Boolean);
669
+ }
670
+ function getWindowsPathExtensions(env) {
671
+ const rawExtensions = env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD";
672
+ const extensions = rawExtensions.split(";").map((extension) => extension.trim()).filter(Boolean).map((extension) => extension.startsWith(".") ? extension : `.${extension}`);
673
+ return [...new Set([...extensions, ".exe", ".cmd", ".bat", ""])];
674
+ }
675
+ function resolveWindowsCommand(command, env) {
676
+ const hasPathSeparator = command.includes("/") || command.includes("\\");
677
+ const pathValue = env["PATH"] ?? env["Path"] ?? "";
678
+ const baseDirectories = hasPathSeparator ? [""] : splitPath(pathValue, "win32");
679
+ const extensions = getWindowsPathExtensions(env);
680
+ for (const baseDirectory of baseDirectories) {
681
+ for (const extension of extensions) {
682
+ const candidate = baseDirectory ? join(baseDirectory, `${command}${extension}`) : `${command}${extension}`;
683
+ if (existsSync(candidate))
684
+ return candidate;
685
+ }
686
+ }
687
+ return command;
688
+ }
689
+ function createSpawnCommand(command, platform = process.platform, commandProcessor = process.env["ComSpec"] ?? "cmd.exe", env = process.env) {
690
+ const [cmd, ...args] = command;
691
+ if (!cmd) {
692
+ throw new LspProcessSpawnError("[lsp] empty command");
693
+ }
694
+ if (platform !== "win32") {
695
+ return { command: cmd, args, shell: false };
696
+ }
697
+ const resolvedCommand = resolveWindowsCommand(cmd, env);
698
+ if (!isWindowsShellShim(resolvedCommand)) {
699
+ return { command: resolvedCommand, args, shell: false };
700
+ }
701
+ return {
702
+ command: commandProcessor,
703
+ args: ["/d", "/s", "/c", resolvedCommand, ...args],
704
+ shell: false
705
+ };
706
+ }
707
+ function spawnProcess(command, options) {
708
+ const cwdValidation = validateCwd(options.cwd);
709
+ if (!cwdValidation.valid) {
710
+ throw new LspInvalidPathError(`[lsp] ${cwdValidation.error}`);
711
+ }
712
+ const [cmd] = command;
713
+ if (!cmd) {
714
+ throw new LspProcessSpawnError("[lsp] empty command");
715
+ }
716
+ const preparedCommand = createSpawnCommand(command, process.platform, process.env["ComSpec"] ?? "cmd.exe", options.env);
717
+ const proc = spawn(preparedCommand.command, preparedCommand.args, {
718
+ cwd: options.cwd,
719
+ env: options.env,
720
+ stdio: ["pipe", "pipe", "pipe"],
721
+ windowsHide: true,
722
+ shell: preparedCommand.shell,
723
+ detached: process.platform !== "win32"
724
+ });
725
+ return wrap(proc);
726
+ }
727
+
728
+ // ../lsp-core/src/lsp/transport.ts
729
+ function isRecord(value) {
730
+ return typeof value === "object" && value !== null && !Array.isArray(value);
731
+ }
732
+ function parseConfigurationItems(params) {
733
+ if (!isRecord(params) || !Array.isArray(params["items"]))
734
+ return [];
735
+ const items = [];
736
+ for (const item of params["items"]) {
737
+ if (!isRecord(item))
738
+ continue;
739
+ const section = item["section"];
740
+ items.push(section === undefined || typeof section !== "string" ? {} : { section });
741
+ }
742
+ return items;
743
+ }
744
+ function parseDiagnosticsParams(params) {
745
+ if (!isRecord(params) || typeof params["uri"] !== "string")
746
+ return null;
747
+ const diagnostics = Array.isArray(params["diagnostics"]) ? params["diagnostics"].filter(isDiagnostic) : [];
748
+ return { uri: params["uri"], diagnostics };
749
+ }
750
+
751
+ class LspClientTransport {
752
+ root;
753
+ server;
754
+ proc = null;
755
+ connection = null;
756
+ stderrBuffer = [];
757
+ processExited = false;
758
+ diagnosticsStore = new Map;
759
+ requestTimeoutMs;
760
+ initializeTimeoutMs;
761
+ constructor(root, server2, timeouts = {}) {
762
+ this.root = root;
763
+ this.server = server2;
764
+ this.requestTimeoutMs = timeouts.requestTimeoutMs ?? REQUEST_TIMEOUT_MS;
765
+ this.initializeTimeoutMs = timeouts.initializeTimeoutMs ?? INIT_TIMEOUT_MS;
766
+ }
767
+ pid() {
768
+ return this.proc?.pid;
769
+ }
770
+ command() {
771
+ return [...this.server.command];
772
+ }
773
+ async start() {
774
+ const env = createLspSpawnEnv(this.root, {
775
+ ...process.env,
776
+ ...this.server.env
777
+ });
778
+ this.proc = spawnProcess(this.server.command, {
779
+ cwd: this.root,
780
+ env
781
+ });
782
+ this.startStderrReading();
783
+ await new Promise((resolve) => setTimeout(resolve, 100));
784
+ if (this.proc.exitCode !== null) {
785
+ const stderr = this.stderrBuffer.join(`
786
+ `);
787
+ throw new LspProcessExitedError(this.server.id, this.root, this.proc.exitCode, stderr.slice(-2000));
788
+ }
789
+ this.connection = new JsonRpcConnection(this.proc.stdout, this.proc.stdin);
790
+ this.connection.onNotification("textDocument/publishDiagnostics", (params) => {
791
+ const diagnosticsParams = parseDiagnosticsParams(params);
792
+ if (diagnosticsParams?.uri) {
793
+ this.diagnosticsStore.set(diagnosticsParams.uri, diagnosticsParams.diagnostics);
794
+ }
795
+ });
796
+ this.connection.onRequest("workspace/configuration", (params) => {
797
+ const items = parseConfigurationItems(params);
798
+ return items.map((item) => {
799
+ if (item.section === "json")
800
+ return { validate: { enable: true } };
801
+ return {};
802
+ });
803
+ });
804
+ this.connection.onRequest("client/registerCapability", () => null);
805
+ this.connection.onRequest("window/workDoneProgress/create", () => null);
806
+ this.connection.onClose(() => {
807
+ this.processExited = true;
808
+ });
809
+ this.connection.onError((error) => {
810
+ reportBestEffortCleanupError("connection error notification", error);
811
+ });
812
+ this.connection.listen();
813
+ }
814
+ startStderrReading() {
815
+ if (!this.proc)
816
+ return;
817
+ this.proc.stderr.setEncoding("utf-8");
818
+ this.proc.stderr.on("data", (chunk) => {
819
+ this.stderrBuffer.push(chunk);
820
+ if (this.stderrBuffer.length > 100) {
821
+ this.stderrBuffer.shift();
822
+ }
823
+ });
824
+ }
825
+ isConnectionClosedError(error) {
826
+ if (!(error instanceof Error)) {
827
+ return false;
828
+ }
829
+ const code = "code" in error && typeof error.code === "string" ? error.code : undefined;
830
+ return code === "ERR_STREAM_DESTROYED" || /connection closed|connection is disposed|stream was destroyed/i.test(error.message);
831
+ }
832
+ async sendRequest(method, ...args) {
833
+ if (!this.connection)
834
+ throw new Error("LSP client not started");
835
+ if (this.processExited || this.proc && this.proc.exitCode !== null) {
836
+ const stderrTail = this.stderrBuffer.slice(-10).join(`
837
+ `);
838
+ throw new LspProcessExitedError(this.server.id, this.root, this.proc?.exitCode ?? null, stderrTail || undefined);
839
+ }
840
+ const timeoutMs = args[1]?.timeoutMs ?? this.requestTimeoutMs;
841
+ let timeoutHandle = null;
842
+ const timeoutPromise = new Promise((_, reject) => {
843
+ timeoutHandle = setTimeout(() => {
844
+ const stderrTail = this.stderrBuffer.slice(-5).join(`
845
+ `);
846
+ reject(new LspRequestTimeoutError(method, stderrTail || undefined));
847
+ }, timeoutMs);
848
+ });
849
+ try {
850
+ const requestPromise = args.length === 0 ? this.connection.sendRequest(method) : this.connection.sendRequest(method, args[0]);
851
+ const result = await Promise.race([requestPromise, timeoutPromise]);
852
+ if (timeoutHandle !== null)
853
+ clearTimeout(timeoutHandle);
854
+ return result;
855
+ } catch (error) {
856
+ if (timeoutHandle !== null)
857
+ clearTimeout(timeoutHandle);
858
+ if (this.processExited || this.proc && this.proc.exitCode !== null) {
859
+ throw new LspProcessExitedError(this.server.id, this.root, this.proc?.exitCode ?? null, this.stderrBuffer.slice(-10).join(`
860
+ `) || undefined);
861
+ }
862
+ if (this.isConnectionClosedError(error)) {
863
+ throw new LspConnectionClosedError(this.server.id, this.root, error.message);
864
+ }
865
+ throw error;
866
+ }
867
+ }
868
+ async sendNotification(method, ...args) {
869
+ if (!this.connection)
870
+ return;
871
+ if (this.processExited || this.proc && this.proc.exitCode !== null)
872
+ return;
873
+ try {
874
+ if (args.length === 0) {
875
+ await this.connection.sendNotification(method);
876
+ } else {
877
+ await this.connection.sendNotification(method, args[0]);
878
+ }
879
+ } catch (error) {
880
+ if (this.isConnectionClosedError(error)) {
881
+ throw new LspConnectionClosedError(this.server.id, this.root, error.message);
882
+ }
883
+ throw error;
884
+ }
885
+ }
886
+ isAlive() {
887
+ return this.proc !== null && !this.processExited && this.proc.exitCode === null;
888
+ }
889
+ async stop() {
890
+ if (this.connection) {
891
+ try {
892
+ await this.sendRequest("shutdown");
893
+ } catch (error) {
894
+ reportBestEffortCleanupError("shutdown request", error);
895
+ }
896
+ try {
897
+ await this.sendNotification("exit");
898
+ } catch (error) {
899
+ reportBestEffortCleanupError("exit notification", error);
900
+ }
901
+ try {
902
+ this.connection.dispose();
903
+ } catch (error) {
904
+ reportBestEffortCleanupError("connection dispose", error);
905
+ }
906
+ this.connection = null;
907
+ }
908
+ const proc = this.proc;
909
+ if (proc) {
910
+ this.proc = null;
911
+ let exitedBeforeTimeout = false;
912
+ try {
913
+ proc.kill();
914
+ let timeoutId;
915
+ const timeoutPromise = new Promise((resolve) => {
916
+ timeoutId = setTimeout(resolve, STOP_HARD_KILL_TIMEOUT_MS);
21
917
  });
918
+ await Promise.race([
919
+ proc.exited.then(() => {
920
+ exitedBeforeTimeout = true;
921
+ }).finally(() => {
922
+ if (timeoutId)
923
+ clearTimeout(timeoutId);
924
+ }),
925
+ timeoutPromise
926
+ ]);
927
+ if (!exitedBeforeTimeout) {
928
+ try {
929
+ proc.kill("SIGKILL");
930
+ await Promise.race([
931
+ proc.exited,
932
+ new Promise((resolve) => setTimeout(resolve, STOP_SIGKILL_GRACE_MS))
933
+ ]);
934
+ } catch (error) {
935
+ reportBestEffortCleanupError("hard process kill", error);
936
+ }
937
+ }
938
+ } catch (error) {
939
+ reportBestEffortCleanupError("process stop", error);
940
+ }
22
941
  }
23
- if (method === "tools/list") {
24
- return successResponse(id, { tools: LSP_MCP_TOOLS.map(describeTool) });
942
+ this.processExited = true;
943
+ this.diagnosticsStore.clear();
944
+ }
945
+ getStoredDiagnostics(uri) {
946
+ return this.diagnosticsStore.get(uri) ?? [];
947
+ }
948
+ }
949
+ function createLspSpawnEnv(_root, input) {
950
+ return { ...input };
951
+ }
952
+ function isDiagnostic(value) {
953
+ return isRecord(value) && isRange(value["range"]) && typeof value["message"] === "string";
954
+ }
955
+ function isRange(value) {
956
+ return isRecord(value) && isPosition(value["start"]) && isPosition(value["end"]);
957
+ }
958
+ function isPosition(value) {
959
+ return isRecord(value) && typeof value["line"] === "number" && typeof value["character"] === "number";
960
+ }
961
+
962
+ // ../lsp-core/src/lsp/connection.ts
963
+ var INITIALIZE_SETTLE_MS = 300;
964
+
965
+ class LspClientConnection extends LspClientTransport {
966
+ async initialize() {
967
+ const rootUri = pathToFileURL(this.root).href;
968
+ await this.sendRequest("initialize", {
969
+ processId: process.pid,
970
+ rootUri,
971
+ rootPath: this.root,
972
+ workspaceFolders: [{ uri: rootUri, name: "workspace" }],
973
+ capabilities: {
974
+ textDocument: {
975
+ hover: { contentFormat: ["markdown", "plaintext"] },
976
+ definition: { linkSupport: true },
977
+ references: {},
978
+ documentSymbol: { hierarchicalDocumentSymbolSupport: true },
979
+ publishDiagnostics: {},
980
+ rename: {
981
+ prepareSupport: true,
982
+ prepareSupportDefaultBehavior: 1,
983
+ honorsChangeAnnotations: true
984
+ },
985
+ codeAction: {
986
+ codeActionLiteralSupport: {
987
+ codeActionKind: {
988
+ valueSet: [
989
+ "quickfix",
990
+ "refactor",
991
+ "refactor.extract",
992
+ "refactor.inline",
993
+ "refactor.rewrite",
994
+ "source",
995
+ "source.organizeImports",
996
+ "source.fixAll"
997
+ ]
998
+ }
999
+ },
1000
+ isPreferredSupport: true,
1001
+ disabledSupport: true,
1002
+ dataSupport: true,
1003
+ resolveSupport: {
1004
+ properties: ["edit", "command"]
1005
+ }
1006
+ }
1007
+ },
1008
+ workspace: {
1009
+ symbol: {},
1010
+ workspaceFolders: true,
1011
+ configuration: true,
1012
+ applyEdit: true,
1013
+ workspaceEdit: {
1014
+ documentChanges: true
1015
+ }
1016
+ }
1017
+ },
1018
+ initializationOptions: this.server.initialization
1019
+ }, { timeoutMs: this.initializeTimeoutMs });
1020
+ await this.sendNotification("initialized");
1021
+ await this.sendNotification("workspace/didChangeConfiguration", {
1022
+ settings: { json: { validate: { enable: true } } }
1023
+ });
1024
+ await new Promise((r) => setTimeout(r, INITIALIZE_SETTLE_MS));
1025
+ }
1026
+ }
1027
+
1028
+ // ../lsp-core/src/lsp/language-mappings.ts
1029
+ var SYMBOL_KIND_MAP = {
1030
+ 1: "File",
1031
+ 2: "Module",
1032
+ 3: "Namespace",
1033
+ 4: "Package",
1034
+ 5: "Class",
1035
+ 6: "Method",
1036
+ 7: "Property",
1037
+ 8: "Field",
1038
+ 9: "Constructor",
1039
+ 10: "Enum",
1040
+ 11: "Interface",
1041
+ 12: "Function",
1042
+ 13: "Variable",
1043
+ 14: "Constant",
1044
+ 15: "String",
1045
+ 16: "Number",
1046
+ 17: "Boolean",
1047
+ 18: "Array",
1048
+ 19: "Object",
1049
+ 20: "Key",
1050
+ 21: "Null",
1051
+ 22: "EnumMember",
1052
+ 23: "Struct",
1053
+ 24: "Event",
1054
+ 25: "Operator",
1055
+ 26: "TypeParameter"
1056
+ };
1057
+ var SEVERITY_MAP = {
1058
+ 1: "error",
1059
+ 2: "warning",
1060
+ 3: "information",
1061
+ 4: "hint"
1062
+ };
1063
+ var EXT_TO_LANG = {
1064
+ ".abap": "abap",
1065
+ ".bat": "bat",
1066
+ ".bib": "bibtex",
1067
+ ".bibtex": "bibtex",
1068
+ ".clj": "clojure",
1069
+ ".cljs": "clojure",
1070
+ ".cljc": "clojure",
1071
+ ".edn": "clojure",
1072
+ ".coffee": "coffeescript",
1073
+ ".c": "c",
1074
+ ".cpp": "cpp",
1075
+ ".cxx": "cpp",
1076
+ ".cc": "cpp",
1077
+ ".c++": "cpp",
1078
+ ".cs": "csharp",
1079
+ ".css": "css",
1080
+ ".d": "d",
1081
+ ".pas": "pascal",
1082
+ ".pascal": "pascal",
1083
+ ".diff": "diff",
1084
+ ".patch": "diff",
1085
+ ".dart": "dart",
1086
+ ".dockerfile": "dockerfile",
1087
+ ".ex": "elixir",
1088
+ ".exs": "elixir",
1089
+ ".erl": "erlang",
1090
+ ".hrl": "erlang",
1091
+ ".fs": "fsharp",
1092
+ ".fsi": "fsharp",
1093
+ ".fsx": "fsharp",
1094
+ ".fsscript": "fsharp",
1095
+ ".gitcommit": "git-commit",
1096
+ ".gitrebase": "git-rebase",
1097
+ ".go": "go",
1098
+ ".groovy": "groovy",
1099
+ ".gleam": "gleam",
1100
+ ".hbs": "handlebars",
1101
+ ".handlebars": "handlebars",
1102
+ ".hs": "haskell",
1103
+ ".html": "html",
1104
+ ".htm": "html",
1105
+ ".ini": "ini",
1106
+ ".java": "java",
1107
+ ".jl": "julia",
1108
+ ".js": "javascript",
1109
+ ".jsx": "javascriptreact",
1110
+ ".json": "json",
1111
+ ".jsonc": "jsonc",
1112
+ ".tex": "latex",
1113
+ ".latex": "latex",
1114
+ ".less": "less",
1115
+ ".lua": "lua",
1116
+ ".makefile": "makefile",
1117
+ makefile: "makefile",
1118
+ ".md": "markdown",
1119
+ ".markdown": "markdown",
1120
+ ".m": "objective-c",
1121
+ ".mm": "objective-cpp",
1122
+ ".pl": "perl",
1123
+ ".pm": "perl",
1124
+ ".pm6": "perl6",
1125
+ ".php": "php",
1126
+ ".ps1": "powershell",
1127
+ ".psm1": "powershell",
1128
+ ".pug": "jade",
1129
+ ".jade": "jade",
1130
+ ".py": "python",
1131
+ ".pyi": "python",
1132
+ ".r": "r",
1133
+ ".cshtml": "razor",
1134
+ ".razor": "razor",
1135
+ ".rb": "ruby",
1136
+ ".rake": "ruby",
1137
+ ".gemspec": "ruby",
1138
+ ".ru": "ruby",
1139
+ ".erb": "erb",
1140
+ ".html.erb": "erb",
1141
+ ".js.erb": "erb",
1142
+ ".css.erb": "erb",
1143
+ ".json.erb": "erb",
1144
+ ".rs": "rust",
1145
+ ".scss": "scss",
1146
+ ".sass": "sass",
1147
+ ".scala": "scala",
1148
+ ".shader": "shaderlab",
1149
+ ".sh": "shellscript",
1150
+ ".bash": "shellscript",
1151
+ ".zsh": "shellscript",
1152
+ ".ksh": "shellscript",
1153
+ ".sql": "sql",
1154
+ ".svelte": "svelte",
1155
+ ".swift": "swift",
1156
+ ".ts": "typescript",
1157
+ ".tsx": "typescriptreact",
1158
+ ".mts": "typescript",
1159
+ ".cts": "typescript",
1160
+ ".mtsx": "typescriptreact",
1161
+ ".ctsx": "typescriptreact",
1162
+ ".xml": "xml",
1163
+ ".xsl": "xsl",
1164
+ ".yaml": "yaml",
1165
+ ".yml": "yaml",
1166
+ ".mjs": "javascript",
1167
+ ".cjs": "javascript",
1168
+ ".vue": "vue",
1169
+ ".zig": "zig",
1170
+ ".zon": "zig",
1171
+ ".astro": "astro",
1172
+ ".ml": "ocaml",
1173
+ ".mli": "ocaml",
1174
+ ".tf": "terraform",
1175
+ ".tfvars": "terraform-vars",
1176
+ ".hcl": "hcl",
1177
+ ".nix": "nix",
1178
+ ".typ": "typst",
1179
+ ".typc": "typst",
1180
+ ".ets": "typescript",
1181
+ ".lhs": "haskell",
1182
+ ".kt": "kotlin",
1183
+ ".kts": "kotlin",
1184
+ ".prisma": "prisma",
1185
+ ".h": "c",
1186
+ ".hpp": "cpp",
1187
+ ".hh": "cpp",
1188
+ ".hxx": "cpp",
1189
+ ".h++": "cpp",
1190
+ ".objc": "objective-c",
1191
+ ".objcpp": "objective-cpp",
1192
+ ".fish": "fish",
1193
+ ".graphql": "graphql",
1194
+ ".gql": "graphql"
1195
+ };
1196
+ function getLanguageId(ext) {
1197
+ return EXT_TO_LANG[ext] ?? "plaintext";
1198
+ }
1199
+
1200
+ // ../lsp-core/src/lsp/client.ts
1201
+ var POST_OPEN_DELAY_MS = 1000;
1202
+ var POST_DIAGNOSTICS_WAIT_MS = 500;
1203
+
1204
+ class LspClient extends LspClientConnection {
1205
+ openedFiles = new Set;
1206
+ documentVersions = new Map;
1207
+ lastSyncedText = new Map;
1208
+ diagnosticPullErrors = [];
1209
+ getDiagnosticPullErrors() {
1210
+ return this.diagnosticPullErrors;
1211
+ }
1212
+ async openFile(filePath) {
1213
+ const absPath = resolve(contextCwd(), filePath);
1214
+ const uri = pathToFileURL2(absPath).href;
1215
+ const text = readFileSync(absPath, "utf-8");
1216
+ if (!this.openedFiles.has(absPath)) {
1217
+ const ext = effectiveExtension(absPath);
1218
+ const languageId = getLanguageId(ext);
1219
+ const version = 1;
1220
+ await this.sendNotification("textDocument/didOpen", {
1221
+ textDocument: {
1222
+ uri,
1223
+ languageId,
1224
+ version,
1225
+ text
1226
+ }
1227
+ });
1228
+ this.openedFiles.add(absPath);
1229
+ this.documentVersions.set(uri, version);
1230
+ this.lastSyncedText.set(uri, text);
1231
+ await new Promise((r) => setTimeout(r, POST_OPEN_DELAY_MS));
1232
+ return;
25
1233
  }
26
- if (method === "tools/call") {
27
- return handleToolCall(id, input["params"]);
1234
+ const prevText = this.lastSyncedText.get(uri);
1235
+ if (prevText === text) {
1236
+ return;
1237
+ }
1238
+ const nextVersion = (this.documentVersions.get(uri) ?? 1) + 1;
1239
+ this.documentVersions.set(uri, nextVersion);
1240
+ this.lastSyncedText.set(uri, text);
1241
+ await this.sendNotification("textDocument/didChange", {
1242
+ textDocument: { uri, version: nextVersion },
1243
+ contentChanges: [{ text }]
1244
+ });
1245
+ await this.sendNotification("textDocument/didSave", {
1246
+ textDocument: { uri },
1247
+ text
1248
+ });
1249
+ }
1250
+ async definition(filePath, line, character) {
1251
+ const absPath = resolve(contextCwd(), filePath);
1252
+ await this.openFile(absPath);
1253
+ return this.sendRequest("textDocument/definition", {
1254
+ textDocument: { uri: pathToFileURL2(absPath).href },
1255
+ position: { line: line - 1, character }
1256
+ });
1257
+ }
1258
+ async references(filePath, line, character, includeDeclaration = true) {
1259
+ const absPath = resolve(contextCwd(), filePath);
1260
+ await this.openFile(absPath);
1261
+ return this.sendRequest("textDocument/references", {
1262
+ textDocument: { uri: pathToFileURL2(absPath).href },
1263
+ position: { line: line - 1, character },
1264
+ context: { includeDeclaration }
1265
+ });
1266
+ }
1267
+ async documentSymbols(filePath) {
1268
+ const absPath = resolve(contextCwd(), filePath);
1269
+ await this.openFile(absPath);
1270
+ return this.sendRequest("textDocument/documentSymbol", {
1271
+ textDocument: { uri: pathToFileURL2(absPath).href }
1272
+ });
1273
+ }
1274
+ async workspaceSymbols(query) {
1275
+ return this.sendRequest("workspace/symbol", { query });
1276
+ }
1277
+ isUnsupportedDiagnosticPullError(error) {
1278
+ if (!(error instanceof Error))
1279
+ return false;
1280
+ const code = "code" in error && typeof error.code === "number" ? error.code : undefined;
1281
+ if (code === -32601)
1282
+ return true;
1283
+ return /unsupported|not supported|method not found|unknown request/i.test(error.message);
1284
+ }
1285
+ async diagnostics(filePath) {
1286
+ const absPath = resolve(contextCwd(), filePath);
1287
+ const uri = pathToFileURL2(absPath).href;
1288
+ await this.openFile(absPath);
1289
+ await new Promise((r) => setTimeout(r, POST_DIAGNOSTICS_WAIT_MS));
1290
+ try {
1291
+ const result = await this.sendRequest("textDocument/diagnostic", {
1292
+ textDocument: { uri }
1293
+ });
1294
+ if (result.items) {
1295
+ return { items: result.items };
1296
+ }
1297
+ } catch (error) {
1298
+ if (!this.isUnsupportedDiagnosticPullError(error)) {
1299
+ this.diagnosticPullErrors.push(error instanceof Error ? error : new Error(String(error)));
1300
+ }
28
1301
  }
29
- return errorResponse(id, -32601, `Method not found: ${String(method)}`);
1302
+ return { items: this.getStoredDiagnostics(uri) };
1303
+ }
1304
+ async prepareRename(filePath, line, character) {
1305
+ const absPath = resolve(contextCwd(), filePath);
1306
+ await this.openFile(absPath);
1307
+ return this.sendRequest("textDocument/prepareRename", {
1308
+ textDocument: { uri: pathToFileURL2(absPath).href },
1309
+ position: { line: line - 1, character }
1310
+ });
1311
+ }
1312
+ async rename(filePath, line, character, newName) {
1313
+ const absPath = resolve(contextCwd(), filePath);
1314
+ await this.openFile(absPath);
1315
+ return this.sendRequest("textDocument/rename", {
1316
+ textDocument: { uri: pathToFileURL2(absPath).href },
1317
+ position: { line: line - 1, character },
1318
+ newName
1319
+ });
1320
+ }
30
1321
  }
31
- export async function runMcpStdioServer(input = process.stdin, output = process.stdout) {
32
- const lines = createInterface({ input, crlfDelay: Number.POSITIVE_INFINITY });
33
- for await (const line of lines) {
34
- if (!line.trim())
35
- continue;
36
- let parsed;
1322
+
1323
+ // ../lsp-core/src/lsp/process-signal-cleanup.ts
1324
+ function installProcessSignalCleanup(cleanup) {
1325
+ const signals = process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGBREAK"] : ["SIGINT", "SIGTERM"];
1326
+ const handler = () => {
1327
+ cleanup().catch((error) => {
1328
+ reportBestEffortCleanupError("signal cleanup", error);
1329
+ });
1330
+ };
1331
+ for (const signal of signals) {
1332
+ process.on(signal, handler);
1333
+ }
1334
+ return () => {
1335
+ for (const signal of signals) {
1336
+ process.removeListener(signal, handler);
1337
+ }
1338
+ };
1339
+ }
1340
+
1341
+ // ../lsp-core/src/lsp/manager.ts
1342
+ async function stopClientBestEffort(client) {
1343
+ try {
1344
+ await client.stop();
1345
+ } catch (error) {
1346
+ reportBestEffortCleanupError("client stop", error);
1347
+ }
1348
+ }
1349
+ function awaitWithSignal(promise, signal) {
1350
+ if (!signal)
1351
+ return promise;
1352
+ return new Promise((resolve2, reject) => {
1353
+ let settled = false;
1354
+ const onAbort = () => {
1355
+ if (settled)
1356
+ return;
1357
+ settled = true;
1358
+ reject(new DOMException("Aborted", "AbortError"));
1359
+ };
1360
+ if (signal.aborted) {
1361
+ onAbort();
1362
+ return;
1363
+ }
1364
+ signal.addEventListener("abort", onAbort, { once: true });
1365
+ promise.then((value) => {
1366
+ if (settled)
1367
+ return;
1368
+ settled = true;
1369
+ signal.removeEventListener("abort", onAbort);
1370
+ resolve2(value);
1371
+ }, (err) => {
1372
+ if (settled)
1373
+ return;
1374
+ settled = true;
1375
+ signal.removeEventListener("abort", onAbort);
1376
+ reject(err);
1377
+ });
1378
+ });
1379
+ }
1380
+
1381
+ class LspManager {
1382
+ clients = new Map;
1383
+ reaperHandle = null;
1384
+ signalDisposer = null;
1385
+ disposed = false;
1386
+ idleTimeoutMs;
1387
+ initTimeoutMs;
1388
+ reaperIntervalMs;
1389
+ clientFactory;
1390
+ now;
1391
+ constructor(options = {}) {
1392
+ this.idleTimeoutMs = options.idleTimeoutMs ?? IDLE_TIMEOUT_MS;
1393
+ this.initTimeoutMs = options.initTimeoutMs ?? INIT_TIMEOUT_MS;
1394
+ this.reaperIntervalMs = options.reaperIntervalMs ?? REAPER_INTERVAL_MS;
1395
+ this.clientFactory = options.clientFactory ?? ((root, server2) => new LspClient(root, server2));
1396
+ this.now = options.now ?? (() => Date.now());
1397
+ this.startReaper();
1398
+ this.signalDisposer = installProcessSignalCleanup(() => this.stopAll());
1399
+ }
1400
+ startReaper() {
1401
+ if (this.reaperHandle)
1402
+ return;
1403
+ this.reaperHandle = setInterval(() => {
1404
+ this.reapStale();
1405
+ }, this.reaperIntervalMs);
1406
+ if (typeof this.reaperHandle.unref === "function") {
1407
+ this.reaperHandle.unref();
1408
+ }
1409
+ }
1410
+ getKey(root, serverId) {
1411
+ return `${root}::${serverId}`;
1412
+ }
1413
+ reapStale() {
1414
+ const t = this.now();
1415
+ for (const [key, managed] of this.clients) {
1416
+ if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
1417
+ stopClientBestEffort(managed.client);
1418
+ this.clients.delete(key);
1419
+ continue;
1420
+ }
1421
+ if (!managed.isInitializing && managed.refCount === 0 && managed.pendingWaiters === 0 && t - managed.lastUsedAt > this.idleTimeoutMs) {
1422
+ stopClientBestEffort(managed.client);
1423
+ this.clients.delete(key);
1424
+ }
1425
+ }
1426
+ }
1427
+ async tryDeleteIfOrphaned(key, managed) {
1428
+ if (managed.refCount === 0 && managed.pendingWaiters === 0 && !managed.isInitializing && this.clients.get(key) === managed) {
1429
+ this.clients.delete(key);
1430
+ await stopClientBestEffort(managed.client);
1431
+ }
1432
+ }
1433
+ async getClient(root, server2, signal) {
1434
+ if (this.disposed) {
1435
+ throw new Error("LspManager has been disposed");
1436
+ }
1437
+ signal?.throwIfAborted();
1438
+ const key = this.getKey(root, server2.id);
1439
+ let managed = this.clients.get(key);
1440
+ if (managed) {
1441
+ const t = this.now();
1442
+ if (managed.isInitializing && managed.initializingSince !== null && t - managed.initializingSince > this.initTimeoutMs) {
1443
+ await stopClientBestEffort(managed.client);
1444
+ this.clients.delete(key);
1445
+ managed = undefined;
1446
+ }
1447
+ }
1448
+ if (managed) {
1449
+ if (managed.initPromise) {
1450
+ managed.pendingWaiters++;
37
1451
  try {
38
- parsed = JSON.parse(line);
1452
+ await awaitWithSignal(managed.initPromise, signal);
1453
+ } catch (err) {
1454
+ managed.pendingWaiters--;
1455
+ await this.tryDeleteIfOrphaned(key, managed);
1456
+ throw err;
39
1457
  }
40
- catch (error) {
41
- output.write(`${JSON.stringify(errorResponse(null, -32700, "Parse error", messageFromError(error)))}\n`);
42
- continue;
1458
+ managed.pendingWaiters--;
1459
+ }
1460
+ if (signal?.aborted) {
1461
+ await this.tryDeleteIfOrphaned(key, managed);
1462
+ signal.throwIfAborted();
1463
+ }
1464
+ if (!managed.client.isAlive()) {
1465
+ await stopClientBestEffort(managed.client);
1466
+ this.clients.delete(key);
1467
+ return this.getClient(root, server2, signal);
1468
+ }
1469
+ managed.refCount++;
1470
+ managed.lastUsedAt = this.now();
1471
+ return managed.client;
1472
+ }
1473
+ const client = this.clientFactory(root, server2);
1474
+ const initStartedAt = this.now();
1475
+ const initPromise = (async () => {
1476
+ await client.start();
1477
+ await client.initialize();
1478
+ })();
1479
+ const newManaged = {
1480
+ client,
1481
+ refCount: 0,
1482
+ pendingWaiters: 1,
1483
+ lastUsedAt: initStartedAt,
1484
+ initPromise,
1485
+ isInitializing: true,
1486
+ initializingSince: initStartedAt
1487
+ };
1488
+ this.clients.set(key, newManaged);
1489
+ try {
1490
+ await awaitWithSignal(initPromise, signal);
1491
+ } catch (err) {
1492
+ newManaged.pendingWaiters--;
1493
+ if (this.clients.get(key) === newManaged) {
1494
+ this.clients.delete(key);
1495
+ }
1496
+ await stopClientBestEffort(client);
1497
+ throw err;
1498
+ }
1499
+ newManaged.pendingWaiters--;
1500
+ newManaged.isInitializing = false;
1501
+ newManaged.initializingSince = null;
1502
+ newManaged.initPromise = null;
1503
+ if (signal?.aborted) {
1504
+ await this.tryDeleteIfOrphaned(key, newManaged);
1505
+ signal.throwIfAborted();
1506
+ }
1507
+ newManaged.refCount++;
1508
+ newManaged.lastUsedAt = this.now();
1509
+ return client;
1510
+ }
1511
+ releaseClient(root, serverId) {
1512
+ const key = this.getKey(root, serverId);
1513
+ const managed = this.clients.get(key);
1514
+ if (managed && managed.refCount > 0) {
1515
+ managed.refCount--;
1516
+ managed.lastUsedAt = this.now();
1517
+ }
1518
+ }
1519
+ invalidateClient(root, serverId, client) {
1520
+ const key = this.getKey(root, serverId);
1521
+ const managed = this.clients.get(key);
1522
+ if (!managed)
1523
+ return;
1524
+ if (client && managed.client !== client)
1525
+ return;
1526
+ this.clients.delete(key);
1527
+ stopClientBestEffort(managed.client);
1528
+ }
1529
+ warmupClient(root, server2) {
1530
+ if (this.disposed)
1531
+ return;
1532
+ const key = this.getKey(root, server2.id);
1533
+ if (this.clients.has(key))
1534
+ return;
1535
+ const client = this.clientFactory(root, server2);
1536
+ const initStartedAt = this.now();
1537
+ const initPromise = (async () => {
1538
+ await client.start();
1539
+ await client.initialize();
1540
+ })();
1541
+ const managed = {
1542
+ client,
1543
+ refCount: 0,
1544
+ pendingWaiters: 0,
1545
+ lastUsedAt: initStartedAt,
1546
+ initPromise,
1547
+ isInitializing: true,
1548
+ initializingSince: initStartedAt
1549
+ };
1550
+ this.clients.set(key, managed);
1551
+ initPromise.then(() => {
1552
+ managed.isInitializing = false;
1553
+ managed.initializingSince = null;
1554
+ managed.initPromise = null;
1555
+ managed.lastUsedAt = this.now();
1556
+ }, () => {
1557
+ if (this.clients.get(key) === managed) {
1558
+ this.clients.delete(key);
1559
+ }
1560
+ stopClientBestEffort(client);
1561
+ });
1562
+ }
1563
+ isServerInitializing(root, serverId) {
1564
+ const managed = this.clients.get(this.getKey(root, serverId));
1565
+ return managed?.isInitializing ?? false;
1566
+ }
1567
+ getSnapshot() {
1568
+ const snapshots = [];
1569
+ for (const [key, managed] of this.clients) {
1570
+ const [root, serverId] = key.split("::");
1571
+ snapshots.push({
1572
+ root,
1573
+ serverId,
1574
+ refCount: managed.refCount,
1575
+ pendingWaiters: managed.pendingWaiters,
1576
+ lastUsedAt: managed.lastUsedAt,
1577
+ isInitializing: managed.isInitializing,
1578
+ alive: managed.client.isAlive(),
1579
+ command: managed.client.command()
1580
+ });
1581
+ }
1582
+ return snapshots;
1583
+ }
1584
+ hasClient(root, serverId) {
1585
+ return this.clients.has(this.getKey(root, serverId));
1586
+ }
1587
+ clientCount() {
1588
+ return this.clients.size;
1589
+ }
1590
+ async stopAll() {
1591
+ this.disposed = true;
1592
+ if (this.reaperHandle) {
1593
+ clearInterval(this.reaperHandle);
1594
+ this.reaperHandle = null;
1595
+ }
1596
+ if (this.signalDisposer) {
1597
+ this.signalDisposer();
1598
+ this.signalDisposer = null;
1599
+ }
1600
+ const stopPromises = [];
1601
+ for (const managed of this.clients.values()) {
1602
+ stopPromises.push(stopClientBestEffort(managed.client));
1603
+ }
1604
+ this.clients.clear();
1605
+ await Promise.allSettled(stopPromises);
1606
+ }
1607
+ }
1608
+ var _defaultInstance = null;
1609
+ function getLspManager() {
1610
+ if (!_defaultInstance) {
1611
+ _defaultInstance = new LspManager;
1612
+ }
1613
+ return _defaultInstance;
1614
+ }
1615
+ async function disposeDefaultLspManager() {
1616
+ if (_defaultInstance) {
1617
+ const m = _defaultInstance;
1618
+ _defaultInstance = null;
1619
+ await m.stopAll();
1620
+ }
1621
+ }
1622
+
1623
+ // ../lsp-core/src/lsp/server-install-state.ts
1624
+ import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, renameSync, writeFileSync } from "node:fs";
1625
+ import { homedir } from "node:os";
1626
+ import { dirname, isAbsolute, join as join2 } from "node:path";
1627
+ function getInstallDecisionsPath() {
1628
+ const override = contextEnv("LSP_TOOLS_MCP_INSTALL_DECISIONS");
1629
+ if (!override)
1630
+ return join2(homedir(), ".codex", "lsp-install-decisions.json");
1631
+ return isAbsolute(override) ? override : join2(homedir(), override);
1632
+ }
1633
+ function loadInstallDecisions() {
1634
+ const path = getInstallDecisionsPath();
1635
+ if (!existsSync2(path))
1636
+ return {};
1637
+ try {
1638
+ const parsed = JSON.parse(readFileSync2(path, "utf8"));
1639
+ return isInstallDecisions(parsed) ? parsed : {};
1640
+ } catch {
1641
+ return {};
1642
+ }
1643
+ }
1644
+ function loadInstallDecision(serverId) {
1645
+ return loadInstallDecisions()[serverId];
1646
+ }
1647
+ function recordInstallDecision(serverId, decision, decidedAt = new Date().toISOString()) {
1648
+ const decisions = loadInstallDecisions();
1649
+ decisions[serverId] = { decision, decidedAt };
1650
+ writeInstallDecisions(decisions);
1651
+ }
1652
+ function isInstallDecision(value) {
1653
+ return value === "declined" || value === "allowed";
1654
+ }
1655
+ function writeInstallDecisions(decisions) {
1656
+ const path = getInstallDecisionsPath();
1657
+ mkdirSync(dirname(path), { recursive: true });
1658
+ const tmpPath = `${path}.tmp`;
1659
+ writeFileSync(tmpPath, `${JSON.stringify(decisions, null, 2)}
1660
+ `, "utf8");
1661
+ renameSync(tmpPath, path);
1662
+ }
1663
+ function isInstallDecisions(value) {
1664
+ return isRecord2(value) && Object.values(value).every(isInstallDecisionRecord);
1665
+ }
1666
+ function isInstallDecisionRecord(value) {
1667
+ if (!isRecord2(value))
1668
+ return false;
1669
+ return isInstallDecision(value["decision"]) && typeof value["decidedAt"] === "string";
1670
+ }
1671
+ function isRecord2(value) {
1672
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1673
+ }
1674
+
1675
+ // ../lsp-core/src/lsp/config-loader.ts
1676
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
1677
+ import { homedir as homedir2 } from "node:os";
1678
+ import { delimiter as delimiter2, isAbsolute as isAbsolute2, join as join3 } from "node:path";
1679
+
1680
+ // ../lsp-core/src/lsp/server-definitions.ts
1681
+ var LSP_INSTALL_HINTS = {
1682
+ typescript: "npm install -g typescript-language-server typescript",
1683
+ deno: "Install Deno from https://deno.land",
1684
+ vue: "npm install -g @vue/language-server",
1685
+ eslint: "npm install -g vscode-langservers-extracted",
1686
+ oxlint: "npm install -g oxlint",
1687
+ biome: "npm install -g @biomejs/biome",
1688
+ gopls: "go install golang.org/x/tools/gopls@latest",
1689
+ "ruby-lsp": "gem install ruby-lsp",
1690
+ basedpyright: "pip install basedpyright",
1691
+ pyright: "pip install pyright",
1692
+ ty: "pip install ty",
1693
+ ruff: "pip install ruff",
1694
+ "elixir-ls": "See https://github.com/elixir-lsp/elixir-ls",
1695
+ zls: "See https://github.com/zigtools/zls",
1696
+ csharp: "dotnet tool install -g csharp-ls",
1697
+ fsharp: "dotnet tool install -g fsautocomplete",
1698
+ "sourcekit-lsp": "Included with Xcode or Swift toolchain",
1699
+ rust: "Install rust-analyzer and ensure it is in PATH. If using rustup: rustup component add rust-analyzer. " + "If rust-analyzer exits while loading rust-src: rustup component remove rust-src && rustup component add rust-src.",
1700
+ clangd: "See https://clangd.llvm.org/installation",
1701
+ svelte: "npm install -g svelte-language-server",
1702
+ astro: "npm install -g @astrojs/language-server",
1703
+ "bash-ls": "npm install -g bash-language-server",
1704
+ jdtls: "See https://github.com/eclipse-jdtls/eclipse.jdt.ls",
1705
+ "yaml-ls": "npm install -g yaml-language-server",
1706
+ "lua-ls": "See https://github.com/LuaLS/lua-language-server",
1707
+ php: "npm install -g intelephense",
1708
+ dart: "Included with Dart SDK",
1709
+ "terraform-ls": "See https://github.com/hashicorp/terraform-ls",
1710
+ terraform: "See https://github.com/hashicorp/terraform-ls",
1711
+ prisma: "npm install -g prisma",
1712
+ "ocaml-lsp": "opam install ocaml-lsp-server",
1713
+ texlab: "See https://github.com/latex-lsp/texlab",
1714
+ dockerfile: "npm install -g dockerfile-language-server-nodejs",
1715
+ gleam: "See https://gleam.run/getting-started/installing/",
1716
+ "clojure-lsp": "See https://clojure-lsp.io/installation/",
1717
+ nixd: "nix profile install nixpkgs#nixd",
1718
+ tinymist: "See https://github.com/Myriad-Dreamin/tinymist",
1719
+ "haskell-language-server": "ghcup install hls",
1720
+ bash: "npm install -g bash-language-server",
1721
+ "kotlin-ls": "See https://github.com/Kotlin/kotlin-lsp",
1722
+ julials: `julia -e 'using Pkg; Pkg.add("LanguageServer")'`,
1723
+ 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"
1724
+ };
1725
+ var BUILTIN_SERVERS = {
1726
+ typescript: {
1727
+ command: ["typescript-language-server", "--stdio"],
1728
+ extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts"]
1729
+ },
1730
+ deno: { command: ["deno", "lsp"], extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs"] },
1731
+ vue: { command: ["vue-language-server", "--stdio"], extensions: [".vue"] },
1732
+ eslint: {
1733
+ command: ["vscode-eslint-language-server", "--stdio"],
1734
+ extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".vue"]
1735
+ },
1736
+ oxlint: {
1737
+ command: ["oxlint", "--lsp"],
1738
+ extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".mts", ".cts", ".vue", ".astro", ".svelte"]
1739
+ },
1740
+ biome: {
1741
+ command: ["biome", "lsp-proxy", "--stdio"],
1742
+ extensions: [
1743
+ ".ts",
1744
+ ".tsx",
1745
+ ".js",
1746
+ ".jsx",
1747
+ ".mjs",
1748
+ ".cjs",
1749
+ ".mts",
1750
+ ".cts",
1751
+ ".json",
1752
+ ".jsonc",
1753
+ ".vue",
1754
+ ".astro",
1755
+ ".svelte",
1756
+ ".css",
1757
+ ".graphql",
1758
+ ".gql",
1759
+ ".html"
1760
+ ]
1761
+ },
1762
+ gopls: { command: ["gopls"], extensions: [".go"] },
1763
+ "ruby-lsp": {
1764
+ command: ["rubocop", "--lsp"],
1765
+ extensions: [".rb", ".rake", ".gemspec", ".ru"]
1766
+ },
1767
+ basedpyright: {
1768
+ command: ["basedpyright-langserver", "--stdio"],
1769
+ extensions: [".py", ".pyi"]
1770
+ },
1771
+ pyright: { command: ["pyright-langserver", "--stdio"], extensions: [".py", ".pyi"] },
1772
+ ty: { command: ["ty", "server"], extensions: [".py", ".pyi"] },
1773
+ ruff: { command: ["ruff", "server"], extensions: [".py", ".pyi"] },
1774
+ "elixir-ls": { command: ["elixir-ls"], extensions: [".ex", ".exs"] },
1775
+ zls: { command: ["zls"], extensions: [".zig", ".zon"] },
1776
+ csharp: { command: ["csharp-ls"], extensions: [".cs"] },
1777
+ fsharp: { command: ["fsautocomplete"], extensions: [".fs", ".fsi", ".fsx", ".fsscript"] },
1778
+ "sourcekit-lsp": { command: ["sourcekit-lsp"], extensions: [".swift", ".m", ".mm"] },
1779
+ rust: { command: ["rust-analyzer"], extensions: [".rs"] },
1780
+ clangd: {
1781
+ command: ["clangd", "--background-index", "--clang-tidy"],
1782
+ extensions: [".c", ".cpp", ".cc", ".cxx", ".c++", ".h", ".hpp", ".hh", ".hxx", ".h++"]
1783
+ },
1784
+ svelte: { command: ["svelteserver", "--stdio"], extensions: [".svelte"] },
1785
+ astro: { command: ["astro-ls", "--stdio"], extensions: [".astro"] },
1786
+ bash: {
1787
+ command: ["bash-language-server", "start"],
1788
+ extensions: [".sh", ".bash", ".zsh", ".ksh"]
1789
+ },
1790
+ "bash-ls": {
1791
+ command: ["bash-language-server", "start"],
1792
+ extensions: [".sh", ".bash", ".zsh", ".ksh"]
1793
+ },
1794
+ jdtls: { command: ["jdtls"], extensions: [".java"] },
1795
+ "yaml-ls": { command: ["yaml-language-server", "--stdio"], extensions: [".yaml", ".yml"] },
1796
+ "lua-ls": { command: ["lua-language-server"], extensions: [".lua"] },
1797
+ php: { command: ["intelephense", "--stdio"], extensions: [".php"] },
1798
+ dart: { command: ["dart", "language-server", "--lsp"], extensions: [".dart"] },
1799
+ terraform: { command: ["terraform-ls", "serve"], extensions: [".tf", ".tfvars"] },
1800
+ "terraform-ls": { command: ["terraform-ls", "serve"], extensions: [".tf", ".tfvars"] },
1801
+ prisma: { command: ["prisma", "language-server"], extensions: [".prisma"] },
1802
+ "ocaml-lsp": { command: ["ocamllsp"], extensions: [".ml", ".mli"] },
1803
+ texlab: { command: ["texlab"], extensions: [".tex", ".bib"] },
1804
+ dockerfile: { command: ["docker-langserver", "--stdio"], extensions: [".dockerfile"] },
1805
+ gleam: { command: ["gleam", "lsp"], extensions: [".gleam"] },
1806
+ "clojure-lsp": {
1807
+ command: ["clojure-lsp", "listen"],
1808
+ extensions: [".clj", ".cljs", ".cljc", ".edn"]
1809
+ },
1810
+ nixd: { command: ["nixd"], extensions: [".nix"] },
1811
+ tinymist: { command: ["tinymist"], extensions: [".typ", ".typc"] },
1812
+ "haskell-language-server": {
1813
+ command: ["haskell-language-server-wrapper", "--lsp"],
1814
+ extensions: [".hs", ".lhs"]
1815
+ },
1816
+ "kotlin-ls": { command: ["kotlin-lsp", "--stdio"], extensions: [".kt", ".kts"] },
1817
+ julials: {
1818
+ command: ["julia", "--startup-file=no", "--history-file=no", "-e", "using LanguageServer; runserver()"],
1819
+ extensions: [".jl"]
1820
+ },
1821
+ razor: {
1822
+ command: ["roslyn-language-server", "--stdio"],
1823
+ extensions: [".razor", ".cshtml"]
1824
+ }
1825
+ };
1826
+
1827
+ // ../lsp-core/src/lsp/config-loader.ts
1828
+ function resolveProjectConfigPath(path) {
1829
+ return isAbsolute2(path) ? path : join3(contextCwd(), path);
1830
+ }
1831
+ function getProjectConfigPaths() {
1832
+ const projectOverride = contextEnv("LSP_TOOLS_MCP_PROJECT_CONFIG");
1833
+ if (projectOverride) {
1834
+ return projectOverride.split(delimiter2).filter(Boolean).map(resolveProjectConfigPath);
1835
+ }
1836
+ return [join3(contextCwd(), ".codex", "lsp-client.json")];
1837
+ }
1838
+ function getUserConfigPath() {
1839
+ const userOverride = contextEnv("LSP_TOOLS_MCP_USER_CONFIG");
1840
+ if (!userOverride)
1841
+ return join3(homedir2(), ".codex", "lsp-client.json");
1842
+ return isAbsolute2(userOverride) ? userOverride : join3(homedir2(), userOverride);
1843
+ }
1844
+ function loadJsonFile(path) {
1845
+ if (!existsSync3(path))
1846
+ return null;
1847
+ try {
1848
+ const parsed = JSON.parse(readFileSync3(path, "utf-8"));
1849
+ return isConfigJson(parsed) ? parsed : null;
1850
+ } catch {
1851
+ return null;
1852
+ }
1853
+ }
1854
+ function loadAllConfigs() {
1855
+ const configs = new Map;
1856
+ const project = loadFirstJsonFile(getProjectConfigPaths());
1857
+ if (project)
1858
+ configs.set("project", project);
1859
+ const user = loadJsonFile(getUserConfigPath());
1860
+ if (user)
1861
+ configs.set("user", user);
1862
+ return configs;
1863
+ }
1864
+ function loadFirstJsonFile(paths) {
1865
+ for (const path of paths) {
1866
+ const config = loadJsonFile(path);
1867
+ if (config)
1868
+ return config;
1869
+ }
1870
+ return null;
1871
+ }
1872
+ function getMergedServers() {
1873
+ const configs = loadAllConfigs();
1874
+ const servers = [];
1875
+ const disabled = new Set;
1876
+ const seen = new Set;
1877
+ const sources = ["project", "user"];
1878
+ for (const source of sources) {
1879
+ const config = configs.get(source);
1880
+ if (!config?.lsp)
1881
+ continue;
1882
+ for (const [id, rawEntry] of Object.entries(config.lsp)) {
1883
+ const entry = parseLspEntry(rawEntry);
1884
+ if (!entry)
1885
+ continue;
1886
+ if (entry.disabled) {
1887
+ disabled.add(id);
1888
+ continue;
1889
+ }
1890
+ if (seen.has(id))
1891
+ continue;
1892
+ const server2 = createServerFromEntry(id, entry, source);
1893
+ if (!server2)
1894
+ continue;
1895
+ servers.push(server2);
1896
+ seen.add(id);
1897
+ }
1898
+ }
1899
+ for (const [id, config] of Object.entries(BUILTIN_SERVERS)) {
1900
+ if (disabled.has(id) || seen.has(id))
1901
+ continue;
1902
+ servers.push({
1903
+ id,
1904
+ command: config.command,
1905
+ extensions: config.extensions,
1906
+ priority: -100,
1907
+ source: "builtin"
1908
+ });
1909
+ }
1910
+ return servers.sort((a, b) => {
1911
+ if (a.source !== b.source) {
1912
+ const order = {
1913
+ project: 0,
1914
+ user: 1,
1915
+ builtin: 2
1916
+ };
1917
+ return order[a.source] - order[b.source];
1918
+ }
1919
+ return b.priority - a.priority;
1920
+ });
1921
+ }
1922
+ function createServerFromEntry(id, entry, source) {
1923
+ const builtin = BUILTIN_SERVERS[id];
1924
+ if (source === "project") {
1925
+ if (!builtin)
1926
+ return null;
1927
+ const server3 = createServer({
1928
+ id,
1929
+ command: builtin.command,
1930
+ extensions: entry.extensions ?? builtin.extensions,
1931
+ priority: entry.priority ?? 0,
1932
+ source
1933
+ });
1934
+ if (entry.initialization !== undefined) {
1935
+ server3.initialization = entry.initialization;
1936
+ }
1937
+ return server3;
1938
+ }
1939
+ if (entry.command && entry.extensions) {
1940
+ const server3 = createServer({
1941
+ id,
1942
+ command: entry.command,
1943
+ extensions: entry.extensions,
1944
+ priority: entry.priority ?? 0,
1945
+ source
1946
+ });
1947
+ applyOptionalServerFields(server3, entry);
1948
+ return server3;
1949
+ }
1950
+ if (!builtin)
1951
+ return null;
1952
+ const server2 = createServer({
1953
+ id,
1954
+ command: entry.command ?? builtin.command,
1955
+ extensions: entry.extensions ?? builtin.extensions,
1956
+ priority: entry.priority ?? 0,
1957
+ source
1958
+ });
1959
+ applyOptionalServerFields(server2, entry);
1960
+ return server2;
1961
+ }
1962
+ function createServer(input) {
1963
+ const server2 = {
1964
+ id: input.id,
1965
+ command: input.command,
1966
+ extensions: input.extensions,
1967
+ priority: input.priority,
1968
+ source: input.source
1969
+ };
1970
+ if (input.env !== undefined) {
1971
+ server2.env = input.env;
1972
+ }
1973
+ if (input.initialization !== undefined) {
1974
+ server2.initialization = input.initialization;
1975
+ }
1976
+ return server2;
1977
+ }
1978
+ function applyOptionalServerFields(server2, entry) {
1979
+ if (entry.env !== undefined) {
1980
+ server2.env = entry.env;
1981
+ }
1982
+ if (entry.initialization !== undefined) {
1983
+ server2.initialization = entry.initialization;
1984
+ }
1985
+ }
1986
+ function isConfigJson(value) {
1987
+ if (!isRecord3(value))
1988
+ return false;
1989
+ const lsp = value["lsp"];
1990
+ return lsp === undefined || isRecord3(lsp);
1991
+ }
1992
+ function parseLspEntry(value) {
1993
+ return isLspEntry(value) ? value : null;
1994
+ }
1995
+ function isLspEntry(value) {
1996
+ if (!isRecord3(value))
1997
+ return false;
1998
+ const disabled = value["disabled"];
1999
+ const command = value["command"];
2000
+ const extensions = value["extensions"];
2001
+ const priority = value["priority"];
2002
+ const env = value["env"];
2003
+ const initialization = value["initialization"];
2004
+ return (disabled === undefined || typeof disabled === "boolean") && (command === undefined || isStringArray(command)) && (extensions === undefined || isStringArray(extensions)) && (priority === undefined || typeof priority === "number") && (env === undefined || isStringRecord(env)) && (initialization === undefined || isRecord3(initialization));
2005
+ }
2006
+ function isStringArray(value) {
2007
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
2008
+ }
2009
+ function isStringRecord(value) {
2010
+ return isRecord3(value) && Object.values(value).every((item) => typeof item === "string");
2011
+ }
2012
+ function isRecord3(value) {
2013
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2014
+ }
2015
+ function getDisabledServerIds() {
2016
+ const configs = loadAllConfigs();
2017
+ const disabled = new Set;
2018
+ for (const config of configs.values()) {
2019
+ if (!config.lsp)
2020
+ continue;
2021
+ for (const [id, rawEntry] of Object.entries(config.lsp)) {
2022
+ const entry = parseLspEntry(rawEntry);
2023
+ if (!entry)
2024
+ continue;
2025
+ if (entry.disabled)
2026
+ disabled.add(id);
2027
+ }
2028
+ }
2029
+ return disabled;
2030
+ }
2031
+
2032
+ // ../lsp-core/src/lsp/server-installation.ts
2033
+ import { existsSync as existsSync4 } from "node:fs";
2034
+ import { delimiter as delimiter3, join as join4 } from "node:path";
2035
+ function isServerInstalled(command, _workingDirectory) {
2036
+ if (command.length === 0)
2037
+ return false;
2038
+ const [cmd] = command;
2039
+ if (!cmd)
2040
+ return false;
2041
+ if (cmd.includes("/") || cmd.includes("\\")) {
2042
+ if (existsSync4(cmd))
2043
+ return true;
2044
+ }
2045
+ const isWindows = process.platform === "win32";
2046
+ let exts = [""];
2047
+ if (isWindows) {
2048
+ const pathExt = process.env["PATHEXT"] ?? "";
2049
+ if (pathExt) {
2050
+ const systemExts = pathExt.split(";").filter(Boolean);
2051
+ exts = [...new Set([...exts, ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
2052
+ } else {
2053
+ exts = ["", ".exe", ".cmd", ".bat", ".ps1"];
2054
+ }
2055
+ }
2056
+ let pathEnv = process.env["PATH"] ?? "";
2057
+ if (isWindows && !pathEnv) {
2058
+ pathEnv = process.env["Path"] ?? "";
2059
+ }
2060
+ const paths = pathEnv.split(delimiter3);
2061
+ for (const p of paths) {
2062
+ for (const suffix of exts) {
2063
+ if (existsSync4(join4(p, cmd + suffix))) {
2064
+ return true;
2065
+ }
2066
+ }
2067
+ }
2068
+ if (cmd === "node")
2069
+ return true;
2070
+ return false;
2071
+ }
2072
+
2073
+ // ../lsp-core/src/lsp/server-resolution.ts
2074
+ function findServerForExtension(ext) {
2075
+ const servers = getMergedServers();
2076
+ for (const server2 of servers) {
2077
+ if (server2.extensions.includes(ext) && isServerInstalled(server2.command)) {
2078
+ const resolvedServer = {
2079
+ id: server2.id,
2080
+ command: server2.command,
2081
+ extensions: server2.extensions,
2082
+ priority: server2.priority
2083
+ };
2084
+ if (server2.env !== undefined) {
2085
+ return {
2086
+ status: "found",
2087
+ server: {
2088
+ ...resolvedServer,
2089
+ env: server2.env,
2090
+ ...server2.initialization === undefined ? {} : { initialization: server2.initialization }
2091
+ }
2092
+ };
2093
+ }
2094
+ return {
2095
+ status: "found",
2096
+ server: {
2097
+ ...resolvedServer,
2098
+ ...server2.initialization === undefined ? {} : { initialization: server2.initialization }
43
2099
  }
44
- const response = await handleLspMcpRequest(parsed);
45
- if (response)
46
- output.write(`${JSON.stringify(response)}\n`);
2100
+ };
47
2101
  }
2102
+ }
2103
+ for (const server2 of servers) {
2104
+ if (server2.extensions.includes(ext)) {
2105
+ const installHint = LSP_INSTALL_HINTS[server2.id] ?? `Install '${server2.command[0]}' and ensure it's in your PATH`;
2106
+ return {
2107
+ status: "not_installed",
2108
+ server: {
2109
+ id: server2.id,
2110
+ command: server2.command,
2111
+ extensions: server2.extensions
2112
+ },
2113
+ installHint
2114
+ };
2115
+ }
2116
+ }
2117
+ const availableServers = [...new Set(servers.map((s) => s.id))];
2118
+ return {
2119
+ status: "not_configured",
2120
+ extension: ext,
2121
+ availableServers
2122
+ };
48
2123
  }
49
- async function handleToolCall(id, params) {
50
- if (!isRecord(params) || typeof params["name"] !== "string") {
51
- return errorResponse(id, -32602, "tools/call requires params.name");
2124
+ function getAllServers() {
2125
+ const servers = getMergedServers();
2126
+ const disabled = getDisabledServerIds();
2127
+ const result = [];
2128
+ const seen = new Set;
2129
+ for (const server2 of servers) {
2130
+ if (seen.has(server2.id))
2131
+ continue;
2132
+ result.push({
2133
+ id: server2.id,
2134
+ installed: isServerInstalled(server2.command),
2135
+ extensions: server2.extensions,
2136
+ disabled: false,
2137
+ source: server2.source,
2138
+ priority: server2.priority
2139
+ });
2140
+ seen.add(server2.id);
2141
+ }
2142
+ for (const id of disabled) {
2143
+ if (seen.has(id))
2144
+ continue;
2145
+ const builtin = BUILTIN_SERVERS[id];
2146
+ result.push({
2147
+ id,
2148
+ installed: builtin ? isServerInstalled(builtin.command) : false,
2149
+ extensions: builtin?.extensions ?? [],
2150
+ disabled: true,
2151
+ source: "disabled",
2152
+ priority: 0
2153
+ });
2154
+ }
2155
+ return result;
2156
+ }
2157
+
2158
+ // ../lsp-core/src/lsp/client-wrapper.ts
2159
+ var WORKSPACE_MARKERS = [".git", "package.json", "pyproject.toml", "Cargo.toml", "go.mod", "pom.xml", "build.gradle"];
2160
+ function isDirectoryPath(filePath) {
2161
+ try {
2162
+ return statSync2(filePath).isDirectory();
2163
+ } catch {
2164
+ return false;
2165
+ }
2166
+ }
2167
+ function findWorkspaceRoot(filePath) {
2168
+ const abs = resolve2(contextCwd(), filePath);
2169
+ let dir = abs;
2170
+ if (!isDirectoryPath(dir)) {
2171
+ dir = dirname2(dir);
2172
+ }
2173
+ let prevDir = "";
2174
+ while (dir !== prevDir) {
2175
+ for (const marker of WORKSPACE_MARKERS) {
2176
+ if (existsSync5(join5(dir, marker))) {
2177
+ return dir;
2178
+ }
52
2179
  }
2180
+ prevDir = dir;
2181
+ dir = dirname2(dir);
2182
+ }
2183
+ return dirname2(abs);
2184
+ }
2185
+ function formatServerLookupError(result) {
2186
+ if (result.status === "not_installed") {
2187
+ return formatNotInstalled(result);
2188
+ }
2189
+ return [
2190
+ `No LSP server configured for extension: ${result.extension}`,
2191
+ "",
2192
+ `Available servers: ${result.availableServers.slice(0, 10).join(", ")}${result.availableServers.length > 10 ? "..." : ""}`,
2193
+ "",
2194
+ "Configure a custom server in '.codex/lsp-client.json':",
2195
+ " {",
2196
+ ' "lsp": {',
2197
+ ' "my-server": {',
2198
+ ' "command": ["my-lsp", "--stdio"],',
2199
+ ` "extensions": ["${result.extension}"]`,
2200
+ " }",
2201
+ " }",
2202
+ " }"
2203
+ ].join(`
2204
+ `);
2205
+ }
2206
+ function formatNotInstalled(result) {
2207
+ const { server: server2, installHint } = result;
2208
+ const extensions = server2.extensions.join(", ");
2209
+ const decision = loadInstallDecision(server2.id)?.decision;
2210
+ if (decision === "declined") {
2211
+ return `LSP server '${server2.id}' (${extensions}) is NOT INSTALLED; user previously declined installation — proceed without LSP.`;
2212
+ }
2213
+ const header = [
2214
+ `LSP server '${server2.id}' for ${extensions} is NOT INSTALLED.`,
2215
+ "",
2216
+ `Command not found: ${server2.command[0]}`,
2217
+ ""
2218
+ ];
2219
+ if (decision === "allowed") {
2220
+ return [
2221
+ ...header,
2222
+ "The user has pre-authorized LSP installation. Run the install command, then retry this tool:",
2223
+ ` ${installHint}`
2224
+ ].join(`
2225
+ `);
2226
+ }
2227
+ return [
2228
+ ...header,
2229
+ "To install, run:",
2230
+ ` ${installHint}`,
2231
+ "",
2232
+ "ACTION REQUIRED — ASK THE USER whether to install this LSP server.",
2233
+ "- If the user agrees: run the install command above, then retry this tool.",
2234
+ "- If the user declines, OR has NOT explicitly asked for LSP installation:",
2235
+ ` call lsp_install_decision { server_id: "${server2.id}", decision: "declined" },`,
2236
+ " then ignore this message and proceed WITHOUT LSP."
2237
+ ].join(`
2238
+ `);
2239
+ }
2240
+ var READ_ONLY_RETRY_TOOLS = new Set([
2241
+ "diagnostics",
2242
+ "definition",
2243
+ "references",
2244
+ "documentSymbols",
2245
+ "workspaceSymbols",
2246
+ "prepareRename"
2247
+ ]);
2248
+ async function withLspClient(filePath, fn, toolName, options = {}) {
2249
+ const absPath = resolve2(contextCwd(), filePath);
2250
+ if (isDirectoryPath(absPath)) {
2251
+ throw new LspInvalidPathError("Directory paths are not supported by this LSP tool. " + "Use lsp.diagnostics with a directory path for directory diagnostics.");
2252
+ }
2253
+ const ext = effectiveExtension(absPath);
2254
+ const result = findServerForExtension(ext);
2255
+ if (result.status !== "found") {
2256
+ throw new LspServerLookupError(formatServerLookupError(result));
2257
+ }
2258
+ const server2 = result.server;
2259
+ const root = findWorkspaceRoot(absPath);
2260
+ const manager = options.manager ?? getLspManager();
2261
+ const acquireAndCall = async (allowRetry) => {
2262
+ const client = await manager.getClient(root, server2, options.signal);
53
2263
  try {
54
- const result = await executeLspTool(params["name"], coerceToolArguments(params["arguments"]));
55
- return successResponse(id, {
56
- content: result.content,
57
- isError: result.isError ?? false,
58
- details: result.details,
59
- });
2264
+ return await fn(client, root);
2265
+ } catch (err) {
2266
+ if (allowRetry && READ_ONLY_RETRY_TOOLS.has(toolName) && isLspDeadConnectionError(err)) {
2267
+ manager.invalidateClient(root, server2.id, client);
2268
+ return acquireAndCall(false);
2269
+ }
2270
+ if (err instanceof LspRequestTimeoutError) {
2271
+ if (manager.isServerInitializing(root, server2.id)) {
2272
+ throw new LspServerInitializingError(err);
2273
+ }
2274
+ }
2275
+ throw err;
2276
+ } finally {
2277
+ manager.releaseClient(root, server2.id);
60
2278
  }
61
- catch (error) {
62
- return successResponse(id, {
63
- content: [{ type: "text", text: messageFromError(error) }],
64
- isError: true,
2279
+ };
2280
+ return acquireAndCall(true);
2281
+ }
2282
+
2283
+ // ../lsp-core/src/lsp/directory-diagnostics.ts
2284
+ import { existsSync as existsSync6, lstatSync, readdirSync } from "node:fs";
2285
+ import { join as join6, resolve as resolve3 } from "node:path";
2286
+
2287
+ // ../lsp-core/src/lsp/formatters.ts
2288
+ import { fileURLToPath } from "node:url";
2289
+ var DIAGNOSTIC_SEVERITY_FILTERS = {
2290
+ error: 1,
2291
+ warning: 2,
2292
+ information: 3,
2293
+ hint: 4
2294
+ };
2295
+ function uriToPath(uri) {
2296
+ return fileURLToPath(uri);
2297
+ }
2298
+ function formatLocation(loc) {
2299
+ if ("targetUri" in loc) {
2300
+ const uri2 = uriToPath(loc.targetUri);
2301
+ const line2 = loc.targetRange.start.line + 1;
2302
+ const char2 = loc.targetRange.start.character;
2303
+ return `${uri2}:${line2}:${char2}`;
2304
+ }
2305
+ const uri = uriToPath(loc.uri);
2306
+ const line = loc.range.start.line + 1;
2307
+ const char = loc.range.start.character;
2308
+ return `${uri}:${line}:${char}`;
2309
+ }
2310
+ function formatSymbolKind(kind) {
2311
+ return SYMBOL_KIND_MAP[kind] ?? `Unknown(${kind})`;
2312
+ }
2313
+ function formatSeverity(severity) {
2314
+ if (!severity)
2315
+ return "unknown";
2316
+ return SEVERITY_MAP[severity] ?? `unknown(${severity})`;
2317
+ }
2318
+ function formatDocumentSymbol(symbol, indent = 0) {
2319
+ const prefix = " ".repeat(indent);
2320
+ const kind = formatSymbolKind(symbol.kind);
2321
+ const line = symbol.range.start.line + 1;
2322
+ let result = `${prefix}${symbol.name} (${kind}) - line ${line}`;
2323
+ if (symbol.children && symbol.children.length > 0) {
2324
+ for (const child of symbol.children) {
2325
+ result += `
2326
+ ${formatDocumentSymbol(child, indent + 1)}`;
2327
+ }
2328
+ }
2329
+ return result;
2330
+ }
2331
+ function formatSymbolInfo(symbol) {
2332
+ const kind = formatSymbolKind(symbol.kind);
2333
+ const loc = formatLocation(symbol.location);
2334
+ const container = symbol.containerName ? ` (in ${symbol.containerName})` : "";
2335
+ return `${symbol.name} (${kind})${container} - ${loc}`;
2336
+ }
2337
+ function formatDiagnostic(diag) {
2338
+ const severity = formatSeverity(diag.severity);
2339
+ const line = diag.range.start.line + 1;
2340
+ const char = diag.range.start.character;
2341
+ const source = diag.source ? `[${diag.source}]` : "";
2342
+ const code = diag.code ? ` (${diag.code})` : "";
2343
+ return `${severity}${source}${code} at ${line}:${char}: ${diag.message}`;
2344
+ }
2345
+ function filterDiagnosticsBySeverity(diagnostics, severityFilter) {
2346
+ if (!severityFilter || severityFilter === "all") {
2347
+ return diagnostics;
2348
+ }
2349
+ const targetSeverity = DIAGNOSTIC_SEVERITY_FILTERS[severityFilter];
2350
+ return diagnostics.filter((d) => d.severity === targetSeverity);
2351
+ }
2352
+ function formatPrepareRenameResult(result) {
2353
+ if (!result)
2354
+ return "Cannot rename at this position";
2355
+ if ("defaultBehavior" in result) {
2356
+ return result.defaultBehavior ? "Rename supported (using default behavior)" : "Cannot rename at this position";
2357
+ }
2358
+ if ("range" in result && result.range) {
2359
+ const startLine = result.range.start.line + 1;
2360
+ const startChar = result.range.start.character;
2361
+ const endLine = result.range.end.line + 1;
2362
+ const endChar = result.range.end.character;
2363
+ const placeholder = result.placeholder ? ` (current: "${result.placeholder}")` : "";
2364
+ return `Rename available at ${startLine}:${startChar}-${endLine}:${endChar}${placeholder}`;
2365
+ }
2366
+ if ("start" in result && "end" in result) {
2367
+ const startLine = result.start.line + 1;
2368
+ const startChar = result.start.character;
2369
+ const endLine = result.end.line + 1;
2370
+ const endChar = result.end.character;
2371
+ return `Rename available at ${startLine}:${startChar}-${endLine}:${endChar}`;
2372
+ }
2373
+ return "Cannot rename at this position";
2374
+ }
2375
+ function formatApplyResult(result) {
2376
+ const lines = [];
2377
+ if (result.success) {
2378
+ lines.push(`Applied ${result.totalEdits} edit(s) to ${result.filesModified.length} file(s):`);
2379
+ for (const file of result.filesModified) {
2380
+ lines.push(` - ${file}`);
2381
+ }
2382
+ } else {
2383
+ lines.push("Failed to apply some changes:");
2384
+ for (const err of result.errors) {
2385
+ lines.push(` Error: ${err}`);
2386
+ }
2387
+ if (result.filesModified.length > 0) {
2388
+ lines.push(`Successfully modified: ${result.filesModified.join(", ")}`);
2389
+ }
2390
+ }
2391
+ return lines.join(`
2392
+ `);
2393
+ }
2394
+
2395
+ // ../lsp-core/src/lsp/directory-diagnostics.ts
2396
+ var SKIP_DIRECTORIES = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
2397
+ function collectFilesWithExtension(dir, extension, maxFiles) {
2398
+ const files = [];
2399
+ function walk(currentDir) {
2400
+ if (files.length >= maxFiles)
2401
+ return;
2402
+ let entries = [];
2403
+ try {
2404
+ entries = readdirSync(currentDir);
2405
+ } catch {
2406
+ return;
2407
+ }
2408
+ for (const entry of entries) {
2409
+ if (files.length >= maxFiles)
2410
+ return;
2411
+ const fullPath = join6(currentDir, entry);
2412
+ let stat;
2413
+ try {
2414
+ stat = lstatSync(fullPath);
2415
+ } catch {
2416
+ continue;
2417
+ }
2418
+ if (!stat || stat.isSymbolicLink())
2419
+ continue;
2420
+ if (stat.isDirectory()) {
2421
+ if (!SKIP_DIRECTORIES.has(entry)) {
2422
+ walk(fullPath);
2423
+ }
2424
+ } else if (stat.isFile() && effectiveExtension(fullPath) === extension) {
2425
+ files.push(fullPath);
2426
+ }
2427
+ }
2428
+ }
2429
+ walk(dir);
2430
+ return files;
2431
+ }
2432
+ async function aggregateDiagnosticsForDirectory(directory, extension, severity, maxFiles = DEFAULT_MAX_DIRECTORY_FILES) {
2433
+ if (!extension.startsWith(".")) {
2434
+ throw new LspInvalidPathError(`Extension must start with a dot (e.g., ".ts", not "${extension}"). Use ".${extension}" instead.`);
2435
+ }
2436
+ const absDir = resolve3(contextCwd(), directory);
2437
+ if (!existsSync6(absDir)) {
2438
+ throw new LspInvalidPathError(`Directory does not exist: ${absDir}`);
2439
+ }
2440
+ const serverResult = findServerForExtension(extension);
2441
+ if (serverResult.status !== "found") {
2442
+ throw new LspServerLookupError(formatServerLookupError(serverResult));
2443
+ }
2444
+ const server2 = serverResult.server;
2445
+ const allFiles = collectFilesWithExtension(absDir, extension, maxFiles + 1);
2446
+ const wasCapped = allFiles.length > maxFiles;
2447
+ const filesToProcess = allFiles.slice(0, maxFiles);
2448
+ if (filesToProcess.length === 0) {
2449
+ return [
2450
+ `Directory: ${absDir}`,
2451
+ `Extension: ${extension}`,
2452
+ "Files scanned: 0",
2453
+ `No files found with extension "${extension}".`
2454
+ ].join(`
2455
+ `);
2456
+ }
2457
+ const root = findWorkspaceRoot(absDir);
2458
+ const manager = getLspManager();
2459
+ const allDiagnostics = [];
2460
+ const fileErrors = [];
2461
+ const client = await manager.getClient(root, server2);
2462
+ try {
2463
+ for (const file of filesToProcess) {
2464
+ try {
2465
+ const result = await client.diagnostics(file);
2466
+ const filtered = filterDiagnosticsBySeverity(result.items, severity);
2467
+ allDiagnostics.push(...filtered.map((diagnostic) => ({
2468
+ filePath: file,
2469
+ diagnostic
2470
+ })));
2471
+ } catch (e) {
2472
+ fileErrors.push({
2473
+ file,
2474
+ error: e instanceof Error ? e.message : String(e)
65
2475
  });
2476
+ }
2477
+ }
2478
+ } finally {
2479
+ manager.releaseClient(root, server2.id);
2480
+ }
2481
+ const displayDiagnostics = allDiagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS);
2482
+ const wasDiagCapped = allDiagnostics.length > DEFAULT_MAX_DIAGNOSTICS;
2483
+ const lines = [
2484
+ `Directory: ${absDir}`,
2485
+ `Extension: ${extension}`,
2486
+ `Files scanned: ${filesToProcess.length}${wasCapped ? ` (capped at ${maxFiles})` : ""}`,
2487
+ `Files with errors: ${fileErrors.length}`,
2488
+ `Total diagnostics: ${allDiagnostics.length}`
2489
+ ];
2490
+ if (fileErrors.length > 0) {
2491
+ lines.push("", "File processing errors:");
2492
+ for (const { file, error } of fileErrors) {
2493
+ lines.push(` ${file}: ${error}`);
2494
+ }
2495
+ }
2496
+ if (displayDiagnostics.length > 0) {
2497
+ lines.push("");
2498
+ for (const { filePath, diagnostic } of displayDiagnostics) {
2499
+ lines.push(`${filePath}: ${formatDiagnostic(diagnostic)}`);
66
2500
  }
2501
+ if (wasDiagCapped) {
2502
+ lines.push("", `... (${allDiagnostics.length - DEFAULT_MAX_DIAGNOSTICS} more diagnostics not shown)`);
2503
+ }
2504
+ }
2505
+ return lines.join(`
2506
+ `);
67
2507
  }
68
- function describeTool(tool) {
2508
+
2509
+ // ../lsp-core/src/lsp/infer-extension.ts
2510
+ import { lstatSync as lstatSync2, readdirSync as readdirSync2 } from "node:fs";
2511
+ import { join as join7 } from "node:path";
2512
+ var SKIP_DIRECTORIES2 = new Set(["node_modules", ".git", "dist", "build", ".next", "out"]);
2513
+ var MAX_SCAN_ENTRIES = 500;
2514
+ function inferExtensionFromDirectory(directory) {
2515
+ const extensionCounts = new Map;
2516
+ let scanned = 0;
2517
+ function walk(dir) {
2518
+ if (scanned >= MAX_SCAN_ENTRIES)
2519
+ return;
2520
+ let entries;
2521
+ try {
2522
+ entries = readdirSync2(dir);
2523
+ } catch {
2524
+ return;
2525
+ }
2526
+ for (const entry of entries) {
2527
+ if (scanned >= MAX_SCAN_ENTRIES)
2528
+ return;
2529
+ const fullPath = join7(dir, entry);
2530
+ let stat;
2531
+ try {
2532
+ stat = lstatSync2(fullPath);
2533
+ } catch {
2534
+ continue;
2535
+ }
2536
+ if (stat.isSymbolicLink())
2537
+ continue;
2538
+ scanned++;
2539
+ if (stat.isDirectory()) {
2540
+ if (!SKIP_DIRECTORIES2.has(entry)) {
2541
+ walk(fullPath);
2542
+ }
2543
+ } else if (stat.isFile()) {
2544
+ const ext = effectiveExtension(fullPath);
2545
+ if (ext && ext in EXT_TO_LANG) {
2546
+ extensionCounts.set(ext, (extensionCounts.get(ext) ?? 0) + 1);
2547
+ }
2548
+ }
2549
+ }
2550
+ }
2551
+ walk(directory);
2552
+ if (extensionCounts.size === 0)
2553
+ return null;
2554
+ let maxExt = "";
2555
+ let maxCount = 0;
2556
+ for (const [ext, count] of extensionCounts) {
2557
+ if (count > maxCount) {
2558
+ maxCount = count;
2559
+ maxExt = ext;
2560
+ }
2561
+ }
2562
+ return maxExt || null;
2563
+ }
2564
+
2565
+ // ../lsp-core/src/lsp/utils.ts
2566
+ var RUST_SRC_REPAIR_MESSAGE = [
2567
+ "rust-analyzer exited while loading Rust standard library sources.",
2568
+ "",
2569
+ "Repair rust-src for the active toolchain:",
2570
+ " rustup component remove rust-src",
2571
+ " rustup component add rust-src"
2572
+ ];
2573
+ function errorMessage(error) {
2574
+ return error instanceof Error ? error.message : String(error);
2575
+ }
2576
+ function formatKnownLspStartupFailure(error) {
2577
+ if (!(error instanceof LspProcessExitedError))
2578
+ return null;
2579
+ if (error.serverId !== "rust")
2580
+ return null;
2581
+ const details = error.stderrTail ?? error.message;
2582
+ const lowerDetails = details.toLowerCase();
2583
+ const isRustSrcFailure = lowerDetails.includes("rust-src") && (lowerDetails.includes("failed to install component") || lowerDetails.includes("detected conflict") || lowerDetails.includes("can't load standard library") || lowerDetails.includes("try installing") || lowerDetails.includes("sysroot"));
2584
+ if (!isRustSrcFailure)
2585
+ return null;
2586
+ return [...RUST_SRC_REPAIR_MESSAGE, "", "Original stderr tail:", details].join(`
2587
+ `);
2588
+ }
2589
+ function handleMissingDependencyError(error) {
2590
+ const knownStartupFailure = formatKnownLspStartupFailure(error);
2591
+ if (knownStartupFailure)
2592
+ return knownStartupFailure;
2593
+ const message = errorMessage(error);
2594
+ return message.includes("NOT INSTALLED") || message.includes("No LSP server configured") ? message : null;
2595
+ }
2596
+ // ../lsp-core/src/missing-dependency-result.ts
2597
+ function missingDependencyResult(error, details) {
2598
+ const message = handleMissingDependencyError(error);
2599
+ if (!message)
2600
+ return null;
2601
+ return {
2602
+ content: [{ type: "text", text: message }],
2603
+ details: {
2604
+ ...details,
2605
+ error: message,
2606
+ errorKind: "missing_dependency"
2607
+ }
2608
+ };
2609
+ }
2610
+
2611
+ // ../lsp-core/src/tools/parameters.ts
2612
+ function isRecord4(value) {
2613
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2614
+ }
2615
+ function requireString(params, key) {
2616
+ const value = params[key];
2617
+ if (typeof value !== "string" || value.length === 0) {
2618
+ throw new Error(`Missing required string parameter '${key}'`);
2619
+ }
2620
+ return value;
2621
+ }
2622
+ function optionalString(params, key) {
2623
+ const value = params[key];
2624
+ return typeof value === "string" ? value : undefined;
2625
+ }
2626
+ function requireNumber(params, key) {
2627
+ const value = params[key];
2628
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2629
+ throw new Error(`Missing required number parameter '${key}'`);
2630
+ }
2631
+ return value;
2632
+ }
2633
+ function optionalNumber(params, key) {
2634
+ const value = params[key];
2635
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
2636
+ }
2637
+ function optionalBoolean(params, key) {
2638
+ const value = params[key];
2639
+ return typeof value === "boolean" ? value : undefined;
2640
+ }
2641
+ function severityFilter(params) {
2642
+ const value = params["severity"];
2643
+ if (value === "error" || value === "warning" || value === "information" || value === "hint" || value === "all") {
2644
+ return value;
2645
+ }
2646
+ return "all";
2647
+ }
2648
+ function clientOptions(signal) {
2649
+ return signal === undefined ? {} : { signal };
2650
+ }
2651
+
2652
+ // ../lsp-core/src/tools/result.ts
2653
+ function text(text2, details, isError = false) {
2654
+ return { content: [{ type: "text", text: text2 }], details, isError };
2655
+ }
2656
+
2657
+ // ../lsp-core/src/tools/diagnostics.ts
2658
+ function asDiagnosticArray(result) {
2659
+ if (!result)
2660
+ return [];
2661
+ if (Array.isArray(result))
2662
+ return result;
2663
+ return result.items ?? [];
2664
+ }
2665
+ async function executeLspDiagnostics(params, signal) {
2666
+ const filePath = requireString(params, "filePath");
2667
+ const severity = severityFilter(params);
2668
+ try {
2669
+ const absPath = resolve4(contextCwd(), filePath);
2670
+ if (isDirectoryPath(absPath)) {
2671
+ const extension = inferExtensionFromDirectory(absPath);
2672
+ if (!extension) {
2673
+ const message = `No supported source files found in directory: ${absPath}`;
2674
+ const details3 = {
2675
+ filePath,
2676
+ severity,
2677
+ mode: "directory",
2678
+ diagnostics: [],
2679
+ totalDiagnostics: 0,
2680
+ truncated: false,
2681
+ error: message,
2682
+ errorKind: "no_files"
2683
+ };
2684
+ return text(message, details3);
2685
+ }
2686
+ const output2 = await aggregateDiagnosticsForDirectory(absPath, extension, severity);
2687
+ const details2 = {
2688
+ filePath,
2689
+ severity,
2690
+ mode: "directory",
2691
+ diagnostics: [],
2692
+ totalDiagnostics: 0,
2693
+ truncated: false
2694
+ };
2695
+ return text(output2, details2);
2696
+ }
2697
+ const result = await withLspClient(filePath, async (client) => client.diagnostics(filePath), "diagnostics", clientOptions(signal));
2698
+ const diagnostics = filterDiagnosticsBySeverity(asDiagnosticArray(result), severity);
2699
+ const total = diagnostics.length;
2700
+ const truncated = total > DEFAULT_MAX_DIAGNOSTICS;
2701
+ const limited = truncated ? diagnostics.slice(0, DEFAULT_MAX_DIAGNOSTICS) : diagnostics;
2702
+ const output = total === 0 ? "No diagnostics found" : [
2703
+ ...truncated ? [`Found ${total} diagnostics (showing first ${DEFAULT_MAX_DIAGNOSTICS}):`] : [],
2704
+ ...limited.map(formatDiagnostic)
2705
+ ].join(`
2706
+ `);
2707
+ const details = {
2708
+ filePath,
2709
+ severity,
2710
+ mode: "file",
2711
+ diagnostics: diagnostics.map((diagnostic) => ({ file: absPath, diagnostic })),
2712
+ totalDiagnostics: total,
2713
+ truncated
2714
+ };
2715
+ return text(output, details);
2716
+ } catch (error) {
2717
+ const missingDependency = missingDependencyResult(error, {
2718
+ filePath,
2719
+ severity,
2720
+ mode: "file",
2721
+ diagnostics: [],
2722
+ totalDiagnostics: 0,
2723
+ truncated: false
2724
+ });
2725
+ if (missingDependency)
2726
+ return missingDependency;
2727
+ throw error;
2728
+ }
2729
+ }
2730
+ // ../lsp-core/src/tools/install-decision.ts
2731
+ async function executeLspInstallDecision(params) {
2732
+ const serverId = requireString(params, "server_id");
2733
+ const decision = params["decision"];
2734
+ if (!isInstallDecision(decision)) {
2735
+ return text(`Invalid decision '${String(decision)}'. Expected "declined" or "allowed".`, { serverId, errorKind: "invalid_decision" }, true);
2736
+ }
2737
+ const serverIds = [...new Set(getMergedServers().map((server2) => server2.id))];
2738
+ if (!serverIds.includes(serverId)) {
2739
+ const preview = serverIds.slice(0, 20).join(", ");
2740
+ return text(`Unknown LSP server '${serverId}'. Known servers: ${preview}${serverIds.length > 20 ? "..." : ""}`, { serverId, errorKind: "unknown_server" }, true);
2741
+ }
2742
+ recordInstallDecision(serverId, decision);
2743
+ return text(`Recorded install decision for '${serverId}': ${decision}. ${decisionFollowUp(decision)}`, {
2744
+ serverId,
2745
+ decision
2746
+ });
2747
+ }
2748
+ function decisionFollowUp(decision) {
2749
+ return decision === "declined" ? "Future LSP lookups for this server stay quiet; proceed without LSP." : "Future LSP lookups keep install instructions without asking the user.";
2750
+ }
2751
+
2752
+ // ../lsp-core/src/tools/navigation.ts
2753
+ async function executeLspGotoDefinition(params, signal) {
2754
+ const filePath = requireString(params, "filePath");
2755
+ const line = requireNumber(params, "line");
2756
+ const character = requireNumber(params, "character");
2757
+ try {
2758
+ const result = await withLspClient(filePath, async (client) => client.definition(filePath, line, character), "definition", clientOptions(signal));
2759
+ const locations = !result ? [] : Array.isArray(result) ? result : [result];
2760
+ const details = { filePath, line, character, locations };
2761
+ if (locations.length === 0)
2762
+ return text("No definition found", details);
2763
+ return text(locations.map(formatLocation).join(`
2764
+ `), details);
2765
+ } catch (error) {
2766
+ const missingDependency = missingDependencyResult(error, {
2767
+ filePath,
2768
+ line,
2769
+ character,
2770
+ locations: []
2771
+ });
2772
+ if (missingDependency)
2773
+ return missingDependency;
2774
+ throw error;
2775
+ }
2776
+ }
2777
+ async function executeLspFindReferences(params, signal) {
2778
+ const filePath = requireString(params, "filePath");
2779
+ const line = requireNumber(params, "line");
2780
+ const character = requireNumber(params, "character");
2781
+ const includeDeclaration = optionalBoolean(params, "includeDeclaration") ?? true;
2782
+ try {
2783
+ const result = await withLspClient(filePath, async (client) => client.references(filePath, line, character, includeDeclaration), "references", clientOptions(signal));
2784
+ const references = Array.isArray(result) ? result : [];
2785
+ const total = references.length;
2786
+ const truncated = total > DEFAULT_MAX_REFERENCES;
2787
+ const limited = truncated ? references.slice(0, DEFAULT_MAX_REFERENCES) : references;
2788
+ const details = {
2789
+ filePath,
2790
+ line,
2791
+ character,
2792
+ references,
2793
+ totalReferences: total,
2794
+ truncated
2795
+ };
2796
+ if (total === 0)
2797
+ return text("No references found", details);
2798
+ const output = [
2799
+ ...truncated ? [`Found ${total} references (showing first ${DEFAULT_MAX_REFERENCES}):`] : [],
2800
+ ...limited.map(formatLocation)
2801
+ ].join(`
2802
+ `);
2803
+ return text(output, details);
2804
+ } catch (error) {
2805
+ const missingDependency = missingDependencyResult(error, {
2806
+ filePath,
2807
+ line,
2808
+ character,
2809
+ references: [],
2810
+ totalReferences: 0,
2811
+ truncated: false
2812
+ });
2813
+ if (missingDependency)
2814
+ return missingDependency;
2815
+ throw error;
2816
+ }
2817
+ }
2818
+
2819
+ // ../lsp-core/src/lsp/workspace-edit.ts
2820
+ import { existsSync as existsSync7, readFileSync as readFileSync4, realpathSync, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
2821
+ import { dirname as dirname3, isAbsolute as isAbsolute3, relative, resolve as resolve5 } from "node:path";
2822
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
2823
+ function errorMessage2(error) {
2824
+ return error instanceof Error ? error.message : String(error);
2825
+ }
2826
+ function isPathInsideWorkspace(filePath, workspaceRoot) {
2827
+ const relativePath = relative(workspaceRoot, filePath);
2828
+ return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute3(relativePath);
2829
+ }
2830
+ function realpathForValidation(filePath) {
2831
+ if (existsSync7(filePath))
2832
+ return realpathSync(filePath);
2833
+ const parent = dirname3(filePath);
2834
+ return resolve5(realpathSync(parent), relative(parent, filePath));
2835
+ }
2836
+ function uriToWorkspacePath(uri, workspaceRoot) {
2837
+ let filePath;
2838
+ try {
2839
+ filePath = fileURLToPath2(uri);
2840
+ } catch (error) {
2841
+ return { success: false, error: `non-file URI ${uri}: ${errorMessage2(error)}` };
2842
+ }
2843
+ let validatedPath;
2844
+ try {
2845
+ validatedPath = realpathForValidation(filePath);
2846
+ } catch (error) {
2847
+ return { success: false, error: `${filePath}: ${errorMessage2(error)}` };
2848
+ }
2849
+ if (!isPathInsideWorkspace(validatedPath, workspaceRoot)) {
2850
+ return { success: false, error: `${filePath}: outside workspace ${workspaceRoot}` };
2851
+ }
2852
+ return { success: true, path: filePath };
2853
+ }
2854
+ function applyTextEditsToFile(filePath, edits) {
2855
+ try {
2856
+ const content = readFileSync4(filePath, "utf-8");
2857
+ const lines = content.split(`
2858
+ `);
2859
+ const sortedEdits = [...edits].sort((a, b) => {
2860
+ if (b.range.start.line !== a.range.start.line) {
2861
+ return b.range.start.line - a.range.start.line;
2862
+ }
2863
+ return b.range.start.character - a.range.start.character;
2864
+ });
2865
+ for (const edit of sortedEdits) {
2866
+ const startLine = edit.range.start.line;
2867
+ const startChar = edit.range.start.character;
2868
+ const endLine = edit.range.end.line;
2869
+ const endChar = edit.range.end.character;
2870
+ if (startLine === endLine) {
2871
+ const line = lines[startLine] ?? "";
2872
+ lines[startLine] = line.substring(0, startChar) + edit.newText + line.substring(endChar);
2873
+ } else {
2874
+ const firstLine = lines[startLine] ?? "";
2875
+ const lastLine = lines[endLine] ?? "";
2876
+ const newContent = firstLine.substring(0, startChar) + edit.newText + lastLine.substring(endChar);
2877
+ lines.splice(startLine, endLine - startLine + 1, ...newContent.split(`
2878
+ `));
2879
+ }
2880
+ }
2881
+ writeFileSync2(filePath, lines.join(`
2882
+ `), "utf-8");
2883
+ return { success: true, editCount: edits.length };
2884
+ } catch (err) {
69
2885
  return {
70
- name: tool.name,
71
- title: tool.title,
72
- description: tool.description,
73
- inputSchema: tool.inputSchema,
2886
+ success: false,
2887
+ editCount: 0,
2888
+ error: err instanceof Error ? err.message : String(err)
74
2889
  };
2890
+ }
75
2891
  }
76
- function successResponse(id, result) {
77
- return { jsonrpc: "2.0", id, result };
2892
+ function applyWorkspaceEdit(edit, options = {}) {
2893
+ if (!edit) {
2894
+ return { success: false, filesModified: [], totalEdits: 0, errors: ["No edit provided"] };
2895
+ }
2896
+ const result = { success: true, filesModified: [], totalEdits: 0, errors: [] };
2897
+ const workspaceRoot = realpathSync(options.workspaceRoot ?? contextCwd());
2898
+ if (edit.changes) {
2899
+ for (const [uri, edits] of Object.entries(edit.changes)) {
2900
+ const validatedPath = uriToWorkspacePath(uri, workspaceRoot);
2901
+ if (!validatedPath.success) {
2902
+ result.success = false;
2903
+ result.errors.push(validatedPath.error);
2904
+ continue;
2905
+ }
2906
+ const applyResult = applyTextEditsToFile(validatedPath.path, edits);
2907
+ if (applyResult.success) {
2908
+ result.filesModified.push(validatedPath.path);
2909
+ result.totalEdits += applyResult.editCount;
2910
+ } else {
2911
+ result.success = false;
2912
+ result.errors.push(`${validatedPath.path}: ${applyResult.error}`);
2913
+ }
2914
+ }
2915
+ }
2916
+ if (edit.documentChanges) {
2917
+ for (const change of edit.documentChanges) {
2918
+ if (!("kind" in change)) {
2919
+ const validatedPath = uriToWorkspacePath(change.textDocument.uri, workspaceRoot);
2920
+ if (!validatedPath.success) {
2921
+ result.success = false;
2922
+ result.errors.push(validatedPath.error);
2923
+ continue;
2924
+ }
2925
+ const applyResult = applyTextEditsToFile(validatedPath.path, change.edits);
2926
+ if (applyResult.success) {
2927
+ result.filesModified.push(validatedPath.path);
2928
+ result.totalEdits += applyResult.editCount;
2929
+ } else {
2930
+ result.success = false;
2931
+ result.errors.push(`${validatedPath.path}: ${applyResult.error}`);
2932
+ }
2933
+ continue;
2934
+ }
2935
+ if (change.kind === "create") {
2936
+ try {
2937
+ const validatedPath = uriToWorkspacePath(change.uri, workspaceRoot);
2938
+ if (!validatedPath.success) {
2939
+ result.success = false;
2940
+ result.errors.push(`Create ${change.uri}: ${validatedPath.error}`);
2941
+ continue;
2942
+ }
2943
+ writeFileSync2(validatedPath.path, "", "utf-8");
2944
+ result.filesModified.push(validatedPath.path);
2945
+ } catch (err) {
2946
+ result.success = false;
2947
+ result.errors.push(`Create ${change.uri}: ${String(err)}`);
2948
+ }
2949
+ } else if (change.kind === "rename") {
2950
+ try {
2951
+ const oldPath = uriToWorkspacePath(change.oldUri, workspaceRoot);
2952
+ const newPath = uriToWorkspacePath(change.newUri, workspaceRoot);
2953
+ if (!oldPath.success || !newPath.success) {
2954
+ const error = oldPath.success ? newPath.success ? "invalid URI" : newPath.error : oldPath.error;
2955
+ result.success = false;
2956
+ result.errors.push(`Rename ${change.oldUri}: ${error}`);
2957
+ continue;
2958
+ }
2959
+ const content = readFileSync4(oldPath.path, "utf-8");
2960
+ writeFileSync2(newPath.path, content, "utf-8");
2961
+ unlinkSync(oldPath.path);
2962
+ result.filesModified.push(newPath.path);
2963
+ } catch (err) {
2964
+ result.success = false;
2965
+ result.errors.push(`Rename ${change.oldUri}: ${String(err)}`);
2966
+ }
2967
+ } else if (change.kind === "delete") {
2968
+ try {
2969
+ const validatedPath = uriToWorkspacePath(change.uri, workspaceRoot);
2970
+ if (!validatedPath.success) {
2971
+ result.success = false;
2972
+ result.errors.push(`Delete ${change.uri}: ${validatedPath.error}`);
2973
+ continue;
2974
+ }
2975
+ unlinkSync(validatedPath.path);
2976
+ result.filesModified.push(validatedPath.path);
2977
+ } catch (err) {
2978
+ result.success = false;
2979
+ result.errors.push(`Delete ${change.uri}: ${String(err)}`);
2980
+ }
2981
+ }
2982
+ }
2983
+ }
2984
+ return result;
78
2985
  }
79
- function errorResponse(id, code, message, data) {
80
- return { jsonrpc: "2.0", id, error: data === undefined ? { code, message } : { code, message, data } };
2986
+
2987
+ // ../lsp-core/src/tools/rename.ts
2988
+ async function executeLspPrepareRename(params, signal) {
2989
+ const filePath = requireString(params, "filePath");
2990
+ const line = requireNumber(params, "line");
2991
+ const character = requireNumber(params, "character");
2992
+ try {
2993
+ const result = await withLspClient(filePath, async (client) => client.prepareRename(filePath, line, character), "prepareRename", clientOptions(signal));
2994
+ const details = { filePath, line, character, result };
2995
+ return text(formatPrepareRenameResult(result), details);
2996
+ } catch (error) {
2997
+ const missingDependency = missingDependencyResult(error, {
2998
+ filePath,
2999
+ line,
3000
+ character,
3001
+ result: null
3002
+ });
3003
+ if (missingDependency)
3004
+ return missingDependency;
3005
+ throw error;
3006
+ }
81
3007
  }
82
- function requestedProtocolVersion(params) {
83
- if (!isRecord(params) || typeof params["protocolVersion"] !== "string")
84
- return "2024-11-05";
85
- return params["protocolVersion"];
3008
+ async function executeLspRename(params, signal) {
3009
+ const filePath = requireString(params, "filePath");
3010
+ const line = requireNumber(params, "line");
3011
+ const character = requireNumber(params, "character");
3012
+ const newName = requireString(params, "newName");
3013
+ try {
3014
+ const edit = await withLspClient(filePath, async (client, workspaceRoot) => ({
3015
+ edit: await client.rename(filePath, line, character, newName),
3016
+ workspaceRoot
3017
+ }), "rename", clientOptions(signal));
3018
+ const apply = applyWorkspaceEdit(edit.edit, { workspaceRoot: edit.workspaceRoot });
3019
+ const details = { filePath, line, character, newName, apply, edit: edit.edit };
3020
+ return text(formatApplyResult(apply), details, !apply.success);
3021
+ } catch (error) {
3022
+ const missingDependency = missingDependencyResult(error, {
3023
+ filePath,
3024
+ line,
3025
+ character,
3026
+ newName,
3027
+ apply: null,
3028
+ edit: null
3029
+ });
3030
+ if (missingDependency)
3031
+ return missingDependency;
3032
+ throw error;
3033
+ }
86
3034
  }
87
- function jsonRpcId(value) {
88
- return typeof value === "string" || typeof value === "number" || value === null ? value : null;
3035
+
3036
+ // ../lsp-core/src/tools/schema.ts
3037
+ function objectSchema(properties, required = []) {
3038
+ return {
3039
+ type: "object",
3040
+ properties,
3041
+ required
3042
+ };
89
3043
  }
90
- function isRecord(value) {
91
- return typeof value === "object" && value !== null && !Array.isArray(value);
3044
+
3045
+ // ../lsp-core/src/tools/status.ts
3046
+ async function executeLspStatus() {
3047
+ const servers = getAllServers();
3048
+ const snapshots = getLspManager().getSnapshot();
3049
+ const installed = servers.filter((server2) => server2.installed && !server2.disabled);
3050
+ const configuredLines = servers.map((server2) => {
3051
+ const state = server2.disabled ? "disabled" : server2.installed ? "installed" : "missing";
3052
+ return `- ${server2.id}: ${state}; source=${server2.source}; extensions=${server2.extensions.join(", ")}`;
3053
+ });
3054
+ const activeLines = snapshots.map((snapshot) => {
3055
+ const state = snapshot.alive ? snapshot.isInitializing ? "initializing" : "alive" : "dead";
3056
+ return `- ${snapshot.serverId}: ${state}; root=${snapshot.root}; refs=${snapshot.refCount}`;
3057
+ });
3058
+ const lines = [
3059
+ `Configured LSP servers: ${servers.length}`,
3060
+ `Installed LSP servers: ${installed.length}`,
3061
+ "",
3062
+ ...configuredLines,
3063
+ "",
3064
+ `Active LSP clients: ${snapshots.length}`,
3065
+ ...activeLines
3066
+ ];
3067
+ return text(lines.join(`
3068
+ `), { servers, snapshots });
92
3069
  }
93
- function messageFromError(error) {
94
- return error instanceof Error ? error.message : String(error);
3070
+
3071
+ // ../lsp-core/src/tools/symbols.ts
3072
+ function isDocumentSymbol(symbol) {
3073
+ return "range" in symbol;
3074
+ }
3075
+ async function executeLspSymbols(params, signal) {
3076
+ const filePath = requireString(params, "filePath");
3077
+ const rawScope = optionalString(params, "scope") ?? "document";
3078
+ const scope = rawScope === "workspace" ? "workspace" : "document";
3079
+ const limit = Math.min(optionalNumber(params, "limit") ?? DEFAULT_MAX_SYMBOLS, DEFAULT_MAX_SYMBOLS);
3080
+ try {
3081
+ if (scope === "workspace") {
3082
+ const query = optionalString(params, "query");
3083
+ if (!query) {
3084
+ const message = "Error: 'query' is required for workspace scope";
3085
+ return text(message, {
3086
+ filePath,
3087
+ scope,
3088
+ symbols: [],
3089
+ totalSymbols: 0,
3090
+ truncated: false,
3091
+ error: message,
3092
+ errorKind: "missing_query"
3093
+ });
3094
+ }
3095
+ const symbols2 = await withLspClient(filePath, async (client) => client.workspaceSymbols(query), "workspaceSymbols", clientOptions(signal));
3096
+ return formatSymbolsResult(filePath, scope, symbols2, limit, query);
3097
+ }
3098
+ const symbols = await withLspClient(filePath, async (client) => client.documentSymbols(filePath), "documentSymbols", clientOptions(signal));
3099
+ return formatSymbolsResult(filePath, scope, symbols, limit);
3100
+ } catch (error) {
3101
+ const query = optionalString(params, "query");
3102
+ const missingDependency = missingDependencyResult(error, {
3103
+ filePath,
3104
+ scope,
3105
+ symbols: [],
3106
+ totalSymbols: 0,
3107
+ truncated: false,
3108
+ ...query === undefined ? {} : { query }
3109
+ });
3110
+ if (missingDependency)
3111
+ return missingDependency;
3112
+ throw error;
3113
+ }
3114
+ }
3115
+ function formatSymbolsResult(filePath, scope, symbols, limit, query) {
3116
+ const total = symbols.length;
3117
+ const truncated = total > limit;
3118
+ const limited = truncated ? symbols.slice(0, limit) : symbols;
3119
+ const details = {
3120
+ filePath,
3121
+ scope,
3122
+ symbols,
3123
+ totalSymbols: total,
3124
+ truncated,
3125
+ ...query === undefined ? {} : { query }
3126
+ };
3127
+ if (total === 0)
3128
+ return text("No symbols found", details);
3129
+ const lines = [];
3130
+ if (truncated)
3131
+ lines.push(`Found ${total} symbols (showing first ${limit}):`);
3132
+ const documentSymbols = limited.filter(isDocumentSymbol);
3133
+ if (documentSymbols.length === limited.length) {
3134
+ lines.push(...documentSymbols.map((symbol) => formatDocumentSymbol(symbol)));
3135
+ } else {
3136
+ lines.push(...limited.filter((symbol) => !isDocumentSymbol(symbol)).map(formatSymbolInfo));
3137
+ }
3138
+ return text(lines.join(`
3139
+ `), details);
3140
+ }
3141
+
3142
+ // ../lsp-core/src/tools/definitions.ts
3143
+ var LSP_MCP_TOOLS = [
3144
+ {
3145
+ name: "status",
3146
+ aliases: ["lsp_status"],
3147
+ title: "LSP Status",
3148
+ description: "List configured and active LSP servers without starting a new language server.",
3149
+ inputSchema: objectSchema({}),
3150
+ execute: executeLspStatus
3151
+ },
3152
+ {
3153
+ name: "diagnostics",
3154
+ aliases: ["lsp_diagnostics"],
3155
+ title: "LSP Diagnostics",
3156
+ description: "Get errors, warnings, and hints for a source file or directory.",
3157
+ inputSchema: objectSchema({
3158
+ filePath: { type: "string", description: "File or directory path to check." },
3159
+ severity: {
3160
+ type: "string",
3161
+ enum: ["error", "warning", "information", "hint", "all"],
3162
+ description: "Severity filter. Defaults to all."
3163
+ }
3164
+ }, ["filePath"]),
3165
+ execute: executeLspDiagnostics
3166
+ },
3167
+ {
3168
+ name: "goto_definition",
3169
+ aliases: ["lsp_goto_definition"],
3170
+ title: "LSP Goto Definition",
3171
+ description: "Find where a symbol is defined.",
3172
+ inputSchema: objectSchema({
3173
+ filePath: { type: "string", description: "Source file containing the symbol." },
3174
+ line: { type: "number", description: "1-based line number." },
3175
+ character: { type: "number", description: "0-based column." }
3176
+ }, ["filePath", "line", "character"]),
3177
+ execute: executeLspGotoDefinition
3178
+ },
3179
+ {
3180
+ name: "find_references",
3181
+ aliases: ["lsp_find_references"],
3182
+ title: "LSP Find References",
3183
+ description: "Find references of a symbol across the workspace.",
3184
+ inputSchema: objectSchema({
3185
+ filePath: { type: "string", description: "Source file containing the symbol." },
3186
+ line: { type: "number", description: "1-based line number." },
3187
+ character: { type: "number", description: "0-based column." },
3188
+ includeDeclaration: { type: "boolean", description: "Include the declaration. Defaults to true." }
3189
+ }, ["filePath", "line", "character"]),
3190
+ execute: executeLspFindReferences
3191
+ },
3192
+ {
3193
+ name: "symbols",
3194
+ aliases: ["lsp_symbols"],
3195
+ title: "LSP Symbols",
3196
+ description: "List document symbols or search workspace symbols.",
3197
+ inputSchema: objectSchema({
3198
+ filePath: { type: "string", description: "File path used as LSP context." },
3199
+ scope: {
3200
+ type: "string",
3201
+ enum: ["document", "workspace"],
3202
+ description: "Use document for file outline or workspace for project-wide search."
3203
+ },
3204
+ query: { type: "string", description: "Workspace symbol query." },
3205
+ limit: { type: "number", description: "Maximum number of symbols to return." }
3206
+ }, ["filePath", "scope"]),
3207
+ execute: executeLspSymbols
3208
+ },
3209
+ {
3210
+ name: "prepare_rename",
3211
+ aliases: ["lsp_prepare_rename"],
3212
+ title: "LSP Prepare Rename",
3213
+ description: "Check whether a symbol can be renamed at a position.",
3214
+ inputSchema: objectSchema({
3215
+ filePath: { type: "string", description: "Source file path." },
3216
+ line: { type: "number", description: "1-based line number." },
3217
+ character: { type: "number", description: "0-based column." }
3218
+ }, ["filePath", "line", "character"]),
3219
+ execute: executeLspPrepareRename
3220
+ },
3221
+ {
3222
+ name: "rename",
3223
+ aliases: ["lsp_rename"],
3224
+ title: "LSP Rename",
3225
+ description: "Rename a symbol across the workspace and apply the returned workspace edit.",
3226
+ inputSchema: objectSchema({
3227
+ filePath: { type: "string", description: "Source file path." },
3228
+ line: { type: "number", description: "1-based line number." },
3229
+ character: { type: "number", description: "0-based column." },
3230
+ newName: { type: "string", description: "New symbol name." }
3231
+ }, ["filePath", "line", "character", "newName"]),
3232
+ execute: executeLspRename
3233
+ },
3234
+ {
3235
+ name: "install_decision",
3236
+ aliases: ["lsp_install_decision"],
3237
+ title: "LSP Install Decision",
3238
+ description: "Record whether the user allowed or declined installing a missing LSP server. Record 'declined' when the user declines, or has not explicitly asked for LSP installation, to silence future prompts.",
3239
+ inputSchema: objectSchema({
3240
+ server_id: {
3241
+ type: "string",
3242
+ description: "The LSP server id from the not-installed message (e.g. 'rust')."
3243
+ },
3244
+ decision: {
3245
+ type: "string",
3246
+ enum: ["declined", "allowed"],
3247
+ description: "'declined' silences future prompts; 'allowed' pre-authorizes installation."
3248
+ }
3249
+ }, ["server_id", "decision"]),
3250
+ execute: executeLspInstallDecision
3251
+ }
3252
+ ];
3253
+ // ../lsp-core/src/tools/runtime.ts
3254
+ async function executeLspTool(name, params, signal) {
3255
+ const tool = LSP_MCP_TOOLS.find((candidate) => matchesToolName(candidate, name));
3256
+ if (!tool)
3257
+ throw new Error(`Unknown LSP tool: ${name}`);
3258
+ return tool.execute(params, signal);
3259
+ }
3260
+ function matchesToolName(tool, name) {
3261
+ return tool.name === name || (tool.aliases?.includes(name) ?? false);
3262
+ }
3263
+ function coerceToolArguments(value) {
3264
+ return isRecord4(value) ? value : {};
3265
+ }
3266
+ // ../lsp-core/src/mcp.ts
3267
+ var SERVER_NAME = "lsp";
3268
+ var SERVER_VERSION = "0.1.0";
3269
+ async function handleLspMcpRequest(input) {
3270
+ if (!isPlainRecord(input)) {
3271
+ return errorResponse(null, -32600, "Invalid Request");
3272
+ }
3273
+ const id = jsonRpcId(input["id"]);
3274
+ const method = input["method"];
3275
+ if (method === "notifications/initialized")
3276
+ return;
3277
+ if (method === "ping")
3278
+ return successResponse(id, {});
3279
+ if (method === "initialize") {
3280
+ const protocolVersion = requestedProtocolVersion(input["params"]);
3281
+ return successResponse(id, {
3282
+ capabilities: { tools: { listChanged: false } },
3283
+ serverInfo: { name: SERVER_NAME, version: SERVER_VERSION },
3284
+ protocolVersion
3285
+ });
3286
+ }
3287
+ if (method === "tools/list") {
3288
+ return successResponse(id, { tools: LSP_MCP_TOOLS.map(describeTool) });
3289
+ }
3290
+ if (method === "tools/call") {
3291
+ return handleToolCall(id, input["params"]);
3292
+ }
3293
+ return errorResponse(id, -32601, `Method not found: ${String(method)}`);
3294
+ }
3295
+ async function runMcpStdioServer(input = process.stdin, output = process.stdout) {
3296
+ await runJsonRpcStdioServer({
3297
+ input,
3298
+ output,
3299
+ handler: handleLspMcpRequest,
3300
+ handlerOptions: undefined
3301
+ });
3302
+ }
3303
+ async function handleToolCall(id, params) {
3304
+ if (!isPlainRecord(params) || typeof params["name"] !== "string") {
3305
+ return errorResponse(id, -32602, "tools/call requires params.name");
3306
+ }
3307
+ try {
3308
+ const result = await executeLspTool(params["name"], coerceToolArguments(params["arguments"]));
3309
+ return successResponse(id, {
3310
+ content: result.content,
3311
+ isError: result.isError ?? false,
3312
+ details: result.details
3313
+ });
3314
+ } catch (error) {
3315
+ return successResponse(id, {
3316
+ content: [{ type: "text", text: messageFromError(error) }],
3317
+ isError: true
3318
+ });
3319
+ }
3320
+ }
3321
+ function describeTool(tool) {
3322
+ return {
3323
+ name: tool.name,
3324
+ title: tool.title,
3325
+ description: tool.description,
3326
+ inputSchema: tool.inputSchema
3327
+ };
3328
+ }
3329
+ function requestedProtocolVersion(params) {
3330
+ if (!isPlainRecord(params) || typeof params["protocolVersion"] !== "string")
3331
+ return "2024-11-05";
3332
+ return params["protocolVersion"];
95
3333
  }
3334
+ export {
3335
+ runMcpStdioServer,
3336
+ handleLspMcpRequest
3337
+ };