pi-agent-ide 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (606) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +24 -29
  3. package/dist/chunk-2AY526TN.js +3 -0
  4. package/dist/{chunk-LEJKDYCK.js → chunk-2TZDG2JH.js} +1 -1
  5. package/dist/{chunk-XBQR74IK.js → chunk-4GBFIGH3.js} +1 -1
  6. package/dist/{chunk-PJL3UVMJ.js → chunk-4IWEKRSP.js} +1 -1
  7. package/dist/chunk-52PFWQMU.js +5 -0
  8. package/dist/chunk-5BGWNYQS.js +1 -0
  9. package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
  10. package/dist/chunk-64JTD2DJ.js +1 -0
  11. package/dist/{chunk-XAHU42FP.js → chunk-6A3ORNW3.js} +2 -2
  12. package/dist/{chunk-ANM3Y5FO.js → chunk-6WCHBHFW.js} +5 -5
  13. package/dist/{chunk-IMGIDBCC.js → chunk-7D7PXIVV.js} +1 -1
  14. package/dist/chunk-7PVDTMEM.js +1 -0
  15. package/dist/chunk-7SG756UO.js +4 -0
  16. package/dist/{chunk-GBUJOR6V.js → chunk-7URANI6I.js} +14 -14
  17. package/dist/{chunk-4W7GH3T7.js → chunk-AJZVKDYC.js} +1 -1
  18. package/dist/chunk-AMIIOWFL.js +1 -0
  19. package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
  20. package/dist/chunk-C2JT2G5K.js +1 -0
  21. package/dist/chunk-CVOYSEBE.js +1 -0
  22. package/dist/chunk-DDH3FP4G.js +3 -0
  23. package/dist/chunk-FEZLTM4L.js +1 -0
  24. package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
  25. package/dist/chunk-FKKAHI62.js +11 -0
  26. package/dist/chunk-FS3KCKFX.js +9 -0
  27. package/dist/chunk-FYOU4RBH.js +2 -0
  28. package/dist/chunk-G4PRFO6G.js +1 -0
  29. package/dist/chunk-GS5ZRTUG.js +1 -0
  30. package/dist/{chunk-XXLLY66B.js → chunk-GXL4NMHR.js} +1 -1
  31. package/dist/{chunk-QT3EAHOG.js → chunk-H3GEEOOL.js} +1 -1
  32. package/dist/chunk-H5Z54BEU.js +25 -0
  33. package/dist/chunk-H7WAM5RH.js +23 -0
  34. package/dist/chunk-HT7LZN5A.js +9 -0
  35. package/dist/chunk-IG5DXVDJ.js +1 -0
  36. package/dist/chunk-K4UTEMDU.js +1 -0
  37. package/dist/chunk-KFBRL2V4.js +3 -0
  38. package/dist/chunk-KN6VPARZ.js +1 -0
  39. package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
  40. package/dist/chunk-LTADNZKW.js +2 -0
  41. package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
  42. package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
  43. package/dist/chunk-NA2NEU4V.js +1 -0
  44. package/dist/chunk-OBTT5INC.js +6 -0
  45. package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
  46. package/dist/chunk-PLMHBXWI.js +10 -0
  47. package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
  48. package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
  49. package/dist/chunk-QM5WDEFI.js +1 -0
  50. package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
  51. package/dist/chunk-RIOPUTUJ.js +6 -0
  52. package/dist/chunk-RVFMH77U.js +82 -0
  53. package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
  54. package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
  55. package/dist/{chunk-PT35ZFLH.js → chunk-TNAUCNUT.js} +12 -12
  56. package/dist/{chunk-DUUOCBS3.js → chunk-TVH2ND35.js} +1 -1
  57. package/dist/chunk-TVSZYABY.js +5 -0
  58. package/dist/chunk-TVXZE4KW.js +4 -0
  59. package/dist/chunk-U7YDLVFL.js +1 -0
  60. package/dist/{chunk-KZC7TI5M.js → chunk-UD3DMY3Q.js} +1 -1
  61. package/dist/{chunk-VXP5BMW7.js → chunk-USG6WHAT.js} +1 -1
  62. package/dist/{chunk-RMI3NMQY.js → chunk-V4J3TLCV.js} +2 -2
  63. package/dist/{chunk-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
  64. package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
  65. package/dist/{chunk-6T7PSDQW.js → chunk-VN3XBH2Q.js} +1 -1
  66. package/dist/chunk-WAJW4G4F.js +22 -0
  67. package/dist/chunk-WEE3NM6L.js +1 -0
  68. package/dist/{chunk-IM24DB3K.js → chunk-WES2E4VR.js} +1 -1
  69. package/dist/{chunk-RIJMXO43.js → chunk-WQIMM4SU.js} +1 -1
  70. package/dist/chunk-WUO3UW4J.js +17 -0
  71. package/dist/chunk-XE4W5YTE.js +2 -0
  72. package/dist/chunk-XUYIK4TX.js +1 -0
  73. package/dist/{chunk-ZJQRLVVV.js → chunk-Y74EKJOY.js} +1 -1
  74. package/dist/{chunk-AAC77UD4.js → chunk-YPYROPQF.js} +1 -1
  75. package/dist/chunk-ZXO4D5UB.js +1 -0
  76. package/dist/entry-0.js +1 -1
  77. package/dist/entry-1.js +1 -1
  78. package/dist/entry-10.js +1 -1
  79. package/dist/entry-11.js +1 -1
  80. package/dist/entry-12.js +1 -1
  81. package/dist/entry-13.js +1 -1
  82. package/dist/entry-14.js +1 -1
  83. package/dist/entry-15.js +1 -1
  84. package/dist/entry-16.js +1 -1
  85. package/dist/entry-17.js +1 -1
  86. package/dist/entry-18.js +1 -1
  87. package/dist/entry-19.js +1 -1
  88. package/dist/entry-2.js +1 -1
  89. package/dist/entry-20.js +1 -1
  90. package/dist/entry-21.js +1 -0
  91. package/dist/entry-23.js +1 -1
  92. package/dist/entry-24.js +1 -1
  93. package/dist/entry-25.js +1 -1
  94. package/dist/entry-26.js +1 -1
  95. package/dist/entry-27.js +1 -1
  96. package/dist/entry-28.js +1 -1
  97. package/dist/entry-29.js +1 -2
  98. package/dist/entry-3.js +1 -1
  99. package/dist/entry-30.js +2 -1
  100. package/dist/entry-31.js +1 -4
  101. package/dist/entry-32.js +1 -1
  102. package/dist/entry-33.js +1 -1
  103. package/dist/entry-34.js +1 -1
  104. package/dist/entry-35.js +1 -18
  105. package/dist/entry-36.js +1 -1
  106. package/dist/entry-37.js +15 -1
  107. package/dist/entry-38.js +1 -1
  108. package/dist/entry-39.js +1 -1
  109. package/dist/entry-4.js +1 -1
  110. package/dist/entry-40.js +1 -1
  111. package/dist/entry-41.js +1 -1
  112. package/dist/entry-42.js +1 -1
  113. package/dist/entry-43.js +1 -1
  114. package/dist/entry-44.js +1 -1
  115. package/dist/entry-45.js +1 -1
  116. package/dist/entry-46.js +1 -1
  117. package/dist/entry-47.js +1 -1
  118. package/dist/entry-48.js +1 -1
  119. package/dist/entry-49.js +1 -25
  120. package/dist/entry-5.js +1 -1
  121. package/dist/entry-50.js +1 -1
  122. package/dist/entry-51.js +1 -1
  123. package/dist/entry-52.js +1 -1
  124. package/dist/entry-53.js +1 -1
  125. package/dist/entry-54.js +1 -3
  126. package/dist/entry-55.js +1 -13
  127. package/dist/entry-56.js +1 -1
  128. package/dist/entry-57.js +1 -1
  129. package/dist/entry-58.js +1 -1
  130. package/dist/entry-59.js +1 -1
  131. package/dist/entry-6.js +1 -1
  132. package/dist/entry-60.js +1 -1
  133. package/dist/entry-61.js +1 -1
  134. package/dist/entry-62.js +1 -1
  135. package/dist/entry-63.js +1 -1
  136. package/dist/entry-64.js +1 -1
  137. package/dist/entry-65.js +1 -0
  138. package/dist/entry-66.js +1 -1
  139. package/dist/entry-68.js +1 -1
  140. package/dist/entry-69.js +0 -1
  141. package/dist/entry-7.js +1 -1
  142. package/dist/entry-70.js +1 -1
  143. package/dist/entry-71.js +1 -1
  144. package/dist/entry-72.js +1 -1
  145. package/dist/entry-73.js +1 -1
  146. package/dist/entry-74.js +1 -1
  147. package/dist/entry-75.js +1 -0
  148. package/dist/entry-76.js +1 -1
  149. package/dist/entry-78.js +1 -1
  150. package/dist/entry-79.js +0 -1
  151. package/dist/entry-8.js +1 -1
  152. package/dist/entry-80.js +1 -1
  153. package/dist/entry-81.js +1 -80
  154. package/dist/entry-82.js +1 -22
  155. package/dist/entry-83.js +1 -2
  156. package/dist/entry-84.js +1 -1
  157. package/dist/entry-85.js +2 -1
  158. package/dist/entry-86.js +1 -1
  159. package/dist/entry-87.js +1 -1
  160. package/dist/entry-88.js +1 -3
  161. package/dist/entry-89.js +1 -1
  162. package/dist/entry-9.js +1 -1
  163. package/dist/entry-90.js +3 -1
  164. package/dist/entry-91.js +1 -1
  165. package/dist/entry-92.js +1 -0
  166. package/dist/entry-93.js +1 -0
  167. package/dist/pi-agent-ide.js +10 -34
  168. package/docs/agent-guides/ast-search.md +58 -0
  169. package/docs/agent-guides/debugger.md +1 -1
  170. package/docs/agent-guides/editing.md +26 -58
  171. package/docs/agent-guides/git-changes.md +4 -14
  172. package/docs/agent-guides/search.md +38 -0
  173. package/docs/agent-guides/ssh.md +17 -49
  174. package/docs/agent-guides/terminal.md +9 -15
  175. package/docs/configuration.md +9 -13
  176. package/docs/extensions.md +82 -0
  177. package/docs/settings-help.md +2 -2
  178. package/docs/structured-results.md +33 -11
  179. package/docs/tools.md +23 -22
  180. package/node_modules/pi-agent-doctor/package.json +7 -7
  181. package/node_modules/pi-agent-doctor/src/workspace.ts +0 -5
  182. package/node_modules/pi-agent-documentation/package.json +2 -2
  183. package/node_modules/pi-agent-documentation/runtime/entry-29.js +1 -0
  184. package/node_modules/pi-agent-documentation/src/index.ts +26 -10
  185. package/node_modules/pi-agent-filesystem/index.ts +1 -1
  186. package/node_modules/pi-agent-filesystem/package.json +8 -8
  187. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  188. package/node_modules/pi-agent-filesystem-jq/index.ts +9 -63
  189. package/node_modules/pi-agent-filesystem-jq/package.json +12 -6
  190. package/node_modules/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  191. package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  192. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  193. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  194. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  195. package/node_modules/pi-agent-ide-ast/package.json +15 -15
  196. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +13 -1
  197. package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
  198. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  199. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  200. package/node_modules/pi-agent-ide-changes/index.ts +1 -2
  201. package/node_modules/pi-agent-ide-changes/package.json +10 -10
  202. package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  203. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  204. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  205. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  206. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  207. package/node_modules/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  208. package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
  209. package/node_modules/pi-agent-ide-lsp/package.json +14 -10
  210. package/node_modules/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  211. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  212. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  213. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  214. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  215. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  216. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  217. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  218. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  219. package/node_modules/pi-agent-image/package.json +3 -3
  220. package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
  221. package/node_modules/pi-agent-invariant/package.json +2 -2
  222. package/node_modules/pi-agent-pdf/package.json +3 -3
  223. package/node_modules/pi-agent-pdf/src/pdf-converter.ts +23 -1
  224. package/node_modules/pi-agent-read/package.json +12 -12
  225. package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
  226. package/node_modules/pi-agent-read/runtime/entry-51.js +2 -0
  227. package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
  228. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
  229. package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
  230. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  231. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  232. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  233. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  234. package/node_modules/pi-agent-resource/package.json +2 -2
  235. package/node_modules/pi-agent-resource/src/index.ts +8 -0
  236. package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
  237. package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
  238. package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
  239. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
  240. package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
  241. package/node_modules/pi-agent-search/package.json +9 -9
  242. package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
  243. package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
  244. package/node_modules/pi-agent-search/runtime/entry-56.js +2 -0
  245. package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
  246. package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
  247. package/node_modules/pi-agent-search/src/api/search.ts +14 -2
  248. package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
  249. package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
  250. package/node_modules/pi-agent-search-text/index.ts +34 -12
  251. package/node_modules/pi-agent-search-text/package.json +17 -15
  252. package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
  253. package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
  254. package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
  255. package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
  256. package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
  257. package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
  258. package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
  259. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
  260. package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
  261. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
  262. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
  263. package/node_modules/pi-agent-text/package.json +3 -3
  264. package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
  265. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  266. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  267. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  268. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
  269. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  270. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  271. package/node_modules/pi-agent-text-editor/package.json +26 -26
  272. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
  273. package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
  274. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  275. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  276. package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  277. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  278. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  279. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
  280. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  281. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
  282. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  283. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  284. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  285. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  286. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  287. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  288. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  289. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  290. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  291. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  292. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  293. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  294. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  295. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  296. package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
  297. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  298. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  299. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  300. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
  301. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  302. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  303. package/node_modules/pi-agent-tool-ui/package.json +3 -3
  304. package/node_modules/pi-agent-tool-ui/runtime/entry-87.js +1 -0
  305. package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
  306. package/node_modules/pi-agent-web/index.ts +28 -6
  307. package/node_modules/pi-agent-web/package.json +8 -8
  308. package/node_modules/pi-agent-web-html/package.json +3 -3
  309. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  310. package/node_modules/pi-agent-web-image/package.json +4 -4
  311. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  312. package/node_modules/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  313. package/node_modules/pi-agent-web-text/package.json +4 -4
  314. package/node_modules/pi-agent-web-text/runtime/entry-93.js +2 -0
  315. package/package.json +61 -58
  316. package/src/api/approval.ts +2 -0
  317. package/src/api/read.ts +2 -0
  318. package/src/api/standalone.ts +7 -0
  319. package/src/backend/doctor-workspace.ts +0 -3
  320. package/src/backend/process-metadata-worker.py +9 -18
  321. package/src/backend/process-metadata.ts +11 -44
  322. package/src/backend/registration.ts +0 -10
  323. package/src/backend/web-browser-worker.mjs +2 -17
  324. package/src/backend/web-browser.ts +1 -26
  325. package/src/composite/builtin-extensions.ts +8 -6
  326. package/src/composite/ide-alias-rendering.ts +18 -2
  327. package/src/composite/module-labels.ts +0 -4
  328. package/src/composite/preferences.ts +0 -36
  329. package/src/composite/settings-documentation.ts +1 -2
  330. package/src/composite/text-results.ts +61 -23
  331. package/src/documentation/extension.ts +39 -15
  332. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
  333. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  334. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  335. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +9 -63
  336. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
  337. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  338. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  339. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  340. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  341. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  342. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-35.js +2 -0
  343. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +2 -0
  344. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
  345. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  346. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  347. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  348. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  349. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  350. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  351. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  352. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-93.js +2 -0
  353. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +2 -0
  354. package/src/extensions/pi-agent-read/package.json +12 -12
  355. package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
  356. package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
  357. package/src/extensions/pi-agent-read/runtime/entry-51.js +2 -0
  358. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
  359. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
  360. package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
  361. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  362. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  363. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  364. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  365. package/src/extensions/pi-agent-search/package.json +9 -9
  366. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
  367. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
  368. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  369. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
  370. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-60.js +1 -0
  371. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
  372. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
  373. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
  374. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
  376. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
  377. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
  378. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
  379. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
  380. package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
  381. package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
  382. package/src/extensions/pi-agent-search/runtime/entry-56.js +2 -0
  383. package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
  384. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
  385. package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
  386. package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
  387. package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
  388. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  389. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  390. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  391. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  392. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
  393. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  394. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-65.js +1 -0
  395. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  396. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
  397. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  398. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  399. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  400. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
  401. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  402. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
  403. package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
  404. package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +2 -0
  405. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  406. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  407. package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  408. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  409. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  410. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
  411. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  412. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
  413. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  414. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  415. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  416. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  417. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  418. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  419. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  420. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  421. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  422. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  423. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  424. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  425. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  426. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  427. package/src/pi-agent-ide.ts +8 -15
  428. package/src/plugins/pi-agent-ide-ast/package.json +15 -15
  429. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +13 -1
  430. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  431. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  432. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  433. package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
  434. package/src/plugins/pi-agent-ide-changes/package.json +10 -10
  435. package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  436. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  437. package/src/plugins/pi-agent-ide-debugger/index.ts +17 -4
  438. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
  439. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  440. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  441. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  442. package/src/plugins/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  443. package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
  444. package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
  445. package/src/plugins/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  446. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  447. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  448. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  449. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  450. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  451. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  452. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  453. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  454. package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
  455. package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
  456. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +10 -7
  457. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
  458. package/src/standalone/resource-host.ts +147 -0
  459. package/src/standalone/scoped-api.ts +457 -0
  460. package/dist/chunk-2RTCSZB3.js +0 -1
  461. package/dist/chunk-4DIUPEDF.js +0 -2
  462. package/dist/chunk-6EDOLYOV.js +0 -1
  463. package/dist/chunk-6FGLAVPJ.js +0 -1
  464. package/dist/chunk-6H32W35W.js +0 -1
  465. package/dist/chunk-6OJ565FL.js +0 -2
  466. package/dist/chunk-6R3Y4AD3.js +0 -1
  467. package/dist/chunk-6TJPMBUQ.js +0 -1
  468. package/dist/chunk-6XFUICD7.js +0 -1
  469. package/dist/chunk-BHSO2MDK.js +0 -6
  470. package/dist/chunk-GSOYVIQS.js +0 -1
  471. package/dist/chunk-HSRH76JN.js +0 -3
  472. package/dist/chunk-HSZ4AQ6L.js +0 -9
  473. package/dist/chunk-I6NPILT5.js +0 -1
  474. package/dist/chunk-K7SRNBIV.js +0 -1
  475. package/dist/chunk-LCWBVOII.js +0 -3
  476. package/dist/chunk-MKEC3U2M.js +0 -4
  477. package/dist/chunk-NUM3YQGK.js +0 -1
  478. package/dist/chunk-OM4LYD3S.js +0 -1
  479. package/dist/chunk-PLKYHUNT.js +0 -1
  480. package/dist/chunk-QIJMV2P2.js +0 -2
  481. package/dist/chunk-RVU73VKN.js +0 -2
  482. package/dist/chunk-SDAH3ECM.js +0 -5
  483. package/dist/chunk-SGQWRIRJ.js +0 -10
  484. package/dist/chunk-SWBJS3U4.js +0 -1
  485. package/dist/chunk-T7I2VX3J.js +0 -1
  486. package/dist/chunk-T7MWQQIF.js +0 -3
  487. package/dist/chunk-UEVGZUII.js +0 -3
  488. package/dist/chunk-VDP5CQHM.js +0 -3
  489. package/dist/chunk-XG7QNAKW.js +0 -9
  490. package/dist/chunk-XLWCSJMR.js +0 -1
  491. package/dist/chunk-YFP4P2FV.js +0 -1
  492. package/dist/chunk-YIXP2ALP.js +0 -9
  493. package/dist/entry-22.js +0 -1
  494. package/docs/agent-guides/diagnostics.md +0 -5
  495. package/docs/agent-guides/json-reading.md +0 -57
  496. package/docs/agent-guides/read-resources.md +0 -17
  497. package/docs/agent-guides/search-code.md +0 -76
  498. package/docs/agent-guides/select-code.md +0 -119
  499. package/docs/agent-guides/vision.md +0 -11
  500. package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
  501. package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
  502. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  503. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  504. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  505. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  506. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  507. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  508. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  509. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
  510. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
  511. package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
  512. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
  513. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
  514. package/node_modules/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  515. package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  516. package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
  517. package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
  518. package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
  519. package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
  520. package/node_modules/pi-agent-search-text/runtime/entry-56.js +0 -1
  521. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  522. package/node_modules/pi-agent-text-editor/runtime/entry-66.js +0 -1
  523. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  524. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
  525. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
  526. package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
  527. package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
  528. package/src/backend/vision-capture-worker.py +0 -319
  529. package/src/backend/vision-capture.ts +0 -165
  530. package/src/backend/vision-registration.ts +0 -104
  531. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
  532. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  533. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
  534. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
  535. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
  536. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
  537. package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
  538. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  539. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
  540. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
  541. package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
  542. package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
  543. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  544. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +0 -1
  545. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  546. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
  547. package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
  548. package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
  549. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  550. package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
  551. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  552. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  553. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  554. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  555. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  556. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
  557. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
  558. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
  559. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
  560. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
  561. package/src/plugins/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  562. package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  563. package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
  564. package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
  565. package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
  566. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
  567. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
  568. /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
  569. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
  570. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-30.js +0 -0
  571. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  572. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  573. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-35.js +0 -0
  574. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  575. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  576. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  577. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  578. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
  579. /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-44.js +0 -0
  580. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-45.js +0 -0
  581. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-46.js +0 -0
  582. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
  583. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-52.js +0 -0
  584. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
  585. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-61.js +0 -0
  586. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  587. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  588. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  589. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-65.js +0 -0
  590. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-83.js +0 -0
  591. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-86.js +0 -0
  592. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-89.js +0 -0
  593. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  594. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  595. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  596. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  597. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  598. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  599. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  600. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  601. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  602. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  603. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  604. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  605. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  606. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
@@ -1,9 +0,0 @@
1
- import{a as nt}from"./chunk-47SPPIXK.js";import{a as ot,b as st}from"./chunk-4DIUPEDF.js";import{a as tt,b as rt}from"./chunk-VAXLSPPU.js";import{e as it}from"./chunk-I6NPILT5.js";import{a as ze,c as He}from"./chunk-TOYN4W4F.js";import{a as Ge}from"./chunk-YJ6T3PEP.js";import{b as Fe,c as Ve}from"./chunk-S72FVLUX.js";import{a as et}from"./chunk-XXLLY66B.js";import{c as Qe,d as Ye,f as Ze}from"./chunk-235QMMVA.js";import{d as Xe}from"./chunk-IICJXZBU.js";import{a as Ke}from"./chunk-BU7IZLKB.js";import{a as Be,b as Je}from"./chunk-S5PL5DFQ.js";import{J as F}from"./chunk-LCWBVOII.js";import{f as Ie,g as De,h as Ae}from"./chunk-DUUOCBS3.js";import{a as q,b as E,c as J,d as M}from"./chunk-T4FTT3U4.js";import{m as Ee}from"./chunk-ZPT5D4VP.js";import{a as Oe}from"./chunk-ZAWRSA7N.js";import{a as je,b as Te}from"./chunk-OFILFO6D.js";import{b as $e,c as We,g as Ue,j as Ne,p as qe}from"./chunk-IMGIDBCC.js";import{a as Me}from"./chunk-BXGMMZT3.js";import{a as _}from"./chunk-ZC65Z3CK.js";import{a}from"./chunk-EI7MMDWY.js";import Dr from"node:path";var V=[{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"]}]}}},b("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}}),b("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"]}}},b("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"]),b("dart-language-server",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],{dart:[".dart"]},["dart","language-server","--protocol=lsp"],"https://dart.dev/tools/dart-language-server"),b("r-language-server",["r"],["Rscript"],["DESCRIPTION",".lintr",".Rprofile"],{r:[".r"]},["Rscript","-e","languageserver::run()"],"https://github.com/REditorSupport/languageserver"),b("zls",["zig"],["zls"],["build.zig","build.zig.zon","zls.json"],{zig:[".zig",".zon"]},["zls"],"https://zigtools.org/zls/"),b("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/"),b("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"]),b("basedpyright",["python"],["basedpyright-langserver","pyright-langserver"],["pyproject.toml","pyrightconfig.json"],{python:[".py",".pyi"]},["basedpyright-langserver","--stdio"],"https://docs.basedpyright.com/",["basedpyright"]),b("gopls",["go"],["gopls"],["go.mod","go.work"],{go:[".go"]},["gopls"],"https://go.dev/gopls/"),b("rust-analyzer",["rust"],["rust-analyzer"],["Cargo.toml","rust-project.json"],{rust:[".rs"]},["rust-analyzer"],"https://rust-analyzer.github.io/"),b("csharp-ls",["csharp"],["csharp-ls"],[".sln",".csproj"],{csharp:[".cs"]},["csharp-ls"],"https://github.com/razzmatazz/csharp-language-server"),b("jdtls",["java"],["jdtls"],["pom.xml","build.gradle",".project"],{java:[".java"]},["jdtls"],"https://projects.eclipse.org/projects/eclipse.jdt.ls"),b("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"),b("solargraph",["ruby"],["solargraph"],["Gemfile",".solargraph.yml"],{ruby:[".rb",".rake"]},["solargraph","stdio"],"https://solargraph.org/"),b("intelephense",["php"],["intelephense"],["composer.json"],{php:[".php"]},["intelephense","--stdio"],"https://intelephense.com/"),b("sourcekit-lsp",["swift"],["sourcekit-lsp"],["Package.swift"],{swift:[".swift"]},["sourcekit-lsp"],"https://github.com/swiftlang/sourcekit-lsp"),b("lua-language-server",["lua"],["lua-language-server"],[".luarc.json",".luarc.jsonc"],{lua:[".lua"]},["lua-language-server"],"https://luals.github.io/"),b("bash-language-server",["shell"],["bash-language-server"],[".shellcheckrc"],{shell:[".sh",".bash"]},["bash-language-server","start"],"https://github.com/bash-lsp/bash-language-server"),b("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:{}}),b("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"),b("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"),b("taplo-lsp",["toml"],["taplo"],["taplo.toml"],{toml:[".toml"]},["taplo","lsp","stdio"],"https://taplo.tamasfe.dev/"),b("marksman",["markdown"],["marksman"],[".marksman.toml"],{markdown:[".md",".mdx"]},["marksman","server"],"https://github.com/artempyanykh/marksman"),b("terraform-ls",["terraform"],["terraform-ls"],[".terraform.lock.hcl"],{terraform:[".tf",".tfvars"]},["terraform-ls","serve"],"https://github.com/hashicorp/terraform-ls"),b("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"),b("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"),b("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"),b("neocmakelsp",["cmake"],["neocmakelsp"],["CMakeLists.txt",".neocmake.toml",".neocmakelint.toml"],{cmake:[".cmake"]},["neocmakelsp","stdio"],"https://github.com/neocmakelsp/neocmakelsp",void 0,{cmake:["CMakeLists.txt"]}),b("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"),b("lemminx",["xml"],["lemminx"],[".lemminx.json"],{xml:[".xml",".xsd",".xsl"]},["lemminx"],"https://github.com/eclipse-lemminx/lemminx"),b("sqls",["sql"],["sqls"],[".sqls.yml"],{sql:[".sql"]},["sqls"],"https://github.com/sqls-server/sqls"),b("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 b(n,e,t,r,o,s,i,l,c,p){return{id:n,name:n,kind:"lsp",languages:e,executables:t,configFiles:r,documentation:i,...l&&{dependencies:l},lsp:{command:s,rootMarkers:r,languageIds:o,...c&&{fileNames:c},...p&&{settings:p}}}}a(b,"recipe");import Jt from"node:path";import Kt from"cross-spawn";import{createMessageConnection as Xt,CancellationTokenSource as Qt,StreamMessageReader as Yt}from"vscode-jsonrpc/node";import{URI as ct}from"vscode-uri";import{watch as Nt}from"node:fs";import{readdir as qt,stat as Ft}from"node:fs/promises";import z from"node:path";import{URI as le}from"vscode-uri";var ne=class{constructor(e,t,r){this.root=e;this.changed=t;this.failed=r}static{a(this,"LspFileWatchers")}registrations=new Map;disposed=!1;async register(e,t){let r=[];try{for(let o of t){let s=o.globPattern,i=typeof s=="string"?this.root:le.parse(typeof s.baseUri=="string"?s.baseUri:s.baseUri.uri).fsPath,l=typeof s=="string"?s:s.pattern,c=a(g=>z.matchesGlob(z.isAbsolute(l)?z.join(i,g):g,l),"matches"),p=new Set((await qt(i,{recursive:!0})).filter(c));if(this.disposed)throw new Error("Language server file watchers are disposed");let d=Nt(i,{recursive:!0},(g,u)=>{!u||!c(u)||Ft(z.join(i,u)).then(()=>{if(!this.registrations.get(e)?.includes(d))return;let m=p.has(u)?2:1;p.add(u),(o.kind??7)&(m===1?1:2)&&this.changed({uri:le.file(z.join(i,u)).toString(),type:m})},m=>{if(this.registrations.get(e)?.includes(d)){if(m.code!=="ENOENT"){this.failed(m);return}p.delete(u)&&(o.kind??7)&4&&this.changed({uri:le.file(z.join(i,u)).toString(),type:3})}})});d.on("error",this.failed),r.push(d)}}catch(o){for(let s of r)s.close();throw o}this.unregister(e),this.registrations.set(e,r)}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 Vt}from"vscode-jsonrpc/node";var oe=class extends Vt{constructor(t,r){super(t);this.fail=r}static{a(this,"TransportWriter")}async write(t){try{await super.write(t)}catch(r){this.fail(r)}}};import zt from"node:path";import{URI as Ht}from"vscode-uri";function k(n,e){if(e.startsWith("ssh://")){let t=at(e);if(n.includes("://")){let o=at(n);if(o.host!==t.host)throw new Error("Document belongs to another language server owner");return o.href}let r=zt.posix.resolve(decodeURIComponent(t.pathname),n);return t.pathname=r.split("/").map(encodeURIComponent).join("/"),t.href}if(n.startsWith("ssh://")||n.includes("://")&&!n.startsWith("file://"))throw new Error("Document belongs to another language server owner");return n.startsWith("file://")?n:Ht.file(n).toString()}a(k,"documentUri");function at(n){let e=new URL(n);if(e.protocol!=="ssh:"||!e.hostname||e.username||e.password||e.port||e.search||e.hash)throw new Error("Invalid language server resource owner");return decodeURIComponent(e.pathname),e}a(at,"checkedRemote");async function A(n,e){if(e?.aborted)throw n.catch(()=>{}),e.reason;if(!e)return n;let t;try{return await Promise.race([n,new Promise((r,o)=>{t=a(()=>o(e.reason),"onAbort"),e.addEventListener("abort",t,{once:!0})})])}finally{t&&e.removeEventListener("abort",t)}}a(A,"waitWithSignal");var H=class{static{a(this,"SharedStartup")}controller=new AbortController;promise;settled=!1;waiters=0;constructor(e){this.promise=e(this.controller.signal);let t=a(()=>{this.settled=!0},"settled");this.promise.then(t,t)}async wait(e){this.waiters+=1;let t=await A(this.promise,e).then(r=>({value:r}),r=>({error:r}));if(this.waiters-=1,!this.settled&&this.waiters===0){this.controller.abort(e?.reason);try{await this.promise}catch(r){if(r!==this.controller.signal.reason)throw new AggregateError([this.controller.signal.reason,r],"Startup cancellation and cleanup failed",{cause:r})}}if("error"in t)throw t.error;return t.value}};var Gt=new Set(["uri","targetUri","target","oldUri","newUri","rootUri","documentUri","scopeUri","baseUri"]),Bt=new Set(["changes","relatedDocuments"]);function j(n,e){return Array.isArray(n)?n.map(t=>j(t,e)):typeof n!="object"||n===null?n:Object.fromEntries(Object.entries(n).map(([t,r])=>Gt.has(t)&&typeof r=="string"?[t,e(r)]:Bt.has(t)&&typeof r=="object"&&r!==null&&!Array.isArray(r)?[t,Object.fromEntries(Object.entries(r).map(([o,s])=>[e(o),j(s,e)]))]:[t,j(r,e)]))}a(j,"mapLspUris");var $=class{static{a(this,"LspClient")}_process=null;_ownedProcess=null;_ownedStartup;_ownerTransport;_connection=null;_initialized=!1;_serverCapabilities=null;_disposed=!1;_shutdownPromise;_crashed=!1;_stderr="";_fileWatchers;_fileWatcherCleanup=Promise.resolve();_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,this._ownerTransport=e.ownerTransport}get ready(){return this._initialized&&!this._disposed}get crashed(){return this._crashed}get pid(){return this._process?.pid??null}get remote(){return this._ownedProcess?.remote}get commandName(){return $e(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 hasWorkspaceSymbolCapability(){let e=this._serverCapabilities?.workspaceSymbolProvider;return e===!0||typeof e=="object"&&e!==null}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(e){e?.throwIfAborted();try{await this._start(e)}catch(t){try{await this.shutdown()}catch(r){throw new AggregateError([e?.aborted?e.reason:t,r],`[lsp] ${this.serverId}: startup and cleanup failed`,{cause:r})}throw e?.throwIfAborted(),t}}async _start(e){if(this._initialized)return;if(this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);if(!this.rootUri.startsWith("file://")&&!this._ownerTransport)throw Object.assign(new Error("No language server process transport for this resource owner"),{code:"UNSUPPORTED_SOURCE"});if(await this._closeFileWatchers(),e?.throwIfAborted(),this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);let t=_(this._command[0]),r=this._ownerTransport?decodeURIComponent(new URL(this.rootUri).pathname):ct.parse(this.rootUri).fsPath,o=[{uri:this._ownerTransport?.toServerUri(this.rootUri)??this.rootUri,name:Jt.basename(r)||r}];this._ownedStartup=this._ownerTransport?.start({rootUri:this.rootUri,command:this._command,env:this._env,signal:e});let s=await this._ownedStartup;if(this._ownedProcess=s??null,e?.throwIfAborted(),this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);let i=s?void 0:Kt(t,this._args,{stdio:["pipe","pipe","pipe"],...e&&{signal:e},cwd:r,env:qe({command:this._command,env:this._env},r,process.env)});this._process=i??null;let l=i?Zt(i):Promise.resolve(),c=_(s?.stdin??i?.stdin),p=_(s?.stdout??i?.stdout),d=_(s?.stderr??i?.stderr);c.on("error",()=>{}),p.on("error",()=>{}),d.on("error",()=>{}),this._stderr="",d.setEncoding("utf8"),d.on("data",h=>{this._stderr=(this._stderr+h).slice(-4096)}),i?.on("error",h=>{("code"in h?h.code:void 0)!=="ENOENT"&&console.error(`[lsp] ${this.serverId}: spawn failed:`,h),this._crashed=!0,this._connection?.dispose(),this._connection=null,this._process=null});let g=a(h=>{(s?this._ownedProcess!==s:this._process!==i)||(this._closeFileWatchers(),!this._disposed&&h!==0&&h!==null&&(this._crashed=!0),this._connection?.dispose(),this._connection=null,this._diagnosticPublications.clear(),this._activeDiagnosticRequests.clear(),this._diagnosticMode="unknown",this._process=null,this._initialized=!1)},"onExit");i?.on("exit",g),s?.completion.then(({exitCode:h})=>g(h),()=>{this._ownedProcess===s&&(this._crashed=!0,g(null))}),await A(l,e);let u=Xt(new Yt(p),new oe(c,h=>{this._connection!==u||this._disposed||(this._crashed=!0,this._initialized=!1,this._closeFileWatchers(),u.dispose(),console.error(`[lsp] ${this.serverId}: transport write failed:`,h))}));this._connection=u,this._connection.onError(h=>{console.error(`[lsp] ${this.serverId}: connection error:`,h)});let m=a(h=>{this._sendNotification("workspace/didChangeWatchedFiles",{changes:[h]})},"changed"),y=a(h=>console.error(`[lsp] ${this.serverId}: file watcher failed:`,h),"failed");this._fileWatchers=this._ownerTransport?this._ownerTransport.fileWatchers?.(this.rootUri,m,y):new ne(r,m,y),this._connection.onRequest("client/registerCapability",async h=>{for(let w of h.registrations)if(w.method!=="workspace/didChangeConfiguration"){if(w.method!=="workspace/didChangeWatchedFiles")throw new Error(`Unsupported dynamic capability: ${w.method}`);if(!this._fileWatchers)throw new Error("File watching is unavailable for this server owner");await this._fileWatchers.register(w.id,w.registerOptions?.watchers??[])}return null}),this._connection.onRequest("client/unregisterCapability",async h=>{for(let w of h.unregisterations)await this._fileWatchers?.unregister(w.id);return null}),this._connection.onRequest("window/workDoneProgress/create",()=>null),this._connection.onRequest("workspace/configuration",h=>h.items.map(w=>{let S=this._settings??null;for(let R of w.section?.split(".").filter(Boolean)??[])S=typeof S=="object"&&S!==null?S[R]??null:null;return S})),this._connection.listen(),this._connection.onNotification((h,...w)=>{let S=this._ownerTransport,R=S?j(w[0],v=>S.fromServerUri(v)):w[0];if(h==="textDocument/publishDiagnostics"){let v=R;v&&typeof v.uri=="string"&&Array.isArray(v.diagnostics)&&this._documentVersions.has(v.uri)&&(v.version===void 0||v.version===this.documentVersion(v.uri))&&this._diagnosticPublications.set(v.uri,{diagnostics:v.diagnostics,...typeof v.version=="number"&&{version:v.version}})}for(let v of this._handlers.get(h)??[])v(R)}),this._connection.onRequest("workspace/workspaceFolders",()=>o);let f=await A(lt(this._connection.sendRequest("initialize",{processId:this._ownerTransport?null:process.pid,rootUri:this._ownerTransport?.toServerUri(this.rootUri)??this.rootUri,workspaceFolders:o,capabilities:{workspace:{applyEdit:!1,configuration:!0,workspaceFolders:!0,didChangeWatchedFiles:{dynamicRegistration:this._fileWatchers!==void 0,relativePatternSupport:this._fileWatchers!==void 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`),e).catch(h=>{let w=this._stderr.trim();throw w?new Error(`[lsp] ${this.serverId}: ${w}`,{cause:h}):h});if(await this._connection.sendNotification("initialized",{capabilities:f.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`);e?.throwIfAborted(),this._initialized=!0,this._serverCapabilities=f.capabilities,this._diagnosticMode=f.capabilities.diagnosticProvider?"pull":"push"}touch(){}async restart(e){await this.shutdown(),this._closeFileWatchers(),this._connection?.dispose(),this._connection=null,this._process=null,this._initialized=!1,this._crashed=!1,this._disposed=!1,this._shutdownPromise=void 0,this._documentVersions.clear(),this._documentContents.clear(),this._diagnosticPublications.clear(),this._diagnosticMode="unknown",this._activeDiagnosticRequests.clear(),this._serverCapabilities=null,await this.start(e)}async sendRequest(e,t,r){this._assertReady(),r?.throwIfAborted();let o=this._ownerTransport,s=o?j(t,p=>o.toServerUri(p)):t,i=a(p=>o?j(p,d=>o.fromServerUri(d)):p,"mapResult");if(!r)return i(await _(this._connection).sendRequest(e,s));let l=new Qt,c;try{let p=_(this._connection).sendRequest(e,s,l.token);return i(await Promise.race([p,new Promise((d,g)=>{c=a(()=>{l.cancel(),g(r.reason)},"onAbort"),r.addEventListener("abort",c,{once:!0})})]))}finally{c&&r.removeEventListener("abort",c),l.dispose()}}sendNotification(e,t){this._assertReady(),this._sendNotification(e,t)}_sendNotification(e,t){let r=this._connection;if(!r)return;let o=this._ownerTransport,s=o?j(t,i=>o.toServerUri(i)):t;r.sendNotification(e,s).catch(i=>{this._connection!==r||this._disposed||(this._crashed=!0,this._initialized=!1,this._closeFileWatchers(),r.dispose(),console.error(`[lsp] ${this.serverId}: notification ${e} failed:`,i))})}onNotification(e,t){let r=this._handlers.get(e)??[];return r.push(t),this._handlers.set(e,r),()=>{let o=r.indexOf(t);o!==-1&&r.splice(o,1)}}toUri(e){return k(e,this.rootUri)}serverDocumentPath(e){let t=this.toUri(e),r=this._ownerTransport?.toServerUri(t)??t;return this._ownerTransport?decodeURIComponent(new URL(r).pathname):ct.parse(r).fsPath}openDocument(e,t,r,o=1){let s=this._documentVersions.get(e);if(s!==void 0){this.changeDocument(e,t,Math.max(o,s+1));return}this._diagnosticPublications.delete(e),this.sendNotification("textDocument/didOpen",{textDocument:{uri:e,languageId:r,version:o,text:t}}),this._documentVersions.set(e,o),this._documentContents.set(e,t)}syncDocument(e,t,r,o=!1){if(this._documentContents.get(e)===t)return;let s=this._documentVersions.get(e);s===void 0?this.openDocument(e,t,r):this.changeDocument(e,t,s+1);let i=this._serverCapabilities?.textDocumentSync,l=typeof i=="object"&&i!==null?i.save:void 0;o&&l&&this.sendNotification("textDocument/didSave",{textDocument:{uri:e},...typeof l=="object"&&l.includeText&&{text:t}})}changeDocument(e,t,r){let o=this._documentVersions.get(e),s=Math.max(r,(o??0)+1);this._diagnosticPublications.delete(e),this.sendNotification("textDocument/didChange",{textDocument:{uri:e,version:s},contentChanges:[{text:t}]}),this._documentVersions.set(e,s),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)}shutdown(){return this._shutdownPromise??=this._shutdown()}async _shutdown(){this._disposed=!0;let e=this._closeFileWatchers();if(this._connection&&this._initialized)try{await lt(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;let t=this._ownedProcess??await this._ownedStartup?.catch(()=>{});this._ownedProcess=null,this._ownedStartup=void 0;let r=Promise.resolve().then(()=>t?.stop()),o=this._process;this._process=null,o&&!o.killed&&(o.kill("SIGTERM"),setTimeout(()=>{o.exitCode===null&&o.signalCode===null&&o.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;let s=await Promise.allSettled([r,e]),i=[];for(let l of s)l.status==="rejected"&&i.push(l.reason);if(i.length>0)throw new AggregateError(i,`[lsp] ${this.serverId}: owned cleanup failed`)}dispose(){return this.shutdown()}_closeFileWatchers(){let e=this._fileWatchers;return this._fileWatchers=void 0,e&&(this._fileWatcherCleanup=this._fileWatcherCleanup.catch(()=>{}).then(()=>e.dispose()),this._fileWatcherCleanup.catch(t=>{console.error(`[lsp] ${this.serverId}: file watcher cleanup failed:`,t)})),this._fileWatcherCleanup}_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 Zt(n){return new Promise((e,t)=>{let r=a(()=>{n.off("spawn",o),n.off("error",s)},"cleanup"),o=a(()=>{r(),e()},"onSpawn"),s=a(i=>{r(),t(i)},"onError");n.once("spawn",o),n.once("error",s)})}a(Zt,"waitForSpawn");function lt(n,e,t){return new Promise((r,o)=>{let s=setTimeout(()=>{o(new Error(t))},e);n.then(i=>{clearTimeout(s),r(i)}).catch(i=>{clearTimeout(s),o(i instanceof Error?i:new Error(String(i)))})})}a(lt,"withTimeout");import{readFile as pt}from"node:fs/promises";import{URI as ut}from"vscode-uri";var K={Error:1,Warning:2,Information:3,Hint:4};var dt={command:"typescript.tsserverRequest",async request(n,e,t){return(await Promise.all(["syntacticDiagnosticsSync","semanticDiagnosticsSync","suggestionDiagnosticsSync"].map(async o=>{let s=await n.sendRequest("workspace/executeCommand",{command:"typescript.tsserverRequest",arguments:[o,{file:n.serverDocumentPath(e),includeLinePosition:!0},{isAsync:!1,expectsResult:!0}]},t);if(!de(s)||s.success!==!0||!Array.isArray(s.body))throw new Error(`Invalid completed TypeScript diagnostic report: ${o}`);return s.body.map(er)}))).flat()}};function se(n){return n.supportsCommand(dt.command)?dt:void 0}a(se,"completedDiagnosticAdapter");function er(n){if(!de(n)||typeof n.message!="string"||typeof n.code!="number"&&typeof n.code!="string"||!de(n.startLocation)||!Number.isInteger(n.startLocation.line)||!Number.isInteger(n.startLocation.offset)||Number(n.startLocation.line)<1||Number(n.startLocation.offset)<1||!["error","warning","suggestion","message"].includes(String(n.category)))throw new Error("Invalid TypeScript diagnostic entry");return{code:String(n.code),message:n.message,line:Number(n.startLocation.line),column:Number(n.startLocation.offset),severity:n.category==="error"?"error":n.category==="warning"?"warning":n.category==="suggestion"?"hint":"info"}}a(er,"convertTypeScriptDiagnostic");function de(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}a(de,"isRecord");async function X(n,e,t,r={}){let o=new AbortController,s=AbortSignal.any([o.signal,...r.signal?[r.signal]:[]]),i=setTimeout(()=>o.abort(new Error(`[lsp] ${n.serverId}: diagnostics timed out for ${e}`)),n.timeoutMs);try{return await tr(n,e,t,r.content,s)}finally{clearTimeout(i)}}a(X,"requestDiagnostics");async function tr(n,e,t,r,o){if(o.throwIfAborted(),n.diagnosticMode!=="push"){let c=n.documentVersion(e);try{let p=await n.sendRequest("textDocument/diagnostic",{textDocument:{uri:e}},o);if(p.kind!=="full"||!Array.isArray(p.items))throw new Error("Invalid full diagnostic report");if(n.documentVersion(e)!==c)throw new Error("Document changed during diagnostic request");return n.setDiagnosticMode("pull"),gt(p.items,!1,!0)}catch(p){if(!rr(p))throw p;n.setDiagnosticMode("push")}}let s=se(n);if(s){n.documentVersion(e)===void 0&&n.syncDocument(e,r??await pt(ut.parse(e).fsPath,"utf8"),t??"plaintext");let c=n.documentVersion(e),p=await s.request(n,e,o);if(o.throwIfAborted(),n.documentVersion(e)!==c)throw new Error("Document changed during diagnostic request");return{diagnostics:p,syntaxErrors:[],otherDiagnostics:p,unversioned:!1,complete:!0}}o.throwIfAborted();let i=n.documentVersion(e)!==void 0,l=i?void 0:r??await pt(ut.parse(e).fsPath,"utf8");o.throwIfAborted(),n.beginDiagnosticRequest(e);try{return await new Promise((c,p)=>{let d=n.documentVersion(e)??1,g=a(f=>{let h=f;h.uri!==e||!Array.isArray(h.diagnostics)||h.version!==void 0&&h.version!==d||n.documentVersion(e)===d&&(y(),c(gt(h.diagnostics,h.version===void 0)))},"receive"),u=n.onNotification("textDocument/publishDiagnostics",g),m=a(()=>{y(),p(o.reason)},"onAbort");function y(){u(),o.removeEventListener("abort",m)}a(y,"cleanup"),o.addEventListener("abort",m,{once:!0});try{i||n.syncDocument(e,l??"",t??"plaintext");let f=n.diagnosticPublication(e);f&&g({uri:e,...f})}catch(f){y(),p(f)}})}finally{n.endDiagnosticRequest(e)}}a(tr,"requestCurrentDiagnostics");function pe(n){return{code:String(n.code??"LSP"),message:n.message,line:n.range.start.line+1,column:n.range.start.character+1,severity:n.severity===K.Warning?"warning":n.severity===K.Information?"info":n.severity===K.Hint?"hint":"error"}}a(pe,"toDiagnostic");function gt(n,e,t=!1){let r=n.map(pe);return{diagnostics:r,syntaxErrors:[],otherDiagnostics:r,unversioned:e,complete:t}}a(gt,"classify");function rr(n){return n!==null&&typeof n=="object"&&"code"in n&&n.code===-32601}a(rr,"isMethodNotFound");var nr={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 T(n){return nr[n]??`SymbolKind(${n})`}a(T,"symbolKindName");async function Q(n,e,t){return await n.sendRequest("textDocument/documentSymbol",{textDocument:{uri:e}},t)??[]}a(Q,"requestDocumentSymbols");async function ue(n,e,t=100,r){return(await n.sendRequest("workspace/symbol",{query:e},r)??[]).slice(0,t)}a(ue,"requestWorkspaceSymbols");async function ie(n,e,t,r){return await n.sendRequest("textDocument/rename",{textDocument:{uri:e},position:t,newName:r})}a(ie,"requestRename");import Z from"node:path";import{URI as ar}from"vscode-uri";import{createHash as or}from"node:crypto";import{readdir as sr,stat as ae}from"node:fs/promises";import O from"node:path";import{URI as me}from"vscode-uri";async function ge(n,e){if(!n.supportsCommand("typescript.tsserverRequest"))return;if((await n.sendRequest("workspace/executeCommand",{command:"typescript.tsserverRequest",arguments:["projectInfo",{file:e,needFileNameList:!0},{isAsync:!1,expectsResult:!0}]}))?.success!==!0)throw new Error("TypeScript could not load the project for a workspace query.")}a(ge,"prepareProjectQuery");function mt(n,e){let t=a(r=>typeof r=="string"?r.replaceAll("{project}",()=>e):Array.isArray(r)?r.map(t):r!==null&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,s])=>[o,t(s)])):r,"expand");return Object.fromEntries(Object.entries(n).map(([r,o])=>[r,t(o)]))}a(mt,"resolveInitializationOptions");var W=class n{constructor(e,t){this._registry=e;this._owner=t}static{a(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(!n._instance)throw new Error("[lsp] LspManager not initialized");return n._instance}static getInstanceOrNull(){return n._instance}static init(e,t){let r=n._instance;return r?._disposed?(r._registry=e,r._owner=t,r._disposed=!1,r):(n._instance=new n(e,t),n._instance)}static async resetForTest(){n._instance&&(await n._instance.shutdownAll(),n._instance=null)}requireOwner(){if(!this._owner)throw Object.assign(new Error("No language server workspace owner"),{code:"UNSUPPORTED_SOURCE"});return this._owner}get workspaceRoot(){return this._registry.projectRoot}get clientCount(){return this._clients.size}onPushDiagnostics(e){return this._pushHandlers.add(e),()=>this._pushHandlers.delete(e)}async getOrStart(e,t,r,o){if(o?.throwIfAborted(),this._disposed)return null;let s=t.startsWith("ssh://"),i=s?this.requireOwner():void 0,l=i?await this._registry.resolveOwned(e,f=>i.exists(f,o)):this._registry.resolve(e);if(o?.throwIfAborted(),this._disposed)return null;let c=r==="symbols"?l[0]:l.find(f=>f.config.capabilities.includes(r));if(!c)return null;let p=s?t:me.file(t).toString(),d=`${c.serverId}:${p}`,g=this._clientStarts.get(d);if(g)return g.controller.signal.aborted?(await A(g.promise.catch(()=>{}),o),this.getOrStart(e,t,r,o)):g.wait(o);let u=this._clients.get(d);if(u?.ready)return u;let m=new H(f=>this._startClient(d,p,c,u,f));this._clientStarts.set(d,m);let y=a(()=>{this._clientStarts.get(d)===m&&this._clientStarts.delete(d)},"settled");return m.promise.then(y,y),m.wait(o)}async _startClient(e,t,r,o,s){let i=o??new $({serverId:r.serverId,rootUri:t,command:r.config.command,...t.startsWith("ssh://")&&this._owner&&{ownerTransport:this._owner.transport(t)},...r.config.env&&{env:r.config.env},...r.config.initializationOptions&&{initOptions:mt(r.config.initializationOptions,t.startsWith("ssh://")?decodeURIComponent(new URL(t).pathname):me.parse(t).fsPath)},...r.config.settings&&{settings:r.config.settings},...r.config.timeoutMs&&{timeoutMs:r.config.timeoutMs}});try{o?await o.restart(s):await i.start(s),s.throwIfAborted()}catch(l){try{await i.shutdown()}catch(c){if(c!==l)throw new AggregateError([l,c],"Language server startup and cleanup failed",{cause:c})}throw l}if(this._disposed)throw await i.shutdown(),new Error(`[lsp] ${r.serverId}: manager disposed during startup`);return this._clients.set(e,i),this._subscribeToPushDiagnostics(e,i),i}async isSourceFile(e,t,r){if(r?.throwIfAborted(),t.startsWith("ssh://")){if(this._owner===void 0)throw new Error("No language server workspace owner");return this._owner.isFile(k(e,t),r)}let o=await ae(O.resolve(t,e));return r?.throwIfAborted(),o.isFile()}async getWorkspaceClients(e,t="symbols",r=e,o=()=>!0,s){if(s?.throwIfAborted(),e.startsWith("ssh://")){let g=this._owner;if(!g)throw Object.assign(new Error("No language server workspace owner"),{code:"UNSUPPORTED_SOURCE"});let u=new Set,m=new Set(this._registry.knownExtensions),y=new Set([".git",".cache","node_modules","dist","build"]),f=a(async w=>{if(s?.throwIfAborted(),m.size!==0)for(let S of await g.entries(w,s)){s?.throwIfAborted();let R=k(S.name,`${w}/`);if(S.kind==="directory")y.has(S.name)||await f(R);else if(S.kind==="file"){let v=O.posix.extname(S.name).toLowerCase();if(!m.has(v)||!o(R))continue;let D=await this.openFile(R,e,t,s);D&&(u.add(D.client),m.delete(v))}}},"visit"),h=k(r,e);if(await g.isFile(h,s)){if(!o(h))return[];let w=await this.openFile(h,e,t,s);return w?[w.client]:[]}return await f(h),[...u]}let i=new Set,l=new Set(this._registry.knownExtensions),c=new Set([".git",".cache","node_modules","dist","build"]),p=a(async g=>{if(s?.throwIfAborted(),l.size===0)return;let u;try{u=await sr(g,{withFileTypes:!0})}catch{return}for(let m of u){if(s?.throwIfAborted(),l.size===0)return;if(m.isDirectory()){c.has(m.name)||await p(O.join(g,m.name));continue}if(!m.isFile())continue;let y=O.extname(m.name).toLowerCase();if(!l.has(y))continue;let f=O.join(g,m.name);if(!o(f))continue;let h=await this.openFile(f,e,t,s);h&&(l.delete(y),h.client.hasWorkspaceSymbolCapability&&(await ge(h.client,f),i.add(h.client)))}},"visit"),d=O.resolve(e,r);if((await ae(d)).isFile()){if(!o(d))return[];let g=await this.openFile(d,e,t,s);return g===null||!g.client.hasWorkspaceSymbolCapability?[]:(await ge(g.client,d),[g.client])}return await p(d),s?.throwIfAborted(),[...i]}async prepareWorkspaceSymbols(e,t=e,r,o){return this.getWorkspaceClients(e,"symbols",t,r,o)}hasServerFor(e){return this._registry.resolve(e).length>0}languageId(e){return this._registry.languageId(e)}isOpen(e){return this._openDocs.has(e)}syncEditedSource(e,t){for(let r of this._clients.values()){if(!r.ready)continue;let o=r.toUri(e);if(r.documentContent(o)===void 0)continue;let s=this.languageId(O.extname(decodeURIComponent(new URL(o).pathname)));r.syncDocument(o,t,s,!0)}}async readSourceSnapshot(e,t){if(t?.throwIfAborted(),e.startsWith("ssh://"))return this.requireOwner().readSnapshot(e,t);if(e.includes("://"))throw Object.assign(new Error("Unsupported rename source"),{code:"UNSUPPORTED_SOURCE"});let r=a(i=>`${i.dev}:${i.ino}:${i.mode}:${i.size}:${i.mtimeMs}:${i.ctimeMs}`,"identity"),o=r(await ae(e)),s=await this.readSourceText(e,t);if(o!==r(await ae(e)))throw new Error("A rename source changed while reading it. No edits applied.");return{content:s,version:or("sha256").update(o).update("\0").update(s).digest("hex")}}async readSourceBytes(e,t){if(t?.throwIfAborted(),e.startsWith("ssh://"))return this.requireOwner().readBytes(e,t);if(e.includes("://"))throw Object.assign(new Error("Unsupported declaration source"),{code:"UNSUPPORTED_SOURCE"});let{readFile:r}=await import("node:fs/promises");return r(e,{signal:t})}async readSourceText(e,t){if(t?.throwIfAborted(),e.startsWith("ssh://"))return this.requireOwner().readText(e,t);if(e.includes("://"))throw Object.assign(new Error("Unsupported declaration source"),{code:"UNSUPPORTED_SOURCE"});let{readFile:r}=await import("node:fs/promises");return r(e,{encoding:"utf8",signal:t})}async openFile(e,t,r="diagnostics",o){if(o?.throwIfAborted(),e.startsWith("ssh://")&&!t.startsWith("ssh://")){if(!this._registry.projectRoot.startsWith("ssh://"))throw Object.assign(new Error("Remote document has no workspace owner"),{code:"UNSUPPORTED_SOURCE"});t=this._registry.projectRoot}let s=t.startsWith("ssh://"),i=s?k(e,t):O.resolve(t,e),l=await this.getOrStart(i,t,r,o);if(!l)return null;let c=l.toUri(i),p=s?this.requireOwner():void 0,g=(p?await this._registry.resolveOwned(i,u=>p.exists(u,o)):this._registry.resolve(i))[0]?.languageId??"plaintext";if(p){let u=await p.readText(c,o);return o?.throwIfAborted(),l.syncDocument(c,u,g),this._openDocs.add(c),{client:l,uri:c,languageId:g}}try{let{readFile:u}=await import("node:fs/promises"),m=await u(i,{encoding:"utf8",signal:o});o?.throwIfAborted(),l.syncDocument(c,m,g),this._openDocs.add(c)}catch(u){if(o?.throwIfAborted(),!(u instanceof Error&&"code"in u&&u.code==="ENOENT"))throw u}return{client:l,uri:c,languageId:g}}_subscribeToPushDiagnostics(e,t){if(this._pushUnsubscribers.has(e))return;let r=t.onNotification("textDocument/publishDiagnostics",o=>{let s=ir(o);if(!s||t.hasActiveDiagnosticRequest(s.uri))return;let i=t.documentVersion(s.uri);if(s.version!==void 0&&i!==void 0&&s.version<i)return;let l=`${e}:${s.uri}`,c=s.diagnostics.map(pe),p=JSON.stringify([s.version,i,c]);if(this._pushFingerprints.get(l)===p)return;this._pushFingerprints.set(l,p);let d={cwd:t.rootUri.startsWith("ssh://")?t.rootUri:me.parse(t.rootUri).fsPath,serverId:t.serverId,uri:s.uri,diagnostics:c,...s.version!==void 0&&{version:s.version}};for(let g of this._pushHandlers)g(d)});this._pushUnsubscribers.set(e,r)}async shutdownAll(){this._disposed=!0;let e=[...this._clientStarts.values()];for(let i of e)i.controller.abort(new Error("Language server manager stopped"));let t=await Promise.allSettled(e.map(i=>i.promise)),r=[];for(let[i,l]of t.entries())l.status==="rejected"&&l.reason!==e[i]?.controller.signal.reason&&r.push(l.reason);let o=[...this._clients.values()],s=await Promise.allSettled(o.map(i=>i.shutdown()));for(let i of this._pushUnsubscribers.values())i();this._pushUnsubscribers.clear(),this._clientStarts.clear(),this._pushFingerprints.clear(),this._pushHandlers.clear(),this._clients.clear();for(let i of s)i.status==="rejected"&&r.push(i.reason);if(r.length>0)throw new AggregateError(r,"Language server cleanup failed")}dispose(){return this.shutdownAll()}};function ir(n){if(n===null||typeof n!="object")return;let e=n;if(!(typeof e.uri!="string"||!Array.isArray(e.diagnostics)))return{uri:e.uri,diagnostics:e.diagnostics,...typeof e.version=="number"&&{version:e.version}}}a(ir,"parsePushNotification");async function fe(n,e,t){if(t?.throwIfAborted(),!n.supportsCommand("typescript.tsserverRequest"))return;let r=await n.sendRequest("workspace/executeCommand",{command:"typescript.tsserverRequest",arguments:["projectInfo",{file:n.serverDocumentPath(e),needFileNameList:!0},{isAsync:!1,expectsResult:!0}]},t);if(t?.throwIfAborted(),r?.success!==!0)throw new Error("TypeScript could not load the project for the workspace query.")}a(fe,"loadQueryProject");async function Y(n,e,t,r){return await fe(n,e,r),await n.sendRequest("textDocument/references",{textDocument:{uri:e},position:t,context:{includeDeclaration:!0}},r)??[]}a(Y,"requestReferences");async function he(n,e,t,r){let o=await n.sendRequest("textDocument/prepareCallHierarchy",{textDocument:{uri:e},position:t},r),s=o?.[0];if(!s)return{items:[],incoming:[],outgoing:[]};let[i,l]=await Promise.all([n.sendRequest("callHierarchy/incomingCalls",{item:s},r),n.sendRequest("callHierarchy/outgoingCalls",{item:s},r)]);return{items:o,incoming:i??[],outgoing:l??[]}}a(he,"requestCallHierarchy");function G(n,e,t){let r=e.startsWith("ssh://"),o=r?Z.posix:Z,s=a(d=>r?decodeURIComponent(new URL(k(d,e)).pathname):d,"native"),i=r?s(t.path??e):Z.resolve(e,t.path??"."),l=o.relative(i,s(n));if(l===".."||l.startsWith(`..${o.sep}`)||o.isAbsolute(l))return!1;let c=o.relative(s(e),s(n)).split(o.sep).join("/"),p=a(d=>d.split(",").some(g=>{let u=g.trim();return u.length>0&&o.matchesGlob(u.includes("/")?c:o.basename(s(n)),u)}),"matches");return(t.include===void 0||p(t.include))&&(t.exclude===void 0||!p(t.exclude))}a(G,"withinScope");function ye(n,e){let t=k(n,e);if(t.startsWith("ssh://"))return t;let r=ar.parse(t);if(r.scheme!=="file")throw new Error("Unsupported LSP source location.");return Z.resolve(r.fsPath)}a(ye,"sourceOf");function cr(n,e){return n.start.line===e.start.line&&n.start.character===e.start.character&&n.end.line===e.end.line&&n.end.character===e.end.character}a(cr,"sameRange");function ft(n,e,t){return n.flatMap(r=>[...r.name===e&&r.range!==void 0&&cr(r.range,t)&&r.selectionRange!==void 0?[r.selectionRange]:[],...ft(r.children??[],e,t)])}a(ft,"declarationNames");async function we(n,e,t,r,o={},s=W.getInstance()){r?.throwIfAborted();let i=o.resultScope;if(i!==void 0&&(await F(i,r),i.targets.length===0))return{hits:[],complete:i.complete};if(i===void 0&&o.path!==void 0&&!G(e.startsWith("ssh://")?k(o.path,e):Z.resolve(e,o.path),e,o)&&await s.isSourceFile(o.path,e,r))return{hits:[],complete:!0};let l=i?.targets.map(y=>y.source)??[o.path??e],c=new Set((await Promise.all(l.map(y=>s.prepareWorkspaceSymbols(e,y,f=>G(f,e,o),r)))).flat());if(c.size===0)throw new Error("LSP symbol search is unavailable: no provider supports workspace/symbol in this scope.");let p=new Map,d=a(async y=>{r?.throwIfAborted();let f=ye(y.uri,e),h=p.get(f);if(h===void 0){let{content:L,version:N}=await s.readSourceSnapshot(f,r);h={document:Ee(f,L),version:N},p.set(f,h)}let{document:w}=h,{start:S,end:R}=y.range,v=[S,R];for(let L of v){let N=w.lines[L.line];if(!Number.isInteger(L.line)||!Number.isInteger(L.character)||N===void 0||L.character<0||L.character>N.content.length)throw new Error("LSP range does not match its source snapshot.")}let D=_(w.lines[S.line]),re=a(L=>w.lines.slice(0,L).reduce((N,xe)=>N+xe.content.length+xe.lineEnding.length,0),"offset"),U=re(S.line)+S.character,C=re(R.line)+R.character;if(C<U)throw new Error("LSP returned a reversed source range.");return{source:f,lineNumber:S.line+1,endLineNumber:R.line+1,startColumn:S.character,endColumn:R.character,matchedText:w.content.slice(U,C),lineText:D.content}},"toMatch"),g=a(y=>G(y.source,e,o)&&(i===void 0||st(i,y)),"included"),u=[],m=new Set;for(let y of c){r?.throwIfAborted();let f=await ue(y,n,Number.MAX_SAFE_INTEGER,r);for(let h of f){if(r?.throwIfAborted(),!G(ye(h.location.uri,e),e,{}))continue;let w=await d(h.location),S=await s.openFile(w.source,e,"symbols",r);if(S===null)throw new Error("LSP references are unavailable for a discovered declaration.");let R=h.location;if(w.matchedText!==h.name){let C=await Q(S.client,S.uri,r),L=ft(C,h.name,h.location.range);if(L.length!==1)throw new Error("LSP declaration has no unique provider selectionRange; cannot search its references.");R={uri:S.uri,range:_(L[0])}}let v=await d(R),D={id:JSON.stringify([y.serverId,v.source,h.location.range]),name:h.name,kind:String(h.kind),source:v.source,range:{startLine:v.lineNumber,startColumn:v.startColumn,endLine:v.endLineNumber??v.lineNumber,endColumn:v.endColumn}},re=await Y(S.client,S.uri,R.range.start,r);r?.throwIfAborted();let U=[{...v,role:"definition",symbol:D}];for(let C of re){if(!G(ye(C.uri,e),e,{}))continue;let L=await d(C);L.source===v.source&&L.lineNumber===v.lineNumber&&L.startColumn===v.startColumn&&L.endLineNumber===v.endLineNumber&&L.endColumn===v.endColumn||U.push({...L,role:"reference",symbol:D})}if(!(o.navigation==="references"&&!U.some(g)))for(let C of U){if(o.navigation!=="references"&&!g(C)||o.navigation==="references"&&!G(C.source,e,{}))continue;let L=JSON.stringify([D.id,C.source,C.lineNumber,C.startColumn,C.endLineNumber,C.endColumn]);m.has(L)||(m.add(L),u.push(C))}}}r?.throwIfAborted();for(let[y,f]of p){let h=await s.readSourceSnapshot(y,r);if(h.version!==f.version||h.content!==f.document.content)throw new Error("LSP source changed during search.")}return i!==void 0&&await F(i,r),u.sort((y,f)=>y.source.localeCompare(f.source)||y.lineNumber-f.lineNumber||y.startColumn-f.startColumn||y.endColumn-f.endColumn||y.symbol.id.localeCompare(f.symbol.id)),{hits:u.slice(0,t),complete:(i?.complete??!0)&&u.length<=t}}a(we,"searchSymbols");import{readFile as lr}from"node:fs/promises";import ve from"node:path";import{fileURLToPath as dr}from"node:url";var pr={failureLabel:"SYMBOL_READ_FAILED",emptyReason:"no symbol source was produced."},be=10,Se=5,B=10;async function yt(n,e,t,r,o){x(o);let s=await n.readSourceText(e,o),i=await te(n,e,r,o),l=ee(i.symbols,t,i.displayPath),c=await n.readSourceText(i.filePath,o);if(x(o),s!==c)throw new Error("The symbol source changed during resolution. Read it again before editing.");return{source:i.filePath,range:l.range,content:c}}a(yt,"resolveLspDeclaration");async function wt(n,e,t,r,o){x(o);let s=await n.readSourceText(e,o),i=await te(n,e,r,o),l=ee(i.symbols,t,i.displayPath);if(s!==await n.readSourceText(e,o))throw new Error("The rename source changed during resolution.");return x(o),{client:i.client,uri:i.uri,position:l.selectionRange.start,content:s}}a(wt,"resolveLspRenameTarget");async function Pe(n,e,t,r,o){x(o);let s=await te(n,e,r,o),i=ee(s.symbols,t,s.displayPath),l=await yr(s.filePath,n,o);x(o);let c=i.range.start.line+1,p=Math.min(i.range.end.line+1,l.lines.length),d=l.lines.slice(Math.max(0,c-1),Math.max(0,p)).map((u,m)=>{let y=c+m;return Ie({content:u,sourceLine:{source:s.filePath,lineNumber:y,content:u}})}),g={path:s.displayPath,heading:`symbol: ${M(i.selector)}`,details:[`defined in: ${s.displayPath}:${c}-${p} (${T(i.kind)})`],startLine:c,endLine:p,totalLines:l.lines.length,renderedLines:d};return De([g],pr)}a(Pe,"readLspSymbolBody");async function _e(n,e,t,r,o){x(o);let s=await te(n,e,r,o),i=ee(s.symbols,t,s.displayPath),l=await Lt(s,i,o),c=new ce(r);return await ur(s,i,l,c)}a(_e,"readLspSymbolGraph");async function Ce(n,e,t,r){x(r);let o=await te(n,e,t,r),s=new ce(t),i=[`## file graph: ${o.displayPath}`,`Top-level declarations: ${o.symbols.length}`];for(let l of o.symbols){x(r);let c=await Lt(o,l,r);i.push("",...await hr(o,l,c,s))}return i.join(`
2
- `)}a(Ce,"readLspFileGraph");function ee(n,e,t){if(e.length===0)throw new TypeError("A symbol selector must contain at least one segment.");if(e.length===1){let s=St(n,_(e[0]));if(s.length===1)return _(s[0]);throw s.length>1?new Error(`Symbol selector "${M(e)}" is ambiguous in ${t}; use parent/child.`):ht(e,t)}let r=n,o;for(let s of e){let i=r.filter(l=>l.name===s);if(i.length===0)throw ht(e,t);if(i.length>1)throw new Error(`Symbol selector "${M(e)}" is ambiguous at "${s}" in ${t}.`);o=_(i[0]),r=o.children}return _(o)}a(ee,"resolveLspCodeSymbol");async function te(n,e,t,r){let o=E(e,t),s=await n.openFile(o,t,"symbols",r);if(!s)throw new Error(`No LSP server with symbol support is configured for ${Re(o,t)}.`);let i=await Q(s.client,s.uri,r),l=vt(i).sort(bt);return{client:s.client,uri:s.uri,filePath:o,displayPath:Re(o,t),symbols:l}}a(te,"openCodeDocument");function vt(n,e=[]){return n.flatMap(t=>{let r=t.selectionRange??t.range;if(!r)return[];let o=t.range??r,s=[...e,t.name];return[{name:t.name,kind:t.kind,range:o,selectionRange:r,selector:s,children:vt(t.children??[],s).sort(bt)}]})}a(vt,"normalizeDocumentSymbols");function bt(n,e){return n.range.start.line-e.range.start.line||n.range.start.character-e.range.start.character||n.name.localeCompare(e.name)}a(bt,"compareSymbols");function St(n,e){return n.flatMap(t=>[...t.name===e?[t]:[],...St(t.children,e)])}a(St,"collectNamedSymbols");function ht(n,e){return new Error(`Symbol "${M(n)}" was not found in ${e}.`)}a(ht,"symbolNotFound");async function Lt(n,e,t){let r=e.selectionRange.start,[o,s]=await Promise.all([Y(n.client,n.uri,r,t),he(n.client,n.uri,r,t)]);return x(t),{references:o,calls:s}}a(Lt,"queryRelations");async function ur(n,e,t,r){let o=M(e.selector),s=await r.line(n.uri,e.selectionRange.start.line+1);return[`## graph: ${o}`,`Definition: ${n.displayPath} ${s} (${T(e.kind)})`,`Source: ${J("graph",n.displayPath,e.selector)}`,"",...await gr(t.references,r),"",...await mr(t.calls.incoming,r),"",...await fr(t.calls.outgoing,r)].join(`
3
- `)}a(ur,"formatSymbolGraph");async function gr(n,e){let t=Rt(n),r=[`References: ${n.length} in ${t.length} file(s)`];for(let[o,s]of t.slice(0,be)){r.push(`- ${e.display(o)} (${s.length})`);for(let i of s.slice(0,Se))r.push(` - ${await e.line(o,i.range.start.line+1)}`);s.length>Se&&r.push(` - ... ${s.length-Se} more`)}return t.length>be&&r.push(`- ... ${t.length-be} more file(s)`),r}a(gr,"formatReferences");async function mr(n,e){let t=[`Incoming calls: ${n.length}`];for(let r of n.slice(0,B)){let o=r.fromRanges[0]?.start.line??r.from.selectionRange.start.line,s=await e.line(r.from.uri,o+1);t.push(`- ${T(r.from.kind)} ${r.from.name} \u2014 ${e.display(r.from.uri)} ${s}`)}return n.length>B&&t.push(`- ... ${n.length-B} more`),t}a(mr,"formatIncomingCalls");async function fr(n,e){let t=[`Outgoing calls: ${n.length}`];for(let r of n.slice(0,B)){let o=await e.line(r.to.uri,r.to.selectionRange.start.line+1);t.push(`- ${T(r.to.kind)} ${r.to.name} \u2014 ${e.display(r.to.uri)} ${o}`)}return n.length>B&&t.push(`- ... ${n.length-B} more`),t}a(fr,"formatOutgoingCalls");async function hr(n,e,t,r){let o=T(e.kind),s=await r.line(n.uri,e.selectionRange.start.line+1),i=Rt(t.references).map(([d,g])=>`${r.display(d)} (${g.length})`),l=t.calls.incoming.map(d=>`${d.from.name} (${r.display(d.from.uri)})`),c=t.calls.outgoing.map(d=>`${d.to.name} (${r.display(d.to.uri)})`),p=[`### ${o} ${e.name}`,`Selector: ${M(e.selector)}`,`Definition: ${s}`,`Used by: ${Le(i)}`,`Incoming calls: ${Le(l)}`,`Outgoing calls: ${Le(c)}`];if(e.children.length>0){p.push("Members:");for(let d of e.children){let g=J("graph",n.displayPath,d.selector);p.push(`- ${T(d.kind)} ${d.name} \u2014 ${g}`)}}return p}a(hr,"formatFileGraphSymbol");function Le(n,e=5){if(n.length===0)return"none";let t=n.slice(0,e).join(", ");return n.length>e?`${t}, ... ${n.length-e} more`:t}a(Le,"summarize");function Rt(n){let e=new Map;for(let t of n){let r=e.get(t.uri)??[];r.push(t),e.set(t.uri,r)}return[...e].map(([t,r])=>[t,r.sort((o,s)=>o.range.start.line-s.range.start.line||o.range.start.character-s.range.start.character)]).sort(([t],[r])=>t.localeCompare(r))}a(Rt,"groupLocationsByUri");async function yr(n,e,t){let r=n.startsWith("ssh://")?Buffer.from(await e.readSourceBytes(n,t)):await lr(n,{signal:t});if(r.byteLength>256*1024)throw new Error(`File exceeds the 262144-byte code-view limit: ${n}`);if(r.includes(0))throw new Error(`File appears to be binary and cannot be read as text: ${n}`);let o=r.toString("utf8").replaceAll(`\r
4
- `,`
5
- `),s=o.endsWith(`
6
- `)?o.slice(0,-1):o,i=s.length===0?[]:s.split(`
7
- `);return{content:o,lines:i}}a(yr,"readTextFile");var ce=class{static{a(this,"LocationPresenter")}#e;constructor(e){this.#e=e}display(e){return Re(wr(e),this.#e)}line(e,t){return Promise.resolve(String(t))}};function wr(n){if(!n.startsWith("file://"))return n;try{return dr(n)}catch{return decodeURIComponent(n.slice(7))}}a(wr,"filePathFromUri");function Re(n,e){if(n.startsWith("ssh://"))return n;let t=ve.relative(e,n);return t.length===0||t.startsWith("..")||ve.isAbsolute(t)?n:t.replaceAll(ve.sep,"/")}a(Re,"displayFilePath");function x(n){if(n?.aborted===!0)throw vr(n)}a(x,"throwIfAborted");function vr(n,e){if(n.reason instanceof Error)return n.reason;if(e instanceof Error)return e;let t=new Error("The operation was aborted");return t.name="AbortError",t}a(vr,"abortReason");function ke(n){let e=null;return{kind:"compiler",name:"lsp",priority:100,extensions:["*"],detect:a(()=>Promise.resolve(!0),"detect"),async compile({filePath:t},r){r.signal?.throwIfAborted();let o=await n(r.cwd,t,r.signal);r.signal?.throwIfAborted();let s=await br(t,r,o);if(!s)throw new Error("No diagnostic language server for this source");let{client:i,diagnostics:l,syntaxErrors:c,otherDiagnostics:p}=s;return e=i,{ok:!l.some(d=>d.severity==="error"),diagnostics:l,syntaxErrors:c,otherDiagnostics:p}},async restart(){e&&(await e.restart(),e=null)}}}a(ke,"createLspCompiler");async function br(n,e,t){let r=await t.openFile(n,e.cwd,"diagnostics",e.signal);if(e.signal?.throwIfAborted(),!r)return null;let o=await X(r.client,r.uri,r.languageId,{signal:e.signal});if(e.signal?.throwIfAborted(),!o.complete)throw new Error("Language server diagnostics are a snapshot, not a completed report");return{client:r.client,...o}}a(br,"openAndDiagnose");import P from"node:path";import{existsSync as Sr}from"node:fs";function Pt(n){let e=new Map,t=new Map;for(let[r,o]of Object.entries(n))for(let[s,i]of Object.entries(o.languages))for(let l of i.extensions){let c=l.toLowerCase(),p=e.get(c);if(p!==void 0&&p!==s)throw new Error(`[lsp] extension conflict: "${c}" claimed by "${p}" and "${s}"`);e.set(c,s);let d=t.get(c)??[];d.push(r),t.set(c,d)}return{extToLanguageId:e,extToServerIds:t}}a(Pt,"buildLanguageLookup");var I=class n{constructor(e,t,r){this._projectRoot=r;this._entries=e;let o=e.filter(s=>s.layer!=="built-in"||t.has(s.id));this._servers=Object.fromEntries(o.map(s=>[s.id,s.config])),this._lookup=Pt(this._servers)}static{a(this,"LspServerRegistry")}_servers;_entries;_lookup;static async fromPackageDir(e,t={}){t.signal?.throwIfAborted();let r=await Ue(e,"lsp-servers",c=>Lr(c).servers,t);if(t.signal?.throwIfAborted(),e.startsWith("ssh://")&&(!t.executableAvailable&&!t.executableAvailability||t.requireBuiltInEvidence&&!t.recipeEvidence))throw Object.assign(new Error("Remote language server availability needs its workspace owner"),{code:"UNSUPPORTED_SOURCE"});let o=t.environment??process.env,s=r.entries.filter(c=>c.layer==="built-in"),i=[];if(t.executableAvailability){let c=await t.executableAvailability(s.map(p=>p.config));if(c.length!==s.length||c.some(p=>typeof p!="boolean"))throw new TypeError("Invalid owner executable availability report");for(let[p,d]of s.entries())i.push({id:d.id,available:c[p]===!0})}else if(t.executableAvailable)for(let c of s)i.push({id:c.id,available:await t.executableAvailable(c.config)});else i.push(...await Promise.all(s.map(async c=>({id:c.id,available:await Ne(c.config,e,o,t.signal)}))));t.signal?.throwIfAborted();let l=t.requireBuiltInEvidence?t.recipeEvidence?await t.recipeEvidence(t.recipes??[]):await Me(e,t.recipes??[],void 0,t.signal):void 0;return t.signal?.throwIfAborted(),new n(r.entries,new Set(i.filter(c=>c.available&&(l===void 0||(l.get(c.id)?.score??0)>0)).map(c=>c.id)),e.startsWith("ssh://")?e:P.resolve(e))}static fromConfig(e,t=process.cwd()){return new n(Object.entries(e.servers).map(([r,o])=>({id:r,config:o,layer:"project",sourcePath:"<memory>"})),new Set,t.startsWith("ssh://")?t:P.resolve(t))}resolve(e){return this.candidates(e).filter(t=>!t.config.requireRootMarker||this.hasRootMarker(e,t.config.rootMarkers))}candidates(e){let t=P.basename(e),r=P.extname(e)||(e.startsWith(".")?e:`.${e}`),o=a(i=>process.platform==="win32"?i.toLowerCase():i,"normalizeName"),s=[];for(let i of this._entries)if(this._servers[i.id]){for(let[l,c]of Object.entries(i.config.languages))if(c.extensions.some(p=>p.toLowerCase()===r.toLowerCase())||c.fileNames?.some(p=>o(p)===o(t))){s.push({serverId:i.id,config:i.config,languageId:l,layer:i.layer,sourcePath:i.sourcePath});break}}return s}async resolveOwned(e,t){if(!this._projectRoot.startsWith("ssh://"))return this.resolve(e);let r=new URL(this._projectRoot),o=decodeURIComponent(r.pathname),s=e.startsWith(".")&&!e.includes("/"),i=e.includes("://")?new URL(e):new URL(r.href),l=e.includes("://")?decodeURIComponent(i.pathname):P.posix.resolve(o,e),c=P.posix.relative(o,l);if(i.origin!==r.origin||i.host!==r.host||i.protocol!==r.protocol||i.username||i.password||i.port||i.search||i.hash||c===".."||c.startsWith("../"))throw Object.assign(new Error("Language server resource belongs to another owner"),{code:"UNSUPPORTED_SOURCE"});let p=[];for(let d of this.candidates(s?e:l)){if(!d.config.requireRootMarker){p.push(d);continue}let g=s||l===o?o:P.posix.dirname(l);for(;;){let u=!1;for(let m of d.config.rootMarkers){let y=P.posix.resolve(g,m),f=P.posix.relative(o,y);if(f===".."||f.startsWith("../"))continue;let h=new URL(r.href);if(h.pathname=y.split("/").map(encodeURIComponent).join("/"),await t(h.href)){u=!0;break}}if(u){p.push(d);break}if(g===o)break;g=P.posix.dirname(g)}}return p}hasRootMarker(e,t){let r=P.dirname(P.resolve(this._projectRoot,e));for(e.startsWith(".")&&!e.includes(P.sep)&&(r=this._projectRoot);;){let o=P.relative(this._projectRoot,r);if(o===".."||o.startsWith(`..${P.sep}`)||P.isAbsolute(o))return!1;if(t.some(s=>Sr(P.join(r,s))))return!0;if(r===this._projectRoot)return!1;r=P.dirname(r)}}get projectRoot(){return this._projectRoot}get servers(){return this._servers}get entries(){return this._entries}get knownExtensions(){return new Set(this._lookup.extToLanguageId.keys())}languageId(e){let t=e.startsWith("ssh://")?decodeURIComponent(new URL(e).pathname):e;return(this._projectRoot.startsWith("ssh://")?this.candidates(t):this.resolve(t))[0]?.languageId??e.slice(1)}};function Lr(n){if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("LSP config must be an object");let e=n;if(e.version!==1)throw new Error("LSP config version must be 1");if(typeof e.servers!="object"||e.servers===null||Array.isArray(e.servers))throw new Error("LSP config servers must be an object");for(let[t,r]of Object.entries(e.servers)){if(typeof r!="object"||r===null||Array.isArray(r))throw new Error(`LSP server ${t} must be an object`);let o=r;if(!Array.isArray(o.command)||o.command.length===0||o.command.some(s=>typeof s!="string"||s.length===0))throw new Error(`LSP server ${t}.command must be a non-empty string array`);if(o.transport!==void 0&&o.transport!=="stdio")throw new Error(`LSP server ${t} only supports stdio transport`);if(!Array.isArray(o.rootMarkers)||o.rootMarkers.some(s=>typeof s!="string"))throw new Error(`LSP server ${t}.rootMarkers must be a string array`);if(o.requireRootMarker!==void 0&&typeof o.requireRootMarker!="boolean")throw new TypeError(`LSP server ${t}.requireRootMarker must be a boolean`);if(o.requireRootMarker&&o.rootMarkers.length===0)throw new Error(`LSP server ${t}.requireRootMarker requires rootMarkers`);if(typeof o.languages!="object"||o.languages===null||Array.isArray(o.languages))throw new Error(`LSP server ${t}.languages must be an object`);for(let[s,i]of Object.entries(o.languages)){let l=typeof i=="object"&&i!==null&&!Array.isArray(i)?i.extensions:void 0;if(!Array.isArray(l)||l.length===0||l.some(p=>typeof p!="string"))throw new Error(`LSP server ${t} language ${s} requires extensions`);let c=i.fileNames;if(c!==void 0&&(!Array.isArray(c)||c.some(p=>typeof p!="string"||p.length===0||/[/\\]/u.test(p))))throw new Error(`LSP server ${t} language ${s}.fileNames must contain basenames`)}if(!Array.isArray(o.capabilities))throw new TypeError(`LSP server ${t}.capabilities must be an array`)}return n}a(Lr,"parseLspConfig");function _t(n){return kt("symbol","lsp-symbol",n,async e=>await Pe(e.manager,e.filePath,_(e.selector),e.cwd,e.signal))}a(_t,"createLspSymbolResolver");function Ct(n){return kt("graph","lsp-graph",n,async e=>e.selector===void 0?await Ce(e.manager,e.filePath,e.cwd,e.signal):await _e(e.manager,e.filePath,e.selector,e.cwd,e.signal))}a(Ct,"createLspGraphResolver");function kt(n,e,t,r){return{id:e,tryResolve(o,s){return Promise.resolve(Rr(o,s,n,t,r))}}}a(kt,"createCodeViewResolver");function Rr(n,e,t,r,o){let s;try{s=q(n,t)}catch(c){return{kind:"failed",error:c}}if(s===void 0)return{kind:"not-handled"};let i;try{i=E(s.path,e.cwd)}catch(c){return{kind:"failed",error:c}}return{kind:"resolved",resource:{source:J(t,i,s.selector),async read(c){let p=await r(e.cwd,i,c.signal),d=await o({manager:p,filePath:i,cwd:e.cwd,...Pr(s.selector),..._r(c.signal)});return[typeof d=="string"?{type:"text",text:d}:d]}}}}a(Rr,"resolveCodeViewSource");function Pr(n){return n===void 0?{}:{selector:n}}a(Pr,"optionalSelector");function _r(n){return n===void 0?{}:{signal:n}}a(_r,"optionalSignal");function Et(n,e=(t,r)=>Promise.resolve({cwd:r,external:!1})){return{id:"lsp",async diagnose(t,r){let o=await e(t,r.cwd,r.signal);if(o===void 0)return{status:"unavailable",diagnostics:[],reason:"No local language-server project found for this file"};let s=await n(o.cwd,o.external,r.signal);r.signal.throwIfAborted();let i=await s.getOrStart(t,o.cwd,"diagnostics",r.signal);if(r.signal.throwIfAborted(),!i)return{status:"unavailable",diagnostics:[],reason:"No language server configured for this file"};let l=i.toUri(t),c=s.languageId(t);i.syncDocument(l,r.content,c,!0);let p=i.documentVersion(l),d={active:!0,queued:!1},g=a(()=>!r.signal.aborted&&i.documentVersion(l)===p,"current"),u=a(()=>X(i,l,c,{signal:r.signal,content:r.content}),"request"),m=a(async()=>{if(d.queued=!0,!d.active){d.active=!0;try{for(;d.queued&&g();){d.queued=!1;let f=await u();g()&&r.publish(xt(f,i.commandName))}}catch(f){g()&&r.publish({status:"unavailable",diagnostics:[],reason:f instanceof Error?f.message:String(f),source:i.commandName})}finally{d.active=!1}}},"refresh"),y=s.onPushDiagnostics(f=>{!g()||f.uri!==l||f.serverId!==i.serverId||f.cwd!==o.cwd||f.version!==void 0&&f.version!==p||(i.diagnosticMode==="pull"||se(i)?m():r.publish({status:"snapshot",diagnostics:f.diagnostics,source:i.commandName,reason:It(f.version===void 0)}))});r.signal.addEventListener("abort",y,{once:!0});try{let f=await u();return p=i.documentVersion(l),xt(f,i.commandName)}catch(f){throw d.queued=!1,y(),r.signal.removeEventListener("abort",y),f}finally{d.active=!1,d.queued&&g()&&queueMicrotask(()=>{m()})}}}}a(Et,"createLspDiagnosticSource");function It(n){return`Latest push snapshot; completion is unknown${n?"; language server omitted the document version":""}`}a(It,"snapshotReason");function xt(n,e){return n.complete?{status:"ready",diagnostics:n.diagnostics,source:e}:{status:"snapshot",diagnostics:n.diagnostics,reason:It(n.unversioned),source:e}}a(xt,"toReport");import{URI as Cr}from"vscode-uri";var Dt={protocol:Fe,apiVersion:Ve,id:"lsp",setup(n){for(let e of V)n.addToolRecipe(e);n.addSetupCheck({id:"effective-config",inspect:kr}),n.addCheck({id:"config",title:"LSP",async run(e){try{let t=await I.fromPackageDir(e.cwd,At(e)),r=xr(t,e.files);return r.length===0?[{status:"skip",message:"No language server matches the inspected project files"}]:await Promise.all(r.map(async o=>{let s=`${o.serverId} [${o.layer}] command ${JSON.stringify(o.config.command)}`,i=e.workspace,l=new $({serverId:o.serverId,rootUri:i?e.cwd:Cr.file(e.cwd).toString(),...i&&{ownerTransport:{start:a(c=>i.start(c.command,c.env,c.signal),"start"),toServerUri:a(c=>i.toNativeUri(c),"toServerUri"),fromServerUri:a(c=>i.fromNativeUri(c),"fromServerUri")}},command:o.config.command,env:Er(e.env,o.config.env),...o.config.initializationOptions&&{initOptions:o.config.initializationOptions},...o.config.settings&&{settings:o.config.settings},...o.config.timeoutMs&&{timeoutMs:o.config.timeoutMs}});try{return await l.start(e.signal),{status:"pass",message:`${s}: initialized`,detail:o.sourcePath}}catch(c){return{status:"fail",message:`${s}: ${c instanceof Error?c.message:String(c)}`,detail:o.sourcePath}}finally{await l.shutdown()}}))}catch(t){return e.signal?.throwIfAborted(),[{status:"fail",message:t instanceof Error?t.message:String(t)}]}}})}};async function kr(n){try{let e=await I.fromPackageDir(n.cwd,At(n)),t=[],r=new Map;for(let[o,s]of n.detectedLanguages){let i=s.flatMap(l=>e.resolve(l)).find(l=>l.languageId===o);i!==void 0&&(t.push({kind:"lsp",languageId:o,toolId:i.serverId}),await He(n,i.config)||r.set(i.serverId,{id:`lsp-${i.serverId}-unavailable`,message:`Configured language server ${i.serverId} cannot run ${JSON.stringify(i.config.command)}`}))}return{selections:t,actions:[...r.values()]}}catch(e){return n.signal?.throwIfAborted(),{actions:[{id:"lsp-config-invalid",message:`Language server configuration cannot load: ${e instanceof Error?e.message:String(e)}`}]}}}a(kr,"inspectLspSetup");function At(n){let e=n.workspace;return{...ze(n),recipeEvidence:e?t=>e.evidence(t,n.signal):void 0}}a(At,"lspOptions");function xr(n,e){let t=new Map;for(let r of e){let o=n.resolve(r)[0];o!==void 0&&!t.has(o.serverId)&&t.set(o.serverId,o)}return[...t.values()]}a(xr,"applicableServers");function Er(n,e){return Object.fromEntries(Object.entries({...n,...e}).filter(t=>t[1]!==void 0))}a(Er,"definedEnvironment");import jt from"node:path";function Tt(n,e){return{id:"symbols",supportsResultScope:!0,readResources:a(t=>t.query.startsWith("symbols:")?void 0:[],"readResources"),toScriptData(t){return t.data},async tryResolve(t,r){if(!t.query.startsWith("symbols:"))return{kind:"not-handled"};let o=t.query.slice(8).trim();if(o.length===0)return{kind:"failed",error:new Error("symbols: query must not be empty")};let s=r.scope,i=new Map;if(s!==void 0){await F(s,r.signal);for(let u of s.targets){let m=await n(r.cwd,u.source,r.signal),y=i.get(m)??[];y.push(u),i.set(m,y)}}else i.set(await n(r.cwd,t.path,r.signal),[]);let l=t.limit??100,c=a(async u=>{let m=[],y=s?.complete??!0;for(let[f,h]of i){let w=await we(o,f.workspaceRoot,l,u,{...t,...s===void 0?{}:{resultScope:{targets:h,complete:s.complete}}},f);m.push(...w.hits),y=y&&w.complete}return s!==void 0&&await F(s,u),{hits:m.slice(0,l),complete:y&&m.length<=l}},"collect"),p=await c(r.signal),d=await e({request:t,matches:p.hits,complete:p.complete,refresh:a(async u=>{let m=await c(u);return{matches:m.hits,complete:m.complete}},"refresh")},r),g=it(p.hits,p.complete,d.id,d);return{kind:"resolved",payload:{query:o,sessionId:d.id,hits:p.hits,complete:p.complete,navigation:t.navigation,data:{...g,matches:g.matches.map((u,m)=>({...u,role:p.hits[m]?.role,symbol:p.hits[m]?.symbol}))}}}},renderResult(t,r,o){let s=t.details;return ot(s.hits,s.complete,o,r.expanded,s.cwd,s.navigation==="references"?["LSP reference navigation \xB7 may leave input scope"]:[],s.hits.map(i=>`${i.role} ${i.symbol.name}`))},format(t,r){let o=t,s=o.navigation==="references"?"LSP reference navigation (may leave input scope)":"LSP symbols inside scope",i=o.hits.length===0?["No symbols found."]:o.hits.slice(0,100).map((l,c)=>`SEARCH#${o.sessionId}:${c+1}:match ${l.source.startsWith("ssh://")?l.source:jt.relative(r.cwd,l.source)}:${l.lineNumber}:${l.startColumn+1} ${l.role} ${l.symbol.name} \xB7 declared at ${l.symbol.source.startsWith("ssh://")?l.symbol.source:jt.relative(r.cwd,l.symbol.source)}:${l.symbol.range.startLine}:${l.symbol.range.startColumn+1}`);return o.complete&&o.hits.length&&i.unshift(`SEARCH#${o.sessionId}:all:match selects all exact symbol matches.`),o.hits.length>100&&i.push("Preview shortened; full source targets retained."),{content:[{type:"text",text:[s,...i].join(`
8
- `)}],details:{...o,cwd:r.cwd}}}}}a(Tt,"createLspSearchResolver");function Ot(n){return{id:"lsp-declaration-target",async tryResolve(e,t){let r=q(e,"symbol");if(r===void 0||e.endsWith("#name"))return{kind:"not-handled"};if(r.selector===void 0)return{kind:"rejected",rejection:{code:"invalid",reason:"Use symbol:<file>#<selector> to choose one declaration"}};try{let o=await yt(await n(t.cwd,E(r.path,t.cwd),t.signal),E(r.path,t.cwd),r.selector,t.cwd,t.signal);return{kind:"resolved",targets:[{source:o.source,expectedContent:o.content,ranges:[{start:{lineNumber:o.range.start.line+1,column:o.range.start.character},end:{lineNumber:o.range.end.line+1,column:o.range.end.character}}]}]}}catch(o){return{kind:"failed",error:new Error(`${o instanceof Error?o.message:String(o)} Read the physical file and use explicit text anchors if declaration resolution is unavailable.`,{cause:o})}}}}}a(Ot,"createDeclarationTargets");import{fileURLToPath as Ir}from"node:url";function Mt(n,e){if(n===null)throw new Error("The language server did not provide rename edits. No text fallback was applied.");let t=new Map(Object.entries(n.changes??{}));for(let r of n.documentChanges??[]){if(!("textDocument"in r)||!("edits"in r))throw new Error("Rename returned an unsupported file operation. No edits applied.");if(r.textDocument.version!=null&&r.textDocument.version!==e.documentVersion(r.textDocument.uri))throw new Error("Rename refers to an unavailable document revision. No edits applied.");if(t.has(r.textDocument.uri))throw new Error("Rename returned duplicate document edits.");t.set(r.textDocument.uri,r.edits)}return t}a(Mt,"renameEntries");function $t(n,e){let t=n.split(`
9
- `),r=t[e.line];if(!Number.isInteger(e.line)||e.line<0||r===void 0||!Number.isInteger(e.character)||e.character<0||e.character>r.replace(/\r$/u,"").length)throw new Error("The language server returned an invalid text position.");return t.slice(0,e.line).reduce((o,s)=>o+s.length+1,0)+e.character}a($t,"offset");async function Wt(n,e){let t=n.input;if(typeof t.path!="string"||!t.path.startsWith("symbol:")||!t.path.endsWith("#name"))return;if(typeof t.text!="string"||t.text.trim()===""||t.start!==void 0||t.end!==void 0)throw new Error("Rename needs a symbol #name path and a non-empty new name in text, without start/end.");let r=q(t.path.slice(0,-5),"symbol");if(r?.selector===void 0)throw new Error("Rename needs an exact symbol selector before #name.");let o=E(r.path,n.cwd),s=await e(n.cwd,o,n.signal),i=await wt(s,o,r.selector,n.cwd,n.signal);await fe(i.client,i.uri,n.signal);let l=Mt(await ie(i.client,i.uri,i.position,t.text),i.client),c=new Map;for(let g of new Set([i.uri,...l.keys()])){n.signal?.throwIfAborted();let u=k(g,i.client.rootUri);if(u!==g)throw new Error("Rename returned a non-canonical participant. No edits applied.");let m=u.startsWith("ssh://")?u:Ir(u),y=await s.readSourceSnapshot(m,n.signal);if(m===o&&y.content!==i.content)throw new Error("The rename source changed. Read the symbol again before retrying.");let f=await s.openFile(m,n.cwd,"symbols",n.signal);if(f?.client!==i.client||f.uri!==g)throw new Error("A rename participant has a different language server owner. No edits applied.");if(i.client.documentContent(g)!==y.content)throw new Error("A rename participant changed during synchronization. No edits applied.");c.set(g,{file:m,...y})}let p=Mt(await ie(i.client,i.uri,i.position,t.text),i.client);n.signal?.throwIfAborted();for(let[g,u]of c){n.signal?.throwIfAborted();let m=await s.readSourceSnapshot(u.file,n.signal);if(u.version!==m.version||i.client.documentContent(g)!==u.content)throw new Error("A rename participant changed during the server request. No edits applied.")}let d=[];for(let[g,u]of p){let m=c.get(g);if(!m)throw new Error("Rename discovered a new participant after preflight. No edits applied.");d.push({source:m.file,expectedContent:m.content,changes:u.map(y=>({from:$t(m.content,y.range.start),to:$t(m.content,y.range.end),insert:y.newText}))})}return{...n,editPlan:{files:d},metadata:{...n.metadata,semanticEdit:{mode:"lsp-rename",server:i.client.serverId,referencesUpdated:!0},diffStatuses:[{text:"Renamed through LSP",tone:"success"}]}}}a(Wt,"prepareSymbolRename");var Ut=Xe({kind:"code-view",label:"LSP"});async function Ar(n){await jr(n)}a(Ar,"registerLsp");async function jr(n,e){let t=new Map,r=!1,o=a(async(d,g=!1,u)=>{if(u?.throwIfAborted(),r)throw new Error("LSP session has ended");let m=JSON.stringify([d,g]),y=t.get(m);if(y?.controller.signal.aborted)return await A(y.promise.catch(()=>{}),u),t.get(m)===y&&t.delete(m),o(d,g,u);if(!y){y=new H(async h=>{let w=e?await e.loadRegistry(d,g,h):await Tr(d,g,h);if(h.throwIfAborted(),r)throw new Error("LSP session has ended");return W.init(w,e?.workspace(d))});let f=y;t.set(m,f),f.promise.catch(()=>{t.get(m)===f&&t.delete(m)})}return y.wait(u)},"managerFor"),s=a(async(d,g,u)=>{if(u?.throwIfAborted(),e)return e.resolveProject(d,g,u);let m=await We(g,d,"lsp-servers",V,u);return u?.throwIfAborted(),m===void 0?void 0:{cwd:m,external:m!==Dr.resolve(g)}},"resolveLspProject"),i=a(async(d,g,u)=>{if(u?.throwIfAborted(),!g)return o(d,!1,u);let m=await s(g,d,u);if(u?.throwIfAborted(),!m)throw new Error("No language server project for this source");return o(m.cwd,m.external,u)},"managerForFile"),l={...ke(i),name:"pi-agent-ide-lsp",priority:200},c={protocol:je,apiVersion:5,id:"lsp",setup(d){d.addTool(l),d.addDiagnosticSource(Et(o,s))}};n.on("session_shutdown",async()=>{r=!0,await Promise.allSettled([...t.values()].map(async d=>{d.settled||d.controller.abort(new Error("LSP session has ended")),await(await d.promise).shutdownAll()})),t.clear()});let p={protocol:Be,apiVersion:Je,id:"lsp",setup(d){d.addResolver({resolver:_t(i),renderResult:Ut}),d.addResolver({resolver:Ct(i),renderResult:Ut}),d.addHandler({stage:"read",when:{resolvedBy:"any",contentKind:"text"},handler:Ae()}),d.describe({path:"symbol:<file>#<selector> \u2014 declaration source, e.g. symbol:src/catalog.ts#Catalog/find. graph:<file> \u2014 top-level declarations, references and calls; members include selectors. graph:<file>#<selector> \u2014 references and incoming/outgoing calls for that declaration or member."})}};await Promise.all([Oe(n,c),et(n,{protocol:Qe,apiVersion:Ye,id:"lsp-declarations",setup(d){d.onDidEdit(async g=>{await Promise.all([...t.values()].filter(u=>u.settled).map(u=>u.promise.then(m=>m.syncEditedSource(g.source,g.after.content),()=>{})))}),d.addAnchorResolver({kind:Ze,type:"auxiliary",resolver:{id:"lsp-declaration",description:"symbol:<file>#<selector> selects an exact declaration for text fallback editing; imports and references are not rewritten.",renderFull:a(g=>g,"renderFull"),renderCompact:a(g=>g,"renderCompact"),tryResolve:a(()=>Promise.resolve({kind:"not-handled"}),"tryResolve")},resources:Ot(i),describeInPrompt:!1});for(let g of["copy","move","delete","replace"])d.tool(g).describe("Use symbol:<file>#<selector> as path to select one exact declaration without start/end. Use parent/child for ambiguous names. For declaration-text Copy/Move, supply an explicit target and destination anchor. This text fallback leaves imports and references unchanged; it is not semantic rename."+(g==="replace"?" Use symbol:<file>#<selector>#name with text containing the new name for native LSP rename across references. Omit start/end. A failed server rename never falls back to identifier text replacement.":"")),d.tool(g).addHandler({stage:"text-pre-edit",async handler(u){if(g==="replace"){let f=await Wt(u,i);if(f!==void 0)return f}let m=u.input;if(![m.path,m.start,m.end,m.target,m.targetStart,m.targetEnd].some(f=>typeof f=="string"&&f.startsWith("symbol:")))return u;if((g==="copy"||g==="move")&&typeof m.target!="string")throw new Error("Copying or moving a symbol requires an explicit target file and destination anchor.");return{...u,metadata:{...u.metadata,semanticEdit:{mode:"declaration-text",referencesUpdated:!1,importsUpdated:!1},diffStatuses:[{text:"Text fallback: imports and references unchanged",tone:"warning"}]}}}});d.tool("insert").describe("Symbol targets are unsupported for insert. Read the declaration and select an ordinary text line anchor instead."),d.tool("insert").addHandler({stage:"text-pre-edit",handler(g){let u=g.input;if([u.path,u.anchor].some(m=>typeof m=="string"&&m.startsWith("symbol:")))throw new Error("Semantic insert is not supported. Read the declaration and use an explicit text line anchor instead.");return g}})}}),Ke(n,p),Ge(n,Dt),nt(n,{protocol:tt,apiVersion:rt,id:"symbols",setup(d){d.addResolver({resolver:Tt(i,d.registerSelection)}),d.describe('Use `symbols:<query>` to locate named workspace declarations and references through configured language servers when the file is unknown. Results contain exact source targets, roles, and originating symbols. Default search stays within path. Use navigation: "references" explicitly to follow symbols represented inside path to references outside it, within the workspace.')}})])}a(jr,"registerLspWithOwner");async function Tr(n,e,t){let r=e?n:process.env.PI_AGENT_IDE_CONFIG_DIR??n;return I.fromPackageDir(r,{signal:t,includeGlobal:!e,requireBuiltInEvidence:e,recipes:V})}a(Tr,"loadRegistry");export{V as a,I as b,Ar as c,jr as d};
@@ -1 +0,0 @@
1
- import{f as T,i as m,j as M}from"./chunk-LCWBVOII.js";import{a as p}from"./chunk-EI7MMDWY.js";import{Type as o}from"typebox";var E=o.Union([o.Literal("pending"),o.Literal("applied"),o.Literal("not-applied"),o.Literal("unknown")]),b=o.Object({source:o.String(),effect:E,state:o.Optional(o.Union([o.Literal("present"),o.Literal("absent"),o.Literal("unknown")]))},{additionalProperties:!1}),L={effect:E,files:o.Array(b)};function R(n){return o.Object({operation:o.Literal(n),...L,operationId:o.Optional(o.String()),...n==="delete"?{}:{target:o.Optional(o.String()),targetUnavailable:o.Optional(o.String())}},{additionalProperties:!1})}p(R,"mutationDataSchema");function v(n){return T(R(n))}p(v,"mutationResultSchema");function u(n){return typeof n=="object"&&n!==null}p(u,"record");function U(n,c,h=[]){let r=n.details,l=u(r)?r:{};if((u(r)&&u(r.nativeEditBatch)?r.nativeEditBatch:void 0)?.state==="accepted")return{status:"success",errors:[],data:{operation:c,effect:"pending",...c!=="delete"&&typeof r.metadata?.resultTarget=="string"?{target:r.metadata.resultTarget}:{},files:typeof l.source=="string"?[{source:l.source,effect:"pending"}]:[]}};let g=new Set(h.map(t=>t.resourceSource)),s=[],f=[],y=r.results;for(let t of y??[]){let e=t.data,k=[...new Set([...(e.files??[]).map(i=>i.path),...e.path?[e.path]:[],...e.rollback?.failedSources??[],...e.rollback?.restoredSources??[]])];for(let i of k)f.push({source:i,...g.has(i)?{state:"present"}:{},effect:g.has(i)||e.ok===!0&&e.files?.some(A=>A.path===i)?"applied":e.rollback?.failedSources.includes(i)?"unknown":e.rollback?.restoredSources.includes(i)?"not-applied":r.effect??"unknown"});for(let i of e.errors??[])s.push({code:i.code??"MUTATION_FAILED",message:i.reason??"Mutation failed",source:i.path});e.ok===!1&&(e.errors?.length??0)===0&&s.push({code:"MUTATION_FAILED",message:"Mutation failed",...e.path?{source:e.path}:{}})}for(let t of g)f.some(e=>e.source===t)||f.push({source:t,effect:"applied",state:"present"});let a=u(r.metadata)&&u(r.metadata.semanticAction)?r.metadata.semanticAction:void 0;if(a){let t=a.effect==="not-applied"||a.effect==="unknown"?a.effect:a.ok===!1?"unknown":"applied",e=typeof a.source=="string"?a.source:void 0;e&&f.push({source:e,...a.kind==="file-operation"&&a.ok===!0?{state:c==="delete"||c==="move"?"absent":"present"}:{},effect:c==="copy"&&typeof a.target=="string"&&a.target!==e?"not-applied":t}),typeof a.target=="string"&&f.push({source:a.target,effect:t,...a.kind==="file-operation"&&a.ok===!0?{state:"present"}:{}}),u(a.error)&&s.push(m(a.error.message,typeof a.error.code=="string"?a.error.code:"MUTATION_FAILED",e)),typeof a.postProcessingError=="string"&&s.push(m(a.postProcessingError,"POST_EDIT_FAILED",e)),a.ok===!1&&s.length===0&&s.push(m("Resource operation failed","MUTATION_FAILED",e))}let d=[...new Map(f.map(t=>[t.source,t])).values()];if(Array.isArray(r.metadata?.resultFileStates))for(let t of r.metadata.resultFileStates){if(!u(t))continue;let e=d.find(k=>k.source===t.source);e&&(t.state==="present"||t.state==="absent")&&(e.state=t.state)}let S=d.some(t=>t.effect==="applied");n.isError&&s.length===0&&s.push({code:"MUTATION_FAILED",message:"Mutation failed"}),(y?.length??0)===0&&!a&&g.size===0&&s.length===0&&r.effect!=="not-applied"&&s.push({code:"UNKNOWN_RESULT",message:"Mutation effects were not reported"});let w=r.effect==="unknown"||d.some(t=>t.effect==="unknown")||s.some(t=>t.code==="UNKNOWN_RESULT")?"unknown":S?"applied":"not-applied";return{status:s.length===0?"success":!a&&S&&d.some(t=>t.effect!=="applied")?"partial":"error",data:{operation:c,effect:w,files:d,...c!=="delete"&&typeof r.metadata?.resultTarget=="string"?{target:r.metadata.resultTarget}:{},...c!=="delete"&&typeof r.metadata?.targetUnavailable=="string"?{targetUnavailable:r.metadata.targetUnavailable}:{}},errors:s}}p(U,"mutationOutcome");function F(n,c,h=[],r){let l=U(n,c,h);return l.data&&r!==void 0&&(l.data.operationId=r),M(n,R(c),l)}p(F,"structuredMutation");export{R as a,v as b,U as c,F as d};
@@ -1 +0,0 @@
1
- import{b as n}from"./chunk-6R3Y4AD3.js";import"./chunk-6XFUICD7.js";import{a as o,b as t,c as i}from"./chunk-RIJMXO43.js";import"./chunk-VMTOFEXF.js";import"./chunk-CPELC6JE.js";import"./chunk-PJL3UVMJ.js";import{b as s}from"./chunk-HSRH76JN.js";import"./chunk-VDP5CQHM.js";import"./chunk-47SPPIXK.js";import"./chunk-4DIUPEDF.js";import"./chunk-VAXLSPPU.js";import"./chunk-I6NPILT5.js";import{c as r}from"./chunk-W7CASEO3.js";import"./chunk-YJ6T3PEP.js";import"./chunk-S72FVLUX.js";import"./chunk-NNCZYO4Q.js";import"./chunk-IICJXZBU.js";import"./chunk-PS2B6THP.js";import"./chunk-BU7IZLKB.js";import"./chunk-S5PL5DFQ.js";import"./chunk-LCWBVOII.js";import"./chunk-ZPT5D4VP.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import{a as e}from"./chunk-EI7MMDWY.js";async function g(a){let m=new i(await t(o(r())));await s(a,f=>n(f,m))}e(g,"registerOwnedWeb");export{g as default};
@@ -1,9 +0,0 @@
1
- import{a as le,b as fe,c as ue}from"./chunk-RIJMXO43.js";import{a as de}from"./chunk-CPELC6JE.js";import{a as N,g as l}from"./chunk-PJL3UVMJ.js";import{a as se}from"./chunk-47SPPIXK.js";import{a as ie,b as ae}from"./chunk-VAXLSPPU.js";import{c as ce}from"./chunk-W7CASEO3.js";import{e as q,f as Z}from"./chunk-T7I2VX3J.js";import{a as ne}from"./chunk-XXLLY66B.js";import{b as te,c as re,d as oe}from"./chunk-235QMMVA.js";import"./chunk-NNCZYO4Q.js";import{d as ee}from"./chunk-IICJXZBU.js";import"./chunk-PS2B6THP.js";import{a as G}from"./chunk-BU7IZLKB.js";import{a as H,b as V}from"./chunk-S5PL5DFQ.js";import{F as z}from"./chunk-LCWBVOII.js";import{r as J}from"./chunk-ZPT5D4VP.js";import{a as X}from"./chunk-ZAWRSA7N.js";import{a as x,b as Q}from"./chunk-OFILFO6D.js";import"./chunk-ZC65Z3CK.js";import{a as s}from"./chunk-EI7MMDWY.js";import pe from"node:path";import{StringDecoder as Oe}from"node:string_decoder";function he(r){return(i,a)=>{let n=r.resolve(i.path??".",a.cwd);if(n===void 0)return;let{backend:c,location:w}=n,e=s((t,o=w.source)=>{let m=r.resolve(t,o);if(m===void 0||m.backend!==c)throw new l("UNSUPPORTED_SOURCE",t,"not-applied");return m.location},"own");return{resolve:s((t,o)=>e(o,t.includes("://")?t:w.source).source,"resolve"),dirname:s(t=>N(w.target,pe.posix.dirname(e(t).path)).source,"dirname"),basename:s(t=>pe.posix.basename(e(t).path),"basename"),isDirectory:s(async(t,o)=>(await c.stat(e(t).path,{signal:o})).kind==="directory","isDirectory"),byteSize:s(async(t,o)=>(await c.stat(e(t).path,{signal:o})).size,"byteSize"),readText:s(async(t,o)=>(await c.read(e(t).path,{signal:o})).bytes.toString("utf8"),"readText"),async execute(t,o,m,R){let d=await c.execute(t,o,e(m).path,{signal:R});return{code:d.exitCode,stdout:d.stdout.toString("utf8"),stderr:d.stderr.toString("utf8")}},async runLines(t,o,m,R){let d=await c.startProcess("rg",t,e(o).path,{signal:R}),g=new Oe("utf8"),u=[],p=0,f="",h,y=s(k=>{let E=k.split(`
2
- `);for(let[O,b]of E.entries()){if(u.push(b),p+=Buffer.byteLength(b),p>32*1024*1024)throw new l("CONTENT_LIMIT",w.source,"not-applied");O<E.length-1&&(m(u.join("")),u.length=0,p=0)}},"consume"),v=(async()=>{try{for await(let k of d.stdout)y(g.write(k));y(g.end()),p>0&&m(u.join(""))}catch(k){h=k,await d.stop()}})(),T=(async()=>{for await(let k of d.stderr)f+=k.toString("utf8"),f.length>65536&&(f=f.slice(-65536))})();try{try{await d.end()}catch(E){if(!(E instanceof l)||E.code!=="INPUT_CLOSED")throw E}let k=await d.completion;if(await Promise.all([v,T]),h!==void 0)throw h instanceof Error?h:new Error("Search output failed.",{cause:h});return R?.throwIfAborted(),{code:k.exitCode,stderr:f}}finally{await d.stop(),await Promise.allSettled([v,T])}}}}}s(he,"createSshSearchEnvironmentProvider");import{lstat as Ue,mkdir as ke,rm as Me,symlink as He,unlink as Ve,open as Ge}from"node:fs/promises";import A from"node:path";import{constants as $}from"node:fs";import{createHash as Pe,randomBytes as Te}from"node:crypto";import{constants as we}from"node:fs";import{lstat as Ie,mkdir as Ne,open as me,readFile as Ce,rename as _e,rm as Ae,unlink as Fe}from"node:fs/promises";import D from"node:path";import{fileURLToPath as Le}from"node:url";function C(r,i,a){if(a?.has(r)&&a.get(r)!==i)throw new l("CONFLICT",r,"not-applied")}s(C,"checkCapturedRevision");var Be=1024*1024,De=Ce(new URL("./ssh-transfer-worker.py",new URL("../src/backend/file-transfer.ts",import.meta.url).href),"utf8");function j(r,i){if(r.startsWith("file:"))try{return Le(r)}catch{throw new l("UNSUPPORTED_SOURCE",r,"not-applied")}if(/^[a-z][a-z\d+.-]*:/iu.test(r)&&!/^[a-z]:[\\/]/iu.test(r))throw new l("UNSUPPORTED_SOURCE",r,"not-applied");if(i.startsWith("ssh://"))throw new l("UNSUPPORTED_SOURCE",r,"not-applied");return D.resolve(i,r)}s(j,"localTransferSource");function F(r){return[r.dev,r.ino,r.mode,r.uid,r.gid,r.size,r.mtimeNs,r.ctimeNs].join(":")}s(F,"localRevision");async function U(r){let i=await Ie(r,{bigint:!0});if(!i.isFile()||i.isSymbolicLink())throw new l("INVALID_FILE_TYPE",r,"not-applied");if(i.size>BigInt(Number.MAX_SAFE_INTEGER))throw new l("CONTENT_LIMIT",r,"not-applied");return i}s(U,"localEntry");function ye(r){return r!==null&&typeof r=="object"&&"code"in r&&r.code==="ENOENT"}s(ye,"missing");function ge(r){return r!==null&&typeof r=="object"&&"code"in r&&typeof r.code=="string"&&/^[A-Z][A-Z0-9_]*$/u.test(r.code)?r.code:"TRANSFER_FAILED"}s(ge,"errorCode");async function je(r,i,a,n){a.signal?.throwIfAborted();let c=r.resolve(i.path,a.cwd),w=r.resolve(i.target??"",a.cwd),e=c?.location.source??j(i.path,a.cwd),t=w?.location.source??j(i.target??"",a.cwd);if(e===t)throw new l("SAME_FILE",e,"not-applied");let o=c?await c.backend.lstat(c.location.path,a):await U(e);if("kind"in o&&o.kind!=="file")throw new l("INVALID_FILE_TYPE",e,"not-applied");let m=Number(o.size),R=Number(o.mode),d="revision"in o?o.revision:F(o);C(e,d,n);let g;try{g=w?await w.backend.lstat(w.location.path,a):await U(t)}catch(p){if(!ye(p))throw p}if(g!==void 0){if("kind"in g&&g.kind!=="file")throw new l("INVALID_FILE_TYPE",t,"not-applied");if(C(t,"revision"in g?g.revision:F(g),n),c&&w&&c.backend.target.host===w.backend.target.host&&c.backend.target.configFile===w.backend.target.configFile&&"identity"in o&&"identity"in g&&o.identity.device===g.identity.device&&o.identity.inode===g.identity.inode)throw new l("SAME_FILE",e,"not-applied")}let u=g===void 0?null:"revision"in g?g.revision:F(g);return g===void 0&&C(t,null,n),{source:e,target:t,remoteSource:c,remoteTarget:w,size:m,mode:R,sourceRevision:d,targetRevision:u}}s(je,"prepareTransfer");async function Y(r,i,a,n,c,w){let{source:e,target:t,remoteSource:o,remoteTarget:m,size:R,mode:d,sourceRevision:g,targetRevision:u}=await je(r,a,n,c);await w?.();let p=o?void 0:await me(e,we.O_RDONLY|we.O_NOFOLLOW),f,h,y,v=!1,T="",k=s(async()=>{let E=o?await o.backend.lstat(o.location.path,n):await U(e);if(("revision"in E?E.revision:F(E))!==g)throw new l("CONFLICT",e,"not-applied")},"verifySource");try{if(p&&F(await p.stat({bigint:!0}))!==g)throw new l("CONFLICT",e,"not-applied");m?(y=await de(m.backend.target,"python3",["-c",await De,JSON.stringify({destination:m.location.path,size:R,mode:d,expected:u})],"/",n),y.completion.catch(()=>{}),y.stdout.on("data",b=>{T.length<=8192&&(T+=b.toString("utf8")),T.length>8192&&y?.stop().catch(()=>{})}),y.stderr.resume()):(await Ne(D.dirname(t),{recursive:!0}),f=D.join(D.dirname(t),`.pi-ide-transfer-${Te(12).toString("hex")}`),h=await me(f,"wx",d&4095));let E=Pe("sha256");for(let b=0;b<R;){n.signal?.throwIfAborted();let S=Math.min(Be,R-b),I;if(o){let P=await o.backend.readRange(o.location.path,b,S,n);if(P.revision!==g||P.offset!==b||P.totalBytes!==R)throw new l("CONFLICT",e,"not-applied");I=P.bytes}else{if(p===void 0)throw new Error("Missing source descriptor");let P=Buffer.allocUnsafe(S),{bytesRead:B}=await p.read(P,0,S,b);I=P.subarray(0,B)}if(I.length===0)throw new l("CONFLICT",e,"not-applied");if(E.update(I),y)await y.write(I);else{if(h===void 0)throw new Error("Missing destination descriptor");for(let P=0;P<I.length;){let B=await h.write(I,P,I.length-P);if(B.bytesWritten===0)throw new l("TRANSFER_FAILED",t,"not-applied");P+=B.bytesWritten}}b+=I.length}await k(),await w?.();let O=E.digest("hex");if(n.signal?.throwIfAborted(),y){if(await y.write(Buffer.from(`${JSON.stringify({sha256:O})}
3
- `)),await y.end(),(await y.completion).exitCode!==0||T.length>8192)throw new l("TRANSFER_FAILED",t,"unknown");let S;try{S=JSON.parse(T)}catch{throw new l("INVALID_REPLY",t,"unknown")}if(S===null||typeof S!="object"||!("ok"in S))throw new l("INVALID_REPLY",t,"unknown");if(S.ok!==!0){let I="effect"in S&&(S.effect==="not-applied"||S.effect==="applied")?S.effect:"unknown";throw new l(ge(S),t,I)}if(!("sha256"in S)||S.sha256!==O)throw new l("CHECKSUM_MISMATCH",t,"unknown");v=!0}else{if(h===void 0||f===void 0)throw new Error("Missing staged destination");await h.chmod(d&4095),await h.sync(),await h.close(),h=void 0;let b=null;try{b=F(await U(t))}catch(S){if(!ye(S))throw S}if(b!==u)throw new l("CONFLICT",t,"not-applied");n.signal?.throwIfAborted(),await _e(f,t),f=void 0,v=!0}return i==="move"&&(await k(),o?await o.backend.removeEntry(o.location.path,g,n):await Fe(e)),{source:e,target:t}}catch(E){throw v?new l(ge(E),e,"unknown"):E}finally{await p?.close(),await h?.close(),f!==void 0&&await Ae(f,{force:!0}),y&&await y.stop().catch(()=>{})}}s(Y,"transferFile");function Re(r,i,a){let n=r.resolve(i,a.cwd);if(n===void 0){let e=j(i,a.cwd);return{path:e,source:e,cwd:a.cwd,files:te}}let c=r.resolve(a.cwd,a.cwd),w=c?.location.target===n.location.target?c.location.path:n.backend.target.workspace;return{remote:n,source:n.location.source,path:n.location.path,cwd:w,files:{owner:JSON.stringify([n.backend.target.host,n.backend.target.configFile??null]),realpath:s(e=>n.backend.realpath(e,a),"realpath"),inspect:s(e=>n.backend.lstat(e,a),"inspect"),read:s(async e=>(await n.backend.read(e,a)).bytes.toString("utf8"),"read"),git:s((e,t,o)=>n.backend.queryGit(e,t,{...a,signal:o}),"git"),source:s(e=>N(n.location.target,e).source,"source"),snapshot:s((e,t)=>n.backend.objectSnapshot(e,{...a,signal:t}),"snapshot")}}}s(Re,"endpoint");function L(r,i,a){let n=r.remote?A.posix:A;if(n.sep==="\\"&&a.split("/").some(c=>c.includes("\\")||c.includes(":")))throw new l("INVALID_TARGET",r.source,"not-applied");return n.join(i,...a.split("/"))}s(L,"leaf");function K(r,i){return r.remote?N(r.remote.location.target,i).source:i}s(K,"receiptPath");async function _(r,i,a){let n;try{n=await r.files.inspect(i)}catch(c){if(c!==null&&typeof c=="object"&&"code"in c&&c.code==="ENOENT"){if(a===void 0)return}else throw c}if(a===void 0||n?.revision!==a.revision)throw new l("TRANSFER_TARGET_CHANGED",K(r,i),"not-applied")}s(_,"checkEntry");async function M(r){let i;try{i=await Ue(r)}catch(a){if(a===null||typeof a!="object"||!("code"in a)||a.code!=="ENOENT")throw a;await M(A.dirname(r)),await ke(r);return}if(!i.isDirectory()||i.isSymbolicLink())throw new l("INVALID_FILE_TYPE",r,"not-applied");A.dirname(r)!==r&&await M(A.dirname(r))}s(M,"directoryParents");async function ve(r,i,a,n){r.remote?await r.remote.backend.removeObject(i,a.revision,n):(await _(r,i,a),a.kind==="directory"?await Me(i,{recursive:!0,force:!1}):await Ve(i))}s(ve,"remove");async function Ee(r,i,a,n,c,w){let e=Re(r,a.path,n),t=Re(r,a.target??"",n),o=await c.prepareTransfer(i,e,t),m=o.source.entries[0];if(m===void 0)throw new l("ENOENT",e.source,"not-applied");e.remote&&C(e.source,m.revision,w),t.remote&&C(t.source,o.target.entries[0]?.revision??null,w);let R=!1;try{n.signal?.throwIfAborted();for(let d of o.source.entries)L(e,o.source.path,d.relativePath),L(t,o.target.path,d.relativePath);if(o.sourceKind==="file")e.remote&&t.remote&&e.remote.location.target===t.remote.location.target?await e.remote.backend[i](o.source.path,o.target.path,m.revision,o.target.entries[0]?.revision??null,n):await Y(r,i,a,n,w,async()=>{await _(e,o.source.path,m),await _(t,o.target.path,o.target.entries[0])});else{if(i==="move"&&e.remote&&t.remote&&e.files.owner===t.files.owner&&await e.remote.backend.moveObject(o.source,o.target,n))return{kind:"file-operation",operation:i,ok:!0,effect:"applied",path:e.source,target:t.source,sourceKind:o.sourceKind};let d=new Map(o.target.entries.map(u=>[u.relativePath,u])),g=new Map;i==="move"&&o.target.entries[0]&&(R=!0,await ve(t,o.target.path,o.target.entries[0],n),d.clear());for(let u of o.source.entries){n.signal?.throwIfAborted();let p=L(e,o.source.path,u.relativePath),f=L(t,o.target.path,u.relativePath);await _(e,p,u);let h=d.get(u.relativePath);if(await _(t,f,h),u.kind==="directory")h===void 0&&(R=!0),t.remote?await t.remote.backend.ensureObjectDirectory(f,u.mode|448,h?.revision??null,n):h===void 0&&(await M(A.dirname(f)),await ke(f,{mode:u.mode|448})),h===void 0&&g.set(u.relativePath,(await t.files.inspect(f)).identity);else if(u.kind==="symlink"){if(R=!0,u.link===void 0)throw new l("INVALID_RESPONSE",e.source,"unknown");t.remote?await t.remote.backend.createObjectLink(f,u.link,n):(await M(A.dirname(f)),await He(Buffer.from(u.link,"base64"),f))}else{R=!0;let y=K(e,p),v=K(t,f);e.remote&&t.remote&&e.files.owner===t.files.owner?await e.remote.backend.copy(p,f,u.revision,h?.revision??null,n):await Y(r,"copy",{path:y,target:v},n,void 0,async()=>{await _(e,p,u),await _(t,f,h)})}}for(let u of[...o.source.entries].reverse()){if(u.kind!=="directory"||d.has(u.relativePath))continue;let p=L(t,o.target.path,u.relativePath),f=await t.files.inspect(p),h=g.get(u.relativePath);if(f.kind!=="directory"||h?.device!==f.identity.device||h.inode!==f.identity.inode)throw new l("TRANSFER_TARGET_CHANGED",t.source,"unknown");if(t.remote)await t.remote.backend.setObjectMode(p,u.mode,f.revision,n);else{let y=await Ge(p,$.O_RDONLY|$.O_DIRECTORY|$.O_NOFOLLOW);try{let v=await y.stat();if(String(v.dev)!==h.device||String(v.ino)!==h.inode)throw new l("TRANSFER_TARGET_CHANGED",t.source,"unknown");await y.chmod(u.mode&4095)}finally{await y.close()}}}await o.verifySource(),i==="move"&&await ve(e,o.source.path,m,n)}return{kind:"file-operation",operation:i,ok:!0,effect:"applied",path:e.source,target:t.source,sourceKind:o.sourceKind}}catch(d){throw R?Object.assign(d instanceof Error?d:new Error(String(d)),{effect:"unknown"}):d}}s(Ee,"transferObject");function Se(r,i){return async(a,n,c,w)=>{let e=r.resolve(n.path,c.cwd);if(e===void 0&&(n.target===void 0||r.resolve(n.target,c.cwd)===void 0))return;if(a!=="delete"){if(w===void 0)throw new l("TRANSFER_POLICY_REQUIRED",n.path,"not-applied");return Ee(r,a,n,c,w,i)}if(e===void 0)return;let t=await e.backend.lstat(e.location.path,c);C(e.location.source,t.revision,i);{if(w===void 0)throw new l("DELETE_POLICY_REQUIRED",e.location.source,"not-applied");let o=r.resolve(c.cwd,c.cwd);if(o!==void 0&&o.location.target!==e.location.target)throw new l("UNSUPPORTED_SOURCE",e.location.source,"not-applied");let m=o?.location.path??e.backend.target.workspace,R=await w.prepare(e.location.path,m,{temporaryEnvironment:s(d=>e.backend.temporaryEnvironment({...c,signal:d}),"temporaryEnvironment"),realpath:s(d=>e.backend.realpath(d,c),"realpath"),inspect:s(d=>e.backend.lstat(d,c),"inspect"),read:s(async d=>(await e.backend.read(d,c)).bytes.toString("utf8"),"read"),git:s((d,g,u)=>e.backend.queryGit(d,g,{...c,signal:u}),"git"),source:s(d=>N(e.location.target,d).source,"source")});if(R.revision!==t.revision)throw new l("DELETE_TARGET_CHANGED",e.location.source,"not-applied");return await e.backend.removeObject(R.resolvedPath,R.revision,c),{kind:"file-operation",operation:a,ok:!0,effect:"applied",path:e.location.source}}}}s(Se,"createSshFileOperationResolver");function W(r,i,a){return{id:"ssh",async tryResolve(n,c){try{let w=r.resolve(n,c.cwd);if(!w)return{kind:"not-handled"};let{backend:e,location:t}=w,o=!1;try{o=(await e.stat(t.path,c)).kind==="directory"}catch(p){if(!(p instanceof l)||p.code!=="ENOENT")throw p}let m,R,d=s(async p=>{try{let f=await e.read(t.path,p);return m=f.version,f.bytes}catch(f){throw f instanceof l&&f.code==="ENOENT"&&(m=null),f}},"snapshot"),g=s(async p=>{if(R=void 0,o){let h=(await e.list(t.path,p)).map(y=>` ${y.kind==="directory"?"\u{1F4C1}":y.kind==="file"?"\u{1F4C4}":"\u{1F517}"} ${y.name}`);return[{type:"text",text:[`\u{1F4C1} ${t.source}/`,...h.length?["",...h]:[]].join(`
4
- `)}]}return R=await d(p),i.convert({source:t.source,bytes:R},p)},"read"),u=s(async(p,f,h)=>{let v=await e.readRange(t.path,p,Math.min(f??4194304,4194304),h),T=[v.bytes],k=v.bytes.length,E=Math.min(f??v.totalBytes,v.totalBytes-v.offset);for(;k<E;){let O=await e.readRange(t.path,v.offset+k,Math.min(E-k,4194304),h);if(O.revision!==v.revision||O.totalBytes!==v.totalBytes||O.offset!==v.offset+k)throw new l("SOURCE_CHANGED",t.source,"not-applied");if(O.bytes.length===0)break;T.push(O.bytes),k+=O.bytes.length}return{bytes:Buffer.concat(T,k),byteOffset:v.offset,totalBytes:v.totalBytes}},"readBytes");return a==="read"||o?{kind:"resolved",resource:{source:t.source,link:t.source,read:g,get sourceBytes(){return R},...o?{}:{readBytes:u}}}:{kind:"resolved",resource:{source:t.source,link:t.source,read:g,readBytes:u,get sourceBytes(){return R},async write(p,f){let h=J(p);if(m===void 0)try{await d(f)}catch(y){if(!(y instanceof l)||y.code!=="ENOENT")throw y}if(m===void 0)throw new l("SNAPSHOT_REQUIRED",t.source,"not-applied");m=await e.write(t.path,Buffer.from(h,"utf8"),m,f)}}}}catch(w){return{kind:"failed",error:w}}}}}s(W,"createSshResourceResolver");async function be(r,i){let a=await q({id:"ssh",description:"Set up SSH targets and use remote resources",triggers:[{tool:"read",resourcePrefixes:["ssh://","raw:ssh://","ast:ssh://","web:ssh://"]},{tool:"search",resourcePrefixes:["ssh://","web:ssh://"]},{tool:"debug",resourcePrefixes:["ssh://"]},...["write","replace","insert","delete","copy","move","stage","unstage","undo"].map(o=>({tool:o,resourcePrefixes:["ssh://"]}))]});if(Z(r,[{...a,markdown:`${a.markdown}
5
- ## Configured workspaces
6
-
7
- ${i.length===0?"No SSH targets are configured. Follow the setup steps above.":i.map(o=>`- \`${N(o.id,o.workspace).source}\``).join(`
8
- `)}
9
- `}]),await G(r,{protocol:H,apiVersion:V,id:"ssh-guidance",setup(o){o.addPromptGuideline("When the user asks to connect to or work on a remote device or environment over SSH, read docs:ssh first and follow its setup and usage steps.")}}),i.length===0)return;let n=new ue(i),c=z(r,{provider:"filesystem",capability:"read"}),w=z(r,{provider:"filesystem",capability:"write"}),e={protocol:H,apiVersion:V,id:"ssh",setup(o){o.addResolver({resolver:W(n,c,"read"),priority:-50,preserveTruncatedOutput:!0,renderResult:ee({kind:"source"})})}},t={protocol:re,apiVersion:oe,id:"ssh",setup(o){o.addFileOperationResolver(Se(n)),o.addResolver({resolver:W(n,w,"write"),priority:-50})}};await Promise.all([X(r,{protocol:x,apiVersion:5,id:"ssh-diagnostic-files",setup(o){o.addDiagnosticFileReader({id:"ssh",async readText(m,R){let d=n.resolve(m,R.cwd);if(d)return(await d.backend.read(d.location.path,{signal:R.signal})).bytes.toString("utf8")}})}}),G(r,e),ne(r,t),se(r,{protocol:ie,apiVersion:ae,id:"ssh",setup(o){o.addEnvironmentProvider(he(n))}})])}s(be,"registerSshResources");async function ze(r){let i=await fe(le(ce()));await be(r,i)}s(ze,"registerSshModule");export{ze as default};
package/dist/entry-22.js DELETED
@@ -1 +0,0 @@
1
- import"./chunk-K4ZMRDEI.js";
@@ -1,5 +0,0 @@
1
- # Diagnostics workflow
2
-
3
- Read `diagnostics:<path>` or add the `diagnostics` view to inspect file findings. Reports name the actual source and distinguish completed results, snapshots, pending checks, and unavailable providers. Silence and empty snapshots do not prove a file is clean.
4
-
5
- Use diagnostics for focused file feedback; use the project's build or test command for whole-project verification. After edits, wait for or explicitly request the relevant completed check. Do not run a fixer when the task only calls for diagnosis.
@@ -1,57 +0,0 @@
1
- # Read JSON and JSONL with jq
2
-
3
- Use a `jq:` view when a JSON or JSONL file is too large or you need a structured subset. Use the same view for Pi session `.jsonl` files; no separate format option or shell command is needed.
4
-
5
- ```json
6
- { "path": "package.json", "views": ["jq:.scripts"] }
7
- ```
8
-
9
- The text after `jq:` is a normal jq filter. It is passed as one argument to the installed `jq` executable, while the selected resource is sent through standard input.
10
-
11
- ## Common filters
12
-
13
- ```text
14
- jq:.
15
- jq:.dependencies | keys
16
- jq:.users[] | select(.active) | {id, name}
17
- jq:[.items[].price] | add
18
- ```
19
-
20
- A filter may produce no values, one value, or several values. Output keeps jq's normal pretty-printed JSON form.
21
-
22
- ## Session files and other JSONL input
23
-
24
- jq runs the filter separately on each input JSON value. For JSONL, each record is one value, not an item in a combined array.
25
-
26
- ```json
27
- {
28
- "path": "session.jsonl",
29
- "views": ["jq:select(.type == \"message\") | {id, role: .message.role}"],
30
- "limit": 100
31
- }
32
- ```
33
-
34
- Use `select(...)` to choose records and extract only the fields you need. The filter runs over the complete file before Read selects output lines. `offset` does not skip input records, and output line numbers are not JSONL record numbers.
35
-
36
- Malformed input fails the whole Read with jq's parse error and input line/column. Earlier valid records are not returned as a successful partial result.
37
-
38
- ## Read part of the result
39
-
40
- `offset` and `limit` select lines from the transformed jq output, not from the original file.
41
-
42
- ```json
43
- { "path": "large.json", "views": ["jq:.items"], "offset": 101, "limit": 100 }
44
- ```
45
-
46
- Follow the continuation offset returned by Read. Oversized complete output may also provide a temporary resource.
47
-
48
- ## Limits
49
-
50
- - Supply exactly one non-empty `jq:` view.
51
- - Do not combine `jq:` with annotation views. Their source coordinates would not describe the transformed JSON.
52
- - The file must contain valid JSON or a stream of JSON values, such as JSONL.
53
- - jq must be installed and available on the project or system `PATH`.
54
- - Module loading is disabled. The process receives only a minimal environment and the selected JSON on standard input.
55
- - Execution is limited to five seconds and 10 MB of jq output.
56
-
57
- Use ordinary Read when you need the original source lines or anchors. Use the jq view for inspection and computation only; it does not edit the file.
@@ -1,17 +0,0 @@
1
- # Read results and selections
2
-
3
- ## Preserve source boundaries
4
-
5
- A Read result retains the requested source window. When reading a selection, Read may display surrounding whole lines. That context does not widen the selection used by later tools.
6
-
7
- Read-only views, bytes, images and directory listings do not grant text-edit authority. Read the original text source when you need an editable selection.
8
-
9
- ## Continue with another tool
10
-
11
- Search a Read result to look only inside its selection. Use Select to derive new boundaries before editing.
12
-
13
- Read `docs:select-code` for selection workflows and `docs:editing` for using results in mutations.
14
-
15
- ## Comparing text sources
16
-
17
- When a Diff source resolves to several resources, their text is joined with one newline separator in resolver order. Diff line numbers refer to each compared text, not original source line numbers when a window is selected.
@@ -1,76 +0,0 @@
1
- # Search, AST, and LSP workflow
2
-
3
- ## Text and path search
4
-
5
- Use ordinary queries for literal text. If no literal result exists, unquoted input is tried as a regular expression and then ordinary multi-word input may be broadened to separate words. Quoted terms stay literal. Treat broadened results as location hints rather than safe edit selections.
6
-
7
- Use uppercase `AND` and `OR`, infix `NOT`, `||`, or a space-separated `|` for Boolean queries. Parentheses group Boolean conditions. An unspaced `|`, regex groups, and character classes remain regular-expression syntax. Use `regex:<pattern>` to force regex matching.
8
-
9
- Use `files:<pattern>` for paths. Slash-containing globs match workspace-relative paths; basename globs match at any depth. Narrow with `path`, `include`, and `exclude` before broadening a noisy query.
10
-
11
- ## Possible names after zero matches
12
-
13
- Use possible-name groups as spelling hints, not synonyms or proof of equivalent behavior. Inspect the candidate source before choosing an edit. The original match list stays empty; each group is a separate exact alternative in the same scope.
14
-
15
- Inspect the displayed possible-name groups and their completeness separately. The whole Search result still selects the original empty match set, not a suggested alternative. Use the chosen group's returned references to inspect or edit that alternative. A candidate all-reference refreshes only its exact alternative, not the fuzzy ranking. For URL groups, read the returned URL and line range; no editable Search references exist. Result-scoped queries stay exact and do not run this extra branch.
16
-
17
- If the extra branch reports a budget skip, narrow `path` rather than treating the skip as proof that no nearby name exists. Keep quoted exact queries, Boolean queries, and explicit protocols exact.
18
-
19
- ## Search resources
20
-
21
- Search returns readable matches and references in direct calls. In Codemode it returns `{ result, hasMatches, complete }`. Pass `result` to other tools to reuse the issued selection, or print it for the readable output. `hasMatches` reports original matches, not spelling alternatives. `complete` reports query coverage, not display truncation. Either fact is `null` when the provider does not report it. Treat `hasMatches: false` as proof of absence only when `complete: true`. An empty successful search is not an error.
22
-
23
- If Search fails, fix the reported input, scope or provider problem before retrying. Keep the intended search scope; do not treat the failure as zero matches.
24
-
25
- If Search is interrupted or cancelled, do not treat it as zero matches or completed coverage. Do not use its unfinished result as an edit scope. Retry only when the search is still wanted, and use the new result.
26
-
27
- If a result has no local edit references, use its locations to inspect the source, not as an edit scope. For changed local files, repeat Search or Read to obtain a current selection before editing.
28
-
29
- Use unchanged Read/Search/Select result text, its UUID, returned items, or `RESULT#` targets as Search scopes. These inputs keep exact source ranges and sparse gaps. Reconstructed coordinates do not grant access. Refresh stale snapshots before searching again.
30
-
31
- Use `navigation: "references"` only for symbol searches that must follow declarations outside the input scope. Without navigation, symbol results stay inside the supplied ranges. Reference results retain the originating declaration identity; equal names do not establish that identity.
32
- Local text results expose `SEARCH#HASH:N:line` for its containing line and `SEARCH#HASH:N:match` for the exact match. Complete selections use `:all:line` or `:all:match`. Pass these references directly to read or editing tools; omit the file path when an all-selection spans files.
33
-
34
- A single-result reference becomes stale after its file changes. Re-run the search before reuse. A complete `:all` reference refreshes its original query when selected files change. Compacted output retains complete all-selections.
35
-
36
- ## Searching returned scopes
37
-
38
- Pass an unchanged Read/Search/Select/edit result, its UUID or a `RESULT#` reference as `path`. Arrays of registered results also work. Local text, `regex:`, `ast:`, and `symbols:` queries search their exact ranges. Sparse ranges and files stay separate; gaps and neighboring text are not searched.
39
-
40
- A replace/insert result searches only that call's resulting text, including an empty resulting position. Copy/move search only destination text; whole-file transfers, write and undo search whole resulting files. Delete and restored absence have no live text target. In Codemode, passing a pending result commits the batch first. Final formatting runs at script end; results from before changed formatting become stale, not silently rebound.
41
-
42
- Use a displayed item or capture reference for a subset. The whole result retains its complete stored scope; editing copied preview text never narrows that scope.
43
-
44
- Incomplete registered result scopes cannot authorize edits, even through non-empty subsets. A numbered local text Search reference remains editable while its file snapshot is current, even if collection was incomplete. Use it only for its containing line or exact match, not as a complete match set. Empty arrays select no sources; they do not default to the workspace. Result-scoped Boolean text queries check each line inside each selected range separately; conditions cannot borrow terms from gaps or neighboring text. Text include/exclude globs remain unsupported for result scopes. AST and LSP providers retain their own path/glob filters. File/process and unsupported provider scopes fail without widening the scope.
45
-
46
- ## AST search
47
-
48
- Use `ast:<pattern>` for syntax-aware matching. `$NAME` captures one syntax node and `$$$BODY` captures several nodes. Returned search references can select multiline matches for read, replace, copy, move, and delete. An incomplete result does not provide a complete all-selection. Text replacement through an AST selection does not update imports or references automatically.
49
-
50
- Use the displayed `capture NAME: RESULT#...` reference to Search or edit a capture without Select. It belongs to that parent match and retains every captured node, including punctuation. Its node count does not change the selection. An empty capture selects nothing; an absent capture has no reference. AST matches and captures must be wholly contained in one requested region; they are not clipped at a scope boundary.
51
-
52
- ```js
53
- const window = await tools.read({ path: "client.ts", offset: 10, limit: 4 });
54
- const calls = await tools.search({ path: window, query: "ast:request($OPTIONS)" });
55
- text(calls.result);
56
- ```
57
-
58
- Use its displayed OPTIONS reference in the next call. Store/load keeps these result strings across Codemode scripts within the same session.
59
-
60
- ## Symbols and graphs
61
-
62
- Use `symbols:<query>` to locate declarations and references when the source file is unknown. Use `symbol:<file>#<selector>` to read one declaration. Use `graph:<file>` for the file's top-level declarations and relationships, or `graph:<file>#<selector>` for incoming and outgoing references of one declaration.
63
-
64
- Pass a result scope to `symbols:` for strict discovery inside its exact ranges. Read the displayed definition/reference and symbol information. Name equality alone does not establish reference identity.
65
-
66
- Use `navigation: "references"` only when following symbols represented inside the input scope to references outside it. Navigation stays within the workspace. Path and globs define the seed scope in this mode, not the destination references. Omit navigation for strict discovery. Incomplete, failed or unavailable provider results do not prove absence. Text replacement through an LSP match changes only that range; it is not semantic rename.
67
-
68
- Append `#name` to an exact symbol resource only for a native language-server rename across references. If semantic support is unavailable, use a precise text or AST operation instead of pretending it was a semantic rename. Pending or empty language-server output does not prove that no declaration or reference exists.
69
-
70
- ## Other search protocols
71
-
72
- Use `path: "docs:all"` to search every available packaged guide body, or `path: "docs:<id>"` for one guide. Use a literal or `regex:` query with `caseSensitive`, `wholeWord`, and `limit` as needed. File globs and structural queries do not apply. Matches show the guide source, line, and excerpt without editable references. Read that `docs:<id>` source for context or the full guide; search excerpts do not count as reading it. Read `docs:` to list the available IDs. Search requires `docs:all` or `docs:<id>`; bare `docs:` is not a search scope.
73
-
74
- Use an HTTP(S) URL as `path` for local web execution, or `web:ssh://target/https://example.com/page` for explicit target execution. Search converted page text with a literal or `regex:` query; no prior Read is needed. Web results keep the requested source and do not expose editable `SEARCH#` references. Use Read on that source for more context.
75
-
76
- Use `process:<query>` for running processes. Use `path: "shell:<session>"` to search retained terminal output beyond its current tail.
@@ -1,119 +0,0 @@
1
- # Select source boundaries
2
-
3
- Use Search for predicates and existing captures. Use Select to derive new text or syntax boundaries. Pass the unchanged Read/Search/Select/edit result as `path`; ordinary paths and returned item references also work. Outside Codemode, you can pass the result's UUID.
4
-
5
- Select returns readable selected text with item references. The whole result retains all selected ranges, even when its preview is shortened. Use a displayed item reference when you need only that item. Do not build a selection from copied preview text or invented coordinates.
6
-
7
- ## Syntax operations
8
-
9
- Syntax operations support JavaScript (.js/.mjs/.cjs) and TypeScript (.ts/.mts/.cts), without JSX/TSX. Missing providers and syntax errors are errors, not evidence of absence. Text operations need no parser.
10
-
11
- ### Enclosing constructs
12
-
13
- `{kind:"object", object:"function"}` selects the nearest function containing the entire seed. An exact function selects itself. `level:2` selects the next outer function; levels count only the requested category. A seed crossing separate constructs is rejected. Enclosing can expand outside the original window and reports that expansion.
14
-
15
- Supported categories: function, call, class, if, switch, loop, try, catch, binding, assignment, object, property, array, return and throw. Call includes new expressions. Function includes methods, arrows, async/generator forms and bodyless TS signatures. Default parameter expressions belong to their function. Binding selects one variable declarator, not the whole declaration statement.
16
-
17
- These are syntax categories, not semantic identities. Parser-only wrappers, punctuation, comments, class fields, JSX/TSX and unlisted forms do not become extra categories. `ownBody` is not implemented.
18
-
19
- ### Navigate
20
-
21
- `{kind:"navigate", relation:"parent"}` requires an exact named syntax node and skips parser-only wrappers. Exact parts and captures work; first use enclosing when a range cuts through a node. A whole-file seed is not implicitly split into functions.
22
-
23
- - parent selects the nearest normalized ancestor, excluding the starting node.
24
- - ancestors selects all normalized ancestors in source order.
25
- - children selects nearest nested constructs; descendants selects all nested constructs.
26
- - siblings selects other constructs with the same normalized parent. previous/next selects the immediate neighbor; all selects every sibling. Missing neighbors are valid absence.
27
-
28
- An `object` filter is applied after navigation; it never changes topology. Parent with object:function does not jump past an intervening call. Children with object:call does not jump through an if. Use ancestors/descendants for deeper matches.
29
-
30
- Ancestors and descendants can overlap. Narrow to disjoint targets before editing; edit tools reject overlapping writes.
31
-
32
- ### Named parts
33
-
34
- `{kind:"part", part:"arguments"}` requires an exact construct. Parts keep their delimiters: block bodies include braces, argument/parameter lists include parentheses, annotations include colons, and else/finalizer clauses include their keywords. Expression arrow bodies are exact expressions.
35
-
36
- | Construct | Supported parts |
37
- | --------------- | ---------------------------------------------------------- |
38
- | function | name, parameters, returnType, body |
39
- | call/new | callee, arguments |
40
- | class | name, body |
41
- | if | condition, then, else |
42
- | switch | condition, body |
43
- | classic for | initializer, condition, update, body |
44
- | for-in / for-of | left, iterable, body |
45
- | while / do | condition, body |
46
- | try | body, handler, finalizer |
47
- | catch | parameter, body |
48
- | finally clause | body |
49
- | binding | name, type, value |
50
- | assignment | left, right |
51
- | property | key, value; shorthand selects the same identifier for both |
52
- | return / throw | value |
53
-
54
- An absent optional part produces no selection. An unsupported part reports available names. Objects and arrays do not invent body or arguments parts.
55
-
56
- ```js
57
- const found = await tools.search({ path: "client.ts", query: "ast:send($$$ARGS)" });
58
- const call = await tools.select({
59
- path: found.result,
60
- operation: { kind: "object", object: "call" },
61
- });
62
- const args = await tools.select({ path: call, operation: { kind: "part", part: "arguments" } });
63
- text(await tools.read({ path: args }));
64
- const number = await tools.search({ path: args, query: "10" });
65
- await tools.replace({ path: number.result, text: "20" });
66
- ```
67
-
68
- ### List element extents
69
-
70
- `{kind:"elementExtent", extent:"inside"}` requires an exact direct call/new argument or parenthesized function parameter. Use a displayed Search capture reference for that element. Variadic captures can include punctuation; punctuation is not an element. Typed/default parameters must include their type/default.
71
-
72
- Inside keeps the element. Around adds owned comma/whitespace and preserves list parentheses. First/middle elements own the following gap. A last element with a trailing comma owns that following gap; without one it owns the preceding gap. An only element owns the whole list interior.
73
-
74
- Adjacent comments make around ambiguous; inside remains available. Several around extents may overlap, so do not assume bulk deletion repairs syntax. Copy/move transports exact selected bytes, not a refactoring. Destination syntax and parameter ordering remain the caller's responsibility. Arrays, objects, partial expressions, whole lists and unparenthesized arrow parameters are unsupported here.
75
-
76
- ## Text operations
77
-
78
- - range: absolute startLine/startColumn/endLine/endColumn in one source; lines are one-based, columns UTF-16, end exclusive. Must fit one input region.
79
- - lines: inclusive first/last complete source lines, including existing endings; must fit one region.
80
- - between: pairs each non-empty start marker with the nearest following end, without nesting, then resumes after the pair. Extent inside excludes markers, around includes them, lines expands to containing lines. Unmatched openings are errors; no openings is valid absence.
81
- - sliceText: relative UTF-16 from/to in each region; to is exclusive and defaults to its end. Equal offsets select a point.
82
- - trim: removes whitespace from start/end/both edges. Whitespace-only input selects a point at its end.
83
- - split: divides by a non-empty literal delimiter, excluding delimiters and retaining empty segments as points.
84
- - linesOf: expands to complete containing lines. An exclusive end at next-line column zero does not include that line.
85
- - position: before/after points of each region. Use a whole-file Read for file edges.
86
- - columns: exclusive from/to columns on each touched line, excluding endings. Every interval must fit its line and input scope.
87
-
88
- Except for range/lines, operations apply independently to each region. Sparse gaps stay separate. Markers cannot cross gaps. Bounds inside surrogate pairs or CRLF are errors; ranges are never silently clipped. Only linesOf and between/lines explicitly expand text input.
89
-
90
- ## Range sets
91
-
92
- Pass candidates in `path` and comparison results in `operation.scopes`. Both accept unchanged results, issued references or arrays. Match by source and snapshot, not array order. Every input is verified, even without a counterpart.
93
-
94
- - within retains a candidate only if one scope contains it; no clipping or joining for containment.
95
- - intersection clips each candidate to the union of scopes.
96
- - difference subtracts scopes and retains separate surviving fragments.
97
- - merge joins overlapping candidates. adjacent:true also joins touching nonempty ranges, never real gaps.
98
-
99
- Points belong to a nonempty range at its included start, not its excluded end. Equal points match. Intersection with a contained point keeps it; touching ranges do not create points. Difference removes covered candidate points but point scopes do not cut text. Merge absorbs covered points without extending ranges. EOF points are outside a range ending at EOF.
100
-
101
- Empty scopes make within/intersection empty and difference unchanged. Incomplete inputs cannot establish absence or authorize edits. Select never writes or formats.
102
- Repeat the operation after interruption. Do not treat cancellation as an empty result.
103
-
104
- ```js
105
- const candidates = await tools.search({ path: "notes.txt", query: "regex:<[^>]+>" });
106
- const protectedText = await tools.search({ path: candidates.result, query: "KEEP" });
107
- const editable = await tools.select({
108
- path: candidates.result,
109
- operation: { kind: "difference", scopes: protectedText.result },
110
- });
111
- const found = await tools.search({ path: editable, query: "old" });
112
- await tools.replace({ path: found.result, text: "new" });
113
- ```
114
-
115
- ## Composition limits
116
-
117
- Read may show whole-line context around a selection, but later tools remain within its exact selected ranges. Whole-file write/undo reject partial selections. Insert remains line-based. Changed files, new sessions and reloads retire IDs; final Codemode formatting may also retire earlier results.
118
-
119
- A function body includes nested functions. To check a call in a function's own body, compare the call's nearest enclosing function with the original owner using their source-local selections. Syntax names alone do not establish semantic identity. Do not establish absence from incomplete results.
@@ -1,11 +0,0 @@
1
- # Visual capture workflow
2
-
3
- Use `search` with `process:<query>` and an SSH `path` to inspect a configured Linux target. Read its returned `process:ssh://target/PID` for target metadata and kernel start identity. Use `window:ssh://target/PID` for that target's application window; never put a remote PID into local `window:PID`. Window capture requires an active IDE-owned process, an exact native executable allowlist match, or the arbitrary-window opt-in. Each frame checks the current target process and start identity, then verifies the X server's local client PID before reading pixels. A window's advertised PID alone never authorizes capture.
4
-
5
- Use `display:ssh://target/` or `display:ssh://target/#N` for a target X11 screen only when display capture is enabled. Target capture needs Python and an accessible X11 session with libX11. Window capture also needs libX11-xcb, libxcb and X-Resource 1.2 native client identity support. A headless, inaccessible, ambiguous or obscured window fails without controller or root-image fallback. Target acquisition is bounded to 16 million pixels per frame and 20MB of PNG data. The ordinary region, scale, grid and sequence rules below still apply; transformations happen locally after target acquisition.
6
-
7
- Use `web:ssh://target/https://example.com/page` with `image` or `sequence` views for target browser screenshots. Ordinary HTTP(S) sources still capture locally. The target needs Node, `playwright-core` and Chrome/Chromium; missing dependencies never select a controller browser. Browser capture uses a fresh profile with JavaScript enabled and the Chromium sandbox disabled. Crop, scale and grid apply to the fetched full-page PNG, just as for local URL capture.
8
-
9
- Discover a process first with `process:<query>`, then read `window:<PID>` for an allowed application window. Use `display:` or `display:#N` only when display capture is enabled. Add `views: ["image"]` for a still image or `views: ["sequence"]` when motion or timing requires multiple frames.
10
-
11
- Tune sequence duration, interval, scale, and region only when defaults do not fit. Region uses normalized `x,y,width,height` and is applied before scaling. For image grids, use `limit` as the square cell size and `offset` as a zero-based row-major cell index. Avoid capturing unrelated desktop content.
@@ -1 +0,0 @@
1
- export * from "../../../dist/entry-22.js";