pi-agent-ide 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (606) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +24 -29
  3. package/dist/chunk-2AY526TN.js +3 -0
  4. package/dist/{chunk-LEJKDYCK.js → chunk-2TZDG2JH.js} +1 -1
  5. package/dist/{chunk-XBQR74IK.js → chunk-4GBFIGH3.js} +1 -1
  6. package/dist/{chunk-PJL3UVMJ.js → chunk-4IWEKRSP.js} +1 -1
  7. package/dist/chunk-52PFWQMU.js +5 -0
  8. package/dist/chunk-5BGWNYQS.js +1 -0
  9. package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
  10. package/dist/chunk-64JTD2DJ.js +1 -0
  11. package/dist/{chunk-XAHU42FP.js → chunk-6A3ORNW3.js} +2 -2
  12. package/dist/{chunk-ANM3Y5FO.js → chunk-6WCHBHFW.js} +5 -5
  13. package/dist/{chunk-IMGIDBCC.js → chunk-7D7PXIVV.js} +1 -1
  14. package/dist/chunk-7PVDTMEM.js +1 -0
  15. package/dist/chunk-7SG756UO.js +4 -0
  16. package/dist/{chunk-GBUJOR6V.js → chunk-7URANI6I.js} +14 -14
  17. package/dist/{chunk-4W7GH3T7.js → chunk-AJZVKDYC.js} +1 -1
  18. package/dist/chunk-AMIIOWFL.js +1 -0
  19. package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
  20. package/dist/chunk-C2JT2G5K.js +1 -0
  21. package/dist/chunk-CVOYSEBE.js +1 -0
  22. package/dist/chunk-DDH3FP4G.js +3 -0
  23. package/dist/chunk-FEZLTM4L.js +1 -0
  24. package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
  25. package/dist/chunk-FKKAHI62.js +11 -0
  26. package/dist/chunk-FS3KCKFX.js +9 -0
  27. package/dist/chunk-FYOU4RBH.js +2 -0
  28. package/dist/chunk-G4PRFO6G.js +1 -0
  29. package/dist/chunk-GS5ZRTUG.js +1 -0
  30. package/dist/{chunk-XXLLY66B.js → chunk-GXL4NMHR.js} +1 -1
  31. package/dist/{chunk-QT3EAHOG.js → chunk-H3GEEOOL.js} +1 -1
  32. package/dist/chunk-H5Z54BEU.js +25 -0
  33. package/dist/chunk-H7WAM5RH.js +23 -0
  34. package/dist/chunk-HT7LZN5A.js +9 -0
  35. package/dist/chunk-IG5DXVDJ.js +1 -0
  36. package/dist/chunk-K4UTEMDU.js +1 -0
  37. package/dist/chunk-KFBRL2V4.js +3 -0
  38. package/dist/chunk-KN6VPARZ.js +1 -0
  39. package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
  40. package/dist/chunk-LTADNZKW.js +2 -0
  41. package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
  42. package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
  43. package/dist/chunk-NA2NEU4V.js +1 -0
  44. package/dist/chunk-OBTT5INC.js +6 -0
  45. package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
  46. package/dist/chunk-PLMHBXWI.js +10 -0
  47. package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
  48. package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
  49. package/dist/chunk-QM5WDEFI.js +1 -0
  50. package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
  51. package/dist/chunk-RIOPUTUJ.js +6 -0
  52. package/dist/chunk-RVFMH77U.js +82 -0
  53. package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
  54. package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
  55. package/dist/{chunk-PT35ZFLH.js → chunk-TNAUCNUT.js} +12 -12
  56. package/dist/{chunk-DUUOCBS3.js → chunk-TVH2ND35.js} +1 -1
  57. package/dist/chunk-TVSZYABY.js +5 -0
  58. package/dist/chunk-TVXZE4KW.js +4 -0
  59. package/dist/chunk-U7YDLVFL.js +1 -0
  60. package/dist/{chunk-KZC7TI5M.js → chunk-UD3DMY3Q.js} +1 -1
  61. package/dist/{chunk-VXP5BMW7.js → chunk-USG6WHAT.js} +1 -1
  62. package/dist/{chunk-RMI3NMQY.js → chunk-V4J3TLCV.js} +2 -2
  63. package/dist/{chunk-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
  64. package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
  65. package/dist/{chunk-6T7PSDQW.js → chunk-VN3XBH2Q.js} +1 -1
  66. package/dist/chunk-WAJW4G4F.js +22 -0
  67. package/dist/chunk-WEE3NM6L.js +1 -0
  68. package/dist/{chunk-IM24DB3K.js → chunk-WES2E4VR.js} +1 -1
  69. package/dist/{chunk-RIJMXO43.js → chunk-WQIMM4SU.js} +1 -1
  70. package/dist/chunk-WUO3UW4J.js +17 -0
  71. package/dist/chunk-XE4W5YTE.js +2 -0
  72. package/dist/chunk-XUYIK4TX.js +1 -0
  73. package/dist/{chunk-ZJQRLVVV.js → chunk-Y74EKJOY.js} +1 -1
  74. package/dist/{chunk-AAC77UD4.js → chunk-YPYROPQF.js} +1 -1
  75. package/dist/chunk-ZXO4D5UB.js +1 -0
  76. package/dist/entry-0.js +1 -1
  77. package/dist/entry-1.js +1 -1
  78. package/dist/entry-10.js +1 -1
  79. package/dist/entry-11.js +1 -1
  80. package/dist/entry-12.js +1 -1
  81. package/dist/entry-13.js +1 -1
  82. package/dist/entry-14.js +1 -1
  83. package/dist/entry-15.js +1 -1
  84. package/dist/entry-16.js +1 -1
  85. package/dist/entry-17.js +1 -1
  86. package/dist/entry-18.js +1 -1
  87. package/dist/entry-19.js +1 -1
  88. package/dist/entry-2.js +1 -1
  89. package/dist/entry-20.js +1 -1
  90. package/dist/entry-21.js +1 -0
  91. package/dist/entry-23.js +1 -1
  92. package/dist/entry-24.js +1 -1
  93. package/dist/entry-25.js +1 -1
  94. package/dist/entry-26.js +1 -1
  95. package/dist/entry-27.js +1 -1
  96. package/dist/entry-28.js +1 -1
  97. package/dist/entry-29.js +1 -2
  98. package/dist/entry-3.js +1 -1
  99. package/dist/entry-30.js +2 -1
  100. package/dist/entry-31.js +1 -4
  101. package/dist/entry-32.js +1 -1
  102. package/dist/entry-33.js +1 -1
  103. package/dist/entry-34.js +1 -1
  104. package/dist/entry-35.js +1 -18
  105. package/dist/entry-36.js +1 -1
  106. package/dist/entry-37.js +15 -1
  107. package/dist/entry-38.js +1 -1
  108. package/dist/entry-39.js +1 -1
  109. package/dist/entry-4.js +1 -1
  110. package/dist/entry-40.js +1 -1
  111. package/dist/entry-41.js +1 -1
  112. package/dist/entry-42.js +1 -1
  113. package/dist/entry-43.js +1 -1
  114. package/dist/entry-44.js +1 -1
  115. package/dist/entry-45.js +1 -1
  116. package/dist/entry-46.js +1 -1
  117. package/dist/entry-47.js +1 -1
  118. package/dist/entry-48.js +1 -1
  119. package/dist/entry-49.js +1 -25
  120. package/dist/entry-5.js +1 -1
  121. package/dist/entry-50.js +1 -1
  122. package/dist/entry-51.js +1 -1
  123. package/dist/entry-52.js +1 -1
  124. package/dist/entry-53.js +1 -1
  125. package/dist/entry-54.js +1 -3
  126. package/dist/entry-55.js +1 -13
  127. package/dist/entry-56.js +1 -1
  128. package/dist/entry-57.js +1 -1
  129. package/dist/entry-58.js +1 -1
  130. package/dist/entry-59.js +1 -1
  131. package/dist/entry-6.js +1 -1
  132. package/dist/entry-60.js +1 -1
  133. package/dist/entry-61.js +1 -1
  134. package/dist/entry-62.js +1 -1
  135. package/dist/entry-63.js +1 -1
  136. package/dist/entry-64.js +1 -1
  137. package/dist/entry-65.js +1 -0
  138. package/dist/entry-66.js +1 -1
  139. package/dist/entry-68.js +1 -1
  140. package/dist/entry-69.js +0 -1
  141. package/dist/entry-7.js +1 -1
  142. package/dist/entry-70.js +1 -1
  143. package/dist/entry-71.js +1 -1
  144. package/dist/entry-72.js +1 -1
  145. package/dist/entry-73.js +1 -1
  146. package/dist/entry-74.js +1 -1
  147. package/dist/entry-75.js +1 -0
  148. package/dist/entry-76.js +1 -1
  149. package/dist/entry-78.js +1 -1
  150. package/dist/entry-79.js +0 -1
  151. package/dist/entry-8.js +1 -1
  152. package/dist/entry-80.js +1 -1
  153. package/dist/entry-81.js +1 -80
  154. package/dist/entry-82.js +1 -22
  155. package/dist/entry-83.js +1 -2
  156. package/dist/entry-84.js +1 -1
  157. package/dist/entry-85.js +2 -1
  158. package/dist/entry-86.js +1 -1
  159. package/dist/entry-87.js +1 -1
  160. package/dist/entry-88.js +1 -3
  161. package/dist/entry-89.js +1 -1
  162. package/dist/entry-9.js +1 -1
  163. package/dist/entry-90.js +3 -1
  164. package/dist/entry-91.js +1 -1
  165. package/dist/entry-92.js +1 -0
  166. package/dist/entry-93.js +1 -0
  167. package/dist/pi-agent-ide.js +10 -34
  168. package/docs/agent-guides/ast-search.md +58 -0
  169. package/docs/agent-guides/debugger.md +1 -1
  170. package/docs/agent-guides/editing.md +26 -58
  171. package/docs/agent-guides/git-changes.md +4 -14
  172. package/docs/agent-guides/search.md +38 -0
  173. package/docs/agent-guides/ssh.md +17 -49
  174. package/docs/agent-guides/terminal.md +9 -15
  175. package/docs/configuration.md +9 -13
  176. package/docs/extensions.md +82 -0
  177. package/docs/settings-help.md +2 -2
  178. package/docs/structured-results.md +33 -11
  179. package/docs/tools.md +23 -22
  180. package/node_modules/pi-agent-doctor/package.json +7 -7
  181. package/node_modules/pi-agent-doctor/src/workspace.ts +0 -5
  182. package/node_modules/pi-agent-documentation/package.json +2 -2
  183. package/node_modules/pi-agent-documentation/runtime/entry-29.js +1 -0
  184. package/node_modules/pi-agent-documentation/src/index.ts +26 -10
  185. package/node_modules/pi-agent-filesystem/index.ts +1 -1
  186. package/node_modules/pi-agent-filesystem/package.json +8 -8
  187. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  188. package/node_modules/pi-agent-filesystem-jq/index.ts +9 -63
  189. package/node_modules/pi-agent-filesystem-jq/package.json +12 -6
  190. package/node_modules/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  191. package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  192. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  193. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  194. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  195. package/node_modules/pi-agent-ide-ast/package.json +15 -15
  196. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +13 -1
  197. package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
  198. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  199. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  200. package/node_modules/pi-agent-ide-changes/index.ts +1 -2
  201. package/node_modules/pi-agent-ide-changes/package.json +10 -10
  202. package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  203. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  204. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  205. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  206. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  207. package/node_modules/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  208. package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
  209. package/node_modules/pi-agent-ide-lsp/package.json +14 -10
  210. package/node_modules/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  211. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  212. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  213. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  214. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  215. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  216. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  217. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  218. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  219. package/node_modules/pi-agent-image/package.json +3 -3
  220. package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
  221. package/node_modules/pi-agent-invariant/package.json +2 -2
  222. package/node_modules/pi-agent-pdf/package.json +3 -3
  223. package/node_modules/pi-agent-pdf/src/pdf-converter.ts +23 -1
  224. package/node_modules/pi-agent-read/package.json +12 -12
  225. package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
  226. package/node_modules/pi-agent-read/runtime/entry-51.js +2 -0
  227. package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
  228. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
  229. package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
  230. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  231. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  232. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  233. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  234. package/node_modules/pi-agent-resource/package.json +2 -2
  235. package/node_modules/pi-agent-resource/src/index.ts +8 -0
  236. package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
  237. package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
  238. package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
  239. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
  240. package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
  241. package/node_modules/pi-agent-search/package.json +9 -9
  242. package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
  243. package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
  244. package/node_modules/pi-agent-search/runtime/entry-56.js +2 -0
  245. package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
  246. package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
  247. package/node_modules/pi-agent-search/src/api/search.ts +14 -2
  248. package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
  249. package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
  250. package/node_modules/pi-agent-search-text/index.ts +34 -12
  251. package/node_modules/pi-agent-search-text/package.json +17 -15
  252. package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
  253. package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
  254. package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
  255. package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
  256. package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
  257. package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
  258. package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
  259. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
  260. package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
  261. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
  262. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
  263. package/node_modules/pi-agent-text/package.json +3 -3
  264. package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
  265. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  266. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  267. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  268. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
  269. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  270. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  271. package/node_modules/pi-agent-text-editor/package.json +26 -26
  272. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
  273. package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
  274. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  275. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  276. package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  277. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  278. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  279. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
  280. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  281. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
  282. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  283. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  284. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  285. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  286. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  287. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  288. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  289. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  290. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  291. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  292. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  293. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  294. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  295. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  296. package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
  297. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  298. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  299. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  300. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
  301. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  302. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  303. package/node_modules/pi-agent-tool-ui/package.json +3 -3
  304. package/node_modules/pi-agent-tool-ui/runtime/entry-87.js +1 -0
  305. package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
  306. package/node_modules/pi-agent-web/index.ts +28 -6
  307. package/node_modules/pi-agent-web/package.json +8 -8
  308. package/node_modules/pi-agent-web-html/package.json +3 -3
  309. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  310. package/node_modules/pi-agent-web-image/package.json +4 -4
  311. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  312. package/node_modules/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  313. package/node_modules/pi-agent-web-text/package.json +4 -4
  314. package/node_modules/pi-agent-web-text/runtime/entry-93.js +2 -0
  315. package/package.json +61 -58
  316. package/src/api/approval.ts +2 -0
  317. package/src/api/read.ts +2 -0
  318. package/src/api/standalone.ts +7 -0
  319. package/src/backend/doctor-workspace.ts +0 -3
  320. package/src/backend/process-metadata-worker.py +9 -18
  321. package/src/backend/process-metadata.ts +11 -44
  322. package/src/backend/registration.ts +0 -10
  323. package/src/backend/web-browser-worker.mjs +2 -17
  324. package/src/backend/web-browser.ts +1 -26
  325. package/src/composite/builtin-extensions.ts +8 -6
  326. package/src/composite/ide-alias-rendering.ts +18 -2
  327. package/src/composite/module-labels.ts +0 -4
  328. package/src/composite/preferences.ts +0 -36
  329. package/src/composite/settings-documentation.ts +1 -2
  330. package/src/composite/text-results.ts +61 -23
  331. package/src/documentation/extension.ts +39 -15
  332. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
  333. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  334. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  335. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +9 -63
  336. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
  337. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  338. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  339. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  340. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  341. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  342. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-35.js +2 -0
  343. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +2 -0
  344. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
  345. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  346. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  347. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  348. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  349. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  350. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  351. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  352. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-93.js +2 -0
  353. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +2 -0
  354. package/src/extensions/pi-agent-read/package.json +12 -12
  355. package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
  356. package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
  357. package/src/extensions/pi-agent-read/runtime/entry-51.js +2 -0
  358. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
  359. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
  360. package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
  361. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  362. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  363. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  364. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  365. package/src/extensions/pi-agent-search/package.json +9 -9
  366. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
  367. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
  368. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  369. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
  370. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-60.js +1 -0
  371. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
  372. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
  373. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
  374. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
  376. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
  377. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
  378. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
  379. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
  380. package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
  381. package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
  382. package/src/extensions/pi-agent-search/runtime/entry-56.js +2 -0
  383. package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
  384. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
  385. package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
  386. package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
  387. package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
  388. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  389. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  390. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  391. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  392. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
  393. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  394. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-65.js +1 -0
  395. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  396. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
  397. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  398. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  399. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  400. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
  401. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  402. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
  403. package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
  404. package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +2 -0
  405. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  406. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  407. package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  408. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  409. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  410. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
  411. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  412. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
  413. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  414. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  415. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  416. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  417. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  418. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  419. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  420. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  421. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  422. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  423. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  424. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  425. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  426. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  427. package/src/pi-agent-ide.ts +8 -15
  428. package/src/plugins/pi-agent-ide-ast/package.json +15 -15
  429. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +13 -1
  430. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  431. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  432. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  433. package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
  434. package/src/plugins/pi-agent-ide-changes/package.json +10 -10
  435. package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  436. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  437. package/src/plugins/pi-agent-ide-debugger/index.ts +17 -4
  438. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
  439. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  440. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  441. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  442. package/src/plugins/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  443. package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
  444. package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
  445. package/src/plugins/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  446. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  447. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  448. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  449. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  450. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  451. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  452. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  453. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  454. package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
  455. package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
  456. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +10 -7
  457. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
  458. package/src/standalone/resource-host.ts +147 -0
  459. package/src/standalone/scoped-api.ts +457 -0
  460. package/dist/chunk-2RTCSZB3.js +0 -1
  461. package/dist/chunk-4DIUPEDF.js +0 -2
  462. package/dist/chunk-6EDOLYOV.js +0 -1
  463. package/dist/chunk-6FGLAVPJ.js +0 -1
  464. package/dist/chunk-6H32W35W.js +0 -1
  465. package/dist/chunk-6OJ565FL.js +0 -2
  466. package/dist/chunk-6R3Y4AD3.js +0 -1
  467. package/dist/chunk-6TJPMBUQ.js +0 -1
  468. package/dist/chunk-6XFUICD7.js +0 -1
  469. package/dist/chunk-BHSO2MDK.js +0 -6
  470. package/dist/chunk-GSOYVIQS.js +0 -1
  471. package/dist/chunk-HSRH76JN.js +0 -3
  472. package/dist/chunk-HSZ4AQ6L.js +0 -9
  473. package/dist/chunk-I6NPILT5.js +0 -1
  474. package/dist/chunk-K7SRNBIV.js +0 -1
  475. package/dist/chunk-LCWBVOII.js +0 -3
  476. package/dist/chunk-MKEC3U2M.js +0 -4
  477. package/dist/chunk-NUM3YQGK.js +0 -1
  478. package/dist/chunk-OM4LYD3S.js +0 -1
  479. package/dist/chunk-PLKYHUNT.js +0 -1
  480. package/dist/chunk-QIJMV2P2.js +0 -2
  481. package/dist/chunk-RVU73VKN.js +0 -2
  482. package/dist/chunk-SDAH3ECM.js +0 -5
  483. package/dist/chunk-SGQWRIRJ.js +0 -10
  484. package/dist/chunk-SWBJS3U4.js +0 -1
  485. package/dist/chunk-T7I2VX3J.js +0 -1
  486. package/dist/chunk-T7MWQQIF.js +0 -3
  487. package/dist/chunk-UEVGZUII.js +0 -3
  488. package/dist/chunk-VDP5CQHM.js +0 -3
  489. package/dist/chunk-XG7QNAKW.js +0 -9
  490. package/dist/chunk-XLWCSJMR.js +0 -1
  491. package/dist/chunk-YFP4P2FV.js +0 -1
  492. package/dist/chunk-YIXP2ALP.js +0 -9
  493. package/dist/entry-22.js +0 -1
  494. package/docs/agent-guides/diagnostics.md +0 -5
  495. package/docs/agent-guides/json-reading.md +0 -57
  496. package/docs/agent-guides/read-resources.md +0 -17
  497. package/docs/agent-guides/search-code.md +0 -76
  498. package/docs/agent-guides/select-code.md +0 -119
  499. package/docs/agent-guides/vision.md +0 -11
  500. package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
  501. package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
  502. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  503. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  504. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  505. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  506. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  507. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  508. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  509. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
  510. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
  511. package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
  512. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
  513. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
  514. package/node_modules/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  515. package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  516. package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
  517. package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
  518. package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
  519. package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
  520. package/node_modules/pi-agent-search-text/runtime/entry-56.js +0 -1
  521. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  522. package/node_modules/pi-agent-text-editor/runtime/entry-66.js +0 -1
  523. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  524. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
  525. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
  526. package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
  527. package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
  528. package/src/backend/vision-capture-worker.py +0 -319
  529. package/src/backend/vision-capture.ts +0 -165
  530. package/src/backend/vision-registration.ts +0 -104
  531. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
  532. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  533. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
  534. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
  535. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
  536. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
  537. package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
  538. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  539. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
  540. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
  541. package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
  542. package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
  543. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  544. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +0 -1
  545. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  546. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
  547. package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
  548. package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
  549. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  550. package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
  551. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  552. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  553. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  554. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  555. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  556. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
  557. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
  558. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
  559. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
  560. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
  561. package/src/plugins/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  562. package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  563. package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
  564. package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
  565. package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
  566. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
  567. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
  568. /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
  569. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
  570. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-30.js +0 -0
  571. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  572. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  573. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-35.js +0 -0
  574. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  575. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  576. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  577. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  578. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
  579. /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-44.js +0 -0
  580. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-45.js +0 -0
  581. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-46.js +0 -0
  582. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
  583. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-52.js +0 -0
  584. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
  585. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-61.js +0 -0
  586. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  587. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  588. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  589. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-65.js +0 -0
  590. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-83.js +0 -0
  591. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-86.js +0 -0
  592. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-89.js +0 -0
  593. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  594. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  595. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  596. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  597. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  598. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  599. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  600. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  601. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  602. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  603. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  604. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  605. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  606. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
@@ -9,6 +9,8 @@ import {
9
9
  } from "pi-agent-read/api/plugin-protocol";
10
10
  import { connectDoctorPlugin } from "pi-agent-doctor/api/connect-plugin";
11
11
  import { SEARCH_API_VERSION, SEARCH_PROTOCOL } from "pi-agent-search/api/plugin-protocol";
12
+ import type { SearchPluginApi } from "pi-agent-search/api/search";
13
+ import { registerFileSearchTool } from "#src/tool-file-search.js";
12
14
  import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
13
15
  import {
14
16
  TEXT_EDITOR_API_VERSION,
@@ -26,12 +28,26 @@ import { isSearchToolDetails } from "#src/search-result.js";
26
28
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
27
29
 
28
30
  export default async function registerTextSearch(pi: ExtensionAPI): Promise<void> {
31
+ return registerSearch(pi, true);
32
+ }
33
+
34
+ /** Reuse selection/anchor machinery without installing filesystem query resolvers. */
35
+ export async function registerResourceSearchSelections(pi: ExtensionAPI): Promise<void> {
36
+ return registerSearch(pi, false);
37
+ }
38
+
39
+ async function registerSearch(pi: ExtensionAPI, includeFilesystem: boolean): Promise<void> {
40
+ let resolveSearchApi!: (api: SearchPluginApi) => void;
41
+ const searchApi = new Promise<SearchPluginApi>((resolve) => (resolveSearchApi = resolve));
42
+ // Not registered with search: file_search runs it through the shared execution core.
43
+ if (includeFilesystem) registerFileSearchTool(pi, createFileResolver(), searchApi);
29
44
  let read: ReadPluginApi | undefined;
30
45
  const sessions = new SearchSessionStore(
31
46
  undefined,
32
47
  connectResultTargets(pi),
33
48
  async (source, cwd, signal) => {
34
49
  if (read === undefined) {
50
+ if (!includeFilesystem) throw new Error("Resource search requires its owning Read host.");
35
51
  // Standalone Search owns local files, but must never treat remote identities as paths.
36
52
  if (source.includes("://")) throw new Error("No search snapshot owner for this source.");
37
53
  return readFile(source, { encoding: "utf8", signal });
@@ -138,18 +154,24 @@ export default async function registerTextSearch(pi: ExtensionAPI): Promise<void
138
154
  context.environment,
139
155
  ),
140
156
  );
141
- api.addResolver({ resolver: createRegexResolver(sessions), priority: -10 });
142
- api.addResolver({ resolver: createFileResolver(), priority: -10 });
143
- api.addResolver({ resolver: createTextResolver(sessions), fallback: true });
144
- api.describe(
145
- [
146
- "Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching; files:<pattern> searches file paths: glob patterns use *, **, ?, character classes and braces; other queries use case-insensitive subsequence matching. Slash-containing globs match cwd-relative paths; basename globs match at any depth.",
147
- "After a complete zero result, a single unquoted ASCII identifier may produce separate possible-name groups: naming-style changes, one leading/trailing component, then small typos. Each group reports a verified case-sensitive whole-identifier alternative in the same scope, its count/completeness, and Read references. Budget skips are explicit. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. Registered local candidate selections also expose strict snapshot targets. Result scopes stay exact and do not run this extra branch.",
148
- "The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.",
149
- "SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.",
150
- "Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections.",
151
- ].join("\n"),
152
- );
157
+ if (includeFilesystem) {
158
+ resolveSearchApi(api);
159
+ api.addResolver({ resolver: createRegexResolver(sessions), priority: -10 });
160
+ api.addResolver({ resolver: createTextResolver(sessions), fallback: true });
161
+ } else {
162
+ api.addResolver({ resolver: createRegexResolver(sessions, true), priority: -10 });
163
+ api.addResolver({ resolver: createTextResolver(sessions, true), fallback: true });
164
+ }
165
+ if (includeFilesystem)
166
+ api.describe(
167
+ [
168
+ "Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching.",
169
+ "After a complete zero result, a single unquoted ASCII identifier may produce separate possible-name groups: naming-style changes, one leading/trailing component, then small typos. Each group reports a verified case-sensitive whole-identifier alternative in the same scope, its count/completeness, and Read references. Budget skips are explicit. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. Registered local candidate selections also expose strict snapshot targets. Result scopes stay exact and do not run this extra branch.",
170
+ "The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.",
171
+ "SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.",
172
+ "Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections.",
173
+ ].join("\n"),
174
+ );
153
175
  },
154
176
  }),
155
177
  connectTextEditorPlugin(pi, {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-search-text",
3
- "version": "0.8.3",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,38 +8,40 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./index.ts",
11
- "default": "./runtime/entry-55.js"
11
+ "default": "./runtime/entry-57.js"
12
12
  },
13
13
  "./search-session": {
14
14
  "types": "./src/search-session.ts",
15
- "default": "./runtime/entry-56.js"
15
+ "default": "./runtime/entry-58.js"
16
16
  },
17
17
  "./rendering": {
18
18
  "types": "./src/search-renderer.ts",
19
- "default": "./runtime/entry-57.js"
19
+ "default": "./runtime/entry-59.js"
20
20
  },
21
21
  "./result": {
22
22
  "types": "./src/search-result.ts",
23
- "default": "./runtime/entry-58.js"
23
+ "default": "./runtime/entry-60.js"
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "pi-agent-doctor": "0.8.3",
28
- "pi-agent-invariant": "0.8.3",
29
- "pi-agent-read": "0.8.3",
30
- "pi-agent-resource": "0.8.3",
31
- "pi-agent-search": "0.8.3",
32
- "pi-agent-text": "0.8.3",
33
- "pi-agent-text-editor": "0.8.3",
34
- "pi-agent-tool-ui": "0.8.3"
27
+ "pi-agent-doctor": "0.9.0",
28
+ "pi-agent-invariant": "0.9.0",
29
+ "pi-agent-read": "0.9.0",
30
+ "pi-agent-resource": "0.9.0",
31
+ "pi-agent-search": "0.9.0",
32
+ "pi-agent-text": "0.9.0",
33
+ "pi-agent-text-editor": "0.9.0",
34
+ "pi-agent-tool-call-interception": "0.9.0",
35
+ "pi-agent-tool-ui": "0.9.0"
35
36
  },
36
37
  "pi": {
37
38
  "extensions": [
38
- "./runtime/entry-55.js"
39
+ "./runtime/entry-57.js"
39
40
  ]
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@earendil-works/pi-coding-agent": "*",
43
- "@earendil-works/pi-tui": "*"
44
+ "@earendil-works/pi-tui": "*",
45
+ "typebox": "*"
44
46
  }
45
47
  }
@@ -1 +1,2 @@
1
1
  export * from "../../../../../../dist/entry-57.js";
2
+ export { default } from "../../../../../../dist/entry-57.js";
@@ -0,0 +1 @@
1
+ export * from "../../../../../../dist/entry-59.js";
@@ -0,0 +1 @@
1
+ export * from "../../../../../../dist/entry-60.js";
@@ -1,9 +1,10 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import path from "node:path";
3
+ import { createInterface } from "node:readline";
3
4
 
4
5
  import { resolveRipgrepExecutable } from "#src/ripgrep.js";
5
6
 
6
- import type { SearchRequest } from "pi-agent-search/api/search";
7
+ import { splitGlobList, type SearchRequest } from "pi-agent-search/api/search";
7
8
  import type { SearchEnvironment } from "pi-agent-search/api/search";
8
9
 
9
10
  export interface FileSearchResult {
@@ -28,11 +29,11 @@ export async function searchFiles(
28
29
  "!.git/**",
29
30
  ];
30
31
 
31
- for (const include of splitGlobs(request.include)) {
32
+ for (const include of splitGlobList(request.include)) {
32
33
  arguments_.push("--glob", include);
33
34
  }
34
35
 
35
- for (const exclude of splitGlobs(request.exclude)) {
36
+ for (const exclude of splitGlobList(request.exclude)) {
36
37
  arguments_.push("--glob", `!${exclude}`);
37
38
  }
38
39
 
@@ -41,21 +42,20 @@ export async function searchFiles(
41
42
  const directory = await environment.isDirectory(target, signal);
42
43
  const searchCwd = directory ? target : environment.dirname(target);
43
44
  arguments_.push("--", directory ? "." : `./${environment.basename(target)}`);
44
- const files: string[] = [];
45
+ const found = firstFiles(limit);
45
46
  const result = await environment.runLines(
46
47
  arguments_,
47
48
  searchCwd,
48
49
  (file) => {
49
50
  const relative = file.replace(/^\.\//u, "");
50
- if (matchFile(relative, query)) files.push(environment.resolve(searchCwd, file));
51
+ if (matchFile(relative, query)) found.add(environment.resolve(searchCwd, file));
51
52
  },
52
53
  signal,
53
54
  );
54
55
  signal?.throwIfAborted();
55
56
  if (result.code !== 0 && result.code !== 1)
56
57
  throw new Error(result.stderr || "File search failed.");
57
- files.sort((left, right) => left.localeCompare(right));
58
- return { files: files.slice(0, limit), complete: files.length <= limit };
58
+ return found.result();
59
59
  }
60
60
  if (request.path?.includes("://") || cwd.includes("://"))
61
61
  throw new Error("No search environment owns this scope.");
@@ -66,12 +66,25 @@ export async function searchFiles(
66
66
  cwd,
67
67
  stdio: ["ignore", "pipe", "pipe"],
68
68
  });
69
- let stdout = "";
69
+ // A large tree lists more paths than one string can hold, so lines are matched as they arrive.
70
+ const found = firstFiles(limit);
71
+ let failure: Error | undefined;
70
72
  let stderr = "";
71
- child.stdout.setEncoding("utf8");
72
73
  child.stderr.setEncoding("utf8");
73
- child.stdout.on("data", (chunk: string) => (stdout += chunk));
74
- child.stderr.on("data", (chunk: string) => (stderr += chunk));
74
+ child.stderr.on("data", (chunk: string) => {
75
+ if (stderr.length < maximumStderrLength) stderr += chunk;
76
+ });
77
+ createInterface({ input: child.stdout, crlfDelay: Infinity }).on("line", (line) => {
78
+ if (line.length === 0 || failure !== undefined) return;
79
+ try {
80
+ const file = path.relative(cwd, path.resolve(cwd, line));
81
+ if (matchFile(file, query)) found.add(file);
82
+ } catch (error) {
83
+ failure =
84
+ error instanceof Error ? error : new Error("File search failed.", { cause: error });
85
+ child.kill("SIGTERM");
86
+ }
87
+ });
75
88
  const abort = (): void => {
76
89
  child.kill("SIGTERM");
77
90
  };
@@ -85,29 +98,50 @@ export async function searchFiles(
85
98
  return;
86
99
  }
87
100
 
101
+ if (failure !== undefined) {
102
+ reject(failure);
103
+ return;
104
+ }
105
+
88
106
  if (code !== 0 && code !== 1) {
89
107
  reject(new Error(stderr.trim() || `rg exited with code ${String(code)}`));
90
108
  return;
91
109
  }
92
110
 
93
- const matches = stdout
94
- .split("\n")
95
- .filter(Boolean)
96
- .map((file) => path.relative(cwd, path.resolve(cwd, file)))
97
- .filter((file) => matchFile(file, query))
98
- .sort((left, right) => left.localeCompare(right));
99
- resolve({ files: matches.slice(0, limit), complete: matches.length <= limit });
111
+ resolve(found.result());
100
112
  });
101
113
  });
