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