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