pi-agent-ide 0.6.1 → 0.6.2

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 (210) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +82 -30
  3. package/assets/summary/debugging.png +0 -0
  4. package/assets/summary/editing.png +0 -0
  5. package/assets/summary/read.png +0 -0
  6. package/assets/summary/search-and-replace.png +0 -0
  7. package/assets/summary/search.png +0 -0
  8. package/assets/summary/settings.png +0 -0
  9. package/assets/summary/terminal.png +0 -0
  10. package/assets/summary/thumbs/debugging.png +0 -0
  11. package/assets/summary/thumbs/editing.png +0 -0
  12. package/assets/summary/thumbs/read.png +0 -0
  13. package/assets/summary/thumbs/search-and-replace.png +0 -0
  14. package/assets/summary/thumbs/search.png +0 -0
  15. package/assets/summary/thumbs/settings.png +0 -0
  16. package/assets/summary/thumbs/terminal.png +0 -0
  17. package/assets/summary/thumbs/user_terminal.png +0 -0
  18. package/assets/summary/user_terminal.png +0 -0
  19. package/dist/{chunk-4KUFOHWP.js → chunk-3E2NTWCN.js} +1 -1
  20. package/dist/chunk-7WCZOO5I.js +1 -0
  21. package/dist/chunk-CEX3VOJ7.js +2 -0
  22. package/dist/{chunk-2527OQ4Y.js → chunk-HMLH43ZS.js} +1 -1
  23. package/dist/chunk-LVWMWWWF.js +28 -0
  24. package/dist/{chunk-HKMBQLEK.js → chunk-QDLTO5PH.js} +1 -1
  25. package/dist/{chunk-Z3VC3S2T.js → chunk-QIK2E64R.js} +1 -1
  26. package/dist/chunk-T7CZIACQ.js +27 -0
  27. package/dist/chunk-VXD6FZP5.js +5 -0
  28. package/dist/entry-1.js +1 -1
  29. package/dist/entry-2.js +1 -1
  30. package/dist/entry-31.js +8 -7
  31. package/dist/entry-34.js +1 -1
  32. package/dist/entry-36.js +1 -1
  33. package/dist/entry-37.js +1 -1
  34. package/dist/entry-51.js +9 -10
  35. package/dist/entry-53.js +1 -1
  36. package/dist/entry-54.js +1 -1
  37. package/dist/entry-55.js +1 -1
  38. package/dist/entry-56.js +1 -1
  39. package/dist/entry-57.js +1 -1
  40. package/dist/entry-58.js +1 -1
  41. package/dist/entry-59.js +1 -1
  42. package/dist/entry-60.js +1 -0
  43. package/dist/entry-61.js +1 -1
  44. package/dist/entry-63.js +1 -1
  45. package/dist/entry-64.js +0 -1
  46. package/dist/entry-65.js +1 -1
  47. package/dist/entry-66.js +1 -1
  48. package/dist/entry-67.js +1 -1
  49. package/dist/entry-68.js +1 -1
  50. package/dist/entry-69.js +1 -0
  51. package/dist/entry-70.js +1 -1
  52. package/dist/entry-72.js +1 -1
  53. package/dist/entry-73.js +0 -1
  54. package/dist/entry-74.js +1 -1
  55. package/dist/entry-75.js +1 -315
  56. package/dist/entry-76.js +1 -30
  57. package/dist/entry-77.js +315 -2
  58. package/dist/entry-78.js +30 -1
  59. package/dist/entry-79.js +2 -1
  60. package/dist/entry-80.js +1 -3
  61. package/dist/entry-81.js +1 -3
  62. package/dist/entry-82.js +3 -1
  63. package/dist/entry-83.js +3 -1
  64. package/dist/entry-84.js +1 -1
  65. package/dist/entry-85.js +1 -0
  66. package/dist/entry-86.js +1 -0
  67. package/dist/pi-agent-ide.js +1 -1
  68. package/docs/agent-guides/debugger.md +1 -1
  69. package/docs/agent-guides/terminal.md +1 -1
  70. package/node_modules/pi-agent-doctor/package.json +1 -1
  71. package/node_modules/pi-agent-documentation/package.json +1 -1
  72. package/node_modules/pi-agent-filesystem/package.json +6 -6
  73. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  74. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  75. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  76. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  77. package/node_modules/pi-agent-ide-ast/package.json +10 -9
  78. package/node_modules/pi-agent-ide-ast/src/search-presentation.ts +117 -0
  79. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +20 -2
  80. package/node_modules/pi-agent-ide-changes/package.json +7 -7
  81. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  82. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  83. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  84. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  85. package/node_modules/pi-agent-image/package.json +2 -2
  86. package/node_modules/pi-agent-invariant/package.json +1 -1
  87. package/node_modules/pi-agent-pdf/package.json +2 -2
  88. package/node_modules/pi-agent-read/package.json +7 -7
  89. package/node_modules/pi-agent-resource/package.json +1 -1
  90. package/node_modules/pi-agent-search/package.json +4 -4
  91. package/node_modules/pi-agent-search-text/package.json +14 -6
  92. package/node_modules/pi-agent-search-text/runtime/entry-54.js +1 -0
  93. package/node_modules/pi-agent-search-text/src/persisted-result.ts +9 -7
  94. package/node_modules/pi-agent-search-text/src/search-renderer.ts +10 -4
  95. package/node_modules/pi-agent-search-text/src/search-result.ts +8 -1
  96. package/node_modules/pi-agent-text/package.json +3 -3
  97. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  98. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  99. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  100. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-60.js +2 -0
  101. package/node_modules/pi-agent-text-editor/package.json +26 -26
  102. package/node_modules/pi-agent-text-editor/runtime/entry-75.js +0 -1
  103. package/node_modules/pi-agent-text-editor/runtime/entry-76.js +1 -0
  104. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  105. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-78.js +2 -0
  106. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  107. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-79.js +2 -0
  108. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  109. package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +1 -0
  110. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  111. package/node_modules/pi-agent-tool-ui/runtime/entry-81.js +1 -0
  112. package/node_modules/pi-agent-web/package.json +7 -7
  113. package/node_modules/pi-agent-web-html/package.json +3 -3
  114. package/node_modules/pi-agent-web-image/package.json +4 -4
  115. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  116. package/node_modules/pi-agent-web-pdf/runtime/entry-85.js +2 -0
  117. package/node_modules/pi-agent-web-text/package.json +4 -4
  118. package/node_modules/pi-agent-web-text/runtime/entry-86.js +2 -0
  119. package/package.json +35 -35
  120. package/src/api/plugin-protocol.ts +10 -4
  121. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
  122. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  123. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  124. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  125. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  126. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  127. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  128. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  129. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  130. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-85.js +2 -0
  131. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  132. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-86.js +2 -0
  133. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +2 -0
  134. package/src/extensions/pi-agent-read/package.json +7 -7
  135. package/src/extensions/pi-agent-search/package.json +4 -4
  136. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -6
  137. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +1 -0
  138. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-54.js +1 -0
  139. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +9 -7
  140. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +10 -4
  141. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +8 -1
  142. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  143. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  144. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  145. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  146. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-59.js +1 -0
  147. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-60.js +2 -0
  148. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  149. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +2 -0
  150. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  151. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-79.js +2 -0
  152. package/src/extensions/pi-agent-text-editor/runtime/entry-75.js +0 -1
  153. package/src/extensions/pi-agent-text-editor/runtime/entry-76.js +1 -0
  154. package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +2 -0
  155. package/src/plugins/pi-agent-ide-ast/package.json +10 -9
  156. package/src/plugins/pi-agent-ide-ast/src/search-presentation.ts +117 -0
  157. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +20 -2
  158. package/src/plugins/pi-agent-ide-changes/package.json +7 -7
  159. package/src/plugins/pi-agent-ide-debugger/index.ts +32 -10
  160. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +10 -1
  161. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +39 -0
  162. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +42 -5
  163. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  164. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  165. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  166. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  167. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +88 -9
  168. package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +6 -2
  169. package/src/plugins/pi-agent-ide-vision/index.ts +2 -1
  170. package/src/plugins/pi-agent-ide-vision/src/vision.ts +17 -3
  171. package/assets/gallery/apply-editing.png +0 -0
  172. package/assets/gallery/debugging.png +0 -0
  173. package/assets/gallery/read-web.png +0 -0
  174. package/assets/gallery/search-replace.png +0 -0
  175. package/assets/gallery/terminal.png +0 -0
  176. package/assets/gallery/tool-editing.png +0 -0
  177. package/dist/chunk-4LDOV7QS.js +0 -28
  178. package/dist/chunk-I6Y3W4X6.js +0 -27
  179. package/dist/chunk-YEQOQMU7.js +0 -5
  180. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-54.js +0 -2
  181. package/node_modules/pi-agent-text-editor/runtime/entry-60.js +0 -1
  182. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-76.js +0 -2
  183. package/node_modules/pi-agent-tool-call-interception/runtime/entry-78.js +0 -1
  184. package/node_modules/pi-agent-tool-ui/runtime/entry-79.js +0 -1
  185. package/node_modules/pi-agent-web/runtime/entry-80.js +0 -2
  186. package/node_modules/pi-agent-web-html/runtime/entry-81.js +0 -2
  187. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-81.js +0 -2
  188. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-82.js +0 -2
  189. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-80.js +0 -2
  190. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-54.js +0 -2
  191. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-55.js +0 -1
  192. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-76.js +0 -2
  193. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-77.js +0 -2
  194. package/src/extensions/pi-agent-text-editor/runtime/entry-59.js +0 -1
  195. package/src/extensions/pi-agent-text-editor/runtime/entry-60.js +0 -1
  196. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-53.js +0 -0
  197. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-55.js +0 -0
  198. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-56.js +0 -0
  199. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-57.js +0 -0
  200. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-58.js +0 -0
  201. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-59.js +0 -0
  202. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-77.js +0 -0
  203. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-82.js +0 -0
  204. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-83.js +0 -0
  205. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-84.js +0 -0
  206. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-83.js +0 -0
  207. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-84.js +0 -0
  208. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-56.js +0 -0
  209. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-57.js +0 -0
  210. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-58.js +0 -0
