pi-agent-ide 0.8.4 → 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 (603) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +24 -29
  3. package/dist/{chunk-CM3XGY72.js → chunk-2AY526TN.js} +1 -1
  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-Z2MNHSJ4.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/extension.ts +8 -8
  197. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  198. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  199. package/node_modules/pi-agent-ide-changes/index.ts +1 -2
  200. package/node_modules/pi-agent-ide-changes/package.json +10 -10
  201. package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  202. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  203. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  204. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  205. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  206. package/node_modules/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  207. package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
  208. package/node_modules/pi-agent-ide-lsp/package.json +14 -10
  209. package/node_modules/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  210. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  211. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  212. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  213. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  214. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  215. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  216. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  217. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  218. package/node_modules/pi-agent-image/package.json +3 -3
  219. package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
  220. package/node_modules/pi-agent-invariant/package.json +2 -2
  221. package/node_modules/pi-agent-pdf/package.json +3 -3
  222. package/node_modules/pi-agent-pdf/src/pdf-converter.ts +23 -1
  223. package/node_modules/pi-agent-read/package.json +12 -12
  224. package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
  225. package/node_modules/pi-agent-read/runtime/entry-51.js +2 -0
  226. package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
  227. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
  228. package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
  229. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  230. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  231. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  232. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  233. package/node_modules/pi-agent-resource/package.json +2 -2
  234. package/node_modules/pi-agent-resource/src/index.ts +8 -0
  235. package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
  236. package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
  237. package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
  238. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
  239. package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
  240. package/node_modules/pi-agent-search/package.json +9 -9
  241. package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
  242. package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
  243. package/node_modules/pi-agent-search/runtime/entry-56.js +2 -0
  244. package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
  245. package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
  246. package/node_modules/pi-agent-search/src/api/search.ts +14 -2
  247. package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
  248. package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
  249. package/node_modules/pi-agent-search-text/index.ts +34 -12
  250. package/node_modules/pi-agent-search-text/package.json +17 -15
  251. package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
  252. package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
  253. package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
  254. package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
  255. package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
  256. package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
  257. package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
  258. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
  259. package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
  260. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
  261. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
  262. package/node_modules/pi-agent-text/package.json +3 -3
  263. package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
  264. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  265. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  266. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  267. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
  268. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  269. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  270. package/node_modules/pi-agent-text-editor/package.json +26 -26
  271. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
  272. package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
  273. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  274. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  275. package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  276. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  277. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  278. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
  279. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  280. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
  281. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  282. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  283. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  284. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  285. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  286. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  287. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  288. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  289. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  290. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  291. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  292. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  293. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  294. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  295. package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
  296. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  297. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  298. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  299. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
  300. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  301. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  302. package/node_modules/pi-agent-tool-ui/package.json +3 -3
  303. package/node_modules/pi-agent-tool-ui/runtime/entry-87.js +1 -0
  304. package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
  305. package/node_modules/pi-agent-web/index.ts +28 -6
  306. package/node_modules/pi-agent-web/package.json +8 -8
  307. package/node_modules/pi-agent-web-html/package.json +3 -3
  308. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  309. package/node_modules/pi-agent-web-image/package.json +4 -4
  310. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  311. package/node_modules/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  312. package/node_modules/pi-agent-web-text/package.json +4 -4
  313. package/node_modules/pi-agent-web-text/runtime/entry-93.js +2 -0
  314. package/package.json +61 -58
  315. package/src/api/approval.ts +2 -0
  316. package/src/api/read.ts +2 -0
  317. package/src/api/standalone.ts +7 -0
  318. package/src/backend/doctor-workspace.ts +0 -3
  319. package/src/backend/process-metadata-worker.py +9 -18
  320. package/src/backend/process-metadata.ts +11 -44
  321. package/src/backend/registration.ts +0 -10
  322. package/src/backend/web-browser-worker.mjs +2 -17
  323. package/src/backend/web-browser.ts +1 -26
  324. package/src/composite/builtin-extensions.ts +8 -6
  325. package/src/composite/ide-alias-rendering.ts +18 -2
  326. package/src/composite/module-labels.ts +0 -4
  327. package/src/composite/preferences.ts +0 -36
  328. package/src/composite/settings-documentation.ts +1 -2
  329. package/src/composite/text-results.ts +61 -23
  330. package/src/documentation/extension.ts +39 -15
  331. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
  332. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  333. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  334. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +9 -63
  335. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
  336. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  337. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  338. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  339. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  340. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  341. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-35.js +2 -0
  342. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +2 -0
  343. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
  344. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  345. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  346. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  347. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  348. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  349. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  350. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  351. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-93.js +2 -0
  352. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +2 -0
  353. package/src/extensions/pi-agent-read/package.json +12 -12
  354. package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
  355. package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
  356. package/src/extensions/pi-agent-read/runtime/entry-51.js +2 -0
  357. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
  358. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
  359. package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
  360. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  361. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  362. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  363. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  364. package/src/extensions/pi-agent-search/package.json +9 -9
  365. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
  366. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
  367. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  368. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
  369. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-60.js +1 -0
  370. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
  371. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
  372. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
  373. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
  374. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
  376. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
  377. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
  378. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
  379. package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
  380. package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
  381. package/src/extensions/pi-agent-search/runtime/entry-56.js +2 -0
  382. package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
  383. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
  384. package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
  385. package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
  386. package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
  387. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  388. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  389. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  390. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  391. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
  392. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  393. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-65.js +1 -0
  394. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  395. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
  396. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  397. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  398. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  399. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
  400. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  401. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
  402. package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
  403. package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +2 -0
  404. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  405. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  406. package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  407. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  408. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  409. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
  410. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  411. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
  412. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  413. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  414. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  415. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  416. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  417. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  418. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  419. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  420. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  421. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  422. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  423. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  424. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  425. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  426. package/src/pi-agent-ide.ts +8 -15
  427. package/src/plugins/pi-agent-ide-ast/package.json +15 -15
  428. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  429. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  430. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  431. package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
  432. package/src/plugins/pi-agent-ide-changes/package.json +10 -10
  433. package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  434. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  435. package/src/plugins/pi-agent-ide-debugger/index.ts +17 -4
  436. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
  437. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  438. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  439. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  440. package/src/plugins/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  441. package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
  442. package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
  443. package/src/plugins/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  444. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  445. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  446. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  447. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  448. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  449. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  450. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  451. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  452. package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
  453. package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
  454. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +10 -7
  455. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
  456. package/src/standalone/resource-host.ts +147 -0
  457. package/src/standalone/scoped-api.ts +457 -0
  458. package/dist/chunk-2RTCSZB3.js +0 -1
  459. package/dist/chunk-4DIUPEDF.js +0 -2
  460. package/dist/chunk-6EDOLYOV.js +0 -1
  461. package/dist/chunk-6FGLAVPJ.js +0 -1
  462. package/dist/chunk-6H32W35W.js +0 -1
  463. package/dist/chunk-6OJ565FL.js +0 -2
  464. package/dist/chunk-6R3Y4AD3.js +0 -1
  465. package/dist/chunk-6TJPMBUQ.js +0 -1
  466. package/dist/chunk-6XFUICD7.js +0 -1
  467. package/dist/chunk-BHSO2MDK.js +0 -6
  468. package/dist/chunk-GSOYVIQS.js +0 -1
  469. package/dist/chunk-HSRH76JN.js +0 -3
  470. package/dist/chunk-HSZ4AQ6L.js +0 -9
  471. package/dist/chunk-I6NPILT5.js +0 -1
  472. package/dist/chunk-K7SRNBIV.js +0 -1
  473. package/dist/chunk-LCWBVOII.js +0 -3
  474. package/dist/chunk-MKEC3U2M.js +0 -4
  475. package/dist/chunk-NUM3YQGK.js +0 -1
  476. package/dist/chunk-OM4LYD3S.js +0 -1
  477. package/dist/chunk-PLKYHUNT.js +0 -1
  478. package/dist/chunk-QIJMV2P2.js +0 -2
  479. package/dist/chunk-RVU73VKN.js +0 -2
  480. package/dist/chunk-SDAH3ECM.js +0 -5
  481. package/dist/chunk-SGQWRIRJ.js +0 -10
  482. package/dist/chunk-SWBJS3U4.js +0 -1
  483. package/dist/chunk-T7I2VX3J.js +0 -1
  484. package/dist/chunk-T7MWQQIF.js +0 -3
  485. package/dist/chunk-VDP5CQHM.js +0 -3
  486. package/dist/chunk-XG7QNAKW.js +0 -9
  487. package/dist/chunk-XLWCSJMR.js +0 -1
  488. package/dist/chunk-YFP4P2FV.js +0 -1
  489. package/dist/chunk-YIXP2ALP.js +0 -9
  490. package/dist/entry-22.js +0 -1
  491. package/docs/agent-guides/diagnostics.md +0 -5
  492. package/docs/agent-guides/json-reading.md +0 -57
  493. package/docs/agent-guides/read-resources.md +0 -17
  494. package/docs/agent-guides/search-code.md +0 -76
  495. package/docs/agent-guides/select-code.md +0 -119
  496. package/docs/agent-guides/vision.md +0 -11
  497. package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
  498. package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
  499. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  500. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  501. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  502. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  503. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  504. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  505. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  506. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
  507. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
  508. package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
  509. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
  510. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
  511. package/node_modules/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  512. package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  513. package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
  514. package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
  515. package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
  516. package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
  517. package/node_modules/pi-agent-search-text/runtime/entry-56.js +0 -1
  518. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  519. package/node_modules/pi-agent-text-editor/runtime/entry-66.js +0 -1
  520. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  521. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
  522. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
  523. package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
  524. package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
  525. package/src/backend/vision-capture-worker.py +0 -319
  526. package/src/backend/vision-capture.ts +0 -165
  527. package/src/backend/vision-registration.ts +0 -104
  528. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
  529. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  530. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
  531. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
  532. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
  533. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
  534. package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
  535. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  536. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
  537. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
  538. package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
  539. package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
  540. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  541. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +0 -1
  542. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  543. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
  544. package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
  545. package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
  546. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  547. package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
  548. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  549. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  550. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  551. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  552. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  553. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
  554. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
  555. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
  556. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
  557. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
  558. package/src/plugins/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  559. package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  560. package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
  561. package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
  562. package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
  563. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
  564. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
  565. /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
  566. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
  567. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-30.js +0 -0
  568. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  569. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  570. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-35.js +0 -0
  571. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  572. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  573. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  574. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  575. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
  576. /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-44.js +0 -0
  577. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-45.js +0 -0
  578. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-46.js +0 -0
  579. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
  580. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-52.js +0 -0
  581. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
  582. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-61.js +0 -0
  583. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  584. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  585. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  586. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-65.js +0 -0
  587. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-83.js +0 -0
  588. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-86.js +0 -0
  589. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-89.js +0 -0
  590. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  591. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  592. /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
  593. /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
  594. /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
  595. /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
  596. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  597. /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
  598. /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
  599. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  600. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  601. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  602. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  603. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