102
114
  }
103
115
 
104
- function splitGlobs(value: string | undefined): string[] {
105
- return (
106
- value
107
- ?.split(",")
108
- .map((item) => item.trim())
109
- .filter(Boolean) ?? []
110
- );
116
+ const maximumStderrLength = 64 * 1024;
117
+ const collator = new Intl.Collator();
118
+
119
+ /** Keep the first `limit` matches in sort order and count the rest, so memory stays bounded. */
120
+ function firstFiles(limit: number): {
121
+ add(file: string): void;
122
+ result(): FileSearchResult;
123
+ } {
124
+ const files: string[] = [];
125
+ let count = 0;
126
+ return {
127
+ add(file) {
128
+ count += 1;
129
+ const last = files.at(-1);
130
+ if (files.length >= limit && (last === undefined || collator.compare(file, last) >= 0))
131
+ return;
132
+ let low = 0;
133
+ let high = files.length;
134
+ while (low < high) {
135
+ const middle = (low + high) >>> 1;
136
+ const current = files[middle];
137
+ if (current !== undefined && collator.compare(current, file) <= 0) low = middle + 1;
138
+ else high = middle;
139
+ }
140
+ files.splice(low, 0, file);
141
+ if (files.length > limit) files.pop();
142
+ },
143
+ result: () => ({ files, complete: count <= limit }),
144
+ };
111
145
  }
112
146
 
113
147
  function matchFile(file: string, query: string): boolean {
@@ -44,35 +44,54 @@ interface FilePayload {
44
44
  }
45
45
 
46
46
  /** Search unhandled requests with literal-first hybrid matching. */
47
- export function createTextResolver(sessions: SearchSessionStore): SearchResolver {
48
- return createMatchResolver("text", sessions, createSearchRecipe);
47
+ export function createTextResolver(
48
+ sessions: SearchSessionStore,
49
+ resultScopeOnly = false,
50
+ ): SearchResolver {
51
+ return createMatchResolver("text", sessions, createSearchRecipe, resultScopeOnly);
49
52
  }
50
53
 
51
54
  /** Search an explicit regex without broadening or swallowing syntax errors. */
52
- export function createRegexResolver(sessions: SearchSessionStore): SearchResolver {
53
- return createMatchResolver("regex", sessions, (request) =>
54
- request.query.startsWith("regex:")
55
- ? { ...request, query: request.query.slice("regex:".length), regex: true }
56
- : undefined,
55
+ export function createRegexResolver(
56
+ sessions: SearchSessionStore,
57
+ resultScopeOnly = false,
58
+ ): SearchResolver {
59
+ return createMatchResolver(
60
+ "regex",
61
+ sessions,
62
+ (request) =>
63
+ request.query.startsWith("regex:")
64
+ ? { ...request, query: request.query.slice("regex:".length), regex: true }
65
+ : undefined,
66
+ resultScopeOnly,
57
67
  );
58
68
  }
59
69
 
60
- /** Resolve file-pattern queries through the local file search backend. */
70
+ /** Options the `file_search` tool passes in `SearchRequest.options.files`; their presence selects this resolver. */
71
+ export interface FileSearchOptions {
72
+ readonly pattern: string;
73
+ }
74
+
75
+ function fileOptions(request: SearchRequest): FileSearchOptions | undefined {
76
+ const value = request.options?.files as FileSearchOptions | undefined;
77
+ return typeof value?.pattern === "string" ? value : undefined;
78
+ }
79
+
80
+ /** Resolve file-path patterns through the local or owned file search backend. */
61
81
  export function createFileResolver(): SearchResolver {
62
82
  return {
63
83
  id: "files",
64
84
  readResources: (request, context) =>
65
- request.query.startsWith("files:") ? [request.path ?? context.cwd] : [],
85
+ fileOptions(request) === undefined ? [] : [request.path ?? context.cwd],
66
86
  toScriptData(payload) {
67
87
  const result = payload as FilePayload;
68
88
  return { kind: "files", files: [...result.files], complete: result.complete };
69
89
  },
70
90
  async tryResolve(request, context) {
71
- if (!request.query.startsWith("files:")) {
72
- return { kind: "not-handled" };
73
- }
91
+ const options = fileOptions(request);
92
+ if (options === undefined) return { kind: "not-handled" };
74
93
 
75
- const query = request.query.slice("files:".length).trim();
94
+ const query = options.pattern.trim();
76
95
  const result = await searchFiles(
77
96
  query,
78
97
  request,
@@ -123,14 +142,16 @@ function createMatchResolver(
123
142
  id: "text" | "regex",
124
143
  sessions: SearchSessionStore,
125
144
  queryBody: (request: SearchRequest) => SearchRecipe | undefined,
145
+ resultScopeOnly = false,
126
146
  ): SearchResolver {
127
147
  return {
128
148
  readResources: (request, context) =>
129
- queryBody(request) === undefined
149
+ queryBody(request) === undefined || (resultScopeOnly && context.scope === undefined)
130
150
  ? []
131
151
  : (context.scope?.targets.map((target) => target.source) ?? [request.path ?? context.cwd]),
132
152
  id,
133
153
  supportsResultScope: true,
154
+ supportsMultiline: true,
134
155
  toScriptData(payload, details) {
135
156
  const result = payload as TextPayload;
136
157
  const formatted = details as SearchToolDetails & {
@@ -145,6 +166,7 @@ function createMatchResolver(
145
166
  };
146
167
  },
147
168
  async tryResolve(request, context) {
169
+ if (resultScopeOnly && context.scope === undefined) return { kind: "not-handled" };
148
170
  const recipe = queryBody(request);
149
171
  if (recipe === undefined) return { kind: "not-handled" };
150
172
  const result =
@@ -154,6 +176,7 @@ function createMatchResolver(
154
176
  const fuzzy =
155
177
  context.scope === undefined &&
156
178
  id === "text" &&
179
+ request.multiline !== true &&
157
180
  result.complete &&
158
181
  result.matches.length === 0 &&
159
182
  isFuzzyQuery(request.query)
@@ -330,7 +353,14 @@ function formatSearchSession(
330
353
  `${source}: ${String(file.matchCount)} matches across ${String(file.uniqueLineCount)} unique line texts (compacted)`,
331
354
  );
332
355
  for (const group of file.groups) {
333
- lines.push(` ×${String(group.matchCount)} ${previewLine(group.text)}`);
356
+ const index = indices.get(group.first);
357
+ const first = group.first;
358
+ lines.push(
359
+ anchorsRegistered && index !== undefined
360
+ ? ` ×${String(group.matchCount)} first at ${source}:${String(first.lineNumber)} SEARCH#${session.id}:${String(index)}:line SEARCH#${session.id}:${String(index)}:match`
361
+ : ` ×${String(group.matchCount)} first at ${source}:${String(first.lineNumber)}`,
362
+ ` ${previewLine(group.text)}`,
363
+ );
334
364
  }
335
365
  if (file.groups.length < file.uniqueLineCount) {
336
366
  lines.push(
@@ -346,7 +376,11 @@ function formatSearchSession(
346
376
  for (const match of file.matches) {
347
377
  const index = indices.get(match);
348
378
  if (index === undefined) continue;
349
- const location = `${source}:${String(match.lineNumber)}:${String(match.startColumn + 1)}-${String(match.endColumn + 1)}`;
379
+ const end =
380
+ match.endLineNumber === undefined
381
+ ? String(match.endColumn + 1)
382
+ : `${String(match.endLineNumber)}:${String(match.endColumn + 1)}`;
383
+ const location = `${source}:${String(match.lineNumber)}:${String(match.startColumn + 1)}-${end}`;
350
384
  lines.push(
351
385
  anchorsRegistered
352
386
  ? `${location} SEARCH#${session.id}:${String(index)}:line SEARCH#${session.id}:${String(index)}:match`
@@ -371,6 +405,17 @@ function formatSearchSession(
371
405
 
372
406
  function previewMatch(match: TextSearchMatch): string {
373
407
  const context = 64;
408
+ if (match.endLineNumber !== undefined) {
409
+ // Show the matched lines themselves, bounded; continuation lines keep the preview indent.
410
+ const maximumLines = 8;
411
+ const from = Math.max(0, match.startColumn - context);
412
+ const matched = match.matchedText.replace(/\r\n/gu, "\n").split("\n");
413
+ const shown = matched.slice(0, maximumLines);
414
+ const more = matched.length - shown.length;
415
+ return `${from > 0 ? "…" : ""}${match.lineText.slice(from, match.startColumn)}⟦${shown.join("\n ")}${
416
+ more > 0 ? `\n … ${String(more)} more lines` : ""
417
+ }⟧`;
418
+ }
374
419
  const from = Math.max(0, match.startColumn - context);
375
420
  const to = Math.min(match.lineText.length, match.endColumn + context);
376
421
  return `${from > 0 ? "…" : ""}${match.lineText.slice(from, match.startColumn)}⟦${match.lineText.slice(
@@ -43,19 +43,25 @@ export async function runScopedSearch(
43
43
  );
44
44
  for (const match of result.matches) {
45
45
  const lineNumber = range.start.lineNumber + match.lineNumber - 1;
46
- const shift = match.lineNumber === 1 ? range.start.column : 0;
46
+ const endLine = match.endLineNumber ?? match.lineNumber;
47
+ // Only positions on the range's first line are offset by its starting column.
48
+ const shift = (line: number) => (line === 1 ? range.start.column : 0);
47
49
  const mapped: TextSearchMatch = {
48
50
  ...match,
49
51
  source: target.source,
50
52
  lineNumber,
51
- startColumn: match.startColumn + shift,
52
- endColumn: match.endColumn + shift,
53
+ startColumn: match.startColumn + shift(match.lineNumber),
54
+ ...(match.endLineNumber === undefined
55
+ ? {}
56
+ : { endLineNumber: range.start.lineNumber + match.endLineNumber - 1 }),
57
+ endColumn: match.endColumn + shift(endLine),
53
58
  lineText: document.lines[lineNumber - 1]?.content ?? "",
54
59
  };
55
60
  const key = JSON.stringify([
56
61
  mapped.source,
57
62
  lineNumber,
58
63
  mapped.startColumn,
64
+ mapped.endLineNumber ?? lineNumber,
59
65
  mapped.endColumn,
60
66
  ]);
61
67
  if (seen.has(key)) continue;
@@ -1,7 +1,7 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { stat } from "node:fs/promises";
3
3
  import path from "node:path";
4
- import type { SearchEnvironment } from "pi-agent-search/api/search";
4
+ import { splitGlobList, type SearchEnvironment } from "pi-agent-search/api/search";
5
5
  import { createInterface } from "node:readline";
6
6
 
7
7
  import { resolveRipgrepExecutable } from "#src/ripgrep.js";
@@ -19,9 +19,28 @@ export interface TextSearchRequest {
19
19
  readonly condition?: SearchCondition;
20
20
  readonly caseSensitive?: boolean;
21
21
  readonly wholeWord?: boolean;
22
+ /** Let one match span line breaks (`--multiline --multiline-dotall`). */
23
+ readonly multiline?: boolean;
22
24
  readonly limit?: number;
23
25
  }
24
26
 
27
+ /** Reject inputs that line-based matching cannot honor instead of silently changing them. */
28
+ function assertSupportedPattern(request: TextSearchRequest): void {
29
+ if (request.multiline === true) {
30
+ if (request.condition !== undefined)
31
+ throw new Error(
32
+ "Boolean conditions check single lines and cannot be combined with multiline. Use one regex with multiline instead.",
33
+ );
34
+ return;
35
+ }
36
+ if (/\r|\n/u.test(request.query))
37
+ throw new Error("A pattern with line breaks requires multiline: true.");
38
+ }
39
+
40
+ function multilineArguments(request: TextSearchRequest): string[] {
41
+ return request.multiline === true ? ["--multiline", "--multiline-dotall"] : [];
42
+ }
43
+
25
44
  export interface TextSearchBackendResult {
26
45
  readonly matches: readonly TextSearchMatch[];
27
46
  readonly complete: boolean;
@@ -51,9 +70,7 @@ export async function searchText(
51
70
  throw new Error("Search query must not be empty.");
52
71
  }
53
72
 
54
- if (/\r|\n/u.test(request.query)) {
55
- throw new Error("Search supports one-line patterns only.");
56
- }
73
+ assertSupportedPattern(request);
57
74
 
58
75
  if (request.condition !== undefined)
59
76
  return searchBoolean(
@@ -106,6 +123,7 @@ export async function searchTextContent(
106
123
  cwd: string,
107
124
  signal?: AbortSignal,
108
125
  ): Promise<TextSearchBackendResult> {
126
+ assertSupportedPattern(request);
109
127
  if (request.condition !== undefined)
110
128
  return searchBoolean(
111
129
  request,
@@ -116,7 +134,6 @@ export async function searchTextContent(
116
134
  },
117
135
  signal,
118
136
  );
119
- if (/\r|\n/u.test(request.query)) throw new Error("Search supports one-line patterns only.");
120
137
  const result = await runRipgrep(
121
138
  [
122
139
  "--json",
@@ -127,6 +144,7 @@ export async function searchTextContent(
127
144
  ...(request.regex === true ? ["--engine", "auto"] : ["--fixed-strings"]),
128
145
  request.caseSensitive === true ? "--case-sensitive" : "--ignore-case",
129
146
  ...(request.wholeWord === true ? ["--word-regexp"] : []),
147
+ ...multilineArguments(request),
130
148
  "--",
131
149
  request.query,
132
150
  "-",
@@ -164,6 +182,7 @@ async function searchPattern(
164
182
  "--line-number",
165
183
  request.caseSensitive === true ? "--case-sensitive" : "--ignore-case",
166
184
  ...(request.wholeWord === true ? ["--word-regexp"] : []),
185
+ ...multilineArguments(request),
167
186
  ...scope.arguments,
168
187
  "--",
169
188
  request.query,
@@ -468,8 +487,14 @@ function matchesFromEvent(
468
487
  return [];
469
488
  }
470
489
 
471
- const lineText = rawLine.replace(/(?:\r\n|\n)$/u, "");
490
+ // Multiline mode reports every line a match touches in one event; offsets count from its start.
491
+ const lines = rawLine.split("\n").map((line) => line.replace(/\r$/u, ""));
472
492
  const lineBuffer = Buffer.from(rawLine);
493
+ const position = (byteOffset: number) => {
494
+ const prefix = lineBuffer.subarray(0, byteOffset).toString("utf8");
495
+ const lineIndex = prefix.split("\n").length - 1;
496
+ return { lineIndex, column: prefix.length - prefix.lastIndexOf("\n") - 1 };
497
+ };
473
498
  const matches: TextSearchMatch[] = [];
474
499
 
475
500
  for (const submatch of event.data.submatches) {
@@ -477,56 +502,27 @@ function matchesFromEvent(
477
502
  continue;
478
503
  }
479
504
 
480
- const startColumn = lineBuffer.subarray(0, submatch.start).toString("utf8").length;
481
- const endColumn = lineBuffer.subarray(0, submatch.end).toString("utf8").length;
505
+ const start = position(submatch.start);
506
+ const end = position(submatch.end);
482
507
  matches.push({
483
508
  source: environment?.resolve(cwd, source) ?? path.resolve(cwd, source),
484
- lineNumber: event.data.line_number,
485
- startColumn,
486
- endColumn,
487
- matchedText: lineText.slice(startColumn, endColumn),
488
- lineText,
509
+ lineNumber: event.data.line_number + start.lineIndex,
510
+ startColumn: start.column,
511
+ ...(end.lineIndex === start.lineIndex
512
+ ? {}
513
+ : { endLineNumber: event.data.line_number + end.lineIndex }),
514
+ endColumn: end.column,
515
+ matchedText:
516
+ end.lineIndex === start.lineIndex
517
+ ? (lines[start.lineIndex] ?? "").slice(start.column, end.column)
518
+ : lineBuffer.subarray(submatch.start, submatch.end).toString("utf8"),
519
+ lineText: lines[start.lineIndex] ?? "",
489
520
  });
490
521
  }
491
522
 
492
523
  return matches;
493
524
  }
494
525
 
495
- function splitGlobList(value: string | undefined): string[] {
496
- if (value === undefined) {
497
- return [];
498
- }
499
-
500
- const globs: string[] = [];
501
- let depth = 0;
502
- let current = "";
503
-
504
- for (const character of value) {
505
- if (character === "{") {
506
- depth += 1;
507
- } else if (character === "}") {
508
- depth = Math.max(0, depth - 1);
509
- }
510
-
511
- if (depth === 0 && (character === "," || /\s/u.test(character))) {
512
- if (current.length > 0) {
513
- globs.push(current);
514
- current = "";
515
- }
516
-
517
- continue;
518
- }
519
-
520
- current += character;
521
- }
522
-
523
- if (current.length > 0) {
524
- globs.push(current);
525
- }
526
-
527
- return globs;
528
- }
529
-
530
526
  function stripFilePrefix(source: string): string {
531
527
  return source.startsWith("@") ? source.slice(1) : source;
532
528
  }