@greppleai/grip 0.1.5 → 0.1.6

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 (565) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/cli.js.map +1 -1
  5. package/dist/bun/embedded-assets.d.ts.map +1 -1
  6. package/dist/bun/embedded-assets.js.map +1 -1
  7. package/dist/bun/register-bedrock.d.ts.map +1 -1
  8. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  9. package/dist/bun/restore-sandbox-env.js.map +1 -1
  10. package/dist/cli/args.d.ts.map +1 -1
  11. package/dist/cli/args.js.map +1 -1
  12. package/dist/cli/config-selector.d.ts.map +1 -1
  13. package/dist/cli/config-selector.js.map +1 -1
  14. package/dist/cli/file-processor.d.ts.map +1 -1
  15. package/dist/cli/file-processor.js.map +1 -1
  16. package/dist/cli/initial-message.d.ts +1 -1
  17. package/dist/cli/initial-message.d.ts.map +1 -1
  18. package/dist/cli/initial-message.js.map +1 -1
  19. package/dist/cli/list-models.d.ts.map +1 -1
  20. package/dist/cli/list-models.js.map +1 -1
  21. package/dist/cli/session-picker.d.ts.map +1 -1
  22. package/dist/cli/session-picker.js.map +1 -1
  23. package/dist/cli.d.ts.map +1 -1
  24. package/dist/cli.js.map +1 -1
  25. package/dist/config.d.ts.map +1 -1
  26. package/dist/config.js.map +1 -1
  27. package/dist/core/agent-session.d.ts +27 -0
  28. package/dist/core/agent-session.d.ts.map +1 -1
  29. package/dist/core/agent-session.js +117 -152
  30. package/dist/core/agent-session.js.map +1 -1
  31. package/dist/core/auth-guidance.d.ts.map +1 -1
  32. package/dist/core/auth-guidance.js.map +1 -1
  33. package/dist/core/auth-storage.d.ts +4 -0
  34. package/dist/core/auth-storage.d.ts.map +1 -1
  35. package/dist/core/auth-storage.js +3 -10
  36. package/dist/core/auth-storage.js.map +1 -1
  37. package/dist/core/bash-executor.d.ts.map +1 -1
  38. package/dist/core/bash-executor.js +19 -23
  39. package/dist/core/bash-executor.js.map +1 -1
  40. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  41. package/dist/core/compaction/branch-summarization.js.map +1 -1
  42. package/dist/core/compaction/compaction.d.ts.map +1 -1
  43. package/dist/core/compaction/compaction.js.map +1 -1
  44. package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -1
  45. package/dist/core/compaction/compression-detection-ledger.js.map +1 -1
  46. package/dist/core/compaction/compression-detector.d.ts +1 -0
  47. package/dist/core/compaction/compression-detector.d.ts.map +1 -1
  48. package/dist/core/compaction/compression-detector.js +10 -21
  49. package/dist/core/compaction/compression-detector.js.map +1 -1
  50. package/dist/core/compaction/compression-economics.d.ts.map +1 -1
  51. package/dist/core/compaction/compression-economics.js.map +1 -1
  52. package/dist/core/compaction/utils.d.ts.map +1 -1
  53. package/dist/core/compaction/utils.js.map +1 -1
  54. package/dist/core/defaults.d.ts.map +1 -1
  55. package/dist/core/diagnostics.d.ts.map +1 -1
  56. package/dist/core/event-bus.d.ts.map +1 -1
  57. package/dist/core/event-bus.js.map +1 -1
  58. package/dist/core/exec.d.ts.map +1 -1
  59. package/dist/core/exec.js.map +1 -1
  60. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  61. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  62. package/dist/core/export-html/index.d.ts.map +1 -1
  63. package/dist/core/export-html/index.js.map +1 -1
  64. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  65. package/dist/core/export-html/tool-renderer.js.map +1 -1
  66. package/dist/core/extensions/loader.d.ts.map +1 -1
  67. package/dist/core/extensions/loader.js.map +1 -1
  68. package/dist/core/extensions/runner.d.ts.map +1 -1
  69. package/dist/core/extensions/runner.js +18 -30
  70. package/dist/core/extensions/runner.js.map +1 -1
  71. package/dist/core/extensions/types.d.ts.map +1 -1
  72. package/dist/core/extensions/types.js.map +1 -1
  73. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  74. package/dist/core/extensions/wrapper.js.map +1 -1
  75. package/dist/core/footer-data-provider.d.ts.map +1 -1
  76. package/dist/core/footer-data-provider.js +15 -16
  77. package/dist/core/footer-data-provider.js.map +1 -1
  78. package/dist/core/grip-agent.d.ts.map +1 -1
  79. package/dist/core/grip-agent.js +7 -21
  80. package/dist/core/grip-agent.js.map +1 -1
  81. package/dist/core/grip-manifest.d.ts.map +1 -1
  82. package/dist/core/grip-manifest.js.map +1 -1
  83. package/dist/core/hooks/aggregate.d.ts.map +1 -1
  84. package/dist/core/hooks/aggregate.js.map +1 -1
  85. package/dist/core/hooks/config.d.ts.map +1 -1
  86. package/dist/core/hooks/config.js.map +1 -1
  87. package/dist/core/hooks/executor.d.ts.map +1 -1
  88. package/dist/core/hooks/executor.js.map +1 -1
  89. package/dist/core/hooks/index.d.ts.map +1 -1
  90. package/dist/core/hooks/index.js.map +1 -1
  91. package/dist/core/hooks/matcher.d.ts.map +1 -1
  92. package/dist/core/hooks/matcher.js.map +1 -1
  93. package/dist/core/hooks/trust-store.d.ts.map +1 -1
  94. package/dist/core/hooks/trust-store.js +0 -3
  95. package/dist/core/hooks/trust-store.js.map +1 -1
  96. package/dist/core/hooks/types.d.ts.map +1 -1
  97. package/dist/core/hooks/types.js.map +1 -1
  98. package/dist/core/http-dispatcher.d.ts.map +1 -1
  99. package/dist/core/http-dispatcher.js.map +1 -1
  100. package/dist/core/instruction-resource-loader.d.ts.map +1 -1
  101. package/dist/core/instruction-resource-loader.js +0 -3
  102. package/dist/core/instruction-resource-loader.js.map +1 -1
  103. package/dist/core/keybindings.d.ts.map +1 -1
  104. package/dist/core/keybindings.js +0 -1
  105. package/dist/core/keybindings.js.map +1 -1
  106. package/dist/core/lsp/abort.d.ts.map +1 -1
  107. package/dist/core/lsp/abort.js.map +1 -1
  108. package/dist/core/lsp/client.d.ts.map +1 -1
  109. package/dist/core/lsp/client.js +8 -22
  110. package/dist/core/lsp/client.js.map +1 -1
  111. package/dist/core/lsp/config-loader.d.ts.map +1 -1
  112. package/dist/core/lsp/config-loader.js.map +1 -1
  113. package/dist/core/lsp/config.d.ts.map +1 -1
  114. package/dist/core/lsp/config.js.map +1 -1
  115. package/dist/core/lsp/diagnostics.d.ts.map +1 -1
  116. package/dist/core/lsp/diagnostics.js.map +1 -1
  117. package/dist/core/lsp/file-sync.d.ts.map +1 -1
  118. package/dist/core/lsp/file-sync.js +7 -9
  119. package/dist/core/lsp/file-sync.js.map +1 -1
  120. package/dist/core/lsp/integration.d.ts.map +1 -1
  121. package/dist/core/lsp/integration.js.map +1 -1
  122. package/dist/core/lsp/language-map.d.ts.map +1 -1
  123. package/dist/core/lsp/language-map.js +2 -7
  124. package/dist/core/lsp/language-map.js.map +1 -1
  125. package/dist/core/lsp/manager.d.ts.map +1 -1
  126. package/dist/core/lsp/manager.js +18 -29
  127. package/dist/core/lsp/manager.js.map +1 -1
  128. package/dist/core/lsp/navigation.d.ts.map +1 -1
  129. package/dist/core/lsp/navigation.js.map +1 -1
  130. package/dist/core/lsp/portable-path.d.ts.map +1 -1
  131. package/dist/core/lsp/portable-path.js.map +1 -1
  132. package/dist/core/lsp/refactor.d.ts.map +1 -1
  133. package/dist/core/lsp/refactor.js.map +1 -1
  134. package/dist/core/lsp/transport.d.ts.map +1 -1
  135. package/dist/core/lsp/transport.js.map +1 -1
  136. package/dist/core/messages.d.ts.map +1 -1
  137. package/dist/core/messages.js.map +1 -1
  138. package/dist/core/model-registry.d.ts.map +1 -1
  139. package/dist/core/model-registry.js +5 -7
  140. package/dist/core/model-registry.js.map +1 -1
  141. package/dist/core/model-resolver.d.ts.map +1 -1
  142. package/dist/core/model-resolver.js.map +1 -1
  143. package/dist/core/output-guard.d.ts.map +1 -1
  144. package/dist/core/output-guard.js.map +1 -1
  145. package/dist/core/package-manager.d.ts.map +1 -1
  146. package/dist/core/package-manager.js +0 -6
  147. package/dist/core/package-manager.js.map +1 -1
  148. package/dist/core/prompt-templates.d.ts.map +1 -1
  149. package/dist/core/prompt-templates.js.map +1 -1
  150. package/dist/core/provider-display-names.d.ts.map +1 -1
  151. package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -1
  152. package/dist/core/remote-workspace-protocol/contract.js +4 -2
  153. package/dist/core/remote-workspace-protocol/contract.js.map +1 -1
  154. package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts.map +1 -1
  155. package/dist/core/remote-workspace-protocol/guest-shared-client.js +1 -5
  156. package/dist/core/remote-workspace-protocol/guest-shared-client.js.map +1 -1
  157. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts.map +1 -1
  158. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js +5 -10
  159. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js.map +1 -1
  160. package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts.map +1 -1
  161. package/dist/core/remote-workspace-protocol/guest-shared-uplink.js +2 -9
  162. package/dist/core/remote-workspace-protocol/guest-shared-uplink.js.map +1 -1
  163. package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts.map +1 -1
  164. package/dist/core/remote-workspace-protocol/lima-owner-directory.js.map +1 -1
  165. package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts.map +1 -1
  166. package/dist/core/remote-workspace-protocol/lima-owner-lock.js.map +1 -1
  167. package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -1
  168. package/dist/core/remote-workspace-protocol/session.js +27 -65
  169. package/dist/core/remote-workspace-protocol/session.js.map +1 -1
  170. package/dist/core/remote-workspace-protocol/shared-transport.d.ts.map +1 -1
  171. package/dist/core/remote-workspace-protocol/shared-transport.js.map +1 -1
  172. package/dist/core/resolve-config-value.d.ts.map +1 -1
  173. package/dist/core/resolve-config-value.js.map +1 -1
  174. package/dist/core/resource-loader.d.ts.map +1 -1
  175. package/dist/core/resource-loader.js +0 -48
  176. package/dist/core/resource-loader.js.map +1 -1
  177. package/dist/core/rules.d.ts.map +1 -1
  178. package/dist/core/rules.js.map +1 -1
  179. package/dist/core/sandbox/command.d.ts.map +1 -1
  180. package/dist/core/sandbox/command.js.map +1 -1
  181. package/dist/core/sandbox/config.d.ts.map +1 -1
  182. package/dist/core/sandbox/config.js.map +1 -1
  183. package/dist/core/sandbox/lima-guest-binary.d.ts.map +1 -1
  184. package/dist/core/sandbox/lima-guest-binary.js.map +1 -1
  185. package/dist/core/sandbox/lima.d.ts +2 -0
  186. package/dist/core/sandbox/lima.d.ts.map +1 -1
  187. package/dist/core/sandbox/lima.js +3 -9
  188. package/dist/core/sandbox/lima.js.map +1 -1
  189. package/dist/core/sandbox/shared-lima-roots.d.ts.map +1 -1
  190. package/dist/core/sandbox/shared-lima-roots.js.map +1 -1
  191. package/dist/core/sandbox/update-shared-guest-binary.d.ts.map +1 -1
  192. package/dist/core/sandbox/update-shared-guest-binary.js.map +1 -1
  193. package/dist/core/session/constants.d.ts.map +1 -1
  194. package/dist/core/session/context-metadata.d.ts.map +1 -1
  195. package/dist/core/session/context-metadata.js.map +1 -1
  196. package/dist/core/session/context.d.ts.map +1 -1
  197. package/dist/core/session/context.js.map +1 -1
  198. package/dist/core/session/ids.d.ts.map +1 -1
  199. package/dist/core/session/ids.js.map +1 -1
  200. package/dist/core/session/in-memory-session-manager.d.ts.map +1 -1
  201. package/dist/core/session/in-memory-session-manager.js +0 -1
  202. package/dist/core/session/in-memory-session-manager.js.map +1 -1
  203. package/dist/core/session/in-memory-session.d.ts.map +1 -1
  204. package/dist/core/session/in-memory-session.js.map +1 -1
  205. package/dist/core/session/jsonl-errors.d.ts.map +1 -1
  206. package/dist/core/session/jsonl-errors.js +0 -11
  207. package/dist/core/session/jsonl-errors.js.map +1 -1
  208. package/dist/core/session/jsonl-helpers.d.ts.map +1 -1
  209. package/dist/core/session/jsonl-helpers.js.map +1 -1
  210. package/dist/core/session/local-session-manager.d.ts.map +1 -1
  211. package/dist/core/session/local-session-manager.js +4 -6
  212. package/dist/core/session/local-session-manager.js.map +1 -1
  213. package/dist/core/session/local-session.d.ts.map +1 -1
  214. package/dist/core/session/local-session.js.map +1 -1
  215. package/dist/core/session/migrations.d.ts.map +1 -1
  216. package/dist/core/session/migrations.js.map +1 -1
  217. package/dist/core/session/remote-session-client.d.ts.map +1 -1
  218. package/dist/core/session/remote-session-client.js +0 -6
  219. package/dist/core/session/remote-session-client.js.map +1 -1
  220. package/dist/core/session/remote-session-manager.d.ts.map +1 -1
  221. package/dist/core/session/remote-session-manager.js +0 -3
  222. package/dist/core/session/remote-session-manager.js.map +1 -1
  223. package/dist/core/session/remote-session.d.ts.map +1 -1
  224. package/dist/core/session/remote-session.js +0 -1
  225. package/dist/core/session/remote-session.js.map +1 -1
  226. package/dist/core/session/session-manager.d.ts.map +1 -1
  227. package/dist/core/session/session.d.ts.map +1 -1
  228. package/dist/core/session/session.js +1 -5
  229. package/dist/core/session/session.js.map +1 -1
  230. package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -1
  231. package/dist/core/session/stores/in-memory-session-store.js +7 -6
  232. package/dist/core/session/stores/in-memory-session-store.js.map +1 -1
  233. package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -1
  234. package/dist/core/session/stores/jsonl-session-store.js +6 -14
  235. package/dist/core/session/stores/jsonl-session-store.js.map +1 -1
  236. package/dist/core/session/stores/remote-session-store.d.ts.map +1 -1
  237. package/dist/core/session/stores/remote-session-store.js +3 -8
  238. package/dist/core/session/stores/remote-session-store.js.map +1 -1
  239. package/dist/core/session/stores/session-store.d.ts.map +1 -1
  240. package/dist/core/session/types.d.ts.map +1 -1
  241. package/dist/core/session/usage-ledger.d.ts.map +1 -1
  242. package/dist/core/session/usage-ledger.js.map +1 -1
  243. package/dist/core/session-cwd.d.ts.map +1 -1
  244. package/dist/core/session-cwd.js +0 -1
  245. package/dist/core/session-cwd.js.map +1 -1
  246. package/dist/core/settings-manager.d.ts.map +1 -1
  247. package/dist/core/settings-manager.js +9 -17
  248. package/dist/core/settings-manager.js.map +1 -1
  249. package/dist/core/skills.d.ts.map +1 -1
  250. package/dist/core/skills.js.map +1 -1
  251. package/dist/core/slash-commands.d.ts.map +1 -1
  252. package/dist/core/source-info.d.ts.map +1 -1
  253. package/dist/core/source-info.js.map +1 -1
  254. package/dist/core/system-prompt.d.ts.map +1 -1
  255. package/dist/core/system-prompt.js.map +1 -1
  256. package/dist/core/telemetry.d.ts.map +1 -1
  257. package/dist/core/telemetry.js.map +1 -1
  258. package/dist/core/timings.d.ts.map +1 -1
  259. package/dist/core/timings.js.map +1 -1
  260. package/dist/core/tools/bash.d.ts.map +1 -1
  261. package/dist/core/tools/bash.js +8 -5
  262. package/dist/core/tools/bash.js.map +1 -1
  263. package/dist/core/tools/compress-context.d.ts.map +1 -1
  264. package/dist/core/tools/compress-context.js.map +1 -1
  265. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  266. package/dist/core/tools/edit-diff.js.map +1 -1
  267. package/dist/core/tools/edit.d.ts.map +1 -1
  268. package/dist/core/tools/edit.js.map +1 -1
  269. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  270. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  271. package/dist/core/tools/find.d.ts.map +1 -1
  272. package/dist/core/tools/find.js.map +1 -1
  273. package/dist/core/tools/grep.d.ts.map +1 -1
  274. package/dist/core/tools/grep.js.map +1 -1
  275. package/dist/core/tools/hash-store.d.ts.map +1 -1
  276. package/dist/core/tools/hash-store.js.map +1 -1
  277. package/dist/core/tools/hashline/apply.d.ts.map +1 -1
  278. package/dist/core/tools/hashline/apply.js.map +1 -1
  279. package/dist/core/tools/hashline/hash.d.ts.map +1 -1
  280. package/dist/core/tools/hashline/hash.js.map +1 -1
  281. package/dist/core/tools/hashline/parse.d.ts.map +1 -1
  282. package/dist/core/tools/hashline/parse.js.map +1 -1
  283. package/dist/core/tools/hashline/resolve.d.ts.map +1 -1
  284. package/dist/core/tools/hashline/resolve.js.map +1 -1
  285. package/dist/core/tools/hashline-utils.d.ts.map +1 -1
  286. package/dist/core/tools/hashline-utils.js.map +1 -1
  287. package/dist/core/tools/index.d.ts.map +1 -1
  288. package/dist/core/tools/index.js.map +1 -1
  289. package/dist/core/tools/ls.d.ts.map +1 -1
  290. package/dist/core/tools/ls.js.map +1 -1
  291. package/dist/core/tools/operations.d.ts +5 -0
  292. package/dist/core/tools/operations.d.ts.map +1 -1
  293. package/dist/core/tools/operations.js +26 -24
  294. package/dist/core/tools/operations.js.map +1 -1
  295. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  296. package/dist/core/tools/output-accumulator.js +12 -18
  297. package/dist/core/tools/output-accumulator.js.map +1 -1
  298. package/dist/core/tools/path-utils.d.ts.map +1 -1
  299. package/dist/core/tools/path-utils.js.map +1 -1
  300. package/dist/core/tools/read.d.ts.map +1 -1
  301. package/dist/core/tools/read.js.map +1 -1
  302. package/dist/core/tools/render-utils.d.ts.map +1 -1
  303. package/dist/core/tools/render-utils.js.map +1 -1
  304. package/dist/core/tools/replace-diff.d.ts.map +1 -1
  305. package/dist/core/tools/replace-diff.js.map +1 -1
  306. package/dist/core/tools/replace-normalize.d.ts.map +1 -1
  307. package/dist/core/tools/replace-normalize.js.map +1 -1
  308. package/dist/core/tools/replace-render.d.ts +1 -1
  309. package/dist/core/tools/replace-render.d.ts.map +1 -1
  310. package/dist/core/tools/replace-render.js.map +1 -1
  311. package/dist/core/tools/runtime.d.ts.map +1 -1
  312. package/dist/core/tools/runtime.js.map +1 -1
  313. package/dist/core/tools/session-history.d.ts.map +1 -1
  314. package/dist/core/tools/session-history.js.map +1 -1
  315. package/dist/core/tools/subagent-agents.d.ts.map +1 -1
  316. package/dist/core/tools/subagent-agents.js.map +1 -1
  317. package/dist/core/tools/subagent.d.ts.map +1 -1
  318. package/dist/core/tools/subagent.js.map +1 -1
  319. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  320. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  321. package/dist/core/tools/truncate.d.ts.map +1 -1
  322. package/dist/core/tools/truncate.js.map +1 -1
  323. package/dist/core/tools/websearch.d.ts.map +1 -1
  324. package/dist/core/tools/websearch.js.map +1 -1
  325. package/dist/core/tools/workspace-tool-host.d.ts +1 -0
  326. package/dist/core/tools/workspace-tool-host.d.ts.map +1 -1
  327. package/dist/core/tools/workspace-tool-host.js +36 -22
  328. package/dist/core/tools/workspace-tool-host.js.map +1 -1
  329. package/dist/core/tools/write.d.ts.map +1 -1
  330. package/dist/core/tools/write.js +0 -1
  331. package/dist/core/tools/write.js.map +1 -1
  332. package/dist/core/workspace-identity.d.ts.map +1 -1
  333. package/dist/daemon/activity-budget.d.ts.map +1 -1
  334. package/dist/daemon/activity-budget.js +2 -3
  335. package/dist/daemon/activity-budget.js.map +1 -1
  336. package/dist/daemon/command.d.ts.map +1 -1
  337. package/dist/daemon/command.js.map +1 -1
  338. package/dist/daemon/config.d.ts +2 -0
  339. package/dist/daemon/config.d.ts.map +1 -1
  340. package/dist/daemon/config.js +4 -0
  341. package/dist/daemon/config.js.map +1 -1
  342. package/dist/daemon/help.d.ts.map +1 -1
  343. package/dist/daemon/help.js +4 -3
  344. package/dist/daemon/help.js.map +1 -1
  345. package/dist/daemon/lsp-config.d.ts.map +1 -1
  346. package/dist/daemon/lsp-config.js.map +1 -1
  347. package/dist/daemon/outbound-budget.d.ts.map +1 -1
  348. package/dist/daemon/outbound-budget.js +2 -4
  349. package/dist/daemon/outbound-budget.js.map +1 -1
  350. package/dist/daemon/security.d.ts.map +1 -1
  351. package/dist/daemon/security.js.map +1 -1
  352. package/dist/daemon/server.d.ts.map +1 -1
  353. package/dist/daemon/server.js.map +1 -1
  354. package/dist/daemon/shared-connection.d.ts.map +1 -1
  355. package/dist/daemon/shared-connection.js +10 -15
  356. package/dist/daemon/shared-connection.js.map +1 -1
  357. package/dist/daemon/shared-revision.d.ts.map +1 -1
  358. package/dist/daemon/shared-revision.js +2 -1
  359. package/dist/daemon/shared-revision.js.map +1 -1
  360. package/dist/daemon/shared-roots.d.ts.map +1 -1
  361. package/dist/daemon/shared-roots.js +0 -1
  362. package/dist/daemon/shared-roots.js.map +1 -1
  363. package/dist/daemon/workspace-runtime.d.ts +2 -0
  364. package/dist/daemon/workspace-runtime.d.ts.map +1 -1
  365. package/dist/daemon/workspace-runtime.js +43 -15
  366. package/dist/daemon/workspace-runtime.js.map +1 -1
  367. package/dist/index.d.ts.map +1 -1
  368. package/dist/main.d.ts.map +1 -1
  369. package/dist/main.js.map +1 -1
  370. package/dist/migrations.d.ts.map +1 -1
  371. package/dist/migrations.js.map +1 -1
  372. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  373. package/dist/modes/interactive/components/assistant-message.js +3 -10
  374. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  375. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  376. package/dist/modes/interactive/components/bash-execution.js +4 -9
  377. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  378. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  379. package/dist/modes/interactive/components/bordered-loader.js +0 -3
  380. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  381. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  382. package/dist/modes/interactive/components/branch-summary-message.js +1 -3
  383. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  384. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  385. package/dist/modes/interactive/components/compaction-summary-message.js +1 -3
  386. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  387. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  388. package/dist/modes/interactive/components/config-selector.js +6 -16
  389. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  390. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  391. package/dist/modes/interactive/components/countdown-timer.js +0 -5
  392. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  393. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  394. package/dist/modes/interactive/components/custom-editor.js +1 -8
  395. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  396. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  397. package/dist/modes/interactive/components/custom-message.js +1 -6
  398. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  399. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  400. package/dist/modes/interactive/components/diff.js.map +1 -1
  401. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  402. package/dist/modes/interactive/components/dynamic-border.js +0 -1
  403. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  404. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  405. package/dist/modes/interactive/components/extension-editor.js +1 -7
  406. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  407. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  408. package/dist/modes/interactive/components/extension-input.js +2 -8
  409. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  410. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  411. package/dist/modes/interactive/components/extension-selector.js +1 -9
  412. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  413. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  414. package/dist/modes/interactive/components/footer.js +1 -3
  415. package/dist/modes/interactive/components/footer.js.map +1 -1
  416. package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -1
  417. package/dist/modes/interactive/components/hook-execution.js +2 -5
  418. package/dist/modes/interactive/components/hook-execution.js.map +1 -1
  419. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  420. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  421. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  422. package/dist/modes/interactive/components/login-dialog.js +3 -9
  423. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  424. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
  425. package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
  426. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  427. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  428. package/dist/modes/interactive/components/message-card.d.ts.map +1 -1
  429. package/dist/modes/interactive/components/message-card.js +0 -1
  430. package/dist/modes/interactive/components/message-card.js.map +1 -1
  431. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  432. package/dist/modes/interactive/components/model-selector.js +13 -28
  433. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  434. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  435. package/dist/modes/interactive/components/oauth-selector.js +3 -12
  436. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  437. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  438. package/dist/modes/interactive/components/scoped-models-selector.js +9 -13
  439. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  440. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  441. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  442. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  443. package/dist/modes/interactive/components/session-selector.js +33 -58
  444. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  445. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  446. package/dist/modes/interactive/components/settings-selector.js +0 -4
  447. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  448. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  449. package/dist/modes/interactive/components/show-images-selector.js +0 -1
  450. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  451. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  452. package/dist/modes/interactive/components/skill-invocation-message.js +1 -3
  453. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  454. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  455. package/dist/modes/interactive/components/theme-selector.js +0 -2
  456. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  457. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  458. package/dist/modes/interactive/components/thinking-selector.js +0 -1
  459. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  460. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  461. package/dist/modes/interactive/components/tool-execution.js +9 -24
  462. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  463. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  464. package/dist/modes/interactive/components/tree-selector.js +18 -34
  465. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  466. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  467. package/dist/modes/interactive/components/user-message-selector.js +3 -6
  468. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  469. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  470. package/dist/modes/interactive/components/user-message.js +0 -4
  471. package/dist/modes/interactive/components/user-message.js.map +1 -1
  472. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  473. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  474. package/dist/modes/interactive/interactive-mode.d.ts +14 -0
  475. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  476. package/dist/modes/interactive/interactive-mode.js +159 -135
  477. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  478. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  479. package/dist/modes/interactive/theme/theme.js +0 -7
  480. package/dist/modes/interactive/theme/theme.js.map +1 -1
  481. package/dist/modes/json-event.d.ts.map +1 -1
  482. package/dist/modes/json-event.js.map +1 -1
  483. package/dist/modes/print-mode.d.ts.map +1 -1
  484. package/dist/modes/print-mode.js.map +1 -1
  485. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  486. package/dist/modes/rpc/jsonl.js.map +1 -1
  487. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  488. package/dist/modes/rpc/rpc-client.js +10 -11
  489. package/dist/modes/rpc/rpc-client.js.map +1 -1
  490. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  491. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  492. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  493. package/dist/package-manager-cli.d.ts.map +1 -1
  494. package/dist/package-manager-cli.js.map +1 -1
  495. package/dist/utils/ansi.d.ts.map +1 -1
  496. package/dist/utils/ansi.js.map +1 -1
  497. package/dist/utils/changelog.d.ts.map +1 -1
  498. package/dist/utils/changelog.js.map +1 -1
  499. package/dist/utils/child-process.d.ts.map +1 -1
  500. package/dist/utils/child-process.js.map +1 -1
  501. package/dist/utils/clipboard-image.d.ts.map +1 -1
  502. package/dist/utils/clipboard-image.js.map +1 -1
  503. package/dist/utils/clipboard-native.d.ts.map +1 -1
  504. package/dist/utils/clipboard-native.js.map +1 -1
  505. package/dist/utils/clipboard.d.ts.map +1 -1
  506. package/dist/utils/clipboard.js.map +1 -1
  507. package/dist/utils/deprecation.d.ts.map +1 -1
  508. package/dist/utils/deprecation.js.map +1 -1
  509. package/dist/utils/directory-completions.d.ts.map +1 -1
  510. package/dist/utils/directory-completions.js.map +1 -1
  511. package/dist/utils/exif-orientation.d.ts.map +1 -1
  512. package/dist/utils/exif-orientation.js.map +1 -1
  513. package/dist/utils/frontmatter.d.ts.map +1 -1
  514. package/dist/utils/frontmatter.js.map +1 -1
  515. package/dist/utils/fs-watch.d.ts.map +1 -1
  516. package/dist/utils/fs-watch.js.map +1 -1
  517. package/dist/utils/git.d.ts.map +1 -1
  518. package/dist/utils/git.js.map +1 -1
  519. package/dist/utils/grip-user-agent.d.ts.map +1 -1
  520. package/dist/utils/grip-user-agent.js.map +1 -1
  521. package/dist/utils/html.d.ts.map +1 -1
  522. package/dist/utils/html.js.map +1 -1
  523. package/dist/utils/image-convert.d.ts.map +1 -1
  524. package/dist/utils/image-convert.js.map +1 -1
  525. package/dist/utils/image-process.d.ts.map +1 -1
  526. package/dist/utils/image-process.js.map +1 -1
  527. package/dist/utils/image-resize-core.d.ts.map +1 -1
  528. package/dist/utils/image-resize-core.js.map +1 -1
  529. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  530. package/dist/utils/image-resize-worker.js.map +1 -1
  531. package/dist/utils/image-resize.d.ts.map +1 -1
  532. package/dist/utils/image-resize.js.map +1 -1
  533. package/dist/utils/json.d.ts.map +1 -1
  534. package/dist/utils/json.js.map +1 -1
  535. package/dist/utils/mime.d.ts.map +1 -1
  536. package/dist/utils/mime.js.map +1 -1
  537. package/dist/utils/open-browser.d.ts.map +1 -1
  538. package/dist/utils/open-browser.js.map +1 -1
  539. package/dist/utils/paths.d.ts.map +1 -1
  540. package/dist/utils/paths.js.map +1 -1
  541. package/dist/utils/photon.d.ts.map +1 -1
  542. package/dist/utils/photon.js +10 -5
  543. package/dist/utils/photon.js.map +1 -1
  544. package/dist/utils/shell.d.ts.map +1 -1
  545. package/dist/utils/shell.js.map +1 -1
  546. package/dist/utils/sleep.d.ts.map +1 -1
  547. package/dist/utils/sleep.js.map +1 -1
  548. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  549. package/dist/utils/syntax-highlight.js +1 -1
  550. package/dist/utils/syntax-highlight.js.map +1 -1
  551. package/dist/utils/tools-manager.d.ts.map +1 -1
  552. package/dist/utils/tools-manager.js.map +1 -1
  553. package/dist/utils/version-check.d.ts.map +1 -1
  554. package/dist/utils/version-check.js.map +1 -1
  555. package/dist/utils/windows-self-update.d.ts.map +1 -1
  556. package/dist/utils/windows-self-update.js.map +1 -1
  557. package/docs/sandbox.md +6 -0
  558. package/docs/sessions.md +1 -1
  559. package/docs/usage.md +2 -1
  560. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  561. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  562. package/examples/extensions/sandbox/package.json +2 -2
  563. package/examples/extensions/with-deps/package.json +1 -1
  564. package/npm-shrinkwrap.json +601 -833
  565. package/package.json +20 -21