@@ -1,5 +1,9 @@
1
1
  import { requiredValue } from "pi-agent-invariant";
2
- import { ResourceError } from "pi-agent-resource";
2
+ import {
3
+ ResourceError,
4
+ resourceErrorMetadataOf,
5
+ type ResourceErrorMetadata,
6
+ } from "pi-agent-resource";
3
7
  import path from "node:path";
4
8
  import { AsyncLocalStorage } from "node:async_hooks";
5
9
  import type { TextEditCompletion } from "#src/api/edit-completion.js";
@@ -32,6 +36,8 @@ import {
32
36
  type TextMutationContext,
33
37
  type TextMutationEdit,
34
38
  type TextMutationToolRegistration,
39
+ type TextSemanticMutationResult,
40
+ withoutEmptyOptionalAnchors,
35
41
  } from "#src/api/mutation-tool.js";
36
42
  import {
37
43
  isFormattingContribution,
@@ -43,6 +49,7 @@ import {
43
49
  type StaleAnchorMessageDetails,
44
50
  } from "#src/api/stale-anchor-message.js";
45
51
  import { createUnifiedDiff } from "#src/core/mutation-result/diff.js";
52
+ import { imageWriteResult, planImageWrite } from "#src/core/image-write.js";
46
53
  import { FileMutationAgentResult } from "#src/core/mutation-result/file-mutation-agent-result.js";
47
54
  import { readTextAnchorRecovery } from "#src/core/text-anchor-recovery.js";
48
55
  import { applyTextChanges, TextChangeDocument } from "#src/core/text-change-engine.js";
@@ -93,7 +100,7 @@ import { executeWholeFileTool, isWholeFileInvocation } from "#src/core/file-oper
93
100
  import { EDITING_GUIDELINES } from "#src/core/editing-guidelines.js";
94
101
  import { writeAgentResult } from "./write-agent-result.js";
95
102
  import { mutationResultSchema, structuredMutation } from "./structured-result.js";
96
- import type { ResultTargetStore } from "pi-agent-resource";
103
+ import type { ResultImageStore, ResultTargetStore } from "pi-agent-resource";
97
104
 
98
105
  /** Build a mutation tool; host events report terminal filesystem approvals to Herdr. */
99
106
  export function createTextTool<TParameters extends TSchema>(
@@ -103,6 +110,7 @@ export function createTextTool<TParameters extends TSchema>(
103
110
  getLastResolvedSource: () => string | undefined,
104
111
  resultTargets?: ResultTargetStore,
105
112
  events?: Pick<ExtensionAPI["events"], "emit">,
113
+ resultImages?: ResultImageStore,
106
114
  ): ToolDefinition<TParameters, FileMutationBatchResult> {
107
115
  const renderer = core.getToolRenderer(definition.name);
108
116
  const initialRenderCall = renderer?.renderCall;
@@ -160,6 +168,16 @@ export function createTextTool<TParameters extends TSchema>(
160
168
  captureScriptMutation(core, async () => {
161
169
  const execute = async (): Promise<AgentToolResult<FileMutationBatchResult>> => {
162
170
  let input = asMutationParameters<TParameters>(parameters);
171
+ if (definition.name === "write") {
172
+ const written = await writeImageContent(
173
+ core,
174
+ resultImages,
175
+ input,
176
+ context.cwd,
177
+ signal,
178
+ );
179
+ if (written !== undefined) return written;
180
+ }
163
181
  if (
164
182
  ["replace", "write", "delete", "undo", "insert"].includes(definition.name) &&
165
183
  isResultInput(input[definition.source.field])
@@ -300,19 +318,7 @@ export function createTextTool<TParameters extends TSchema>(
300
318
  { cwd: context.cwd, ...(signal !== undefined && { signal }) },
301
319
  input,
302
320
  );
303
- return {
304
- content: [{ type: "text", text: action.summary }],
305
- details: {
306
- results: [],
307
- metadata: {
308
- semanticAction: {
309
- ...action.data,
310
- source: action.source,
311
- ...(action.script !== undefined && { script: action.script }),
312
- },
313
- },
314
- },
315
- };
321
+ return semanticActionResult(action);
316
322
  } catch (error) {
317
323
  const code =
318
324
  error !== null && typeof error === "object" && "code" in error
@@ -449,37 +455,41 @@ export function createTextTool<TParameters extends TSchema>(
449
455
  }),
450
456
  annotations,
451
457
  );
458
+ let fieldDescriptionsKey = "";
459
+ let describedParameters = definition.parameters;
460
+ Object.defineProperty(tool, "parameters", {
461
+ enumerable: true,
462
+ get(): TParameters {
463
+ const properties = (definition.parameters as { properties?: Record<string, TSchema> })
464
+ .properties;
465
+ if (properties === undefined) return definition.parameters;
466
+ const additions = Object.keys(properties).map(
467
+ (field) => [field, core.renderToolFieldDescription(definition.name, field)] as const,
468
+ );
469
+ const key = JSON.stringify(additions);
470
+ if (key === fieldDescriptionsKey) return describedParameters;
471
+ fieldDescriptionsKey = key;
472
+ const described = { ...properties };
473
+ for (const [field, addition] of additions) {
474
+ if (addition === undefined) continue;
475
+ const base = described[field] as TSchema & { description?: string };
476
+ described[field] = {
477
+ ...base,
478
+ description: [base.description, addition].filter(Boolean).join(" "),
479
+ };
480
+ }
481
+ describedParameters = { ...definition.parameters, properties: described };
482
+ return describedParameters;
483
+ },
484
+ });
452
485
  Object.defineProperty(tool, "description", {
453
486
  enumerable: true,
454
487
  get(): string {
455
488
  return [
456
489
  definition.description,
457
490
  core.renderToolPromptGuideline(definition.name) ?? "",
458
- (
459
- {
460
- replace:
461
- "This result selects the resulting text; empty replacement selects the resulting position, not the removed text.",
462
- insert:
463
- "For text edits, this result selects the inserted text, including supplied line separators. Specialized resources return their own action result.",
464
- write:
465
- "For file writes, this result selects the whole file and returns a compact write receipt, not file content.",
466
- copy: "This result selects only the copied destination text; a whole-file copy selects the whole destination. Copy edits only the destination.",
467
- move: "Use the Move result to work with the inserted destination text, including any added line separators. Valid empty arrays and paired zero-width selections succeed without writes; paired points select only the unchanged destination points. Source removals are not selected. A whole-file move selects the whole destination when a reusable text result is available.",
468
- delete: "Delete returns no reusable text selection.",
469
- undo: "The result selects the whole restored text file, not only the reversed span.",
470
- } as Record<string, string>
471
- )[definition.name] ?? "",
472
- definition.name === "replace"
473
- ? "Pass the unchanged result to another source tool to use its selection. If it has no text selection, read the file again."
474
- : definition.name === "write"
475
- ? "For file writes, pass this unchanged result to another source tool for dependent work. If the result reports no verified text selection, inspect the file instead."
476
- : definition.name === "undo"
477
- ? "Pass the unchanged result to another source tool for dependent work. If no verified text selection is returned, read the file again."
478
- : ["insert", "copy", "move"].includes(definition.name)
479
- ? "Pass this unchanged result to another source tool for dependent work." +
480
- " If the result reports no verified text selection, inspect the file instead."
481
- : "",
482
- definition.source.inherited && !["delete", "undo"].includes(definition.name)
491
+ definition.source.inherited &&
492
+ !["delete", "undo", "insert", "move", "copy", "replace"].includes(definition.name)
483
493
  ? definition.wholeFileOperation === undefined
484
494
  ? `When ${definition.source.field} is omitted, the tool can reuse the file identified by the supplied anchor, the last read, or the preceding edit in the same batch.`
485
495
  : `When ${definition.source.field} is omitted, the tool can reuse the file identified by a supplied text anchor.`
@@ -502,10 +512,12 @@ function prepareGuardedArguments<TParameters extends TSchema>(
502
512
  ): ReturnType<
503
513
  NonNullable<ToolDefinition<TParameters, FileMutationBatchResult>["prepareArguments"]>
504
514
  > {
505
- const prepared =
515
+ const prepared = withoutEmptyOptionalAnchors(
516
+ anchorFields,
506
517
  arguments_ !== null && typeof arguments_ === "object" && !Array.isArray(arguments_)
507
518
  ? { ...(arguments_ as Record<string, unknown>) }
508
- : {};
519
+ : {},
520
+ );
509
521
  const required = (schema as { required?: unknown }).required;
510
522
  const properties = (schema as { properties?: Record<string, { type?: unknown }> }).properties;
511
523
 
@@ -748,10 +760,14 @@ function mergeTargets(left: readonly TextTarget[], right: readonly TextTarget[])
748
760
  return [...merged.values()];
749
761
  }
750
762
 
763
+ function selectionRangeKey(range: TextSelectionRange): string {
764
+ return JSON.stringify({ start: range.start, end: range.end });
765
+ }
766
+
751
767
  function deduplicateRanges(ranges: readonly TextSelectionRange[]): readonly TextSelectionRange[] {
752
768
  const merged = new Map<string, TextSelectionRange>();
753
769
  for (const range of ranges) {
754
- const key = JSON.stringify({ start: range.start, end: range.end });
770
+ const key = selectionRangeKey(range);
755
771
  const previous = merged.get(key);
756
772
  merged.set(key, {
757
773
  ...range,
@@ -812,7 +828,29 @@ function mergeResolvedAnchors(
812
828
  throw new Error(`Anchor ${field} selections overlap or are ambiguous.`);
813
829
  }
814
830
  }
815
- return [source, new TextSelectionAnchor(field, source, unique)] as const;
831
+ // A typed source can duplicate an explicit literal's linewise selection.
832
+ // Keep the explicit endpoint extent when deduplicating that selection.
833
+ const explicitEndpoints = explicitSelection.endpointRanges;
834
+ const endpoints =
835
+ explicitEndpoints === undefined
836
+ ? undefined
837
+ : new Map(
838
+ explicitSelection.ranges.map((range, index) => [
839
+ selectionRangeKey(range),
840
+ requiredValue(explicitEndpoints[index]),
841
+ ]),
842
+ );
843
+ return [
844
+ source,
845
+ new TextSelectionAnchor(
846
+ field,
847
+ source,
848
+ unique,
849
+ endpoints === undefined
850
+ ? undefined
851
+ : unique.map((range) => endpoints.get(selectionRangeKey(range)) ?? range),
852
+ ),
853
+ ] as const;
816
854
  }),
817
855
  );
818
856
  }
@@ -1510,27 +1548,13 @@ async function buildToolResult(
1510
1548
  effect,
1511
1549
  outcome.failure.rollback,
1512
1550
  outcome.failure.code,
1551
+ false,
1552
+ resourceErrorMetadataOf(safe),
1513
1553
  );
1514
1554
  }
1515
1555
 
1516
1556
  const mutation = outcome.result as ExecutedTextMutation;
1517
- if (mutation.semanticAction !== undefined) {
1518
- return {
1519
- content: [{ type: "text", text: mutation.semanticAction.summary }],
1520
- details: {
1521
- results: [],
1522
- metadata: {
1523
- semanticAction: {
1524
- ...mutation.semanticAction.data,
1525
- source: mutation.semanticAction.source,
1526
- ...(mutation.semanticAction.script !== undefined && {
1527
- script: mutation.semanticAction.script,
1528
- }),
1529
- },
1530
- },
1531
- },
1532
- };
1533
- }
1557
+ if (mutation.semanticAction !== undefined) return semanticActionResult(mutation.semanticAction);
1534
1558
  if (operation === "write" && outcome.resources.length === 0 && mutation.unchangedWrite) {
1535
1559
  const { source: unchangedSource, content } = mutation.unchangedWrite;
1536
1560
  return {
@@ -1855,6 +1879,57 @@ function declaredMutationEffect(error: unknown): "applied" | "not-applied" | "un
1855
1879
  return error.effect;
1856
1880
  return "unknown";
1857
1881
  }
1882
+ /**
1883
+ * The tool result of a semantic or direct action: its summary, then any images it returned for the model.
1884
+ * Image data stays out of details, which carry only the receipt and the script value.
1885
+ */
1886
+ function semanticActionResult(
1887
+ action: TextSemanticMutationResult,
1888
+ ): AgentToolResult<FileMutationBatchResult> {
1889
+ return {
1890
+ content: [{ type: "text", text: action.summary }, ...(action.images ?? [])],
1891
+ details: {
1892
+ results: [],
1893
+ metadata: {
1894
+ semanticAction: {
1895
+ ...action.data,
1896
+ source: action.source,
1897
+ ...(action.script !== undefined && { script: action.script }),
1898
+ },
1899
+ },
1900
+ },
1901
+ };
1902
+ }
1903
+ /** Write images named by Write content; returns undefined when the content is ordinary text. */
1904
+ async function writeImageContent(
1905
+ core: TextEditorCore,
1906
+ store: ResultImageStore | undefined,
1907
+ input: Readonly<Record<string, unknown>>,
1908
+ cwd: string,
1909
+ signal: AbortSignal | undefined,
1910
+ ): Promise<AgentToolResult<FileMutationBatchResult> | undefined> {
1911
+ const target = typeof input.path === "string" ? input.path : "";
1912
+ try {
1913
+ const files = await planImageWrite(input.path, input.content, store, cwd);
1914
+ if (files === undefined) return undefined;
1915
+ await core.enqueueFileOperation(
1916
+ () => core.writeFiles(files, { cwd, ...(signal !== undefined && { signal }) }),
1917
+ signal,
1918
+ { cwd, sources: files.map((file) => file.source) },
1919
+ );
1920
+ return imageWriteResult(files);
1921
+ } catch (error) {
1922
+ signal?.throwIfAborted();
1923
+ const declared = error !== null && typeof error === "object";
1924
+ return failureToolResult(
1925
+ target,
1926
+ declared && "code" in error ? String(error.code) : "IMAGE_WRITE_FAILED",
1927
+ errorMessage(error),
1928
+ // Only the write step marks its effect; earlier failures changed nothing.
1929
+ declared && "effect" in error ? declaredMutationEffect(error) : "not-applied",
1930
+ );
1931
+ }
1932
+ }
1858
1933
  function failureToolResult(
1859
1934
  source: string,
1860
1935
  code: string,
@@ -1863,6 +1938,7 @@ function failureToolResult(
1863
1938
  rollback?: TextResourceEditFailure["rollback"],
1864
1939
  stage?: string,
1865
1940
  copyExecutionFailure = false,
1941
+ metadata?: ResourceErrorMetadata,
1866
1942
  ): { content: [{ type: "text"; text: string }]; details: FileMutationBatchResult } {
1867
1943
  const uncertain =
1868
1944
  effect === "unknown" ||
@@ -1889,7 +1965,15 @@ function failureToolResult(
1889
1965
  const result = new FileMutationResult({
1890
1966
  ok: false,
1891
1967
  path: source,
1892
- errors: [{ path: source, code, reason, ...(stage === undefined ? {} : { stage }) }],
1968
+ errors: [
1969
+ {
1970
+ path: source,
1971
+ code,
1972
+ reason,
1973
+ ...(stage === undefined ? {} : { stage }),
1974
+ ...(metadata === undefined ? {} : { metadata }),
1975
+ },
1976
+ ],
1893
1977
  ...(fileChangedStatement === undefined
1894
1978
  ? {}
1895
1979
  : {
@@ -113,31 +113,26 @@ export function registerStreamingInterceptorProvider(
113
113
  installed.set(model.provider, state);
114
114
  };
115
115
 
116
- pi.on("before_provider_request", (_event, context) => {
116
+ // Pi can still run an in-flight request's hooks after it disposed the session that issued them.
117
+ // Their context is stale then, and the shut-down session must not join the shared stream again.
118
+ let shutDown = false;
119
+ const attach = (context: ExtensionContext, model?: Model<Api>): void => {
120
+ if (shutDown) return;
117
121
  subscriber.context = context;
118
- install(context.model, context);
119
- });
120
-
121
- pi.on("turn_start", (_event, context) => {
122
- subscriber.context = context;
123
- install(context.model, context);
124
- });
122
+ install(model ?? context.model, context);
123
+ };
125
124
 
126
- pi.on("agent_start", (_event, context) => {
127
- subscriber.context = context;
128
- install(context.model, context);
129
- });
125
+ pi.on("before_provider_request", (_event, context) => attach(context));
126
+ pi.on("turn_start", (_event, context) => attach(context));
127
+ pi.on("agent_start", (_event, context) => attach(context));
130
128
  pi.on("session_start", (_event, context) => {
131
- subscriber.context = context;
132
- install(context.model, context);
133
- });
134
-
135
- pi.on("model_select", (event, context) => {
136
- subscriber.context = context;
137
- install(event.model, context);
129
+ shutDown = false;
130
+ attach(context);
138
131
  });
132
+ pi.on("model_select", (event, context) => attach(context, event.model));
139
133
 
140
134
  pi.on("session_shutdown", () => {
135
+ shutDown = true;
141
136
  for (const [provider, state] of installed) {
142
137
  state.subscribers.delete(subscriber);
143
138
 
@@ -51,6 +51,7 @@ export function singleAnchorSpan(
51
51
  anchors: ReadonlyMap<string, TextAnchor>,
52
52
  field: string,
53
53
  wholeLines = false,
54
+ rangeEndpoint = false,
54
55
  ): TextAnchorSpan {
55
56
  if (anchors.size !== 1) {
56
57
  throw new Error(`Anchor ${field} must resolve in one resource.`);
@@ -61,7 +62,9 @@ export function singleAnchorSpan(
61
62
  if (anchor.ranges.length !== 1) {
62
63
  throw new Error(`Anchor ${field} must select one match for this operation.`);
63
64
  }
64
- const selectedRange = requiredValue(anchor.ranges[0]);
65
+ const selectedRange = requiredValue(
66
+ (rangeEndpoint ? (anchor.endpointRanges ?? anchor.ranges) : anchor.ranges)[0],
67
+ );
65
68
  const document = context.documentFor(source);
66
69
  const exactRange = selectionRange(context, source, selectedRange);
67
70
  const endLine = wholeLines
@@ -92,7 +95,36 @@ export function singleAnchorSpan(
92
95
  };
93
96
  }
94
97
 
95
- /** A single anchor keeps its own extent; two ordered anchors select inclusive whole lines. */
98
+ /**
99
+ * Text to transfer into a destination. A whole-line literal source selects its line, but an
100
+ * exact character destination receives the literal itself, so no extra line break is added.
101
+ */
102
+ export function transferText(
103
+ context: TextMutationContext,
104
+ starts: ReadonlyMap<string, TextAnchor>,
105
+ ends: ReadonlyMap<string, TextAnchor> | undefined,
106
+ sourceSpan: TextAnchorSpan,
107
+ targetSpan: TextAnchorSpan | undefined,
108
+ ): string {
109
+ const span =
110
+ ends === undefined && targetSpan?.selection === true && !sourceSpan.selection
111
+ ? singleAnchorSpan(context, starts, "start", false, true)
112
+ : sourceSpan;
113
+ return context.documentFor(span.source).text(span);
114
+ }
115
+
116
+ /** Whether an endpoint selects complete lines: a line anchor or text matching a whole line. */
117
+ function selectsWholeLines(anchors: ReadonlyMap<string, TextAnchor>): boolean {
118
+ const anchor = anchors.values().next().value;
119
+ if (anchor === undefined) return false;
120
+ if (!TextSelectionAnchor.is(anchor)) return true;
121
+ return anchor.ranges.length === 1 && anchor.ranges[0]?.linewise === true;
122
+ }
123
+
124
+ /**
125
+ * Join ordered endpoints. Two whole-line endpoints, such as BEGIN/END marker lines, select their
126
+ * complete lines; otherwise exact text and :match keep character boundaries.
127
+ */
96
128
  export function anchorSpanRange(
97
129
  context: TextMutationContext,
98
130
  starts: ReadonlyMap<string, TextAnchor>,
@@ -100,23 +132,22 @@ export function anchorSpanRange(
100
132
  startField: string,
101
133
  endField: string,
102
134
  ): TextAnchorSpan {
103
- const start = singleAnchorSpan(context, starts, startField);
104
- const end = ends === undefined ? start : singleAnchorSpan(context, ends, endField);
135
+ if (ends === undefined) return singleAnchorSpan(context, starts, startField);
136
+ const exactEndpoints = !(selectsWholeLines(starts) && selectsWholeLines(ends));
137
+ const start = singleAnchorSpan(context, starts, startField, false, exactEndpoints);
138
+ const end = singleAnchorSpan(context, ends, endField, false, exactEndpoints);
105
139
  if (start.source !== end.source) {
106
140
  throw new Error(`Anchors ${startField} and ${endField} must resolve in one resource.`);
107
141
  }
108
142
  if (start.from > end.from) {
109
143
  throw new Error(`Anchor ${startField} must not come after ${endField}.`);
110
144
  }
111
- if (ends === undefined) return start;
112
- const first = singleAnchorSpan(context, starts, startField, true);
113
- const last = singleAnchorSpan(context, ends, endField, true);
114
145
  return {
115
- source: first.source,
116
- from: first.from,
117
- to: last.to,
118
- selection: false,
119
- preservesTrailingLineBreak: true,
146
+ source: start.source,
147
+ from: start.from,
148
+ to: end.to,
149
+ selection: start.selection || end.selection,
150
+ preservesTrailingLineBreak: end.preservesTrailingLineBreak,
120
151
  };
121
152
  }
122
153
 
@@ -18,14 +18,14 @@ export function sourceRangeProperties(descriptions: Partial<Record<"start" | "en
18
18
  Type.String({
19
19
  description:
20
20
  descriptions.start ??
21
- "Anchor or unique exact text. Alone, selects that fragment; a line anchor selects only its line. Omit when path already selects text through a supported resource reference. With end, selects a whole-line range.",
21
+ "Anchor or unique exact text where the selection begins. Without end, selects only this text, or only this one line for a line anchor; add end to select several lines. Omit when path is a result that already selects text.",
22
22
  }),
23
23
  ),
24
24
  end: Type.Optional(
25
25
  Type.String({
26
26
  description:
27
27
  descriptions.end ??
28
- "Optional anchor or unique exact text. Range includes start's first line through end's last line, even for SEARCH :match. Mixed types allowed; boundaries must be unique, in one file, and forward-ordered. Omit when start already selects the intended content; do not repeat start. The end line is included, not a stopping point before it.",
28
+ "Anchor or unique exact text where the selection ends, inclusive. Omit when start selects everything.",
29
29
  }),
30
30
  ),
31
31
  };
@@ -35,18 +35,18 @@ export function sourceRangeProperties(descriptions: Partial<Record<"start" | "en
35
35
  export function targetProperties(directorySemantics: string) {
36
36
  return {
37
37
  target: resultSourceProperty(
38
- `Destination path, unchanged source result or its UUID. A result replaces its exact ranges (zero-width ranges insert); omit targetStart/targetEnd. Source and destination selections pair in declared order with equal counts. A path with text selectors keeps its existing anchor semantics. Whole-object transfers create missing parents and replace regular destination files. ${directorySemantics} Reject symlink destinations, type conflicts, and overlapping directory trees.`,
38
+ `Destination: a path, or an unchanged result whose ranges are replaced. A whole-file transfer creates missing folders and replaces an existing file. ${directorySemantics}`,
39
39
  ),
40
40
  targetStart: Type.Optional(
41
41
  Type.String({
42
42
  description:
43
- "Registered anchor or unique exact text in the destination. Required for text transfers to a file path; omit for whole-file transfers or a result destination. Without targetEnd, inserts after the last containing line, keeping the selected text. With targetEnd, replacement starts at the first containing line. SEARCH :match also uses these line boundaries.",
43
+ "Anchor or unique exact text in the destination file; the text goes after its line. Required when the text goes into a file path.",
44
44
  }),
45
45
  ),
46
46
  targetEnd: Type.Optional(
47
47
  Type.String({
48
48
  description:
49
- "Optional inclusive destination end. Replaces whole lines through the last line containing this anchor, including SEARCH :match. May differ in type from targetStart; both must resolve uniquely in the target file and in forward order. Omit to insert after targetStart instead.",
49
+ "Replace from targetStart through targetEnd instead of inserting after targetStart.",
50
50
  }),
51
51
  ),
52
52
  };
@@ -9,6 +9,7 @@ import {
9
9
  import { TEXT_POSITION_ANCHOR_KIND, TEXT_SEARCH_ANCHOR_KIND } from "#src/api/plugin-protocol.js";
10
10
  import {
11
11
  anchorSpanRange,
12
+ transferText,
12
13
  insertionAfterAnchor,
13
14
  replaceAnchorSpan,
14
15
  } from "#src/tools/text-selection.js";
@@ -18,11 +19,11 @@ import type { TextMutationToolRegistration } from "#src/api/mutation-tool.js";
18
19
  export const copySchema = Type.Object(
19
20
  {
20
21
  path: resultSourceProperty(
21
- "Filesystem source path, unchanged source result or its UUID; omit start/end for result inputs. Use ordinary paths without selectors to copy whole files, directory trees, or symlink objects without following their targets. Use one whole-file result when the destination is a file path without text selectors. Source/destination selections pair in declared order, with equal counts and duplicate ranges removed.",
22
+ "Source: a path, an unchanged Read/Search result or its UUID, or an array of them. A path without start copies the whole file, directory or symlink. Omit to use the file of the start anchor.",
22
23
  ),
23
24
  ...sourceRangeProperties(),
24
25
  ...targetProperties(
25
- "Directory Copy merges into the exact target path and retains destination-only entries.",
26
+ "Copying a directory merges into the target and keeps files that exist only there.",
26
27
  ),
27
28
  },
28
29
  { additionalProperties: false },
@@ -39,8 +40,7 @@ interface CopyParameters {
39
40
  export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> = {
40
41
  name: "copy",
41
42
  wholeFileOperation: "copy",
42
- description:
43
- "Use copy to copy a file, directory tree, or symlink object, or to duplicate selected text within or between files.",
43
+ description: "Use copy to copy a file or directory, or to duplicate text in another place.",
44
44
 
45
45
  promptSnippet: "Copy filesystem objects or selected text",
46
46
  parameters: copySchema,
@@ -74,10 +74,10 @@ export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> =
74
74
  const starts = await context.resolveAnchors("start");
75
75
  const ends = parameters.end === undefined ? undefined : await context.resolveAnchors("end");
76
76
  const sourceSpan = anchorSpanRange(context, starts, ends, "start", "end");
77
- const copied = context.documentFor(sourceSpan.source).text(sourceSpan);
78
77
 
79
78
  const targetStarts = await context.resolveAnchors("targetStart");
80
79
  if (parameters.targetEnd === undefined) {
80
+ const copied = context.documentFor(sourceSpan.source).text(sourceSpan);
81
81
  const [target, change] = insertionAfterAnchor(context, targetStarts, "targetStart", copied);
82
82
  return {
83
83
  edits: new Map([
@@ -94,6 +94,7 @@ export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> =
94
94
  "targetStart",
95
95
  "targetEnd",
96
96
  );
97
+ const copied = transferText(context, starts, ends, sourceSpan, targetSpan);
97
98
  return {
98
99
  edits: new Map([
99
100
  [
@@ -18,13 +18,9 @@ import type { TextMutationToolRegistration } from "#src/api/mutation-tool.js";
18
18
  export const deleteSchema = Type.Object(
19
19
  {
20
20
  path: resultSourceProperty(
21
- "Filesystem path, shell:<session>, debug:<session>, debug:<session>/breakpoint/<id>, unchanged source result or its UUID, or an array of results. An ordinary filesystem path without start/end deletes the object: directories recursively, symlinks only as links. A text result input removes only selected text and keeps the file, even for a whole-file selection. For Read results from symbol:<file>#<selector>, deletion removes only the declaration text; imports and references are unchanged. Omit start/end for result inputs. Omit path when a supplied text anchor identifies the file.",
21
+ "Path, unchanged Read/Search result or its UUID, or an array of them. A path without start deletes the file or directory (a symlink only as a link); a result removes only its selected text. Omit to use the file of the start anchor.",
22
22
  ),
23
- ...sourceRangeProperties({
24
- start:
25
- "Anchor or unique exact text locating the text to remove. Without end, exact text selects only that fragment; a line anchor selects its whole line. Omit when path already selects text.",
26
- end: "Anchor or unique exact text locating the last line to remove. With start, removes whole lines including both boundary lines, even for SEARCH :match anchors. Both boundaries must be unique, in one file, and in forward order. Mixed anchor types are allowed. Omit when start alone selects the intended text.",
27
- }),
23
+ ...sourceRangeProperties(),
28
24
  },
29
25
  { additionalProperties: false },
30
26
  );
@@ -38,7 +34,7 @@ export const deleteMutationTool: TextMutationToolRegistration<typeof deleteSchem
38
34
  name: "delete",
39
35
  wholeFileOperation: "delete",
40
36
  description:
41
- "Use delete to remove selected text, permanently delete a file or directory, unlink a symlink, terminate a terminal or debugger session, or remove a debugger breakpoint.",
37
+ "Use delete to remove text, delete a file or directory, or end a terminal or debugger session.",
42
38
 
43
39
  promptSnippet:
44
40
  "Delete files or selected text, terminate terminal or debugger sessions, or remove debugger breakpoints",
@@ -15,30 +15,28 @@ export const insertSchema = Type.Object(
15
15
  path: Type.Optional(
16
16
  Type.String({
17
17
  description:
18
- "Pass a file path, source resource reference, unchanged Read/Search/Select/edit result, or its UUID. Result inputs select only their registered ranges.",
18
+ "File path, resource reference, unchanged Read/Search/edit result or its UUID; a result selects only its ranges. Omit to reuse the file of the anchor, the last read or the preceding edit.",
19
19
  }),
20
20
  ),
21
21
  anchor: Type.Optional(
22
22
  Type.String({
23
23
  description:
24
- "For text edits, use a registered anchor or unique exact text to locate the insertion. Omit anchor when path already supplies the intended selection; otherwise it is required. For live resources, follow the action rules above.",
24
+ "Line anchor or unique exact text; insertion is always whole-line. Omit when path already selects the lines.",
25
25
  }),
26
26
  ),
27
27
  text: Type.String({
28
28
  minLength: 1,
29
- description:
30
- "For text edits, supply non-empty new text. The tool adds missing line breaks between the insertion and existing text. Add a leading newline only for an intentional blank line, not to start a new line. Payload newlines are kept, with line endings converted to the file's LF/CRLF style. No trailing newline is added at EOF.",
29
+ description: "Non-empty text to insert; line breaks around it are added for you.",
31
30
  }),
32
31
  separation: Type.Optional(
33
32
  Type.Union([Type.Literal("line"), Type.Literal("blank-line")], {
34
- description:
35
- "For text edits, defaults to line: separate inserted text from existing lines without adding extra blank lines. Use blank-line to add only missing blank lines between the insertion and existing text.",
33
+ description: "line (default) or blank-line: add blank lines around the insertion.",
36
34
  }),
37
35
  ),
38
36
  before: Type.Optional(
39
37
  Type.Boolean({
40
38
  description:
41
- "For text edits, defaults to false: insert after the last containing line of each selection. With true, insert before its first containing line. Selected text is kept. Multiple selections on the same insertion line produce one insertion.",
39
+ "true inserts before the first selected line; default false inserts after the last.",
42
40
  }),
43
41
  ),
44
42
  },
@@ -56,7 +54,7 @@ interface InsertParameters {
56
54
  export const insertMutationTool: TextMutationToolRegistration<typeof insertSchema> = {
57
55
  name: "insert",
58
56
  description:
59
- "Use insert to edit text or act on a live resource. For text edits, add new text before or after selected lines while keeping existing text. Insertion is line-based, including for exact-text and SEARCH :match anchors. An empty result selection makes no changes and is not an error.",
57
+ "Use insert to add text before or after lines without changing them, to send keys to a terminal session, or to control a debugger.",
60
58
 
61
59
  promptSnippet: "Insert file text, send terminal keys, or perform debugger actions",
62
60
  parameters: insertSchema,