package/dist/entry-37.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as Ce}from"./chunk-MGCHOGQD.js";import{a as _e,b as ke}from"./chunk-T6LX2RX5.js";import{a as Ae}from"./chunk-L7JMDDSD.js";import{a as je,b as Me,d as $e}from"./chunk-O6LE42GK.js";import"./chunk-NNCZYO4Q.js";import{d as Ie}from"./chunk-VCTK4JSN.js";import"./chunk-YHUTTZC6.js";import{a as Ee}from"./chunk-6CZO43OH.js";import{a as xe,b as De}from"./chunk-OBNING2A.js";import"./chunk-S3ZPXWX7.js";import{a as qe}from"./chunk-ZTYWHL2F.js";import{a as Te,b as Oe}from"./chunk-7UGNGK7Y.js";import{a as D,b as E,c as $,d as k,j as me,k as fe,l as he}from"./chunk-NTYXZ3EL.js";import"./chunk-5VSE5X5R.js";import{a as be}from"./chunk-HKMBQLEK.js";import{a as ye,b as ve}from"./chunk-Z3VC3S2T.js";import"./chunk-KINKBPPX.js";import{b as Le,c as Se,g as Re,j as H,o as Pe}from"./chunk-M5MJP7Z2.js";import{a as we}from"./chunk-WZI4YC2O.js";import"./chunk-N34ATN52.js";import{a as v}from"./chunk-ZC65Z3CK.js";import{a as c}from"./chunk-EI7MMDWY.js";import sr from"node:path";var A=[{id:"vue-typescript-language-server",name:"vue-typescript-language-server",kind:"lsp",languages:["vue"],executables:["typescript-language-server"],dependencies:["typescript-language-server","@vue/typescript-plugin"],configFiles:["tsconfig.json"],documentation:"https://github.com/vuejs/language-tools/tree/master/packages/typescript-plugin",lsp:{command:["typescript-language-server","--stdio"],rootMarkers:["tsconfig.json","package.json"],languageIds:{vue:[".vue"]},initializationOptions:{plugins:[{name:"@vue/typescript-plugin",location:"{project}/node_modules/@vue/typescript-plugin",languages:["vue"]}]}}},m("elixir-ls",["elixir"],["elixir-ls"],["mix.exs"],{elixir:[".ex",".exs"]},["elixir-ls"],"https://github.com/elixir-lsp/elixir-ls",void 0,void 0,{elixirLS:{mcpEnabled:!1}}),m("metals",["scala"],["metals"],["build.sbt","project.scala",".bsp"],{scala:[".scala",".sc"]},["metals"],"https://scalameta.org/metals/"),{id:"angular-language-server",name:"angular-language-server",kind:"lsp",languages:["typescript","html"],executables:["ngserver"],dependencies:["@angular/language-server"],configFiles:["angular.json"],documentation:"https://github.com/angular/vscode-ng-language-service",lsp:{command:["ngserver","--stdio","--tsProbeLocations",".","--ngProbeLocations","."],rootMarkers:["angular.json"],requireRootMarker:!0,languageIds:{typescript:[".ts"],html:[".html"]}}},m("svelte-language-server",["svelte"],["svelteserver"],["svelte.config.js","package.json"],{svelte:[".svelte"]},["svelteserver","--stdio"],"https://github.com/sveltejs/language-tools/tree/master/packages/language-server",["svelte-language-server"]),m("dart-language-server",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],{dart:[".dart"]},["dart","language-server","--protocol=lsp"],"https://dart.dev/tools/dart-language-server"),m("r-language-server",["r"],["Rscript"],["DESCRIPTION",".lintr",".Rprofile"],{r:[".r"]},["Rscript","-e","languageserver::run()"],"https://github.com/REditorSupport/languageserver"),m("zls",["zig"],["zls"],["build.zig","build.zig.zon","zls.json"],{zig:[".zig",".zon"]},["zls"],"https://zigtools.org/zls/"),m("clangd",["c","cpp"],["clangd"],[".clangd","compile_commands.json","CMakeLists.txt"],{c:[".c",".h"],cpp:[".cc",".cpp",".cxx",".hh",".hpp",".hxx"]},["clangd"],"https://clangd.llvm.org/"),m("typescript-language-server",["javascript","typescript"],["typescript-language-server"],["tsconfig.json","jsconfig.json","package.json"],{javascript:[".js",".mjs",".cjs"],javascriptreact:[".jsx"],typescript:[".ts",".mts",".cts"],typescriptreact:[".tsx"]},["typescript-language-server","--stdio"],"https://github.com/typescript-language-server/typescript-language-server",["typescript-language-server"]),m("basedpyright",["python"],["basedpyright-langserver","pyright-langserver"],["pyproject.toml","pyrightconfig.json"],{python:[".py",".pyi"]},["basedpyright-langserver","--stdio"],"https://docs.basedpyright.com/",["basedpyright"]),m("gopls",["go"],["gopls"],["go.mod","go.work"],{go:[".go"]},["gopls"],"https://go.dev/gopls/"),m("rust-analyzer",["rust"],["rust-analyzer"],["Cargo.toml","rust-project.json"],{rust:[".rs"]},["rust-analyzer"],"https://rust-analyzer.github.io/"),m("csharp-ls",["csharp"],["csharp-ls"],[".sln",".csproj"],{csharp:[".cs"]},["csharp-ls"],"https://github.com/razzmatazz/csharp-language-server"),m("jdtls",["java"],["jdtls"],["pom.xml","build.gradle",".project"],{java:[".java"]},["jdtls"],"https://projects.eclipse.org/projects/eclipse.jdt.ls"),m("kotlin-language-server",["kotlin"],["kotlin-language-server"],["build.gradle.kts","pom.xml"],{kotlin:[".kt",".kts"]},["kotlin-language-server"],"https://github.com/fwcd/kotlin-language-server"),m("solargraph",["ruby"],["solargraph"],["Gemfile",".solargraph.yml"],{ruby:[".rb",".rake"]},["solargraph","stdio"],"https://solargraph.org/"),m("intelephense",["php"],["intelephense"],["composer.json"],{php:[".php"]},["intelephense","--stdio"],"https://intelephense.com/"),m("sourcekit-lsp",["swift"],["sourcekit-lsp"],["Package.swift"],{swift:[".swift"]},["sourcekit-lsp"],"https://github.com/swiftlang/sourcekit-lsp"),m("lua-language-server",["lua"],["lua-language-server"],[".luarc.json",".luarc.jsonc"],{lua:[".lua"]},["lua-language-server"],"https://luals.github.io/"),m("bash-language-server",["shell"],["bash-language-server"],[".shellcheckrc"],{shell:[".sh",".bash"]},["bash-language-server","start"],"https://github.com/bash-lsp/bash-language-server"),m("vscode-css-language-server",["css"],["vscode-css-language-server"],["package.json"],{css:[".css",".scss",".less"]},["vscode-css-language-server","--stdio"],"https://github.com/microsoft/vscode-css-languageservice",void 0,void 0,{css:{},scss:{},less:{}}),m("vscode-html-language-server",["html"],["vscode-html-language-server"],["package.json"],{html:[".html",".htm"]},["vscode-html-language-server","--stdio"],"https://github.com/microsoft/vscode-html-languageservice"),m("yaml-language-server",["yaml"],["yaml-language-server"],[".yamllint","package.json"],{yaml:[".yaml",".yml"]},["yaml-language-server","--stdio"],"https://github.com/redhat-developer/yaml-language-server"),m("taplo-lsp",["toml"],["taplo"],["taplo.toml"],{toml:[".toml"]},["taplo","lsp","stdio"],"https://taplo.tamasfe.dev/"),m("marksman",["markdown"],["marksman"],[".marksman.toml"],{markdown:[".md",".mdx"]},["marksman","server"],"https://github.com/artempyanykh/marksman"),m("terraform-ls",["terraform"],["terraform-ls"],[".terraform.lock.hcl"],{terraform:[".tf",".tfvars"]},["terraform-ls","serve"],"https://github.com/hashicorp/terraform-ls"),m("kotlin-lsp",["kotlin"],["intellij-server"],["build.gradle.kts","build.gradle","pom.xml","settings.gradle.kts"],{kotlin:[".kt",".kts"]},["intellij-server","--stdio"],"https://github.com/Kotlin/kotlin-lsp"),m("julia-language-server",["julia"],["julia"],["Project.toml","JuliaProject.toml"],{julia:[".jl"]},["julia","--startup-file=no","--history-file=no","-e","using LanguageServer; runserver()"],"https://github.com/julia-vscode/LanguageServer.jl"),m("powershell-editor-services",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],{powershell:[".ps1",".psm1",".psd1"]},["pwsh","-NoProfile","-NonInteractive","-Command",'$ErrorActionPreference="Stop";Import-Module PowerShellEditorServices;$d=Join-Path (Get-Location) ".agents/tmp/powershell-lsp-$PID";[IO.Directory]::CreateDirectory($d)|Out-Null;Start-EditorServices -HostName Pi -HostProfileId Pi -HostVersion 1.0.0 -Stdio -LanguageServiceOnly -LogPath (Join-Path $d "server.log") -SessionDetailsPath (Join-Path $d "session.json")'],"https://github.com/PowerShell/PowerShellEditorServices"),m("neocmakelsp",["cmake"],["neocmakelsp"],["CMakeLists.txt",".neocmake.toml",".neocmakelint.toml"],{cmake:[".cmake"]},["neocmakelsp","stdio"],"https://github.com/neocmakelsp/neocmakelsp",void 0,{cmake:["CMakeLists.txt"]}),m("vscode-json-language-server",["json"],["vscode-json-language-server"],["package.json"],{json:[".json",".jsonc"]},["vscode-json-language-server","--stdio"],"https://github.com/microsoft/vscode-json-languageservice"),m("lemminx",["xml"],["lemminx"],[".lemminx.json"],{xml:[".xml",".xsd",".xsl"]},["lemminx"],"https://github.com/eclipse-lemminx/lemminx"),m("sqls",["sql"],["sqls"],[".sqls.yml"],{sql:[".sql"]},["sqls"],"https://github.com/sqls-server/sqls"),m("docker-langserver",["dockerfile"],["docker-langserver"],["Dockerfile"],{dockerfile:[".dockerfile"]},["docker-langserver","--stdio"],"https://github.com/rcjsuen/dockerfile-language-server-nodejs",void 0,{dockerfile:["Dockerfile","Containerfile"]})];function m(r,e,t,n,s,i,o,u,a,l){return{id:r,name:r,kind:"lsp",languages:e,executables:t,configFiles:n,documentation:o,...u&&{dependencies:u},lsp:{command:i,rootMarkers:n,languageIds:s,...a&&{fileNames:a},...l&&{settings:l}}}}c(m,"recipe");import St from"node:path";import Rt from"cross-spawn";import{createMessageConnection as Pt,CancellationTokenSource as _t,StreamMessageReader as kt}from"vscode-jsonrpc/node";import{URI as Ne}from"vscode-uri";import{watch as vt}from"node:fs";import{readdir as bt,stat as wt}from"node:fs/promises";import I from"node:path";import{URI as X}from"vscode-uri";var U=class{constructor(e,t,n){this.root=e;this.changed=t;this.failed=n}static{c(this,"LspFileWatchers")}registrations=new Map;disposed=!1;async register(e,t){let n=[];try{for(let s of t){let i=s.globPattern,o=typeof i=="string"?this.root:X.parse(typeof i.baseUri=="string"?i.baseUri:i.baseUri.uri).fsPath,u=typeof i=="string"?i:i.pattern,a=c(p=>I.matchesGlob(I.isAbsolute(u)?I.join(o,p):p,u),"matches"),l=new Set((await bt(o,{recursive:!0})).filter(a));if(this.disposed)throw new Error("Language server file watchers are disposed");let d=vt(o,{recursive:!0},(p,g)=>{!g||!a(g)||wt(I.join(o,g)).then(()=>{if(!this.registrations.get(e)?.includes(d))return;let h=l.has(g)?2:1;l.add(g),(s.kind??7)&(h===1?1:2)&&this.changed({uri:X.file(I.join(o,g)).toString(),type:h})},h=>{if(this.registrations.get(e)?.includes(d)){if(h.code!=="ENOENT"){this.failed(h);return}l.delete(g)&&(s.kind??7)&4&&this.changed({uri:X.file(I.join(o,g)).toString(),type:3})}})});d.on("error",this.failed),n.push(d)}}catch(s){for(let i of n)i.close();throw s}this.unregister(e),this.registrations.set(e,n)}unregister(e){for(let t of this.registrations.get(e)??[])t.close();this.registrations.delete(e)}dispose(){this.disposed=!0;for(let e of this.registrations.keys())this.unregister(e)}};import{StreamMessageWriter as Lt}from"vscode-jsonrpc/node";var G=class extends Lt{constructor(t,n){super(t);this.fail=n}static{c(this,"TransportWriter")}async write(t){try{await super.write(t)}catch(n){this.fail(n)}}};var C=class{static{c(this,"LspClient")}_process=null;_connection=null;_initialized=!1;_serverCapabilities=null;_disposed=!1;_crashed=!1;_stderr="";_fileWatchers;_handlers=new Map;_documentVersions=new Map;_documentContents=new Map;_diagnosticPublications=new Map;_diagnosticMode="unknown";_activeDiagnosticRequests=new Set;serverId;rootUri;_command;_args;_env;_initOptions;_settings;_timeoutMs;constructor(e){this.serverId=e.serverId,this.rootUri=e.rootUri,this._command=e.command,this._args=e.command.slice(1),this._env=e.env??{},this._initOptions=e.initOptions,this._settings=e.settings,this._timeoutMs=e.timeoutMs??3e4}get ready(){return this._initialized&&!this._disposed}get crashed(){return this._crashed}get pid(){return this._process?.pid??null}get commandName(){return Le(this._command)}get diagnosticMode(){return this._diagnosticMode}setDiagnosticMode(e){this._diagnosticMode=e}get timeoutMs(){return this._timeoutMs}supportsCommand(e){let t=this._serverCapabilities?.executeCommandProvider;return Array.isArray(t?.commands)&&t.commands.includes(e)}get hasFoldingRangeCapability(){let e=this._serverCapabilities?.foldingRangeProvider;return e===!0||typeof e=="object"&&e!==null}documentContent(e){return this._documentContents.get(e)}documentVersion(e){return this._documentVersions.get(e)}diagnosticPublication(e){return this._diagnosticPublications.get(e)}beginDiagnosticRequest(e){this._activeDiagnosticRequests.add(e)}endDiagnosticRequest(e){this._activeDiagnosticRequests.delete(e)}hasActiveDiagnosticRequest(e){return this._activeDiagnosticRequests.has(e)}async start(){if(this._initialized)return;if(this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);let e=v(this._command[0]),t=Ne.parse(this.rootUri).fsPath,n=[{uri:this.rootUri,name:St.basename(t)||t}],s=Rt(e,this._args,{stdio:["pipe","pipe","pipe"],cwd:t,env:Pe({command:this._command,env:this._env},t,process.env)});this._process=s;let i=Ct(s);s.stdin?.on("error",()=>{}),s.stdout?.on("error",()=>{}),s.stderr?.on("error",()=>{}),this._stderr="",s.stderr?.setEncoding("utf8"),s.stderr?.on("data",a=>{this._stderr=(this._stderr+a).slice(-4096)}),s.on("error",a=>{("code"in a?a.code:void 0)!=="ENOENT"&&console.error(`[lsp] ${this.serverId}: spawn failed:`,a),this._crashed=!0,this._connection?.dispose(),this._connection=null,this._process=null}),s.on("exit",(a,l)=>{this._fileWatchers?.dispose(),!this._disposed&&a!==0&&a!==null&&(this._crashed=!0),this._connection?.dispose(),this._connection=null,this._process=null,this._initialized=!1}),await i;let o=Pt(new kt(v(s.stdout)),new G(v(s.stdin),a=>{this._connection!==o||this._disposed||(this._crashed=!0,this._initialized=!1,this._fileWatchers?.dispose(),o.dispose(),console.error(`[lsp] ${this.serverId}: transport write failed:`,a))}));this._connection=o,this._connection.onError(a=>{console.error(`[lsp] ${this.serverId}: connection error:`,a)}),this._fileWatchers=new U(t,a=>{this._sendNotification("workspace/didChangeWatchedFiles",{changes:[a]})},a=>console.error(`[lsp] ${this.serverId}: file watcher failed:`,a)),this._connection.onRequest("client/registerCapability",async a=>{for(let l of a.registrations)if(l.method!=="workspace/didChangeConfiguration"){if(l.method!=="workspace/didChangeWatchedFiles")throw new Error(`Unsupported dynamic capability: ${l.method}`);await this._fileWatchers?.register(l.id,l.registerOptions?.watchers??[])}return null}),this._connection.onRequest("client/unregisterCapability",a=>{for(let l of a.unregisterations)this._fileWatchers?.unregister(l.id);return null}),this._connection.onRequest("window/workDoneProgress/create",()=>null),this._connection.onRequest("workspace/configuration",a=>a.items.map(l=>{let d=this._settings??null;for(let p of l.section?.split(".").filter(Boolean)??[])d=typeof d=="object"&&d!==null?d[p]??null:null;return d})),this._connection.listen(),this._connection.onNotification((a,...l)=>{if(a==="textDocument/publishDiagnostics"){let d=l[0];d&&typeof d.uri=="string"&&Array.isArray(d.diagnostics)&&this._documentVersions.has(d.uri)&&(d.version===void 0||d.version===this.documentVersion(d.uri))&&this._diagnosticPublications.set(d.uri,{diagnostics:d.diagnostics,...typeof d.version=="number"&&{version:d.version}})}for(let d of this._handlers.get(a)??[])d(l[0])}),this._connection.onRequest("workspace/workspaceFolders",()=>n);let u=await Ve(this._connection.sendRequest("initialize",{processId:process.pid,rootUri:this.rootUri,workspaceFolders:n,capabilities:{workspace:{applyEdit:!1,configuration:!0,workspaceFolders:!0,didChangeWatchedFiles:{dynamicRegistration:!0,relativePatternSupport:!0},symbol:{dynamicRegistration:!1}},textDocument:{synchronization:{didOpen:!0,didChange:!0,didClose:!0},publishDiagnostics:{relatedInformation:!0},diagnostic:{dynamicRegistration:!1,relatedDocumentSupport:!1},documentSymbol:{hierarchicalDocumentSymbolSupport:!0},foldingRange:{lineFoldingOnly:!0}}},initializationOptions:this._initOptions}),this._timeoutMs,`[lsp] ${this.serverId}: initialize timed out`).catch(a=>{let l=this._stderr.trim();throw l?new Error(`[lsp] ${this.serverId}: ${l}`,{cause:a}):a});if(await this._connection.sendNotification("initialized",{capabilities:u.capabilities}),this._settings!==void 0&&await this._connection.sendNotification("workspace/didChangeConfiguration",{settings:this._settings}),this._crashed)throw new Error(`[lsp] ${this.serverId}: transport failed during initialization`);this._initialized=!0,this._serverCapabilities=u.capabilities,this._diagnosticMode=u.capabilities.diagnosticProvider?"pull":"push"}touch(){}async restart(){this._fileWatchers?.dispose(),this._connection?.dispose(),this._connection=null,this._process=null,this._initialized=!1,this._crashed=!1,this._disposed=!1,this._documentVersions.clear(),this._documentContents.clear(),this._diagnosticPublications.clear(),this._diagnosticMode="unknown",this._activeDiagnosticRequests.clear(),this._serverCapabilities=null,await this.start()}async sendRequest(e,t,n){if(this._assertReady(),n?.throwIfAborted(),!n)return v(this._connection).sendRequest(e,t);let s=new _t,i;try{let o=v(this._connection).sendRequest(e,t,s.token);return await Promise.race([o,new Promise((u,a)=>{i=c(()=>{s.cancel(),a(n.reason)},"onAbort"),n.addEventListener("abort",i,{once:!0})})])}finally{i&&n.removeEventListener("abort",i),s.dispose()}}sendNotification(e,t){this._assertReady(),this._sendNotification(e,t)}_sendNotification(e,t){let n=this._connection;n&&n.sendNotification(e,t).catch(s=>{this._connection!==n||this._disposed||(this._crashed=!0,this._initialized=!1,this._fileWatchers?.dispose(),n.dispose(),console.error(`[lsp] ${this.serverId}: notification ${e} failed:`,s))})}onNotification(e,t){let n=this._handlers.get(e)??[];return n.push(t),this._handlers.set(e,n),()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}toUri(e){return e.startsWith("file://")?e:Ne.file(e).toString()}openDocument(e,t,n,s=1){let i=this._documentVersions.get(e);if(i!==void 0){this.changeDocument(e,t,Math.max(s,i+1));return}this._diagnosticPublications.delete(e),this.sendNotification("textDocument/didOpen",{textDocument:{uri:e,languageId:n,version:s,text:t}}),this._documentVersions.set(e,s),this._documentContents.set(e,t)}syncDocument(e,t,n,s=!1){if(this._documentContents.get(e)===t)return;let i=this._documentVersions.get(e);i===void 0?this.openDocument(e,t,n):this.changeDocument(e,t,i+1);let o=this._serverCapabilities?.textDocumentSync,u=typeof o=="object"&&o!==null?o.save:void 0;s&&u&&this.sendNotification("textDocument/didSave",{textDocument:{uri:e},...typeof u=="object"&&u.includeText&&{text:t}})}changeDocument(e,t,n){let s=this._documentVersions.get(e),i=Math.max(n,(s??0)+1);this._diagnosticPublications.delete(e),this.sendNotification("textDocument/didChange",{textDocument:{uri:e,version:i},contentChanges:[{text:t}]}),this._documentVersions.set(e,i),this._documentContents.set(e,t)}closeDocument(e){this.sendNotification("textDocument/didClose",{textDocument:{uri:e}}),this._documentVersions.delete(e),this._documentContents.delete(e),this._diagnosticPublications.delete(e)}async shutdown(){if(!this._disposed){if(this._disposed=!0,this._fileWatchers?.dispose(),this._connection&&this._initialized)try{await Ve(this._connection.sendRequest("shutdown"),Math.min(this._timeoutMs,1e3),`[lsp] ${this.serverId}: shutdown timed out`),await this._connection.sendNotification("exit").catch(()=>{})}catch{}this._connection?.dispose(),this._connection=null,this._process&&!this._process.killed&&(this._process.kill("SIGTERM"),setTimeout(()=>{this._process&&!this._process.killed&&this._process.kill("SIGKILL")},2e3).unref()),this._initialized=!1,this._documentVersions.clear(),this._documentContents.clear(),this._diagnosticPublications.clear(),this._diagnosticMode="unknown",this._activeDiagnosticRequests.clear(),this._serverCapabilities=null}}dispose(){this.shutdown()}_assertReady(){if(this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);if(this._crashed)throw new Error(`[lsp] ${this.serverId}: crashed \u2014 call restart()`);if(!this._initialized)throw new Error(`[lsp] ${this.serverId}: not started \u2014 call start()`);if(!this._connection)throw new Error(`[lsp] ${this.serverId}: connection lost`)}};function Ct(r){return new Promise((e,t)=>{let n=c(()=>{r.off("spawn",s),r.off("error",i)},"cleanup"),s=c(()=>{n(),e()},"onSpawn"),i=c(o=>{n(),t(o)},"onError");r.once("spawn",s),r.once("error",i)})}c(Ct,"waitForSpawn");function Ve(r,e,t){return new Promise((n,s)=>{let i=setTimeout(()=>{s(new Error(t))},e);r.then(o=>{clearTimeout(i),n(o)}).catch(o=>{clearTimeout(i),s(o instanceof Error?o:new Error(String(o)))})})}c(Ve,"withTimeout");import{readFile as We}from"node:fs/promises";import{URI as ze}from"vscode-uri";var T={Error:1,Warning:2,Information:3,Hint:4};var Fe={command:"typescript.tsserverRequest",async request(r,e,t){return(await Promise.all(["syntacticDiagnosticsSync","semanticDiagnosticsSync","suggestionDiagnosticsSync"].map(async s=>{let i=await r.sendRequest("workspace/executeCommand",{command:"typescript.tsserverRequest",arguments:[s,{file:e,includeLinePosition:!0},{isAsync:!1,expectsResult:!0}]},t);if(!Y(i)||i.success!==!0||!Array.isArray(i.body))throw new Error(`Invalid completed TypeScript diagnostic report: ${s}`);return i.body.map(xt)}))).flat()}};function B(r){return r.supportsCommand(Fe.command)?Fe:void 0}c(B,"completedDiagnosticAdapter");function xt(r){if(!Y(r)||typeof r.message!="string"||typeof r.code!="number"&&typeof r.code!="string"||!Y(r.startLocation)||!Number.isInteger(r.startLocation.line)||!Number.isInteger(r.startLocation.offset)||Number(r.startLocation.line)<1||Number(r.startLocation.offset)<1||!["error","warning","suggestion","message"].includes(String(r.category)))throw new Error("Invalid TypeScript diagnostic entry");return{code:String(r.code),message:r.message,line:Number(r.startLocation.line),column:Number(r.startLocation.offset),severity:r.category==="error"?"error":r.category==="warning"?"warning":r.category==="suggestion"?"hint":"info"}}c(xt,"convertTypeScriptDiagnostic");function Y(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}c(Y,"isRecord");async function O(r,e,t,n={}){let s=new AbortController,i=AbortSignal.any([s.signal,...n.signal?[n.signal]:[]]),o=setTimeout(()=>s.abort(new Error(`[lsp] ${r.serverId}: diagnostics timed out for ${e}`)),r.timeoutMs);try{return await Dt(r,e,t,n.content,i)}finally{clearTimeout(o)}}c(O,"requestDiagnostics");async function Dt(r,e,t,n,s){if(s.throwIfAborted(),r.diagnosticMode!=="push"){let a=r.documentVersion(e);try{let l=await r.sendRequest("textDocument/diagnostic",{textDocument:{uri:e}},s);if(l.kind!=="full"||!Array.isArray(l.items))throw new Error("Invalid full diagnostic report");if(r.documentVersion(e)!==a)throw new Error("Document changed during diagnostic request");return r.setDiagnosticMode("pull"),He(l.items,!1,!0)}catch(l){if(!Et(l))throw l;r.setDiagnosticMode("push")}}let i=B(r);if(i){r.documentVersion(e)===void 0&&r.syncDocument(e,n??await We(ze.parse(e).fsPath,"utf8"),t??"plaintext");let a=r.documentVersion(e),l=await i.request(r,e,s);if(s.throwIfAborted(),r.documentVersion(e)!==a)throw new Error("Document changed during diagnostic request");return{diagnostics:l,syntaxErrors:[],otherDiagnostics:l,unversioned:!1,complete:!0}}s.throwIfAborted();let o=r.documentVersion(e)!==void 0,u=o?void 0:n??await We(ze.parse(e).fsPath,"utf8");s.throwIfAborted(),r.beginDiagnosticRequest(e);try{return await new Promise((a,l)=>{let d=r.documentVersion(e)??1,p=c(f=>{let w=f;w.uri!==e||!Array.isArray(w.diagnostics)||w.version!==void 0&&w.version!==d||r.documentVersion(e)===d&&(y(),a(He(w.diagnostics,w.version===void 0)))},"receive"),g=r.onNotification("textDocument/publishDiagnostics",p),h=c(()=>{y(),l(s.reason)},"onAbort");function y(){g(),s.removeEventListener("abort",h)}c(y,"cleanup"),s.addEventListener("abort",h,{once:!0});try{o||r.syncDocument(e,u??"",t??"plaintext");let f=r.diagnosticPublication(e);f&&p({uri:e,...f})}catch(f){y(),l(f)}})}finally{r.endDiagnosticRequest(e)}}c(Dt,"requestCurrentDiagnostics");function Q(r){return{code:String(r.code??"LSP"),message:r.message,line:r.range.start.line+1,column:r.range.start.character+1,severity:r.severity===T.Warning?"warning":r.severity===T.Information?"info":r.severity===T.Hint?"hint":"error"}}c(Q,"toDiagnostic");function He(r,e,t=!1){let n=r.map(Q);return{diagnostics:n,syntaxErrors:[],otherDiagnostics:n,unversioned:e,complete:t}}c(He,"classify");function Et(r){return r!==null&&typeof r=="object"&&"code"in r&&r.code===-32601}c(Et,"isMethodNotFound");var It={1:"File",2:"Module",3:"Namespace",4:"Package",5:"Class",6:"Method",7:"Property",8:"Field",9:"Constructor",10:"Enum",11:"Interface",12:"Function",13:"Variable",14:"Constant",15:"String",16:"Number",17:"Boolean",18:"Array",19:"Object",20:"Key",21:"Null",22:"EnumMember",23:"Struct",24:"Event",25:"Operator",26:"TypeParameter"};function P(r){return It[r]??`SymbolKind(${r})`}c(P,"symbolKindName");async function Z(r,e){return await r.sendRequest("textDocument/documentSymbol",{textDocument:{uri:e}})??[]}c(Z,"requestDocumentSymbols");async function ee(r,e,t=100){return(await r.sendRequest("workspace/symbol",{query:e})??[]).slice(0,t)}c(ee,"requestWorkspaceSymbols");async function te(r,e,t,n){return await r.sendRequest("textDocument/rename",{textDocument:{uri:e},position:t,newName:n})}c(te,"requestRename");import S from"node:path";import{URI as At}from"vscode-uri";import{readdir as jt,stat as Mt}from"node:fs/promises";import q from"node:path";import{URI as re}from"vscode-uri";function Ue(r,e){let t=c(n=>typeof n=="string"?n.replaceAll("{project}",()=>e):Array.isArray(n)?n.map(t):n!==null&&typeof n=="object"?Object.fromEntries(Object.entries(n).map(([s,i])=>[s,t(i)])):n,"expand");return Object.fromEntries(Object.entries(r).map(([n,s])=>[n,t(s)]))}c(Ue,"resolveInitializationOptions");var x=class r{constructor(e){this._registry=e}static{c(this,"LspManager")}_clients=new Map;_clientStarts=new Map;_openDocs=new Set;_pushUnsubscribers=new Map;_pushHandlers=new Set;_pushFingerprints=new Map;_disposed=!1;static _instance=null;static getInstance(){if(!r._instance)throw new Error("[lsp] LspManager not initialized");return r._instance}static getInstanceOrNull(){return r._instance}static init(e){let t=r._instance;return t?._disposed?(t._registry=e,t._disposed=!1,t):(r._instance=new r(e),r._instance)}static async resetForTest(){r._instance&&(await r._instance.shutdownAll(),r._instance=null)}get clientCount(){return this._clients.size}onPushDiagnostics(e){return this._pushHandlers.add(e),()=>this._pushHandlers.delete(e)}async getOrStart(e,t,n){if(this._disposed)return null;let s=this._registry.resolve(e),i=n==="symbols"?s[0]:s.find(p=>p.config.capabilities.includes(n));if(!i)return null;let o=re.file(t).toString(),u=`${i.serverId}:${o}`,a=this._clientStarts.get(u);if(a)return a;let l=this._clients.get(u);if(l?.ready)return l;let d=this._startClient(u,o,i,l);this._clientStarts.set(u,d);try{return await d}finally{this._clientStarts.get(u)===d&&this._clientStarts.delete(u)}}async _startClient(e,t,n,s){let i=s??new C({serverId:n.serverId,rootUri:t,command:n.config.command,...n.config.env&&{env:n.config.env},...n.config.initializationOptions&&{initOptions:Ue(n.config.initializationOptions,re.parse(t).fsPath)},...n.config.settings&&{settings:n.config.settings},...n.config.timeoutMs&&{timeoutMs:n.config.timeoutMs}});try{s?await s.restart():await i.start()}catch(o){throw await i.shutdown().catch(()=>{}),o}if(this._disposed)throw await i.shutdown(),new Error(`[lsp] ${n.serverId}: manager disposed during startup`);return this._clients.set(e,i),this._subscribeToPushDiagnostics(e,i),i}async getWorkspaceClients(e,t="symbols",n=e){let s=new Set,i=new Set(this._registry.knownExtensions),o=new Set([".git",".cache","node_modules","dist","build"]),u=c(async l=>{if(i.size===0)return;let d;try{d=await jt(l,{withFileTypes:!0})}catch{return}for(let p of d){if(i.size===0)return;if(p.isDirectory()){o.has(p.name)||await u(q.join(l,p.name));continue}if(!p.isFile())continue;let g=q.extname(p.name).toLowerCase();if(!i.has(g))continue;let h=q.join(l,p.name),y=await this.openFile(h,e,t).catch(()=>null);y&&(s.add(y.client),i.delete(g))}},"visit"),a=q.resolve(e,n);if((await Mt(a)).isFile()){let l=await this.openFile(a,e,t);return l===null?[]:[l.client]}return await u(a),[...s]}async prepareWorkspaceSymbols(e,t=e){return this.getWorkspaceClients(e,"symbols",t)}hasServerFor(e){return this._registry.resolve(e).length>0}languageId(e){return this._registry.languageId(e)}isOpen(e){return this._openDocs.has(e)}async openFile(e,t,n="diagnostics"){let s=q.resolve(t,e),i=await this.getOrStart(s,t,n);if(!i)return null;let o=i.toUri(s),a=this._registry.resolve(s)[0]?.languageId??"plaintext";try{let{readFile:l}=await import("node:fs/promises"),d=await l(s,"utf8");i.openDocument(o,d,a),this._openDocs.add(o)}catch{}return{client:i,uri:o,languageId:a}}_subscribeToPushDiagnostics(e,t){if(this._pushUnsubscribers.has(e))return;let n=t.onNotification("textDocument/publishDiagnostics",s=>{let i=$t(s);if(!i||t.hasActiveDiagnosticRequest(i.uri))return;let o=t.documentVersion(i.uri);if(i.version!==void 0&&o!==void 0&&i.version<o)return;let u=`${e}:${i.uri}`,a=i.diagnostics.map(Q),l=JSON.stringify([i.version,o,a]);if(this._pushFingerprints.get(u)===l)return;this._pushFingerprints.set(u,l);let d={cwd:re.parse(t.rootUri).fsPath,serverId:t.serverId,uri:i.uri,diagnostics:a,...i.version!==void 0&&{version:i.version}};for(let p of this._pushHandlers)p(d)});this._pushUnsubscribers.set(e,n)}async shutdownAll(){this._disposed=!0,await Promise.allSettled(this._clientStarts.values());let e=[...this._clients.values()];await Promise.all(e.map(t=>t.shutdown()));for(let t of this._pushUnsubscribers.values())t();this._pushUnsubscribers.clear(),this._clientStarts.clear(),this._pushFingerprints.clear(),this._pushHandlers.clear(),this._clients.clear()}dispose(){this.shutdownAll()}};function $t(r){if(r===null||typeof r!="object")return;let e=r;if(!(typeof e.uri!="string"||!Array.isArray(e.diagnostics)))return{uri:e.uri,diagnostics:e.diagnostics,...typeof e.version=="number"&&{version:e.version}}}c($t,"parsePushNotification");async function N(r,e,t){return await r.sendRequest("textDocument/references",{textDocument:{uri:e},position:t,context:{includeDeclaration:!0}})??[]}c(N,"requestReferences");async function ne(r,e,t){let n=await r.sendRequest("textDocument/prepareCallHierarchy",{textDocument:{uri:e},position:t}),s=n?.[0];if(!s)return{items:[],incoming:[],outgoing:[]};let[i,o]=await Promise.all([r.sendRequest("callHierarchy/incomingCalls",{item:s}).catch(()=>[]),r.sendRequest("callHierarchy/outgoingCalls",{item:s}).catch(()=>[])]);return{items:n,incoming:i??[],outgoing:o??[]}}c(ne,"requestCallHierarchy");function Ge(r,e,t){let n=S.relative(S.resolve(e,t.path??"."),r);if(n===".."||n.startsWith(`..${S.sep}`)||S.isAbsolute(n))return!1;let s=S.relative(e,r).split(S.sep).join("/"),i=c(o=>o.split(",").some(u=>{let a=u.trim();return a.length>0&&S.matchesGlob(a.includes("/")?s:S.basename(r),a)}),"matches");return(t.include===void 0||i(t.include))&&(t.exclude===void 0||!i(t.exclude))}c(Ge,"withinScope");function J(r){try{return At.parse(r).fsPath}catch{return r.startsWith("file://")?decodeURIComponent(r.slice(7)):r}}c(J,"uriToFilePath");function Be(r,e,t,n,s){let i=J(t),o=S.relative(r,i);return{filePath:o.startsWith("..")?i:o,lineNumber:n+1,column:s+1,kind:String(e.kind),name:e.name}}c(Be,"toHit");async function se(r,e,t,n,s={},i=x.getInstance()){if(n?.aborted)throw new Error("Operation aborted");let o=await i.prepareWorkspaceSymbols(e,s.path??e),u=[];for(let d of o){if(n?.aborted)throw new Error("Operation aborted");try{u.push(...await ee(d,r,Number.MAX_SAFE_INTEGER))}catch{}}let a=new Set,l=[];for(let d of u){if(n?.aborted)throw new Error("Operation aborted");if(l.length>=t)break;let p=d.location,g=Be(e,d,p.uri,p.range.start.line,p.range.start.character),h=`${g.filePath}:${g.lineNumber}:${g.column}`;if(Ge(J(p.uri),e,s)&&!a.has(h)&&(a.add(h),l.push(g)),l.length>=t)break;let y=J(p.uri),f=await i.openFile(y,e,"symbols").catch(()=>null);if(!f)continue;let w=await N(f.client,f.uri,p.range.start).catch(()=>[]);for(let R of w){let z=Be(e,d,R.uri,R.range.start.line,R.range.start.character),ge=`${z.filePath}:${z.lineNumber}:${z.column}`;if(Ge(J(R.uri),e,s)&&!a.has(ge)&&(a.add(ge),l.push(z)),l.length>=t)break}}return l}c(se,"searchSymbols");import{readFile as V}from"node:fs/promises";import j from"node:path";import{fileURLToPath as Tt}from"node:url";var Ot={failureLabel:"SYMBOL_READ_FAILED",emptyReason:"no symbol source was produced."},ie=10,oe=5,M=10;async function Xe(r,e,t,n,s){L(s);let i=await V(e,"utf8"),o=await W(r,e,n),u=F(o.symbols,t,o.displayPath),a=await V(o.filePath,"utf8");if(L(s),i!==a)throw new Error("The symbol source changed during resolution. Read it again before editing.");return{source:o.filePath,range:u.range,content:a}}c(Xe,"resolveLspDeclaration");async function Ye(r,e,t,n,s){L(s);let i=await V(e,"utf8"),o=await W(r,e,n),u=F(o.symbols,t,o.displayPath);if(i!==await V(e,"utf8"))throw new Error("The rename source changed during resolution.");return L(s),{client:o.client,uri:o.uri,position:u.selectionRange.start,content:i}}c(Ye,"resolveLspRenameTarget");async function le(r,e,t,n,s){L(s);let i=await W(r,e,n),o=F(i.symbols,t,i.displayPath),u=await zt(i.filePath);L(s);let a=o.range.start.line+1,l=Math.min(o.range.end.line+1,u.lines.length),d=u.lines.slice(Math.max(0,a-1),Math.max(0,l)).map((g,h)=>{let y=a+h;return me({content:g,sourceLine:{source:i.filePath,lineNumber:y,content:g}})}),p={path:i.displayPath,heading:`symbol: ${k(o.selector)}`,details:[`defined in: ${i.displayPath}:${a}-${l} (${P(o.kind)})`],startLine:a,endLine:l,totalLines:u.lines.length,renderedLines:d};return fe([p],Ot)}c(le,"readLspSymbolBody");async function de(r,e,t,n,s){L(s);let i=await W(r,e,n),o=F(i.symbols,t,i.displayPath),u=await tt(i,o,s),a=new K(n);return await qt(i,o,u,a)}c(de,"readLspSymbolGraph");async function ue(r,e,t,n){L(n);let s=await W(r,e,t),i=new K(t),o=[`## file graph: ${s.displayPath}`,`Top-level declarations: ${s.symbols.length}`];for(let u of s.symbols){L(n);let a=await tt(s,u,n);o.push("",...await Wt(s,u,a,i))}return o.join(`
1
+ import{a as Ce}from"./chunk-MGCHOGQD.js";import{a as _e,b as ke}from"./chunk-T6LX2RX5.js";import{a as Ae}from"./chunk-L7JMDDSD.js";import{a as je,b as Me,d as $e}from"./chunk-O6LE42GK.js";import"./chunk-NNCZYO4Q.js";import{d as Ie}from"./chunk-VCTK4JSN.js";import"./chunk-YHUTTZC6.js";import{a as Ee}from"./chunk-6CZO43OH.js";import{a as xe,b as De}from"./chunk-OBNING2A.js";import"./chunk-S3ZPXWX7.js";import{a as qe}from"./chunk-ZTYWHL2F.js";import{a as Te,b as Oe}from"./chunk-7UGNGK7Y.js";import{a as D,b as E,c as $,d as k,j as me,k as fe,l as he}from"./chunk-NTYXZ3EL.js";import"./chunk-5VSE5X5R.js";import{a as be}from"./chunk-QDLTO5PH.js";import{a as ye,b as ve}from"./chunk-QIK2E64R.js";import"./chunk-KINKBPPX.js";import{b as Le,c as Se,g as Re,j as H,o as Pe}from"./chunk-M5MJP7Z2.js";import{a as we}from"./chunk-WZI4YC2O.js";import"./chunk-N34ATN52.js";import{a as v}from"./chunk-ZC65Z3CK.js";import{a as c}from"./chunk-EI7MMDWY.js";import sr from"node:path";var A=[{id:"vue-typescript-language-server",name:"vue-typescript-language-server",kind:"lsp",languages:["vue"],executables:["typescript-language-server"],dependencies:["typescript-language-server","@vue/typescript-plugin"],configFiles:["tsconfig.json"],documentation:"https://github.com/vuejs/language-tools/tree/master/packages/typescript-plugin",lsp:{command:["typescript-language-server","--stdio"],rootMarkers:["tsconfig.json","package.json"],languageIds:{vue:[".vue"]},initializationOptions:{plugins:[{name:"@vue/typescript-plugin",location:"{project}/node_modules/@vue/typescript-plugin",languages:["vue"]}]}}},m("elixir-ls",["elixir"],["elixir-ls"],["mix.exs"],{elixir:[".ex",".exs"]},["elixir-ls"],"https://github.com/elixir-lsp/elixir-ls",void 0,void 0,{elixirLS:{mcpEnabled:!1}}),m("metals",["scala"],["metals"],["build.sbt","project.scala",".bsp"],{scala:[".scala",".sc"]},["metals"],"https://scalameta.org/metals/"),{id:"angular-language-server",name:"angular-language-server",kind:"lsp",languages:["typescript","html"],executables:["ngserver"],dependencies:["@angular/language-server"],configFiles:["angular.json"],documentation:"https://github.com/angular/vscode-ng-language-service",lsp:{command:["ngserver","--stdio","--tsProbeLocations",".","--ngProbeLocations","."],rootMarkers:["angular.json"],requireRootMarker:!0,languageIds:{typescript:[".ts"],html:[".html"]}}},m("svelte-language-server",["svelte"],["svelteserver"],["svelte.config.js","package.json"],{svelte:[".svelte"]},["svelteserver","--stdio"],"https://github.com/sveltejs/language-tools/tree/master/packages/language-server",["svelte-language-server"]),m("dart-language-server",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],{dart:[".dart"]},["dart","language-server","--protocol=lsp"],"https://dart.dev/tools/dart-language-server"),m("r-language-server",["r"],["Rscript"],["DESCRIPTION",".lintr",".Rprofile"],{r:[".r"]},["Rscript","-e","languageserver::run()"],"https://github.com/REditorSupport/languageserver"),m("zls",["zig"],["zls"],["build.zig","build.zig.zon","zls.json"],{zig:[".zig",".zon"]},["zls"],"https://zigtools.org/zls/"),m("clangd",["c","cpp"],["clangd"],[".clangd","compile_commands.json","CMakeLists.txt"],{c:[".c",".h"],cpp:[".cc",".cpp",".cxx",".hh",".hpp",".hxx"]},["clangd"],"https://clangd.llvm.org/"),m("typescript-language-server",["javascript","typescript"],["typescript-language-server"],["tsconfig.json","jsconfig.json","package.json"],{javascript:[".js",".mjs",".cjs"],javascriptreact:[".jsx"],typescript:[".ts",".mts",".cts"],typescriptreact:[".tsx"]},["typescript-language-server","--stdio"],"https://github.com/typescript-language-server/typescript-language-server",["typescript-language-server"]),m("basedpyright",["python"],["basedpyright-langserver","pyright-langserver"],["pyproject.toml","pyrightconfig.json"],{python:[".py",".pyi"]},["basedpyright-langserver","--stdio"],"https://docs.basedpyright.com/",["basedpyright"]),m("gopls",["go"],["gopls"],["go.mod","go.work"],{go:[".go"]},["gopls"],"https://go.dev/gopls/"),m("rust-analyzer",["rust"],["rust-analyzer"],["Cargo.toml","rust-project.json"],{rust:[".rs"]},["rust-analyzer"],"https://rust-analyzer.github.io/"),m("csharp-ls",["csharp"],["csharp-ls"],[".sln",".csproj"],{csharp:[".cs"]},["csharp-ls"],"https://github.com/razzmatazz/csharp-language-server"),m("jdtls",["java"],["jdtls"],["pom.xml","build.gradle",".project"],{java:[".java"]},["jdtls"],"https://projects.eclipse.org/projects/eclipse.jdt.ls"),m("kotlin-language-server",["kotlin"],["kotlin-language-server"],["build.gradle.kts","pom.xml"],{kotlin:[".kt",".kts"]},["kotlin-language-server"],"https://github.com/fwcd/kotlin-language-server"),m("solargraph",["ruby"],["solargraph"],["Gemfile",".solargraph.yml"],{ruby:[".rb",".rake"]},["solargraph","stdio"],"https://solargraph.org/"),m("intelephense",["php"],["intelephense"],["composer.json"],{php:[".php"]},["intelephense","--stdio"],"https://intelephense.com/"),m("sourcekit-lsp",["swift"],["sourcekit-lsp"],["Package.swift"],{swift:[".swift"]},["sourcekit-lsp"],"https://github.com/swiftlang/sourcekit-lsp"),m("lua-language-server",["lua"],["lua-language-server"],[".luarc.json",".luarc.jsonc"],{lua:[".lua"]},["lua-language-server"],"https://luals.github.io/"),m("bash-language-server",["shell"],["bash-language-server"],[".shellcheckrc"],{shell:[".sh",".bash"]},["bash-language-server","start"],"https://github.com/bash-lsp/bash-language-server"),m("vscode-css-language-server",["css"],["vscode-css-language-server"],["package.json"],{css:[".css",".scss",".less"]},["vscode-css-language-server","--stdio"],"https://github.com/microsoft/vscode-css-languageservice",void 0,void 0,{css:{},scss:{},less:{}}),m("vscode-html-language-server",["html"],["vscode-html-language-server"],["package.json"],{html:[".html",".htm"]},["vscode-html-language-server","--stdio"],"https://github.com/microsoft/vscode-html-languageservice"),m("yaml-language-server",["yaml"],["yaml-language-server"],[".yamllint","package.json"],{yaml:[".yaml",".yml"]},["yaml-language-server","--stdio"],"https://github.com/redhat-developer/yaml-language-server"),m("taplo-lsp",["toml"],["taplo"],["taplo.toml"],{toml:[".toml"]},["taplo","lsp","stdio"],"https://taplo.tamasfe.dev/"),m("marksman",["markdown"],["marksman"],[".marksman.toml"],{markdown:[".md",".mdx"]},["marksman","server"],"https://github.com/artempyanykh/marksman"),m("terraform-ls",["terraform"],["terraform-ls"],[".terraform.lock.hcl"],{terraform:[".tf",".tfvars"]},["terraform-ls","serve"],"https://github.com/hashicorp/terraform-ls"),m("kotlin-lsp",["kotlin"],["intellij-server"],["build.gradle.kts","build.gradle","pom.xml","settings.gradle.kts"],{kotlin:[".kt",".kts"]},["intellij-server","--stdio"],"https://github.com/Kotlin/kotlin-lsp"),m("julia-language-server",["julia"],["julia"],["Project.toml","JuliaProject.toml"],{julia:[".jl"]},["julia","--startup-file=no","--history-file=no","-e","using LanguageServer; runserver()"],"https://github.com/julia-vscode/LanguageServer.jl"),m("powershell-editor-services",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],{powershell:[".ps1",".psm1",".psd1"]},["pwsh","-NoProfile","-NonInteractive","-Command",'$ErrorActionPreference="Stop";Import-Module PowerShellEditorServices;$d=Join-Path (Get-Location) ".agents/tmp/powershell-lsp-$PID";[IO.Directory]::CreateDirectory($d)|Out-Null;Start-EditorServices -HostName Pi -HostProfileId Pi -HostVersion 1.0.0 -Stdio -LanguageServiceOnly -LogPath (Join-Path $d "server.log") -SessionDetailsPath (Join-Path $d "session.json")'],"https://github.com/PowerShell/PowerShellEditorServices"),m("neocmakelsp",["cmake"],["neocmakelsp"],["CMakeLists.txt",".neocmake.toml",".neocmakelint.toml"],{cmake:[".cmake"]},["neocmakelsp","stdio"],"https://github.com/neocmakelsp/neocmakelsp",void 0,{cmake:["CMakeLists.txt"]}),m("vscode-json-language-server",["json"],["vscode-json-language-server"],["package.json"],{json:[".json",".jsonc"]},["vscode-json-language-server","--stdio"],"https://github.com/microsoft/vscode-json-languageservice"),m("lemminx",["xml"],["lemminx"],[".lemminx.json"],{xml:[".xml",".xsd",".xsl"]},["lemminx"],"https://github.com/eclipse-lemminx/lemminx"),m("sqls",["sql"],["sqls"],[".sqls.yml"],{sql:[".sql"]},["sqls"],"https://github.com/sqls-server/sqls"),m("docker-langserver",["dockerfile"],["docker-langserver"],["Dockerfile"],{dockerfile:[".dockerfile"]},["docker-langserver","--stdio"],"https://github.com/rcjsuen/dockerfile-language-server-nodejs",void 0,{dockerfile:["Dockerfile","Containerfile"]})];function m(r,e,t,n,s,i,o,u,a,l){return{id:r,name:r,kind:"lsp",languages:e,executables:t,configFiles:n,documentation:o,...u&&{dependencies:u},lsp:{command:i,rootMarkers:n,languageIds:s,...a&&{fileNames:a},...l&&{settings:l}}}}c(m,"recipe");import St from"node:path";import Rt from"cross-spawn";import{createMessageConnection as Pt,CancellationTokenSource as _t,StreamMessageReader as kt}from"vscode-jsonrpc/node";import{URI as Ne}from"vscode-uri";import{watch as vt}from"node:fs";import{readdir as bt,stat as wt}from"node:fs/promises";import I from"node:path";import{URI as X}from"vscode-uri";var U=class{constructor(e,t,n){this.root=e;this.changed=t;this.failed=n}static{c(this,"LspFileWatchers")}registrations=new Map;disposed=!1;async register(e,t){let n=[];try{for(let s of t){let i=s.globPattern,o=typeof i=="string"?this.root:X.parse(typeof i.baseUri=="string"?i.baseUri:i.baseUri.uri).fsPath,u=typeof i=="string"?i:i.pattern,a=c(p=>I.matchesGlob(I.isAbsolute(u)?I.join(o,p):p,u),"matches"),l=new Set((await bt(o,{recursive:!0})).filter(a));if(this.disposed)throw new Error("Language server file watchers are disposed");let d=vt(o,{recursive:!0},(p,g)=>{!g||!a(g)||wt(I.join(o,g)).then(()=>{if(!this.registrations.get(e)?.includes(d))return;let h=l.has(g)?2:1;l.add(g),(s.kind??7)&(h===1?1:2)&&this.changed({uri:X.file(I.join(o,g)).toString(),type:h})},h=>{if(this.registrations.get(e)?.includes(d)){if(h.code!=="ENOENT"){this.failed(h);return}l.delete(g)&&(s.kind??7)&4&&this.changed({uri:X.file(I.join(o,g)).toString(),type:3})}})});d.on("error",this.failed),n.push(d)}}catch(s){for(let i of n)i.close();throw s}this.unregister(e),this.registrations.set(e,n)}unregister(e){for(let t of this.registrations.get(e)??[])t.close();this.registrations.delete(e)}dispose(){this.disposed=!0;for(let e of this.registrations.keys())this.unregister(e)}};import{StreamMessageWriter as Lt}from"vscode-jsonrpc/node";var G=class extends Lt{constructor(t,n){super(t);this.fail=n}static{c(this,"TransportWriter")}async write(t){try{await super.write(t)}catch(n){this.fail(n)}}};var C=class{static{c(this,"LspClient")}_process=null;_connection=null;_initialized=!1;_serverCapabilities=null;_disposed=!1;_crashed=!1;_stderr="";_fileWatchers;_handlers=new Map;_documentVersions=new Map;_documentContents=new Map;_diagnosticPublications=new Map;_diagnosticMode="unknown";_activeDiagnosticRequests=new Set;serverId;rootUri;_command;_args;_env;_initOptions;_settings;_timeoutMs;constructor(e){this.serverId=e.serverId,this.rootUri=e.rootUri,this._command=e.command,this._args=e.command.slice(1),this._env=e.env??{},this._initOptions=e.initOptions,this._settings=e.settings,this._timeoutMs=e.timeoutMs??3e4}get ready(){return this._initialized&&!this._disposed}get crashed(){return this._crashed}get pid(){return this._process?.pid??null}get commandName(){return Le(this._command)}get diagnosticMode(){return this._diagnosticMode}setDiagnosticMode(e){this._diagnosticMode=e}get timeoutMs(){return this._timeoutMs}supportsCommand(e){let t=this._serverCapabilities?.executeCommandProvider;return Array.isArray(t?.commands)&&t.commands.includes(e)}get hasFoldingRangeCapability(){let e=this._serverCapabilities?.foldingRangeProvider;return e===!0||typeof e=="object"&&e!==null}documentContent(e){return this._documentContents.get(e)}documentVersion(e){return this._documentVersions.get(e)}diagnosticPublication(e){return this._diagnosticPublications.get(e)}beginDiagnosticRequest(e){this._activeDiagnosticRequests.add(e)}endDiagnosticRequest(e){this._activeDiagnosticRequests.delete(e)}hasActiveDiagnosticRequest(e){return this._activeDiagnosticRequests.has(e)}async start(){if(this._initialized)return;if(this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);let e=v(this._command[0]),t=Ne.parse(this.rootUri).fsPath,n=[{uri:this.rootUri,name:St.basename(t)||t}],s=Rt(e,this._args,{stdio:["pipe","pipe","pipe"],cwd:t,env:Pe({command:this._command,env:this._env},t,process.env)});this._process=s;let i=Ct(s);s.stdin?.on("error",()=>{}),s.stdout?.on("error",()=>{}),s.stderr?.on("error",()=>{}),this._stderr="",s.stderr?.setEncoding("utf8"),s.stderr?.on("data",a=>{this._stderr=(this._stderr+a).slice(-4096)}),s.on("error",a=>{("code"in a?a.code:void 0)!=="ENOENT"&&console.error(`[lsp] ${this.serverId}: spawn failed:`,a),this._crashed=!0,this._connection?.dispose(),this._connection=null,this._process=null}),s.on("exit",(a,l)=>{this._fileWatchers?.dispose(),!this._disposed&&a!==0&&a!==null&&(this._crashed=!0),this._connection?.dispose(),this._connection=null,this._process=null,this._initialized=!1}),await i;let o=Pt(new kt(v(s.stdout)),new G(v(s.stdin),a=>{this._connection!==o||this._disposed||(this._crashed=!0,this._initialized=!1,this._fileWatchers?.dispose(),o.dispose(),console.error(`[lsp] ${this.serverId}: transport write failed:`,a))}));this._connection=o,this._connection.onError(a=>{console.error(`[lsp] ${this.serverId}: connection error:`,a)}),this._fileWatchers=new U(t,a=>{this._sendNotification("workspace/didChangeWatchedFiles",{changes:[a]})},a=>console.error(`[lsp] ${this.serverId}: file watcher failed:`,a)),this._connection.onRequest("client/registerCapability",async a=>{for(let l of a.registrations)if(l.method!=="workspace/didChangeConfiguration"){if(l.method!=="workspace/didChangeWatchedFiles")throw new Error(`Unsupported dynamic capability: ${l.method}`);await this._fileWatchers?.register(l.id,l.registerOptions?.watchers??[])}return null}),this._connection.onRequest("client/unregisterCapability",a=>{for(let l of a.unregisterations)this._fileWatchers?.unregister(l.id);return null}),this._connection.onRequest("window/workDoneProgress/create",()=>null),this._connection.onRequest("workspace/configuration",a=>a.items.map(l=>{let d=this._settings??null;for(let p of l.section?.split(".").filter(Boolean)??[])d=typeof d=="object"&&d!==null?d[p]??null:null;return d})),this._connection.listen(),this._connection.onNotification((a,...l)=>{if(a==="textDocument/publishDiagnostics"){let d=l[0];d&&typeof d.uri=="string"&&Array.isArray(d.diagnostics)&&this._documentVersions.has(d.uri)&&(d.version===void 0||d.version===this.documentVersion(d.uri))&&this._diagnosticPublications.set(d.uri,{diagnostics:d.diagnostics,...typeof d.version=="number"&&{version:d.version}})}for(let d of this._handlers.get(a)??[])d(l[0])}),this._connection.onRequest("workspace/workspaceFolders",()=>n);let u=await Ve(this._connection.sendRequest("initialize",{processId:process.pid,rootUri:this.rootUri,workspaceFolders:n,capabilities:{workspace:{applyEdit:!1,configuration:!0,workspaceFolders:!0,didChangeWatchedFiles:{dynamicRegistration:!0,relativePatternSupport:!0},symbol:{dynamicRegistration:!1}},textDocument:{synchronization:{didOpen:!0,didChange:!0,didClose:!0},publishDiagnostics:{relatedInformation:!0},diagnostic:{dynamicRegistration:!1,relatedDocumentSupport:!1},documentSymbol:{hierarchicalDocumentSymbolSupport:!0},foldingRange:{lineFoldingOnly:!0}}},initializationOptions:this._initOptions}),this._timeoutMs,`[lsp] ${this.serverId}: initialize timed out`).catch(a=>{let l=this._stderr.trim();throw l?new Error(`[lsp] ${this.serverId}: ${l}`,{cause:a}):a});if(await this._connection.sendNotification("initialized",{capabilities:u.capabilities}),this._settings!==void 0&&await this._connection.sendNotification("workspace/didChangeConfiguration",{settings:this._settings}),this._crashed)throw new Error(`[lsp] ${this.serverId}: transport failed during initialization`);this._initialized=!0,this._serverCapabilities=u.capabilities,this._diagnosticMode=u.capabilities.diagnosticProvider?"pull":"push"}touch(){}async restart(){this._fileWatchers?.dispose(),this._connection?.dispose(),this._connection=null,this._process=null,this._initialized=!1,this._crashed=!1,this._disposed=!1,this._documentVersions.clear(),this._documentContents.clear(),this._diagnosticPublications.clear(),this._diagnosticMode="unknown",this._activeDiagnosticRequests.clear(),this._serverCapabilities=null,await this.start()}async sendRequest(e,t,n){if(this._assertReady(),n?.throwIfAborted(),!n)return v(this._connection).sendRequest(e,t);let s=new _t,i;try{let o=v(this._connection).sendRequest(e,t,s.token);return await Promise.race([o,new Promise((u,a)=>{i=c(()=>{s.cancel(),a(n.reason)},"onAbort"),n.addEventListener("abort",i,{once:!0})})])}finally{i&&n.removeEventListener("abort",i),s.dispose()}}sendNotification(e,t){this._assertReady(),this._sendNotification(e,t)}_sendNotification(e,t){let n=this._connection;n&&n.sendNotification(e,t).catch(s=>{this._connection!==n||this._disposed||(this._crashed=!0,this._initialized=!1,this._fileWatchers?.dispose(),n.dispose(),console.error(`[lsp] ${this.serverId}: notification ${e} failed:`,s))})}onNotification(e,t){let n=this._handlers.get(e)??[];return n.push(t),this._handlers.set(e,n),()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}toUri(e){return e.startsWith("file://")?e:Ne.file(e).toString()}openDocument(e,t,n,s=1){let i=this._documentVersions.get(e);if(i!==void 0){this.changeDocument(e,t,Math.max(s,i+1));return}this._diagnosticPublications.delete(e),this.sendNotification("textDocument/didOpen",{textDocument:{uri:e,languageId:n,version:s,text:t}}),this._documentVersions.set(e,s),this._documentContents.set(e,t)}syncDocument(e,t,n,s=!1){if(this._documentContents.get(e)===t)return;let i=this._documentVersions.get(e);i===void 0?this.openDocument(e,t,n):this.changeDocument(e,t,i+1);let o=this._serverCapabilities?.textDocumentSync,u=typeof o=="object"&&o!==null?o.save:void 0;s&&u&&this.sendNotification("textDocument/didSave",{textDocument:{uri:e},...typeof u=="object"&&u.includeText&&{text:t}})}changeDocument(e,t,n){let s=this._documentVersions.get(e),i=Math.max(n,(s??0)+1);this._diagnosticPublications.delete(e),this.sendNotification("textDocument/didChange",{textDocument:{uri:e,version:i},contentChanges:[{text:t}]}),this._documentVersions.set(e,i),this._documentContents.set(e,t)}closeDocument(e){this.sendNotification("textDocument/didClose",{textDocument:{uri:e}}),this._documentVersions.delete(e),this._documentContents.delete(e),this._diagnosticPublications.delete(e)}async shutdown(){if(!this._disposed){if(this._disposed=!0,this._fileWatchers?.dispose(),this._connection&&this._initialized)try{await Ve(this._connection.sendRequest("shutdown"),Math.min(this._timeoutMs,1e3),`[lsp] ${this.serverId}: shutdown timed out`),await this._connection.sendNotification("exit").catch(()=>{})}catch{}this._connection?.dispose(),this._connection=null,this._process&&!this._process.killed&&(this._process.kill("SIGTERM"),setTimeout(()=>{this._process&&!this._process.killed&&this._process.kill("SIGKILL")},2e3).unref()),this._initialized=!1,this._documentVersions.clear(),this._documentContents.clear(),this._diagnosticPublications.clear(),this._diagnosticMode="unknown",this._activeDiagnosticRequests.clear(),this._serverCapabilities=null}}dispose(){this.shutdown()}_assertReady(){if(this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);if(this._crashed)throw new Error(`[lsp] ${this.serverId}: crashed \u2014 call restart()`);if(!this._initialized)throw new Error(`[lsp] ${this.serverId}: not started \u2014 call start()`);if(!this._connection)throw new Error(`[lsp] ${this.serverId}: connection lost`)}};function Ct(r){return new Promise((e,t)=>{let n=c(()=>{r.off("spawn",s),r.off("error",i)},"cleanup"),s=c(()=>{n(),e()},"onSpawn"),i=c(o=>{n(),t(o)},"onError");r.once("spawn",s),r.once("error",i)})}c(Ct,"waitForSpawn");function Ve(r,e,t){return new Promise((n,s)=>{let i=setTimeout(()=>{s(new Error(t))},e);r.then(o=>{clearTimeout(i),n(o)}).catch(o=>{clearTimeout(i),s(o instanceof Error?o:new Error(String(o)))})})}c(Ve,"withTimeout");import{readFile as We}from"node:fs/promises";import{URI as ze}from"vscode-uri";var T={Error:1,Warning:2,Information:3,Hint:4};var Fe={command:"typescript.tsserverRequest",async request(r,e,t){return(await Promise.all(["syntacticDiagnosticsSync","semanticDiagnosticsSync","suggestionDiagnosticsSync"].map(async s=>{let i=await r.sendRequest("workspace/executeCommand",{command:"typescript.tsserverRequest",arguments:[s,{file:e,includeLinePosition:!0},{isAsync:!1,expectsResult:!0}]},t);if(!Y(i)||i.success!==!0||!Array.isArray(i.body))throw new Error(`Invalid completed TypeScript diagnostic report: ${s}`);return i.body.map(xt)}))).flat()}};function B(r){return r.supportsCommand(Fe.command)?Fe:void 0}c(B,"completedDiagnosticAdapter");function xt(r){if(!Y(r)||typeof r.message!="string"||typeof r.code!="number"&&typeof r.code!="string"||!Y(r.startLocation)||!Number.isInteger(r.startLocation.line)||!Number.isInteger(r.startLocation.offset)||Number(r.startLocation.line)<1||Number(r.startLocation.offset)<1||!["error","warning","suggestion","message"].includes(String(r.category)))throw new Error("Invalid TypeScript diagnostic entry");return{code:String(r.code),message:r.message,line:Number(r.startLocation.line),column:Number(r.startLocation.offset),severity:r.category==="error"?"error":r.category==="warning"?"warning":r.category==="suggestion"?"hint":"info"}}c(xt,"convertTypeScriptDiagnostic");function Y(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}c(Y,"isRecord");async function O(r,e,t,n={}){let s=new AbortController,i=AbortSignal.any([s.signal,...n.signal?[n.signal]:[]]),o=setTimeout(()=>s.abort(new Error(`[lsp] ${r.serverId}: diagnostics timed out for ${e}`)),r.timeoutMs);try{return await Dt(r,e,t,n.content,i)}finally{clearTimeout(o)}}c(O,"requestDiagnostics");async function Dt(r,e,t,n,s){if(s.throwIfAborted(),r.diagnosticMode!=="push"){let a=r.documentVersion(e);try{let l=await r.sendRequest("textDocument/diagnostic",{textDocument:{uri:e}},s);if(l.kind!=="full"||!Array.isArray(l.items))throw new Error("Invalid full diagnostic report");if(r.documentVersion(e)!==a)throw new Error("Document changed during diagnostic request");return r.setDiagnosticMode("pull"),He(l.items,!1,!0)}catch(l){if(!Et(l))throw l;r.setDiagnosticMode("push")}}let i=B(r);if(i){r.documentVersion(e)===void 0&&r.syncDocument(e,n??await We(ze.parse(e).fsPath,"utf8"),t??"plaintext");let a=r.documentVersion(e),l=await i.request(r,e,s);if(s.throwIfAborted(),r.documentVersion(e)!==a)throw new Error("Document changed during diagnostic request");return{diagnostics:l,syntaxErrors:[],otherDiagnostics:l,unversioned:!1,complete:!0}}s.throwIfAborted();let o=r.documentVersion(e)!==void 0,u=o?void 0:n??await We(ze.parse(e).fsPath,"utf8");s.throwIfAborted(),r.beginDiagnosticRequest(e);try{return await new Promise((a,l)=>{let d=r.documentVersion(e)??1,p=c(f=>{let w=f;w.uri!==e||!Array.isArray(w.diagnostics)||w.version!==void 0&&w.version!==d||r.documentVersion(e)===d&&(y(),a(He(w.diagnostics,w.version===void 0)))},"receive"),g=r.onNotification("textDocument/publishDiagnostics",p),h=c(()=>{y(),l(s.reason)},"onAbort");function y(){g(),s.removeEventListener("abort",h)}c(y,"cleanup"),s.addEventListener("abort",h,{once:!0});try{o||r.syncDocument(e,u??"",t??"plaintext");let f=r.diagnosticPublication(e);f&&p({uri:e,...f})}catch(f){y(),l(f)}})}finally{r.endDiagnosticRequest(e)}}c(Dt,"requestCurrentDiagnostics");function Q(r){return{code:String(r.code??"LSP"),message:r.message,line:r.range.start.line+1,column:r.range.start.character+1,severity:r.severity===T.Warning?"warning":r.severity===T.Information?"info":r.severity===T.Hint?"hint":"error"}}c(Q,"toDiagnostic");function He(r,e,t=!1){let n=r.map(Q);return{diagnostics:n,syntaxErrors:[],otherDiagnostics:n,unversioned:e,complete:t}}c(He,"classify");function Et(r){return r!==null&&typeof r=="object"&&"code"in r&&r.code===-32601}c(Et,"isMethodNotFound");var It={1:"File",2:"Module",3:"Namespace",4:"Package",5:"Class",6:"Method",7:"Property",8:"Field",9:"Constructor",10:"Enum",11:"Interface",12:"Function",13:"Variable",14:"Constant",15:"String",16:"Number",17:"Boolean",18:"Array",19:"Object",20:"Key",21:"Null",22:"EnumMember",23:"Struct",24:"Event",25:"Operator",26:"TypeParameter"};function P(r){return It[r]??`SymbolKind(${r})`}c(P,"symbolKindName");async function Z(r,e){return await r.sendRequest("textDocument/documentSymbol",{textDocument:{uri:e}})??[]}c(Z,"requestDocumentSymbols");async function ee(r,e,t=100){return(await r.sendRequest("workspace/symbol",{query:e})??[]).slice(0,t)}c(ee,"requestWorkspaceSymbols");async function te(r,e,t,n){return await r.sendRequest("textDocument/rename",{textDocument:{uri:e},position:t,newName:n})}c(te,"requestRename");import S from"node:path";import{URI as At}from"vscode-uri";import{readdir as jt,stat as Mt}from"node:fs/promises";import q from"node:path";import{URI as re}from"vscode-uri";function Ue(r,e){let t=c(n=>typeof n=="string"?n.replaceAll("{project}",()=>e):Array.isArray(n)?n.map(t):n!==null&&typeof n=="object"?Object.fromEntries(Object.entries(n).map(([s,i])=>[s,t(i)])):n,"expand");return Object.fromEntries(Object.entries(r).map(([n,s])=>[n,t(s)]))}c(Ue,"resolveInitializationOptions");var x=class r{constructor(e){this._registry=e}static{c(this,"LspManager")}_clients=new Map;_clientStarts=new Map;_openDocs=new Set;_pushUnsubscribers=new Map;_pushHandlers=new Set;_pushFingerprints=new Map;_disposed=!1;static _instance=null;static getInstance(){if(!r._instance)throw new Error("[lsp] LspManager not initialized");return r._instance}static getInstanceOrNull(){return r._instance}static init(e){let t=r._instance;return t?._disposed?(t._registry=e,t._disposed=!1,t):(r._instance=new r(e),r._instance)}static async resetForTest(){r._instance&&(await r._instance.shutdownAll(),r._instance=null)}get clientCount(){return this._clients.size}onPushDiagnostics(e){return this._pushHandlers.add(e),()=>this._pushHandlers.delete(e)}async getOrStart(e,t,n){if(this._disposed)return null;let s=this._registry.resolve(e),i=n==="symbols"?s[0]:s.find(p=>p.config.capabilities.includes(n));if(!i)return null;let o=re.file(t).toString(),u=`${i.serverId}:${o}`,a=this._clientStarts.get(u);if(a)return a;let l=this._clients.get(u);if(l?.ready)return l;let d=this._startClient(u,o,i,l);this._clientStarts.set(u,d);try{return await d}finally{this._clientStarts.get(u)===d&&this._clientStarts.delete(u)}}async _startClient(e,t,n,s){let i=s??new C({serverId:n.serverId,rootUri:t,command:n.config.command,...n.config.env&&{env:n.config.env},...n.config.initializationOptions&&{initOptions:Ue(n.config.initializationOptions,re.parse(t).fsPath)},...n.config.settings&&{settings:n.config.settings},...n.config.timeoutMs&&{timeoutMs:n.config.timeoutMs}});try{s?await s.restart():await i.start()}catch(o){throw await i.shutdown().catch(()=>{}),o}if(this._disposed)throw await i.shutdown(),new Error(`[lsp] ${n.serverId}: manager disposed during startup`);return this._clients.set(e,i),this._subscribeToPushDiagnostics(e,i),i}async getWorkspaceClients(e,t="symbols",n=e){let s=new Set,i=new Set(this._registry.knownExtensions),o=new Set([".git",".cache","node_modules","dist","build"]),u=c(async l=>{if(i.size===0)return;let d;try{d=await jt(l,{withFileTypes:!0})}catch{return}for(let p of d){if(i.size===0)return;if(p.isDirectory()){o.has(p.name)||await u(q.join(l,p.name));continue}if(!p.isFile())continue;let g=q.extname(p.name).toLowerCase();if(!i.has(g))continue;let h=q.join(l,p.name),y=await this.openFile(h,e,t).catch(()=>null);y&&(s.add(y.client),i.delete(g))}},"visit"),a=q.resolve(e,n);if((await Mt(a)).isFile()){let l=await this.openFile(a,e,t);return l===null?[]:[l.client]}return await u(a),[...s]}async prepareWorkspaceSymbols(e,t=e){return this.getWorkspaceClients(e,"symbols",t)}hasServerFor(e){return this._registry.resolve(e).length>0}languageId(e){return this._registry.languageId(e)}isOpen(e){return this._openDocs.has(e)}async openFile(e,t,n="diagnostics"){let s=q.resolve(t,e),i=await this.getOrStart(s,t,n);if(!i)return null;let o=i.toUri(s),a=this._registry.resolve(s)[0]?.languageId??"plaintext";try{let{readFile:l}=await import("node:fs/promises"),d=await l(s,"utf8");i.openDocument(o,d,a),this._openDocs.add(o)}catch{}return{client:i,uri:o,languageId:a}}_subscribeToPushDiagnostics(e,t){if(this._pushUnsubscribers.has(e))return;let n=t.onNotification("textDocument/publishDiagnostics",s=>{let i=$t(s);if(!i||t.hasActiveDiagnosticRequest(i.uri))return;let o=t.documentVersion(i.uri);if(i.version!==void 0&&o!==void 0&&i.version<o)return;let u=`${e}:${i.uri}`,a=i.diagnostics.map(Q),l=JSON.stringify([i.version,o,a]);if(this._pushFingerprints.get(u)===l)return;this._pushFingerprints.set(u,l);let d={cwd:re.parse(t.rootUri).fsPath,serverId:t.serverId,uri:i.uri,diagnostics:a,...i.version!==void 0&&{version:i.version}};for(let p of this._pushHandlers)p(d)});this._pushUnsubscribers.set(e,n)}async shutdownAll(){this._disposed=!0,await Promise.allSettled(this._clientStarts.values());let e=[...this._clients.values()];await Promise.all(e.map(t=>t.shutdown()));for(let t of this._pushUnsubscribers.values())t();this._pushUnsubscribers.clear(),this._clientStarts.clear(),this._pushFingerprints.clear(),this._pushHandlers.clear(),this._clients.clear()}dispose(){this.shutdownAll()}};function $t(r){if(r===null||typeof r!="object")return;let e=r;if(!(typeof e.uri!="string"||!Array.isArray(e.diagnostics)))return{uri:e.uri,diagnostics:e.diagnostics,...typeof e.version=="number"&&{version:e.version}}}c($t,"parsePushNotification");async function N(r,e,t){return await r.sendRequest("textDocument/references",{textDocument:{uri:e},position:t,context:{includeDeclaration:!0}})??[]}c(N,"requestReferences");async function ne(r,e,t){let n=await r.sendRequest("textDocument/prepareCallHierarchy",{textDocument:{uri:e},position:t}),s=n?.[0];if(!s)return{items:[],incoming:[],outgoing:[]};let[i,o]=await Promise.all([r.sendRequest("callHierarchy/incomingCalls",{item:s}).catch(()=>[]),r.sendRequest("callHierarchy/outgoingCalls",{item:s}).catch(()=>[])]);return{items:n,incoming:i??[],outgoing:o??[]}}c(ne,"requestCallHierarchy");function Ge(r,e,t){let n=S.relative(S.resolve(e,t.path??"."),r);if(n===".."||n.startsWith(`..${S.sep}`)||S.isAbsolute(n))return!1;let s=S.relative(e,r).split(S.sep).join("/"),i=c(o=>o.split(",").some(u=>{let a=u.trim();return a.length>0&&S.matchesGlob(a.includes("/")?s:S.basename(r),a)}),"matches");return(t.include===void 0||i(t.include))&&(t.exclude===void 0||!i(t.exclude))}c(Ge,"withinScope");function J(r){try{return At.parse(r).fsPath}catch{return r.startsWith("file://")?decodeURIComponent(r.slice(7)):r}}c(J,"uriToFilePath");function Be(r,e,t,n,s){let i=J(t),o=S.relative(r,i);return{filePath:o.startsWith("..")?i:o,lineNumber:n+1,column:s+1,kind:String(e.kind),name:e.name}}c(Be,"toHit");async function se(r,e,t,n,s={},i=x.getInstance()){if(n?.aborted)throw new Error("Operation aborted");let o=await i.prepareWorkspaceSymbols(e,s.path??e),u=[];for(let d of o){if(n?.aborted)throw new Error("Operation aborted");try{u.push(...await ee(d,r,Number.MAX_SAFE_INTEGER))}catch{}}let a=new Set,l=[];for(let d of u){if(n?.aborted)throw new Error("Operation aborted");if(l.length>=t)break;let p=d.location,g=Be(e,d,p.uri,p.range.start.line,p.range.start.character),h=`${g.filePath}:${g.lineNumber}:${g.column}`;if(Ge(J(p.uri),e,s)&&!a.has(h)&&(a.add(h),l.push(g)),l.length>=t)break;let y=J(p.uri),f=await i.openFile(y,e,"symbols").catch(()=>null);if(!f)continue;let w=await N(f.client,f.uri,p.range.start).catch(()=>[]);for(let R of w){let z=Be(e,d,R.uri,R.range.start.line,R.range.start.character),ge=`${z.filePath}:${z.lineNumber}:${z.column}`;if(Ge(J(R.uri),e,s)&&!a.has(ge)&&(a.add(ge),l.push(z)),l.length>=t)break}}return l}c(se,"searchSymbols");import{readFile as V}from"node:fs/promises";import j from"node:path";import{fileURLToPath as Tt}from"node:url";var Ot={failureLabel:"SYMBOL_READ_FAILED",emptyReason:"no symbol source was produced."},ie=10,oe=5,M=10;async function Xe(r,e,t,n,s){L(s);let i=await V(e,"utf8"),o=await W(r,e,n),u=F(o.symbols,t,o.displayPath),a=await V(o.filePath,"utf8");if(L(s),i!==a)throw new Error("The symbol source changed during resolution. Read it again before editing.");return{source:o.filePath,range:u.range,content:a}}c(Xe,"resolveLspDeclaration");async function Ye(r,e,t,n,s){L(s);let i=await V(e,"utf8"),o=await W(r,e,n),u=F(o.symbols,t,o.displayPath);if(i!==await V(e,"utf8"))throw new Error("The rename source changed during resolution.");return L(s),{client:o.client,uri:o.uri,position:u.selectionRange.start,content:i}}c(Ye,"resolveLspRenameTarget");async function le(r,e,t,n,s){L(s);let i=await W(r,e,n),o=F(i.symbols,t,i.displayPath),u=await zt(i.filePath);L(s);let a=o.range.start.line+1,l=Math.min(o.range.end.line+1,u.lines.length),d=u.lines.slice(Math.max(0,a-1),Math.max(0,l)).map((g,h)=>{let y=a+h;return me({content:g,sourceLine:{source:i.filePath,lineNumber:y,content:g}})}),p={path:i.displayPath,heading:`symbol: ${k(o.selector)}`,details:[`defined in: ${i.displayPath}:${a}-${l} (${P(o.kind)})`],startLine:a,endLine:l,totalLines:u.lines.length,renderedLines:d};return fe([p],Ot)}c(le,"readLspSymbolBody");async function de(r,e,t,n,s){L(s);let i=await W(r,e,n),o=F(i.symbols,t,i.displayPath),u=await tt(i,o,s),a=new K(n);return await qt(i,o,u,a)}c(de,"readLspSymbolGraph");async function ue(r,e,t,n){L(n);let s=await W(r,e,t),i=new K(t),o=[`## file graph: ${s.displayPath}`,`Top-level declarations: ${s.symbols.length}`];for(let u of s.symbols){L(n);let a=await tt(s,u,n);o.push("",...await Wt(s,u,a,i))}return o.join(`
2
2
  `)}c(ue,"readLspFileGraph");function F(r,e,t){if(e.length===0)throw new TypeError("A symbol selector must contain at least one segment.");if(e.length===1){let i=et(r,v(e[0]));if(i.length===1)return v(i[0]);throw i.length>1?new Error(`Symbol selector "${k(e)}" is ambiguous in ${t}; use parent/child.`):Je(e,t)}let n=r,s;for(let i of e){let o=n.filter(u=>u.name===i);if(o.length===0)throw Je(e,t);if(o.length>1)throw new Error(`Symbol selector "${k(e)}" is ambiguous at "${i}" in ${t}.`);s=v(o[0]),n=s.children}return v(s)}c(F,"resolveLspCodeSymbol");async function W(r,e,t){let n=j.isAbsolute(e)?j.normalize(e):j.resolve(t,e),s=await r.openFile(n,t,"symbols");if(!s)throw new Error(`No LSP server with symbol support is configured for ${ce(n,t)}.`);let i=await Z(s.client,s.uri),o=Qe(i).sort(Ze);return{client:s.client,uri:s.uri,filePath:n,displayPath:ce(n,t),symbols:o}}c(W,"openCodeDocument");function Qe(r,e=[]){return r.flatMap(t=>{let n=t.selectionRange??t.range;if(!n)return[];let s=t.range??n,i=[...e,t.name];return[{name:t.name,kind:t.kind,range:s,selectionRange:n,selector:i,children:Qe(t.children??[],i).sort(Ze)}]})}c(Qe,"normalizeDocumentSymbols");function Ze(r,e){return r.range.start.line-e.range.start.line||r.range.start.character-e.range.start.character||r.name.localeCompare(e.name)}c(Ze,"compareSymbols");function et(r,e){return r.flatMap(t=>[...t.name===e?[t]:[],...et(t.children,e)])}c(et,"collectNamedSymbols");function Je(r,e){return new Error(`Symbol "${k(r)}" was not found in ${e}.`)}c(Je,"symbolNotFound");async function tt(r,e,t){let n=e.selectionRange.start,[s,i]=await Promise.all([Ke(N(r.client,r.uri,n),[],t),Ke(ne(r.client,r.uri,n),{items:[],incoming:[],outgoing:[]},t)]);return L(t),{references:s,calls:i}}c(tt,"queryRelations");async function Ke(r,e,t){try{let n=await r;return L(t),n}catch(n){if(t?.aborted===!0)throw nt(t,n);return e}}c(Ke,"optionalRequest");async function qt(r,e,t,n){let s=k(e.selector),i=await n.line(r.uri,e.selectionRange.start.line+1);return[`## graph: ${s}`,`Definition: ${r.displayPath} ${i} (${P(e.kind)})`,`Source: ${$("graph",r.displayPath,e.selector)}`,"",...await Nt(t.references,n),"",...await Vt(t.calls.incoming,n),"",...await Ft(t.calls.outgoing,n)].join(`
3
3
  `)}c(qt,"formatSymbolGraph");async function Nt(r,e){let t=rt(r),n=[`References: ${r.length} in ${t.length} file(s)`];for(let[s,i]of t.slice(0,ie)){n.push(`- ${e.display(s)} (${i.length})`);for(let o of i.slice(0,oe))n.push(` - ${await e.line(s,o.range.start.line+1)}`);i.length>oe&&n.push(` - ... ${i.length-oe} more`)}return t.length>ie&&n.push(`- ... ${t.length-ie} more file(s)`),n}c(Nt,"formatReferences");async function Vt(r,e){let t=[`Incoming calls: ${r.length}`];for(let n of r.slice(0,M)){let s=n.fromRanges[0]?.start.line??n.from.selectionRange.start.line,i=await e.line(n.from.uri,s+1);t.push(`- ${P(n.from.kind)} ${n.from.name} \u2014 ${e.display(n.from.uri)} ${i}`)}return r.length>M&&t.push(`- ... ${r.length-M} more`),t}c(Vt,"formatIncomingCalls");async function Ft(r,e){let t=[`Outgoing calls: ${r.length}`];for(let n of r.slice(0,M)){let s=await e.line(n.to.uri,n.to.selectionRange.start.line+1);t.push(`- ${P(n.to.kind)} ${n.to.name} \u2014 ${e.display(n.to.uri)} ${s}`)}return r.length>M&&t.push(`- ... ${r.length-M} more`),t}c(Ft,"formatOutgoingCalls");async function Wt(r,e,t,n){let s=P(e.kind),i=await n.line(r.uri,e.selectionRange.start.line+1),o=rt(t.references).map(([d,p])=>`${n.display(d)} (${p.length})`),u=t.calls.incoming.map(d=>`${d.from.name} (${n.display(d.from.uri)})`),a=t.calls.outgoing.map(d=>`${d.to.name} (${n.display(d.to.uri)})`),l=[`### ${s} ${e.name}`,`Selector: ${k(e.selector)}`,`Definition: ${i}`,`Used by: ${ae(o)}`,`Incoming calls: ${ae(u)}`,`Outgoing calls: ${ae(a)}`];if(e.children.length>0){l.push("Members:");for(let d of e.children){let p=$("graph",r.displayPath,d.selector);l.push(`- ${P(d.kind)} ${d.name} \u2014 ${p}`)}}return l}c(Wt,"formatFileGraphSymbol");function ae(r,e=5){if(r.length===0)return"none";let t=r.slice(0,e).join(", ");return r.length>e?`${t}, ... ${r.length-e} more`:t}c(ae,"summarize");function rt(r){let e=new Map;for(let t of r){let n=e.get(t.uri)??[];n.push(t),e.set(t.uri,n)}return[...e].map(([t,n])=>[t,n.sort((s,i)=>s.range.start.line-i.range.start.line||s.range.start.character-i.range.start.character)]).sort(([t],[n])=>t.localeCompare(n))}c(rt,"groupLocationsByUri");async function zt(r){let e=await V(r);if(e.byteLength>256*1024)throw new Error(`File exceeds the 262144-byte code-view limit: ${r}`);if(e.includes(0))throw new Error(`File appears to be binary and cannot be read as text: ${r}`);let t=e.toString("utf8").replaceAll(`\r
4
4
  `,`
package/dist/entry-51.js CHANGED
@@ -1,11 +1,10 @@
1
- import{a as x,b as J,c as X,d as fe,h as Q}from"./chunk-P7XO5CIP.js";import"./chunk-GUTQ3PWL.js";import{a as H}from"./chunk-MGCHOGQD.js";import{a as F,b as I}from"./chunk-T6LX2RX5.js";import{a as W}from"./chunk-L7JMDDSD.js";import{a as _,b as j,d as B}from"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import{a as z}from"./chunk-ZTYWHL2F.js";import{a as G,b as V}from"./chunk-7UGNGK7Y.js";import{t as L,u as O}from"./chunk-5VSE5X5R.js";import{d as N,e as v}from"./chunk-N34ATN52.js";import{a as M}from"./chunk-ZC65Z3CK.js";import{a as c}from"./chunk-EI7MMDWY.js";var U={protocol:F,apiVersion:1,id:"search-text",setup(e){e.addSetupCheck({id:"ripgrep",async inspect(t){let r=x(t.env.PI_CODING_AGENT_DIR);return await N(r,t.cwd,t.env)?{}:{actions:[{id:"ripgrep-unavailable",message:"Local search is unavailable because ripgrep was not found"}]}}}),e.addCheck({id:"ripgrep",title:"Local search",async run(t){let r=t.env.PI_CODING_AGENT_DIR,n=x(r),a=await v(n,["--version"],t.cwd,t.env);return[a.ok?{status:"pass",message:"ripgrep is available",detail:a.detail}:{status:"fail",message:"ripgrep is not available",detail:a.detail}]}})}};import ce from"node:path";import{spawn as ge}from"node:child_process";import T from"node:path";function Y(e,t,r,n){let a=t.limit??100,o=["--files","--hidden","--no-config","--no-ignore-parent","--glob","!.git/**"];for(let i of K(t.include))o.push("--glob",i);for(let i of K(t.exclude))o.push("--glob",`!${i}`);return t.path!==void 0&&o.push(t.path),new Promise((i,s)=>{let l=ge(x(),o,{cwd:r,stdio:["ignore","pipe","pipe"]}),u="",h="";l.stdout.setEncoding("utf8"),l.stderr.setEncoding("utf8"),l.stdout.on("data",d=>u+=d),l.stderr.on("data",d=>h+=d);let p=c(()=>{l.kill("SIGTERM")},"abort");n?.addEventListener("abort",p,{once:!0}),l.once("error",s),l.once("close",d=>{if(n?.removeEventListener("abort",p),n?.aborted===!0){s(n.reason instanceof Error?n.reason:new Error("File search aborted"));return}if(d!==0&&d!==1){s(new Error(h.trim()||`rg exited with code ${String(d)}`));return}let g=u.split(`
2
- `).filter(Boolean).map(m=>T.relative(r,T.resolve(r,m))).filter(m=>ye(m,e)).sort((m,b)=>m.localeCompare(b));i({files:g.slice(0,a),complete:g.length<=a})})})}c(Y,"searchFiles");function K(e){return e?.split(",").map(t=>t.trim()).filter(Boolean)??[]}c(K,"splitGlobs");function ye(e,t){if(/[*?[\]{}]/u.test(t)){let r=t.replace(/^\.\//u,"");return T.matchesGlob(r.includes("/")?e:T.basename(e),r)}return Se(e,t)}c(ye,"matchFile");function Se(e,t){if(t.length===0)return!0;let r=0,n=e.toLowerCase();for(let a of t.toLowerCase()){if(r=n.indexOf(a,r),r===-1)return!1;r+=1}return!0}c(Se,"fuzzyMatch");import Te from"node:path";import{keyText as ie}from"@earendil-works/pi-coding-agent";import{Text as $e,truncateToWidth as C,visibleWidth as f,wrapTextWithAnsi as Ae}from"@earendil-works/pi-tui";import Z from"node:path";import{pathToFileURL as ee}from"node:url";function $(e,t){let r=new Map;for(let s of e){let l=r.get(s.source)??[];l.push(s),r.set(s.source,l)}let n=new Set,a=e.length,o=[...r].sort(([s,l],[u,h])=>h.length-l.length||s.localeCompare(u));for(let[s,l]of o){if(a<=t)break;n.add(s),a-=l.length}return{files:[...r].sort(([s],[l])=>s.localeCompare(l)).map(([s,l])=>{if(!n.has(s))return{kind:"detailed",source:s,matches:l};let u=new Map;for(let h of l)u.set(h.lineText,(u.get(h.lineText)??0)+1);return{kind:"compacted",source:s,matchCount:l.length,uniqueLineCount:u.size,groups:r.size===1?[...u].sort(([h,p],[d,g])=>g-p||h.localeCompare(d)).slice(0,t).map(([h,p])=>({text:h,matchCount:p})):[]}})}}c($,"planSearchPresentation");function E(e,t,r,n,a,o=50){let s=$(t,o).files.map(l=>l.kind==="detailed"?be(l.source,l.matches,n):{path:te(l.source,n),link:ee(l.source).href,matchCount:l.matchCount,uniqueLineCount:l.uniqueLineCount,groups:l.groups,lines:[]});return{...a!==void 0&&{sessionId:a},query:e,matchCount:t.length,fileCount:s.length,complete:r,files:s}}c(E,"createSearchToolDetails");function A(e){if(!R(e)||typeof e.query!="string"||!y(e.matchCount)||!y(e.fileCount)||typeof e.complete!="boolean"||e.sessionId!==void 0&&typeof e.sessionId!="string"||!Array.isArray(e.files)||!e.files.every(xe))return!1;let t=e.files;return e.fileCount===t.length&&e.matchCount===t.reduce((r,n)=>r+n.matchCount,0)}c(A,"isSearchToolDetails");function be(e,t,r){let n=new Map;for(let o of t){let i=n.get(o.lineNumber);if(i!==void 0&&i.text!==o.lineText)throw new Error(`Search results disagree about line ${String(o.lineNumber)} in ${e}.`);let s=i??{lineNumber:o.lineNumber,text:o.lineText,ranges:[]};s.ranges.push({from:o.startColumn,to:o.endColumn}),n.set(o.lineNumber,s)}let a=[...n.values()].sort((o,i)=>o.lineNumber-i.lineNumber).map(o=>{let i=[...o.ranges].sort((s,l)=>s.from-l.from||s.to-l.to);return{lineNumber:o.lineNumber,text:o.text,matchCount:i.length,ranges:i}});return{path:te(e,r),link:ee(e).href,matchCount:t.length,lines:a}}c(be,"createSearchResultFile");function xe(e){if(!R(e)||typeof e.path!="string"||typeof e.link!="string"||!y(e.matchCount)||!Array.isArray(e.lines)||!e.lines.every(Re))return!1;let t=e.lines,r=e.groups;return(r===void 0||Array.isArray(r)&&r.every(n=>R(n)&&typeof n.text=="string"&&y(n.matchCount)))&&(e.uniqueLineCount===void 0||y(e.uniqueLineCount))&&(t.length===0||e.matchCount===t.reduce((n,a)=>n+a.matchCount,0))}c(xe,"isSearchResultFile");function Re(e){return R(e)&&Number.isSafeInteger(e.lineNumber)&&e.lineNumber>=1&&typeof e.text=="string"&&y(e.matchCount)&&Array.isArray(e.ranges)&&e.ranges.length===e.matchCount&&e.ranges.every(t=>Ce(t,e.text))}c(Re,"isSearchResultLine");function Ce(e,t){return R(e)&&Number.isSafeInteger(e.from)&&Number.isSafeInteger(e.to)&&e.from>=0&&e.to>e.from&&e.to<=t.length}c(Ce,"isSearchResultRange");function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}c(R,"isRecord");function y(e){return Number.isSafeInteger(e)&&e>=0}c(y,"isCount");function te(e,t){let r=Z.relative(t,e);return r.length>0&&!r.startsWith("..")&&!Z.isAbsolute(r)?r:e}c(te,"displaySource");function re(e){return e.replaceAll("\u27E6","").replaceAll("\u27E7","")}c(re,"sourceText");function ne(e,t){let{files:r,...n}=e,a=re(t);return{...n,storedFiles:r.map(({lines:o,...i})=>({...i,lines:o.map(s=>[s.lineNumber,L(s.text,a),s.ranges])}))}}c(ne,"compactSearchDetails");function oe(e,t){if("files"in e)return e;let{storedFiles:r,...n}=e,a=re(t);return{...n,files:r.map(({lines:o,...i})=>({...i,lines:o.map(([s,l,u])=>({lineNumber:s,text:O(l,a),ranges:u,matchCount:u.length}))}))}}c(oe,"restoreSearchDetails");var ae=new WeakMap,k=12,we={".ts":{label:"TS",color:"accent"},".tsx":{label:"TX",color:"accent"},".js":{label:"JS",color:"warning"},".jsx":{label:"JX",color:"warning"},".json":{label:"{}",color:"warning"},".md":{label:"MD",color:"mdHeading"},".py":{label:"PY",color:"accent"},".rs":{label:"RS",color:"accent"},".go":{label:"GO",color:"accent"},".css":{label:"CS",color:"accent"},".html":{label:"<>",color:"accent"}};function se(e,t,r,n){if(typeof e.details=="object"){let i=ae.get(e.details);i===void 0&&(i=oe(e.details,e.content.flatMap(s=>s.type==="text"?[s.text]:[]).join(`
3
- `)),ae.set(e.details,i)),e={...e,details:i}}if(t.isPartial||n.isError||!A(e.details)){let i=e.content[0],s=i?.type==="text"?i.text:"",l=n.isError?"error":t.isPartial?"dim":"toolOutput";return new $e(r.fg(l,s),0,0)}let o=(n.lastComponent instanceof q?n.lastComponent:void 0)??new q(e.details,r,t.expanded);return o.update(e.details,r,t.expanded),o}c(se,"renderSearchResult");var q=class{constructor(t,r,n){this.details=t;this.theme=r;this.expanded=n}static{c(this,"SearchResultPanel")}cached;update(t,r,n){this.details===t&&this.theme===r&&this.expanded===n||(this.details=t,this.theme=r,this.expanded=n,this.invalidate())}render(t){if(this.cached?.width===t)return this.cached.lines;if(t<4){let u=[C(le(this.details),Math.max(1,t))];return this.cached={width:t,lines:u},u}let r=t-2,n=ke(this.details,this.expanded),a=Fe(this.details.files),o=n.flatMap(u=>Ee(u,r,a,this.theme)),i=qe(o,this.expanded,r,this.theme),s=[Le(this.details,r,this.theme),...i];s.push(this.theme.fg("borderMuted",`\u2570${"\u2500".repeat(r)}\u256F`));let l=s.map(u=>C(u,t));return this.cached={width:t,lines:l},l}invalidate(){this.cached=void 0}};function ke(e,t){let r=e.files.length===0?[{kind:"empty"}]:e.files.flatMap(o=>[{kind:"file",file:o},...o.uniqueLineCount===void 0?o.lines.map(i=>({kind:"line",file:o,line:i})):[{kind:"summary",text:`${String(o.uniqueLineCount)} unique line texts \xB7 search this path with a narrower query`},...(o.groups??[]).map(i=>({kind:"summary",text:`\xD7${String(i.matchCount)} ${i.text}`}))]]);if(t||r.length<=k)return r;let n=r.slice(0,k-1);for(;n.at(-1)?.kind==="file";)n.pop();let a=n.reduce((o,i)=>o+(i.kind==="line"?i.line.matchCount:0),0);return[...n,{kind:"omitted",matches:e.matchCount-a}]}c(ke,"searchViewport");function qe(e,t,r,n){if(t||e.length<=k)return e;let a=`${ie("app.tools.expand")} to expand`,o=S(n.fg("dim",` \u2026 output truncated \xB7 ${a}`),r,n);return[...e.slice(0,k-1),o]}c(qe,"compactRenderedRows");function Ee(e,t,r,n){if(e.kind==="file")return[S(Pe(e.file,t,n),t,n,!0)];if(e.kind==="line")return De(e.line,t,r,n);if(e.kind==="summary")return[S(n.fg("dim",` ${w(e.text)}`),t,n)];if(e.kind==="omitted"){let a=`${ie("app.tools.expand")} to expand`;return[S(n.fg("dim",` \u2026 ${String(e.matches)} more ${P(e.matches,"match","matches")} \xB7 ${a}`),t,n)]}return[S(n.fg("dim"," No matches found"),t,n)]}c(Ee,"renderPanelRow");function Pe(e,t,r){let n=Oe(e.path,r),a=r.fg("accent",r.bold(String(e.matchCount))),o=f(n)+f(a)+4,i=Math.max(1,t-o),s=ve(e.path,i),l=Ne(s,e.link,r),u=` ${n} ${l}`,h=" ".repeat(Math.max(1,t-f(u)-f(a)-1));return C(`${u}${h}${a} `,t)}c(Pe,"renderFileHeader");function De(e,t,r,n){let a=String(e.lineNumber).padStart(r),o=` ${n.fg("dim",a)} ${n.fg("borderMuted","\u2502")} `,i=Math.max(1,t-f(o)-1),s=Ae(Me(e,n),i),l=" ".repeat(f(o));return s.map((u,h)=>S(`${h===0?o:l}${u}`,t,n))}c(De,"renderMatchLine");function Me(e,t){let r="",n=0;for(let a of e.ranges){a.from>n&&(r+=t.fg("toolOutput",w(e.text.slice(n,a.from))));let o=w(e.text.slice(a.from,a.to));r+=t.bg("selectedBg",t.fg("accent",t.bold(o))),n=a.to}return n<e.text.length&&(r+=t.fg("toolOutput",w(e.text.slice(n)))),r}c(Me,"renderHighlightedLine");function Le(e,t,r){let n=c(i=>r.fg("borderMuted",i),"frame"),a=C(` ${le(e)} `,Math.max(0,t-1),""),o="\u2500".repeat(Math.max(0,t-f(a)-1));return`${n("\u256D\u2500")}${r.fg("accent",a)}${n(`${o}\u256E`)}`}c(Le,"renderTopBorder");function le(e){return e.matchCount===0?"No matches":`${`${String(e.matchCount)}${e.complete?"":"+"}`} ${P(e.matchCount,"match","matches")} in ${String(e.fileCount)} ${P(e.fileCount,"file","files")}`}c(le,"searchSummary");function S(e,t,r,n=!1){let a=C(e,t),o=`${a}${" ".repeat(Math.max(0,t-f(a)))}`,i=n?r.bg("selectedBg",o):o,s=r.fg("borderMuted","\u2502");return`${s}${i}${s}`}c(S,"framed");function Oe(e,t){let r=Te.extname(e).toLowerCase(),n=we[r]??{label:"\u25C7 ",color:r.length===0?"muted":"accent"};return t.fg(n.color,t.bold(n.label))}c(Oe,"fileBadge");function Ne(e,t,r){let n=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),a=n===-1?"":e.slice(0,n+1),o=n===-1?e:e.slice(n+1),i=r.fg("muted",a)+r.underline(r.fg("accent",o));return t.includes("\x07")||t.includes("\x1B")?i:`\x1B]8;;${t}\x07${i}\x1B]8;;\x07`}c(Ne,"fileLink");function ve(e,t){return f(e)<=t?e:t<=1?"\u2026":`\u2026${e.slice(-(t-1))}`}c(ve,"truncatePath");function w(e){let t="";for(let r of e){if(r===" "){t+=" ".repeat(4);continue}let n=M(r.codePointAt(0));t+=n<32||n===127?"\uFFFD":r}return t}c(w,"safeText");function Fe(e){let t=1;for(let r of e)for(let n of r.lines)t=Math.max(t,n.lineNumber);return Math.max(3,String(t).length)}c(Fe,"maximumLineNumberWidth");function P(e,t,r){return e===1?t:r}c(P,"plural");function de(e){return pe("text",e,J)}c(de,"createTextResolver");function he(e){return pe("regex",e,t=>t.query.startsWith("regex:")?{...t,query:t.query.slice(6),regex:!0}:void 0)}c(he,"createRegexResolver");function me(){return{id:"files",async tryResolve(e,t){if(!e.query.startsWith("files:"))return{kind:"not-handled"};let r=e.query.slice(6).trim(),n=await Y(r,e,t.cwd,t.signal);return{kind:"resolved",payload:{query:r,...n}}},format(e){let t=e;return{content:[{type:"text",text:[t.complete?`${String(t.files.length)} files`:`${String(t.files.length)}+ files (limit reached)`,...t.files].join(`
4
- `)}],details:{query:t.query,files:t.files,complete:t.complete}}}}}c(me,"createFileResolver");function pe(e,t,r){return{id:e,async tryResolve(n,a){let o=r(n);if(o===void 0)return{kind:"not-handled"};let i=await X(o,a.cwd,a.signal);return{kind:"resolved",payload:{request:{...n,query:i.query},...i,recipe:{...o,originalQuery:n.query}}}},async format(n,a){let o=n;if(o.matches.length===0)return{content:[{type:"text",text:[...o.notices,"No matches found."].join(`
5
- `)}],details:E(o.request.query,[],o.complete,a.cwd)};let i=o.request.limit??50,s=await t.registerIfCurrent(o.request.query,o.matches,o.complete,a.cwd,a.signal,o.recipe),l=s??{query:o.request.query,matches:o.matches,complete:o.complete};return{content:[{type:"text",text:[...o.notices,Ie(l,a.cwd,i,s!==void 0)].join(`
6
- `)}],details:E(l.query,l.matches,l.complete,a.cwd,s?.id,i)}},renderResult:se}}c(pe,"createMatchResolver");function Ie(e,t,r,n=!0){let a=new Set(e.matches.map(p=>p.source)).size,o=e.matches.length,i=`${String(o)}${e.complete?"":"+"} ${ue(o,"match","matches")} in ${String(a)} ${ue(a,"file","files")}`,s=n?e.complete?`SEARCH#${e.id}:all:line / SEARCH#${e.id}:all:match \u2014 ${i}`:`${i} (limit reached; no all anchors were registered)`:`${i} (files changed during search; results shown without anchors)`,l=n?["Anchors: SEARCH#HASH:N:line (line), SEARCH#HASH:N:match (exact match), SEARCH#HASH:all:line (each unique containing line), SEARCH#HASH:all:match (every exact match)",s]:[s],u=new Map(e.matches.map((p,d)=>[p,d+1])),h=$(e.matches,r);for(let[p,d]of h.files.entries()){p>0&&l.push("");let g=je(d.source,t);if(d.kind==="compacted"){l.push(`${g}: ${String(d.matchCount)} matches across ${String(d.uniqueLineCount)} unique line texts (compacted)`);for(let m of d.groups)l.push(` \xD7${String(m.matchCount)} ${_e(m.text)}`);d.groups.length<d.uniqueLineCount&&l.push(` \u2026 ${String(d.uniqueLineCount-d.groups.length)} more unique line texts`),l.push(` Search again with path: ${JSON.stringify(g)} and a narrower query to see individual matches.`);continue}for(let m of d.matches){let b=u.get(m);if(b===void 0)continue;let D=`${g}:${String(m.lineNumber)}:${String(m.startColumn+1)}-${String(m.endColumn+1)}`;l.push(n?`${D} SEARCH#${e.id}:${String(b)}:line SEARCH#${e.id}:${String(b)}:match`:D,` ${He(m)}`)}}return l.join(`
7
- `)}c(Ie,"formatSearchSession");function He(e){let r=Math.max(0,e.startColumn-64),n=Math.min(e.lineText.length,e.endColumn+64);return`${r>0?"\u2026":""}${e.lineText.slice(r,e.startColumn)}\u27E6${e.lineText.slice(e.startColumn,e.endColumn)}\u27E7${e.lineText.slice(e.endColumn,n)}${n<e.lineText.length?"\u2026":""}`}c(He,"previewMatch");function _e(e){return`${e.slice(0,129)}${e.length>129?"\u2026":""}`}c(_e,"previewLine");function je(e,t){let r=ce.relative(t,e);return r.length>0&&!r.startsWith("..")&&!ce.isAbsolute(r)?r:e}c(je,"displaySource");function ue(e,t,r){return e===1?t:r}c(ue,"plural");async function Be(e){let t=new Q;e.on("tool_result",async(r,n)=>{if(r.toolName!=="replace"||r.isError||typeof r.details!="object"||r.details===null)return;let a="metadata"in r.details?r.details.metadata:void 0,o=a&&typeof a=="object"&&"searchObservations"in a?a.searchObservations:void 0,i=Array.isArray(o)?o:await t.observeAfterEdit([r.input.path,r.input.start,r.input.end],n.signal);if(i.length!==0)return{content:[...r.content,{type:"text",text:["Original search observed after editing (not task validation):",...i.map(s=>{let{query:l,fallbacks:u,...h}=s.scope;return[`SEARCH#${s.sessionId}: ${JSON.stringify(s.query)}`,`Scope and options: ${JSON.stringify(h)}`,s.error===void 0?`Matches: ${s.matches}${s.complete===!0?"; complete search.":"+; incomplete search, lower bound only."}`:`Search failed: ${s.error}. Applied edits remain applied.`,...s.notices??[]].join(`
1
+ import{a as S,b as _,c as I,d as X,h as j}from"./chunk-P7XO5CIP.js";import"./chunk-GUTQ3PWL.js";import{a as D,b as L}from"./chunk-CEX3VOJ7.js";import{a as N,b as x,c as k}from"./chunk-7WCZOO5I.js";import{a as E}from"./chunk-MGCHOGQD.js";import{a as w,b as A}from"./chunk-T6LX2RX5.js";import{a as q}from"./chunk-L7JMDDSD.js";import{a as C,b as $,d as T}from"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import{a as H}from"./chunk-ZTYWHL2F.js";import{a as O,b as P}from"./chunk-7UGNGK7Y.js";import"./chunk-5VSE5X5R.js";import{d as b,e as v}from"./chunk-N34ATN52.js";import"./chunk-ZC65Z3CK.js";import{a as u}from"./chunk-EI7MMDWY.js";var M={protocol:w,apiVersion:1,id:"search-text",setup(e){e.addSetupCheck({id:"ripgrep",async inspect(r){let t=S(r.env.PI_CODING_AGENT_DIR);return await b(t,r.cwd,r.env)?{}:{actions:[{id:"ripgrep-unavailable",message:"Local search is unavailable because ripgrep was not found"}]}}}),e.addCheck({id:"ripgrep",title:"Local search",async run(r){let t=r.env.PI_CODING_AGENT_DIR,n=S(t),o=await v(n,["--version"],r.cwd,r.env);return[o.ok?{status:"pass",message:"ripgrep is available",detail:o.detail}:{status:"fail",message:"ripgrep is not available",detail:o.detail}]}})}};import G from"node:path";import{spawn as U}from"node:child_process";import y from"node:path";function B(e,r,t,n){let o=r.limit??100,i=["--files","--hidden","--no-config","--no-ignore-parent","--glob","!.git/**"];for(let l of F(r.include))i.push("--glob",l);for(let l of F(r.exclude))i.push("--glob",`!${l}`);return r.path!==void 0&&i.push(r.path),new Promise((l,c)=>{let a=U(S(),i,{cwd:t,stdio:["ignore","pipe","pipe"]}),f="",h="";a.stdout.setEncoding("utf8"),a.stderr.setEncoding("utf8"),a.stdout.on("data",s=>f+=s),a.stderr.on("data",s=>h+=s);let p=u(()=>{a.kill("SIGTERM")},"abort");n?.addEventListener("abort",p,{once:!0}),a.once("error",c),a.once("close",s=>{if(n?.removeEventListener("abort",p),n?.aborted===!0){c(n.reason instanceof Error?n.reason:new Error("File search aborted"));return}if(s!==0&&s!==1){c(new Error(h.trim()||`rg exited with code ${String(s)}`));return}let m=f.split(`
2
+ `).filter(Boolean).map(d=>y.relative(t,y.resolve(t,d))).filter(d=>K(d,e)).sort((d,g)=>d.localeCompare(g));l({files:m.slice(0,o),complete:m.length<=o})})})}u(B,"searchFiles");function F(e){return e?.split(",").map(r=>r.trim()).filter(Boolean)??[]}u(F,"splitGlobs");function K(e,r){if(/[*?[\]{}]/u.test(r)){let t=r.replace(/^\.\//u,"");return y.matchesGlob(t.includes("/")?e:y.basename(e),t)}return Y(e,r)}u(K,"matchFile");function Y(e,r){if(r.length===0)return!0;let t=0,n=e.toLowerCase();for(let o of r.toLowerCase()){if(t=n.indexOf(o,t),t===-1)return!1;t+=1}return!0}u(Y,"fuzzyMatch");function z(e){return W("text",e,_)}u(z,"createTextResolver");function J(e){return W("regex",e,r=>r.query.startsWith("regex:")?{...r,query:r.query.slice(6),regex:!0}:void 0)}u(J,"createRegexResolver");function Q(){return{id:"files",async tryResolve(e,r){if(!e.query.startsWith("files:"))return{kind:"not-handled"};let t=e.query.slice(6).trim(),n=await B(t,e,r.cwd,r.signal);return{kind:"resolved",payload:{query:t,...n}}},format(e){let r=e;return{content:[{type:"text",text:[r.complete?`${String(r.files.length)} files`:`${String(r.files.length)}+ files (limit reached)`,...r.files].join(`
3
+ `)}],details:{query:r.query,files:r.files,complete:r.complete}}}}}u(Q,"createFileResolver");function W(e,r,t){return{id:e,async tryResolve(n,o){let i=t(n);if(i===void 0)return{kind:"not-handled"};let l=await I(i,o.cwd,o.signal);return{kind:"resolved",payload:{request:{...n,query:l.query},...l,recipe:{...i,originalQuery:n.query}}}},async format(n,o){let i=n;if(i.matches.length===0)return{content:[{type:"text",text:[...i.notices,"No matches found."].join(`
4
+ `)}],details:x(i.request.query,[],i.complete,o.cwd)};let l=i.request.limit??50,c=await r.registerIfCurrent(i.request.query,i.matches,i.complete,o.cwd,o.signal,i.recipe),a=c??{query:i.request.query,matches:i.matches,complete:i.complete};return{content:[{type:"text",text:[...i.notices,Z(a,o.cwd,l,c!==void 0)].join(`
5
+ `)}],details:x(a.query,a.matches,a.complete,o.cwd,c?.id,l)}},renderResult:L}}u(W,"createMatchResolver");function Z(e,r,t,n=!0){let o=new Set(e.matches.map(p=>p.source)).size,i=e.matches.length,l=`${String(i)}${e.complete?"":"+"} ${V(i,"match","matches")} in ${String(o)} ${V(o,"file","files")}`,c=n?e.complete?`SEARCH#${e.id}:all:line / SEARCH#${e.id}:all:match \u2014 ${l}`:`${l} (limit reached; no all anchors were registered)`:`${l} (files changed during search; results shown without anchors)`,a=n?["Anchors: SEARCH#HASH:N:line (line), SEARCH#HASH:N:match (exact match), SEARCH#HASH:all:line (each unique containing line), SEARCH#HASH:all:match (every exact match)",c]:[c],f=new Map(e.matches.map((p,s)=>[p,s+1])),h=N(e.matches,t);for(let[p,s]of h.files.entries()){p>0&&a.push("");let m=re(s.source,r);if(s.kind==="compacted"){a.push(`${m}: ${String(s.matchCount)} matches across ${String(s.uniqueLineCount)} unique line texts (compacted)`);for(let d of s.groups)a.push(` \xD7${String(d.matchCount)} ${te(d.text)}`);s.groups.length<s.uniqueLineCount&&a.push(` \u2026 ${String(s.uniqueLineCount-s.groups.length)} more unique line texts`),a.push(` Search again with path: ${JSON.stringify(m)} and a narrower query to see individual matches.`);continue}for(let d of s.matches){let g=f.get(d);if(g===void 0)continue;let R=`${m}:${String(d.lineNumber)}:${String(d.startColumn+1)}-${String(d.endColumn+1)}`;a.push(n?`${R} SEARCH#${e.id}:${String(g)}:line SEARCH#${e.id}:${String(g)}:match`:R,` ${ee(d)}`)}}return a.join(`
6
+ `)}u(Z,"formatSearchSession");function ee(e){let t=Math.max(0,e.startColumn-64),n=Math.min(e.lineText.length,e.endColumn+64);return`${t>0?"\u2026":""}${e.lineText.slice(t,e.startColumn)}\u27E6${e.lineText.slice(e.startColumn,e.endColumn)}\u27E7${e.lineText.slice(e.endColumn,n)}${n<e.lineText.length?"\u2026":""}`}u(ee,"previewMatch");function te(e){return`${e.slice(0,129)}${e.length>129?"\u2026":""}`}u(te,"previewLine");function re(e,r){let t=G.relative(r,e);return t.length>0&&!t.startsWith("..")&&!G.isAbsolute(t)?t:e}u(re,"displaySource");function V(e,r,t){return e===1?r:t}u(V,"plural");async function ne(e){let r=new j;e.on("tool_result",async(t,n)=>{if(t.toolName!=="replace"||t.isError||typeof t.details!="object"||t.details===null)return;let o="metadata"in t.details?t.details.metadata:void 0,i=o&&typeof o=="object"&&"searchObservations"in o?o.searchObservations:void 0,l=Array.isArray(i)?i:await r.observeAfterEdit([t.input.path,t.input.start,t.input.end],n.signal);if(l.length!==0)return{content:[...t.content,{type:"text",text:["Original search observed after editing (not task validation):",...l.map(c=>{let{query:a,fallbacks:f,...h}=c.scope;return[`SEARCH#${c.sessionId}: ${JSON.stringify(c.query)}`,`Scope and options: ${JSON.stringify(h)}`,c.error===void 0?`Matches: ${c.matches}${c.complete===!0?"; complete search.":"+; incomplete search, lower bound only."}`:`Search failed: ${c.error}. Applied edits remain applied.`,...c.notices??[]].join(`
8
7
  `)})].join(`
9
- `)}],details:{...r.details,searchObservations:i}}}),e.on("tool_result",r=>{if(r.toolName!=="search"||typeof r.details!="object"||r.details===null)return;let n=r.details;if(A(n.payload))return{details:{...n,payload:ne(n.payload,r.content.flatMap(a=>a.type==="text"?[a.text]:[]).join(`
10
- `))}}}),await Promise.all([H(e,U),z(e,{protocol:G,apiVersion:V,id:"local",setup(r){r.addSelectionProvider((n,a)=>t.register(n.request.query,n.matches,n.complete,a.cwd,a.signal,{...n.request,regex:!1},n.refresh)),r.addResolver({resolver:he(t),priority:-10}),r.addResolver({resolver:me(),priority:-10}),r.addResolver({resolver:de(t),fallback:!0}),r.describe(["Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching; files:<pattern> searches file paths: glob patterns use *, **, ?, character classes and braces; other queries use case-insensitive subsequence matching. Slash-containing globs match cwd-relative paths; basename globs match at any depth.","The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.","SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.","Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections."].join(`
11
- `))}}),W(e,{protocol:_,apiVersion:j,id:"search-anchors",setup(r){r.tool("replace").addHandler({stage:"text-post-edit",async handler(n){if(!n.result||typeof n.result!="object"||!("kind"in n.result)||n.result.kind!=="completed"||!n.input||typeof n.input!="object")return n;let a=n.input,o=await t.observeAfterEdit([a.path,a.start,a.end],n.signal);return o.length===0?n:{...n,metadata:{...n.metadata,searchObservations:o}}}}),r.addAnchorResolver({resolver:t.anchorResolver(),resources:t.resourceResolver(),kind:B,type:"auxiliary",describeInPrompt:!1})}})])}c(Be,"registerTextSearch");export{fe as createSearchSessionId,Be as default};
8
+ `)}],details:{...t.details,searchObservations:l}}}),e.on("tool_result",t=>{if(t.toolName!=="search"||typeof t.details!="object"||t.details===null)return;let n=t.details;if(k(n.payload))return{details:{...n,payload:D(n.payload,t.content.flatMap(o=>o.type==="text"?[o.text]:[]).join(`
9
+ `))}}}),await Promise.all([E(e,M),H(e,{protocol:O,apiVersion:P,id:"local",setup(t){t.addSelectionProvider((n,o)=>r.register(n.request.query,n.matches,n.complete,o.cwd,o.signal,{...n.request,regex:!1},n.refresh)),t.addResolver({resolver:J(r),priority:-10}),t.addResolver({resolver:Q(),priority:-10}),t.addResolver({resolver:z(r),fallback:!0}),t.describe(["Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching; files:<pattern> searches file paths: glob patterns use *, **, ?, character classes and braces; other queries use case-insensitive subsequence matching. Slash-containing globs match cwd-relative paths; basename globs match at any depth.","The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.","SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.","Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections."].join(`
10
+ `))}}),q(e,{protocol:C,apiVersion:$,id:"search-anchors",setup(t){t.tool("replace").addHandler({stage:"text-post-edit",async handler(n){if(!n.result||typeof n.result!="object"||!("kind"in n.result)||n.result.kind!=="completed"||!n.input||typeof n.input!="object")return n;let o=n.input,i=await r.observeAfterEdit([o.path,o.start,o.end],n.signal);return i.length===0?n:{...n,metadata:{...n.metadata,searchObservations:i}}}}),t.addAnchorResolver({resolver:r.anchorResolver(),resources:r.resourceResolver(),kind:T,type:"auxiliary",describeInPrompt:!1})}})])}u(ne,"registerTextSearch");export{X as createSearchSessionId,ne as default};
package/dist/entry-53.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-5VSE5X5R.js";import"./chunk-EI7MMDWY.js";export{a as TextAnchor,b as attachTextAnchorRenderer,p as createTextContentConverter,m as createTextDocument,c as getTextAnchorRenderer,i as getTextSourceLine,g as isTextAnchorRecoveryOutcome,f as isTextAnchorResolutionAttempt,e as isTextAnchorResolver,k as isTextLinePresenter,l as isTextPresenterRegistration,s as isTextTargetResolutionAttempt,q as isTextualMediaType,o as renderPresentedTextDocument,h as renderPresentedTextRows,d as renderTextAnchor,n as renderTextDocument,u as restoreText,t as storeText,r as textFromAgentContent,j as withTextSourceLine};
1
+ import{b as a,c as b}from"./chunk-CEX3VOJ7.js";import"./chunk-7WCZOO5I.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{b as SearchResultPanel,a as renderSearchResult};
package/dist/entry-54.js CHANGED
@@ -1 +1 @@
1
- import{a as d}from"./chunk-L7JMDDSD.js";import{a as s,b as l,c}from"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import{a as i}from"./chunk-5VSE5X5R.js";import{a as t}from"./chunk-EI7MMDWY.js";var o=class extends i{static{t(this,"ConstantTextAnchor")}constructor(n,r){super(n,r)}};function p(){return{id:"file-position",description:"`begin` and `end` select the first and last existing lines.",renderFull(e){return e},renderCompact(e){return e==="begin"?"file start":"file end"},tryResolve(e,n){return Promise.resolve(a(e,n))}}}t(p,"createConstantTextAnchorResolver");function a(e,n){return e!=="begin"&&e!=="end"?{kind:"not-handled"}:n.lines.length===0?{kind:"failed",error:new Error(`${e} cannot resolve in an empty file`)}:{kind:"resolved",anchor:new o(e,e==="begin"?1:n.lines.length)}}t(a,"resolveConstantAnchor");async function T(e){await d(e,{protocol:s,apiVersion:l,id:"text-anchor-constant",setup(r){r.addAnchorResolver({resolver:p(),kind:c,type:"constant"})}})}t(T,"registerConstantTextAnchors");export{T as default};
1
+ import{b as a,c as b}from"./chunk-7WCZOO5I.js";import"./chunk-EI7MMDWY.js";export{a as createSearchToolDetails,b as isSearchToolDetails};
package/dist/entry-55.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c}from"./chunk-ZM4L5AGN.js";import"./chunk-GUTQ3PWL.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as createExactTextAnchorResolver,c as findExactTextMatches,b as resolveExactTextAnchor};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-5VSE5X5R.js";import"./chunk-EI7MMDWY.js";export{a as TextAnchor,b as attachTextAnchorRenderer,p as createTextContentConverter,m as createTextDocument,c as getTextAnchorRenderer,i as getTextSourceLine,g as isTextAnchorRecoveryOutcome,f as isTextAnchorResolutionAttempt,e as isTextAnchorResolver,k as isTextLinePresenter,l as isTextPresenterRegistration,s as isTextTargetResolutionAttempt,q as isTextualMediaType,o as renderPresentedTextDocument,h as renderPresentedTextRows,d as renderTextAnchor,n as renderTextDocument,u as restoreText,t as storeText,r as textFromAgentContent,j as withTextSourceLine};
package/dist/entry-56.js CHANGED
@@ -1 +1 @@
1
- import{a as m}from"./chunk-ZM4L5AGN.js";import"./chunk-GUTQ3PWL.js";import{a as f}from"./chunk-L7JMDDSD.js";import{a as c,b as u,d as s}from"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import{a as i}from"./chunk-EI7MMDWY.js";import{readFileSync as z}from"node:fs";import w from"node:path";function x(e){let n=b(e.settings,"recovery.exactText");n!==void 0&&p(n,["fuzzyEnabled","threshold","exactCandidateLimit","fuzzyCandidateLimit","maxFileSizeMiB","maxQuerySizeKiB","seedLimit","blockLineVariance"],"recovery.exactText");let t=i(o=>n===void 0?void 0:n[o],"value");return{fuzzyEnabled:g(t("fuzzyEnabled"),"fuzzyEnabled")??!0,threshold:d(t("threshold"),"threshold",0,1)??.8,exactCandidateLimit:a(t("exactCandidateLimit"),"exactCandidateLimit",1,100)??20,fuzzyCandidateLimit:a(t("fuzzyCandidateLimit"),"fuzzyCandidateLimit",1,20)??5,maxFileSizeMiB:d(t("maxFileSizeMiB"),"maxFileSizeMiB",.01,100)??20,maxQuerySizeKiB:d(t("maxQuerySizeKiB"),"maxQuerySizeKiB",.01,4096)??1024,seedLimit:a(t("seedLimit"),"seedLimit",1,10)??3,blockLineVariance:a(t("blockLineVariance"),"blockLineVariance",0,10)??2,contextLines:e.contextLines,timeoutMs:e.timeoutMs}}i(x,"parseExactTextRecoveryConfig");function l(e,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError(`${n} must be an object`);return Object.fromEntries(Object.entries(e))}i(l,"objectRecord");function b(e,n){return e===void 0?void 0:l(e,n)}i(b,"optionalObject");function p(e,n,t){let o=new Set(n),r=Object.keys(e).find(y=>!o.has(y));if(r!==void 0)throw new TypeError(`${t} contains unknown key ${r}`)}i(p,"assertKeys");function g(e,n){if(e===void 0||typeof e=="boolean")return e;throw new TypeError(`${n} must be a boolean`)}i(g,"optionalBoolean");function d(e,n,t,o){if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>o)throw new RangeError(`${n} must be between ${t} and ${o}`);return e}}i(d,"optionalNumber");function a(e,n,t,o){let r=d(e,n,t,o);if(r!==void 0&&!Number.isInteger(r))throw new TypeError(`${n} must be an integer`);return r}i(a,"optionalInteger");async function E(e){await f(e,{protocol:c,apiVersion:u,id:"text-anchor-exact",setup(t){t.addAnchorResolver({resolver:m(x(t.recoveryConfig("exactText"))),kind:s,type:"auxiliary",describeInPrompt:!1,priority:1e4})}})}i(E,"registerExactTextAnchor");export{E as default};
1
+ import{a as d}from"./chunk-L7JMDDSD.js";import{a as s,b as l,c}from"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import{a as i}from"./chunk-5VSE5X5R.js";import{a as t}from"./chunk-EI7MMDWY.js";var o=class extends i{static{t(this,"ConstantTextAnchor")}constructor(n,r){super(n,r)}};function p(){return{id:"file-position",description:"`begin` and `end` select the first and last existing lines.",renderFull(e){return e},renderCompact(e){return e==="begin"?"file start":"file end"},tryResolve(e,n){return Promise.resolve(a(e,n))}}}t(p,"createConstantTextAnchorResolver");function a(e,n){return e!=="begin"&&e!=="end"?{kind:"not-handled"}:n.lines.length===0?{kind:"failed",error:new Error(`${e} cannot resolve in an empty file`)}:{kind:"resolved",anchor:new o(e,e==="begin"?1:n.lines.length)}}t(a,"resolveConstantAnchor");async function T(e){await d(e,{protocol:s,apiVersion:l,id:"text-anchor-constant",setup(r){r.addAnchorResolver({resolver:p(),kind:c,type:"constant"})}})}t(T,"registerConstantTextAnchors");export{T as default};
package/dist/entry-57.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e}from"./chunk-QDST6VIU.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{b as createLineHashAnchor,e as createLineHashAnchorResolver,c as formatLineHashAnchor,a as hashLine,d as renderLineHashLines};
1
+ import{a,b,c}from"./chunk-ZM4L5AGN.js";import"./chunk-GUTQ3PWL.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as createExactTextAnchorResolver,c as findExactTextMatches,b as resolveExactTextAnchor};
package/dist/entry-58.js CHANGED
@@ -1 +1 @@
1
- import{b as x,e as T}from"./chunk-QDST6VIU.js";import{a as P}from"./chunk-L7JMDDSD.js";import{a as u,b as h,c as f}from"./chunk-O6LE42GK.js";import{a as l}from"./chunk-6CZO43OH.js";import{a as d,b as m}from"./chunk-OBNING2A.js";import"./chunk-S3ZPXWX7.js";import{i as p}from"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import{a}from"./chunk-EI7MMDWY.js";function g(){return{id:"line-hash",present(n,o){let i=n.lines.map(e=>{let t=o.resolvedBy==="filesystem"?{lineNumber:e.lineNumber,content:e.content}:p(e);return t===void 0?void 0:{anchor:x(t.lineNumber,t.content),lineNumber:t.lineNumber}}),c=Math.max(0,...i.map(e=>e?.anchor.value.length??0)),r=Math.max(0,...i.map(e=>String(e?.lineNumber??"").length)),E=n.lines.map((e,t)=>{let s=i[t];return s===void 0?e:{...e,anchors:[...new Set([...e.anchors??[],s.anchor.value])],presentation:{...e.presentation,prefix:`${s.anchor.value.padStart(c)}|${e.presentation?.prefix??""}`,compactPrefix:e.presentation?.compactPrefix??`${String(s.lineNumber).padStart(r)} \u2502 `}}});return{...n,lines:E}}}}a(g,"createLineHashPresenter");async function R(n){let o=g(),i={protocol:d,apiVersion:m,id:"text-anchor-line-hash",setup(r){r.addView({view:"anchors",presenter:o}),r.describe('views: ["anchors"] \u2014 LINE#HASH references for editing individual source lines.')}},c={protocol:u,apiVersion:h,id:"text-anchor-line-hash",setup(r){r.addAnchorResolver({resolver:T(),kind:f,type:"major"}),r.addTextPresenter({presenter:o})}};await Promise.all([l(n,i),P(n,c)])}a(R,"registerLineHashTextAnchor");export{R as default};
1
+ import{a as m}from"./chunk-ZM4L5AGN.js";import"./chunk-GUTQ3PWL.js";import{a as f}from"./chunk-L7JMDDSD.js";import{a as c,b as u,d as s}from"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import{a as i}from"./chunk-EI7MMDWY.js";import{readFileSync as z}from"node:fs";import w from"node:path";function x(e){let n=b(e.settings,"recovery.exactText");n!==void 0&&p(n,["fuzzyEnabled","threshold","exactCandidateLimit","fuzzyCandidateLimit","maxFileSizeMiB","maxQuerySizeKiB","seedLimit","blockLineVariance"],"recovery.exactText");let t=i(o=>n===void 0?void 0:n[o],"value");return{fuzzyEnabled:g(t("fuzzyEnabled"),"fuzzyEnabled")??!0,threshold:d(t("threshold"),"threshold",0,1)??.8,exactCandidateLimit:a(t("exactCandidateLimit"),"exactCandidateLimit",1,100)??20,fuzzyCandidateLimit:a(t("fuzzyCandidateLimit"),"fuzzyCandidateLimit",1,20)??5,maxFileSizeMiB:d(t("maxFileSizeMiB"),"maxFileSizeMiB",.01,100)??20,maxQuerySizeKiB:d(t("maxQuerySizeKiB"),"maxQuerySizeKiB",.01,4096)??1024,seedLimit:a(t("seedLimit"),"seedLimit",1,10)??3,blockLineVariance:a(t("blockLineVariance"),"blockLineVariance",0,10)??2,contextLines:e.contextLines,timeoutMs:e.timeoutMs}}i(x,"parseExactTextRecoveryConfig");function l(e,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError(`${n} must be an object`);return Object.fromEntries(Object.entries(e))}i(l,"objectRecord");function b(e,n){return e===void 0?void 0:l(e,n)}i(b,"optionalObject");function p(e,n,t){let o=new Set(n),r=Object.keys(e).find(y=>!o.has(y));if(r!==void 0)throw new TypeError(`${t} contains unknown key ${r}`)}i(p,"assertKeys");function g(e,n){if(e===void 0||typeof e=="boolean")return e;throw new TypeError(`${n} must be a boolean`)}i(g,"optionalBoolean");function d(e,n,t,o){if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e)||e<t||e>o)throw new RangeError(`${n} must be between ${t} and ${o}`);return e}}i(d,"optionalNumber");function a(e,n,t,o){let r=d(e,n,t,o);if(r!==void 0&&!Number.isInteger(r))throw new TypeError(`${n} must be an integer`);return r}i(a,"optionalInteger");async function E(e){await f(e,{protocol:c,apiVersion:u,id:"text-anchor-exact",setup(t){t.addAnchorResolver({resolver:m(x(t.recoveryConfig("exactText"))),kind:s,type:"auxiliary",describeInPrompt:!1,priority:1e4})}})}i(E,"registerExactTextAnchor");export{E as default};
package/dist/entry-59.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-6EYWFBNG.js";import{g as a,i as b}from"./chunk-YT42LKFV.js";import"./chunk-ITSNK5YG.js";import"./chunk-FA6BKC5Y.js";import"./chunk-NNCZYO4Q.js";import"./chunk-VCTK4JSN.js";import"./chunk-YHUTTZC6.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as createApplyCallRenderer,b as createApplyResultRenderer};
1
+ import{a,b,c,d,e}from"./chunk-QDST6VIU.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{b as createLineHashAnchor,e as createLineHashAnchorResolver,c as formatLineHashAnchor,a as hashLine,d as renderLineHashLines};
package/dist/entry-60.js CHANGED
@@ -0,0 +1 @@
1
+ import{b as x,e as T}from"./chunk-QDST6VIU.js";import{a as P}from"./chunk-L7JMDDSD.js";import{a as u,b as h,c as f}from"./chunk-O6LE42GK.js";import{a as l}from"./chunk-6CZO43OH.js";import{a as d,b as m}from"./chunk-OBNING2A.js";import"./chunk-S3ZPXWX7.js";import{i as p}from"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import{a}from"./chunk-EI7MMDWY.js";function g(){return{id:"line-hash",present(n,o){let i=n.lines.map(e=>{let t=o.resolvedBy==="filesystem"?{lineNumber:e.lineNumber,content:e.content}:p(e);return t===void 0?void 0:{anchor:x(t.lineNumber,t.content),lineNumber:t.lineNumber}}),c=Math.max(0,...i.map(e=>e?.anchor.value.length??0)),r=Math.max(0,...i.map(e=>String(e?.lineNumber??"").length)),E=n.lines.map((e,t)=>{let s=i[t];return s===void 0?e:{...e,anchors:[...new Set([...e.anchors??[],s.anchor.value])],presentation:{...e.presentation,prefix:`${s.anchor.value.padStart(c)}|${e.presentation?.prefix??""}`,compactPrefix:e.presentation?.compactPrefix??`${String(s.lineNumber).padStart(r)} \u2502 `}}});return{...n,lines:E}}}}a(g,"createLineHashPresenter");async function R(n){let o=g(),i={protocol:d,apiVersion:m,id:"text-anchor-line-hash",setup(r){r.addView({view:"anchors",presenter:o}),r.describe('views: ["anchors"] \u2014 LINE#HASH references for editing individual source lines.')}},c={protocol:u,apiVersion:h,id:"text-anchor-line-hash",setup(r){r.addAnchorResolver({resolver:T(),kind:f,type:"major"}),r.addTextPresenter({presenter:o})}};await Promise.all([l(n,i),P(n,c)])}a(R,"registerLineHashTextAnchor");export{R as default};
package/dist/entry-61.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-L7JMDDSD.js";import"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-EI7MMDWY.js";export{a as connectTextEditorPlugin};
1
+ import"./chunk-6EYWFBNG.js";import{g as a,i as b}from"./chunk-YT42LKFV.js";import"./chunk-ITSNK5YG.js";import"./chunk-FA6BKC5Y.js";import"./chunk-NNCZYO4Q.js";import"./chunk-VCTK4JSN.js";import"./chunk-YHUTTZC6.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as createApplyCallRenderer,b as createApplyResultRenderer};
package/dist/entry-63.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-U22JNO6N.js";import"./chunk-EI7MMDWY.js";export{a as isTextEditHandlerRegistration};
1
+ import{a}from"./chunk-L7JMDDSD.js";import"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-EI7MMDWY.js";export{a as connectTextEditorPlugin};
package/dist/entry-64.js CHANGED
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-EI7MMDWY.js";export{b as TEXT_EDITOR_API_VERSION,e as TEXT_EDITOR_CORE_READY_EVENT,f as TEXT_EDITOR_PLUGIN_REGISTER_EVENT,a as TEXT_EDITOR_PROTOCOL,c as TEXT_POSITION_ANCHOR_KIND,d as TEXT_SEARCH_ANCHOR_KIND,h as isResourceResolverRegistration,i as isTextAnchorResolverRegistration,j as isTextAnchorResourceResolutionAttempt,k as isTextEditorCoreReady,l as isTextEditorPlugin,m as isTextEditorPluginRegistrationRequest,g as isTextEditorToolId};
package/dist/entry-65.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-MBUXFKIW.js";import"./chunk-EI7MMDWY.js";export{a as formatStaleAnchorMessage};
1
+ import{a}from"./chunk-U22JNO6N.js";import"./chunk-EI7MMDWY.js";export{a as isTextEditHandlerRegistration};
package/dist/entry-66.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-GUTQ3PWL.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as TextSelectionAnchor};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-EI7MMDWY.js";export{b as TEXT_EDITOR_API_VERSION,e as TEXT_EDITOR_CORE_READY_EVENT,f as TEXT_EDITOR_PLUGIN_REGISTER_EVENT,a as TEXT_EDITOR_PROTOCOL,c as TEXT_POSITION_ANCHOR_KIND,d as TEXT_SEARCH_ANCHOR_KIND,h as isResourceResolverRegistration,i as isTextAnchorResolverRegistration,j as isTextAnchorResourceResolutionAttempt,k as isTextEditorCoreReady,l as isTextEditorPlugin,m as isTextEditorPluginRegistrationRequest,g as isTextEditorToolId};
package/dist/entry-67.js CHANGED
@@ -1 +1 @@
1
- import{a,d as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i}from"./chunk-FEDVTZJG.js";import"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-EI7MMDWY.js";export{c as TEXT_EDITOR_POST_EDIT_REGISTER_EVENT,a as afterPostEditScope,i as connectTextEditorPostEditHandler,b as hasDeferredPostEdit,e as isDiffStatusContribution,d as isFormattingContribution,h as isTextMutationResultContributionData,f as isTextPostEditHandlerRegistration,g as isTextPostEditHandlerRegistrationRequest};
1
+ import{a}from"./chunk-MBUXFKIW.js";import"./chunk-EI7MMDWY.js";export{a as formatStaleAnchorMessage};
package/dist/entry-68.js CHANGED
@@ -1 +1 @@
1
- import"./chunk-4U2GUKNJ.js";import{b as a,c as b,d as c}from"./chunk-ITSNK5YG.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{c as FileMutationResult,b as FileRange,a as computeChangedRanges};
1
+ import{a}from"./chunk-GUTQ3PWL.js";import"./chunk-5VSE5X5R.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as TextSelectionAnchor};
package/dist/entry-69.js CHANGED
@@ -0,0 +1 @@
1
+ import{a,d as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i}from"./chunk-FEDVTZJG.js";import"./chunk-O6LE42GK.js";import"./chunk-S3ZPXWX7.js";import"./chunk-5VSE5X5R.js";import"./chunk-EI7MMDWY.js";export{c as TEXT_EDITOR_POST_EDIT_REGISTER_EVENT,a as afterPostEditScope,i as connectTextEditorPostEditHandler,b as hasDeferredPostEdit,e as isDiffStatusContribution,d as isFormattingContribution,h as isTextMutationResultContributionData,f as isTextPostEditHandlerRegistration,g as isTextPostEditHandlerRegistrationRequest};
package/dist/entry-70.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c}from"./chunk-AWXVJ5AC.js";import"./chunk-EI7MMDWY.js";export{b as assertTextMutationToolRegistration,a as isMutationAnchorValue,c as mutationSource};
1
+ import"./chunk-4U2GUKNJ.js";import{b as a,c as b,d as c}from"./chunk-ITSNK5YG.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{c as FileMutationResult,b as FileRange,a as computeChangedRanges};
package/dist/entry-72.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c}from"./chunk-YHADTHQM.js";import"./chunk-EI7MMDWY.js";export{c as clearLastResolvedResource,b as getLastResolvedResource,a as rememberLastResolvedResource};
1
+ import{a,b,c}from"./chunk-AWXVJ5AC.js";import"./chunk-EI7MMDWY.js";export{b as assertTextMutationToolRegistration,a as isMutationAnchorValue,c as mutationSource};
package/dist/entry-73.js CHANGED
@@ -1 +0,0 @@
1
- import{a as b,b as c}from"./chunk-4LUW26BX.js";import{c as a}from"./chunk-GIRAEVUJ.js";import"./chunk-YHUTTZC6.js";import"./chunk-EI7MMDWY.js";export{a as getToolCallInterception,c as registerToolCallAnnotationSink,b as registerToolCallInterceptor};
package/dist/entry-74.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-J34VKQGJ.js";import"./chunk-EI7MMDWY.js";export{a as isTextEditorToolRendererRegistration};
1
+ import{a,b,c}from"./chunk-YHADTHQM.js";import"./chunk-EI7MMDWY.js";export{c as clearLastResolvedResource,b as getLastResolvedResource,a as rememberLastResolvedResource};