pi-agent-ide 0.9.5 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (683) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/{chunk-BU7IZLKB.js → chunk-2DSY4U73.js} +1 -1
  3. package/dist/chunk-2YO6RVX4.js +1 -0
  4. package/dist/{chunk-CJPS4GXD.js → chunk-34IYWKY5.js} +1 -1
  5. package/dist/{chunk-TL4PHMAU.js → chunk-4CSNQX54.js} +1 -1
  6. package/dist/{chunk-I7AGYUPS.js → chunk-53IV6EKV.js} +1 -1
  7. package/dist/{chunk-K2G3IMXR.js → chunk-5DN2XBVI.js} +1 -1
  8. package/dist/{chunk-D45H2PNW.js → chunk-6W4OJLCJ.js} +1 -1
  9. package/dist/{chunk-JDAH3IXR.js → chunk-6ZYCTWQE.js} +1 -1
  10. package/dist/{chunk-BB4A5UI3.js → chunk-7JWZPJI5.js} +1 -1
  11. package/dist/{chunk-ULO3YOBE.js → chunk-AMSNDWBT.js} +1 -1
  12. package/dist/{chunk-DMHLIVN6.js → chunk-APWMLLSE.js} +6 -6
  13. package/dist/{chunk-U2ROTQLD.js → chunk-B5UJCNQU.js} +1 -1
  14. package/dist/{chunk-VWP2HLFT.js → chunk-BMSAVDRD.js} +6 -6
  15. package/dist/{chunk-A75GMLA4.js → chunk-BRJIXNFU.js} +1 -1
  16. package/dist/{chunk-IMMOFDTW.js → chunk-C2GZLLSP.js} +2 -2
  17. package/dist/{chunk-KUPYPCRL.js → chunk-DHOIQZUF.js} +1 -1
  18. package/dist/{chunk-DFUGBEHK.js → chunk-ECSMTGVM.js} +3 -3
  19. package/dist/{chunk-DEP55R35.js → chunk-EHFWODRT.js} +1 -1
  20. package/dist/{chunk-UCTBXRGA.js → chunk-FBR7ZLLN.js} +1 -1
  21. package/dist/{chunk-ANTYGMDR.js → chunk-FGN2ZMEN.js} +1 -1
  22. package/dist/{chunk-QBA36YEN.js → chunk-FJSYWOE6.js} +1 -1
  23. package/dist/chunk-H6FEBUAP.js +1 -0
  24. package/dist/{chunk-Y6FXFXCN.js → chunk-HFF4GY7R.js} +1 -1
  25. package/dist/{chunk-WPATZK4Y.js → chunk-HJXSEPO7.js} +1 -1
  26. package/dist/{chunk-7IYO2R47.js → chunk-HSEDKYH4.js} +1 -1
  27. package/dist/{chunk-VNCQGBM6.js → chunk-II7AOJNH.js} +1 -1
  28. package/dist/{chunk-GFITSPSQ.js → chunk-J6CDIH3S.js} +15 -15
  29. package/dist/{chunk-V6IPWCPS.js → chunk-JHWLRL4U.js} +1 -1
  30. package/dist/{chunk-FNJ6X7OP.js → chunk-JMQ67UNK.js} +1 -1
  31. package/dist/{chunk-KMFQBEIR.js → chunk-JRIP33PC.js} +1 -1
  32. package/dist/chunk-JYITLCXC.js +1 -0
  33. package/dist/{chunk-7D4ZCPH4.js → chunk-LIGOOMJS.js} +3 -3
  34. package/dist/{chunk-FUOB54RU.js → chunk-LY2UANKU.js} +3 -3
  35. package/dist/chunk-M7P7V4WI.js +25 -0
  36. package/dist/{chunk-W4IAODWI.js → chunk-NF74ITWT.js} +2 -2
  37. package/dist/{chunk-EL4KJ3Q2.js → chunk-NQYUIQRH.js} +1 -1
  38. package/dist/{chunk-MZW7L37L.js → chunk-OIEA4QWF.js} +2 -2
  39. package/dist/{chunk-3E7YABYT.js → chunk-ON5HDFNL.js} +1 -1
  40. package/dist/{chunk-G3OPALJH.js → chunk-P43GGKUC.js} +5 -5
  41. package/dist/{chunk-GCJHOMSI.js → chunk-P7FUD4WY.js} +1 -1
  42. package/dist/{chunk-72YIFABM.js → chunk-QGXZ4RWX.js} +1 -1
  43. package/dist/{chunk-ALZV2EYT.js → chunk-S7E2D5K7.js} +2 -2
  44. package/dist/{chunk-5GASXMD2.js → chunk-T5ACAOKJ.js} +3 -3
  45. package/dist/{chunk-7GKCQCMS.js → chunk-TWJINFQB.js} +4 -4
  46. package/dist/{chunk-2WQFGBV2.js → chunk-TWQ6ACOI.js} +1 -1
  47. package/dist/chunk-UDVVKVG4.js +1 -0
  48. package/dist/{chunk-NFXS3E2A.js → chunk-V2D5MLGE.js} +1 -1
  49. package/dist/{chunk-6TOFURDG.js → chunk-VDSSAP6Y.js} +1 -1
  50. package/dist/{chunk-AVJVTF5H.js → chunk-VHYJTAXX.js} +1 -1
  51. package/dist/{chunk-6UGSUMTI.js → chunk-WCSWQDJ2.js} +1 -1
  52. package/dist/{chunk-X6VMRL6L.js → chunk-WQTF6Q2X.js} +1 -1
  53. package/dist/{chunk-Q6JB5VAP.js → chunk-YFPU2LRR.js} +7 -7
  54. package/dist/{chunk-ISNWEIUW.js → chunk-YLEERRX3.js} +13 -13
  55. package/dist/{chunk-6BAGTM7U.js → chunk-YOJHCARZ.js} +1 -1
  56. package/dist/chunk-YPTDPMK5.js +1 -0
  57. package/dist/{chunk-37UNDG6V.js → chunk-YZTVC7ME.js} +1 -1
  58. package/dist/entry-0.js +1 -1
  59. package/dist/entry-10.js +1 -1
  60. package/dist/entry-11.js +1 -1
  61. package/dist/entry-14.js +1 -1
  62. package/dist/entry-15.js +1 -1
  63. package/dist/entry-17.js +1 -1
  64. package/dist/entry-21.js +1 -1
  65. package/dist/entry-22.js +1 -1
  66. package/dist/entry-25.js +1 -1
  67. package/dist/entry-31.js +1 -1
  68. package/dist/entry-33.js +1 -1
  69. package/dist/entry-34.js +1 -1
  70. package/dist/entry-36.js +1 -1
  71. package/dist/entry-37.js +1 -1
  72. package/dist/entry-38.js +3 -3
  73. package/dist/entry-39.js +1 -1
  74. package/dist/entry-4.js +1 -1
  75. package/dist/entry-40.js +1 -1
  76. package/dist/entry-41.js +1 -1
  77. package/dist/entry-42.js +1 -1
  78. package/dist/entry-43.js +1 -1
  79. package/dist/entry-44.js +1 -1
  80. package/dist/entry-48.js +1 -1
  81. package/dist/entry-49.js +1 -1
  82. package/dist/entry-50.js +1 -1
  83. package/dist/entry-51.js +1 -1
  84. package/dist/entry-52.js +1 -1
  85. package/dist/entry-57.js +1 -1
  86. package/dist/entry-58.js +1 -1
  87. package/dist/entry-59.js +1 -1
  88. package/dist/entry-60.js +1 -1
  89. package/dist/entry-62.js +1 -1
  90. package/dist/entry-63.js +1 -1
  91. package/dist/entry-64.js +1 -1
  92. package/dist/entry-65.js +1 -1
  93. package/dist/entry-66.js +1 -1
  94. package/dist/entry-67.js +1 -1
  95. package/dist/entry-69.js +1 -1
  96. package/dist/entry-72.js +1 -1
  97. package/dist/entry-74.js +1 -1
  98. package/dist/entry-75.js +1 -1
  99. package/dist/entry-79.js +1 -1
  100. package/dist/entry-84.js +1 -1
  101. package/dist/entry-85.js +1 -1
  102. package/dist/entry-86.js +1 -1
  103. package/dist/entry-90.js +1 -1
  104. package/dist/entry-94.js +1 -1
  105. package/dist/pi-agent-ide.js +6 -6
  106. package/docs/development.md +2 -0
  107. package/node_modules/pi-agent-doctor/package.json +1 -1
  108. package/node_modules/pi-agent-doctor/src/connect-plugin.ts +2 -2
  109. package/node_modules/pi-agent-doctor/src/evidence.ts +1 -1
  110. package/node_modules/pi-agent-doctor/src/fixtures/executable-probe.ts +2 -2
  111. package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +4 -4
  112. package/node_modules/pi-agent-doctor/src/project-probes.ts +2 -2
  113. package/node_modules/pi-agent-doctor/src/workspace.ts +2 -2
  114. package/node_modules/pi-agent-documentation/package.json +1 -1
  115. package/node_modules/pi-agent-filesystem/index.ts +2 -2
  116. package/node_modules/pi-agent-filesystem/package.json +7 -7
  117. package/node_modules/pi-agent-filesystem/src/resolver.ts +2 -2
  118. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  119. package/node_modules/pi-agent-filesystem-jq/index.ts +1 -1
  120. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  121. package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +1 -1
  122. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  123. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  124. package/node_modules/pi-agent-ide-ast/index.ts +1 -1
  125. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  126. package/node_modules/pi-agent-ide-ast/src/api/scope.ts +1 -1
  127. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +2 -2
  128. package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +1 -1
  129. package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +5 -5
  130. package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +1 -1
  131. package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
  132. package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +3 -3
  133. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +1 -1
  134. package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +1 -1
  135. package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
  136. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +1 -1
  137. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +1 -1
  138. package/node_modules/pi-agent-ide-changes/index.ts +9 -9
  139. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  140. package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +4 -4
  141. package/node_modules/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
  142. package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +4 -4
  143. package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -1
  144. package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +4 -4
  145. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -5
  146. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -6
  147. package/node_modules/pi-agent-ide-formatter/index.ts +5 -5
  148. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  149. package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +2 -2
  150. package/node_modules/pi-agent-ide-formatter/src/formatter.ts +2 -2
  151. package/node_modules/pi-agent-ide-formatter/src/registry.ts +1 -1
  152. package/node_modules/pi-agent-ide-languages/index.ts +1 -1
  153. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  154. package/node_modules/pi-agent-ide-lint/index.ts +9 -9
  155. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  156. package/node_modules/pi-agent-ide-lint/src/command-linter.ts +2 -2
  157. package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +3 -3
  158. package/node_modules/pi-agent-ide-lint/src/registry.ts +1 -1
  159. package/node_modules/pi-agent-ide-lsp/index.ts +17 -17
  160. package/node_modules/pi-agent-ide-lsp/package.json +12 -12
  161. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +3 -3
  162. package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +3 -3
  163. package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +4 -4
  164. package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +7 -7
  165. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +9 -9
  166. package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
  167. package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostics.ts +4 -4
  168. package/node_modules/pi-agent-ide-lsp/src/lsp/document-leases.ts +1 -1
  169. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +19 -19
  170. package/node_modules/pi-agent-ide-lsp/src/lsp/language-map.ts +1 -1
  171. package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +4 -4
  172. package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +13 -13
  173. package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +3 -3
  174. package/node_modules/pi-agent-ide-lsp/src/lsp/owner-transport.ts +1 -1
  175. package/node_modules/pi-agent-ide-lsp/src/lsp/position-map.ts +1 -1
  176. package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +1 -1
  177. package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +2 -2
  178. package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +2 -2
  179. package/node_modules/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +17 -5
  180. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +7 -7
  181. package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +3 -3
  182. package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +1 -1
  183. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +1 -1
  184. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +8 -8
  185. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +4 -4
  186. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +1 -1
  187. package/node_modules/pi-agent-image/package.json +2 -2
  188. package/node_modules/pi-agent-image/src/index.ts +1 -1
  189. package/node_modules/pi-agent-invariant/package.json +1 -1
  190. package/node_modules/pi-agent-pdf/package.json +2 -2
  191. package/node_modules/pi-agent-pdf/src/index.ts +1 -1
  192. package/node_modules/pi-agent-read/index.ts +1 -1
  193. package/node_modules/pi-agent-read/package.json +7 -7
  194. package/node_modules/pi-agent-read/src/api/connect-plugin.ts +1 -1
  195. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  196. package/node_modules/pi-agent-read/src/api/read-parameters.ts +1 -1
  197. package/node_modules/pi-agent-read/src/api/rendering.ts +2 -2
  198. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -2
  199. package/node_modules/pi-agent-read/src/core/extension.ts +4 -4
  200. package/node_modules/pi-agent-read/src/core/read-core.ts +4 -4
  201. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +2 -2
  202. package/node_modules/pi-agent-read/src/core/tools/read/persisted-result.ts +1 -1
  203. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +3 -3
  204. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +4 -4
  205. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +1 -1
  206. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +1 -1
  207. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +2 -2
  208. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +7 -7
  209. package/node_modules/pi-agent-resource/package.json +1 -1
  210. package/node_modules/pi-agent-resource/src/content-conversion/connect-plugin.ts +4 -4
  211. package/node_modules/pi-agent-resource/src/content-conversion/content-converter.ts +1 -1
  212. package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -1
  213. package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +4 -4
  214. package/node_modules/pi-agent-resource/src/content-conversion/content-runner.ts +3 -3
  215. package/node_modules/pi-agent-resource/src/content-conversion/plugin-protocol.ts +2 -2
  216. package/node_modules/pi-agent-resource/src/content-conversion/validation.ts +2 -2
  217. package/node_modules/pi-agent-resource/src/index.ts +19 -19
  218. package/node_modules/pi-agent-resource/src/resolver.ts +1 -1
  219. package/node_modules/pi-agent-resource/src/resource-access.ts +1 -1
  220. package/node_modules/pi-agent-resource/src/resource-error.ts +1 -1
  221. package/node_modules/pi-agent-resource/src/resource.ts +1 -1
  222. package/node_modules/pi-agent-resource/src/result-images.ts +1 -1
  223. package/node_modules/pi-agent-resource/src/temp-resource-store.ts +2 -2
  224. package/node_modules/pi-agent-resource/src/tool-result.ts +2 -2
  225. package/node_modules/pi-agent-resource/src/validation.ts +3 -3
  226. package/node_modules/pi-agent-search/index.ts +1 -1
  227. package/node_modules/pi-agent-search/package.json +5 -5
  228. package/node_modules/pi-agent-search/src/api/connect-plugin.ts +1 -1
  229. package/node_modules/pi-agent-search/src/api/fuzzy.ts +2 -2
  230. package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  231. package/node_modules/pi-agent-search/src/api/presentation.ts +1 -1
  232. package/node_modules/pi-agent-search/src/api/search-scope.ts +1 -1
  233. package/node_modules/pi-agent-search/src/api/search.ts +7 -7
  234. package/node_modules/pi-agent-search/src/core/extension.ts +7 -7
  235. package/node_modules/pi-agent-search/src/core/search-core.ts +3 -3
  236. package/node_modules/pi-agent-search-text/index.ts +8 -8
  237. package/node_modules/pi-agent-search-text/package.json +10 -10
  238. package/node_modules/pi-agent-search-text/src/doctor-plugin.ts +1 -1
  239. package/node_modules/pi-agent-search-text/src/file-search.ts +1 -1
  240. package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +2 -2
  241. package/node_modules/pi-agent-search-text/src/persisted-result.ts +1 -1
  242. package/node_modules/pi-agent-search-text/src/resolvers.ts +9 -9
  243. package/node_modules/pi-agent-search-text/src/scoped-search.ts +4 -4
  244. package/node_modules/pi-agent-search-text/src/search-backend.ts +3 -3
  245. package/node_modules/pi-agent-search-text/src/search-presentation.ts +1 -1
  246. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -2
  247. package/node_modules/pi-agent-search-text/src/search-renderer.ts +3 -3
  248. package/node_modules/pi-agent-search-text/src/search-result.ts +2 -2
  249. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -1
  250. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +1 -1
  251. package/node_modules/pi-agent-text/package.json +2 -2
  252. package/node_modules/pi-agent-text/src/index.ts +7 -7
  253. package/node_modules/pi-agent-text/src/source-line.ts +1 -1
  254. package/node_modules/pi-agent-text/src/text-document.ts +1 -1
  255. package/node_modules/pi-agent-text-anchor-constant/index.ts +1 -1
  256. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  257. package/node_modules/pi-agent-text-anchor-exact/index.ts +2 -2
  258. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  259. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +2 -2
  260. package/node_modules/pi-agent-text-anchor-exact/src/recovery.ts +3 -3
  261. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -2
  262. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  263. package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -1
  264. package/node_modules/pi-agent-text-editor/index.ts +5 -5
  265. package/node_modules/pi-agent-text-editor/package.json +9 -9
  266. package/node_modules/pi-agent-text-editor/src/api/connect-plugin.ts +1 -1
  267. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -2
  268. package/node_modules/pi-agent-text-editor/src/api/file-operations.ts +2 -2
  269. package/node_modules/pi-agent-text-editor/src/api/file-transfers.ts +1 -1
  270. package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +4 -4
  271. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -3
  272. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +2 -2
  273. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +1 -1
  274. package/node_modules/pi-agent-text-editor/src/api/native-files.ts +1 -1
  275. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +14 -14
  276. package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +3 -3
  277. package/node_modules/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
  278. package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +2 -2
  279. package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +3 -3
  280. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +3 -3
  281. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -13
  282. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +2 -2
  283. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -6
  284. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +5 -5
  285. package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
  286. package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +3 -3
  287. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +1 -1
  288. package/node_modules/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +3 -3
  289. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +4 -4
  290. package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -2
  291. package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +1 -1
  292. package/node_modules/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
  293. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +6 -6
  294. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +22 -22
  295. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +1 -1
  296. package/node_modules/pi-agent-text-editor/src/core/read-fragment-resolver.ts +3 -3
  297. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +1 -1
  298. package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +2 -2
  299. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +4 -4
  300. package/node_modules/pi-agent-text-editor/src/core/source-change-retry.ts +1 -1
  301. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +2 -2
  302. package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +2 -2
  303. package/node_modules/pi-agent-text-editor/src/core/text-anchor-recovery.ts +1 -1
  304. package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +3 -3
  305. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +2 -2
  306. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +2 -2
  307. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +19 -19
  308. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -4
  309. package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +1 -1
  310. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +19 -19
  311. package/node_modules/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +1 -1
  312. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +29 -29
  313. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +4 -4
  314. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +1 -1
  315. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -3
  316. package/node_modules/pi-agent-text-editor/src/tools/extension.ts +7 -7
  317. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +2 -2
  318. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +4 -4
  319. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -4
  320. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +3 -3
  321. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -5
  322. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +4 -4
  323. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +1 -1
  324. package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -5
  325. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  326. package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +3 -3
  327. package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +1 -1
  328. package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +2 -2
  329. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -4
  330. package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +2 -2
  331. package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +3 -3
  332. package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +2 -2
  333. package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +1 -1
  334. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +7 -7
  335. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  336. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  337. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  338. package/node_modules/pi-agent-tool-ui/src/index.ts +1 -1
  339. package/node_modules/pi-agent-tool-ui/src/result-panel.ts +1 -1
  340. package/node_modules/pi-agent-web/index.ts +3 -3
  341. package/node_modules/pi-agent-web/package.json +7 -7
  342. package/node_modules/pi-agent-web/src/doctor-plugin.ts +1 -1
  343. package/node_modules/pi-agent-web/src/resolver.ts +1 -1
  344. package/node_modules/pi-agent-web-html/index.ts +1 -1
  345. package/node_modules/pi-agent-web-html/package.json +2 -2
  346. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  347. package/node_modules/pi-agent-web-image/package.json +3 -3
  348. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  349. package/node_modules/pi-agent-web-text/package.json +3 -3
  350. package/package.json +35 -35
  351. package/src/api/code-view.ts +3 -3
  352. package/src/api/connect-plugin.ts +1 -1
  353. package/src/api/connect-tip-provider.ts +2 -2
  354. package/src/api/doctor-runtime.ts +1 -1
  355. package/src/api/doctor.ts +1 -1
  356. package/src/api/hooks.ts +2 -2
  357. package/src/api/plugin-protocol.ts +1 -1
  358. package/src/api/standalone.ts +1 -1
  359. package/src/api/tips.ts +1 -1
  360. package/src/api/toolchain.ts +3 -3
  361. package/src/backend/config.ts +2 -2
  362. package/src/backend/configured-process.ts +5 -5
  363. package/src/backend/dap-java-transport.ts +6 -6
  364. package/src/backend/dap-node-transport.ts +5 -5
  365. package/src/backend/dap-tcp-transport.ts +3 -3
  366. package/src/backend/dap-transport.ts +5 -5
  367. package/src/backend/debugger-registration.ts +7 -7
  368. package/src/backend/debugger-workspace-owner.ts +10 -10
  369. package/src/backend/doctor-registration.ts +5 -5
  370. package/src/backend/doctor-workspace.ts +13 -13
  371. package/src/backend/file-operation-resolver.ts +5 -5
  372. package/src/backend/file-revision.ts +1 -1
  373. package/src/backend/file-transfer.ts +4 -4
  374. package/src/backend/formatter-registration.ts +11 -11
  375. package/src/backend/git-registration.ts +4 -4
  376. package/src/backend/index.ts +3 -3
  377. package/src/backend/lint-registration.ts +11 -11
  378. package/src/backend/lsp-file-watchers.ts +5 -5
  379. package/src/backend/lsp-registration.ts +11 -11
  380. package/src/backend/lsp-transport.ts +7 -7
  381. package/src/backend/lsp-workspace-owner.ts +4 -4
  382. package/src/backend/object-transfer.ts +5 -5
  383. package/src/backend/owned-command.ts +2 -2
  384. package/src/backend/owned-process-stop.ts +4 -4
  385. package/src/backend/owned-read-command.ts +2 -2
  386. package/src/backend/process-environment.ts +2 -2
  387. package/src/backend/process-metadata.ts +2 -2
  388. package/src/backend/recipe-evidence.ts +2 -2
  389. package/src/backend/registration.ts +8 -8
  390. package/src/backend/registry.ts +2 -2
  391. package/src/backend/resource-resolver.ts +2 -2
  392. package/src/backend/search-environment.ts +3 -3
  393. package/src/backend/ssh-channel.ts +3 -3
  394. package/src/backend/ssh-transport.ts +2 -2
  395. package/src/backend/ssh.ts +6 -6
  396. package/src/backend/tool-config-access.ts +4 -4
  397. package/src/backend/tool-project.ts +5 -5
  398. package/src/backend/web-browser.ts +3 -3
  399. package/src/backend/web-http.ts +2 -2
  400. package/src/backend/web-owner.ts +5 -5
  401. package/src/backend/web-registration.ts +5 -5
  402. package/src/code-review/extension.ts +3 -3
  403. package/src/code-review/reviewer.ts +2 -2
  404. package/src/code-view/diagnostic-view.ts +4 -4
  405. package/src/composite/builtin-extensions.ts +37 -37
  406. package/src/composite/capabilities.ts +2 -2
  407. package/src/composite/capability-schemas.ts +1 -1
  408. package/src/composite/extensions-config.ts +2 -2
  409. package/src/composite/module-settings-store.ts +2 -2
  410. package/src/composite/module-settings.ts +12 -12
  411. package/src/composite/nested-tool-rendering.ts +3 -3
  412. package/src/composite/output-limits.ts +6 -1
  413. package/src/composite/presets.ts +1 -1
  414. package/src/composite/reload-required.ts +6 -6
  415. package/src/composite/settings-documentation.ts +5 -5
  416. package/src/composite/settings-registry.ts +4 -4
  417. package/src/composite/text-results.ts +2 -2
  418. package/src/core/diagnostic-entry.ts +2 -2
  419. package/src/core/diagnostic-store.ts +3 -3
  420. package/src/core/extension.ts +8 -8
  421. package/src/core/ide-core.ts +4 -4
  422. package/src/doctor/config-writer.ts +3 -3
  423. package/src/doctor/core.ts +2 -2
  424. package/src/doctor/discovery.ts +4 -4
  425. package/src/doctor/extension.ts +7 -7
  426. package/src/doctor/index.ts +1 -1
  427. package/src/doctor/inventory.ts +1 -1
  428. package/src/doctor/run.ts +6 -6
  429. package/src/doctor/tip-provider.ts +2 -2
  430. package/src/documentation/extension.ts +3 -3
  431. package/src/documentation/registry.ts +1 -1
  432. package/src/documentation/search.ts +1 -1
  433. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
  434. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  435. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  436. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +1 -1
  437. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  438. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +1 -1
  439. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  440. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  441. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +2 -2
  442. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +3 -3
  443. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  444. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/index.ts +1 -1
  445. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  446. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  447. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  448. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  449. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  450. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/doctor-plugin.ts +1 -1
  451. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +1 -1
  452. package/src/extensions/pi-agent-read/index.ts +1 -1
  453. package/src/extensions/pi-agent-read/package.json +7 -7
  454. package/src/extensions/pi-agent-read/src/api/connect-plugin.ts +1 -1
  455. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  456. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +1 -1
  457. package/src/extensions/pi-agent-read/src/api/rendering.ts +2 -2
  458. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -2
  459. package/src/extensions/pi-agent-read/src/core/extension.ts +4 -4
  460. package/src/extensions/pi-agent-read/src/core/read-core.ts +4 -4
  461. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +2 -2
  462. package/src/extensions/pi-agent-read/src/core/tools/read/persisted-result.ts +1 -1
  463. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +3 -3
  464. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +4 -4
  465. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +1 -1
  466. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +1 -1
  467. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +2 -2
  468. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +7 -7
  469. package/src/extensions/pi-agent-search/index.ts +1 -1
  470. package/src/extensions/pi-agent-search/package.json +5 -5
  471. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +8 -8
  472. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +10 -10
  473. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/doctor-plugin.ts +1 -1
  474. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +1 -1
  475. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +2 -2
  476. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +1 -1
  477. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +9 -9
  478. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +4 -4
  479. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +3 -3
  480. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +1 -1
  481. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -2
  482. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +3 -3
  483. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +2 -2
  484. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -1
  485. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +1 -1
  486. package/src/extensions/pi-agent-search/src/api/connect-plugin.ts +1 -1
  487. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +2 -2
  488. package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  489. package/src/extensions/pi-agent-search/src/api/presentation.ts +1 -1
  490. package/src/extensions/pi-agent-search/src/api/search-scope.ts +1 -1
  491. package/src/extensions/pi-agent-search/src/api/search.ts +7 -7
  492. package/src/extensions/pi-agent-search/src/core/extension.ts +7 -7
  493. package/src/extensions/pi-agent-search/src/core/search-core.ts +3 -3
  494. package/src/extensions/pi-agent-text-editor/index.ts +5 -5
  495. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  496. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/index.ts +1 -1
  497. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  498. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +2 -2
  499. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  500. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +2 -2
  501. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/recovery.ts +3 -3
  502. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -2
  503. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  504. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -1
  505. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -5
  506. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  507. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +3 -3
  508. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +1 -1
  509. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +2 -2
  510. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -4
  511. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +2 -2
  512. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +3 -3
  513. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +2 -2
  514. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +1 -1
  515. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +7 -7
  516. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  517. package/src/extensions/pi-agent-text-editor/src/api/connect-plugin.ts +1 -1
  518. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -2
  519. package/src/extensions/pi-agent-text-editor/src/api/file-operations.ts +2 -2
  520. package/src/extensions/pi-agent-text-editor/src/api/file-transfers.ts +1 -1
  521. package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +4 -4
  522. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -3
  523. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +2 -2
  524. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +1 -1
  525. package/src/extensions/pi-agent-text-editor/src/api/native-files.ts +1 -1
  526. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +14 -14
  527. package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +3 -3
  528. package/src/extensions/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
  529. package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +2 -2
  530. package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +3 -3
  531. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +3 -3
  532. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -13
  533. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +2 -2
  534. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -6
  535. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +5 -5
  536. package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
  537. package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +3 -3
  538. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +1 -1
  539. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +3 -3
  540. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +4 -4
  541. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -2
  542. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +1 -1
  543. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
  544. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +6 -6
  545. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +22 -22
  546. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +1 -1
  547. package/src/extensions/pi-agent-text-editor/src/core/read-fragment-resolver.ts +3 -3
  548. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +1 -1
  549. package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +2 -2
  550. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +4 -4
  551. package/src/extensions/pi-agent-text-editor/src/core/source-change-retry.ts +1 -1
  552. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +2 -2
  553. package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +2 -2
  554. package/src/extensions/pi-agent-text-editor/src/core/text-anchor-recovery.ts +1 -1
  555. package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +3 -3
  556. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +2 -2
  557. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +2 -2
  558. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +19 -19
  559. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -4
  560. package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +1 -1
  561. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +19 -19
  562. package/src/extensions/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +1 -1
  563. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +29 -29
  564. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +4 -4
  565. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +1 -1
  566. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -3
  567. package/src/extensions/pi-agent-text-editor/src/tools/extension.ts +7 -7
  568. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +2 -2
  569. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +4 -4
  570. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -4
  571. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +3 -3
  572. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -5
  573. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +4 -4
  574. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +1 -1
  575. package/src/index.ts +1 -1
  576. package/src/pi-agent-ide.ts +21 -21
  577. package/src/plugins/pi-agent-ide-ast/index.ts +1 -1
  578. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  579. package/src/plugins/pi-agent-ide-ast/src/api/scope.ts +1 -1
  580. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +2 -2
  581. package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +1 -1
  582. package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +5 -5
  583. package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +1 -1
  584. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  585. package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +3 -3
  586. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +1 -1
  587. package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +1 -1
  588. package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
  589. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +1 -1
  590. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +1 -1
  591. package/src/plugins/pi-agent-ide-changes/index.ts +9 -9
  592. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  593. package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +4 -4
  594. package/src/plugins/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
  595. package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +4 -4
  596. package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -1
  597. package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +4 -4
  598. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -5
  599. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -6
  600. package/src/plugins/pi-agent-ide-debugger/index.ts +11 -11
  601. package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +1 -1
  602. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +4 -4
  603. package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +2 -2
  604. package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +3 -3
  605. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +1 -1
  606. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +5 -5
  607. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +1 -1
  608. package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +1 -1
  609. package/src/plugins/pi-agent-ide-debugger/src/workspace-owner.ts +2 -2
  610. package/src/plugins/pi-agent-ide-diagnostics/index.ts +1 -1
  611. package/src/plugins/pi-agent-ide-formatter/index.ts +5 -5
  612. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  613. package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +2 -2
  614. package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +2 -2
  615. package/src/plugins/pi-agent-ide-formatter/src/registry.ts +1 -1
  616. package/src/plugins/pi-agent-ide-languages/index.ts +1 -1
  617. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  618. package/src/plugins/pi-agent-ide-lint/index.ts +9 -9
  619. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  620. package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +2 -2
  621. package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +3 -3
  622. package/src/plugins/pi-agent-ide-lint/src/registry.ts +1 -1
  623. package/src/plugins/pi-agent-ide-lsp/index.ts +17 -17
  624. package/src/plugins/pi-agent-ide-lsp/package.json +12 -12
  625. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +3 -3
  626. package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +3 -3
  627. package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +4 -4
  628. package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +7 -7
  629. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +9 -9
  630. package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
  631. package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostics.ts +4 -4
  632. package/src/plugins/pi-agent-ide-lsp/src/lsp/document-leases.ts +1 -1
  633. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +19 -19
  634. package/src/plugins/pi-agent-ide-lsp/src/lsp/language-map.ts +1 -1
  635. package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +4 -4
  636. package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +13 -13
  637. package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +3 -3
  638. package/src/plugins/pi-agent-ide-lsp/src/lsp/owner-transport.ts +1 -1
  639. package/src/plugins/pi-agent-ide-lsp/src/lsp/position-map.ts +1 -1
  640. package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +1 -1
  641. package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +2 -2
  642. package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +2 -2
  643. package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +17 -5
  644. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +7 -7
  645. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +3 -3
  646. package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +1 -1
  647. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +1 -1
  648. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +8 -8
  649. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +4 -4
  650. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +1 -1
  651. package/src/plugins/pi-agent-ide-processes/index.ts +4 -4
  652. package/src/plugins/pi-agent-ide-processes/src/ui.ts +1 -1
  653. package/src/plugins/pi-agent-ide-semantic/src/vera-backend.ts +2 -2
  654. package/src/plugins/pi-agent-ide-terminal/index.ts +17 -17
  655. package/src/plugins/pi-agent-ide-terminal/src/origin.ts +1 -1
  656. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
  657. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +3 -3
  658. package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +3 -3
  659. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -5
  660. package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +1 -1
  661. package/src/plugins/pi-agent-ide-terminal/src/search.ts +2 -2
  662. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +3 -3
  663. package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +1 -1
  664. package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +1 -1
  665. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +9 -9
  666. package/src/plugins/pi-agent-ide-terminal/src/types.ts +1 -1
  667. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +3 -3
  668. package/src/post-edit/gate.ts +1 -1
  669. package/src/semantic/extension.ts +2 -2
  670. package/src/semantic/index.ts +4 -4
  671. package/src/standalone/resource-host.ts +13 -13
  672. package/src/standalone/scoped-api.ts +2 -2
  673. package/src/tips/core.ts +1 -1
  674. package/src/tips/extension.ts +6 -6
  675. package/src/tips/setup-hint.ts +1 -1
  676. package/src/toolchain/diagnostic.ts +1 -1
  677. package/src/toolchain/registry.ts +1 -1
  678. package/dist/chunk-57F5GTHO.js +0 -1
  679. package/dist/chunk-6LAHSOAH.js +0 -25
  680. package/dist/chunk-DDLNVJHJ.js +0 -1
  681. package/dist/chunk-FEZLTM4L.js +0 -1
  682. package/dist/chunk-MDD5ORB6.js +0 -1
  683. package/dist/chunk-S5PL5DFQ.js +0 -1