@@ -1 +1 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/core/lsp/manager.ts"],"names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mB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;YAC7G,IAAI,MAAM,IAAI,CAAC,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;gBAAE,OAAO,SAAS,CAAC;YACzF,OAAO,MAAM,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,mBAAmB,KAAK,UAAU,EAAE,CAAC;gBAC7C,eAAe,CAAC,SAAS,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACnF,eAAe,CAAC,KAAK,GAAG,QAAQ,CAAC;YAClC,CAAC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC;IAAA,CACD;IAEO,gBAAgB,CAAC,MAAsB,EAAE,MAAiB,EAAE,UAAkB,EAAW;QAChG,OAAO,CACN,IAAI,CAAC,mBAAmB,KAAK,UAAU;YACvC,CAAC,IAAI,CAAC,YAAY;YAClB,IAAI,CAAC,aAAa,CAAC,OAAO;YAC1B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC;YACrE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,MAAM;YAC/C,MAAM,CAAC,aAAa;YACpB,CAAC,MAAM,CAAC,UAAU,CAClB,CAAC;IAAA,CACF;CACD","sourcesContent":["import type { ServerCapabilities } from \"vscode-languageserver-protocol\";\nimport type { ToolBackendInfo, ToolOperations } from \"../tools/operations.ts\";\nimport { waitForAbort } from \"./abort.ts\";\nimport {\n\tLspClient,\n\ttype LspClientOptions,\n\ttype LspClientOwnership,\n\ttype LspConnectionState,\n\ttype LspShutdownMode,\n} from \"./client.ts\";\nimport type { LspConfiguredServer, LspServerFeatures, LspTransport, ResolvedLspConfiguration } from \"./config.ts\";\nimport {\n\ttype LspRouteFailure,\n\ttype LspRouteResult,\n\tLspRouter,\n\ttype LspRouterOptions,\n\ttype LspRouteTarget,\n} from \"./language-map.ts\";\nimport { resolvePortablePath } from \"./portable-path.ts\";\nimport {\n\ttype LspConnectionFactory,\n\ttype LspConnectionFactoryRegistry,\n\tresolveLspConnectionFactory,\n} from \"./transport.ts\";\n\nexport interface LspServerStatus {\n\tserverId: string;\n\tlanguageIds: string[];\n\ttransport: string;\n\tinstanceKey?: string;\n\tworkspaceRoot?: string;\n\tendpoint?: string;\n\trootUri?: string;\n\townership: LspClientOwnership;\n\tshutdownMode: LspShutdownMode;\n\tstate: LspConnectionState;\n\treconnectEligible: boolean;\n\tcapabilities?: ServerCapabilities;\n\trunning: boolean;\n\tstarting: boolean;\n\tdiagnosticsCount: number;\n\tlastError?: string;\n\tlastRequestError?: string;\n\tstderr?: string;\n\tsynchronizationError?: string;\n}\n\nexport type LspConnectionFactoryResolver = (transport: LspTransport) => LspConnectionFactory;\n\nexport interface LspManagerOptions extends LspRouterOptions {\n\tconfiguration?: ResolvedLspConfiguration;\n\tcreateClient?: (options: LspClientOptions) => LspClient;\n\tconnectionFactories?: LspConnectionFactoryRegistry;\n\tresolveConnectionFactory?: LspConnectionFactoryResolver;\n\tgetToolBackendInfo?: () => ToolBackendInfo;\n\tgetToolOperations?: () => ToolOperations;\n}\n\nexport interface LspClientRoute {\n\tclient: LspClient;\n\ttarget: LspRouteTarget;\n}\n\nexport type LspToolFeature = keyof LspServerFeatures;\n\nexport type LspClientRouteFailure = LspRouteFailure;\n\nexport interface LspClientRouteCollection {\n\troutes: LspClientRoute[];\n\tfailures: LspClientRouteFailure[];\n\tmatchedServerCount: number;\n}\n\ninterface LspTransportStatus {\n\tlastError?: string;\n\tlastRequestError?: string;\n\tstderr: string;\n\tstate: LspConnectionState;\n\tendpoint?: string;\n\tcapabilities?: ServerCapabilities;\n}\n\ninterface LspStartupWaiters {\n\tstartup: Promise<LspClient | undefined>;\n\twaiters: Set<object>;\n}\n\nexport type LspClientStartedListener = (route: LspClientRoute, recoverySignal?: AbortSignal) => Promise<void>;\nexport type LspClientsWillShutdownListener = (routes: LspClientRoute[]) => Promise<void>;\n\nconst DISABLED_CONFIGURATION: ResolvedLspConfiguration = { enabled: false, servers: [] };\nconst SYNCHRONIZATION_RECOVERY_TIMEOUT_MS = 3000;\n\nexport class LspManager {\n\tprivate rootDir: string;\n\tprivate readonly createClient: (options: LspClientOptions) => LspClient;\n\tprivate readonly connectionFactories: LspConnectionFactoryRegistry;\n\tprivate readonly resolveConnectionFactory: LspConnectionFactoryResolver;\n\tprivate readonly getToolBackendInfo: (() => ToolBackendInfo) | undefined;\n\tprivate readonly getToolOperations: (() => ToolOperations) | undefined;\n\tprivate toolBackendInfo: ToolBackendInfo | undefined;\n\tprivate toolOperations: ToolOperations | undefined;\n\tprivate activeBackendIdentity: string | undefined;\n\tprivate readonly operationIds = new WeakMap<ToolOperations, number>();\n\tprivate nextOperationId = 1;\n\tprivate readonly inaccessibleRemotePathExists = async (): Promise<boolean> => false;\n\tprivate readonly router: LspRouter;\n\tprivate configuration: ResolvedLspConfiguration;\n\tprivate readonly clients = new Map<string, LspClient>();\n\tprivate readonly targets = new Map<string, LspRouteTarget>();\n\tprivate readonly transportStatuses = new Map<string, LspTransportStatus>();\n\tprivate readonly synchronizationErrors = new Map<string, string>();\n\tprivate readonly clientStartedListeners = new Set<LspClientStartedListener>();\n\tprivate readonly clientsWillShutdownListeners = new Set<LspClientsWillShutdownListener>();\n\tprivate readonly starting = new Map<string, Promise<LspClient | undefined>>();\n\tprivate readonly startupWaiters = new Map<string, LspStartupWaiters>();\n\tprivate readonly recoverySignals = new Map<string, AbortSignal>();\n\tprivate shuttingDown = false;\n\tprivate permanentlyShutDown = false;\n\tprivate pendingLifecycleOperations = 0;\n\tprivate lifecycleGeneration = 0;\n\tprivate readonly lifecycleGenerationListeners = new Set<() => void>();\n\tprivate lifecycleQueue: Promise<void> = Promise.resolve();\n\n\tconstructor(rootDir: string, options: LspManagerOptions = {}) {\n\t\tthis.rootDir = resolvePortablePath(process.cwd(), rootDir);\n\t\tthis.configuration = options.configuration ?? DISABLED_CONFIGURATION;\n\t\tthis.router = new LspRouter(this.rootDir, this.configuration, { pathExists: options.pathExists });\n\t\tthis.createClient = options.createClient ?? ((clientOptions) => new LspClient(clientOptions));\n\t\tthis.connectionFactories = options.connectionFactories ?? {};\n\t\tthis.resolveConnectionFactory =\n\t\t\toptions.resolveConnectionFactory ??\n\t\t\t((transport) => resolveLspConnectionFactory(transport, this.connectionFactories));\n\t\tthis.getToolBackendInfo = options.getToolBackendInfo;\n\t\tthis.getToolOperations = options.getToolOperations;\n\t}\n\n\tget cwd(): string {\n\t\treturn this.rootDir;\n\t}\n\n\tget isShuttingDown(): boolean {\n\t\treturn this.shuttingDown;\n\t}\n\n\tresolvePath(filePath: string): string {\n\t\treturn resolvePortablePath(this.rootDir, filePath);\n\t}\n\n\tsetConfiguration(configuration: ResolvedLspConfiguration): Promise<void> {\n\t\treturn this.enqueueLifecycleOperation(async () => {\n\t\t\tconst clients = [...this.clients.values()];\n\t\t\tawait this.notifyClientsWillShutdown();\n\t\t\tawait Promise.all(clients.map((client) => client.shutdown().catch(() => undefined)));\n\t\t\tawait Promise.all([...this.starting.values()].map((pending) => pending.catch(() => undefined)));\n\t\t\tthis.clients.clear();\n\t\t\tthis.targets.clear();\n\t\t\tthis.transportStatuses.clear();\n\t\t\tthis.synchronizationErrors.clear();\n\t\t\tthis.starting.clear();\n\t\t\tthis.configuration = configuration;\n\t\t\tthis.router.setConfiguration(configuration);\n\t\t});\n\t}\n\n\tclearRoutingCache(): void {\n\t\tthis.router.clearCache();\n\t}\n\n\tasync resolveTargets(filePath: string, signal?: AbortSignal): Promise<LspRouteResult> {\n\t\tconst operations = this.getToolOperations?.();\n\t\tif (operations) await waitForAbort(this.setToolOperations(operations), signal);\n\t\tif (!this.configuration.enabled) return { targets: [], failures: [] };\n\t\tconst backend = this.toolBackendInfo ?? this.toolOperations?.getBackendInfo?.() ?? this.getToolBackendInfo?.();\n\t\tif (!this.toolOperations && backend && backend.type !== \"local\") {\n\t\t\tthis.rootDir = resolvePortablePath(process.cwd(), backend.cwd);\n\t\t\tthis.router.setRoutingContext(this.rootDir, this.inaccessibleRemotePathExists);\n\t\t}\n\t\tconst route = await waitForAbort(this.router.routeFile(filePath, signal), signal);\n\t\tif (!backend || backend.type === \"local\") return route;\n\t\tconst targets: LspRouteTarget[] = [];\n\t\tconst failures = [...route.failures];\n\t\tfor (const target of route.targets) {\n\t\t\tconst reason = this.getBackendCompatibilityReason(target, backend);\n\t\t\tif (reason) {\n\t\t\t\tthis.targets.set(target.instanceKey, target);\n\t\t\t\tthis.synchronizationErrors.set(target.instanceKey, reason);\n\t\t\t\tfailures.push({ serverId: target.serverId, reason });\n\t\t\t} else {\n\t\t\t\ttargets.push(target);\n\t\t\t}\n\t\t}\n\t\treturn { targets, failures };\n\t}\n\n\tasync getPrimaryTarget(filePath: string, signal?: AbortSignal): Promise<LspRouteTarget | undefined> {\n\t\treturn (await this.resolveTargets(filePath, signal)).targets[0];\n\t}\n\n\tgetRunningClient(instanceKey: string): LspClient | undefined {\n\t\tconst client = this.clients.get(instanceKey);\n\t\treturn client?.isInitialized === true && !client.isDisposed ? client : undefined;\n\t}\n\n\tsetToolBackendInfo(backend: ToolBackendInfo): void {\n\t\tthis.toolBackendInfo = backend;\n\t}\n\n\tasync setToolOperations(operations: ToolOperations, signal?: AbortSignal): Promise<void> {\n\t\tconst backend = operations.getBackendInfo?.() ?? { type: \"local\" as const, cwd: operations.cwd };\n\t\tlet operationId = this.operationIds.get(operations);\n\t\tif (operationId === undefined) {\n\t\t\toperationId = this.nextOperationId++;\n\t\t\tthis.operationIds.set(operations, operationId);\n\t\t}\n\t\tconst identity = JSON.stringify([operationId, backend]);\n\t\tif (identity === this.activeBackendIdentity) {\n\t\t\tthis.toolOperations = operations;\n\t\t\tthis.toolBackendInfo = backend;\n\t\t\treturn;\n\t\t}\n\t\tconst nextRoot = resolvePortablePath(process.cwd(), operations.cwd);\n\t\tconst apply = () => {\n\t\t\tthis.toolOperations = operations;\n\t\t\tthis.toolBackendInfo = backend;\n\t\t\tthis.activeBackendIdentity = identity;\n\t\t\tthis.rootDir = nextRoot;\n\t\t\tthis.router.setRoutingContext(nextRoot, async (path) => {\n\t\t\t\tawait operations.access(path, \"exists\");\n\t\t\t\treturn true;\n\t\t\t});\n\t\t};\n\t\tconst defaultLocalContext =\n\t\t\tthis.activeBackendIdentity === undefined && backend.type === \"local\" && nextRoot === this.rootDir;\n\t\tif (defaultLocalContext || (this.clients.size === 0 && this.starting.size === 0)) {\n\t\t\tapply();\n\t\t\treturn;\n\t\t}\n\t\tawait waitForAbort(\n\t\t\tthis.enqueueLifecycleOperation(async () => {\n\t\t\t\tconst clients = [...this.clients.values()];\n\t\t\t\tawait this.notifyClientsWillShutdown();\n\t\t\t\tawait Promise.all(clients.map((client) => client.shutdown().catch(() => undefined)));\n\t\t\t\tawait Promise.all([...this.starting.values()].map((pending) => pending.catch(() => undefined)));\n\t\t\t\tthis.clients.clear();\n\t\t\t\tthis.targets.clear();\n\t\t\t\tthis.transportStatuses.clear();\n\t\t\t\tthis.synchronizationErrors.clear();\n\t\t\t\tthis.starting.clear();\n\t\t\t\tapply();\n\t\t\t}),\n\t\t\tsignal,\n\t\t);\n\t}\n\n\tonClientStarted(listener: LspClientStartedListener): () => void {\n\t\tthis.clientStartedListeners.add(listener);\n\t\treturn () => this.clientStartedListeners.delete(listener);\n\t}\n\n\tonClientsWillShutdown(listener: LspClientsWillShutdownListener): () => void {\n\t\tthis.clientsWillShutdownListeners.add(listener);\n\t\treturn () => this.clientsWillShutdownListeners.delete(listener);\n\t}\n\n\treportSynchronizationUnavailable(target: LspRouteTarget, reason: string | undefined): void {\n\t\tthis.targets.set(target.instanceKey, target);\n\t\tif (reason) this.synchronizationErrors.set(target.instanceKey, reason);\n\t\telse this.synchronizationErrors.delete(target.instanceKey);\n\t}\n\n\treportSynchronizationError(target: LspRouteTarget | string, error: unknown): void {\n\t\tconst instanceKey = typeof target === \"string\" ? target : target.instanceKey;\n\t\tconst resolvedTarget = typeof target === \"string\" ? this.targets.get(target) : target;\n\t\tif (resolvedTarget) this.targets.set(instanceKey, resolvedTarget);\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconst identity = resolvedTarget\n\t\t\t? `server ${resolvedTarget.serverId} instance ${resolvedTarget.instanceKey}`\n\t\t\t: `instance ${instanceKey}`;\n\t\tthis.synchronizationErrors.set(instanceKey, `Synchronization failed for ${identity}: ${detail}`);\n\t}\n\n\tasync invalidateSynchronizationClient(\n\t\ttarget: LspRouteTarget,\n\t\tclient: LspClient,\n\t\terror: unknown,\n\t\treconnect = true,\n\t): Promise<void> {\n\t\tconst current = this.clients.get(target.instanceKey);\n\t\tif (current !== undefined && current !== client) {\n\t\t\tvoid client.invalidate();\n\t\t\treturn;\n\t\t}\n\t\tif (current === client) {\n\t\t\tthis.clients.delete(target.instanceKey);\n\t\t\tconst transportStatus = this.transportStatuses.get(target.instanceKey);\n\t\t\tif (transportStatus?.state === \"running\") transportStatus.state = \"closed\";\n\t\t}\n\t\tthis.reportSynchronizationError(target, error);\n\t\tvoid client.invalidate();\n\t\tif (!reconnect) return;\n\t\tconst generation = this.lifecycleGeneration;\n\t\tqueueMicrotask(() => {\n\t\t\tif (\n\t\t\t\tthis.lifecycleGeneration !== generation ||\n\t\t\t\tthis.shuttingDown ||\n\t\t\t\t!this.configuration.enabled ||\n\t\t\t\t!this.configuration.servers.some((server) => server === target.server)\n\t\t\t)\n\t\t\t\treturn;\n\t\t\tconst configuredTimeout = target.server.timeouts?.requestMs;\n\t\t\tconst recoveryTimeoutMs =\n\t\t\t\tconfiguredTimeout !== undefined && configuredTimeout > 0\n\t\t\t\t\t? Math.min(configuredTimeout, SYNCHRONIZATION_RECOVERY_TIMEOUT_MS)\n\t\t\t\t\t: SYNCHRONIZATION_RECOVERY_TIMEOUT_MS;\n\t\t\tconst recoverySignal = AbortSignal.timeout(recoveryTimeoutMs);\n\t\t\tthis.recoverySignals.set(target.instanceKey, recoverySignal);\n\t\t\tvoid this.getClientForTarget(target, recoverySignal).catch(() => undefined);\n\t\t});\n\t}\n\n\tgetSynchronizationCompatibilityReason(\n\t\ttarget: LspRouteTarget,\n\t\tbackend: ToolBackendInfo | undefined,\n\t): string | undefined {\n\t\tif (!backend || backend.type === \"local\") return undefined;\n\t\treturn this.getBackendCompatibilityReason(target, backend);\n\t}\n\tgetRunningClients(): LspClientRoute[] {\n\t\tconst serverOrder = new Map(this.configuration.servers.map((server, index) => [server, index]));\n\t\treturn [...this.clients.entries()]\n\t\t\t.flatMap(([instanceKey, client]) => {\n\t\t\t\tconst target = this.targets.get(instanceKey);\n\t\t\t\treturn target && client.isInitialized && !client.isDisposed ? [{ client, target }] : [];\n\t\t\t})\n\t\t\t.sort(\n\t\t\t\t(left, right) =>\n\t\t\t\t\t(right.target.server.priority ?? 0) - (left.target.server.priority ?? 0) ||\n\t\t\t\t\t(serverOrder.get(left.target.server) ?? Number.MAX_SAFE_INTEGER) -\n\t\t\t\t\t\t(serverOrder.get(right.target.server) ?? Number.MAX_SAFE_INTEGER) ||\n\t\t\t\t\tleft.target.instanceKey.localeCompare(right.target.instanceKey),\n\t\t\t);\n\t}\n\n\tisStarting(instanceKey: string): boolean {\n\t\treturn this.starting.has(instanceKey);\n\t}\n\n\tasync getClientRouteForFile(filePath: string, signal?: AbortSignal): Promise<LspClientRoute | undefined> {\n\t\tconst target = await this.getPrimaryTarget(filePath, signal);\n\t\tif (!target) return undefined;\n\t\tconst client = await this.getClientForTarget(target, signal);\n\t\treturn client ? { client, target } : undefined;\n\t}\n\n\tasync getClientForFile(filePath: string, signal?: AbortSignal): Promise<LspClient | undefined> {\n\t\treturn (await this.getClientRouteForFile(filePath, signal))?.client;\n\t}\n\n\tasync getClientRoutesForFeature(\n\t\tfilePath: string,\n\t\tfeature: LspToolFeature,\n\t\tsignal?: AbortSignal,\n\t): Promise<LspClientRouteCollection> {\n\t\tconst resolved = await this.resolveTargets(filePath, signal);\n\t\tconst outcomes = await waitForAbort(\n\t\t\tPromise.all(\n\t\t\t\tresolved.targets.map(async (target) => {\n\t\t\t\t\tif (target.server.features?.[feature] === false) {\n\t\t\t\t\t\treturn { failure: { serverId: target.serverId, reason: `${feature} is disabled by configuration` } };\n\t\t\t\t\t}\n\t\t\t\t\tconst client = await this.getClientForTarget(target, signal);\n\t\t\t\t\tif (!client) {\n\t\t\t\t\t\treturn { failure: { serverId: target.serverId, reason: this.getTargetUnavailableReason(target) } };\n\t\t\t\t\t}\n\t\t\t\t\tconst unsupported = this.getUnsupportedCapabilityReason(client.serverCapabilities, feature);\n\t\t\t\t\tif (unsupported) return { failure: { serverId: target.serverId, reason: unsupported } };\n\t\t\t\t\treturn { route: { client, target } };\n\t\t\t\t}),\n\t\t\t),\n\t\t\tsignal,\n\t\t);\n\t\treturn {\n\t\t\troutes: outcomes.flatMap((outcome) => (outcome.route ? [outcome.route] : [])),\n\t\t\tfailures: [...resolved.failures, ...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : []))],\n\t\t\tmatchedServerCount: resolved.targets.length + resolved.failures.length,\n\t\t};\n\t}\n\n\tasync getClientForTarget(target: LspRouteTarget, signal?: AbortSignal): Promise<LspClient | undefined> {\n\t\tif (!this.configuration.enabled) return undefined;\n\t\tif (!this.configuration.servers.some((server) => server === target.server)) return undefined;\n\t\tconst backend = this.toolBackendInfo ?? this.toolOperations?.getBackendInfo?.() ?? this.getToolBackendInfo?.();\n\t\tif (backend && backend.type !== \"local\") {\n\t\t\tconst reason = this.getBackendCompatibilityReason(target, backend);\n\t\t\tif (reason) {\n\t\t\t\tthis.reportSynchronizationUnavailable(target, reason);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\tif (this.shuttingDown) return undefined;\n\t\tconst running = this.getRunningClient(target.instanceKey);\n\t\tif (running) return running;\n\t\tconst pending = this.starting.get(target.instanceKey);\n\t\tif (pending) return this.waitForClientStartup(target.instanceKey, pending, signal);\n\n\t\tconst generation = this.lifecycleGeneration;\n\t\tconst start = this.startClient(target, generation);\n\t\tthis.starting.set(target.instanceKey, start);\n\t\tvoid start.finally(() => {\n\t\t\tif (this.starting.get(target.instanceKey) === start) {\n\t\t\t\tthis.starting.delete(target.instanceKey);\n\t\t\t\tthis.recoverySignals.delete(target.instanceKey);\n\t\t\t}\n\t\t\tif (this.startupWaiters.get(target.instanceKey)?.startup === start) {\n\t\t\t\tthis.startupWaiters.delete(target.instanceKey);\n\t\t\t}\n\t\t});\n\t\treturn this.waitForClientStartup(target.instanceKey, start, signal);\n\t}\n\n\tprivate async waitForClientStartup(\n\t\tinstanceKey: string,\n\t\tstartup: Promise<LspClient | undefined>,\n\t\tsignal: AbortSignal | undefined,\n\t): Promise<LspClient | undefined> {\n\t\tconst token = {};\n\t\tlet state = this.startupWaiters.get(instanceKey);\n\t\tif (!state || state.startup !== startup) {\n\t\t\tstate = { startup, waiters: new Set<object>() };\n\t\t\tthis.startupWaiters.set(instanceKey, state);\n\t\t}\n\t\tstate.waiters.add(token);\n\t\ttry {\n\t\t\treturn await waitForAbort(startup, signal);\n\t\t} finally {\n\t\t\tstate.waiters.delete(token);\n\t\t\tif (state.waiters.size === 0 && this.startupWaiters.get(instanceKey) === state) {\n\t\t\t\tthis.startupWaiters.delete(instanceKey);\n\t\t\t\tif (signal?.aborted && this.starting.get(instanceKey) === startup) {\n\t\t\t\t\tconst orphanedClient = this.clients.get(instanceKey);\n\t\t\t\t\tthis.starting.delete(instanceKey);\n\t\t\t\t\tthis.recoverySignals.delete(instanceKey);\n\t\t\t\t\tif (this.clients.get(instanceKey) === orphanedClient) this.clients.delete(instanceKey);\n\t\t\t\t\tawait orphanedClient?.invalidate().catch(() => undefined);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tasync getUnavailableReason(filePath: string, signal?: AbortSignal): Promise<string> {\n\t\tif (!this.configuration.enabled) return \"LSP is disabled.\";\n\t\tconst route = await this.resolveTargets(filePath, signal);\n\t\tif (route.targets.length === 0) {\n\t\t\tif (route.failures.length > 0)\n\t\t\t\treturn route.failures.map((failure) => `${failure.serverId}: ${failure.reason}`).join(\"; \");\n\t\t\treturn `No configured LSP document selector matched: ${filePath}`;\n\t\t}\n\t\tconst target = route.targets[0];\n\t\tif (this.starting.has(target.instanceKey)) return `LSP server ${target.serverId} is starting. Retry shortly.`;\n\t\tconst synchronizationError = this.synchronizationErrors.get(target.instanceKey);\n\t\tif (synchronizationError) return `LSP server ${target.serverId} is unavailable: ${synchronizationError}`;\n\t\tconst error = this.transportStatuses.get(target.instanceKey)?.lastError;\n\t\tif (error) return `LSP server ${target.serverId} is unavailable: ${error}`;\n\t\treturn `No running LSP server for ${filePath}. Call an LSP tool for this file to start it.`;\n\t}\n\n\tprivate shutdownModeForServer(server: LspConfiguredServer): LspShutdownMode {\n\t\treturn server.lifecycle.type === \"attached\" && server.lifecycle.shutdown !== \"protocol\"\n\t\t\t? \"disconnect\"\n\t\t\t: \"protocol\";\n\t}\n\n\tprivate countClientDiagnostics(client: LspClient | undefined): number {\n\t\tif (!client) return 0;\n\t\tlet count = 0;\n\t\tfor (const diagnostics of client.getAllDiagnostics().values()) count += diagnostics.length;\n\t\treturn count;\n\t}\n\n\tprivate createRunningServerStatus(instanceKey: string, target: LspRouteTarget): LspServerStatus {\n\t\tconst client = this.clients.get(instanceKey);\n\t\tconst transportStatus = this.transportStatuses.get(instanceKey);\n\t\tconst status: LspServerStatus = {\n\t\t\tserverId: target.serverId,\n\t\t\tlanguageIds: [...new Set(target.server.selectors.map((selector) => selector.languageId))],\n\t\t\ttransport: target.server.transport.type,\n\t\t\tinstanceKey,\n\t\t\tworkspaceRoot: target.workspaceRoot,\n\t\t\trootUri: target.workspaceUri,\n\t\t\townership: target.server.lifecycle.type,\n\t\t\tshutdownMode: this.shutdownModeForServer(target.server),\n\t\t\tstate: client?.connectionState ?? transportStatus?.state ?? \"idle\",\n\t\t\treconnectEligible: !this.shuttingDown && (client === undefined || !client.isDisposed),\n\t\t\trunning: client?.isInitialized === true && !client.isDisposed,\n\t\t\tstarting: this.starting.has(instanceKey),\n\t\t\tdiagnosticsCount: this.countClientDiagnostics(client),\n\t\t};\n\t\tif (client?.connectionEndpoint || transportStatus?.endpoint) {\n\t\t\tstatus.endpoint = client?.connectionEndpoint?.description ?? transportStatus?.endpoint;\n\t\t}\n\t\tif (client?.serverCapabilities || transportStatus?.capabilities) {\n\t\t\tstatus.capabilities = client?.serverCapabilities ?? transportStatus?.capabilities;\n\t\t}\n\t\tif (transportStatus?.lastError) status.lastError = transportStatus.lastError;\n\t\tif (transportStatus?.lastRequestError) status.lastRequestError = transportStatus.lastRequestError;\n\t\tif (transportStatus?.stderr) status.stderr = transportStatus.stderr;\n\t\tconst synchronizationError = this.synchronizationErrors.get(instanceKey);\n\t\tif (synchronizationError) status.synchronizationError = synchronizationError;\n\t\treturn status;\n\t}\n\n\tgetStatus(): LspServerStatus[] {\n\t\tconst runningStatuses = [...this.targets.entries()].map(([instanceKey, target]) =>\n\t\t\tthis.createRunningServerStatus(instanceKey, target),\n\t\t);\n\t\tconst instantiated = new Set(runningStatuses.map((status) => status.serverId));\n\t\tconst statuses = [\n\t\t\t...runningStatuses,\n\t\t\t...this.configuration.servers\n\t\t\t\t.filter((server) => !instantiated.has(server.id))\n\t\t\t\t.map(\n\t\t\t\t\t(server): LspServerStatus => ({\n\t\t\t\t\t\tserverId: server.id,\n\t\t\t\t\t\tlanguageIds: [...new Set(server.selectors.map((selector) => selector.languageId))],\n\t\t\t\t\t\ttransport: server.transport.type,\n\t\t\t\t\t\townership: server.lifecycle.type,\n\t\t\t\t\t\tshutdownMode: this.shutdownModeForServer(server),\n\t\t\t\t\t\tstate: \"idle\" as const,\n\t\t\t\t\t\treconnectEligible: !this.shuttingDown,\n\t\t\t\t\t\trunning: false,\n\t\t\t\t\t\tstarting: false,\n\t\t\t\t\t\tdiagnosticsCount: 0,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t];\n\t\tconst serverOrder = new Map(this.configuration.servers.map((server, index) => [server.id, index]));\n\t\treturn statuses.sort(\n\t\t\t(left, right) =>\n\t\t\t\t(serverOrder.get(left.serverId) ?? Number.MAX_SAFE_INTEGER) -\n\t\t\t\t\t(serverOrder.get(right.serverId) ?? Number.MAX_SAFE_INTEGER) ||\n\t\t\t\t(left.instanceKey ?? \"\").localeCompare(right.instanceKey ?? \"\"),\n\t\t);\n\t}\n\tprivate async notifyClientStarted(\n\t\troute: LspClientRoute,\n\t\tgeneration: number,\n\t\trecoverySignal?: AbortSignal,\n\t): Promise<void> {\n\t\tfor (const listener of this.clientStartedListeners) {\n\t\t\tif (this.lifecycleGeneration !== generation) return;\n\t\t\tlet generationChanged!: () => void;\n\t\t\tconst changed = new Promise<false>((resolve) => {\n\t\t\t\tgenerationChanged = () => resolve(false);\n\t\t\t});\n\t\t\tthis.lifecycleGenerationListeners.add(generationChanged);\n\t\t\tif (this.lifecycleGeneration !== generation) generationChanged();\n\t\t\tconst completed = await Promise.race([\n\t\t\t\tPromise.resolve()\n\t\t\t\t\t.then(() => listener(route, recoverySignal))\n\t\t\t\t\t.then(\n\t\t\t\t\t\t() => true,\n\t\t\t\t\t\t() => true,\n\t\t\t\t\t),\n\t\t\t\tchanged,\n\t\t\t]);\n\t\t\tthis.lifecycleGenerationListeners.delete(generationChanged);\n\t\t\tif (!completed || this.lifecycleGeneration !== generation) return;\n\t\t}\n\t}\n\n\tprivate async notifyClientsWillShutdown(): Promise<void> {\n\t\tconst routes = this.getRunningClients();\n\t\tconst notifications = [...this.clientsWillShutdownListeners].map((listener) =>\n\t\t\tPromise.resolve()\n\t\t\t\t.then(() => listener(routes))\n\t\t\t\t.catch(() => undefined),\n\t\t);\n\t\tif (notifications.length === 0) return;\n\t\tconst lifecycleTargets = routes.length > 0 ? routes.map((route) => route.target) : [...this.targets.values()];\n\t\tconst timeoutMs =\n\t\t\tlifecycleTargets.length === 0\n\t\t\t\t? 3000\n\t\t\t\t: Math.max(...lifecycleTargets.map((target) => target.server.timeouts?.shutdownMs ?? 3000));\n\t\tconst completed = Promise.all(notifications).then(() => undefined);\n\t\tif (timeoutMs === 0) {\n\t\t\tawait completed;\n\t\t\treturn;\n\t\t}\n\t\tlet timer: NodeJS.Timeout | undefined;\n\t\ttry {\n\t\t\tawait Promise.race([\n\t\t\t\tcompleted,\n\t\t\t\tnew Promise<void>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(resolve, timeoutMs);\n\t\t\t\t}),\n\t\t\t]);\n\t\t} finally {\n\t\t\tif (timer) clearTimeout(timer);\n\t\t}\n\t}\n\n\tprivate getUnsupportedCapabilityReason(\n\t\tcapabilities: ServerCapabilities | undefined,\n\t\tfeature: LspToolFeature,\n\t): string | undefined {\n\t\t// publishDiagnostics is a server notification and has no corresponding provider capability.\n\t\tif (feature === \"diagnostics\") return undefined;\n\t\tconst supported =\n\t\t\tfeature === \"hover\"\n\t\t\t\t? capabilities?.hoverProvider\n\t\t\t\t: feature === \"definition\"\n\t\t\t\t\t? capabilities?.definitionProvider\n\t\t\t\t\t: feature === \"references\"\n\t\t\t\t\t\t? capabilities?.referencesProvider\n\t\t\t\t\t\t: feature === \"rename\"\n\t\t\t\t\t\t\t? capabilities?.renameProvider\n\t\t\t\t\t\t\t: capabilities?.codeActionProvider;\n\t\treturn supported ? undefined : `server does not advertise ${feature} capability`;\n\t}\n\n\tprivate getTargetUnavailableReason(target: LspRouteTarget): string {\n\t\tconst synchronizationError = this.synchronizationErrors.get(target.instanceKey);\n\t\tif (synchronizationError) return synchronizationError;\n\t\tconst status = this.transportStatuses.get(target.instanceKey);\n\t\tif (status?.lastError) return status.lastError;\n\t\tif (this.starting.has(target.instanceKey)) return \"server is still starting\";\n\t\tif (this.shuttingDown) return \"LSP lifecycle shutdown or reconfiguration is in progress\";\n\t\treturn \"server could not be started\";\n\t}\n\n\tprivate getBackendCompatibilityReason(target: LspRouteTarget, backend: ToolBackendInfo): string | undefined {\n\t\tif (\"configured\" in backend && backend.configured === false) {\n\t\t\treturn `ToolOperations backend ${backend.type} is not configured`;\n\t\t}\n\t\tif ((target.server.pathMappings?.length ?? 0) === 0) {\n\t\t\treturn `ToolOperations backend ${backend.type} requires explicit LSP pathMappings`;\n\t\t}\n\t\tconst mappedBackendRoot = target.mapper.agentPathToServerUri(backend.cwd);\n\t\tif (!mappedBackendRoot.ok) {\n\t\t\treturn `ToolOperations backend root ${backend.cwd} cannot be mapped to the server workspace: ${mappedBackendRoot.reason}`;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tshutdownAll(): Promise<void> {\n\t\tthis.permanentlyShutDown = true;\n\t\treturn this.enqueueLifecycleOperation(async () => {\n\t\t\tconst clients = [...this.clients.values()];\n\t\t\tawait this.notifyClientsWillShutdown();\n\t\t\tawait Promise.all(clients.map((client) => client.shutdown().catch(() => undefined)));\n\t\t\tawait Promise.all([...this.starting.values()].map((pending) => pending.catch(() => undefined)));\n\t\t\tthis.clients.clear();\n\t\t\tthis.targets.clear();\n\t\t\tthis.transportStatuses.clear();\n\t\t\tthis.synchronizationErrors.clear();\n\t\t\tthis.starting.clear();\n\t\t});\n\t}\n\n\tprivate enqueueLifecycleOperation(operation: () => Promise<void>): Promise<void> {\n\t\tthis.pendingLifecycleOperations++;\n\t\tthis.lifecycleGeneration++;\n\t\tfor (const listener of this.lifecycleGenerationListeners) listener();\n\t\tthis.lifecycleGenerationListeners.clear();\n\t\tthis.shuttingDown = true;\n\t\tconst result = this.lifecycleQueue.then(operation);\n\t\tthis.lifecycleQueue = result.catch(() => undefined);\n\t\treturn result.finally(() => {\n\t\t\tthis.pendingLifecycleOperations--;\n\t\t\tthis.shuttingDown = this.permanentlyShutDown || this.pendingLifecycleOperations > 0;\n\t\t});\n\t}\n\n\tprivate async discardClientIfStartupStale(\n\t\ttarget: LspRouteTarget,\n\t\tclient: LspClient,\n\t\tgeneration: number,\n\t): Promise<boolean> {\n\t\tif (this.isStartupCurrent(target, client, generation)) return false;\n\t\tawait client.shutdown().catch(() => undefined);\n\t\tif (this.clients.get(target.instanceKey) === client) this.clients.delete(target.instanceKey);\n\t\treturn true;\n\t}\n\n\tprivate async startClient(target: LspRouteTarget, generation: number): Promise<LspClient | undefined> {\n\t\tthis.targets.set(target.instanceKey, target);\n\t\tconst transportStatus: LspTransportStatus = { stderr: \"\", state: \"connecting\" };\n\t\tthis.transportStatuses.set(target.instanceKey, transportStatus);\n\t\tlet connectionFactory: LspConnectionFactory;\n\t\ttry {\n\t\t\tconnectionFactory = this.resolveConnectionFactory(target.server.transport);\n\t\t} catch (error) {\n\t\t\ttransportStatus.lastError = error instanceof Error ? error.message : String(error);\n\t\t\ttransportStatus.state = \"failed\";\n\t\t\treturn undefined;\n\t\t}\n\t\tconst lifecycle = target.server.lifecycle;\n\t\tconst client = this.createClient({\n\t\t\tserverId: target.serverId,\n\t\t\trootDir: target.workspaceRoot,\n\t\t\trootUri: target.workspaceUri,\n\t\t\tlanguageId: target.languageId,\n\t\t\tconnectionFactory,\n\t\t\tconnectTimeoutMs: target.server.timeouts?.connectMs,\n\t\t\tinitializeTimeoutMs: target.server.timeouts?.initializeMs,\n\t\t\trequestTimeoutMs: target.server.timeouts?.requestMs,\n\t\t\tshutdownTimeoutMs: target.server.timeouts?.shutdownMs,\n\t\t\tshutdownMode: lifecycle.type === \"attached\" && lifecycle.shutdown !== \"protocol\" ? \"disconnect\" : \"protocol\",\n\t\t\townership: lifecycle.type,\n\t\t\tinitializationOptions: target.server.initializationOptions,\n\t\t\tsettings: target.server.settings,\n\t\t\tclientInfo: target.server.clientInfo,\n\t\t\tlocale: target.server.locale,\n\t\t\ttrace: target.server.trace,\n\t\t\tonStderr: (text) => {\n\t\t\t\tif (this.lifecycleGeneration === generation) {\n\t\t\t\t\ttransportStatus.stderr = `${transportStatus.stderr}${text}`.slice(-16_384);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonTransportError: (error) => {\n\t\t\t\tif (this.lifecycleGeneration === generation) transportStatus.lastError = error.message;\n\t\t\t},\n\t\t\tonRequestError: (error) => {\n\t\t\t\tif (this.lifecycleGeneration === generation) transportStatus.lastRequestError = error.message;\n\t\t\t},\n\t\t\tonUnexpectedClose: (error) => {\n\t\t\t\tif (this.lifecycleGeneration !== generation) return;\n\t\t\t\ttransportStatus.lastError =\n\t\t\t\t\terror?.message ?? `Connection to LSP server ${target.serverId} closed unexpectedly`;\n\t\t\t\ttransportStatus.state = \"closed\";\n\t\t\t\tif (this.clients.get(target.instanceKey) === client) this.clients.delete(target.instanceKey);\n\t\t\t},\n\t\t});\n\t\tthis.clients.set(target.instanceKey, client);\n\t\ttry {\n\t\t\tconst result = await client.start();\n\t\t\tif (await this.discardClientIfStartupStale(target, client, generation)) return undefined;\n\t\t\ttransportStatus.lastError = undefined;\n\t\t\ttransportStatus.state = \"running\";\n\t\t\ttransportStatus.endpoint = result.endpoint.description;\n\t\t\ttransportStatus.capabilities = result.capabilities;\n\t\t\tawait this.notifyClientStarted({ client, target }, generation, this.recoverySignals.get(target.instanceKey));\n\t\t\tif (await this.discardClientIfStartupStale(target, client, generation)) return undefined;\n\t\t\treturn client;\n\t\t} catch (error) {\n\t\t\tif (this.lifecycleGeneration === generation) {\n\t\t\t\ttransportStatus.lastError = error instanceof Error ? error.message : String(error);\n\t\t\t\ttransportStatus.state = \"failed\";\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate isStartupCurrent(target: LspRouteTarget, client: LspClient, generation: number): boolean {\n\t\treturn (\n\t\t\tthis.lifecycleGeneration === generation &&\n\t\t\t!this.shuttingDown &&\n\t\t\tthis.configuration.enabled &&\n\t\t\tthis.configuration.servers.some((server) => server === target.server) &&\n\t\t\tthis.clients.get(target.instanceKey) === client &&\n\t\t\tclient.isInitialized &&\n\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C,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACnF,eAAe,CAAC,KAAK,GAAG,QAAQ,CAAC;YAClC,CAAC;YACD,OAAO,SAAS,CAAC;QAClB,CAAC;IACF,CAAC;IAEO,gBAAgB,CAAC,MAAsB,EAAE,MAAiB,EAAE,UAAkB;QACrF,OAAO,CACN,IAAI,CAAC,mBAAmB,KAAK,UAAU;YACvC,CAAC,IAAI,CAAC,YAAY;YAClB,IAAI,CAAC,aAAa,CAAC,OAAO;YAC1B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC;YACrE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,MAAM;YAC/C,MAAM,CAAC,aAAa;YACpB,CAAC,MAAM,CAAC,UAAU,CAClB,CAAC;IACH,CAAC;CACD","sourcesContent":["import type { ServerCapabilities } from \"vscode-languageserver-protocol\";\nimport type { ToolBackendInfo, ToolOperations } from \"../tools/operations.ts\";\nimport { waitForAbort } from \"./abort.ts\";\nimport {\n\tLspClient,\n\ttype LspClientOptions,\n\ttype LspClientOwnership,\n\ttype LspConnectionState,\n\ttype LspShutdownMode,\n} from \"./client.ts\";\nimport type { LspConfiguredServer, LspServerFeatures, LspTransport, ResolvedLspConfiguration } from \"./config.ts\";\nimport {\n\ttype LspRouteFailure,\n\ttype LspRouteResult,\n\tLspRouter,\n\ttype LspRouterOptions,\n\ttype LspRouteTarget,\n} from \"./language-map.ts\";\nimport { resolvePortablePath } from \"./portable-path.ts\";\nimport {\n\ttype LspConnectionFactory,\n\ttype LspConnectionFactoryRegistry,\n\tresolveLspConnectionFactory,\n} from \"./transport.ts\";\n\nexport interface LspServerStatus {\n\tserverId: string;\n\tlanguageIds: string[];\n\ttransport: string;\n\tinstanceKey?: string;\n\tworkspaceRoot?: string;\n\tendpoint?: string;\n\trootUri?: string;\n\townership: LspClientOwnership;\n\tshutdownMode: LspShutdownMode;\n\tstate: LspConnectionState;\n\treconnectEligible: boolean;\n\tcapabilities?: ServerCapabilities;\n\trunning: boolean;\n\tstarting: boolean;\n\tdiagnosticsCount: number;\n\tlastError?: string;\n\tlastRequestError?: string;\n\tstderr?: string;\n\tsynchronizationError?: string;\n}\n\nexport type LspConnectionFactoryResolver = (transport: LspTransport) => LspConnectionFactory;\n\nexport interface LspManagerOptions extends LspRouterOptions {\n\tconfiguration?: ResolvedLspConfiguration;\n\tcreateClient?: (options: LspClientOptions) => LspClient;\n\tconnectionFactories?: LspConnectionFactoryRegistry;\n\tresolveConnectionFactory?: LspConnectionFactoryResolver;\n\tgetToolBackendInfo?: () => ToolBackendInfo;\n\tgetToolOperations?: () => ToolOperations;\n}\n\nexport interface LspClientRoute {\n\tclient: LspClient;\n\ttarget: LspRouteTarget;\n}\n\nexport type LspToolFeature = keyof LspServerFeatures;\n\nexport type LspClientRouteFailure = LspRouteFailure;\n\nexport interface LspClientRouteCollection {\n\troutes: LspClientRoute[];\n\tfailures: LspClientRouteFailure[];\n\tmatchedServerCount: number;\n}\n\ninterface LspTransportStatus {\n\tlastError?: string;\n\tlastRequestError?: string;\n\tstderr: string;\n\tstate: LspConnectionState;\n\tendpoint?: string;\n\tcapabilities?: ServerCapabilities;\n}\n\ninterface LspStartupWaiters {\n\tstartup: Promise<LspClient | undefined>;\n\twaiters: Set<object>;\n}\n\nexport type LspClientStartedListener = (route: LspClientRoute, recoverySignal?: AbortSignal) => Promise<void>;\nexport type LspClientsWillShutdownListener = (routes: LspClientRoute[]) => Promise<void>;\n\nconst DISABLED_CONFIGURATION: ResolvedLspConfiguration = { enabled: false, servers: [] };\nconst SYNCHRONIZATION_RECOVERY_TIMEOUT_MS = 3000;\n\nexport class LspManager {\n\tprivate rootDir: string;\n\tprivate readonly createClient: (options: LspClientOptions) => LspClient;\n\tprivate readonly connectionFactories: LspConnectionFactoryRegistry;\n\tprivate readonly resolveConnectionFactory: LspConnectionFactoryResolver;\n\tprivate readonly getToolBackendInfo: (() => ToolBackendInfo) | undefined;\n\tprivate readonly getToolOperations: (() => ToolOperations) | undefined;\n\tprivate toolBackendInfo: ToolBackendInfo | undefined;\n\tprivate toolOperations: ToolOperations | undefined;\n\tprivate activeBackendIdentity: string | undefined;\n\tprivate readonly operationIds = new WeakMap<ToolOperations, number>();\n\tprivate nextOperationId = 1;\n\tprivate readonly inaccessibleRemotePathExists = async (): Promise<boolean> => false;\n\tprivate readonly router: LspRouter;\n\tprivate configuration: ResolvedLspConfiguration;\n\tprivate readonly clients = new Map<string, LspClient>();\n\tprivate readonly targets = new Map<string, LspRouteTarget>();\n\tprivate readonly transportStatuses = new Map<string, LspTransportStatus>();\n\tprivate readonly synchronizationErrors = new Map<string, string>();\n\tprivate readonly clientStartedListeners = new Set<LspClientStartedListener>();\n\tprivate readonly clientsWillShutdownListeners = new Set<LspClientsWillShutdownListener>();\n\tprivate readonly starting = new Map<string, Promise<LspClient | undefined>>();\n\tprivate readonly startupWaiters = new Map<string, LspStartupWaiters>();\n\tprivate readonly recoverySignals = new Map<string, AbortSignal>();\n\tprivate shuttingDown = false;\n\tprivate permanentlyShutDown = false;\n\tprivate pendingLifecycleOperations = 0;\n\tprivate lifecycleGeneration = 0;\n\tprivate readonly lifecycleGenerationListeners = new Set<() => void>();\n\tprivate lifecycleQueue: Promise<void> = Promise.resolve();\n\n\tconstructor(rootDir: string, options: LspManagerOptions = {}) {\n\t\tthis.rootDir = resolvePortablePath(process.cwd(), rootDir);\n\t\tthis.configuration = options.configuration ?? DISABLED_CONFIGURATION;\n\t\tthis.router = new LspRouter(this.rootDir, this.configuration, { pathExists: options.pathExists });\n\t\tthis.createClient = options.createClient ?? ((clientOptions) => new LspClient(clientOptions));\n\t\tthis.connectionFactories = options.connectionFactories ?? {};\n\t\tthis.resolveConnectionFactory =\n\t\t\toptions.resolveConnectionFactory ??\n\t\t\t((transport) => resolveLspConnectionFactory(transport, this.connectionFactories));\n\t\tthis.getToolBackendInfo = options.getToolBackendInfo;\n\t\tthis.getToolOperations = options.getToolOperations;\n\t}\n\n\tget cwd(): string {\n\t\treturn this.rootDir;\n\t}\n\n\tget isShuttingDown(): boolean {\n\t\treturn this.shuttingDown;\n\t}\n\n\tresolvePath(filePath: string): string {\n\t\treturn resolvePortablePath(this.rootDir, filePath);\n\t}\n\n\tsetConfiguration(configuration: ResolvedLspConfiguration): Promise<void> {\n\t\treturn this.enqueueLifecycleOperation(async () => {\n\t\t\tconst clients = [...this.clients.values()];\n\t\t\tawait this.notifyClientsWillShutdown();\n\t\t\tawait Promise.all(clients.map((client) => client.shutdown().catch(() => undefined)));\n\t\t\tawait Promise.all([...this.starting.values()].map((pending) => pending.catch(() => undefined)));\n\t\t\tthis.clients.clear();\n\t\t\tthis.targets.clear();\n\t\t\tthis.transportStatuses.clear();\n\t\t\tthis.synchronizationErrors.clear();\n\t\t\tthis.starting.clear();\n\t\t\tthis.configuration = configuration;\n\t\t\tthis.router.setConfiguration(configuration);\n\t\t});\n\t}\n\n\tclearRoutingCache(): void {\n\t\tthis.router.clearCache();\n\t}\n\n\tasync resolveTargets(filePath: string, signal?: AbortSignal): Promise<LspRouteResult> {\n\t\tconst operations = this.getToolOperations?.();\n\t\tif (operations) await waitForAbort(this.setToolOperations(operations), signal);\n\t\tif (!this.configuration.enabled) return { targets: [], failures: [] };\n\t\tconst backend = this.toolBackendInfo ?? this.toolOperations?.getBackendInfo?.() ?? this.getToolBackendInfo?.();\n\t\tif (!this.toolOperations && backend && backend.type !== \"local\") {\n\t\t\tthis.rootDir = resolvePortablePath(process.cwd(), backend.cwd);\n\t\t\tthis.router.setRoutingContext(this.rootDir, this.inaccessibleRemotePathExists);\n\t\t}\n\t\tconst route = await waitForAbort(this.router.routeFile(filePath, signal), signal);\n\t\tif (!backend || backend.type === \"local\") return route;\n\t\tconst targets: LspRouteTarget[] = [];\n\t\tconst failures = [...route.failures];\n\t\tfor (const target of route.targets) {\n\t\t\tconst reason = this.getBackendCompatibilityReason(target, backend);\n\t\t\tif (reason) {\n\t\t\t\tthis.targets.set(target.instanceKey, target);\n\t\t\t\tthis.synchronizationErrors.set(target.instanceKey, reason);\n\t\t\t\tfailures.push({ serverId: target.serverId, reason });\n\t\t\t} else {\n\t\t\t\ttargets.push(target);\n\t\t\t}\n\t\t}\n\t\treturn { targets, failures };\n\t}\n\n\tasync getPrimaryTarget(filePath: string, signal?: AbortSignal): Promise<LspRouteTarget | undefined> {\n\t\treturn (await this.resolveTargets(filePath, signal)).targets[0];\n\t}\n\n\tgetRunningClient(instanceKey: string): LspClient | undefined {\n\t\tconst client = this.clients.get(instanceKey);\n\t\treturn client?.isInitialized === true && !client.isDisposed ? client : undefined;\n\t}\n\n\tsetToolBackendInfo(backend: ToolBackendInfo): void {\n\t\tthis.toolBackendInfo = backend;\n\t}\n\n\tasync setToolOperations(operations: ToolOperations, signal?: AbortSignal): Promise<void> {\n\t\tconst backend = operations.getBackendInfo?.() ?? { type: \"local\" as const, cwd: operations.cwd };\n\t\tlet operationId = this.operationIds.get(operations);\n\t\tif (operationId === undefined) {\n\t\t\toperationId = this.nextOperationId++;\n\t\t\tthis.operationIds.set(operations, operationId);\n\t\t}\n\t\tconst identity = JSON.stringify([operationId, backend]);\n\t\tif (identity === this.activeBackendIdentity) {\n\t\t\tthis.toolOperations = operations;\n\t\t\tthis.toolBackendInfo = backend;\n\t\t\treturn;\n\t\t}\n\t\tconst nextRoot = resolvePortablePath(process.cwd(), operations.cwd);\n\t\tconst apply = () => {\n\t\t\tthis.toolOperations = operations;\n\t\t\tthis.toolBackendInfo = backend;\n\t\t\tthis.activeBackendIdentity = identity;\n\t\t\tthis.rootDir = nextRoot;\n\t\t\tthis.router.setRoutingContext(nextRoot, async (path) => {\n\t\t\t\tawait operations.access(path, \"exists\");\n\t\t\t\treturn true;\n\t\t\t});\n\t\t};\n\t\tconst defaultLocalContext =\n\t\t\tthis.activeBackendIdentity === undefined && backend.type === \"local\" && nextRoot === this.rootDir;\n\t\tif (defaultLocalContext || (this.clients.size === 0 && this.starting.size === 0)) {\n\t\t\tapply();\n\t\t\treturn;\n\t\t}\n\t\tawait waitForAbort(\n\t\t\tthis.enqueueLifecycleOperation(async () => {\n\t\t\t\tconst clients = [...this.clients.values()];\n\t\t\t\tawait this.notifyClientsWillShutdown();\n\t\t\t\tawait Promise.all(clients.map((client) => client.shutdown().catch(() => undefined)));\n\t\t\t\tawait Promise.all([...this.starting.values()].map((pending) => pending.catch(() => undefined)));\n\t\t\t\tthis.clients.clear();\n\t\t\t\tthis.targets.clear();\n\t\t\t\tthis.transportStatuses.clear();\n\t\t\t\tthis.synchronizationErrors.clear();\n\t\t\t\tthis.starting.clear();\n\t\t\t\tapply();\n\t\t\t}),\n\t\t\tsignal,\n\t\t);\n\t}\n\n\tonClientStarted(listener: LspClientStartedListener): () => void {\n\t\tthis.clientStartedListeners.add(listener);\n\t\treturn () => this.clientStartedListeners.delete(listener);\n\t}\n\n\tonClientsWillShutdown(listener: LspClientsWillShutdownListener): () => void {\n\t\tthis.clientsWillShutdownListeners.add(listener);\n\t\treturn () => this.clientsWillShutdownListeners.delete(listener);\n\t}\n\n\treportSynchronizationUnavailable(target: LspRouteTarget, reason: string | undefined): void {\n\t\tthis.targets.set(target.instanceKey, target);\n\t\tif (reason) this.synchronizationErrors.set(target.instanceKey, reason);\n\t\telse this.synchronizationErrors.delete(target.instanceKey);\n\t}\n\n\treportSynchronizationError(target: LspRouteTarget | string, error: unknown): void {\n\t\tconst instanceKey = typeof target === \"string\" ? target : target.instanceKey;\n\t\tconst resolvedTarget = typeof target === \"string\" ? this.targets.get(target) : target;\n\t\tif (resolvedTarget) this.targets.set(instanceKey, resolvedTarget);\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconst identity = resolvedTarget\n\t\t\t? `server ${resolvedTarget.serverId} instance ${resolvedTarget.instanceKey}`\n\t\t\t: `instance ${instanceKey}`;\n\t\tthis.synchronizationErrors.set(instanceKey, `Synchronization failed for ${identity}: ${detail}`);\n\t}\n\n\tasync invalidateSynchronizationClient(\n\t\ttarget: LspRouteTarget,\n\t\tclient: LspClient,\n\t\terror: unknown,\n\t\treconnect = true,\n\t): Promise<void> {\n\t\tconst current = this.clients.get(target.instanceKey);\n\t\tif (current !== undefined && current !== client) {\n\t\t\tvoid client.invalidate();\n\t\t\treturn;\n\t\t}\n\t\tif (current === client) {\n\t\t\tthis.clients.delete(target.instanceKey);\n\t\t\tconst transportStatus = this.transportStatuses.get(target.instanceKey);\n\t\t\tif (transportStatus?.state === \"running\") transportStatus.state = \"closed\";\n\t\t}\n\t\tthis.reportSynchronizationError(target, error);\n\t\tvoid client.invalidate();\n\t\tif (!reconnect) return;\n\t\tconst generation = this.lifecycleGeneration;\n\t\tqueueMicrotask(() => {\n\t\t\tif (\n\t\t\t\tthis.lifecycleGeneration !== generation ||\n\t\t\t\tthis.shuttingDown ||\n\t\t\t\t!this.configuration.enabled ||\n\t\t\t\t!this.configuration.servers.some((server) => server === target.server)\n\t\t\t)\n\t\t\t\treturn;\n\t\t\tconst configuredTimeout = target.server.timeouts?.requestMs;\n\t\t\tconst recoveryTimeoutMs =\n\t\t\t\tconfiguredTimeout !== undefined && configuredTimeout > 0\n\t\t\t\t\t? Math.min(configuredTimeout, SYNCHRONIZATION_RECOVERY_TIMEOUT_MS)\n\t\t\t\t\t: SYNCHRONIZATION_RECOVERY_TIMEOUT_MS;\n\t\t\tconst recoverySignal = AbortSignal.timeout(recoveryTimeoutMs);\n\t\t\tthis.recoverySignals.set(target.instanceKey, recoverySignal);\n\t\t\tvoid this.getClientForTarget(target, recoverySignal).catch(() => undefined);\n\t\t});\n\t}\n\n\tgetSynchronizationCompatibilityReason(\n\t\ttarget: LspRouteTarget,\n\t\tbackend: ToolBackendInfo | undefined,\n\t): string | undefined {\n\t\tif (!backend || backend.type === \"local\") return undefined;\n\t\treturn this.getBackendCompatibilityReason(target, backend);\n\t}\n\tgetRunningClients(): LspClientRoute[] {\n\t\tconst serverOrder = new Map(this.configuration.servers.map((server, index) => [server, index]));\n\t\treturn [...this.clients.entries()]\n\t\t\t.flatMap(([instanceKey, client]) => {\n\t\t\t\tconst target = this.targets.get(instanceKey);\n\t\t\t\treturn target && client.isInitialized && !client.isDisposed ? [{ client, target }] : [];\n\t\t\t})\n\t\t\t.sort(\n\t\t\t\t(left, right) =>\n\t\t\t\t\t(right.target.server.priority ?? 0) - (left.target.server.priority ?? 0) ||\n\t\t\t\t\t(serverOrder.get(left.target.server) ?? Number.MAX_SAFE_INTEGER) -\n\t\t\t\t\t\t(serverOrder.get(right.target.server) ?? Number.MAX_SAFE_INTEGER) ||\n\t\t\t\t\tleft.target.instanceKey.localeCompare(right.target.instanceKey),\n\t\t\t);\n\t}\n\n\tisStarting(instanceKey: string): boolean {\n\t\treturn this.starting.has(instanceKey);\n\t}\n\n\tasync getClientRouteForFile(filePath: string, signal?: AbortSignal): Promise<LspClientRoute | undefined> {\n\t\tconst target = await this.getPrimaryTarget(filePath, signal);\n\t\tif (!target) return undefined;\n\t\tconst client = await this.getClientForTarget(target, signal);\n\t\treturn client ? { client, target } : undefined;\n\t}\n\n\tasync getClientForFile(filePath: string, signal?: AbortSignal): Promise<LspClient | undefined> {\n\t\treturn (await this.getClientRouteForFile(filePath, signal))?.client;\n\t}\n\n\tasync getClientRoutesForFeature(\n\t\tfilePath: string,\n\t\tfeature: LspToolFeature,\n\t\tsignal?: AbortSignal,\n\t): Promise<LspClientRouteCollection> {\n\t\tconst resolved = await this.resolveTargets(filePath, signal);\n\t\tconst outcomes = await waitForAbort(\n\t\t\tPromise.all(\n\t\t\t\tresolved.targets.map(async (target) => {\n\t\t\t\t\tif (target.server.features?.[feature] === false) {\n\t\t\t\t\t\treturn { failure: { serverId: target.serverId, reason: `${feature} is disabled by configuration` } };\n\t\t\t\t\t}\n\t\t\t\t\tconst client = await this.getClientForTarget(target, signal);\n\t\t\t\t\tif (!client) {\n\t\t\t\t\t\treturn { failure: { serverId: target.serverId, reason: this.getTargetUnavailableReason(target) } };\n\t\t\t\t\t}\n\t\t\t\t\tconst unsupported = this.getUnsupportedCapabilityReason(client.serverCapabilities, feature);\n\t\t\t\t\tif (unsupported) return { failure: { serverId: target.serverId, reason: unsupported } };\n\t\t\t\t\treturn { route: { client, target } };\n\t\t\t\t}),\n\t\t\t),\n\t\t\tsignal,\n\t\t);\n\t\treturn {\n\t\t\troutes: outcomes.flatMap((outcome) => (outcome.route ? [outcome.route] : [])),\n\t\t\tfailures: [...resolved.failures, ...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : []))],\n\t\t\tmatchedServerCount: resolved.targets.length + resolved.failures.length,\n\t\t};\n\t}\n\n\tasync getClientForTarget(target: LspRouteTarget, signal?: AbortSignal): Promise<LspClient | undefined> {\n\t\tif (!this.configuration.enabled) return undefined;\n\t\tif (!this.configuration.servers.some((server) => server === target.server)) return undefined;\n\t\tconst backend = this.toolBackendInfo ?? this.toolOperations?.getBackendInfo?.() ?? this.getToolBackendInfo?.();\n\t\tif (backend && backend.type !== \"local\") {\n\t\t\tconst reason = this.getBackendCompatibilityReason(target, backend);\n\t\t\tif (reason) {\n\t\t\t\tthis.reportSynchronizationUnavailable(target, reason);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\tif (this.shuttingDown) return undefined;\n\t\tconst running = this.getRunningClient(target.instanceKey);\n\t\tif (running) return running;\n\t\tconst pending = this.starting.get(target.instanceKey);\n\t\tif (pending) return this.waitForClientStartup(target.instanceKey, pending, signal);\n\n\t\tconst generation = this.lifecycleGeneration;\n\t\tconst start = this.startClient(target, generation);\n\t\tthis.starting.set(target.instanceKey, start);\n\t\tvoid start.finally(() => {\n\t\t\tif (this.starting.get(target.instanceKey) === start) {\n\t\t\t\tthis.starting.delete(target.instanceKey);\n\t\t\t\tthis.recoverySignals.delete(target.instanceKey);\n\t\t\t}\n\t\t\tif (this.startupWaiters.get(target.instanceKey)?.startup === start) {\n\t\t\t\tthis.startupWaiters.delete(target.instanceKey);\n\t\t\t}\n\t\t});\n\t\treturn this.waitForClientStartup(target.instanceKey, start, signal);\n\t}\n\n\tprivate async waitForClientStartup(\n\t\tinstanceKey: string,\n\t\tstartup: Promise<LspClient | undefined>,\n\t\tsignal: AbortSignal | undefined,\n\t): Promise<LspClient | undefined> {\n\t\tconst token = {};\n\t\tlet state = this.startupWaiters.get(instanceKey);\n\t\tif (!state || state.startup !== startup) {\n\t\t\tstate = { startup, waiters: new Set<object>() };\n\t\t\tthis.startupWaiters.set(instanceKey, state);\n\t\t}\n\t\tstate.waiters.add(token);\n\t\ttry {\n\t\t\treturn await waitForAbort(startup, signal);\n\t\t} finally {\n\t\t\tstate.waiters.delete(token);\n\t\t\tif (state.waiters.size === 0 && this.startupWaiters.get(instanceKey) === state) {\n\t\t\t\tthis.startupWaiters.delete(instanceKey);\n\t\t\t\tif (signal?.aborted && this.starting.get(instanceKey) === startup) {\n\t\t\t\t\tconst orphanedClient = this.clients.get(instanceKey);\n\t\t\t\t\tthis.starting.delete(instanceKey);\n\t\t\t\t\tthis.recoverySignals.delete(instanceKey);\n\t\t\t\t\tif (this.clients.get(instanceKey) === orphanedClient) this.clients.delete(instanceKey);\n\t\t\t\t\tawait orphanedClient?.invalidate().catch(() => undefined);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tasync getUnavailableReason(filePath: string, signal?: AbortSignal): Promise<string> {\n\t\tif (!this.configuration.enabled) return \"LSP is disabled.\";\n\t\tconst route = await this.resolveTargets(filePath, signal);\n\t\tif (route.targets.length === 0) {\n\t\t\tif (route.failures.length > 0)\n\t\t\t\treturn route.failures.map((failure) => `${failure.serverId}: ${failure.reason}`).join(\"; \");\n\t\t\treturn `No configured LSP document selector matched: ${filePath}`;\n\t\t}\n\t\tconst target = route.targets[0];\n\t\tif (this.starting.has(target.instanceKey)) return `LSP server ${target.serverId} is starting. Retry shortly.`;\n\t\tconst synchronizationError = this.synchronizationErrors.get(target.instanceKey);\n\t\tif (synchronizationError) return `LSP server ${target.serverId} is unavailable: ${synchronizationError}`;\n\t\tconst error = this.transportStatuses.get(target.instanceKey)?.lastError;\n\t\tif (error) return `LSP server ${target.serverId} is unavailable: ${error}`;\n\t\treturn `No running LSP server for ${filePath}. Call an LSP tool for this file to start it.`;\n\t}\n\n\tprivate shutdownModeForServer(server: LspConfiguredServer): LspShutdownMode {\n\t\treturn server.lifecycle.type === \"attached\" && server.lifecycle.shutdown !== \"protocol\"\n\t\t\t? \"disconnect\"\n\t\t\t: \"protocol\";\n\t}\n\n\tprivate countClientDiagnostics(client: LspClient | undefined): number {\n\t\tif (!client) return 0;\n\t\tlet count = 0;\n\t\tfor (const diagnostics of client.getAllDiagnostics().values()) count += diagnostics.length;\n\t\treturn count;\n\t}\n\n\tprivate createRunningServerStatus(instanceKey: string, target: LspRouteTarget): LspServerStatus {\n\t\tconst client = this.clients.get(instanceKey);\n\t\tconst transportStatus = this.transportStatuses.get(instanceKey);\n\t\tconst status: LspServerStatus = {\n\t\t\tserverId: target.serverId,\n\t\t\tlanguageIds: [...new Set(target.server.selectors.map((selector) => selector.languageId))],\n\t\t\ttransport: target.server.transport.type,\n\t\t\tinstanceKey,\n\t\t\tworkspaceRoot: target.workspaceRoot,\n\t\t\trootUri: target.workspaceUri,\n\t\t\townership: target.server.lifecycle.type,\n\t\t\tshutdownMode: this.shutdownModeForServer(target.server),\n\t\t\tstate: client?.connectionState ?? transportStatus?.state ?? \"idle\",\n\t\t\treconnectEligible: !this.shuttingDown && (client === undefined || !client.isDisposed),\n\t\t\trunning: client?.isInitialized === true && !client.isDisposed,\n\t\t\tstarting: this.starting.has(instanceKey),\n\t\t\tdiagnosticsCount: this.countClientDiagnostics(client),\n\t\t};\n\t\tif (client?.connectionEndpoint || transportStatus?.endpoint) {\n\t\t\tstatus.endpoint = client?.connectionEndpoint?.description ?? transportStatus?.endpoint;\n\t\t}\n\t\tif (client?.serverCapabilities || transportStatus?.capabilities) {\n\t\t\tstatus.capabilities = client?.serverCapabilities ?? transportStatus?.capabilities;\n\t\t}\n\t\tif (transportStatus?.lastError) status.lastError = transportStatus.lastError;\n\t\tif (transportStatus?.lastRequestError) status.lastRequestError = transportStatus.lastRequestError;\n\t\tif (transportStatus?.stderr) status.stderr = transportStatus.stderr;\n\t\tconst synchronizationError = this.synchronizationErrors.get(instanceKey);\n\t\tif (synchronizationError) status.synchronizationError = synchronizationError;\n\t\treturn status;\n\t}\n\n\tgetStatus(): LspServerStatus[] {\n\t\tconst runningStatuses = [...this.targets.entries()].map(([instanceKey, target]) =>\n\t\t\tthis.createRunningServerStatus(instanceKey, target),\n\t\t);\n\t\tconst instantiated = new Set(runningStatuses.map((status) => status.serverId));\n\t\tconst statuses = [\n\t\t\t...runningStatuses,\n\t\t\t...this.configuration.servers\n\t\t\t\t.filter((server) => !instantiated.has(server.id))\n\t\t\t\t.map(\n\t\t\t\t\t(server): LspServerStatus => ({\n\t\t\t\t\t\tserverId: server.id,\n\t\t\t\t\t\tlanguageIds: [...new Set(server.selectors.map((selector) => selector.languageId))],\n\t\t\t\t\t\ttransport: server.transport.type,\n\t\t\t\t\t\townership: server.lifecycle.type,\n\t\t\t\t\t\tshutdownMode: this.shutdownModeForServer(server),\n\t\t\t\t\t\tstate: \"idle\" as const,\n\t\t\t\t\t\treconnectEligible: !this.shuttingDown,\n\t\t\t\t\t\trunning: false,\n\t\t\t\t\t\tstarting: false,\n\t\t\t\t\t\tdiagnosticsCount: 0,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t];\n\t\tconst serverOrder = new Map(this.configuration.servers.map((server, index) => [server.id, index]));\n\t\treturn statuses.sort(\n\t\t\t(left, right) =>\n\t\t\t\t(serverOrder.get(left.serverId) ?? Number.MAX_SAFE_INTEGER) -\n\t\t\t\t\t(serverOrder.get(right.serverId) ?? Number.MAX_SAFE_INTEGER) ||\n\t\t\t\t(left.instanceKey ?? \"\").localeCompare(right.instanceKey ?? \"\"),\n\t\t);\n\t}\n\tprivate async notifyClientStarted(\n\t\troute: LspClientRoute,\n\t\tgeneration: number,\n\t\trecoverySignal?: AbortSignal,\n\t): Promise<void> {\n\t\tfor (const listener of this.clientStartedListeners) {\n\t\t\tif (this.lifecycleGeneration !== generation) return;\n\t\t\tlet generationChanged!: () => void;\n\t\t\tconst changed = new Promise<false>((resolve) => {\n\t\t\t\tgenerationChanged = () => resolve(false);\n\t\t\t});\n\t\t\tthis.lifecycleGenerationListeners.add(generationChanged);\n\t\t\tif (this.lifecycleGeneration !== generation) generationChanged();\n\t\t\tconst completed = await Promise.race([\n\t\t\t\tPromise.resolve()\n\t\t\t\t\t.then(() => listener(route, recoverySignal))\n\t\t\t\t\t.then(\n\t\t\t\t\t\t() => true,\n\t\t\t\t\t\t() => true,\n\t\t\t\t\t),\n\t\t\t\tchanged,\n\t\t\t]);\n\t\t\tthis.lifecycleGenerationListeners.delete(generationChanged);\n\t\t\tif (!completed || this.lifecycleGeneration !== generation) return;\n\t\t}\n\t}\n\n\tprivate async notifyClientsWillShutdown(): Promise<void> {\n\t\tconst routes = this.getRunningClients();\n\t\tconst notifications = [...this.clientsWillShutdownListeners].map((listener) =>\n\t\t\tPromise.resolve()\n\t\t\t\t.then(() => listener(routes))\n\t\t\t\t.catch(() => undefined),\n\t\t);\n\t\tif (notifications.length === 0) return;\n\t\tconst lifecycleTargets = routes.length > 0 ? routes.map((route) => route.target) : [...this.targets.values()];\n\t\tconst timeoutMs =\n\t\t\tlifecycleTargets.length === 0\n\t\t\t\t? 3000\n\t\t\t\t: Math.max(...lifecycleTargets.map((target) => target.server.timeouts?.shutdownMs ?? 3000));\n\t\tconst completed = Promise.all(notifications).then(() => undefined);\n\t\tif (timeoutMs === 0) {\n\t\t\tawait completed;\n\t\t\treturn;\n\t\t}\n\t\tlet timer: NodeJS.Timeout | undefined;\n\t\ttry {\n\t\t\tawait Promise.race([\n\t\t\t\tcompleted,\n\t\t\t\tnew Promise<void>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(resolve, timeoutMs);\n\t\t\t\t}),\n\t\t\t]);\n\t\t} finally {\n\t\t\tif (timer) clearTimeout(timer);\n\t\t}\n\t}\n\n\tprivate getUnsupportedCapabilityReason(\n\t\tcapabilities: ServerCapabilities | undefined,\n\t\tfeature: LspToolFeature,\n\t): string | undefined {\n\t\t// publishDiagnostics is a server notification and has no corresponding provider capability.\n\t\tif (feature === \"diagnostics\") return undefined;\n\t\tconst supported =\n\t\t\tfeature === \"hover\"\n\t\t\t\t? capabilities?.hoverProvider\n\t\t\t\t: feature === \"definition\"\n\t\t\t\t\t? capabilities?.definitionProvider\n\t\t\t\t\t: feature === \"references\"\n\t\t\t\t\t\t? capabilities?.referencesProvider\n\t\t\t\t\t\t: feature === \"rename\"\n\t\t\t\t\t\t\t? capabilities?.renameProvider\n\t\t\t\t\t\t\t: capabilities?.codeActionProvider;\n\t\treturn supported ? undefined : `server does not advertise ${feature} capability`;\n\t}\n\n\tprivate getTargetUnavailableReason(target: LspRouteTarget): string {\n\t\tconst synchronizationError = this.synchronizationErrors.get(target.instanceKey);\n\t\tif (synchronizationError) return synchronizationError;\n\t\tconst status = this.transportStatuses.get(target.instanceKey);\n\t\tif (status?.lastError) return status.lastError;\n\t\tif (this.starting.has(target.instanceKey)) return \"server is still starting\";\n\t\tif (this.shuttingDown) return \"LSP lifecycle shutdown or reconfiguration is in progress\";\n\t\treturn \"server could not be started\";\n\t}\n\n\tprivate getBackendCompatibilityReason(target: LspRouteTarget, backend: ToolBackendInfo): string | undefined {\n\t\tif (\"configured\" in backend && backend.configured === false) {\n\t\t\treturn `ToolOperations backend ${backend.type} is not configured`;\n\t\t}\n\t\tif ((target.server.pathMappings?.length ?? 0) === 0) {\n\t\t\treturn `ToolOperations backend ${backend.type} requires explicit LSP pathMappings`;\n\t\t}\n\t\tconst mappedBackendRoot = target.mapper.agentPathToServerUri(backend.cwd);\n\t\tif (!mappedBackendRoot.ok) {\n\t\t\treturn `ToolOperations backend root ${backend.cwd} cannot be mapped to the server workspace: ${mappedBackendRoot.reason}`;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tshutdownAll(): Promise<void> {\n\t\tthis.permanentlyShutDown = true;\n\t\treturn this.enqueueLifecycleOperation(async () => {\n\t\t\tconst clients = [...this.clients.values()];\n\t\t\tawait this.notifyClientsWillShutdown();\n\t\t\tawait Promise.all(clients.map((client) => client.shutdown().catch(() => undefined)));\n\t\t\tawait Promise.all([...this.starting.values()].map((pending) => pending.catch(() => undefined)));\n\t\t\tthis.clients.clear();\n\t\t\tthis.targets.clear();\n\t\t\tthis.transportStatuses.clear();\n\t\t\tthis.synchronizationErrors.clear();\n\t\t\tthis.starting.clear();\n\t\t});\n\t}\n\n\tprivate enqueueLifecycleOperation(operation: () => Promise<void>): Promise<void> {\n\t\tthis.pendingLifecycleOperations++;\n\t\tthis.lifecycleGeneration++;\n\t\tfor (const listener of this.lifecycleGenerationListeners) listener();\n\t\tthis.lifecycleGenerationListeners.clear();\n\t\tthis.shuttingDown = true;\n\t\tconst result = this.lifecycleQueue.then(operation);\n\t\tthis.lifecycleQueue = result.catch(() => undefined);\n\t\treturn result.finally(() => {\n\t\t\tthis.pendingLifecycleOperations--;\n\t\t\tthis.shuttingDown = this.permanentlyShutDown || this.pendingLifecycleOperations > 0;\n\t\t});\n\t}\n\n\tprivate async discardClientIfStartupStale(\n\t\ttarget: LspRouteTarget,\n\t\tclient: LspClient,\n\t\tgeneration: number,\n\t): Promise<boolean> {\n\t\tif (this.isStartupCurrent(target, client, generation)) return false;\n\t\tawait client.shutdown().catch(() => undefined);\n\t\tif (this.clients.get(target.instanceKey) === client) this.clients.delete(target.instanceKey);\n\t\treturn true;\n\t}\n\n\tprivate async startClient(target: LspRouteTarget, generation: number): Promise<LspClient | undefined> {\n\t\tthis.targets.set(target.instanceKey, target);\n\t\tconst transportStatus: LspTransportStatus = { stderr: \"\", state: \"connecting\" };\n\t\tthis.transportStatuses.set(target.instanceKey, transportStatus);\n\t\tlet connectionFactory: LspConnectionFactory;\n\t\ttry {\n\t\t\tconnectionFactory = this.resolveConnectionFactory(target.server.transport);\n\t\t} catch (error) {\n\t\t\ttransportStatus.lastError = error instanceof Error ? error.message : String(error);\n\t\t\ttransportStatus.state = \"failed\";\n\t\t\treturn undefined;\n\t\t}\n\t\tconst lifecycle = target.server.lifecycle;\n\t\tconst client = this.createClient({\n\t\t\tserverId: target.serverId,\n\t\t\trootDir: target.workspaceRoot,\n\t\t\trootUri: target.workspaceUri,\n\t\t\tlanguageId: target.languageId,\n\t\t\tconnectionFactory,\n\t\t\tconnectTimeoutMs: target.server.timeouts?.connectMs,\n\t\t\tinitializeTimeoutMs: target.server.timeouts?.initializeMs,\n\t\t\trequestTimeoutMs: target.server.timeouts?.requestMs,\n\t\t\tshutdownTimeoutMs: target.server.timeouts?.shutdownMs,\n\t\t\tshutdownMode: lifecycle.type === \"attached\" && lifecycle.shutdown !== \"protocol\" ? \"disconnect\" : \"protocol\",\n\t\t\townership: lifecycle.type,\n\t\t\tinitializationOptions: target.server.initializationOptions,\n\t\t\tsettings: target.server.settings,\n\t\t\tclientInfo: target.server.clientInfo,\n\t\t\tlocale: target.server.locale,\n\t\t\ttrace: target.server.trace,\n\t\t\tonStderr: (text) => {\n\t\t\t\tif (this.lifecycleGeneration === generation) {\n\t\t\t\t\ttransportStatus.stderr = `${transportStatus.stderr}${text}`.slice(-16_384);\n\t\t\t\t}\n\t\t\t},\n\t\t\tonTransportError: (error) => {\n\t\t\t\tif (this.lifecycleGeneration === generation) transportStatus.lastError = error.message;\n\t\t\t},\n\t\t\tonRequestError: (error) => {\n\t\t\t\tif (this.lifecycleGeneration === generation) transportStatus.lastRequestError = error.message;\n\t\t\t},\n\t\t\tonUnexpectedClose: (error) => {\n\t\t\t\tif (this.lifecycleGeneration !== generation) return;\n\t\t\t\ttransportStatus.lastError =\n\t\t\t\t\terror?.message ?? `Connection to LSP server ${target.serverId} closed unexpectedly`;\n\t\t\t\ttransportStatus.state = \"closed\";\n\t\t\t\tif (this.clients.get(target.instanceKey) === client) this.clients.delete(target.instanceKey);\n\t\t\t},\n\t\t});\n\t\tthis.clients.set(target.instanceKey, client);\n\t\ttry {\n\t\t\tconst result = await client.start();\n\t\t\tif (await this.discardClientIfStartupStale(target, client, generation)) return undefined;\n\t\t\ttransportStatus.lastError = undefined;\n\t\t\ttransportStatus.state = \"running\";\n\t\t\ttransportStatus.endpoint = result.endpoint.description;\n\t\t\ttransportStatus.capabilities = result.capabilities;\n\t\t\tawait this.notifyClientStarted({ client, target }, generation, this.recoverySignals.get(target.instanceKey));\n\t\t\tif (await this.discardClientIfStartupStale(target, client, generation)) return undefined;\n\t\t\treturn client;\n\t\t} catch (error) {\n\t\t\tif (this.lifecycleGeneration === generation) {\n\t\t\t\ttransportStatus.lastError = error instanceof Error ? error.message : String(error);\n\t\t\t\ttransportStatus.state = \"failed\";\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate isStartupCurrent(target: LspRouteTarget, client: LspClient, generation: number): boolean {\n\t\treturn (\n\t\t\tthis.lifecycleGeneration === generation &&\n\t\t\t!this.shuttingDown &&\n\t\t\tthis.configuration.enabled &&\n\t\t\tthis.configuration.servers.some((server) => server === target.server) &&\n\t\t\tthis.clients.get(target.instanceKey) === client &&\n\t\t\tclient.isInitialized &&\n\t\t\t!client.isDisposed\n\t\t);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/core/lsp/navigation.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAU5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAkBxD,QAAA,MAAM,WAAW;;;;EAA8B,CAAC;AAChD,QAAA,MAAM,gBAAgB;;;;EAA8B,CAAC;AACrD,QAAA,MAAM,gBAAgB;;;;;EAKpB,CAAC;AAKH,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AA4MD,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,EAAE,MAAM,cAAc,GAClC,cAAc,CAAC,OAAO,WAAW,EAAE,eAAe,CAAC,CA4CrD;AAED,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,EAAE,MAAM,cAAc,GAClC,cAAc,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC,CA+E7D;AAED,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,EAAE,MAAM,cAAc,GAClC,cAAc,CAAC,OAAO,gBAAgB,EAAE,kBAAkB,CAAC,CAyF7D","sourcesContent":["import { Text } from \"@greppleai/grip-tui\";\nimport { type Static, Type } from \"typebox\";\nimport type {\n\tHover,\n\tLocation,\n\tLocationLink,\n\tMarkedString,\n\tMarkupContent,\n\tPosition,\n\tRange,\n} from \"vscode-languageserver-protocol\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport type { ToolOperations } from \"../tools/operations.ts\";\nimport { throwIfAborted } from \"./abort.ts\";\nimport type { LspRuntimeState } from \"./integration.ts\";\nimport type {\n\tLspClientRoute,\n\tLspClientRouteCollection,\n\tLspClientRouteFailure,\n\tLspManager,\n\tLspToolFeature,\n} from \"./manager.ts\";\nimport { relativePortablePath } from \"./portable-path.ts\";\n\nconst MAX_REFERENCES = 80;\n\nconst positionFields = {\n\tpath: Type.String({ description: \"File path\" }),\n\tline: Type.Integer({ minimum: 1, description: \"Line number, 1-indexed\" }),\n\tcharacter: Type.Integer({ minimum: 1, description: \"Column number, 1-indexed\" }),\n};\n\nconst hoverSchema = Type.Object(positionFields);\nconst definitionSchema = Type.Object(positionFields);\nconst referencesSchema = Type.Object({\n\t...positionFields,\n\tincludeDeclaration: Type.Optional(\n\t\tType.Boolean({ description: \"Include the declaration in results. Defaults to true.\" }),\n\t),\n});\n\ntype PositionInput = Static<typeof hoverSchema>;\ntype ReferencesInput = Static<typeof referencesSchema>;\n\nexport interface LspHoverDetails {\n\tfound: boolean;\n}\n\nexport interface LspLocationDetails {\n\tcount: number;\n\ttruncated?: boolean;\n}\n\ntype DefinitionResult = Location | Location[] | LocationLink[] | null;\ntype LspHoverContents = MarkupContent | MarkedString | MarkedString[];\n\ninterface NormalizedLocation {\n\tkey: string;\n\tvalue: string;\n}\n\ninterface AttributedLocation {\n\tvalue: string;\n\tserverIds: string[];\n}\n\ninterface ServerNormalizedLocations {\n\tserverId: string;\n\tvalues: NormalizedLocation[];\n}\n\nfunction toPosition(input: PositionInput): Position {\n\treturn { line: input.line - 1, character: input.character - 1 };\n}\n\nfunction formatMappedUri(manager: LspManager, route: LspClientRoute, uri: string): string {\n\tconst mapped = route.target.mapper.serverUriToAgentPath(uri);\n\treturn mapped.ok ? relativePortablePath(manager.cwd, mapped.value) : `[unmapped URI: ${mapped.reason}]`;\n}\n\nfunction formatRangeStart(range: Range): string {\n\treturn `${range.start.line + 1}:${range.start.character + 1}`;\n}\n\nfunction normalizeLocation(state: LspRuntimeState, route: LspClientRoute, location: Location): NormalizedLocation {\n\tconst path = formatMappedUri(state.manager, route, location.uri);\n\treturn {\n\t\tkey: JSON.stringify({ path, range: location.range }),\n\t\tvalue: `${path}:${formatRangeStart(location.range)}`,\n\t};\n}\n\nfunction normalizeLocationLink(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tlocation: LocationLink,\n): NormalizedLocation {\n\tconst path = formatMappedUri(state.manager, route, location.targetUri);\n\treturn {\n\t\tkey: JSON.stringify({ path, range: location.targetSelectionRange }),\n\t\tvalue: `${path}:${formatRangeStart(location.targetSelectionRange)}`,\n\t};\n}\n\nfunction isLocationLinkArray(value: Location[] | LocationLink[]): value is LocationLink[] {\n\treturn value.length > 0 && \"targetUri\" in value[0];\n}\n\nfunction normalizeDefinitionLocations(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tresult: DefinitionResult,\n): NormalizedLocation[] {\n\tif (!result) return [];\n\tif (!Array.isArray(result)) return [normalizeLocation(state, route, result)];\n\tif (result.length === 0) return [];\n\tif (isLocationLinkArray(result)) return result.map((location) => normalizeLocationLink(state, route, location));\n\treturn result.map((location) => normalizeLocation(state, route, location));\n}\n\nfunction markedStringToText(value: MarkedString): string {\n\treturn typeof value === \"string\" ? value : value.value;\n}\n\nfunction hoverContentsToText(contents: LspHoverContents): string {\n\tif (typeof contents === \"string\") return contents;\n\tif (Array.isArray(contents)) return contents.map(markedStringToText).join(\"\\n\\n\");\n\tif (\"kind\" in contents) return (contents as MarkupContent).value;\n\treturn markedStringToText(contents);\n}\n\nfunction failureText(failures: readonly LspClientRouteFailure[]): string {\n\tconst unique = [\n\t\t...new Map(failures.map((failure) => [`${failure.serverId}\\u0000${failure.reason}`, failure])).values(),\n\t];\n\treturn unique.length === 0\n\t\t? \"\"\n\t\t: `\\n\\nUnavailable or unsupported servers:\\n${unique.map((failure) => `- ${failure.serverId}: ${failure.reason}`).join(\"\\n\")}`;\n}\n\nasync function getClientsAndSync(\n\tstate: LspRuntimeState,\n\tinput: PositionInput,\n\toperations: ToolOperations,\n\tfeature: LspToolFeature,\n\tsignal?: AbortSignal,\n): Promise<LspClientRouteCollection> {\n\tawait state.manager.setToolOperations(operations, signal);\n\tconst collection = await state.manager.getClientRoutesForFeature(input.path, feature, signal);\n\tif (collection.routes.length > 0) {\n\t\tconst result = await state.fileSync.synchronizeFileRead(input.path, operations, signal);\n\t\tif (result.lifecycleCancelled) {\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: [],\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...collection.routes.map((route) => ({\n\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\treason: \"synchronization was cancelled by an LSP lifecycle change\",\n\t\t\t\t\t})),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\tif (result.failures.length > 0) {\n\t\t\tconst failedInstances = new Set(result.failures.map((failure) => failure.instanceKey));\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: collection.routes.filter((route) => !failedInstances.has(route.target.instanceKey)),\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...result.failures.map((failure) => ({ serverId: failure.serverId, reason: failure.reason })),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t}\n\treturn collection;\n}\n\nasync function noCapableResult(\n\tstate: LspRuntimeState,\n\tpath: string,\n\tfeature: LspToolFeature,\n\tcollection: LspClientRouteCollection,\n\tsignal?: AbortSignal,\n): Promise<string> {\n\tif (collection.matchedServerCount === 0) return state.manager.getUnavailableReason(path, signal);\n\treturn `No capable LSP server is available for ${feature}.${failureText(collection.failures)}`;\n}\n\nfunction rethrowIfAborted(signal: AbortSignal | undefined): void {\n\tthrowIfAborted(signal);\n}\n\nfunction mergeAttributedLocations(entries: ServerNormalizedLocations[]): AttributedLocation[] {\n\tconst merged = new Map<string, AttributedLocation>();\n\tfor (const entry of entries) {\n\t\tfor (const location of entry.values) {\n\t\t\tconst existing = merged.get(location.key);\n\t\t\tif (existing) {\n\t\t\t\tif (!existing.serverIds.includes(entry.serverId)) existing.serverIds.push(entry.serverId);\n\t\t\t} else {\n\t\t\t\tmerged.set(location.key, { value: location.value, serverIds: [entry.serverId] });\n\t\t\t}\n\t\t}\n\t}\n\treturn [...merged.values()];\n}\n\nfunction attributedLine(location: AttributedLocation, attribute: boolean): string {\n\treturn attribute ? `[${location.serverIds.join(\", \")}] ${location.value}` : location.value;\n}\n\ninterface HoverSearchResult {\n\thover?: string;\n\tserverId?: string;\n\tfailures: LspClientRouteFailure[];\n}\n\nasync function requestHover(\n\troute: LspClientRoute,\n\tinput: PositionInput,\n\tsignal: AbortSignal | undefined,\n): Promise<string | undefined> {\n\tconst result = await route.client.sendRequest<Hover | null>(\n\t\t\"textDocument/hover\",\n\t\t{ textDocument: { uri: route.target.serverUri }, position: toPosition(input) },\n\t\tsignal,\n\t);\n\tif (!result) return undefined;\n\tconst hover = hoverContentsToText(result.contents).trim();\n\treturn hover || undefined;\n}\n\nasync function findHover(\n\tcollection: LspClientRouteCollection,\n\tinput: PositionInput,\n\tsignal: AbortSignal | undefined,\n): Promise<HoverSearchResult> {\n\tconst failures = [...collection.failures];\n\tfor (const route of collection.routes) {\n\t\ttry {\n\t\t\tconst hover = await requestHover(route, input, signal);\n\t\t\tif (hover) return { hover, serverId: route.target.serverId, failures };\n\t\t} catch (error) {\n\t\t\trethrowIfAborted(signal);\n\t\t\tfailures.push({\n\t\t\t\tserverId: route.target.serverId,\n\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\treturn { failures };\n}\n\nexport function createLspHoverTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof hoverSchema, LspHoverDetails> {\n\treturn {\n\t\tname: \"lsp_hover\",\n\t\tlabel: \"lsp_hover\",\n\t\tdescription:\n\t\t\t\"Get hover information from the highest-priority capable LSP server at a file position. Falls back deterministically when a higher-priority server fails or returns no result. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Get hover information and documentation for a symbol via LSP\",\n\t\tparameters: hoverSchema,\n\t\tasync execute(_toolCallId, input: PositionInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"hover\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: await noCapableResult(state, input.path, \"hover\", collection, signal) }],\n\t\t\t\t\tdetails: { found: false },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst result = await findHover(collection, input, signal);\n\t\t\tif (!result.hover) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No hover information.${failureText(result.failures)}` }],\n\t\t\t\t\tdetails: { found: false },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst prefix = collection.matchedServerCount > 1 ? `Hover from ${result.serverId}:\\n` : \"\";\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `${prefix}${result.hover}${failureText(result.failures)}` }],\n\t\t\t\tdetails: { found: true },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_hover\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createLspDefinitionTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof definitionSchema, LspLocationDetails> {\n\treturn {\n\t\tname: \"lsp_definition\",\n\t\tlabel: \"lsp_definition\",\n\t\tdescription:\n\t\t\t\"Find definitions across all capable matching LSP servers. Identical locations are deduplicated and distinct results are attributed to server IDs. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Find definitions for a symbol via LSP\",\n\t\tparameters: definitionSchema,\n\t\tasync execute(_toolCallId, input: PositionInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"definition\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"definition\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map(async (route) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await route.client.sendRequest<DefinitionResult>(\n\t\t\t\t\t\t\t\"textDocument/definition\",\n\t\t\t\t\t\t\t{ textDocument: { uri: route.target.serverUri }, position: toPosition(input) },\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\tvalues: normalizeDefinitionLocations(state, route, result),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\trethrowIfAborted(signal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t} satisfies LspClientRouteFailure,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst locations = mergeAttributedLocations(\n\t\t\t\toutcomes.flatMap((outcome) => (outcome.result ? [outcome.result] : [])),\n\t\t\t);\n\t\t\tif (locations.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No definition found.${failureText(failures)}` }],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst attribute = collection.matchedServerCount > 1;\n\t\t\tconst lines = locations.map((location) => attributedLine(location, attribute));\n\t\t\tconst body = locations.length === 1 ? `Definition: ${lines[0]}` : `Definitions:\\n${lines.join(\"\\n\")}`;\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `${body}${failureText(failures)}` }],\n\t\t\t\tdetails: { count: locations.length },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_definition\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createLspReferencesTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof referencesSchema, LspLocationDetails> {\n\treturn {\n\t\tname: \"lsp_references\",\n\t\tlabel: \"lsp_references\",\n\t\tdescription:\n\t\t\t\"Find references across all capable matching LSP servers. Identical locations are deduplicated, distinct results are attributed, and output is capped. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Find references to a symbol via LSP\",\n\t\tparameters: referencesSchema,\n\t\tasync execute(_toolCallId, input: ReferencesInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"references\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"references\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map(async (route) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await route.client.sendRequest<Location[] | null>(\n\t\t\t\t\t\t\t\"textDocument/references\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttextDocument: { uri: route.target.serverUri },\n\t\t\t\t\t\t\t\tposition: toPosition(input),\n\t\t\t\t\t\t\t\tcontext: { includeDeclaration: input.includeDeclaration ?? true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\tvalues: (result ?? []).map((location) => normalizeLocation(state, route, location)),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\trethrowIfAborted(signal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t} satisfies LspClientRouteFailure,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst locations = mergeAttributedLocations(\n\t\t\t\toutcomes.flatMap((outcome) => (outcome.result ? [outcome.result] : [])),\n\t\t\t);\n\t\t\tif (locations.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No references found.${failureText(failures)}` }],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst shown = locations.slice(0, MAX_REFERENCES);\n\t\t\tconst truncated = shown.length < locations.length;\n\t\t\tconst attribute = collection.matchedServerCount > 1;\n\t\t\tconst suffix = truncated ? `\\n\\n[Showing ${shown.length} of ${locations.length} references.]` : \"\";\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: `${locations.length} reference(s):\\n${shown.map((location) => attributedLine(location, attribute)).join(\"\\n\")}${suffix}${failureText(failures)}`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdetails: { count: locations.length, ...(truncated ? { truncated } : {}) },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_references\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/core/lsp/navigation.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAU5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAkBxD,QAAA,MAAM,WAAW;;;;EAA8B,CAAC;AAChD,QAAA,MAAM,gBAAgB;;;;EAA8B,CAAC;AACrD,QAAA,MAAM,gBAAgB;;;;;EAKpB,CAAC;AAKH,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AA4MD,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,EAAE,MAAM,cAAc,GAClC,cAAc,CAAC,OAAO,WAAW,EAAE,eAAe,CAAC,CA4CrD;AAED,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,E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CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;aACzE,CAAC;QAAA,CACF;QACD,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE;YACvB,OAAO,IAAI,IAAI,CACd,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,EAC7H,CAAC,EACD,CAAC,CACD,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF","sourcesContent":["import { Text } from \"@greppleai/grip-tui\";\nimport { type Static, Type } from \"typebox\";\nimport type {\n\tHover,\n\tLocation,\n\tLocationLink,\n\tMarkedString,\n\tMarkupContent,\n\tPosition,\n\tRange,\n} from \"vscode-languageserver-protocol\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport type { ToolOperations } from \"../tools/operations.ts\";\nimport { throwIfAborted } from \"./abort.ts\";\nimport type { LspRuntimeState } from \"./integration.ts\";\nimport type {\n\tLspClientRoute,\n\tLspClientRouteCollection,\n\tLspClientRouteFailure,\n\tLspManager,\n\tLspToolFeature,\n} from \"./manager.ts\";\nimport { relativePortablePath } from \"./portable-path.ts\";\n\nconst MAX_REFERENCES = 80;\n\nconst positionFields = {\n\tpath: Type.String({ description: \"File path\" }),\n\tline: Type.Integer({ minimum: 1, description: \"Line number, 1-indexed\" }),\n\tcharacter: Type.Integer({ minimum: 1, description: \"Column number, 1-indexed\" }),\n};\n\nconst hoverSchema = Type.Object(positionFields);\nconst definitionSchema = Type.Object(positionFields);\nconst referencesSchema = Type.Object({\n\t...positionFields,\n\tincludeDeclaration: Type.Optional(\n\t\tType.Boolean({ description: \"Include the declaration in results. Defaults to true.\" }),\n\t),\n});\n\ntype PositionInput = Static<typeof hoverSchema>;\ntype ReferencesInput = Static<typeof referencesSchema>;\n\nexport interface LspHoverDetails {\n\tfound: boolean;\n}\n\nexport interface LspLocationDetails {\n\tcount: number;\n\ttruncated?: boolean;\n}\n\ntype DefinitionResult = Location | Location[] | LocationLink[] | null;\ntype LspHoverContents = MarkupContent | MarkedString | MarkedString[];\n\ninterface NormalizedLocation {\n\tkey: string;\n\tvalue: string;\n}\n\ninterface AttributedLocation {\n\tvalue: string;\n\tserverIds: string[];\n}\n\ninterface ServerNormalizedLocations {\n\tserverId: string;\n\tvalues: NormalizedLocation[];\n}\n\nfunction toPosition(input: PositionInput): Position {\n\treturn { line: input.line - 1, character: input.character - 1 };\n}\n\nfunction formatMappedUri(manager: LspManager, route: LspClientRoute, uri: string): string {\n\tconst mapped = route.target.mapper.serverUriToAgentPath(uri);\n\treturn mapped.ok ? relativePortablePath(manager.cwd, mapped.value) : `[unmapped URI: ${mapped.reason}]`;\n}\n\nfunction formatRangeStart(range: Range): string {\n\treturn `${range.start.line + 1}:${range.start.character + 1}`;\n}\n\nfunction normalizeLocation(state: LspRuntimeState, route: LspClientRoute, location: Location): NormalizedLocation {\n\tconst path = formatMappedUri(state.manager, route, location.uri);\n\treturn {\n\t\tkey: JSON.stringify({ path, range: location.range }),\n\t\tvalue: `${path}:${formatRangeStart(location.range)}`,\n\t};\n}\n\nfunction normalizeLocationLink(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tlocation: LocationLink,\n): NormalizedLocation {\n\tconst path = formatMappedUri(state.manager, route, location.targetUri);\n\treturn {\n\t\tkey: JSON.stringify({ path, range: location.targetSelectionRange }),\n\t\tvalue: `${path}:${formatRangeStart(location.targetSelectionRange)}`,\n\t};\n}\n\nfunction isLocationLinkArray(value: Location[] | LocationLink[]): value is LocationLink[] {\n\treturn value.length > 0 && \"targetUri\" in value[0];\n}\n\nfunction normalizeDefinitionLocations(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tresult: DefinitionResult,\n): NormalizedLocation[] {\n\tif (!result) return [];\n\tif (!Array.isArray(result)) return [normalizeLocation(state, route, result)];\n\tif (result.length === 0) return [];\n\tif (isLocationLinkArray(result)) return result.map((location) => normalizeLocationLink(state, route, location));\n\treturn result.map((location) => normalizeLocation(state, route, location));\n}\n\nfunction markedStringToText(value: MarkedString): string {\n\treturn typeof value === \"string\" ? value : value.value;\n}\n\nfunction hoverContentsToText(contents: LspHoverContents): string {\n\tif (typeof contents === \"string\") return contents;\n\tif (Array.isArray(contents)) return contents.map(markedStringToText).join(\"\\n\\n\");\n\tif (\"kind\" in contents) return (contents as MarkupContent).value;\n\treturn markedStringToText(contents);\n}\n\nfunction failureText(failures: readonly LspClientRouteFailure[]): string {\n\tconst unique = [\n\t\t...new Map(failures.map((failure) => [`${failure.serverId}\\u0000${failure.reason}`, failure])).values(),\n\t];\n\treturn unique.length === 0\n\t\t? \"\"\n\t\t: `\\n\\nUnavailable or unsupported servers:\\n${unique.map((failure) => `- ${failure.serverId}: ${failure.reason}`).join(\"\\n\")}`;\n}\n\nasync function getClientsAndSync(\n\tstate: LspRuntimeState,\n\tinput: PositionInput,\n\toperations: ToolOperations,\n\tfeature: LspToolFeature,\n\tsignal?: AbortSignal,\n): Promise<LspClientRouteCollection> {\n\tawait state.manager.setToolOperations(operations, signal);\n\tconst collection = await state.manager.getClientRoutesForFeature(input.path, feature, signal);\n\tif (collection.routes.length > 0) {\n\t\tconst result = await state.fileSync.synchronizeFileRead(input.path, operations, signal);\n\t\tif (result.lifecycleCancelled) {\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: [],\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...collection.routes.map((route) => ({\n\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\treason: \"synchronization was cancelled by an LSP lifecycle change\",\n\t\t\t\t\t})),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\tif (result.failures.length > 0) {\n\t\t\tconst failedInstances = new Set(result.failures.map((failure) => failure.instanceKey));\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: collection.routes.filter((route) => !failedInstances.has(route.target.instanceKey)),\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...result.failures.map((failure) => ({ serverId: failure.serverId, reason: failure.reason })),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t}\n\treturn collection;\n}\n\nasync function noCapableResult(\n\tstate: LspRuntimeState,\n\tpath: string,\n\tfeature: LspToolFeature,\n\tcollection: LspClientRouteCollection,\n\tsignal?: AbortSignal,\n): Promise<string> {\n\tif (collection.matchedServerCount === 0) return state.manager.getUnavailableReason(path, signal);\n\treturn `No capable LSP server is available for ${feature}.${failureText(collection.failures)}`;\n}\n\nfunction rethrowIfAborted(signal: AbortSignal | undefined): void {\n\tthrowIfAborted(signal);\n}\n\nfunction mergeAttributedLocations(entries: ServerNormalizedLocations[]): AttributedLocation[] {\n\tconst merged = new Map<string, AttributedLocation>();\n\tfor (const entry of entries) {\n\t\tfor (const location of entry.values) {\n\t\t\tconst existing = merged.get(location.key);\n\t\t\tif (existing) {\n\t\t\t\tif (!existing.serverIds.includes(entry.serverId)) existing.serverIds.push(entry.serverId);\n\t\t\t} else {\n\t\t\t\tmerged.set(location.key, { value: location.value, serverIds: [entry.serverId] });\n\t\t\t}\n\t\t}\n\t}\n\treturn [...merged.values()];\n}\n\nfunction attributedLine(location: AttributedLocation, attribute: boolean): string {\n\treturn attribute ? `[${location.serverIds.join(\", \")}] ${location.value}` : location.value;\n}\n\ninterface HoverSearchResult {\n\thover?: string;\n\tserverId?: string;\n\tfailures: LspClientRouteFailure[];\n}\n\nasync function requestHover(\n\troute: LspClientRoute,\n\tinput: PositionInput,\n\tsignal: AbortSignal | undefined,\n): Promise<string | undefined> {\n\tconst result = await route.client.sendRequest<Hover | null>(\n\t\t\"textDocument/hover\",\n\t\t{ textDocument: { uri: route.target.serverUri }, position: toPosition(input) },\n\t\tsignal,\n\t);\n\tif (!result) return undefined;\n\tconst hover = hoverContentsToText(result.contents).trim();\n\treturn hover || undefined;\n}\n\nasync function findHover(\n\tcollection: LspClientRouteCollection,\n\tinput: PositionInput,\n\tsignal: AbortSignal | undefined,\n): Promise<HoverSearchResult> {\n\tconst failures = [...collection.failures];\n\tfor (const route of collection.routes) {\n\t\ttry {\n\t\t\tconst hover = await requestHover(route, input, signal);\n\t\t\tif (hover) return { hover, serverId: route.target.serverId, failures };\n\t\t} catch (error) {\n\t\t\trethrowIfAborted(signal);\n\t\t\tfailures.push({\n\t\t\t\tserverId: route.target.serverId,\n\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\treturn { failures };\n}\n\nexport function createLspHoverTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof hoverSchema, LspHoverDetails> {\n\treturn {\n\t\tname: \"lsp_hover\",\n\t\tlabel: \"lsp_hover\",\n\t\tdescription:\n\t\t\t\"Get hover information from the highest-priority capable LSP server at a file position. Falls back deterministically when a higher-priority server fails or returns no result. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Get hover information and documentation for a symbol via LSP\",\n\t\tparameters: hoverSchema,\n\t\tasync execute(_toolCallId, input: PositionInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"hover\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: await noCapableResult(state, input.path, \"hover\", collection, signal) }],\n\t\t\t\t\tdetails: { found: false },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst result = await findHover(collection, input, signal);\n\t\t\tif (!result.hover) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No hover information.${failureText(result.failures)}` }],\n\t\t\t\t\tdetails: { found: false },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst prefix = collection.matchedServerCount > 1 ? `Hover from ${result.serverId}:\\n` : \"\";\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `${prefix}${result.hover}${failureText(result.failures)}` }],\n\t\t\t\tdetails: { found: true },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_hover\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createLspDefinitionTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof definitionSchema, LspLocationDetails> {\n\treturn {\n\t\tname: \"lsp_definition\",\n\t\tlabel: \"lsp_definition\",\n\t\tdescription:\n\t\t\t\"Find definitions across all capable matching LSP servers. Identical locations are deduplicated and distinct results are attributed to server IDs. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Find definitions for a symbol via LSP\",\n\t\tparameters: definitionSchema,\n\t\tasync execute(_toolCallId, input: PositionInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"definition\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"definition\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map(async (route) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await route.client.sendRequest<DefinitionResult>(\n\t\t\t\t\t\t\t\"textDocument/definition\",\n\t\t\t\t\t\t\t{ textDocument: { uri: route.target.serverUri }, position: toPosition(input) },\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\tvalues: normalizeDefinitionLocations(state, route, result),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\trethrowIfAborted(signal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t} satisfies LspClientRouteFailure,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst locations = mergeAttributedLocations(\n\t\t\t\toutcomes.flatMap((outcome) => (outcome.result ? [outcome.result] : [])),\n\t\t\t);\n\t\t\tif (locations.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No definition found.${failureText(failures)}` }],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst attribute = collection.matchedServerCount > 1;\n\t\t\tconst lines = locations.map((location) => attributedLine(location, attribute));\n\t\t\tconst body = locations.length === 1 ? `Definition: ${lines[0]}` : `Definitions:\\n${lines.join(\"\\n\")}`;\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `${body}${failureText(failures)}` }],\n\t\t\t\tdetails: { count: locations.length },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_definition\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createLspReferencesTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof referencesSchema, LspLocationDetails> {\n\treturn {\n\t\tname: \"lsp_references\",\n\t\tlabel: \"lsp_references\",\n\t\tdescription:\n\t\t\t\"Find references across all capable matching LSP servers. Identical locations are deduplicated, distinct results are attributed, and output is capped. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Find references to a symbol via LSP\",\n\t\tparameters: referencesSchema,\n\t\tasync execute(_toolCallId, input: ReferencesInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"references\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"references\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map(async (route) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await route.client.sendRequest<Location[] | null>(\n\t\t\t\t\t\t\t\"textDocument/references\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttextDocument: { uri: route.target.serverUri },\n\t\t\t\t\t\t\t\tposition: toPosition(input),\n\t\t\t\t\t\t\t\tcontext: { includeDeclaration: input.includeDeclaration ?? true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\tvalues: (result ?? []).map((location) => normalizeLocation(state, route, location)),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\trethrowIfAborted(signal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t} satisfies LspClientRouteFailure,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst locations = mergeAttributedLocations(\n\t\t\t\toutcomes.flatMap((outcome) => (outcome.result ? [outcome.result] : [])),\n\t\t\t);\n\t\t\tif (locations.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No references found.${failureText(failures)}` }],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst shown = locations.slice(0, MAX_REFERENCES);\n\t\t\tconst truncated = shown.length < locations.length;\n\t\t\tconst attribute = collection.matchedServerCount > 1;\n\t\t\tconst suffix = truncated ? `\\n\\n[Showing ${shown.length} of ${locations.length} references.]` : \"\";\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: `${locations.length} reference(s):\\n${shown.map((location) => attributedLine(location, attribute)).join(\"\\n\")}${suffix}${failureText(failures)}`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdetails: { count: locations.length, ...(truncated ? { truncated } : {}) },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_references\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n"]}
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../src/core/lsp/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAY5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAS5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,MAAM,cAAc,GAAG;IACtB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IAC/C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;IACzE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;CAChF,CAAC;AAEF,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AAChD,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AACrD,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IACpC,GAAG,cAAc;IACjB,kBAAkB,EAAE,IAAI,CAAC,QAAQ,CAChC,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uDAAuD,EAAE,CAAC,CACtF;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QACD,UAAU,CAAC,IAAI,EAAE,KAAK;YACrB,OAAO,IAAI,IAAI,CACd,GAAG,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,EAC7H,CAAC,EACD,CAAC,CACD,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { Text } from \"@greppleai/grip-tui\";\nimport { type Static, Type } from \"typebox\";\nimport type {\n\tHover,\n\tLocation,\n\tLocationLink,\n\tMarkedString,\n\tMarkupContent,\n\tPosition,\n\tRange,\n} from \"vscode-languageserver-protocol\";\nimport type { ToolDefinition } from \"../extensions/types.ts\";\nimport type { ToolOperations } from \"../tools/operations.ts\";\nimport { throwIfAborted } from \"./abort.ts\";\nimport type { LspRuntimeState } from \"./integration.ts\";\nimport type {\n\tLspClientRoute,\n\tLspClientRouteCollection,\n\tLspClientRouteFailure,\n\tLspManager,\n\tLspToolFeature,\n} from \"./manager.ts\";\nimport { relativePortablePath } from \"./portable-path.ts\";\n\nconst MAX_REFERENCES = 80;\n\nconst positionFields = {\n\tpath: Type.String({ description: \"File path\" }),\n\tline: Type.Integer({ minimum: 1, description: \"Line number, 1-indexed\" }),\n\tcharacter: Type.Integer({ minimum: 1, description: \"Column number, 1-indexed\" }),\n};\n\nconst hoverSchema = Type.Object(positionFields);\nconst definitionSchema = Type.Object(positionFields);\nconst referencesSchema = Type.Object({\n\t...positionFields,\n\tincludeDeclaration: Type.Optional(\n\t\tType.Boolean({ description: \"Include the declaration in results. Defaults to true.\" }),\n\t),\n});\n\ntype PositionInput = Static<typeof hoverSchema>;\ntype ReferencesInput = Static<typeof referencesSchema>;\n\nexport interface LspHoverDetails {\n\tfound: boolean;\n}\n\nexport interface LspLocationDetails {\n\tcount: number;\n\ttruncated?: boolean;\n}\n\ntype DefinitionResult = Location | Location[] | LocationLink[] | null;\ntype LspHoverContents = MarkupContent | MarkedString | MarkedString[];\n\ninterface NormalizedLocation {\n\tkey: string;\n\tvalue: string;\n}\n\ninterface AttributedLocation {\n\tvalue: string;\n\tserverIds: string[];\n}\n\ninterface ServerNormalizedLocations {\n\tserverId: string;\n\tvalues: NormalizedLocation[];\n}\n\nfunction toPosition(input: PositionInput): Position {\n\treturn { line: input.line - 1, character: input.character - 1 };\n}\n\nfunction formatMappedUri(manager: LspManager, route: LspClientRoute, uri: string): string {\n\tconst mapped = route.target.mapper.serverUriToAgentPath(uri);\n\treturn mapped.ok ? relativePortablePath(manager.cwd, mapped.value) : `[unmapped URI: ${mapped.reason}]`;\n}\n\nfunction formatRangeStart(range: Range): string {\n\treturn `${range.start.line + 1}:${range.start.character + 1}`;\n}\n\nfunction normalizeLocation(state: LspRuntimeState, route: LspClientRoute, location: Location): NormalizedLocation {\n\tconst path = formatMappedUri(state.manager, route, location.uri);\n\treturn {\n\t\tkey: JSON.stringify({ path, range: location.range }),\n\t\tvalue: `${path}:${formatRangeStart(location.range)}`,\n\t};\n}\n\nfunction normalizeLocationLink(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tlocation: LocationLink,\n): NormalizedLocation {\n\tconst path = formatMappedUri(state.manager, route, location.targetUri);\n\treturn {\n\t\tkey: JSON.stringify({ path, range: location.targetSelectionRange }),\n\t\tvalue: `${path}:${formatRangeStart(location.targetSelectionRange)}`,\n\t};\n}\n\nfunction isLocationLinkArray(value: Location[] | LocationLink[]): value is LocationLink[] {\n\treturn value.length > 0 && \"targetUri\" in value[0];\n}\n\nfunction normalizeDefinitionLocations(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tresult: DefinitionResult,\n): NormalizedLocation[] {\n\tif (!result) return [];\n\tif (!Array.isArray(result)) return [normalizeLocation(state, route, result)];\n\tif (result.length === 0) return [];\n\tif (isLocationLinkArray(result)) return result.map((location) => normalizeLocationLink(state, route, location));\n\treturn result.map((location) => normalizeLocation(state, route, location));\n}\n\nfunction markedStringToText(value: MarkedString): string {\n\treturn typeof value === \"string\" ? value : value.value;\n}\n\nfunction hoverContentsToText(contents: LspHoverContents): string {\n\tif (typeof contents === \"string\") return contents;\n\tif (Array.isArray(contents)) return contents.map(markedStringToText).join(\"\\n\\n\");\n\tif (\"kind\" in contents) return (contents as MarkupContent).value;\n\treturn markedStringToText(contents);\n}\n\nfunction failureText(failures: readonly LspClientRouteFailure[]): string {\n\tconst unique = [\n\t\t...new Map(failures.map((failure) => [`${failure.serverId}\\u0000${failure.reason}`, failure])).values(),\n\t];\n\treturn unique.length === 0\n\t\t? \"\"\n\t\t: `\\n\\nUnavailable or unsupported servers:\\n${unique.map((failure) => `- ${failure.serverId}: ${failure.reason}`).join(\"\\n\")}`;\n}\n\nasync function getClientsAndSync(\n\tstate: LspRuntimeState,\n\tinput: PositionInput,\n\toperations: ToolOperations,\n\tfeature: LspToolFeature,\n\tsignal?: AbortSignal,\n): Promise<LspClientRouteCollection> {\n\tawait state.manager.setToolOperations(operations, signal);\n\tconst collection = await state.manager.getClientRoutesForFeature(input.path, feature, signal);\n\tif (collection.routes.length > 0) {\n\t\tconst result = await state.fileSync.synchronizeFileRead(input.path, operations, signal);\n\t\tif (result.lifecycleCancelled) {\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: [],\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...collection.routes.map((route) => ({\n\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\treason: \"synchronization was cancelled by an LSP lifecycle change\",\n\t\t\t\t\t})),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\tif (result.failures.length > 0) {\n\t\t\tconst failedInstances = new Set(result.failures.map((failure) => failure.instanceKey));\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: collection.routes.filter((route) => !failedInstances.has(route.target.instanceKey)),\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...result.failures.map((failure) => ({ serverId: failure.serverId, reason: failure.reason })),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t}\n\treturn collection;\n}\n\nasync function noCapableResult(\n\tstate: LspRuntimeState,\n\tpath: string,\n\tfeature: LspToolFeature,\n\tcollection: LspClientRouteCollection,\n\tsignal?: AbortSignal,\n): Promise<string> {\n\tif (collection.matchedServerCount === 0) return state.manager.getUnavailableReason(path, signal);\n\treturn `No capable LSP server is available for ${feature}.${failureText(collection.failures)}`;\n}\n\nfunction rethrowIfAborted(signal: AbortSignal | undefined): void {\n\tthrowIfAborted(signal);\n}\n\nfunction mergeAttributedLocations(entries: ServerNormalizedLocations[]): AttributedLocation[] {\n\tconst merged = new Map<string, AttributedLocation>();\n\tfor (const entry of entries) {\n\t\tfor (const location of entry.values) {\n\t\t\tconst existing = merged.get(location.key);\n\t\t\tif (existing) {\n\t\t\t\tif (!existing.serverIds.includes(entry.serverId)) existing.serverIds.push(entry.serverId);\n\t\t\t} else {\n\t\t\t\tmerged.set(location.key, { value: location.value, serverIds: [entry.serverId] });\n\t\t\t}\n\t\t}\n\t}\n\treturn [...merged.values()];\n}\n\nfunction attributedLine(location: AttributedLocation, attribute: boolean): string {\n\treturn attribute ? `[${location.serverIds.join(\", \")}] ${location.value}` : location.value;\n}\n\ninterface HoverSearchResult {\n\thover?: string;\n\tserverId?: string;\n\tfailures: LspClientRouteFailure[];\n}\n\nasync function requestHover(\n\troute: LspClientRoute,\n\tinput: PositionInput,\n\tsignal: AbortSignal | undefined,\n): Promise<string | undefined> {\n\tconst result = await route.client.sendRequest<Hover | null>(\n\t\t\"textDocument/hover\",\n\t\t{ textDocument: { uri: route.target.serverUri }, position: toPosition(input) },\n\t\tsignal,\n\t);\n\tif (!result) return undefined;\n\tconst hover = hoverContentsToText(result.contents).trim();\n\treturn hover || undefined;\n}\n\nasync function findHover(\n\tcollection: LspClientRouteCollection,\n\tinput: PositionInput,\n\tsignal: AbortSignal | undefined,\n): Promise<HoverSearchResult> {\n\tconst failures = [...collection.failures];\n\tfor (const route of collection.routes) {\n\t\ttry {\n\t\t\tconst hover = await requestHover(route, input, signal);\n\t\t\tif (hover) return { hover, serverId: route.target.serverId, failures };\n\t\t} catch (error) {\n\t\t\trethrowIfAborted(signal);\n\t\t\tfailures.push({\n\t\t\t\tserverId: route.target.serverId,\n\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t}\n\t}\n\treturn { failures };\n}\n\nexport function createLspHoverTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof hoverSchema, LspHoverDetails> {\n\treturn {\n\t\tname: \"lsp_hover\",\n\t\tlabel: \"lsp_hover\",\n\t\tdescription:\n\t\t\t\"Get hover information from the highest-priority capable LSP server at a file position. Falls back deterministically when a higher-priority server fails or returns no result. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Get hover information and documentation for a symbol via LSP\",\n\t\tparameters: hoverSchema,\n\t\tasync execute(_toolCallId, input: PositionInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"hover\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: await noCapableResult(state, input.path, \"hover\", collection, signal) }],\n\t\t\t\t\tdetails: { found: false },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst result = await findHover(collection, input, signal);\n\t\t\tif (!result.hover) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No hover information.${failureText(result.failures)}` }],\n\t\t\t\t\tdetails: { found: false },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst prefix = collection.matchedServerCount > 1 ? `Hover from ${result.serverId}:\\n` : \"\";\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `${prefix}${result.hover}${failureText(result.failures)}` }],\n\t\t\t\tdetails: { found: true },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_hover\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createLspDefinitionTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof definitionSchema, LspLocationDetails> {\n\treturn {\n\t\tname: \"lsp_definition\",\n\t\tlabel: \"lsp_definition\",\n\t\tdescription:\n\t\t\t\"Find definitions across all capable matching LSP servers. Identical locations are deduplicated and distinct results are attributed to server IDs. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Find definitions for a symbol via LSP\",\n\t\tparameters: definitionSchema,\n\t\tasync execute(_toolCallId, input: PositionInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"definition\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"definition\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map(async (route) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await route.client.sendRequest<DefinitionResult>(\n\t\t\t\t\t\t\t\"textDocument/definition\",\n\t\t\t\t\t\t\t{ textDocument: { uri: route.target.serverUri }, position: toPosition(input) },\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\tvalues: normalizeDefinitionLocations(state, route, result),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\trethrowIfAborted(signal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t} satisfies LspClientRouteFailure,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst locations = mergeAttributedLocations(\n\t\t\t\toutcomes.flatMap((outcome) => (outcome.result ? [outcome.result] : [])),\n\t\t\t);\n\t\t\tif (locations.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No definition found.${failureText(failures)}` }],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst attribute = collection.matchedServerCount > 1;\n\t\t\tconst lines = locations.map((location) => attributedLine(location, attribute));\n\t\t\tconst body = locations.length === 1 ? `Definition: ${lines[0]}` : `Definitions:\\n${lines.join(\"\\n\")}`;\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: `${body}${failureText(failures)}` }],\n\t\t\t\tdetails: { count: locations.length },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_definition\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createLspReferencesTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof referencesSchema, LspLocationDetails> {\n\treturn {\n\t\tname: \"lsp_references\",\n\t\tlabel: \"lsp_references\",\n\t\tdescription:\n\t\t\t\"Find references across all capable matching LSP servers. Identical locations are deduplicated, distinct results are attributed, and output is capped. Line and character are 1-indexed.\",\n\t\tpromptSnippet: \"Find references to a symbol via LSP\",\n\t\tparameters: referencesSchema,\n\t\tasync execute(_toolCallId, input: ReferencesInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"references\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"references\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map(async (route) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await route.client.sendRequest<Location[] | null>(\n\t\t\t\t\t\t\t\"textDocument/references\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttextDocument: { uri: route.target.serverUri },\n\t\t\t\t\t\t\t\tposition: toPosition(input),\n\t\t\t\t\t\t\t\tcontext: { includeDeclaration: input.includeDeclaration ?? true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\tvalues: (result ?? []).map((location) => normalizeLocation(state, route, location)),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\trethrowIfAborted(signal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t} satisfies LspClientRouteFailure,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst locations = mergeAttributedLocations(\n\t\t\t\toutcomes.flatMap((outcome) => (outcome.result ? [outcome.result] : [])),\n\t\t\t);\n\t\t\tif (locations.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No references found.${failureText(failures)}` }],\n\t\t\t\t\tdetails: { count: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst shown = locations.slice(0, MAX_REFERENCES);\n\t\t\tconst truncated = shown.length < locations.length;\n\t\t\tconst attribute = collection.matchedServerCount > 1;\n\t\t\tconst suffix = truncated ? `\\n\\n[Showing ${shown.length} of ${locations.length} references.]` : \"\";\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: `${locations.length} reference(s):\\n${shown.map((location) => attributedLine(location, attribute)).join(\"\\n\")}${suffix}${failureText(failures)}`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdetails: { count: locations.length, ...(truncated ? { truncated } : {}) },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_references\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"portable-path.d.ts","sourceRoot":"","sources":["../../../src/core/lsp/portable-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD,KAAK,OAAO,GAAG,OAAO,KAAK,GAAG,OAAO,KAAK,CAAC;AAE3C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAIhF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAA4B,GAAG,kBAAkB,CAEpG;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAE3D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAE1F;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAE7E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAExF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAoB,GAAG,MAAM,CAGrF;AAUD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY9D;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAIrE;AAED,0GAA0G;AAC1G,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYlF","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PortablePathFlavor = \"posix\" | \"windows\";\n\ntype PathApi = typeof posix | typeof win32;\n\nexport function absolutePathFlavor(value: string): PortablePathFlavor | undefined {\n\tif (/^[A-Za-z]:[\\\\/]/.test(value) || /^[\\\\/]{2}[^\\\\/]+[\\\\/][^\\\\/]+/.test(value)) return \"windows\";\n\tif (value.startsWith(\"/\")) return \"posix\";\n\treturn undefined;\n}\n\nexport function pathFlavor(value: string, fallback: PortablePathFlavor = \"posix\"): PortablePathFlavor {\n\treturn absolutePathFlavor(value) ?? fallback;\n}\n\nexport function pathApi(flavor: PortablePathFlavor): PathApi {\n\treturn flavor === \"windows\" ? win32 : posix;\n}\n\nexport function isPortableAbsolute(value: string): boolean {\n\treturn absolutePathFlavor(value) !== undefined;\n}\n\nexport function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).normalize(value);\n}\n\nexport function resolvePortablePath(baseDir: string, value: string): string {\n\tconst absoluteFlavor = absolutePathFlavor(value);\n\tif (absoluteFlavor) return pathApi(absoluteFlavor).normalize(value);\n\tconst baseFlavor = pathFlavor(baseDir);\n\treturn pathApi(baseFlavor).resolve(baseDir, value);\n}\n\nexport function joinPortablePath(basePath: string, ...parts: string[]): string {\n\treturn pathApi(pathFlavor(basePath)).join(basePath, ...parts);\n}\n\nexport function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).dirname(value);\n}\n\nexport function pathComparisonValue(value: string, flavor = pathFlavor(value)): string {\n\tconst normalized = pathApi(flavor).normalize(value);\n\treturn flavor === \"windows\" ? normalized.toLowerCase() : normalized;\n}\n\nfunction encodePathSegments(value: string, flavor: PortablePathFlavor): string {\n\treturn value\n\t\t.split(flavor === \"windows\" ? /[\\\\/]/ : \"/\")\n\t\t.filter(Boolean)\n\t\t.map((segment) => encodeURIComponent(segment))\n\t\t.join(\"/\");\n}\n\nexport function portablePathToFileUri(filePath: string): string {\n\tconst flavor = pathFlavor(filePath);\n\tconst normalized = normalizePortablePath(filePath, flavor);\n\tif (flavor === \"posix\") return `file:///${encodePathSegments(normalized, flavor)}`;\n\tif (normalized.startsWith(\"\\\\\\\\\")) {\n\t\tconst parts = normalized.slice(2).split(\"\\\\\");\n\t\tconst host = parts.shift();\n\t\tif (!host) throw new Error(`Invalid UNC path: ${filePath}`);\n\t\treturn `file://${host}/${encodePathSegments(parts.join(\"/\"), flavor)}`;\n\t}\n\tconst drive = normalized.slice(0, 2);\n\treturn `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;\n}\n\nexport function relativePortablePath(from: string, to: string): string {\n\tconst flavor = pathFlavor(from);\n\tif (absolutePathFlavor(to) !== flavor) return to;\n\treturn pathApi(flavor).relative(from, to);\n}\n\n/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */\nexport function relativeWithin(root: string, candidate: string): string | undefined {\n\tconst flavor = pathFlavor(root);\n\tif (absolutePathFlavor(candidate) !== flavor) return undefined;\n\tconst api = pathApi(flavor);\n\tconst normalizedRoot = api.normalize(root);\n\tconst normalizedCandidate = api.normalize(candidate);\n\tconst comparableRoot = pathComparisonValue(normalizedRoot, flavor);\n\tconst comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);\n\tif (comparableRoot === comparableCandidate) return \"\";\n\tconst prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;\n\tif (!comparableCandidate.startsWith(prefix)) return undefined;\n\treturn normalizedCandidate.slice(prefix.length);\n}\n"]}
1
+ {"version":3,"file":"portable-path.d.ts","sour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,CAAC,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,cAAc,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,mBAAmB,GAAG,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC7E,IAAI,cAAc,KAAK,mBAAmB;QAAE,OAAO,EAAE,CAAC;IACtD,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IACjG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,OAAO,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAAA,CAChD","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PortablePathFlavor = \"posix\" | \"windows\";\n\ntype PathApi = typeof posix | typeof win32;\n\nexport function absolutePathFlavor(value: string): PortablePathFlavor | undefined {\n\tif (/^[A-Za-z]:[\\\\/]/.test(value) || /^[\\\\/]{2}[^\\\\/]+[\\\\/][^\\\\/]+/.test(value)) return \"windows\";\n\tif (value.startsWith(\"/\")) return \"posix\";\n\treturn undefined;\n}\n\nexport function pathFlavor(value: string, fallback: PortablePathFlavor = \"posix\"): PortablePathFlavor {\n\treturn absolutePathFlavor(value) ?? fallback;\n}\n\nexport function pathApi(flavor: PortablePathFlavor): PathApi {\n\treturn flavor === \"windows\" ? win32 : posix;\n}\n\nexport function isPortableAbsolute(value: string): boolean {\n\treturn absolutePathFlavor(value) !== undefined;\n}\n\nexport function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).normalize(value);\n}\n\nexport function resolvePortablePath(baseDir: string, value: string): string {\n\tconst absoluteFlavor = absolutePathFlavor(value);\n\tif (absoluteFlavor) return pathApi(absoluteFlavor).normalize(value);\n\tconst baseFlavor = pathFlavor(baseDir);\n\treturn pathApi(baseFlavor).resolve(baseDir, value);\n}\n\nexport function joinPortablePath(basePath: string, ...parts: string[]): string {\n\treturn pathApi(pathFlavor(basePath)).join(basePath, ...parts);\n}\n\nexport function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).dirname(value);\n}\n\nexport function pathComparisonValue(value: string, flavor = pathFlavor(value)): string {\n\tconst normalized = pathApi(flavor).normalize(value);\n\treturn flavor === \"windows\" ? normalized.toLowerCase() : normalized;\n}\n\nfunction encodePathSegments(value: string, flavor: PortablePathFlavor): string {\n\treturn value\n\t\t.split(flavor === \"windows\" ? /[\\\\/]/ : \"/\")\n\t\t.filter(Boolean)\n\t\t.map((segment) => encodeURIComponent(segment))\n\t\t.join(\"/\");\n}\n\nexport function portablePathToFileUri(filePath: string): string {\n\tconst flavor = pathFlavor(filePath);\n\tconst normalized = normalizePortablePath(filePath, flavor);\n\tif (flavor === \"posix\") return `file:///${encodePathSegments(normalized, flavor)}`;\n\tif (normalized.startsWith(\"\\\\\\\\\")) {\n\t\tconst parts = normalized.slice(2).split(\"\\\\\");\n\t\tconst host = parts.shift();\n\t\tif (!host) throw new Error(`Invalid UNC path: ${filePath}`);\n\t\treturn `file://${host}/${encodePathSegments(parts.join(\"/\"), flavor)}`;\n\t}\n\tconst drive = normalized.slice(0, 2);\n\treturn `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;\n}\n\nexport function relativePortablePath(from: string, to: string): string {\n\tconst flavor = pathFlavor(from);\n\tif (absolutePathFlavor(to) !== flavor) return to;\n\treturn pathApi(flavor).relative(from, to);\n}\n\n/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */\nexport function relativeWithin(root: string, candidate: string): string | undefined {\n\tconst flavor = pathFlavor(root);\n\tif (absolutePathFlavor(candidate) !== flavor) return undefined;\n\tconst api = pathApi(flavor);\n\tconst normalizedRoot = api.normalize(root);\n\tconst normalizedCandidate = api.normalize(candidate);\n\tconst comparableRoot = pathComparisonValue(normalizedRoot, flavor);\n\tconst comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);\n\tif (comparableRoot === comparableCandidate) return \"\";\n\tconst prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;\n\tif (!comparableCandidate.startsWith(prefix)) return undefined;\n\treturn normalizedCandidate.slice(prefix.length);\n}\n"]}
1
+ {"version":3,"file":"portable-path.js","sourceRoot":"","sources":["../../../src/core/lsp/portable-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAMzC,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC/C,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAClG,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAC1C,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,QAAQ,GAAuB,OAAO;IAC/E,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,MAA0B;IACjD,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC/C,OAAO,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M,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,kBAAkB,CAAC,EAAE,CAAC,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IACjD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,SAAiB;IAC7D,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,kBAAkB,CAAC,SAAS,CAAC,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,cAAc,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,mBAAmB,GAAG,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC7E,IAAI,cAAc,KAAK,mBAAmB;QAAE,OAAO,EAAE,CAAC;IACtD,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IACjG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,OAAO,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PortablePathFlavor = \"posix\" | \"windows\";\n\ntype PathApi = typeof posix | typeof win32;\n\nexport function absolutePathFlavor(value: string): PortablePathFlavor | undefined {\n\tif (/^[A-Za-z]:[\\\\/]/.test(value) || /^[\\\\/]{2}[^\\\\/]+[\\\\/][^\\\\/]+/.test(value)) return \"windows\";\n\tif (value.startsWith(\"/\")) return \"posix\";\n\treturn undefined;\n}\n\nexport function pathFlavor(value: string, fallback: PortablePathFlavor = \"posix\"): PortablePathFlavor {\n\treturn absolutePathFlavor(value) ?? fallback;\n}\n\nexport function pathApi(flavor: PortablePathFlavor): PathApi {\n\treturn flavor === \"windows\" ? win32 : posix;\n}\n\nexport function isPortableAbsolute(value: string): boolean {\n\treturn absolutePathFlavor(value) !== undefined;\n}\n\nexport function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).normalize(value);\n}\n\nexport function resolvePortablePath(baseDir: string, value: string): string {\n\tconst absoluteFlavor = absolutePathFlavor(value);\n\tif (absoluteFlavor) return pathApi(absoluteFlavor).normalize(value);\n\tconst baseFlavor = pathFlavor(baseDir);\n\treturn pathApi(baseFlavor).resolve(baseDir, value);\n}\n\nexport function joinPortablePath(basePath: string, ...parts: string[]): string {\n\treturn pathApi(pathFlavor(basePath)).join(basePath, ...parts);\n}\n\nexport function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).dirname(value);\n}\n\nexport function pathComparisonValue(value: string, flavor = pathFlavor(value)): string {\n\tconst normalized = pathApi(flavor).normalize(value);\n\treturn flavor === \"windows\" ? normalized.toLowerCase() : normalized;\n}\n\nfunction encodePathSegments(value: string, flavor: PortablePathFlavor): string {\n\treturn value\n\t\t.split(flavor === \"windows\" ? /[\\\\/]/ : \"/\")\n\t\t.filter(Boolean)\n\t\t.map((segment) => encodeURIComponent(segment))\n\t\t.join(\"/\");\n}\n\nexport function portablePathToFileUri(filePath: string): string {\n\tconst flavor = pathFlavor(filePath);\n\tconst normalized = normalizePortablePath(filePath, flavor);\n\tif (flavor === \"posix\") return `file:///${encodePathSegments(normalized, flavor)}`;\n\tif (normalized.startsWith(\"\\\\\\\\\")) {\n\t\tconst parts = normalized.slice(2).split(\"\\\\\");\n\t\tconst host = parts.shift();\n\t\tif (!host) throw new Error(`Invalid UNC path: ${filePath}`);\n\t\treturn `file://${host}/${encodePathSegments(parts.join(\"/\"), flavor)}`;\n\t}\n\tconst drive = normalized.slice(0, 2);\n\treturn `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;\n}\n\nexport function relativePortablePath(from: string, to: string): string {\n\tconst flavor = pathFlavor(from);\n\tif (absolutePathFlavor(to) !== flavor) return to;\n\treturn pathApi(flavor).relative(from, to);\n}\n\n/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */\nexport function relativeWithin(root: string, candidate: string): string | undefined {\n\tconst flavor = pathFlavor(root);\n\tif (absolutePathFlavor(candidate) !== flavor) return undefined;\n\tconst api = pathApi(flavor);\n\tconst normalizedRoot = api.normalize(root);\n\tconst normalizedCandidate = api.normalize(candidate);\n\tconst comparableRoot = pathComparisonValue(normalizedRoot, flavor);\n\tconst comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);\n\tif (comparableRoot === comparableCandidate) return \"\";\n\tconst prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;\n\tif (!comparableCandidate.startsWith(prefix)) return undefined;\n\treturn normalizedCandidate.slice(prefix.length);\n}\n"]}