@@ -1,5 +1,5 @@
1
- import{g as m,h as y,j as O,n as x,r as E}from"./chunk-SIYPD5MM.js";import{m as L,o as C}from"./chunk-ALZV2EYT.js";import{a as s}from"./chunk-EI7MMDWY.js";import{Type as o}from"typebox";import{Value as f}from"typebox/value";import{Type as u}from"typebox";var R=u.Object({path:u.Optional(u.String({description:"What to read: a supported resource such as a file or directory path, URL, returned temp: reference, SEARCH# or RESULT# reference, or registered protocol source. Supply a path; an empty call cannot select a source."})),offset:u.Optional(u.Number({description:"For raw: sources, use a zero-based byte offset; negative offsets count from the file end. For other sources: first line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end. For path#anchor, SEARCH or RESULT# selections, count from its containing line instead: 0 or 1 starts there, 2 starts one line later, -1 one line earlier. For image and sequence views, offset is a zero-based row-major grid cell index and requires limit."})),limit:u.Optional(u.Number({description:"For raw: sources, use a non-negative byte count (0 reads no bytes). Otherwise, maximum lines from the selected starting position. Output is bounded; omit for the default read. For image and sequence views, limit is the square grid cell size in pixels; omit offset to select cell 0, or omit both for the bounded full image."})),views:u.Optional(u.Array(u.String(),{description:`Optional source-specific presentations. Combine views when both presentations are needed, for example ["anchors", "ast"]. Omit for the source's default presentation.`}))}),_={path:"What to read: a path, URL, unchanged Read/Search result or its UUID, or one of the forms below. temp:<id> \u2014 saved output; raw:<file> \u2014 original bytes.",offset:"First line, from 1; negative counts from the end. For raw:, a byte offset.",limit:"Maximum lines. For raw:, bytes.",views:"Extra presentations; combine them unless a view says otherwise."};function de(e){let t=s((a,r)=>({...a,description:[_[r],e[r]].filter(d=>d!==void 0).join(`
2
- `)}),"describe");return{...R,properties:{path:t(R.properties.path,"path"),offset:t(R.properties.offset,"offset"),limit:t(R.properties.limit,"limit"),views:t(R.properties.views,"views")}}}s(de,"describeReadParameters");import{Type as n}from"typebox";function Re(e,t,a,r){if(!K(e))return{content:e,source:t,resolvedBy:a,preserveTruncatedOutput:r.preserveTruncatedOutput,textMode:r.textMode,contentKind:"other"};let d=e[0].text;return{content:e,source:t,resolvedBy:a,preserveTruncatedOutput:r.preserveTruncatedOutput,textMode:r.textMode,contentKind:"text",text:L(t,d)}}s(Re,"createReadState");function ye(e,t,a){if(e.contentKind!=="text"){if(t.offset!==void 0||t.limit!==void 0)return H({code:"UNSUPPORTED_RANGE",source:e.source,resolverId:e.resolvedBy,message:"Line ranges require textual content. Omit offset and limit to read this content without a line range."});let l=q(e.content);return{script:{kind:"native",source:e.source,blocks:e.content},content:l.content,details:{...k(e),...l.unsupportedContentBlocks!==void 0&&{unsupportedContentBlocks:l.unsupportedContentBlocks}}}}let r=e.text.lines.length,d=$(t,r,a?.originLine),i=e.text.lines.slice(d.startIndex,d.endIndex),c=d.endIndex<r,b=e.textMode==="final"||i.every(l=>l.presentation===void 0),T=b?M(i,c):C({...e.text,lines:i.map((l,j)=>({...l,lineEnding:j===i.length-1&&c?"":l.lineEnding}))}),S=e.content[0],B=[{type:"text",text:T,...S.textSignature!==void 0&&{textSignature:S.textSignature}}];return{script:{kind:"text",...e.text.references===void 0?{}:{references:e.text.references},source:e.source,content:b&&!c?T:i.map(l=>l.content+l.lineEnding).join(""),lines:i,startLine:i[0]?.lineNumber??0,endLine:i.at(-1)?.lineNumber??0,totalLines:r},content:B,details:{...k(e),startLine:i[0]?.lineNumber??0,endLine:i.at(-1)?.lineNumber??0,totalLines:r,lines:i}}}s(ye,"projectReadState");function M(e,t){return e.map((a,r)=>`${a.content}${r===e.length-1&&t?"":a.lineEnding}`).join("")}s(M,"renderFinalTextLines");function v(e){let t=e.cause,a,r=new Set;for(;t instanceof Error&&!r.has(t);)r.add(t),a=t,t=t.cause;return a}s(v,"deepestCause");var w="Supply path with a source or an unchanged result reference.",P=s(e=>`Read ${JSON.stringify(e)} with views=["anchors"] and choose a current anchor.`,"fragmentRecovery");function N(e){return e.candidates?.length?["Possible matches:",...e.candidates.map(t=>`- ${JSON.stringify(t.path)}`),"","Retry read with an exact candidate path."]:[]}s(N,"candidateLines");function D(e){let t=v(e),a=t!==void 0&&"code"in t?t.code:void 0,r=[];return a==="ENOENT"&&!e.candidates?.length&&r.push("Search for the correct path."),e.code==="INVALID_REQUEST"?r.push(w):e.code==="FRAGMENT_FAILED"&&e.source!==void 0?r.push(P(e.source)):e.code==="NO_RESOLVER"?r.push("Choose a supported source from the path parameter."):e.code==="NO_FRAGMENT_RESOLVER"&&r.push("Read the source without the anchor."),[...r,...N(e)]}s(D,"readFailureRecovery");function V(e){let t=v(e),a=t!==void 0&&"code"in t?t.code:void 0,r=t?.message||e.message;return a==="ENOENT"?r=e.candidates?.length?"Source not found.":"Source not found. Search for the correct path.":a==="EACCES"||a==="EPERM"?r="Access denied.":e.code==="INVALID_RESOLVER_RESULT"?r="The source provider returned an invalid result.":e.code==="INVALID_RESOURCE_CONTENT"?r="The source provider returned invalid content.":e.code==="UNSUPPORTED_CAPABILITY"?r="This source does not support reading.":e.code==="NO_RESOLVER"?r="This source is not supported. Choose a supported source from the path parameter.":e.code==="NO_FRAGMENT_RESOLVER"&&(r="This anchor is not supported. Read the source without the anchor."),e.code==="INVALID_REQUEST"?r+=`. ${w}`:e.code==="FRAGMENT_FAILED"&&e.source!==void 0&&(r+=`
1
+ import{g as m,h as y,j as O,n as x,r as E}from"./chunk-SIYPD5MM.js";import{m as L,o as C}from"./chunk-S7E2D5K7.js";import{a as s}from"./chunk-EI7MMDWY.js";import{Type as o}from"typebox";import{Value as f}from"typebox/value";import{Type as u}from"typebox";var R=u.Object({path:u.Optional(u.String({description:"What to read: a supported resource such as a file or directory path, URL, returned temp: reference, SEARCH# or RESULT# reference, or registered protocol source. Supply a path; an empty call cannot select a source."})),offset:u.Optional(u.Number({description:"For raw: sources, use a zero-based byte offset; negative offsets count from the file end. For other sources: first line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end. For path#anchor, SEARCH or RESULT# selections, count from its containing line instead: 0 or 1 starts there, 2 starts one line later, -1 one line earlier. For image and sequence views, offset is a zero-based row-major grid cell index and requires limit."})),limit:u.Optional(u.Number({description:"For raw: sources, use a non-negative byte count (0 reads no bytes). Otherwise, maximum lines from the selected starting position. Output is bounded; omit for the default read. For image and sequence views, limit is the square grid cell size in pixels; omit offset to select cell 0, or omit both for the bounded full image."})),views:u.Optional(u.Array(u.String(),{description:`Optional source-specific presentations. Combine views when both presentations are needed, for example ["anchors", "ast"]. Omit for the source's default presentation.`}))}),j={path:"What to read: a path, URL, unchanged Read/Search result or its UUID, or one of the forms below. temp:<id> \u2014 saved output; raw:<file> \u2014 original bytes.",offset:"First line, from 1; negative counts from the end. For raw:, a byte offset.",limit:"Maximum lines. For raw:, bytes.",views:"Extra presentations; combine them unless a view says otherwise."};function de(e){let t=s((a,r)=>({...a,description:[j[r],e[r]].filter(d=>d!==void 0).join(`
2
+ `)}),"describe");return{...R,properties:{path:t(R.properties.path,"path"),offset:t(R.properties.offset,"offset"),limit:t(R.properties.limit,"limit"),views:t(R.properties.views,"views")}}}s(de,"describeReadParameters");import{Type as n}from"typebox";function Re(e,t,a,r){if(!K(e))return{content:e,source:t,resolvedBy:a,preserveTruncatedOutput:r.preserveTruncatedOutput,textMode:r.textMode,contentKind:"other"};let d=e[0].text;return{content:e,source:t,resolvedBy:a,preserveTruncatedOutput:r.preserveTruncatedOutput,textMode:r.textMode,contentKind:"text",text:L(t,d)}}s(Re,"createReadState");function ye(e,t,a){if(e.contentKind!=="text"){if(t.offset!==void 0||t.limit!==void 0)return H({code:"UNSUPPORTED_RANGE",source:e.source,resolverId:e.resolvedBy,message:"Line ranges require textual content. Omit offset and limit to read this content without a line range."});let l=q(e.content);return{script:{kind:"native",source:e.source,blocks:e.content},content:l.content,details:{...k(e),...l.unsupportedContentBlocks!==void 0&&{unsupportedContentBlocks:l.unsupportedContentBlocks}}}}let r=e.text.lines.length,d=$(t,r,a?.originLine),i=e.text.lines.slice(d.startIndex,d.endIndex),c=d.endIndex<r,b=e.textMode==="final"||i.every(l=>l.presentation===void 0),T=b?M(i,c):C({...e.text,lines:i.map((l,_)=>({...l,lineEnding:_===i.length-1&&c?"":l.lineEnding}))}),S=e.content[0],B=[{type:"text",text:T,...S.textSignature!==void 0&&{textSignature:S.textSignature}}];return{script:{kind:"text",...e.text.references===void 0?{}:{references:e.text.references},source:e.source,content:b&&!c?T:i.map(l=>l.content+l.lineEnding).join(""),lines:i,startLine:i[0]?.lineNumber??0,endLine:i.at(-1)?.lineNumber??0,totalLines:r},content:B,details:{...k(e),startLine:i[0]?.lineNumber??0,endLine:i.at(-1)?.lineNumber??0,totalLines:r,lines:i}}}s(ye,"projectReadState");function M(e,t){return e.map((a,r)=>`${a.content}${r===e.length-1&&t?"":a.lineEnding}`).join("")}s(M,"renderFinalTextLines");function v(e){let t=e.cause,a,r=new Set;for(;t instanceof Error&&!r.has(t);)r.add(t),a=t,t=t.cause;return a}s(v,"deepestCause");var w="Supply path with a source or an unchanged result reference.",P=s(e=>`Read ${JSON.stringify(e)} with views=["anchors"] and choose a current anchor.`,"fragmentRecovery");function N(e){return e.candidates?.length?["Possible matches:",...e.candidates.map(t=>`- ${JSON.stringify(t.path)}`),"","Retry read with an exact candidate path."]:[]}s(N,"candidateLines");function D(e){let t=v(e),a=t!==void 0&&"code"in t?t.code:void 0,r=[];return a==="ENOENT"&&!e.candidates?.length&&r.push("Search for the correct path."),e.code==="INVALID_REQUEST"?r.push(w):e.code==="FRAGMENT_FAILED"&&e.source!==void 0?r.push(P(e.source)):e.code==="NO_RESOLVER"?r.push("Choose a supported source from the path parameter."):e.code==="NO_FRAGMENT_RESOLVER"&&r.push("Read the source without the anchor."),[...r,...N(e)]}s(D,"readFailureRecovery");function V(e){let t=v(e),a=t!==void 0&&"code"in t?t.code:void 0,r=t?.message||e.message;return a==="ENOENT"?r=e.candidates?.length?"Source not found.":"Source not found. Search for the correct path.":a==="EACCES"||a==="EPERM"?r="Access denied.":e.code==="INVALID_RESOLVER_RESULT"?r="The source provider returned an invalid result.":e.code==="INVALID_RESOURCE_CONTENT"?r="The source provider returned invalid content.":e.code==="UNSUPPORTED_CAPABILITY"?r="This source does not support reading.":e.code==="NO_RESOLVER"?r="This source is not supported. Choose a supported source from the path parameter.":e.code==="NO_FRAGMENT_RESOLVER"&&(r="This anchor is not supported. Read the source without the anchor."),e.code==="INVALID_REQUEST"?r+=`. ${w}`:e.code==="FRAGMENT_FAILED"&&e.source!==void 0&&(r+=`
3
3
  ${P(e.source)}`),`Read failed${e.source===void 0?"":` for ${JSON.stringify(e.source)}`}: ${r}`}s(V,"readFailureMessage");function ge(e,t,a){if(!a?.aborted||!e.isError)return e;let r=e.details.source??e.details.failure?.source??t;return{...e,content:[{type:"text",text:`Read cancelled${r===void 0?"":` for ${JSON.stringify(r)}`}. No completed result was returned.`}]}}s(ge,"withReadCancellation");function H(e){let t=e.cause instanceof y?e.cause:void 0;return t!==void 0?e={...e,source:e.source??t.source,message:`${t.code}: ${e.source??t.source}`,cause:new y(t.code,t.source,t.effect,{metadata:m(t)})}:e.cause instanceof Error&&"code"in e.cause&&!["ENOENT","EACCES","EPERM"].includes(String(e.cause.code))&&(e={...e,message:`${e.code}: ${e.source??"source"}`,cause:void 0}),{content:[{type:"text",text:[V(e),...e.candidates?.length?["",...N(e)]:[]].join(`
4
4
  `)}],details:{failure:e},isError:!0}}s(H,"failureResult");function k(e){return{source:e.source,resolvedBy:e.resolvedBy}}s(k,"readDetails");function q(e){let t=[],a=[];for(let[d,i]of e.entries()){if(i.type!=="custom"){t.push(i);continue}a.push({index:d,kind:i.kind}),t.push({type:"text",text:`[unsupported_content_block kind=${i.kind} index=${d}]`})}let r=a[0];return{content:t,...r!==void 0&&{unsupportedContentBlocks:[r,...a.slice(1)]}}}s(q,"projectAgentContent");function $(e,t,a){let r=e.offset===void 0?1:Math.trunc(e.offset),d=G(r,t,a),i=e.limit===void 0?t:Math.max(0,Math.trunc(e.limit));return{startIndex:Math.min(t,d-1),endIndex:Math.min(t,d-1+i)}}s($,"resolveTextRange");function G(e,t,a){if(a===void 0)return e<0?Math.max(1,t+e+1):Math.max(1,e);let r=e<0?a+e:a+Math.max(1,e)-1;return Math.max(1,r)}s(G,"anchoredStartLine");function K(e){return e.length===1&&e[0].type==="text"}s(K,"isSingleTextContent");var W=n.Object({value:n.String(),kind:n.String(),state:n.Optional(n.String())},{additionalProperties:!1}),J=n.Object({lineNumber:n.Integer(),content:n.String(),lineEnding:n.String(),anchors:n.Optional(n.Array(n.String()))},{additionalProperties:!1}),z=n.Object({path:n.String(),offset:n.Integer()},{additionalProperties:!1}),h={source:n.String(),truncated:n.Boolean(),continuation:n.Optional(z),fullResult:n.Optional(n.String())},A=n.Object({...h,kind:n.Literal("text"),target:n.Optional(n.String()),lines:n.Array(J),startLine:n.Integer(),endLine:n.Integer(),totalLines:n.Integer(),references:n.Optional(n.Array(W))},{additionalProperties:!1}),I=n.Object({...h,kind:n.Literal("bytes"),bytes:n.Array(n.Integer({minimum:0,maximum:255})),byteOffset:n.Integer(),byteLength:n.Integer(),totalBytes:n.Integer()},{additionalProperties:!1}),Q=n.Union([n.Object({type:n.Literal("text"),text:n.String()},{additionalProperties:!1}),n.Object({type:n.Literal("image"),mimeType:n.String()},{additionalProperties:!1})]),F=n.Object({...h,kind:n.Literal("native"),blocks:n.Array(Q)},{additionalProperties:!1}),g=n.Union([n.Object({kind:n.Literal("recovery"),source:n.String(),candidates:n.Array(n.Object({path:n.String()},{additionalProperties:!1}))},{additionalProperties:!1}),A,I,F,n.Object({kind:n.Literal("resources"),source:n.Optional(n.String()),resources:n.Array(n.Union([A,I,F])),truncated:n.Boolean(),fullResult:n.Optional(n.String())},{additionalProperties:!1})]),Y=O(g);function X(e){return{lineNumber:e.lineNumber,content:e.content,lineEnding:e.lineEnding,...e.anchors===void 0?{}:{anchors:[...e.anchors]}}}s(X,"publicLine");function U(e){if(e.kind==="resources"){let i=e.resources.map(c=>U(c));return{kind:e.kind,...e.source===void 0?{}:{source:e.source},resources:i,truncated:i.some(c=>typeof c=="object"&&c!==null&&"truncated"in c&&c.truncated===!0)}}if(e.kind==="bytes"){let i=e.bytes.slice(0,32768),c=e.truncated===!0||i.length<e.bytes.length;return{kind:e.kind,source:e.source,bytes:i,byteOffset:e.byteOffset,byteLength:i.length,totalBytes:e.totalBytes,truncated:c,...e.byteOffset+i.length<e.totalBytes?{continuation:{path:e.source,offset:e.byteOffset+i.length}}:{}}}if(e.kind==="native")return{kind:e.kind,source:e.source,truncated:!1,blocks:e.blocks.map(i=>{if(i.type==="text")return{type:i.type,text:i.text};if(i.type==="image")return{type:i.type,mimeType:i.mimeType};throw new TypeError("Custom content requires a structured adapter")})};let t=[],a=0;for(let i of e.lines){let c=X(i);if(a+=Buffer.byteLength(JSON.stringify(c)),t.length>=2e3||a>512*1024)break;t.push(c)}if(t.length===0&&e.lines.length>0)throw new RangeError("Selected line exceeds the structured window; use a raw byte range or a source-specific view");let r=t.length<e.lines.length,d=t.at(-1)?.lineNumber??e.startLine-1;return{kind:e.kind,source:e.source,...e.target===void 0?{}:{target:e.target},lines:t,startLine:t[0]?.lineNumber??0,endLine:t.at(-1)?.lineNumber??0,totalLines:e.totalLines,truncated:r,...e.target===void 0?{}:{target:e.target},...e.references===void 0?{}:{references:e.references},...r||d<e.totalLines?{continuation:{path:e.source,offset:d+1}}:{}}}s(U,"publicData");function Z(e){let t=e.details.failure,a=t?.cause instanceof y?t.cause:void 0,r=a===void 0?void 0:m(a);if(e.isError||t!==void 0)return x(e,g,{status:"error",...t?.candidates?.length&&t.source!==void 0?{data:{kind:"recovery",source:t.source,candidates:t.candidates}}:{},errors:[{code:a?.code??t?.code??"READ_FAILED",message:a===void 0?[t?.message??"Read failed",...t===void 0?[]:D(t)].join(`
5
5
  `):`${a.code}: ${t?.source??a.source}`,...t?.source===void 0?{}:{source:t.source},...r===void 0?{}:{metadata:r}}]});try{if(e.script===void 0)throw new TypeError("Read handler must return structured script data");let d=U(e.script);return x(e,g,{status:"success",data:e.details.temporarySource!==void 0&&typeof d=="object"&&d!==null?{...d,fullResult:e.details.temporarySource}:d,errors:[]})}catch(d){return x(e,g,{status:"error",errors:[{code:d instanceof RangeError?"STRUCTURED_RESULT_TOO_LARGE":"STRUCTURED_ADAPTER_REQUIRED",message:d instanceof Error?d.message:String(d)}]})}}s(Z,"structuredRead");var p=o.Function([],o.Unknown()),ee=o.Object({resolver:o.Unknown(),matchesCall:o.Optional(p),renderCall:o.Optional(p),priority:o.Optional(o.Number()),renderResult:o.Optional(p),preserveTruncatedOutput:o.Optional(o.Boolean())}),te=o.Object({resolver:o.Unknown(),priority:o.Optional(o.Number())}),ne=o.Object({id:o.String({pattern:"\\S"}),priority:o.Optional(o.Number()),resolve:p}),re=o.Object({view:o.String({pattern:"\\S"}),contentKind:o.Optional(o.Union([o.Literal("text"),o.Literal("any")])),includes:o.Optional(o.Array(o.String({pattern:"\\S"}))),showsLinesOutsideRange:o.Optional(o.Boolean()),presenter:o.Object({id:o.String(),present:p}),priority:o.Optional(o.Number())}),oe=o.Object({resolvedBy:o.String({pattern:"\\S"}),contentKind:o.Union([o.Literal("text"),o.Literal("any")])}),ae=o.Union([o.Object({stage:o.Literal("pre-read"),handler:p}),o.Object({stage:o.Literal("read"),when:oe,handler:p}),o.Object({stage:o.Literal("post-read"),handler:p})]);function Ce(e){if(!f.Check(te,e))return!1;let t=e,a=t.resolver;return typeof a.id=="string"&&a.id.length>0&&typeof a.tryResolve=="function"&&(!("priority"in t)||typeof t.priority=="number")}s(Ce,"isTextTargetResolverRegistration");function ke(e){if(!f.Check(ee,e))return!1;let t=e;return E(t.resolver)?t.resolver.id!=="any"&&(!("priority"in t)||typeof t.priority=="number")&&(!("matchesCall"in t)||typeof t.matchesCall=="function")&&(!("renderCall"in t)||typeof t.renderCall=="function")&&"matchesCall"in t=="renderCall"in t&&(!("renderResult"in t)||typeof t.renderResult=="function"):!1}s(ke,"isResourceResolverRegistration");function ve(e){return f.Check(ae,e)}s(ve,"isReadHandlerRegistration");function we(e){return f.Check(re,e)}s(we,"isReadViewRegistration");function Pe(e){return f.Check(ne,e)}s(Pe,"isFragmentResolverRegistration");function Ne(e){return ie(e)?e.kind==="not-handled"?!0:e.kind==="failed"?typeof e.message=="string"&&e.message.length>0:e.kind==="resolved"&&typeof e.originLine=="number":!1}s(Ne,"isReadFragmentResolution");function ie(e){return typeof e=="object"&&e!==null}s(ie,"isRecord");export{R as a,de as b,Re as c,ye as d,ge as e,H as f,$ as g,G as h,g as i,Y as j,Z as k,Ce as l,ke as m,ve as n,we as o,Pe as p,Ne as q};
@@ -1,4 +1,4 @@
1
- import{c as q}from"./chunk-756K3LJY.js";import{m as E}from"./chunk-ALZV2EYT.js";import{a}from"./chunk-EI7MMDWY.js";import O from"cross-spawn";import{fileURLToPath as S}from"node:url";var T=5e3,R=10*1024*1024,P=S(new URL(".",new URL("../src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts",import.meta.url).href));function j(n){let t=n?.filter(r=>r==="jq"||r.startsWith("jq:"))??[];if(t.length===0)return;if(t.length>1)throw new Error("Read accepts only one jq view");if(n?.length!==1)throw new Error("The jq view cannot be combined with other views. Keep only one jq:<filter> in views.");let e=t[0];if(e===void 0||e==="jq"||e.slice(3).trim().length===0)throw new Error('The jq view requires a filter, for example views: ["jq:.scripts"]');return{filter:e.slice(3)}}a(j,"parseJqView");function y(n,t,e){return e.signal?.aborted===!0?Promise.reject(new Error("jq execution was cancelled")):J(n)?Promise.reject(new Error("jq module loading is disabled")):new Promise((r,s)=>{let i=O(e.command??"jq",["-L",P,"--",n],{cwd:e.cwd,env:b(e.cwd),shell:!1,stdio:["pipe","pipe","pipe"],windowsHide:!0}),d="",u="",c=!1,p=0,l=a(o=>{c||(c=!0,clearTimeout(h),e.signal?.removeEventListener("abort",m),o===void 0?r(d):s(o))},"finish"),g=a(o=>{i.kill(),l(o)},"stop"),m=a(()=>g(new Error("jq execution was cancelled")),"abort"),h=setTimeout(()=>g(new Error(`jq did not finish within ${T/1e3} seconds`)),T);h.unref(),e.signal?.addEventListener("abort",m,{once:!0}),i.stdout?.setEncoding("utf8"),i.stderr?.setEncoding("utf8"),i.stdout?.on("data",o=>{if(p+=Buffer.byteLength(o),p>R){g(new Error(`jq output exceeded ${R/1024/1024}MB`));return}d+=o}),i.stderr?.on("data",o=>{Buffer.byteLength(u)<16384&&(u+=o)}),i.once("error",o=>l(new Error(`Cannot start jq: ${o.message}`))),i.once("close",(o,w)=>{if(!c)if(o===0)l();else{let x=u.trim().split(/\r?\n/u).slice(0,8).join(`
1
+ import{c as q}from"./chunk-756K3LJY.js";import{m as E}from"./chunk-S7E2D5K7.js";import{a}from"./chunk-EI7MMDWY.js";import O from"cross-spawn";import{fileURLToPath as S}from"node:url";var T=5e3,R=10*1024*1024,P=S(new URL(".",new URL("../src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts",import.meta.url).href));function j(n){let t=n?.filter(r=>r==="jq"||r.startsWith("jq:"))??[];if(t.length===0)return;if(t.length>1)throw new Error("Read accepts only one jq view");if(n?.length!==1)throw new Error("The jq view cannot be combined with other views. Keep only one jq:<filter> in views.");let e=t[0];if(e===void 0||e==="jq"||e.slice(3).trim().length===0)throw new Error('The jq view requires a filter, for example views: ["jq:.scripts"]');return{filter:e.slice(3)}}a(j,"parseJqView");function y(n,t,e){return e.signal?.aborted===!0?Promise.reject(new Error("jq execution was cancelled")):J(n)?Promise.reject(new Error("jq module loading is disabled")):new Promise((r,s)=>{let i=O(e.command??"jq",["-L",P,"--",n],{cwd:e.cwd,env:b(e.cwd),shell:!1,stdio:["pipe","pipe","pipe"],windowsHide:!0}),d="",u="",c=!1,p=0,l=a(o=>{c||(c=!0,clearTimeout(h),e.signal?.removeEventListener("abort",m),o===void 0?r(d):s(o))},"finish"),g=a(o=>{i.kill(),l(o)},"stop"),m=a(()=>g(new Error("jq execution was cancelled")),"abort"),h=setTimeout(()=>g(new Error(`jq did not finish within ${T/1e3} seconds`)),T);h.unref(),e.signal?.addEventListener("abort",m,{once:!0}),i.stdout?.setEncoding("utf8"),i.stderr?.setEncoding("utf8"),i.stdout?.on("data",o=>{if(p+=Buffer.byteLength(o),p>R){g(new Error(`jq output exceeded ${R/1024/1024}MB`));return}d+=o}),i.stderr?.on("data",o=>{Buffer.byteLength(u)<16384&&(u+=o)}),i.once("error",o=>l(new Error(`Cannot start jq: ${o.message}`))),i.once("close",(o,w)=>{if(!c)if(o===0)l();else{let x=u.trim().split(/\r?\n/u).slice(0,8).join(`
2
2
  `);l(new Error(x||`jq exited ${w===null?`with code ${String(o)}`:`after signal ${w}`}`))}}),i.stdin?.once("error",o=>l(new Error(`Cannot send JSON to jq: ${o.message}`))),i.stdin?.end(t)})}a(y,"executeJq");function J(n){let t=[0],e=0,r="";for(;e<n.length;){let s=n[e],i=t.at(-1);if(i==="string"){s==="\\"?(n[e+1]==="("&&(t.push(0),r=""),e+=2):(s==='"'&&(t.pop(),r='"'),e+=1);continue}if(s==="#"){let d=n.indexOf(`
3
3
  `,e);e=d<0?n.length:d+1;continue}if(s==='"')t.push("string");else if(s==="(")t[t.length-1]=(i??0)+1;else if(s===")")t.length>1&&i===0?t.pop():t[t.length-1]=Math.max(0,(i??0)-1);else if(/[A-Za-z_]/u.test(s??"")){let d=e;for(;/[A-Za-z0-9_]/u.test(n[e]??"");)e+=1;let u=n.slice(d,e),c=_(n,e),p=r==="."||r==="$",l=c.startsWith(":")&&!c.startsWith("::");if(!p&&!l&&(u==="include"||u==="import"||u==="modulemeta"))return!0;r=u;continue}s!==void 0&&!/\s/u.test(s)&&(r=s),e+=1}return!1}a(J,"hasModuleOperation");function _(n,t){let e=t;for(;e<n.length;)if(/\s/u.test(n[e]??""))e+=1;else if(n[e]==="#"){let r=n.indexOf(`
4
4
  `,e);e=r<0?n.length:r+1}else break;return n.slice(e,e+2)}a(_,"nextCode");function b(n){let t=q(n,process.env),e={};for(let r of["PATH","PATHEXT","SystemRoot","SYSTEMROOT","WINDIR"])t[r]!==void 0&&(e[r]=t[r]);return e}a(b,"safeEnvironment");function $(n){return async t=>{let e;try{e=j(t.request.views)}catch(u){return f(t,n.pluginId,"READ_FAILED",v(u))}if(e===void 0)return{kind:"continue",context:t};if(t.inputScope==="selection"||t.sourceTarget!==void 0)return f(t,n.pluginId,"UNSUPPORTED_RANGE","jq requires a complete JSON source. Read its explicit path instead of a result, search selection or text anchor.");if(t.inputScope!=="source")return f(t,n.pluginId,"READ_FAILED","This jq view requires a matching Read host that classifies complete source inputs.");let r=t.state;if(r?.contentKind!=="text")return f(t,n.pluginId,"UNSUPPORTED_CONTENT","This source does not supply structured JSON for jq.");let s=n.input(t);if(typeof s!="string")return f(t,n.pluginId,"UNSUPPORTED_CONTENT","This source does not supply structured JSON for jq.");let i;try{i=await y(e.filter,s,{cwd:t.resolverContext.cwd,...t.resolverContext.signal===void 0?{}:{signal:t.resolverContext.signal}})}catch(u){return f(t,n.pluginId,"READ_FAILED",v(u))}let d={...r,content:[{type:"text",text:i}],text:E(r.source,i),preserveTruncatedOutput:!0};return{kind:"continue",context:{...t,sourceText:void 0,sourceTarget:void 0,state:d}}}}a($,"createJqReadHandler");function v(n){return n instanceof Error?n.message:String(n)}a(v,"message");function f(n,t,e,r){let s=n.state?.source??n.request.path,i=n.state?.resolvedBy;return{kind:"return",result:{content:[{type:"text",text:`jq failed: ${r}`}],details:{source:s,resolvedBy:i,failure:{code:e,source:s,resolverId:i,pluginId:t,stage:"read",message:r}},isError:!0}}}a(f,"failure");export{$ as a};
@@ -1,6 +1,6 @@
1
- import{a as Z}from"./chunk-K5M65CAF.js";import{a as ee}from"./chunk-GCJHOMSI.js";import{c as J}from"./chunk-HFCHOFLV.js";import{m as k}from"./chunk-ALZV2EYT.js";import{a as w}from"./chunk-ZC65Z3CK.js";import{a as u}from"./chunk-EI7MMDWY.js";import{createHash as me}from"node:crypto";import{open as Be,readFile as Pe}from"node:fs/promises";import x from"node:path";import{spawn as Re}from"node:child_process";import{stat as Ce}from"node:fs/promises";import E from"node:path";import{createInterface as ke}from"node:readline";function z(e,t=!1){let n=j(e);return L(n)?_($(new I(e,n).parse(),t)):t?e:G(e)}u(z,"compileSearchQuery");function Q(e,t=!1){let n=j(e);return L(n)?$(new I(e,n).parse(),t):void 0}u(Q,"compileSearchCondition");function A(e,t){if(e.kind==="term")return t(e.value);let n=A(e.left,t);if(e.kind==="or")return n||A(e.right,t);let r=A(e.right,t);return n&&(e.kind==="not"?!r:r)}u(A,"satisfiesSearchCondition");function ne(e){if(L(j(e)))return;let t=[...new Set(e.trim().split(/\s+/u).filter(Boolean))];return t.length>1?`(?:${t.map(G).join("|")})`:void 0}u(ne,"compileSearchFallbackQuery");function L(e){return e.some(t=>t.quoted===!0||t.type==="and"||t.type==="or"||t.type==="not")}u(L,"containsBooleanSyntax");var I=class{static{u(this,"BooleanQueryParser")}#e;#r;#s=0;constructor(t,n){this.#e=t,this.#r=n}parse(){let t=this.#o(),n=this.#t();if(n.type!=="end"){let r=n.type==="right"?"unexpected ')'.":`unexpected ${Te(n)}.`;throw R(n.offset,r)}return t}#o(){let t=this.#n();for(;this.#t().type==="or";){let n=this.#i(),r=this.#a(`after ${n.value}`);t={kind:"or",left:t,right:this.#c(r)}}return t}#n(){return this.#c(this.#a())}#c(t){let n=t;for(;;){let r=this.#t();if(r.type==="and"||r.type==="not"){this.#i();let o=this.#a(`after ${r.value}`);n={kind:r.type,left:n,right:o};continue}if(r.type==="term"||r.type==="left"){n={kind:"and",left:n,right:this.#a()};continue}return n}}#a(t){let n=this.#t();if(n.type==="term")return this.#i(),{kind:"term",value:n.value,quoted:n.quoted};if(n.type==="left"){if(this.#i(),this.#t().type==="right"||this.#t().type==="end")throw R(this.#t().offset,"expected a term after '('.");let o=this.#o();if(this.#t().type!=="right")throw R(this.#t().offset,"expected ')'.");return this.#i(),o}if(t===void 0&&(n.type==="and"||n.type==="or"||n.type==="not"))throw R(n.offset,`expected a term before ${n.value}.`);let r=t===void 0?"":` ${t}`;throw R(n.offset,`expected a term${r}.`)}#t(){return this.#r[this.#s]??{type:"end",value:"",offset:this.#e.length}}#i(){let t=this.#t();return this.#s+=1,t}};function j(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(/\s/u.test(r)){n+=1;continue}if(r==="("&&xe(e,n)){t.push({type:"left",value:r,offset:n}),n+=1;continue}if(r===")"){t.push({type:"right",value:r,offset:n}),n+=1;continue}if(te(e,n)){let i=e.charAt(n+1)==="|"?2:1;t.push({type:"or",value:e.slice(n,n+i),offset:n}),n+=i;continue}if(r==="'"||r==='"'){let i=n,c=r,s="";for(n+=1;n<e.length&&e.charAt(n)!==c;)e.charAt(n)==="\\"&&(e.charAt(n+1)===c||e.charAt(n+1)==="\\")&&(n+=1),s+=e.charAt(n++);if(n>=e.length)throw R(i,`unterminated ${c==="'"?"single":"double"}-quoted term.`);if(n+=1,s.length===0)throw R(i,"quoted terms must not be empty.");t.push({type:"term",value:s,offset:i,quoted:!0});continue}let o=n;for(;n<e.length;){let i=e.charAt(n);if(/\s/u.test(i)||i===")"||te(e,n))break;i==="\\"&&n+1<e.length?n+=2:i==="["||i==="("?n=U(e,n)??n+1:n+=1}let a=e.slice(o,n);t.push({type:we(a),value:a,offset:o})}return t.push({type:"end",value:"",offset:e.length}),t}u(j,"tokenize");function te(e,t){return e.charAt(t)==="|"&&(e.charAt(t+1)==="|"||/\s/u.test(e.charAt(t-1))&&/\s/u.test(e.charAt(t+1)))}u(te,"isBooleanPipe");function U(e,t){let n=e.charAt(t)==="["?"]":")",r=t+1;for(;r<e.length;){let o=e.charAt(r);if(o==="\\")r+=2;else{if(o===n)return r+1;if(n===")"&&(o==="("||o==="[")){let a=U(e,r);if(a===void 0)return;r=a}else r+=1}}}u(U,"regexBlockEnd");function xe(e,t){let n=U(e,t);if(n===void 0)return!0;let r=e.slice(t+1,n-1);return r.trim().length===0?!0:L(j(r))}u(xe,"isBooleanGroup");function we(e){return e==="AND"?"and":e==="OR"?"or":e==="NOT"?"not":"term"}u(we,"operatorType");function Te(e){return e.value.length>0?JSON.stringify(e.value):"the end of the query"}u(Te,"quoteToken");function R(e,t){return new SyntaxError(`Invalid Boolean search query at column ${String(e+1)}: ${t}`)}u(R,"syntaxError");function $(e,t){return e.kind==="term"?{kind:"term",value:t&&!e.quoted?e.value:G(e.value)}:{kind:e.kind,left:$(e.left,t),right:$(e.right,t)}}u($,"compileTerms");function _(e){if(e.kind==="term")return e.value;let t=_(e.left);return e.kind==="not"?t:`(?:${t}|${_(e.right)})`}u(_,"matchPattern");function G(e){return e.replace(/[\\^$.*+?()[\]{}|]/gu,"\\$&")}u(G,"escapeRegex");function ie(e){if(e.multiline===!0){if(e.condition!==void 0)throw new Error("Boolean conditions check single lines and cannot be combined with multiline. Use one regex with multiline instead.");return}if(/\r|\n/u.test(e.query))throw new Error("A pattern with line breaks requires multiline: true.")}u(ie,"assertSupportedPattern");function se(e){return e.multiline===!0?["--multiline","--multiline-dotall"]:[]}u(se,"multilineArguments");async function K(e,t,n,r,o){if(e.query.length===0)throw new Error("Search query must not be empty.");return ie(e),e.condition!==void 0?ae(e,(a,i)=>re(a,t,n,i,void 0,o),n):re(e,t,n,void 0,r,o)}u(K,"searchText");async function ve(e,t,n,r){if(n===void 0&&(e.path?.includes("://")||t.includes("://")))throw new Error("No search environment owns this scope.");let o=n?.resolve(t,oe(e.path??"."))??E.resolve(t,oe(e.path??".")),a=n===void 0?(await Ce(o)).isDirectory():await n.isDirectory(o,r);return{cwd:a?o:n?.dirname(o)??E.dirname(o),target:a?".":`./${n?.basename(o)??E.basename(o)}`,arguments:["--no-config","--no-ignore-parent","--color=never",...J(e.include).flatMap(i=>["--glob",i]),...J(e.exclude).flatMap(i=>["--glob",`!${i}`])]}}u(ve,"ripgrepScope");async function Ae(e,t,n,r){if(ie(e),e.condition!==void 0)return ae(e,async(a,i)=>{let c=await Ae(a,t,n,r);for(let s of c.matches)i?.(s.source,s.lineNumber);return c},r);let o=await O(["--json","--no-config","--color=never","--with-filename","--line-number",...e.regex===!0?["--engine","auto"]:["--fixed-strings"],e.caseSensitive===!0?"--case-sensitive":"--ignore-case",...e.wholeWord===!0?["--word-regexp"]:[],...se(e),"--",e.query,"-"],n,r,void 0,void 0,t.length===0?`
2
- `:t);return t.length===0?{...o,matches:o.matches.filter(a=>a.lineNumber===1&&a.startColumn===0&&a.endColumn===0)}:o}u(Ae,"searchTextContent");async function re(e,t,n,r,o,a){let i=await ve(e,t,a,n),c=i.cwd,s=["--json","--with-filename","--line-number",e.caseSensitive===!0?"--case-sensitive":"--ignore-case",...e.wholeWord===!0?["--word-regexp"]:[],...se(e),...i.arguments,"--",e.query,i.target];if(e.regex!==!0)return O(["--fixed-strings",...s],c,n,r,o,void 0,a);try{return await O(["--engine","auto",...s],c,n,r,o,void 0,a)}catch(l){if(!Me(l))throw l instanceof Error&&/PCRE2 is not available|does not support PCRE2/iu.test(l.message)?new Error("This regex requires PCRE2. Install ripgrep with PCRE2 support or simplify the regex.",{cause:l}):l;try{return await O(["--engine","default",...s],c,n,r,o,void 0,a)}catch(d){throw n?.aborted?d:new AggregateError([l,d],"Regex exceeded the PCRE2 match limit and cannot run with the default engine. Narrow the search or simplify the regex.",{cause:d})}}}u(re,"searchPattern");async function ae(e,t,n){let r=e.condition;if(r===void 0)throw new Error("Boolean search requires a line condition.");let o=new Set;function a(p){if(p.kind==="term"){o.add(p.value);return}a(p.left),a(p.right)}u(a,"collect"),a(r);let{condition:i,...c}=e,s=new Map,l=u(p=>JSON.stringify([p.source,p.lineNumber]),"lineKey");for(let p of o){n?.throwIfAborted();let f=new Set;await t({...c,query:p,regex:!0,wholeWord:!1},(m,y)=>f.add(JSON.stringify([m,y]))),s.set(p,f)}let d=await t(c),h=new Set,g=d.matches.filter(p=>{let f=l(p);return h.has(f)||!A(r,m=>s.get(m)?.has(f)===!0)?!1:(h.add(f),!0)});return{...d,matches:g}}u(ae,"searchBoolean");function O(e,t,n,r,o,a,i){return i!==void 0?Ee(e,t,i,n,r,o):new Promise((c,s)=>{let l=Re(Z(),e,{stdio:["pipe","pipe","pipe"],cwd:t}),d=0,h=!1;o!==void 0&&l.stdout.on("data",S=>{d+=S.length,d>o.bytes&&(h=!0,l.kill())});let g=ke({input:l.stdout});l.stdin.on("error",()=>{}),l.stdin.end(a);let p=[],f="",m,y=u(()=>{l.kill()},"abort"),T=u(()=>{n?.removeEventListener("abort",y),g.close()},"cleanup");l.stderr.setEncoding("utf8"),l.stderr.on("data",S=>{f+=S}),g.on("line",S=>{if(!(h||m!==void 0||S.length===0))try{let b=JSON.parse(S);if(b.type!=="match")return;if(r!==void 0){let{path:P,line_number:Y}=b.data;P.text!==void 0&&Number.isSafeInteger(Y)&&r(E.resolve(t,P.text),Y);return}for(let P of ce(b,t)){if(o!==void 0&&p.length===o.matches){h=!0,l.kill();break}p.push(P)}}catch(b){m=b,l.kill()}}),l.once("error",S=>{T(),s(S)}),l.once("close",S=>{if(T(),n?.aborted===!0){let b=new Error("Search was aborted.");b.name="AbortError",s(b);return}if(m!==void 0){s(new Error("Unable to parse ripgrep search output.",{cause:m}));return}if(!h&&S!==0&&S!==1){s(new Error(f.trim()||`ripgrep exited with code ${String(S)}.`));return}p.sort(ue),c({matches:p,complete:!h})}),n?.addEventListener("abort",y,{once:!0}),n?.aborted===!0&&y()})}u(O,"runRipgrep");async function Ee(e,t,n,r,o,a){let i=[],c=new AbortController,s=u(()=>c.abort(r?.reason),"abort");r?.addEventListener("abort",s,{once:!0}),r?.aborted&&s();let l=0,d={limited:!1};try{let h=await n.runLines(e,t,g=>{if(d.limited||!g.length)return;if(l+=Buffer.byteLength(g)+1,a!==void 0&&l>a.bytes){d.limited=!0,c.abort();return}let p=JSON.parse(g);if(p.type==="match"){if(o!==void 0){let f=p.data.path.text;f!==void 0&&Number.isSafeInteger(p.data.line_number)&&o(n.resolve(t,f),p.data.line_number);return}for(let f of ce(p,t,n)){if(a!==void 0&&i.length>=a.matches){d.limited=!0,c.abort();break}i.push(f)}}},c.signal);if(h.code!==0&&h.code!==1)throw new Error(h.stderr.trim()||"Ripgrep failed.")}catch(h){if(r?.throwIfAborted(),!d.limited)throw h}finally{r?.removeEventListener("abort",s)}return r?.throwIfAborted(),i.sort(ue),{matches:i,complete:!d.limited}}u(Ee,"runOwnedRipgrep");function Me(e){return e instanceof Error&&/PCRE2: error matching: match limit exceeded/iu.test(e.message)}u(Me,"isPcre2MatchLimitError");function ce(e,t,n){let r=e.data.path.text,o=e.data.lines.text;if(r===void 0||o===void 0||!Number.isSafeInteger(e.data.line_number))return[];let a=o.split(`
1
+ import{a as Z}from"./chunk-K5M65CAF.js";import{a as ee}from"./chunk-P7FUD4WY.js";import{c as J}from"./chunk-HFCHOFLV.js";import{m as k}from"./chunk-S7E2D5K7.js";import{a as w}from"./chunk-ZC65Z3CK.js";import{a as u}from"./chunk-EI7MMDWY.js";import{createHash as me}from"node:crypto";import{open as Be,readFile as Pe}from"node:fs/promises";import x from"node:path";import{spawn as Re}from"node:child_process";import{stat as Ce}from"node:fs/promises";import E from"node:path";import{createInterface as ke}from"node:readline";function z(e,t=!1){let n=O(e);return L(n)?_($(new I(e,n).parse(),t)):t?e:G(e)}u(z,"compileSearchQuery");function Q(e,t=!1){let n=O(e);return L(n)?$(new I(e,n).parse(),t):void 0}u(Q,"compileSearchCondition");function A(e,t){if(e.kind==="term")return t(e.value);let n=A(e.left,t);if(e.kind==="or")return n||A(e.right,t);let r=A(e.right,t);return n&&(e.kind==="not"?!r:r)}u(A,"satisfiesSearchCondition");function ne(e){if(L(O(e)))return;let t=[...new Set(e.trim().split(/\s+/u).filter(Boolean))];return t.length>1?`(?:${t.map(G).join("|")})`:void 0}u(ne,"compileSearchFallbackQuery");function L(e){return e.some(t=>t.quoted===!0||t.type==="and"||t.type==="or"||t.type==="not")}u(L,"containsBooleanSyntax");var I=class{static{u(this,"BooleanQueryParser")}#e;#r;#s=0;constructor(t,n){this.#e=t,this.#r=n}parse(){let t=this.#o(),n=this.#t();if(n.type!=="end"){let r=n.type==="right"?"unexpected ')'.":`unexpected ${Te(n)}.`;throw R(n.offset,r)}return t}#o(){let t=this.#n();for(;this.#t().type==="or";){let n=this.#i(),r=this.#a(`after ${n.value}`);t={kind:"or",left:t,right:this.#c(r)}}return t}#n(){return this.#c(this.#a())}#c(t){let n=t;for(;;){let r=this.#t();if(r.type==="and"||r.type==="not"){this.#i();let o=this.#a(`after ${r.value}`);n={kind:r.type,left:n,right:o};continue}if(r.type==="term"||r.type==="left"){n={kind:"and",left:n,right:this.#a()};continue}return n}}#a(t){let n=this.#t();if(n.type==="term")return this.#i(),{kind:"term",value:n.value,quoted:n.quoted};if(n.type==="left"){if(this.#i(),this.#t().type==="right"||this.#t().type==="end")throw R(this.#t().offset,"expected a term after '('.");let o=this.#o();if(this.#t().type!=="right")throw R(this.#t().offset,"expected ')'.");return this.#i(),o}if(t===void 0&&(n.type==="and"||n.type==="or"||n.type==="not"))throw R(n.offset,`expected a term before ${n.value}.`);let r=t===void 0?"":` ${t}`;throw R(n.offset,`expected a term${r}.`)}#t(){return this.#r[this.#s]??{type:"end",value:"",offset:this.#e.length}}#i(){let t=this.#t();return this.#s+=1,t}};function O(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(/\s/u.test(r)){n+=1;continue}if(r==="("&&xe(e,n)){t.push({type:"left",value:r,offset:n}),n+=1;continue}if(r===")"){t.push({type:"right",value:r,offset:n}),n+=1;continue}if(te(e,n)){let i=e.charAt(n+1)==="|"?2:1;t.push({type:"or",value:e.slice(n,n+i),offset:n}),n+=i;continue}if(r==="'"||r==='"'){let i=n,c=r,s="";for(n+=1;n<e.length&&e.charAt(n)!==c;)e.charAt(n)==="\\"&&(e.charAt(n+1)===c||e.charAt(n+1)==="\\")&&(n+=1),s+=e.charAt(n++);if(n>=e.length)throw R(i,`unterminated ${c==="'"?"single":"double"}-quoted term.`);if(n+=1,s.length===0)throw R(i,"quoted terms must not be empty.");t.push({type:"term",value:s,offset:i,quoted:!0});continue}let o=n;for(;n<e.length;){let i=e.charAt(n);if(/\s/u.test(i)||i===")"||te(e,n))break;i==="\\"&&n+1<e.length?n+=2:i==="["||i==="("?n=U(e,n)??n+1:n+=1}let a=e.slice(o,n);t.push({type:we(a),value:a,offset:o})}return t.push({type:"end",value:"",offset:e.length}),t}u(O,"tokenize");function te(e,t){return e.charAt(t)==="|"&&(e.charAt(t+1)==="|"||/\s/u.test(e.charAt(t-1))&&/\s/u.test(e.charAt(t+1)))}u(te,"isBooleanPipe");function U(e,t){let n=e.charAt(t)==="["?"]":")",r=t+1;for(;r<e.length;){let o=e.charAt(r);if(o==="\\")r+=2;else{if(o===n)return r+1;if(n===")"&&(o==="("||o==="[")){let a=U(e,r);if(a===void 0)return;r=a}else r+=1}}}u(U,"regexBlockEnd");function xe(e,t){let n=U(e,t);if(n===void 0)return!0;let r=e.slice(t+1,n-1);return r.trim().length===0?!0:L(O(r))}u(xe,"isBooleanGroup");function we(e){return e==="AND"?"and":e==="OR"?"or":e==="NOT"?"not":"term"}u(we,"operatorType");function Te(e){return e.value.length>0?JSON.stringify(e.value):"the end of the query"}u(Te,"quoteToken");function R(e,t){return new SyntaxError(`Invalid Boolean search query at column ${String(e+1)}: ${t}`)}u(R,"syntaxError");function $(e,t){return e.kind==="term"?{kind:"term",value:t&&!e.quoted?e.value:G(e.value)}:{kind:e.kind,left:$(e.left,t),right:$(e.right,t)}}u($,"compileTerms");function _(e){if(e.kind==="term")return e.value;let t=_(e.left);return e.kind==="not"?t:`(?:${t}|${_(e.right)})`}u(_,"matchPattern");function G(e){return e.replace(/[\\^$.*+?()[\]{}|]/gu,"\\$&")}u(G,"escapeRegex");function ie(e){if(e.multiline===!0){if(e.condition!==void 0)throw new Error("Boolean conditions check single lines and cannot be combined with multiline. Use one regex with multiline instead.");return}if(/\r|\n/u.test(e.query))throw new Error("A pattern with line breaks requires multiline: true.")}u(ie,"assertSupportedPattern");function se(e){return e.multiline===!0?["--multiline","--multiline-dotall"]:[]}u(se,"multilineArguments");async function K(e,t,n,r,o){if(e.query.length===0)throw new Error("Search query must not be empty.");return ie(e),e.condition!==void 0?ae(e,(a,i)=>re(a,t,n,i,void 0,o),n):re(e,t,n,void 0,r,o)}u(K,"searchText");async function ve(e,t,n,r){if(n===void 0&&(e.path?.includes("://")||t.includes("://")))throw new Error("No search environment owns this scope.");let o=n?.resolve(t,oe(e.path??"."))??E.resolve(t,oe(e.path??".")),a=n===void 0?(await Ce(o)).isDirectory():await n.isDirectory(o,r);return{cwd:a?o:n?.dirname(o)??E.dirname(o),target:a?".":`./${n?.basename(o)??E.basename(o)}`,arguments:["--no-config","--no-ignore-parent","--color=never",...J(e.include).flatMap(i=>["--glob",i]),...J(e.exclude).flatMap(i=>["--glob",`!${i}`])]}}u(ve,"ripgrepScope");async function Ae(e,t,n,r){if(ie(e),e.condition!==void 0)return ae(e,async(a,i)=>{let c=await Ae(a,t,n,r);for(let s of c.matches)i?.(s.source,s.lineNumber);return c},r);let o=await j(["--json","--no-config","--color=never","--with-filename","--line-number",...e.regex===!0?["--engine","auto"]:["--fixed-strings"],e.caseSensitive===!0?"--case-sensitive":"--ignore-case",...e.wholeWord===!0?["--word-regexp"]:[],...se(e),"--",e.query,"-"],n,r,void 0,void 0,t.length===0?`
2
+ `:t);return t.length===0?{...o,matches:o.matches.filter(a=>a.lineNumber===1&&a.startColumn===0&&a.endColumn===0)}:o}u(Ae,"searchTextContent");async function re(e,t,n,r,o,a){let i=await ve(e,t,a,n),c=i.cwd,s=["--json","--with-filename","--line-number",e.caseSensitive===!0?"--case-sensitive":"--ignore-case",...e.wholeWord===!0?["--word-regexp"]:[],...se(e),...i.arguments,"--",e.query,i.target];if(e.regex!==!0)return j(["--fixed-strings",...s],c,n,r,o,void 0,a);try{return await j(["--engine","auto",...s],c,n,r,o,void 0,a)}catch(l){if(!Me(l))throw l instanceof Error&&/PCRE2 is not available|does not support PCRE2/iu.test(l.message)?new Error("This regex requires PCRE2. Install ripgrep with PCRE2 support or simplify the regex.",{cause:l}):l;try{return await j(["--engine","default",...s],c,n,r,o,void 0,a)}catch(d){throw n?.aborted?d:new AggregateError([l,d],"Regex exceeded the PCRE2 match limit and cannot run with the default engine. Narrow the search or simplify the regex.",{cause:d})}}}u(re,"searchPattern");async function ae(e,t,n){let r=e.condition;if(r===void 0)throw new Error("Boolean search requires a line condition.");let o=new Set;function a(p){if(p.kind==="term"){o.add(p.value);return}a(p.left),a(p.right)}u(a,"collect"),a(r);let{condition:i,...c}=e,s=new Map,l=u(p=>JSON.stringify([p.source,p.lineNumber]),"lineKey");for(let p of o){n?.throwIfAborted();let f=new Set;await t({...c,query:p,regex:!0,wholeWord:!1},(m,y)=>f.add(JSON.stringify([m,y]))),s.set(p,f)}let d=await t(c),h=new Set,g=d.matches.filter(p=>{let f=l(p);return h.has(f)||!A(r,m=>s.get(m)?.has(f)===!0)?!1:(h.add(f),!0)});return{...d,matches:g}}u(ae,"searchBoolean");function j(e,t,n,r,o,a,i){return i!==void 0?Ee(e,t,i,n,r,o):new Promise((c,s)=>{let l=Re(Z(),e,{stdio:["pipe","pipe","pipe"],cwd:t}),d=0,h=!1;o!==void 0&&l.stdout.on("data",S=>{d+=S.length,d>o.bytes&&(h=!0,l.kill())});let g=ke({input:l.stdout});l.stdin.on("error",()=>{}),l.stdin.end(a);let p=[],f="",m,y=u(()=>{l.kill()},"abort"),T=u(()=>{n?.removeEventListener("abort",y),g.close()},"cleanup");l.stderr.setEncoding("utf8"),l.stderr.on("data",S=>{f+=S}),g.on("line",S=>{if(!(h||m!==void 0||S.length===0))try{let b=JSON.parse(S);if(b.type!=="match")return;if(r!==void 0){let{path:P,line_number:Y}=b.data;P.text!==void 0&&Number.isSafeInteger(Y)&&r(E.resolve(t,P.text),Y);return}for(let P of ce(b,t)){if(o!==void 0&&p.length===o.matches){h=!0,l.kill();break}p.push(P)}}catch(b){m=b,l.kill()}}),l.once("error",S=>{T(),s(S)}),l.once("close",S=>{if(T(),n?.aborted===!0){let b=new Error("Search was aborted.");b.name="AbortError",s(b);return}if(m!==void 0){s(new Error("Unable to parse ripgrep search output.",{cause:m}));return}if(!h&&S!==0&&S!==1){s(new Error(f.trim()||`ripgrep exited with code ${String(S)}.`));return}p.sort(ue),c({matches:p,complete:!h})}),n?.addEventListener("abort",y,{once:!0}),n?.aborted===!0&&y()})}u(j,"runRipgrep");async function Ee(e,t,n,r,o,a){let i=[],c=new AbortController,s=u(()=>c.abort(r?.reason),"abort");r?.addEventListener("abort",s,{once:!0}),r?.aborted&&s();let l=0,d={limited:!1};try{let h=await n.runLines(e,t,g=>{if(d.limited||!g.length)return;if(l+=Buffer.byteLength(g)+1,a!==void 0&&l>a.bytes){d.limited=!0,c.abort();return}let p=JSON.parse(g);if(p.type==="match"){if(o!==void 0){let f=p.data.path.text;f!==void 0&&Number.isSafeInteger(p.data.line_number)&&o(n.resolve(t,f),p.data.line_number);return}for(let f of ce(p,t,n)){if(a!==void 0&&i.length>=a.matches){d.limited=!0,c.abort();break}i.push(f)}}},c.signal);if(h.code!==0&&h.code!==1)throw new Error(h.stderr.trim()||"Ripgrep failed.")}catch(h){if(r?.throwIfAborted(),!d.limited)throw h}finally{r?.removeEventListener("abort",s)}return r?.throwIfAborted(),i.sort(ue),{matches:i,complete:!d.limited}}u(Ee,"runOwnedRipgrep");function Me(e){return e instanceof Error&&/PCRE2: error matching: match limit exceeded/iu.test(e.message)}u(Me,"isPcre2MatchLimitError");function ce(e,t,n){let r=e.data.path.text,o=e.data.lines.text;if(r===void 0||o===void 0||!Number.isSafeInteger(e.data.line_number))return[];let a=o.split(`
3
3
  `).map(l=>l.replace(/\r$/u,"")),i=Buffer.from(o),c=u(l=>{let d=i.subarray(0,l).toString("utf8");return{lineIndex:d.split(`
4
4
  `).length-1,column:d.length-d.lastIndexOf(`
5
5
  `)-1}},"position"),s=[];for(let l of e.data.submatches){if(l.start<0||l.end<l.start||l.end>i.length)continue;let d=c(l.start),h=c(l.end);s.push({source:n?.resolve(t,r)??E.resolve(t,r),lineNumber:e.data.line_number+d.lineIndex,startColumn:d.column,...h.lineIndex===d.lineIndex?{}:{endLineNumber:e.data.line_number+h.lineIndex},endColumn:h.column,matchedText:h.lineIndex===d.lineIndex?(a[d.lineIndex]??"").slice(d.column,h.column):i.subarray(l.start,l.end).toString("utf8"),lineText:a[d.lineIndex]??""})}return s}u(ce,"matchesFromEvent");function oe(e){return e.startsWith("@")?e.slice(1):e}u(oe,"stripFilePrefix");function ue(e,t){return e.source.localeCompare(t.source)||e.lineNumber-t.lineNumber||e.startColumn-t.startColumn||e.endColumn-t.endColumn}u(ue,"compareMatches");function nt(e){let t=z(e.query),n=z(e.query,!0),r=ne(e.query),o=[],a=Q(e.query),i=Q(e.query,!0);return(n!==t||JSON.stringify(a)!==JSON.stringify(i))&&o.push({query:n,mode:"regex",condition:i}),e.multiline!==!0&&r!==void 0&&r!==t&&r!==n&&o.push({query:r,mode:"words"}),{...e,query:t,regex:!0,condition:a,fallbacks:o}}u(nt,"createSearchRecipe");async function V(e,t,n,r){let o=e.query,a=await K(e,t,n,void 0,r),i=[];for(let c of e.fallbacks??[]){if(a.matches.length>0||!a.complete)break;n?.throwIfAborted();try{a=await K({...e,query:c.query,regex:!0,condition:c.condition},t,n,void 0,r),o=c.query,i.push(c.mode==="regex"?"Search fallback: no literal matches; tried unquoted terms as regex.":"Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.")}catch(s){if(c.mode!=="regex"||!Ne(s)||n?.aborted)throw s;i.push("Search fallback: invalid regex skipped; literal search found no matches.")}}return{...a,query:o,notices:i}}u(V,"runSearchRecipe");function Ne(e){return e instanceof Error&&/regex parse error:|PCRE2: error compiling pattern/iu.test(e.message)}u(Ne,"isRegexSyntaxError");var Ie=/^SEARCH#([A-F0-9]{4,64}):(all|[1-9]\d*):(line|match)$/u,pe=4;function ht(e,t,n,r){return ge(e,t,n,r).slice(0,pe)}u(ht,"createSearchSessionId");function ge(e,t,n,r){let o=n===void 0?We(t.map(s=>s.source)):C(n),a=t.map(s=>({match:s,source:s.source.includes("://")?C(s.source):x.relative(o,x.resolve(s.source))})).sort((s,l)=>s.source.localeCompare(l.source)||X(s.match,l.match)).map(({match:s,source:l})=>[l,s.lineNumber,s.startColumn,s.endLineNumber??s.lineNumber,s.endColumn,s.matchedText,s.lineText]),{limit:i,...c}=Se(r??{query:e,regex:!0},o);return me("sha256").update(JSON.stringify([e,o,c,a])).digest("hex").toUpperCase()}u(ge,"createSearchSessionIdentity");function $e(e,t){if(!/^[A-F0-9]{64}$/u.test(e))throw new Error("Search session identity must be a 64-character uppercase hexadecimal value.");for(let n=pe;n<=e.length;n+=1){let r=e.slice(0,n);if(!t.has(r))return r}throw new Error("Could not allocate a unique search session id.")}u($e,"allocateSearchSessionId");function Se(e,t){return{query:e.query,path:De(t,e.path??"."),include:e.include??"",exclude:e.exclude??"",caseSensitive:e.caseSensitive===!0,wholeWord:e.wholeWord===!0,multiline:e.multiline===!0,limit:e.limit??50,regex:e.regex===!0,condition:e.condition,fallbacks:e.fallbacks??[]}}u(Se,"normalizeRecipe");var D=class extends Error{static{u(this,"SearchSnapshotChangedError")}constructor(t){super(`Search result in ${t} changed before its anchors were registered.`),this.name="SearchSnapshotChangedError"}},le=class{constructor(t=ge,n,r){this.createIdentity=t;this.resultTargets=n;this.readSource=r}static{u(this,"SearchSessionStore")}#e=new Map;#r=new Map;async register(t,n,r,o,a,i={query:t,regex:!0},c,s,l){let d=structuredClone(n).map(S=>({...S,source:C(S.source)})).sort(X),h=this.readSource,g=h===void 0?void 0:(S,b)=>h(S,o,b),p=await he(d,a,s,l,g),f=this.createIdentity(t,d,o,i),y=this.#r.get(f)??$e(f,new Set(this.#e.keys())),T={id:y,query:t,matches:d,complete:r,digestBySource:de(p),read:g,...Le(this.resultTargets,y,d,p,o,r,(S,b)=>W(S,b,l,g)),...s===void 0?{}:{snapshotByteBudget:s},recipe:i,environment:l,...c!==void 0&&{refresh:c},cwd:C(o)};return this.#r.set(f,y),this.#e.set(y,T),T}async registerIfCurrent(t,n,r,o,a,i,c,s,l){try{return await this.register(t,n,r,o,a,i,c,s,l)}catch(d){if(d instanceof D)return;throw d}}async observeAfterEdit(t,n){let r=new Set(t.flatMap(a=>{let i=typeof a=="string"?M(a):void 0;return i===void 0?[]:[i.id]})),o=[];for(let a of r){let i=this.#e.get(a);if(i===void 0)continue;let c={sessionId:a,query:i.recipe.originalQuery??i.query,scope:Se(i.recipe,i.cwd)};try{let s=i.refresh===void 0?await V(i.recipe,i.cwd,n,i.environment):await i.refresh(n);o.push({...c,matches:s.matches.length,complete:s.complete,notices:s.notices})}catch(s){o.push({...c,error:s instanceof Error?s.message:String(s)})}}return o}anchorResolver(){return{id:"search",description:["`SEARCH#HASH:N:line` selects one result's full line; `SEARCH#HASH:N:match` selects its exact match.","`SEARCH#HASH:all:line` selects each unique containing line; `SEARCH#HASH:all:match` selects every exact match.","Omit `path` when `all` spans files."].join(`
6
- `),renderFull(t){return t},renderCompact(t){let n=M(t);return n===void 0?"selected result":n.selector==="all"?n.mode==="match"?"all matches":"all lines":n.mode==="match"?`match ${String(n.selector)}`:`line ${String(n.selector)}`},tryResolve:u((t,n)=>this.#s(t,n.source,n.signal),"tryResolve")}}async resolveSearchScope(t,n){if(!t.startsWith("SEARCH#"))return;let r=await this.#o(t,n.cwd,n.signal,!0);if(r.kind!=="resolved")throw new Error(r.kind==="rejected"?r.rejection.reason:"Invalid Search reference.");let o=w(M(t)),a=w(this.#e.get(o.id));return{complete:!0,targets:r.targets.map(i=>{if(i.expectedContent===void 0)throw new Error("Search snapshot is unavailable.");return{source:i.source,expectedContent:i.expectedContent,ranges:i.ranges??[],readCurrent:u(async c=>{let s=await H(i.source,c,a.environment,a.read);if(s===void 0)throw new Error("Search source is unavailable.");return s},"readCurrent")}})}}resourceResolver(){return{id:"search-targets",tryResolve:u((t,n)=>this.#o(t,n.cwd),"tryResolve")}}async#s(t,n,r){let o=M(t);if(o===void 0)return{kind:"not-handled"};let a=this.#e.get(o.id);if(a===void 0)return B();if(o.selector==="all"&&!a.complete)return v();let i=C(n),c=a,s;if(o.selector==="all"){if(a.refreshedComplete?.complete===!0)c=a.refreshedComplete;else if(a.refreshedComplete!==void 0&&({snapshot:c,contents:s}=await this.#n(a,r),!c.complete))return v()}let l=N(c,o.selector,"match").find(m=>m.source===i);if(l===void 0)return{kind:"rejected",rejection:{code:"missing",reason:"search anchor does not select this resource"}};let d=await H(i,r,a.environment,a.read);if(d===void 0)return B(l.lineNumber);let h=F(d);if(o.selector==="all"&&h!==c.digestBySource.get(i)&&({snapshot:c,contents:s}=await this.#n(a,r),!c.complete))return v();let g=u(m=>s===void 0?m===i?d:void 0:s.get(m),"contentOf"),p=N(c,o.selector,o.mode,g).filter(m=>m.source===i);if(p.length===0)return{kind:"rejected",rejection:{code:"missing",reason:"search anchor does not select this resource"}};if(o.selector!=="all"&&h!==a.digestBySource.get(i))return B(w(p[0]).lineNumber);let f=k(i,d);return{kind:"resolved",anchor:new ee(t,i,p.map(m=>q(f,m,o.mode)))}}async#o(t,n,r,o=!1){let a=M(t);if(a===void 0)return{kind:"not-handled"};let i=this.#e.get(a.id);if(i===void 0||i.cwd!==C(n))return B();if(a.selector==="all"&&!i.complete)return v();let c=i,s=new Map;if(a.selector==="all"){if(i.refreshedComplete?.complete===!0)c=i.refreshedComplete;else if(i.refreshedComplete!==void 0&&({snapshot:c}=await this.#n(i,r),!c.complete))return v();let f=new Set(N(c,a.selector,"match").map(m=>m.source));for(let m of f){let y=await H(m,r,i.environment,i.read);if(y===void 0||F(y)!==c.digestBySource.get(m)){let T=await this.#n(i,r);if(c=T.snapshot,s=new Map(T.contents),!c.complete)return v();break}s.set(m,y)}}else{let f=N(c,a.selector,a.mode)[0];if(f!==void 0){let m=await H(f.source,r,i.environment,i.read);if(m===void 0||F(m)!==c.digestBySource.get(f.source))return B(f.lineNumber);s.set(f.source,m)}}let l=N(c,a.selector,a.mode,f=>s.get(f)),d=new Map,h=u(f=>{let m=d.get(f.source);return m===void 0&&(m=k(f.source,s.get(f.source)??f.lineText),d.set(f.source,m)),m},"documentOf"),g=new Map;for(let f of l){let m=g.get(f.source)??[];m.push(q(h(f),f,a.mode)),g.set(f.source,m)}let p=[...g].map(([f,m])=>({source:f,ranges:m,expectedContent:s.get(f)}));return p.length===0&&!(o&&a.selector==="all")?{kind:"rejected",rejection:{code:"missing",reason:"search anchor has no matches"}}:{kind:"resolved",targets:p}}async#n(t,n){let r=t.refresh===void 0?await V(t.recipe,t.cwd,n,t.environment):await t.refresh(n),o=r.matches.map(c=>({...c,source:C(c.source)})).sort(X),a=await he(o,n,t.snapshotByteBudget,t.environment,t.read),i={matches:o,complete:r.complete,digestBySource:de(a)};return this.#e.set(t.id,{...t,refreshedComplete:i}),{snapshot:i,contents:a}}};function Le(e,t,n,r,o,a,i){if(e===void 0)return{};let c=new Map,s=u(d=>{let h=c.get(d);return h===void 0&&(h=k(d,w(r.get(d))),c.set(d,h)),h},"documentOf"),l=n.map(d=>({source:d.source,expectedContent:w(r.get(d.source)),ranges:[be(d)],readCurrent:je(i,d.source)}));for(let[d,h]of n.slice(0,100).entries()){let g=e.register([{...w(l[d]),ranges:[q(s(h.source),h,"line")]}],o);e.registerSearchReference(`SEARCH#${t}:${d+1}:line`,g,o)}return{target:e.register(l,o,a),matchTargets:l.slice(0,100).map(d=>e.register([d],o,a))}}u(Le,"registerResultReferences");function M(e){let t=Ie.exec(e);if(t!==null)return{id:w(t[1]),selector:t[2]==="all"?"all":Number(t[2]),mode:t[3]==="line"?"line":"match"}}u(M,"parseSearchAnchor");function je(e,t){return n=>e(t,n)}u(je,"sourceReader");function F(e){return me("sha256").update(e).digest("hex")}u(F,"digestContent");function de(e){return new Map([...e].map(([t,n])=>[t,F(n)]))}u(de,"digestContents");function N(e,t,n,r=()=>{}){let o=t==="all"?e.matches:[e.matches[t-1]].filter(Oe);if(n==="match"||t!=="all")return o;let a=new Set,i=new Map;return o.flatMap(c=>{let s=r(c.source),l=s===void 0?void 0:i.get(c.source);l===void 0&&(l=k(c.source,s??c.lineText),s!==void 0&&i.set(c.source,l));let d=ye(c);return l.lines.slice(c.lineNumber-1,d).flatMap(h=>{let g=`${c.source}\0${String(h.lineNumber)}`;return a.has(g)?[]:(a.add(g),[{...c,lineNumber:h.lineNumber,endLineNumber:h.lineNumber,startColumn:0,endColumn:h.content.length,lineText:h.content,matchedText:h.content}])})})}u(N,"selectMatches");function Oe(e){return e!==void 0}u(Oe,"isMatch");function ye(e){let t=e.endLineNumber??e.lineNumber;return t>e.lineNumber&&e.endColumn===0?t-1:t}u(ye,"lastContainingLine");function q(e,t,n){if(n==="match")return be(t);let r=ye(t),o=w(e.lines[r-1]);return{start:{lineNumber:t.lineNumber,column:0},end:{lineNumber:r+(o.lineEnding.length>0?1:0),column:o.lineEnding.length>0?0:o.content.length},linewise:!0}}u(q,"selectionRange");function be(e){return{start:{lineNumber:e.lineNumber,column:e.startColumn},end:{lineNumber:e.endLineNumber??e.lineNumber,column:e.endColumn}}}u(be,"matchRange");function He(e,t){let n=t.endLineNumber??t.lineNumber;return e.lines.slice(t.lineNumber-1,n).map(r=>{let o=r.lineNumber===t.lineNumber?t.startColumn:0,a=r.lineNumber===n?t.endColumn:r.content.length;return r.content.slice(o,a)+(r.lineNumber===n?"":r.lineEnding)}).join("")}u(He,"matchedSourceText");async function he(e,t,n,r,o){let a=[...new Set(e.map(s=>s.source))];if(n!==void 0){let s=new Map,l=n;for(let d of a){let h=await Fe(d,l,t,r,o);l-=Buffer.byteLength(h),fe(d,h,e),s.set(d,h)}return s}let i=await Promise.allSettled(a.map(async s=>{let l=await W(s,t,r,o);return fe(s,l,e),[s,l]})),c=new Map;for(let s of i){if(s.status==="rejected")throw s.reason;c.set(...s.value)}return c}u(he,"snapshotContents");function fe(e,t,n){let r=k(e,t);for(let o of n.filter(a=>a.source===e))if(r.lines[o.lineNumber-1]?.content!==o.lineText||He(r,o)!==o.matchedText)throw new D(e)}u(fe,"validateSnapshot");async function Fe(e,t,n,r,o){if(n?.throwIfAborted(),e.includes("://")){let i=await W(e,n,r,o);if(Buffer.byteLength(i)>t)throw new Error("Candidate snapshot byte budget reached.");return i}let a=await Be(e,"r");try{let i=await a.stat();if(!i.isFile()||i.size>t)throw new Error("Candidate snapshot byte budget reached.");let c=Buffer.alloc(Math.min(i.size+1,t+1)),s=0;for(;s<c.length;){n?.throwIfAborted();let l=await a.read(c,s,c.length-s,s);if(l.bytesRead===0)break;s+=l.bytesRead}if(n?.throwIfAborted(),s>i.size||s>t)throw new Error("Candidate file grew during snapshot capture.");return c.subarray(0,s).toString("utf8")}finally{await a.close()}}u(Fe,"readBoundedSnapshot");async function H(e,t,n,r){try{return await W(e,t,n,r)}catch{return}}u(H,"readCurrent");function C(e){return e.includes("://")?e:x.resolve(e)}u(C,"canonicalSource");function De(e,t){return t.includes("://")?t:e.includes("://")?new URL(t,e.endsWith("/")?e:e+"/").href:x.resolve(e,t)}u(De,"resolveScope");async function W(e,t,n,r){if(t?.throwIfAborted(),r!==void 0)return r(e,t);if(n!==void 0)return n.readText(e,t);if(e.includes("://"))throw new Error("No search snapshot owner for this source.");return Pe(e,{encoding:"utf8",...t!==void 0&&{signal:t}})}u(W,"readOwnedText");function B(e=1){return{kind:"rejected",rejection:{code:"stale",reason:"search anchor is stale",contextRange:{offset:Math.max(1,e-2),limit:5}}}}u(B,"staleAnchor");function v(){return{kind:"rejected",rejection:{code:"missing",reason:"search did not register an all anchor because its result was limited"}}}u(v,"missingCompleteAnchor");function We(e){if(e.length===0)return".";let t=x.dirname(x.resolve(w(e[0])));for(let n of e.slice(1)){let r=x.resolve(n);for(;!Je(t,r);){let o=x.dirname(t);if(o===t)return t;t=o}}return t}u(We,"commonSourceDirectory");function Je(e,t){let n=x.relative(e,t);return n!==".."&&!n.startsWith(`..${x.sep}`)&&!x.isAbsolute(n)}u(Je,"isWithin");function X(e,t){return e.source.localeCompare(t.source)||e.lineNumber-t.lineNumber||e.startColumn-t.startColumn||(e.endLineNumber??e.lineNumber)-(t.endLineNumber??t.lineNumber)||e.endColumn-t.endColumn}u(X,"compareMatches");export{K as a,ve as b,Ae as c,nt as d,V as e,ht as f,ge as g,$e as h,D as i,le as j};
6
+ `),renderFull(t){return t},renderCompact(t){let n=M(t);return n===void 0?"selected result":n.selector==="all"?n.mode==="match"?"all matches":"all lines":n.mode==="match"?`match ${String(n.selector)}`:`line ${String(n.selector)}`},tryResolve:u((t,n)=>this.#s(t,n.source,n.signal),"tryResolve")}}async resolveSearchScope(t,n){if(!t.startsWith("SEARCH#"))return;let r=await this.#o(t,n.cwd,n.signal,!0);if(r.kind!=="resolved")throw new Error(r.kind==="rejected"?r.rejection.reason:"Invalid Search reference.");let o=w(M(t)),a=w(this.#e.get(o.id));return{complete:!0,targets:r.targets.map(i=>{if(i.expectedContent===void 0)throw new Error("Search snapshot is unavailable.");return{source:i.source,expectedContent:i.expectedContent,ranges:i.ranges??[],readCurrent:u(async c=>{let s=await H(i.source,c,a.environment,a.read);if(s===void 0)throw new Error("Search source is unavailable.");return s},"readCurrent")}})}}resourceResolver(){return{id:"search-targets",tryResolve:u((t,n)=>this.#o(t,n.cwd),"tryResolve")}}async#s(t,n,r){let o=M(t);if(o===void 0)return{kind:"not-handled"};let a=this.#e.get(o.id);if(a===void 0)return B();if(o.selector==="all"&&!a.complete)return v();let i=C(n),c=a,s;if(o.selector==="all"){if(a.refreshedComplete?.complete===!0)c=a.refreshedComplete;else if(a.refreshedComplete!==void 0&&({snapshot:c,contents:s}=await this.#n(a,r),!c.complete))return v()}let l=N(c,o.selector,"match").find(m=>m.source===i);if(l===void 0)return{kind:"rejected",rejection:{code:"missing",reason:"search anchor does not select this resource"}};let d=await H(i,r,a.environment,a.read);if(d===void 0)return B(l.lineNumber);let h=F(d);if(o.selector==="all"&&h!==c.digestBySource.get(i)&&({snapshot:c,contents:s}=await this.#n(a,r),!c.complete))return v();let g=u(m=>s===void 0?m===i?d:void 0:s.get(m),"contentOf"),p=N(c,o.selector,o.mode,g).filter(m=>m.source===i);if(p.length===0)return{kind:"rejected",rejection:{code:"missing",reason:"search anchor does not select this resource"}};if(o.selector!=="all"&&h!==a.digestBySource.get(i))return B(w(p[0]).lineNumber);let f=k(i,d);return{kind:"resolved",anchor:new ee(t,i,p.map(m=>q(f,m,o.mode)))}}async#o(t,n,r,o=!1){let a=M(t);if(a===void 0)return{kind:"not-handled"};let i=this.#e.get(a.id);if(i===void 0||i.cwd!==C(n))return B();if(a.selector==="all"&&!i.complete)return v();let c=i,s=new Map;if(a.selector==="all"){if(i.refreshedComplete?.complete===!0)c=i.refreshedComplete;else if(i.refreshedComplete!==void 0&&({snapshot:c}=await this.#n(i,r),!c.complete))return v();let f=new Set(N(c,a.selector,"match").map(m=>m.source));for(let m of f){let y=await H(m,r,i.environment,i.read);if(y===void 0||F(y)!==c.digestBySource.get(m)){let T=await this.#n(i,r);if(c=T.snapshot,s=new Map(T.contents),!c.complete)return v();break}s.set(m,y)}}else{let f=N(c,a.selector,a.mode)[0];if(f!==void 0){let m=await H(f.source,r,i.environment,i.read);if(m===void 0||F(m)!==c.digestBySource.get(f.source))return B(f.lineNumber);s.set(f.source,m)}}let l=N(c,a.selector,a.mode,f=>s.get(f)),d=new Map,h=u(f=>{let m=d.get(f.source);return m===void 0&&(m=k(f.source,s.get(f.source)??f.lineText),d.set(f.source,m)),m},"documentOf"),g=new Map;for(let f of l){let m=g.get(f.source)??[];m.push(q(h(f),f,a.mode)),g.set(f.source,m)}let p=[...g].map(([f,m])=>({source:f,ranges:m,expectedContent:s.get(f)}));return p.length===0&&!(o&&a.selector==="all")?{kind:"rejected",rejection:{code:"missing",reason:"search anchor has no matches"}}:{kind:"resolved",targets:p}}async#n(t,n){let r=t.refresh===void 0?await V(t.recipe,t.cwd,n,t.environment):await t.refresh(n),o=r.matches.map(c=>({...c,source:C(c.source)})).sort(X),a=await he(o,n,t.snapshotByteBudget,t.environment,t.read),i={matches:o,complete:r.complete,digestBySource:de(a)};return this.#e.set(t.id,{...t,refreshedComplete:i}),{snapshot:i,contents:a}}};function Le(e,t,n,r,o,a,i){if(e===void 0)return{};let c=new Map,s=u(d=>{let h=c.get(d);return h===void 0&&(h=k(d,w(r.get(d))),c.set(d,h)),h},"documentOf"),l=n.map(d=>({source:d.source,expectedContent:w(r.get(d.source)),ranges:[be(d)],readCurrent:Oe(i,d.source)}));for(let[d,h]of n.slice(0,100).entries()){let g=e.register([{...w(l[d]),ranges:[q(s(h.source),h,"line")]}],o);e.registerSearchReference(`SEARCH#${t}:${d+1}:line`,g,o)}return{target:e.register(l,o,a),matchTargets:l.slice(0,100).map(d=>e.register([d],o,a))}}u(Le,"registerResultReferences");function M(e){let t=Ie.exec(e);if(t!==null)return{id:w(t[1]),selector:t[2]==="all"?"all":Number(t[2]),mode:t[3]==="line"?"line":"match"}}u(M,"parseSearchAnchor");function Oe(e,t){return n=>e(t,n)}u(Oe,"sourceReader");function F(e){return me("sha256").update(e).digest("hex")}u(F,"digestContent");function de(e){return new Map([...e].map(([t,n])=>[t,F(n)]))}u(de,"digestContents");function N(e,t,n,r=()=>{}){let o=t==="all"?e.matches:[e.matches[t-1]].filter(je);if(n==="match"||t!=="all")return o;let a=new Set,i=new Map;return o.flatMap(c=>{let s=r(c.source),l=s===void 0?void 0:i.get(c.source);l===void 0&&(l=k(c.source,s??c.lineText),s!==void 0&&i.set(c.source,l));let d=ye(c);return l.lines.slice(c.lineNumber-1,d).flatMap(h=>{let g=`${c.source}\0${String(h.lineNumber)}`;return a.has(g)?[]:(a.add(g),[{...c,lineNumber:h.lineNumber,endLineNumber:h.lineNumber,startColumn:0,endColumn:h.content.length,lineText:h.content,matchedText:h.content}])})})}u(N,"selectMatches");function je(e){return e!==void 0}u(je,"isMatch");function ye(e){let t=e.endLineNumber??e.lineNumber;return t>e.lineNumber&&e.endColumn===0?t-1:t}u(ye,"lastContainingLine");function q(e,t,n){if(n==="match")return be(t);let r=ye(t),o=w(e.lines[r-1]);return{start:{lineNumber:t.lineNumber,column:0},end:{lineNumber:r+(o.lineEnding.length>0?1:0),column:o.lineEnding.length>0?0:o.content.length},linewise:!0}}u(q,"selectionRange");function be(e){return{start:{lineNumber:e.lineNumber,column:e.startColumn},end:{lineNumber:e.endLineNumber??e.lineNumber,column:e.endColumn}}}u(be,"matchRange");function He(e,t){let n=t.endLineNumber??t.lineNumber;return e.lines.slice(t.lineNumber-1,n).map(r=>{let o=r.lineNumber===t.lineNumber?t.startColumn:0,a=r.lineNumber===n?t.endColumn:r.content.length;return r.content.slice(o,a)+(r.lineNumber===n?"":r.lineEnding)}).join("")}u(He,"matchedSourceText");async function he(e,t,n,r,o){let a=[...new Set(e.map(s=>s.source))];if(n!==void 0){let s=new Map,l=n;for(let d of a){let h=await Fe(d,l,t,r,o);l-=Buffer.byteLength(h),fe(d,h,e),s.set(d,h)}return s}let i=await Promise.allSettled(a.map(async s=>{let l=await W(s,t,r,o);return fe(s,l,e),[s,l]})),c=new Map;for(let s of i){if(s.status==="rejected")throw s.reason;c.set(...s.value)}return c}u(he,"snapshotContents");function fe(e,t,n){let r=k(e,t);for(let o of n.filter(a=>a.source===e))if(r.lines[o.lineNumber-1]?.content!==o.lineText||He(r,o)!==o.matchedText)throw new D(e)}u(fe,"validateSnapshot");async function Fe(e,t,n,r,o){if(n?.throwIfAborted(),e.includes("://")){let i=await W(e,n,r,o);if(Buffer.byteLength(i)>t)throw new Error("Candidate snapshot byte budget reached.");return i}let a=await Be(e,"r");try{let i=await a.stat();if(!i.isFile()||i.size>t)throw new Error("Candidate snapshot byte budget reached.");let c=Buffer.alloc(Math.min(i.size+1,t+1)),s=0;for(;s<c.length;){n?.throwIfAborted();let l=await a.read(c,s,c.length-s,s);if(l.bytesRead===0)break;s+=l.bytesRead}if(n?.throwIfAborted(),s>i.size||s>t)throw new Error("Candidate file grew during snapshot capture.");return c.subarray(0,s).toString("utf8")}finally{await a.close()}}u(Fe,"readBoundedSnapshot");async function H(e,t,n,r){try{return await W(e,t,n,r)}catch{return}}u(H,"readCurrent");function C(e){return e.includes("://")?e:x.resolve(e)}u(C,"canonicalSource");function De(e,t){return t.includes("://")?t:e.includes("://")?new URL(t,e.endsWith("/")?e:e+"/").href:x.resolve(e,t)}u(De,"resolveScope");async function W(e,t,n,r){if(t?.throwIfAborted(),r!==void 0)return r(e,t);if(n!==void 0)return n.readText(e,t);if(e.includes("://"))throw new Error("No search snapshot owner for this source.");return Pe(e,{encoding:"utf8",...t!==void 0&&{signal:t}})}u(W,"readOwnedText");function B(e=1){return{kind:"rejected",rejection:{code:"stale",reason:"search anchor is stale",contextRange:{offset:Math.max(1,e-2),limit:5}}}}u(B,"staleAnchor");function v(){return{kind:"rejected",rejection:{code:"missing",reason:"search did not register an all anchor because its result was limited"}}}u(v,"missingCompleteAnchor");function We(e){if(e.length===0)return".";let t=x.dirname(x.resolve(w(e[0])));for(let n of e.slice(1)){let r=x.resolve(n);for(;!Je(t,r);){let o=x.dirname(t);if(o===t)return t;t=o}}return t}u(We,"commonSourceDirectory");function Je(e,t){let n=x.relative(e,t);return n!==".."&&!n.startsWith(`..${x.sep}`)&&!x.isAbsolute(n)}u(Je,"isWithin");function X(e,t){return e.source.localeCompare(t.source)||e.lineNumber-t.lineNumber||e.startColumn-t.startColumn||(e.endLineNumber??e.lineNumber)-(t.endLineNumber??t.lineNumber)||e.endColumn-t.endColumn}u(X,"compareMatches");export{K as a,ve as b,Ae as c,nt as d,V as e,ht as f,ge as g,$e as h,D as i,le as j};
@@ -1 +1 @@
1
- import{a as l}from"./chunk-ZC65Z3CK.js";import{a as u}from"./chunk-EI7MMDWY.js";import{createHash as w}from"node:crypto";import{diffLines as v}from"diff";var f=3,G=4;function P(t,a,r,n){let e=S(a,n),s=I(e,a,n),d=S(a,r),c=new Map,g=s.map(i=>{let o=N(i,a,r,n,d),E=j(n,i.currentStart),C=B(n,i.currentEnd),h=JSON.stringify({contextAfter:C,contextBefore:E,headText:o.headText,repositoryPath:t,worktreeText:o.worktreeText}),m=c.get(h)??0;c.set(h,m+1);let b=H(`${h}\0${m}`).toUpperCase();return{selector:b,digest:b,duplicateOrder:m,repositoryPath:t,state:O(o),currentStartLine:R(n,i.currentStart),currentEndLine:R(n,Math.max(i.currentStart,i.currentEnd-1)),contextBefore:E,contextAfter:C,canonicalContent:h,segments:[o]}});return g.map(i=>({...i,selector:`CHANGE#${L(i.digest,g.map(({digest:o})=>o))}`}))}u(P,"createChangeGroups");function U(t,a){let r=t;for(let n of[...a.segments].sort((e,s)=>s.currentStart-e.currentStart)){if(r.slice(n.currentStart,n.currentEnd)!==n.worktreeText)return;r=r.slice(0,n.currentStart)+n.headText+r.slice(n.currentEnd)}return r}u(U,"reverseChangeGroup");function _(t,a,r,n,e){let s=x(r,n,S(t,a));return a.slice(0,s.start)+e+a.slice(s.end)}u(_,"replaceHeadRangeInIndex");function N(t,a,r,n,e){let s=x(t.headStart,t.headEnd,e);return{headText:a.slice(t.headStart,t.headEnd),indexText:r.slice(s.start,s.end),worktreeText:n.slice(t.currentStart,t.currentEnd),headStart:t.headStart,headEnd:t.headEnd,indexStart:s.start,indexEnd:s.end,currentStart:t.currentStart,currentEnd:t.currentEnd}}u(N,"createSegment");function O(t){return t.indexText===t.worktreeText?"staged":t.indexText===t.headText?"unstaged":"partial"}u(O,"changeState");function S(t,a){let r=v(t,a),n=[],e=0,s=0,d=0;for(;d<r.length;){let c=l(r[d]);if(!c.added&&!c.removed){e+=c.value.length,s+=c.value.length,d++;continue}let g={head:e,current:s};for(;d<r.length&&(l(r[d]).added||l(r[d]).removed);){let i=l(r[d]);i.removed?e+=i.value.length:s+=i.value.length,d++}n.push({headStart:g.head,headEnd:e,currentStart:g.current,currentEnd:s})}return n}u(S,"collectRawChanges");function I(t,a,r){let n=[];for(let e of t){let s=n.at(-1);if(s!==void 0&&p(r.slice(s.currentEnd,e.currentStart))<=f*2&&p(a.slice(s.headEnd,e.headStart))<=f*2){n[n.length-1]={headStart:s.headStart,headEnd:e.headEnd,currentStart:s.currentStart,currentEnd:e.currentEnd};continue}n.push(e)}return n}u(I,"mergeNearbyChanges");function x(t,a,r){return{start:y(t,"start",r),end:y(a,"end",r)}}u(x,"projectHeadRange");function y(t,a,r){let n=0;for(let e of r){if(t<e.headStart)return t+n;if(e.headStart===e.headEnd&&t===e.headStart)return a==="start"?e.currentStart:e.currentEnd;if(t===e.headStart)return e.currentStart;if(t<e.headEnd)return a==="start"?e.currentStart:e.currentEnd;if(t===e.headEnd)return e.currentEnd;n=e.currentEnd-e.headEnd}return t+n}u(y,"projectHeadBoundary");function j(t,a){return t.slice(0,a).split(/(?<=\n)/u).filter(Boolean).slice(-f)}u(j,"linesBefore");function B(t,a){return t.slice(a).split(/(?<=\n)/u).filter(Boolean).slice(0,f)}u(B,"linesAfter");function R(t,a){return p(t.slice(0,a))+1}u(R,"lineAtOffset");function p(t){return[...t.matchAll(/\n/gu)].length}u(p,"lineBreakCount");function H(t){return w("sha256").update(t).digest("hex")}u(H,"sha256");function L(t,a){for(let r=G;r<=t.length;r++){let n=t.slice(0,r);if(a.filter(e=>e.startsWith(n)).length===1)return n}return t}u(L,"shortestUniquePrefix");export{P as a,U as b,_ as c};
1
+ import{a as l}from"./chunk-ZC65Z3CK.js";import{a as u}from"./chunk-EI7MMDWY.js";import{createHash as w}from"node:crypto";import{diffLines as v}from"diff";var f=3,G=4;function P(t,a,r,n){let e=S(a,n),s=I(e,a,n),d=S(a,r),c=new Map,g=s.map(i=>{let o=N(i,a,r,n,d),E=B(n,i.currentStart),C=H(n,i.currentEnd),h=JSON.stringify({contextAfter:C,contextBefore:E,headText:o.headText,repositoryPath:t,worktreeText:o.worktreeText}),m=c.get(h)??0;c.set(h,m+1);let b=L(`${h}\0${m}`).toUpperCase();return{selector:b,digest:b,duplicateOrder:m,repositoryPath:t,state:O(o),currentStartLine:R(n,i.currentStart),currentEndLine:R(n,Math.max(i.currentStart,i.currentEnd-1)),contextBefore:E,contextAfter:C,canonicalContent:h,segments:[o]}});return g.map(i=>({...i,selector:`CHANGE#${T(i.digest,g.map(({digest:o})=>o))}`}))}u(P,"createChangeGroups");function U(t,a){let r=t;for(let n of[...a.segments].sort((e,s)=>s.currentStart-e.currentStart)){if(r.slice(n.currentStart,n.currentEnd)!==n.worktreeText)return;r=r.slice(0,n.currentStart)+n.headText+r.slice(n.currentEnd)}return r}u(U,"reverseChangeGroup");function _(t,a,r,n,e){let s=x(r,n,S(t,a));return a.slice(0,s.start)+e+a.slice(s.end)}u(_,"replaceHeadRangeInIndex");function N(t,a,r,n,e){let s=x(t.headStart,t.headEnd,e);return{headText:a.slice(t.headStart,t.headEnd),indexText:r.slice(s.start,s.end),worktreeText:n.slice(t.currentStart,t.currentEnd),headStart:t.headStart,headEnd:t.headEnd,indexStart:s.start,indexEnd:s.end,currentStart:t.currentStart,currentEnd:t.currentEnd}}u(N,"createSegment");function O(t){return t.indexText===t.worktreeText?"staged":t.indexText===t.headText?"unstaged":"partial"}u(O,"changeState");function S(t,a){let r=v(t,a),n=[],e=0,s=0,d=0;for(;d<r.length;){let c=l(r[d]);if(!c.added&&!c.removed){e+=c.value.length,s+=c.value.length,d++;continue}let g={head:e,current:s};for(;d<r.length&&(l(r[d]).added||l(r[d]).removed);){let i=l(r[d]);i.removed?e+=i.value.length:s+=i.value.length,d++}n.push({headStart:g.head,headEnd:e,currentStart:g.current,currentEnd:s})}return n}u(S,"collectRawChanges");function I(t,a,r){let n=[];for(let e of t){let s=n.at(-1);if(s!==void 0&&p(r.slice(s.currentEnd,e.currentStart))<=f*2&&p(a.slice(s.headEnd,e.headStart))<=f*2){n[n.length-1]={headStart:s.headStart,headEnd:e.headEnd,currentStart:s.currentStart,currentEnd:e.currentEnd};continue}n.push(e)}return n}u(I,"mergeNearbyChanges");function x(t,a,r){return{start:y(t,"start",r),end:y(a,"end",r)}}u(x,"projectHeadRange");function y(t,a,r){let n=0;for(let e of r){if(t<e.headStart)return t+n;if(e.headStart===e.headEnd&&t===e.headStart)return a==="start"?e.currentStart:e.currentEnd;if(t===e.headStart)return e.currentStart;if(t<e.headEnd)return a==="start"?e.currentStart:e.currentEnd;if(t===e.headEnd)return e.currentEnd;n=e.currentEnd-e.headEnd}return t+n}u(y,"projectHeadBoundary");function B(t,a){return t.slice(0,a).split(/(?<=\n)/u).filter(Boolean).slice(-f)}u(B,"linesBefore");function H(t,a){return t.slice(a).split(/(?<=\n)/u).filter(Boolean).slice(0,f)}u(H,"linesAfter");function R(t,a){return p(t.slice(0,a))+1}u(R,"lineAtOffset");function p(t){return[...t.matchAll(/\n/gu)].length}u(p,"lineBreakCount");function L(t){return w("sha256").update(t).digest("hex")}u(L,"sha256");function T(t,a){for(let r=G;r<=t.length;r++){let n=t.slice(0,r);if(a.filter(e=>e.startsWith(n)).length===1)return n}return t}u(T,"shortestUniquePrefix");export{P as a,U as b,_ as c};
@@ -1 +1 @@
1
- import{b as y}from"./chunk-V6IPWCPS.js";import{a as c,g as m}from"./chunk-KJAR2WDO.js";import{q as w}from"./chunk-S3T5NOSL.js";import{a as p}from"./chunk-EI7MMDWY.js";import a from"node:path";async function C(e,f,t,v,h,n){n?.throwIfAborted();let i=c(e.target.id,f).path;if(t&&x(t,i))return{cwd:c(e.target.id,t).source,external:!1};let d=!1;try{d=(await e.stat(i,{signal:n})).kind==="directory"}catch(r){if(!(r instanceof m)||r.code!=="ENOENT")throw r}let g=d?h:h.filter(r=>w(r,i)),T=t===void 0&&x(e.target.workspace,i)?e.target.workspace:void 0,o=d?i:a.posix.dirname(i);for(;;){n?.throwIfAborted();let r=a.posix.join(o,".pi","pi-agent-ide",`${v}.json`),l=!1;try{await e.stat(r,{signal:n}),l=!0}catch(s){if(!(s instanceof m)||s.code!=="ENOENT")throw s}let E=!l&&g.length>0?[...(await y(e,o,g,n)).values()].some(s=>s.score>0):!1;if(l||E||o===T)return{cwd:c(e.target.id,o).source,external:t!==void 0};let u=a.posix.dirname(o);if(u===o)return;o=u}}p(C,"resolveSshToolProject");function x(e,f){let t=a.posix.relative(e,f);return t===""||t!==".."&&!t.startsWith("../")&&!a.posix.isAbsolute(t)}p(x,"inside");export{C as a};
1
+ import{b as y}from"./chunk-JHWLRL4U.js";import{a as c,g as m}from"./chunk-KJAR2WDO.js";import{q as w}from"./chunk-S3T5NOSL.js";import{a as p}from"./chunk-EI7MMDWY.js";import a from"node:path";async function C(e,f,t,v,h,n){n?.throwIfAborted();let i=c(e.target.id,f).path;if(t&&x(t,i))return{cwd:c(e.target.id,t).source,external:!1};let d=!1;try{d=(await e.stat(i,{signal:n})).kind==="directory"}catch(r){if(!(r instanceof m)||r.code!=="ENOENT")throw r}let g=d?h:h.filter(r=>w(r,i)),T=t===void 0&&x(e.target.workspace,i)?e.target.workspace:void 0,o=d?i:a.posix.dirname(i);for(;;){n?.throwIfAborted();let r=a.posix.join(o,".pi","pi-agent-ide",`${v}.json`),l=!1;try{await e.stat(r,{signal:n}),l=!0}catch(s){if(!(s instanceof m)||s.code!=="ENOENT")throw s}let E=!l&&g.length>0?[...(await y(e,o,g,n)).values()].some(s=>s.score>0):!1;if(l||E||o===T)return{cwd:c(e.target.id,o).source,external:t!==void 0};let u=a.posix.dirname(o);if(u===o)return;o=u}}p(C,"resolveSshToolProject");function x(e,f){let t=a.posix.relative(e,f);return t===""||t!==".."&&!t.startsWith("../")&&!a.posix.isAbsolute(t)}p(x,"inside");export{C as a};
@@ -1 +1 @@
1
- import{a as m}from"./chunk-ALZV2EYT.js";import{a as h}from"./chunk-ZC65Z3CK.js";import{a as s}from"./chunk-EI7MMDWY.js";import{createHash as g}from"node:crypto";var u=/^([1-9]\d*)#([A-Z0-9]{3,4})$/,x=/(?<![A-Za-z0-9])([1-9]\d*#[A-Z0-9]{3,4})(?![A-Za-z0-9])/g;function A(e){let n=[...e.matchAll(x)],t=n[0];return n.length===1&&t!==void 0?h(t[1]):e}s(A,"normalizeLineHashAnchor");var d=class extends m{static{s(this,"LineHashTextAnchor")}constructor(n,t){super(`${n}#${f(t)}`,n)}};function f(e){return g("sha1").update(e).digest("hex").slice(0,4).toUpperCase()}s(f,"hashLine");function p(e,n){return new d(e,n)}s(p,"createLineHashAnchor");function v(e,n){return p(e,n).value}s(v,"formatLineHashAnchor");function y(e,n=1,t=e.length){let o=Math.max(1,n),r=Math.min(e.length,t);if(r<o)return[];let a=e.map((i,l)=>v(l+1,i)),c=Math.max(0,...a.map(i=>i.length));return e.slice(o-1,r).map((i,l)=>`${h(a[o+l-1]).padStart(c)}|${i}`)}s(y,"renderLineHashLines");function k(){return{id:"line-hash",description:"Use the complete `LINE#HASH` printed before a source line, for example `12#A4F0`; the hash rejects stale text.",normalize:A,renderFull(e){return e},renderCompact(e){return`line ${u.exec(e)?.[1]??"?"}`},tryResolve(e,n){return Promise.resolve(b(e,n))},recover(e,n){let t=u.exec(e);if(t===null)return Promise.resolve({kind:"unavailable"});let o=Number(t[1]),r=Math.min(Math.max(1,o),n.lines.length),a=n.lines[r-1];return a===void 0?Promise.resolve({kind:"unavailable"}):Promise.resolve({kind:"candidates",total:1,candidates:[{rank:1,range:{start:{lineNumber:r,column:0},end:{lineNumber:r,column:a.length}}}]})}}}s(k,"createLineHashAnchorResolver");function b(e,n){let t=u.exec(e);if(t===null)return{kind:"not-handled"};let o=Number(t[1]),r=n.lines[o-1];if(r===void 0||f(r)!==t[2]){let c=Math.max(1,o-5),i=Math.min(n.lines.length,o+5);return{kind:"rejected",rejection:{code:r===void 0?"missing":"stale",reason:r===void 0?"line hash anchor is out of range":"line hash anchor is stale",contextRange:{offset:c,limit:i-c+1}}}}return{kind:"resolved",anchor:p(o,r)}}s(b,"resolveLineHashAnchor");export{f as a,p as b,v as c,y as d,k as e};
1
+ import{a as m}from"./chunk-S7E2D5K7.js";import{a as h}from"./chunk-ZC65Z3CK.js";import{a as s}from"./chunk-EI7MMDWY.js";import{createHash as g}from"node:crypto";var u=/^([1-9]\d*)#([A-Z0-9]{3,4})$/,x=/(?<![A-Za-z0-9])([1-9]\d*#[A-Z0-9]{3,4})(?![A-Za-z0-9])/g;function A(e){let n=[...e.matchAll(x)],t=n[0];return n.length===1&&t!==void 0?h(t[1]):e}s(A,"normalizeLineHashAnchor");var d=class extends m{static{s(this,"LineHashTextAnchor")}constructor(n,t){super(`${n}#${f(t)}`,n)}};function f(e){return g("sha1").update(e).digest("hex").slice(0,4).toUpperCase()}s(f,"hashLine");function p(e,n){return new d(e,n)}s(p,"createLineHashAnchor");function v(e,n){return p(e,n).value}s(v,"formatLineHashAnchor");function y(e,n=1,t=e.length){let o=Math.max(1,n),r=Math.min(e.length,t);if(r<o)return[];let a=e.map((i,l)=>v(l+1,i)),c=Math.max(0,...a.map(i=>i.length));return e.slice(o-1,r).map((i,l)=>`${h(a[o+l-1]).padStart(c)}|${i}`)}s(y,"renderLineHashLines");function k(){return{id:"line-hash",description:"Use the complete `LINE#HASH` printed before a source line, for example `12#A4F0`; the hash rejects stale text.",normalize:A,renderFull(e){return e},renderCompact(e){return`line ${u.exec(e)?.[1]??"?"}`},tryResolve(e,n){return Promise.resolve(b(e,n))},recover(e,n){let t=u.exec(e);if(t===null)return Promise.resolve({kind:"unavailable"});let o=Number(t[1]),r=Math.min(Math.max(1,o),n.lines.length),a=n.lines[r-1];return a===void 0?Promise.resolve({kind:"unavailable"}):Promise.resolve({kind:"candidates",total:1,candidates:[{rank:1,range:{start:{lineNumber:r,column:0},end:{lineNumber:r,column:a.length}}}]})}}}s(k,"createLineHashAnchorResolver");function b(e,n){let t=u.exec(e);if(t===null)return{kind:"not-handled"};let o=Number(t[1]),r=n.lines[o-1];if(r===void 0||f(r)!==t[2]){let c=Math.max(1,o-5),i=Math.min(n.lines.length,o+5);return{kind:"rejected",rejection:{code:r===void 0?"missing":"stale",reason:r===void 0?"line hash anchor is out of range":"line hash anchor is stale",contextRange:{offset:c,limit:i-c+1}}}}return{kind:"resolved",anchor:p(o,r)}}s(b,"resolveLineHashAnchor");export{f as a,p as b,v as c,y as d,k as e};
@@ -1 +1 @@
1
- import{a as C}from"./chunk-UCTBXRGA.js";import{a as w}from"./chunk-TSNY2FSU.js";import{a as E,b as g}from"./chunk-V6IPWCPS.js";import{b as S}from"./chunk-FTECKRK6.js";import"./chunk-PPCWY4BB.js";import{a as u,b as v,c as U}from"./chunk-NFXS3E2A.js";import"./chunk-5W6QQZFI.js";import{g as l}from"./chunk-KJAR2WDO.js";import{a as p,b as O,c as f,e as j}from"./chunk-MZW7L37L.js";import"./chunk-K5G4FDXD.js";import{c as R}from"./chunk-XHFAV2NI.js";import"./chunk-72FL5FHZ.js";import{c as P}from"./chunk-S3T5NOSL.js";import"./chunk-BXGMMZT3.js";import"./chunk-MDD5ORB6.js";import"./chunk-MLFJU2US.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import{a as s}from"./chunk-EI7MMDWY.js";import h from"node:path";import{fileURLToPath as x}from"node:url";function A(i){let c=E(i),T=w(i);return{async resolveProject(e,o){if(e.startsWith("ssh://")||o.startsWith("ssh://")){let n=i.resolve(e,o);if(!n)throw new l("UNSUPPORTED_SOURCE",e,"not-applied");let a=i.resolve(o);if(a&&a.location.target!==n.location.target)throw new l("UNSUPPORTED_SOURCE",e,"not-applied");let r=await C(n.backend,n.location.path,a?.location.path,"linters",p);return r?{projectRoot:r.cwd,external:r.external}:void 0}if(e.includes("://")||o.includes("://"))throw new l("UNSUPPORTED_SOURCE",e,"not-applied");let t=await P(o,e,"linters",p);return t===void 0?void 0:{projectRoot:t,external:t!==h.resolve(o)}},async loadRegistry(e,o){let t=i.resolve(e);return O.fromDirectory(e,{includeGlobal:!o,requireBuiltInEvidence:!0,...t?{layerAccess:c,executableAvailability:s(n=>S(t.backend,t.location.path,n),"executableAvailability"),recipeEvidence:s(n=>g(t.backend,t.location.path,n),"recipeEvidence")}:{}})},async run(e,o){let t=i.resolve(o.filePath);if(!t)return f(e,o);let n=i.resolve(o.projectRoot);if(!n||n.location.target!==t.location.target)throw new l("UNSUPPORTED_SOURCE",o.filePath,"not-applied");let a=e.check.cwd==="file"?h.posix.dirname(t.location.path):n.location.path;return f(e,{...o,processAccess:T,acceptsFile(r){if(r.startsWith("ssh://")){let d=i.resolve(r);return d?.location.target===t.location.target&&d.location.path===t.location.path}let m=r.startsWith("file:")?x(r):r;return m.includes("://")?!1:h.posix.resolve(a,m)===t.location.path}})}}}s(A,"createOwnedLintRuntime");async function L(i){let c=new U(await v(u(R())));await j(i,A(c))}s(L,"registerOwnedLint");export{A as createOwnedLintRuntime,L as default};
1
+ import{a as C}from"./chunk-FBR7ZLLN.js";import{a as w}from"./chunk-TSNY2FSU.js";import{a as E,b as g}from"./chunk-JHWLRL4U.js";import{b as S}from"./chunk-FTECKRK6.js";import"./chunk-PPCWY4BB.js";import{a as u,b as v,c as U}from"./chunk-V2D5MLGE.js";import"./chunk-5W6QQZFI.js";import{g as l}from"./chunk-KJAR2WDO.js";import{a as p,b as O,c as f,e as j}from"./chunk-OIEA4QWF.js";import"./chunk-K5G4FDXD.js";import{c as R}from"./chunk-XHFAV2NI.js";import"./chunk-72FL5FHZ.js";import{c as P}from"./chunk-S3T5NOSL.js";import"./chunk-BXGMMZT3.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import{a as s}from"./chunk-EI7MMDWY.js";import h from"node:path";import{fileURLToPath as x}from"node:url";function A(i){let c=E(i),T=w(i);return{async resolveProject(e,o){if(e.startsWith("ssh://")||o.startsWith("ssh://")){let n=i.resolve(e,o);if(!n)throw new l("UNSUPPORTED_SOURCE",e,"not-applied");let a=i.resolve(o);if(a&&a.location.target!==n.location.target)throw new l("UNSUPPORTED_SOURCE",e,"not-applied");let r=await C(n.backend,n.location.path,a?.location.path,"linters",p);return r?{projectRoot:r.cwd,external:r.external}:void 0}if(e.includes("://")||o.includes("://"))throw new l("UNSUPPORTED_SOURCE",e,"not-applied");let t=await P(o,e,"linters",p);return t===void 0?void 0:{projectRoot:t,external:t!==h.resolve(o)}},async loadRegistry(e,o){let t=i.resolve(e);return O.fromDirectory(e,{includeGlobal:!o,requireBuiltInEvidence:!0,...t?{layerAccess:c,executableAvailability:s(n=>S(t.backend,t.location.path,n),"executableAvailability"),recipeEvidence:s(n=>g(t.backend,t.location.path,n),"recipeEvidence")}:{}})},async run(e,o){let t=i.resolve(o.filePath);if(!t)return f(e,o);let n=i.resolve(o.projectRoot);if(!n||n.location.target!==t.location.target)throw new l("UNSUPPORTED_SOURCE",o.filePath,"not-applied");let a=e.check.cwd==="file"?h.posix.dirname(t.location.path):n.location.path;return f(e,{...o,processAccess:T,acceptsFile(r){if(r.startsWith("ssh://")){let d=i.resolve(r);return d?.location.target===t.location.target&&d.location.path===t.location.path}let m=r.startsWith("file:")?x(r):r;return m.includes("://")?!1:h.posix.resolve(a,m)===t.location.path}})}}}s(A,"createOwnedLintRuntime");async function L(i){let c=new U(await v(u(R())));await j(i,A(c))}s(L,"registerOwnedLint");export{A as createOwnedLintRuntime,L as default};
@@ -0,0 +1 @@
1
+ import{a as t}from"./chunk-EI7MMDWY.js";import{Type as e}from"typebox";import{Value as n}from"typebox/value";var i="pi-agent-read",r=14,c=`${i}/core/ready`,s=`${i}/plugin/register`,a=e.Function([],e.Unknown()),p=e.Object({protocol:e.Literal(i),apiVersion:e.Literal(r)}),R=e.Object({protocol:e.Literal(i),apiVersion:e.Literal(r),id:e.String(),setup:a}),l=e.Object({plugin:R,accept:a});function g(o){return n.Check(p,o)}t(g,"isReadCoreReady");function P(o){return n.Check(R,o)}t(P,"isReadPlugin");function y(o){return n.Check(l,o)}t(y,"isReadPluginRegistrationRequest");export{i as a,r as b,c,s as d,g as e,P as f,y as g};
@@ -1,3 +1,3 @@
1
- import{a as S}from"./chunk-ALZV2EYT.js";import{a as c}from"./chunk-EI7MMDWY.js";import{createRequire as F}from"node:module";import{Lang as y,parse as R,registerDynamicLanguage as B}from"@ast-grep/napi";var D=F(new URL("../src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts",import.meta.url).href),$={bash:"@ast-grep/lang-bash",csharp:"@ast-grep/lang-csharp",dart:"@ast-grep/lang-dart",elixir:"@ast-grep/lang-elixir",go:"@ast-grep/lang-go",html:"@ast-grep/lang-html",java:"@ast-grep/lang-java",kotlin:"@ast-grep/lang-kotlin",lua:"@ast-grep/lang-lua",markdown:"@ast-grep/lang-markdown",php:"@ast-grep/lang-php",ruby:"@ast-grep/lang-ruby",scala:"@ast-grep/lang-scala",sql:"@ast-grep/lang-sql",swift:"@ast-grep/lang-swift"},O={".bash":"bash",".cs":"csharp",".css":y.Css,".less":y.Css,".scss":y.Css,".dart":"dart",".ex":"elixir",".exs":"elixir",".go":"go",".htm":"html",".html":"html",".java":"java",".kt":"kotlin",".kts":"kotlin",".lua":"lua",".md":"markdown",".mdx":"markdown",".php":"php",".rb":"ruby",".rake":"ruby",".scala":"scala",".sc":"scala",".sql":"sql",".sh":"bash",".swift":"swift"},N=!1;function q(){if(N)return;let r={};for(let[e,t]of Object.entries($))r[e]=D(t);B(r),N=!0}c(q,"ensureLanguagesRegistered");function P(r,e){let t=O[r];if(t)return q(),{rootNode:new b(R(t,e).root(),e)}}c(P,"parseNativeDocument");var b=class r{constructor(e,t){this.node=e;this.source=t}static{c(this,"NativeSyntaxNode")}get type(){return String(this.node.kind())}get text(){return this.node.text()}get isNamed(){return this.node.isNamed()}get hasError(){return this.type==="ERROR"||this.node.children().some(e=>new r(e,this.source).hasError)}get startIndex(){return C(this.source,this.node.range().start.index)}get endIndex(){return C(this.source,this.node.range().end.index)}get startPosition(){let{line:e,column:t}=this.node.range().start;return{row:e,column:t}}get endPosition(){let{line:e,column:t}=this.node.range().end;return{row:e,column:t}}get parent(){let e=this.node.parent();return e?new r(e,this.source):null}get namedChildCount(){return this.namedChildren.length}get namedChildren(){return this.node.children().filter(e=>e.isNamed()).map(e=>new r(e,this.source))}childForFieldName(e){let t=this.node.field(e);return t?new r(t,this.source):null}};function C(r,e){return Buffer.from(r).subarray(0,e).toString("utf8").length}c(C,"byteOffsetToStringIndex");import{createHash as W}from"node:crypto";import{createRequire as I}from"node:module";import L from"node:path";import*as p from"web-tree-sitter";var M=I(new URL("../src/plugins/pi-agent-ide-ast/src/ast/manager.ts",import.meta.url).href),G=new Set(["program","module"]),x=new Set(["body","consequence","alternative","handler","finalizer"]);function k(r){let{startPosition:e,endPosition:t}=r;return`${r.type}:${e.row}:${e.column}:${t.row}:${t.column}`}c(k,"siblingKey");var T,A=new Map;function U(r){switch(r){case".ts":case".tsx":case".mts":case".cts":return"tree-sitter-typescript/tree-sitter-typescript.wasm";case".js":case".jsx":case".mjs":case".cjs":return"tree-sitter-javascript/tree-sitter-javascript.wasm";case".py":case".pyi":return"tree-sitter-python/tree-sitter-python.wasm";case".rs":return"tree-sitter-rust/tree-sitter-rust.wasm";case".c":case".cc":case".hh":case".hxx":case".cpp":case".cxx":case".h":case".hpp":return"tree-sitter-cpp/tree-sitter-cpp.wasm";case".json":case".jsonc":return"tree-sitter-json/tree-sitter-json.wasm";case".yaml":case".yml":return"@tree-sitter-grammars/tree-sitter-yaml/tree-sitter-yaml.wasm";case".toml":return"@tree-sitter-grammars/tree-sitter-toml/tree-sitter-toml.wasm";default:return}}c(U,"grammarWasmPath");async function H(r){let e=U(r);if(!e)return;T??=p.Parser.init(),await T;let t=A.get(e);if(t===void 0){let o=M.resolve(e);t=p.Language.load(o),A.set(e,t)}let i=await t,a=new p.Parser;return a.setLanguage(i),a}c(H,"ensureParser");async function K(r,e,t,i){let a=await z(r,e,t);try{return await i(a)}finally{a?.delete?.()}}c(K,"withParsedDocument");async function z(r,e,t){if(t.length===0)return;let i=r.includes("://")||L.isAbsolute(r)?r:L.resolve(e,r),a=L.extname(i).toLowerCase(),o=t.join(`
1
+ import{a as S}from"./chunk-S7E2D5K7.js";import{a as c}from"./chunk-EI7MMDWY.js";import{createRequire as F}from"node:module";import{Lang as y,parse as R,registerDynamicLanguage as B}from"@ast-grep/napi";var D=F(new URL("../src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts",import.meta.url).href),$={bash:"@ast-grep/lang-bash",csharp:"@ast-grep/lang-csharp",dart:"@ast-grep/lang-dart",elixir:"@ast-grep/lang-elixir",go:"@ast-grep/lang-go",html:"@ast-grep/lang-html",java:"@ast-grep/lang-java",kotlin:"@ast-grep/lang-kotlin",lua:"@ast-grep/lang-lua",markdown:"@ast-grep/lang-markdown",php:"@ast-grep/lang-php",ruby:"@ast-grep/lang-ruby",scala:"@ast-grep/lang-scala",sql:"@ast-grep/lang-sql",swift:"@ast-grep/lang-swift"},O={".bash":"bash",".cs":"csharp",".css":y.Css,".less":y.Css,".scss":y.Css,".dart":"dart",".ex":"elixir",".exs":"elixir",".go":"go",".htm":"html",".html":"html",".java":"java",".kt":"kotlin",".kts":"kotlin",".lua":"lua",".md":"markdown",".mdx":"markdown",".php":"php",".rb":"ruby",".rake":"ruby",".scala":"scala",".sc":"scala",".sql":"sql",".sh":"bash",".swift":"swift"},N=!1;function q(){if(N)return;let r={};for(let[e,t]of Object.entries($))r[e]=D(t);B(r),N=!0}c(q,"ensureLanguagesRegistered");function P(r,e){let t=O[r];if(t)return q(),{rootNode:new b(R(t,e).root(),e)}}c(P,"parseNativeDocument");var b=class r{constructor(e,t){this.node=e;this.source=t}static{c(this,"NativeSyntaxNode")}get type(){return String(this.node.kind())}get text(){return this.node.text()}get isNamed(){return this.node.isNamed()}get hasError(){return this.type==="ERROR"||this.node.children().some(e=>new r(e,this.source).hasError)}get startIndex(){return C(this.source,this.node.range().start.index)}get endIndex(){return C(this.source,this.node.range().end.index)}get startPosition(){let{line:e,column:t}=this.node.range().start;return{row:e,column:t}}get endPosition(){let{line:e,column:t}=this.node.range().end;return{row:e,column:t}}get parent(){let e=this.node.parent();return e?new r(e,this.source):null}get namedChildCount(){return this.namedChildren.length}get namedChildren(){return this.node.children().filter(e=>e.isNamed()).map(e=>new r(e,this.source))}childForFieldName(e){let t=this.node.field(e);return t?new r(t,this.source):null}};function C(r,e){return Buffer.from(r).subarray(0,e).toString("utf8").length}c(C,"byteOffsetToStringIndex");import{createHash as W}from"node:crypto";import{createRequire as I}from"node:module";import L from"node:path";import*as p from"web-tree-sitter";var M=I(new URL("../src/plugins/pi-agent-ide-ast/src/ast/manager.ts",import.meta.url).href),G=new Set(["program","module"]),x=new Set(["body","consequence","alternative","handler","finalizer"]);function k(r){let{startPosition:e,endPosition:t}=r;return`${r.type}:${e.row}:${e.column}:${t.row}:${t.column}`}c(k,"siblingKey");var T,A=new Map;function U(r){switch(r){case".ts":case".tsx":case".mts":case".cts":return"tree-sitter-typescript/tree-sitter-typescript.wasm";case".js":case".jsx":case".mjs":case".cjs":return"tree-sitter-javascript/tree-sitter-javascript.wasm";case".py":case".pyi":return"tree-sitter-python/tree-sitter-python.wasm";case".rs":return"tree-sitter-rust/tree-sitter-rust.wasm";case".c":case".cc":case".hh":case".hxx":case".cpp":case".cxx":case".h":case".hpp":return"tree-sitter-cpp/tree-sitter-cpp.wasm";case".json":case".jsonc":return"tree-sitter-json/tree-sitter-json.wasm";case".yaml":case".yml":return"@tree-sitter-grammars/tree-sitter-yaml/tree-sitter-yaml.wasm";case".toml":return"@tree-sitter-grammars/tree-sitter-toml/tree-sitter-toml.wasm";default:return}}c(U,"grammarWasmPath");async function H(r){let e=U(r);if(!e)return;T??=p.Parser.init(),await T;let t=A.get(e);if(t===void 0){let o=M.resolve(e);t=p.Language.load(o),A.set(e,t)}let i=await t,a=new p.Parser;return a.setLanguage(i),a}c(H,"ensureParser");async function K(r,e,t,i){let a=await z(r,e,t);try{return await i(a)}finally{a?.delete?.()}}c(K,"withParsedDocument");async function z(r,e,t){if(t.length===0)return;let i=r.includes("://")||L.isAbsolute(r)?r:L.resolve(e,r),a=L.extname(i).toLowerCase(),o=t.join(`
2
2
  `),d=await H(a);if(d)try{return d.parse(o)??void 0}finally{d.delete()}return P(a,o)}c(z,"parseDocument");function v(r,e,t){let i=r.slice(Math.max(0,e-1),Math.max(0,t)).join(`
3
3
  `);return W("sha1").update(i).digest("hex").slice(0,4).toUpperCase()}c(v,"hashScope");var w=class extends S{static{c(this,"AstScopeTextAnchor")}constructor(e,t,i,a){super(`scope-${e}-${t}${a===void 0?"":`-${a}`}`,i)}};function h(r,e,t,i){return new w(r,e,t,i)}c(h,"createScopeAnchor");var E=class{static{c(this,"AstScopeManager")}async getDocumentScopes(e,t,i){return i.length===0?[]:await K(e,t,i,a=>{if(!a)return[];let o=[];return this.collectCandidates(a.rootNode,o),this.buildEntries(o,i)})}collectCandidates(e,t,i=0,a=!1){if(i>100||!e.isNamed)return;let o=e.type;if(!o||G.has(o)){for(let n of e.namedChildren)this.collectCandidates(n,t,i+1);return}let d=new Set;for(let n of x){let s=e.childForFieldName(n);if(!s?.isNamed)continue;d.add(k(s));let u=s.startPosition.row+1,m=s.endPosition.row+1,l=m-u>=3,g=[...x].some(j=>s.childForFieldName(j)!==null);l&&!g&&t.push({startLine:u,endLine:m,kind:`${o}.${n}`,fromBodyField:!0}),this.collectCandidates(s,t,i+1,!0)}if(![...x].some(n=>e.childForFieldName(n)!==null)&&!a){let n=e.startPosition.row+1,s=e.endPosition.row+1;s-n>=3&&e.namedChildren.length>0&&t.push({startLine:n,endLine:s,kind:o,fromBodyField:!1})}for(let n of e.namedChildren)d.has(k(n))||this.collectCandidates(n,t,i+1)}buildEntries(e,t){let i=new Map;for(let n of e){let s=i.get(n.startLine);(!s||n.endLine>s.endLine||n.endLine===s.endLine&&n.fromBodyField&&!s.fromBodyField)&&i.set(n.startLine,n)}let a=[...i.values()].sort((n,s)=>n.startLine-s.startLine||s.endLine-n.endLine),o=[];for(let n of a)o.some(u=>u.startLine<n.startLine&&u.endLine===n.endLine)||o.push(n);let d=new Map;for(let n of o){let s=v(t,n.startLine,n.endLine);d.set(s,(d.get(s)??0)+1)}let f=new Map;return o.map(n=>{let s=v(t,n.startLine,n.endLine),u=d.get(s)??1,m=(f.get(s)??0)+1;f.set(s,m);let l=u>1?m:void 0;return{name:n.kind,kind:n.kind,startLine:n.startLine,endLine:n.endLine,depth:o.filter(g=>g!==n&&g.startLine<=n.startLine&&g.endLine>=n.endLine&&(g.startLine<n.startLine||g.endLine>n.endLine)).length,hash:s,blockHash:s,...l!==void 0&&{occurrence:l},beginAnchor:h("begin",s,n.startLine,l),endScopeAnchor:h("end",s,n.endLine,l),scopeBeginAnchor:h("begin",s,n.startLine,l),scopeEndAnchor:h("end",s,n.endLine,l)}})}};export{O as a,K as b,E as c};
@@ -1,4 +1,4 @@
1
- import{a as x}from"./chunk-GCJHOMSI.js";import{a}from"./chunk-EI7MMDWY.js";import{Worker as v}from"node:worker_threads";var y=String.raw`
1
+ import{a as x}from"./chunk-P7FUD4WY.js";import{a}from"./chunk-EI7MMDWY.js";import{Worker as v}from"node:worker_threads";var y=String.raw`
2
2
  const { parentPort, workerData } = require("node:worker_threads");
3
3
  let fuzzy;
4
4
  let prepared;
@@ -1 +1 @@
1
- import{a as _}from"./chunk-KX7MG72M.js";import{a as A}from"./chunk-FTECKRK6.js";import{a as W,g as n}from"./chunk-KJAR2WDO.js";import{a as u}from"./chunk-EI7MMDWY.js";import{Writable as M}from"node:stream";import{callbackify as N}from"node:util";import{fileURLToPath as $,pathToFileURL as G}from"node:url";import{readFile as x}from"node:fs/promises";import U from"node:path";import{createInterface as H}from"node:readline";import{fileURLToPath as j}from"node:url";import{Type as i}from"typebox";import{Value as B}from"typebox/value";var V=i.Union([i.Object({kind:i.Literal("ready")}),i.Object({kind:i.Literal("change"),path:i.String(),type:i.Union([i.Literal(1),i.Literal(2),i.Literal(3)])}),i.Object({kind:i.Literal("error"),code:i.Union([i.Literal("WATCH_FAILED"),i.Literal("WATCH_LIMIT"),i.Literal("WATCH_OVERFLOW")])})]);function J(h,s){let c=U.posix.relative(h,s);return c===""||c!==".."&&!c.startsWith("../")&&!U.posix.isAbsolute(c)}u(J,"inside");function I(h,s,c,e){let r=h.resolve(s);if(!r)throw new n("UNSUPPORTED_SOURCE",s,"not-applied");let d=!1,m=new Map,l=new Set,P=u(o=>d||o.closed,"closed"),p=u(o=>(o.closed=!0,o.channel&&(o.stopping??=o.channel.stop().then(()=>{})),o.stopping??Promise.resolve()),"release"),y={async register(o,w){if(d)throw new n("WATCH_DISPOSED",s,"not-applied");let E=w.map(L=>{let f=L.globPattern,S=typeof f=="string"?s:typeof f.baseUri=="string"?f.baseUri:f.baseUri.uri,g=S.startsWith("file://")?W(r.location.target,j(S)).source:S,v=h.resolve(g);if(!v||v.location.target!==r.location.target)throw new n("UNSUPPORTED_SOURCE",g,"not-applied");let O=L.kind??7;if(!Number.isInteger(O)||O<0||O>7)throw new TypeError("Invalid file watcher event mask");return{root:v.location.path,expression:typeof f=="string"?f:f.pattern,kind:O}});if(E.length===0){await y.unregister(o);return}let t={id:o,closed:!1,starting:Promise.resolve()};l.add(t),t.starting=(async()=>{let L=await x(new URL("./file-watch-worker.py",new URL("../src/backend/lsp-file-watchers.ts",import.meta.url).href),"utf8");if(P(t))throw new n("WATCH_DISPOSED",s,"not-applied");let f=await r.backend.startProcess("python3",["-u","-c",L,JSON.stringify([...new Set(E.map(k=>k.root))])],r.location.path);if(t.channel=f,f.stderr.resume(),P(t))throw await p(t),new n("WATCH_DISPOSED",s,"not-applied");let S=H({input:f.stdout}),g=!1,v=!1;if(await new Promise((k,b)=>{let R=u(C=>{if(v||t.closed)return;v=!0;let a=new n(C,s,"not-applied");g?e(a):b(a),p(t).catch(e)},"fail");S.on("line",C=>{if(t.closed)return;let a;try{a=JSON.parse(C)}catch{R("INVALID_RESPONSE");return}if(!B.Check(V,a)){R("INVALID_RESPONSE");return}if(a.kind==="ready"){g=!0,k();return}if(a.kind==="error"){R(a.code);return}if(!g){R("INVALID_RESPONSE");return}if(m.get(o)!==t)return;E.some(T=>{if(!J(T.root,a.path))return!1;let F=U.posix.relative(T.root,a.path);return(T.kind&(a.type===1?1:a.type===2?2:4))!==0&&U.matchesGlob(U.posix.isAbsolute(T.expression)?a.path:F,T.expression)})&&c({uri:W(r.location.target,a.path).source,type:a.type})}),f.completion.then(()=>{S.close(),g?t.closed||R("WATCH_FAILED"):b(new n("WATCH_FAILED",s,"not-applied"))},()=>{S.close(),g?t.closed||R("WATCH_FAILED"):b(new n("WATCH_FAILED",s,"not-applied"))})}),P(t))throw await p(t),new n("WATCH_DISPOSED",s,"not-applied");let D=m.get(o);m.set(o,t),D&&await p(D)})();try{await t.starting}catch(L){throw await p(t),L}finally{l.delete(t)}},async unregister(o){let w=m.get(o);m.delete(o);let E=[...l].filter(t=>t.id===o);await Promise.all([...E,...w?[w]:[]].map(p)),await Promise.allSettled(E.map(t=>t.starting))},async dispose(){d=!0;let o=new Set([...m.keys(),...[...l].map(w=>w.id)]);await Promise.all([...o].map(w=>y.unregister(w)))}};return y}u(I,"createSshLspFileWatchers");function he(h,s){let c=h.resolve(s);if(!c)throw new n("UNSUPPORTED_SOURCE",s,"not-applied");return{async start(e){let r=h.resolve(e.rootUri);if(!r||r.location.target!==c.location.target)throw new n("UNSUPPORTED_SOURCE",e.rootUri,"not-applied");let d=e.command.map(p=>p.replaceAll("{project}",r.location.path));if(!d[0])throw new TypeError("Language server command is empty");let m=Object.entries(await A(r.backend,r.location.path,e.env,e.signal)).map(([p,y])=>`${p}=${y}`),l=await r.backend.startProcess("env",[...m,...d],r.location.path,{signal:e.signal}),P=new M({write:N(async(p,y)=>{await l.write(p)}),final:N(async()=>{await l.end()})});return{stdin:P,stdout:l.stdout,stderr:l.stderr,completion:l.completion,remote:{target:r.location.target,pid:l.pid},async stop(){try{await _(l,h,e.rootUri)}finally{P.destroy()}}}},fileWatchers(e,r,d){let m=h.resolve(e);if(!m||m.location.target!==c.location.target)throw new n("UNSUPPORTED_SOURCE",e,"not-applied");return I(h,e,r,d)},toServerUri(e){if(!e.startsWith("ssh://")){if(e.startsWith("file://"))throw new n("UNSUPPORTED_SOURCE",e,"not-applied");return e}let r=h.resolve(e);if(!r||r.location.target!==c.location.target)throw new n("UNSUPPORTED_SOURCE",e,"not-applied");return G(r.location.path).href},fromServerUri(e){return e.startsWith("file://")?W(c.location.target,$(e)).source:e}}}u(he,"createSshLspTransport");export{he as a};
1
+ import{a as _}from"./chunk-KX7MG72M.js";import{a as A}from"./chunk-FTECKRK6.js";import{a as W,g as n}from"./chunk-KJAR2WDO.js";import{a as u}from"./chunk-EI7MMDWY.js";import{Writable as M}from"node:stream";import{callbackify as N}from"node:util";import{fileURLToPath as $,pathToFileURL as G}from"node:url";import{readFile as x}from"node:fs/promises";import U from"node:path";import{createInterface as H}from"node:readline";import{fileURLToPath as B}from"node:url";import{Type as i}from"typebox";import{Value as j}from"typebox/value";var V=i.Union([i.Object({kind:i.Literal("ready")}),i.Object({kind:i.Literal("change"),path:i.String(),type:i.Union([i.Literal(1),i.Literal(2),i.Literal(3)])}),i.Object({kind:i.Literal("error"),code:i.Union([i.Literal("WATCH_FAILED"),i.Literal("WATCH_LIMIT"),i.Literal("WATCH_OVERFLOW")])})]);function J(h,s){let c=U.posix.relative(h,s);return c===""||c!==".."&&!c.startsWith("../")&&!U.posix.isAbsolute(c)}u(J,"inside");function I(h,s,c,t){let r=h.resolve(s);if(!r)throw new n("UNSUPPORTED_SOURCE",s,"not-applied");let d=!1,m=new Map,l=new Set,P=u(o=>d||o.closed,"closed"),p=u(o=>(o.closed=!0,o.channel&&(o.stopping??=o.channel.stop().then(()=>{})),o.stopping??Promise.resolve()),"release"),y={async register(o,w){if(d)throw new n("WATCH_DISPOSED",s,"not-applied");let E=w.map(L=>{let f=L.globPattern,S=typeof f=="string"?s:typeof f.baseUri=="string"?f.baseUri:f.baseUri.uri,g=S.startsWith("file://")?W(r.location.target,B(S)).source:S,v=h.resolve(g);if(!v||v.location.target!==r.location.target)throw new n("UNSUPPORTED_SOURCE",g,"not-applied");let O=L.kind??7;if(!Number.isInteger(O)||O<0||O>7)throw new TypeError("Invalid file watcher event mask");return{root:v.location.path,expression:typeof f=="string"?f:f.pattern,kind:O}});if(E.length===0){await y.unregister(o);return}let e={id:o,closed:!1,starting:Promise.resolve()};l.add(e),e.starting=(async()=>{let L=await x(new URL("./file-watch-worker.py",new URL("../src/backend/lsp-file-watchers.ts",import.meta.url).href),"utf8");if(P(e))throw new n("WATCH_DISPOSED",s,"not-applied");let f=await r.backend.startProcess("python3",["-u","-c",L,JSON.stringify([...new Set(E.map(k=>k.root))])],r.location.path);if(e.channel=f,f.stderr.resume(),P(e))throw await p(e),new n("WATCH_DISPOSED",s,"not-applied");let S=H({input:f.stdout}),g=!1,v=!1;if(await new Promise((k,b)=>{let R=u(C=>{if(v||e.closed)return;v=!0;let a=new n(C,s,"not-applied");g?t(a):b(a),p(e).catch(t)},"fail");S.on("line",C=>{if(e.closed)return;let a;try{a=JSON.parse(C)}catch{R("INVALID_RESPONSE");return}if(!j.Check(V,a)){R("INVALID_RESPONSE");return}if(a.kind==="ready"){g=!0,k();return}if(a.kind==="error"){R(a.code);return}if(!g){R("INVALID_RESPONSE");return}if(m.get(o)!==e)return;E.some(T=>{if(!J(T.root,a.path))return!1;let F=U.posix.relative(T.root,a.path);return(T.kind&(a.type===1?1:a.type===2?2:4))!==0&&U.matchesGlob(U.posix.isAbsolute(T.expression)?a.path:F,T.expression)})&&c({uri:W(r.location.target,a.path).source,type:a.type})}),f.completion.then(()=>{S.close(),g?e.closed||R("WATCH_FAILED"):b(new n("WATCH_FAILED",s,"not-applied"))},()=>{S.close(),g?e.closed||R("WATCH_FAILED"):b(new n("WATCH_FAILED",s,"not-applied"))})}),P(e))throw await p(e),new n("WATCH_DISPOSED",s,"not-applied");let D=m.get(o);m.set(o,e),D&&await p(D)})();try{await e.starting}catch(L){throw await p(e),L}finally{l.delete(e)}},async unregister(o){let w=m.get(o);m.delete(o);let E=[...l].filter(e=>e.id===o);await Promise.all([...E,...w?[w]:[]].map(p)),await Promise.allSettled(E.map(e=>e.starting))},async dispose(){d=!0;let o=new Set([...m.keys(),...[...l].map(w=>w.id)]);await Promise.all([...o].map(w=>y.unregister(w)))}};return y}u(I,"createSshLspFileWatchers");function ht(h,s){let c=h.resolve(s);if(!c)throw new n("UNSUPPORTED_SOURCE",s,"not-applied");return{async start(t){let r=h.resolve(t.rootUri);if(!r||r.location.target!==c.location.target)throw new n("UNSUPPORTED_SOURCE",t.rootUri,"not-applied");let d=t.command.map(p=>p.replaceAll("{project}",r.location.path));if(!d[0])throw new TypeError("Language server command is empty");let m=Object.entries(await A(r.backend,r.location.path,t.env,t.signal)).map(([p,y])=>`${p}=${y}`),l=await r.backend.startProcess("env",[...m,...d],r.location.path,{signal:t.signal}),P=new M({write:N(async(p,y)=>{await l.write(p)}),final:N(async()=>{await l.end()})});return{stdin:P,stdout:l.stdout,stderr:l.stderr,completion:l.completion,remote:{target:r.location.target,pid:l.pid},async stop(){try{await _(l,h,t.rootUri)}finally{P.destroy()}}}},fileWatchers(t,r,d){let m=h.resolve(t);if(!m||m.location.target!==c.location.target)throw new n("UNSUPPORTED_SOURCE",t,"not-applied");return I(h,t,r,d)},toServerUri(t){if(!t.startsWith("ssh://")){if(t.startsWith("file://"))throw new n("UNSUPPORTED_SOURCE",t,"not-applied");return t}let r=h.resolve(t);if(!r||r.location.target!==c.location.target)throw new n("UNSUPPORTED_SOURCE",t,"not-applied");return G(r.location.path).href},fromServerUri(t){return t.startsWith("file://")?W(c.location.target,$(t)).source:t}}}u(ht,"createSshLspTransport");export{ht as a};
@@ -1,4 +1,4 @@
1
- import{a as le,b as fe,c as ue}from"./chunk-NFXS3E2A.js";import{a as de}from"./chunk-5W6QQZFI.js";import{a as N,g as l}from"./chunk-KJAR2WDO.js";import{c as ce}from"./chunk-XHFAV2NI.js";import"./chunk-NNCZYO4Q.js";import{a as ne}from"./chunk-47SPPIXK.js";import{a as te,b as re}from"./chunk-VAXLSPPU.js";import{f as Z,g as ee}from"./chunk-KN6VPARZ.js";import{d as q}from"./chunk-FUOB54RU.js";import"./chunk-PS2B6THP.js";import{a as ie}from"./chunk-37UNDG6V.js";import{b as x,c as Q,d as X}from"./chunk-6TOFURDG.js";import{a as W}from"./chunk-BU7IZLKB.js";import{a as $,b as K}from"./chunk-S5PL5DFQ.js";import{I as H}from"./chunk-SIYPD5MM.js";import{r as J}from"./chunk-ALZV2EYT.js";import"./chunk-ZC65Z3CK.js";import{a as se}from"./chunk-ZAWRSA7N.js";import{a as oe,b as ae}from"./chunk-OFILFO6D.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(o,a)=>{let i=r.resolve(o.path??".",a.cwd);if(i===void 0)return;let{backend:c,location:w}=i,e=s((t,n=w.source)=>{let m=r.resolve(t,n);if(m===void 0||m.backend!==c)throw new l("UNSUPPORTED_SOURCE",t,"not-applied");return m.location},"own");return{resolve:s((t,n)=>e(n,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,n)=>(await c.stat(e(t).path,{signal:n})).kind==="directory","isDirectory"),byteSize:s(async(t,n)=>(await c.stat(e(t).path,{signal:n})).size,"byteSize"),readText:s(async(t,n)=>(await c.read(e(t).path,{signal:n})).bytes.toString("utf8"),"readText"),async execute(t,n,m,R){let d=await c.execute(t,n,e(m).path,{signal:R});return{code:d.exitCode,stdout:d.stdout.toString("utf8"),stderr:d.stderr.toString("utf8")}},async runLines(t,n,m,R){let d=await c.startProcess("rg",t,e(n).path,{signal:R}),g=new Oe("utf8"),u=[],p=0,f="",h,y=s(E=>{let k=E.split(`
1
+ import{a as le,b as fe,c as ue}from"./chunk-V2D5MLGE.js";import{a as de}from"./chunk-5W6QQZFI.js";import{a as N,g as l}from"./chunk-KJAR2WDO.js";import{c as ce}from"./chunk-XHFAV2NI.js";import"./chunk-NNCZYO4Q.js";import{a as ne}from"./chunk-47SPPIXK.js";import{a as te,b as re}from"./chunk-VAXLSPPU.js";import{f as Z,g as ee}from"./chunk-KN6VPARZ.js";import{d as q}from"./chunk-LY2UANKU.js";import"./chunk-PS2B6THP.js";import{a as ie}from"./chunk-YZTVC7ME.js";import{b as x,c as Q,d as X}from"./chunk-VDSSAP6Y.js";import{a as W}from"./chunk-2DSY4U73.js";import{a as $,b as K}from"./chunk-H6FEBUAP.js";import{I as H}from"./chunk-SIYPD5MM.js";import{r as J}from"./chunk-S7E2D5K7.js";import"./chunk-ZC65Z3CK.js";import{a as se}from"./chunk-ZAWRSA7N.js";import{a as oe,b as ae}from"./chunk-OFILFO6D.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(o,a)=>{let i=r.resolve(o.path??".",a.cwd);if(i===void 0)return;let{backend:c,location:w}=i,e=s((t,n=w.source)=>{let m=r.resolve(t,n);if(m===void 0||m.backend!==c)throw new l("UNSUPPORTED_SOURCE",t,"not-applied");return m.location},"own");return{resolve:s((t,n)=>e(n,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,n)=>(await c.stat(e(t).path,{signal:n})).kind==="directory","isDirectory"),byteSize:s(async(t,n)=>(await c.stat(e(t).path,{signal:n})).size,"byteSize"),readText:s(async(t,n)=>(await c.read(e(t).path,{signal:n})).bytes.toString("utf8"),"readText"),async execute(t,n,m,R){let d=await c.execute(t,n,e(m).path,{signal:R});return{code:d.exitCode,stdout:d.stdout.toString("utf8"),stderr:d.stderr.toString("utf8")}},async runLines(t,n,m,R){let d=await c.startProcess("rg",t,e(n).path,{signal:R}),g=new Oe("utf8"),u=[],p=0,f="",h,y=s(E=>{let k=E.split(`
2
2
  `);for(let[O,b]of k.entries()){if(u.push(b),p+=Buffer.byteLength(b),p>32*1024*1024)throw new l("CONTENT_LIMIT",w.source,"not-applied");O<k.length-1&&(m(u.join("")),u.length=0,p=0)}},"consume"),v=(async()=>{try{for await(let E of d.stdout)y(g.write(E));y(g.end()),p>0&&m(u.join(""))}catch(E){h=E,await d.stop()}})(),T=(async()=>{for await(let E of d.stderr)f+=E.toString("utf8"),f.length>65536&&(f=f.slice(-65536))})();try{try{await d.end()}catch(k){if(!(k instanceof l)||k.code!=="INPUT_CLOSED")throw k}let E=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:E.exitCode,stderr:f}}finally{await d.stop(),await Promise.allSettled([v,T])}}}}}s(he,"createSshSearchEnvironmentProvider");import{lstat as Ue,mkdir as Ee,rm as Me,symlink as He,unlink as Ve,open as ze}from"node:fs/promises";import A from"node:path";import{constants as z}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,o,a){if(a?.has(r)&&a.get(r)!==o)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,o){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(o.startsWith("ssh://"))throw new l("UNSUPPORTED_SOURCE",r,"not-applied");return D.resolve(o,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 o=await Ie(r,{bigint:!0});if(!o.isFile()||o.isSymbolicLink())throw new l("INVALID_FILE_TYPE",r,"not-applied");if(o.size>BigInt(Number.MAX_SAFE_INTEGER))throw new l("CONTENT_LIMIT",r,"not-applied");return o}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,o,a,i){a.signal?.throwIfAborted();let c=r.resolve(o.path,a.cwd),w=r.resolve(o.target??"",a.cwd),e=c?.location.source??j(o.path,a.cwd),t=w?.location.source??j(o.target??"",a.cwd);if(e===t)throw new l("SAME_FILE",e,"not-applied");let n=c?await c.backend.lstat(c.location.path,a):await U(e);if("kind"in n&&n.kind!=="file")throw new l("INVALID_FILE_TYPE",e,"not-applied");let m=Number(n.size),R=Number(n.mode),d="revision"in n?n.revision:F(n);C(e,d,i);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),i),c&&w&&c.backend.target.host===w.backend.target.host&&c.backend.target.configFile===w.backend.target.configFile&&"identity"in n&&"identity"in g&&n.identity.device===g.identity.device&&n.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,i),{source:e,target:t,remoteSource:c,remoteTarget:w,size:m,mode:R,sourceRevision:d,targetRevision:u}}s(je,"prepareTransfer");async function V(r,o,a,i,c,w){let{source:e,target:t,remoteSource:n,remoteTarget:m,size:R,mode:d,sourceRevision:g,targetRevision:u}=await je(r,a,i,c);await w?.();let p=n?void 0:await me(e,we.O_RDONLY|we.O_NOFOLLOW),f,h,y,v=!1,T="",E=s(async()=>{let k=n?await n.backend.lstat(n.location.path,i):await U(e);if(("revision"in k?k.revision:F(k))!==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})],"/",i),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 k=Pe("sha256");for(let b=0;b<R;){i.signal?.throwIfAborted();let S=Math.min(Be,R-b),I;if(n){let P=await n.backend.readRange(n.location.path,b,S,i);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(k.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 E(),await w?.();let O=k.digest("hex");if(i.signal?.throwIfAborted(),y){if(await y.write(Buffer.from(`${JSON.stringify({sha256:O})}
3
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");i.signal?.throwIfAborted(),await _e(f,t),f=void 0,v=!0}return o==="move"&&(await E(),n?await n.backend.removeEntry(n.location.path,g,i):await Fe(e)),{source:e,target:t}}catch(k){throw v?new l(ge(k),e,"unknown"):k}finally{await p?.close(),await h?.close(),f!==void 0&&await Ae(f,{force:!0}),y&&await y.stop().catch(()=>{})}}s(V,"transferFile");function Re(r,o,a){let i=r.resolve(o,a.cwd);if(i===void 0){let e=j(o,a.cwd);return{path:e,source:e,cwd:a.cwd,files:x}}let c=r.resolve(a.cwd,a.cwd),w=c?.location.target===i.location.target?c.location.path:i.backend.target.workspace;return{remote:i,source:i.location.source,path:i.location.path,cwd:w,files:{owner:JSON.stringify([i.backend.target.host,i.backend.target.configFile??null]),realpath:s(e=>i.backend.realpath(e,a),"realpath"),inspect:s(e=>i.backend.lstat(e,a),"inspect"),read:s(async e=>(await i.backend.read(e,a)).bytes.toString("utf8"),"read"),git:s((e,t,n)=>i.backend.queryGit(e,t,{...a,signal:n}),"git"),source:s(e=>N(i.location.target,e).source,"source"),snapshot:s((e,t)=>i.backend.objectSnapshot(e,{...a,signal:t}),"snapshot")}}}s(Re,"endpoint");function L(r,o,a){let i=r.remote?A.posix:A;if(i.sep==="\\"&&a.split("/").some(c=>c.includes("\\")||c.includes(":")))throw new l("INVALID_TARGET",r.source,"not-applied");return i.join(o,...a.split("/"))}s(L,"leaf");function G(r,o){return r.remote?N(r.remote.location.target,o).source:o}s(G,"receiptPath");async function _(r,o,a){let i;try{i=await r.files.inspect(o)}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||i?.revision!==a.revision)throw new l("TRANSFER_TARGET_CHANGED",G(r,o),"not-applied")}s(_,"checkEntry");async function M(r){let o;try{o=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 Ee(r);return}if(!o.isDirectory()||o.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,o,a,i){r.remote?await r.remote.backend.removeObject(o,a.revision,i):(await _(r,o,a),a.kind==="directory"?await Me(o,{recursive:!0,force:!1}):await Ve(o))}s(ve,"remove");async function ke(r,o,a,i,c,w){let e=Re(r,a.path,i),t=Re(r,a.target??"",i),n=await c.prepareTransfer(o,e,t),m=n.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,n.target.entries[0]?.revision??null,w);let R=!1;try{i.signal?.throwIfAborted();for(let d of n.source.entries)L(e,n.source.path,d.relativePath),L(t,n.target.path,d.relativePath);if(n.sourceKind==="file")e.remote&&t.remote&&e.remote.location.target===t.remote.location.target?await e.remote.backend[o](n.source.path,n.target.path,m.revision,n.target.entries[0]?.revision??null,i):await V(r,o,a,i,w,async()=>{await _(e,n.source.path,m),await _(t,n.target.path,n.target.entries[0])});else{if(o==="move"&&e.remote&&t.remote&&e.files.owner===t.files.owner&&await e.remote.backend.moveObject(n.source,n.target,i))return{kind:"file-operation",operation:o,ok:!0,effect:"applied",path:e.source,target:t.source,sourceKind:n.sourceKind};let d=new Map(n.target.entries.map(u=>[u.relativePath,u])),g=new Map;o==="move"&&n.target.entries[0]&&(R=!0,await ve(t,n.target.path,n.target.entries[0],i),d.clear());for(let u of n.source.entries){i.signal?.throwIfAborted();let p=L(e,n.source.path,u.relativePath),f=L(t,n.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,i):h===void 0&&(await M(A.dirname(f)),await Ee(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,i):(await M(A.dirname(f)),await He(Buffer.from(u.link,"base64"),f))}else{R=!0;let y=G(e,p),v=G(t,f);e.remote&&t.remote&&e.files.owner===t.files.owner?await e.remote.backend.copy(p,f,u.revision,h?.revision??null,i):await V(r,"copy",{path:y,target:v},i,void 0,async()=>{await _(e,p,u),await _(t,f,h)})}}for(let u of[...n.source.entries].reverse()){if(u.kind!=="directory"||d.has(u.relativePath))continue;let p=L(t,n.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,i);else{let y=await ze(p,z.O_RDONLY|z.O_DIRECTORY|z.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 n.verifySource(),o==="move"&&await ve(e,n.source.path,m,i)}return{kind:"file-operation",operation:o,ok:!0,effect:"applied",path:e.source,target:t.source,sourceKind:n.sourceKind}}catch(d){throw R?Object.assign(d instanceof Error?d:new Error(String(d)),{effect:"unknown"}):d}}s(ke,"transferObject");function Se(r,o){return async(a,i,c,w)=>{let e=r.resolve(i.path,c.cwd);if(e===void 0&&(i.target===void 0||r.resolve(i.target,c.cwd)===void 0))return;if(a!=="delete"){if(w===void 0)throw new l("TRANSFER_POLICY_REQUIRED",i.path,"not-applied");return ke(r,a,i,c,w,o)}if(e===void 0)return;let t=await e.backend.lstat(e.location.path,c);C(e.location.source,t.revision,o);{if(w===void 0)throw new l("DELETE_POLICY_REQUIRED",e.location.source,"not-applied");let n=r.resolve(c.cwd,c.cwd);if(n!==void 0&&n.location.target!==e.location.target)throw new l("UNSUPPORTED_SOURCE",e.location.source,"not-applied");let m=n?.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 Y(r,o,a){return{id:"ssh",async tryResolve(i,c){try{let w=r.resolve(i,c.cwd);if(!w)return{kind:"not-handled"};let{backend:e,location:t}=w,n=!1;try{n=(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,n){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
4
  `)}]}return R=await d(p),o.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],E=v.bytes.length,k=Math.min(f??v.totalBytes,v.totalBytes-v.offset);for(;E<k;){let O=await e.readRange(t.path,v.offset+E,Math.min(k-E,4194304),h);if(O.revision!==v.revision||O.totalBytes!==v.totalBytes||O.offset!==v.offset+E)throw new l("SOURCE_CHANGED",t.source,"not-applied");if(O.bytes.length===0)break;T.push(O.bytes),E+=O.bytes.length}return{bytes:Buffer.concat(T,E),byteOffset:v.offset,totalBytes:v.totalBytes}},"readBytes");return a==="read"||n?{kind:"resolved",resource:{source:t.source,link:t.source,read:g,get sourceBytes(){return R},...n?{}:{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(Y,"createSshResourceResolver");async function be(r,o){let a=await Z({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(n=>({tool:n,resourcePrefixes:["ssh://"]}))]});if(ee(r,[{...a,markdown:`${a.markdown}