pi-agent-ide 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (508) hide show
  1. package/CHANGELOG.md +70 -40
  2. package/README.md +15 -8
  3. package/dist/{chunk-ICDI27GZ.js → chunk-235QMMVA.js} +1 -1
  4. package/dist/{chunk-N7LMRL64.js → chunk-47SPPIXK.js} +1 -1
  5. package/dist/chunk-4DIUPEDF.js +2 -0
  6. package/dist/{chunk-JMVDFOTQ.js → chunk-57F5GTHO.js} +1 -1
  7. package/dist/{chunk-NULNW6GK.js → chunk-6FGLAVPJ.js} +1 -1
  8. package/dist/{chunk-KL776TGR.js → chunk-6H32W35W.js} +1 -1
  9. package/dist/{chunk-QP2QSQ4U.js → chunk-6OJ565FL.js} +1 -1
  10. package/dist/{chunk-TWWND6NI.js → chunk-6R3Y4AD3.js} +1 -1
  11. package/dist/{chunk-CPZJPGLG.js → chunk-6T7PSDQW.js} +1 -1
  12. package/dist/{chunk-4OYVLXWD.js → chunk-6TJPMBUQ.js} +1 -1
  13. package/dist/{chunk-SBLKPTL3.js → chunk-6XFUICD7.js} +1 -1
  14. package/dist/chunk-7VSVJRRF.js +28 -0
  15. package/dist/{chunk-7JV4VN73.js → chunk-AAC77UD4.js} +1 -1
  16. package/dist/chunk-ANM3Y5FO.js +11 -0
  17. package/dist/chunk-BB4A5UI3.js +5 -0
  18. package/dist/{chunk-7TJ6DWW3.js → chunk-CPELC6JE.js} +1 -1
  19. package/dist/chunk-FTPC44FP.js +33 -0
  20. package/dist/{chunk-SBNR4WZF.js → chunk-GSOYVIQS.js} +1 -1
  21. package/dist/{chunk-Z3PGADVA.js → chunk-HSRH76JN.js} +1 -1
  22. package/dist/{chunk-CSXHCSTH.js → chunk-HSZ4AQ6L.js} +1 -1
  23. package/dist/chunk-I6NPILT5.js +1 -0
  24. package/dist/chunk-K7SRNBIV.js +1 -0
  25. package/dist/{chunk-R5XJSEOE.js → chunk-LCWBVOII.js} +3 -3
  26. package/dist/{chunk-MZXX353D.js → chunk-LEJKDYCK.js} +1 -1
  27. package/dist/{chunk-3G54ZL2L.js → chunk-NJ7C4KMA.js} +1 -1
  28. package/dist/{chunk-CTJV77FR.js → chunk-NUM3YQGK.js} +1 -1
  29. package/dist/chunk-OJEIX7OZ.js +1 -0
  30. package/dist/{chunk-EY65TFHJ.js → chunk-PJL3UVMJ.js} +1 -1
  31. package/dist/{chunk-E4HPRLRB.js → chunk-QT3EAHOG.js} +1 -1
  32. package/dist/{chunk-HCN5W76B.js → chunk-RIJMXO43.js} +1 -1
  33. package/dist/chunk-RMI3NMQY.js +23 -0
  34. package/dist/chunk-RQ7JJ7GV.js +4 -0
  35. package/dist/{chunk-4XPUN4QN.js → chunk-RVU73VKN.js} +1 -1
  36. package/dist/{chunk-OJX3RJ5A.js → chunk-RW2GTYQI.js} +1 -1
  37. package/dist/{chunk-PNP2KNGP.js → chunk-SDAH3ECM.js} +1 -1
  38. package/dist/chunk-SGQWRIRJ.js +10 -0
  39. package/dist/{chunk-IUSLSROY.js → chunk-SMIFCAAX.js} +1 -1
  40. package/dist/chunk-SWBJS3U4.js +1 -0
  41. package/dist/chunk-T7MWQQIF.js +3 -0
  42. package/dist/{chunk-RAZP42IQ.js → chunk-VAXLSPPU.js} +1 -1
  43. package/dist/{chunk-XZDOVPRC.js → chunk-VMTOFEXF.js} +1 -1
  44. package/dist/{chunk-7HDK3NRQ.js → chunk-VXP5BMW7.js} +1 -1
  45. package/dist/{chunk-WE42GBGU.js → chunk-XAHU42FP.js} +3 -3
  46. package/dist/{chunk-UBH6X3D3.js → chunk-XBQR74IK.js} +1 -1
  47. package/dist/{chunk-7NS3QUIE.js → chunk-XG7QNAKW.js} +1 -1
  48. package/dist/{chunk-GW6NZQTQ.js → chunk-XLWCSJMR.js} +1 -1
  49. package/dist/{chunk-2K65BSXS.js → chunk-XXLLY66B.js} +1 -1
  50. package/dist/chunk-YFP4P2FV.js +1 -0
  51. package/dist/{chunk-75SWXD2Z.js → chunk-YIXP2ALP.js} +1 -1
  52. package/dist/{chunk-MOJ5RR35.js → chunk-ZJQRLVVV.js} +1 -1
  53. package/dist/entry-0.js +1 -1
  54. package/dist/entry-1.js +1 -1
  55. package/dist/entry-10.js +1 -1
  56. package/dist/entry-11.js +1 -1
  57. package/dist/entry-12.js +1 -1
  58. package/dist/entry-13.js +1 -1
  59. package/dist/entry-14.js +1 -1
  60. package/dist/entry-15.js +1 -1
  61. package/dist/entry-16.js +1 -1
  62. package/dist/entry-17.js +1 -1
  63. package/dist/entry-18.js +1 -0
  64. package/dist/entry-19.js +1 -1
  65. package/dist/entry-2.js +1 -1
  66. package/dist/entry-20.js +1 -1
  67. package/dist/entry-22.js +1 -1
  68. package/dist/entry-23.js +1 -1
  69. package/dist/entry-24.js +1 -1
  70. package/dist/entry-25.js +1 -1
  71. package/dist/entry-26.js +1 -2
  72. package/dist/entry-27.js +1 -1
  73. package/dist/entry-28.js +1 -4
  74. package/dist/entry-29.js +2 -1
  75. package/dist/entry-3.js +1 -1
  76. package/dist/entry-30.js +1 -1
  77. package/dist/entry-31.js +4 -1
  78. package/dist/entry-32.js +1 -18
  79. package/dist/entry-33.js +1 -1
  80. package/dist/entry-34.js +1 -1
  81. package/dist/entry-35.js +18 -1
  82. package/dist/entry-36.js +1 -1
  83. package/dist/entry-37.js +1 -1
  84. package/dist/entry-38.js +1 -1
  85. package/dist/entry-39.js +1 -1
  86. package/dist/entry-4.js +1 -1
  87. package/dist/entry-40.js +1 -1
  88. package/dist/entry-41.js +1 -1
  89. package/dist/entry-42.js +1 -1
  90. package/dist/entry-43.js +1 -1
  91. package/dist/entry-44.js +1 -1
  92. package/dist/entry-45.js +1 -1
  93. package/dist/entry-46.js +1 -25
  94. package/dist/entry-47.js +1 -1
  95. package/dist/entry-48.js +1 -1
  96. package/dist/entry-49.js +25 -1
  97. package/dist/entry-5.js +1 -1
  98. package/dist/entry-50.js +1 -1
  99. package/dist/entry-51.js +1 -3
  100. package/dist/entry-52.js +1 -13
  101. package/dist/entry-53.js +1 -1
  102. package/dist/entry-54.js +3 -1
  103. package/dist/entry-55.js +13 -1
  104. package/dist/entry-56.js +1 -1
  105. package/dist/entry-57.js +1 -1
  106. package/dist/entry-58.js +1 -1
  107. package/dist/entry-59.js +1 -1
  108. package/dist/entry-6.js +1 -1
  109. package/dist/entry-60.js +1 -1
  110. package/dist/entry-61.js +1 -1
  111. package/dist/entry-62.js +1 -0
  112. package/dist/entry-63.js +1 -1
  113. package/dist/entry-64.js +1 -0
  114. package/dist/entry-65.js +0 -1
  115. package/dist/entry-66.js +1 -1
  116. package/dist/entry-67.js +0 -1
  117. package/dist/entry-68.js +1 -1
  118. package/dist/entry-69.js +1 -1
  119. package/dist/entry-7.js +1 -1
  120. package/dist/entry-70.js +1 -1
  121. package/dist/entry-71.js +1 -1
  122. package/dist/entry-72.js +1 -0
  123. package/dist/entry-73.js +1 -1
  124. package/dist/entry-74.js +1 -0
  125. package/dist/entry-75.js +0 -1
  126. package/dist/entry-76.js +1 -1
  127. package/dist/entry-77.js +0 -1
  128. package/dist/entry-78.js +1 -80
  129. package/dist/entry-79.js +1 -21
  130. package/dist/entry-8.js +1 -1
  131. package/dist/entry-80.js +1 -2
  132. package/dist/entry-81.js +80 -1
  133. package/dist/entry-82.js +22 -1
  134. package/dist/entry-83.js +2 -1
  135. package/dist/entry-84.js +1 -3
  136. package/dist/entry-85.js +1 -1
  137. package/dist/entry-86.js +1 -1
  138. package/dist/entry-87.js +1 -1
  139. package/dist/entry-88.js +3 -0
  140. package/dist/entry-89.js +1 -0
  141. package/dist/entry-9.js +1 -1
  142. package/dist/entry-90.js +1 -0
  143. package/dist/entry-91.js +1 -0
  144. package/dist/pi-agent-ide.js +53 -31
  145. package/docs/agent-guides/debugger.md +2 -0
  146. package/docs/agent-guides/editing.md +3 -3
  147. package/docs/agent-guides/search-code.md +5 -3
  148. package/docs/agent-guides/select-code.md +9 -6
  149. package/docs/agent-guides/ssh.md +1 -1
  150. package/docs/code-review.md +5 -0
  151. package/docs/configuration.md +52 -8
  152. package/docs/development.md +9 -13
  153. package/docs/directory-operations.md +1 -1
  154. package/docs/extensions.md +99 -2
  155. package/docs/releases.md +1 -1
  156. package/docs/settings-help.md +39 -0
  157. package/docs/structured-results.md +11 -6
  158. package/docs/tools.md +1 -0
  159. package/docs/user-hooks.md +4 -2
  160. package/node_modules/pi-agent-doctor/package.json +7 -10
  161. package/node_modules/pi-agent-doctor/runtime/entry-26.js +1 -0
  162. package/node_modules/pi-agent-doctor/runtime/entry-27.js +1 -0
  163. package/node_modules/pi-agent-documentation/package.json +2 -2
  164. package/node_modules/pi-agent-documentation/runtime/entry-28.js +1 -0
  165. package/node_modules/pi-agent-filesystem/package.json +8 -8
  166. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  167. package/node_modules/pi-agent-filesystem-jq/package.json +6 -7
  168. package/node_modules/pi-agent-filesystem-jq/runtime/entry-31.js +2 -0
  169. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  170. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  171. package/node_modules/pi-agent-filesystem-text/runtime/entry-33.js +2 -0
  172. package/node_modules/pi-agent-ide-ast/package.json +15 -41
  173. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +1 -0
  174. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +6 -5
  175. package/node_modules/pi-agent-ide-changes/package.json +10 -11
  176. package/node_modules/pi-agent-ide-changes/runtime/entry-36.js +1 -0
  177. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
  178. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  179. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  180. package/node_modules/pi-agent-ide-languages/runtime/entry-39.js +2 -0
  181. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  182. package/node_modules/pi-agent-ide-lint/runtime/entry-40.js +2 -0
  183. package/node_modules/pi-agent-ide-lsp/package.json +10 -13
  184. package/node_modules/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
  185. package/node_modules/pi-agent-image/package.json +3 -3
  186. package/node_modules/pi-agent-invariant/package.json +2 -2
  187. package/node_modules/pi-agent-pdf/package.json +3 -4
  188. package/node_modules/pi-agent-read/package.json +12 -12
  189. package/node_modules/pi-agent-read/runtime/entry-46.js +0 -1
  190. package/node_modules/pi-agent-read/runtime/entry-49.js +2 -0
  191. package/node_modules/pi-agent-resource/package.json +2 -2
  192. package/node_modules/pi-agent-resource/src/resource-error.ts +11 -0
  193. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -0
  194. package/node_modules/pi-agent-search/package.json +9 -9
  195. package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
  196. package/node_modules/pi-agent-search/runtime/entry-52.js +1 -0
  197. package/node_modules/pi-agent-search/runtime/entry-54.js +2 -0
  198. package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  199. package/node_modules/pi-agent-search/src/api/presentation.ts +10 -2
  200. package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
  201. package/node_modules/pi-agent-search/src/api/search.ts +7 -0
  202. package/node_modules/pi-agent-search/src/core/search-core.ts +23 -3
  203. package/node_modules/pi-agent-search-text/index.ts +2 -0
  204. package/node_modules/pi-agent-search-text/package.json +14 -14
  205. package/node_modules/pi-agent-search-text/runtime/entry-55.js +1 -0
  206. package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
  207. package/node_modules/pi-agent-search-text/src/search-backend.ts +18 -10
  208. package/node_modules/pi-agent-search-text/src/search-session.ts +68 -9
  209. package/node_modules/pi-agent-text/package.json +3 -3
  210. package/node_modules/pi-agent-text/runtime/entry-59.js +1 -0
  211. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  212. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +2 -0
  213. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -6
  214. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-61.js +1 -0
  215. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-62.js +2 -0
  216. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  217. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
  218. package/node_modules/pi-agent-text-editor/index.ts +2 -0
  219. package/node_modules/pi-agent-text-editor/package.json +26 -34
  220. package/node_modules/pi-agent-text-editor/runtime/entry-78.js +0 -1
  221. package/node_modules/pi-agent-text-editor/runtime/entry-79.js +1 -0
  222. package/node_modules/pi-agent-text-editor/runtime/entry-80.js +1 -0
  223. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +2 -0
  224. package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
  225. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
  226. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
  227. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
  228. package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
  229. package/node_modules/pi-agent-text-editor/src/core/extension.ts +4 -1
  230. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +40 -11
  231. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  232. package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
  233. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +29 -20
  234. package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
  235. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
  236. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
  237. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
  238. package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
  239. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
  240. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +35 -14
  241. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
  242. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
  243. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
  244. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
  245. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
  246. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -8
  247. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
  248. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +35 -2
  249. package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +17 -0
  250. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -5
  251. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  252. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +1 -0
  253. package/node_modules/pi-agent-tool-ui/package.json +6 -2
  254. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +1 -0
  255. package/node_modules/pi-agent-tool-ui/runtime/entry-86.js +1 -0
  256. package/node_modules/pi-agent-tool-ui/src/operation-approval.ts +271 -0
  257. package/node_modules/pi-agent-web/package.json +8 -11
  258. package/node_modules/pi-agent-web-html/package.json +3 -5
  259. package/node_modules/pi-agent-web-html/runtime/entry-88.js +2 -0
  260. package/node_modules/pi-agent-web-image/package.json +4 -4
  261. package/node_modules/pi-agent-web-image/runtime/entry-89.js +2 -0
  262. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  263. package/node_modules/pi-agent-web-pdf/runtime/entry-90.js +2 -0
  264. package/node_modules/pi-agent-web-text/package.json +4 -4
  265. package/node_modules/pi-agent-web-text/runtime/entry-91.js +2 -0
  266. package/package.json +65 -53
  267. package/skills/configure-agent-ide/SKILL.md +38 -0
  268. package/src/api/approval.ts +5 -0
  269. package/src/api/content.ts +6 -0
  270. package/src/api/settings.ts +198 -0
  271. package/src/api/tips.ts +3 -0
  272. package/src/backend/debugger-registration.ts +5 -1
  273. package/src/code-review/extension.ts +10 -4
  274. package/src/code-review/reviewer.ts +8 -0
  275. package/src/composite/host-version.ts +29 -5
  276. package/src/composite/ide-alias-rendering.ts +97 -0
  277. package/src/composite/nested-tool-rendering.ts +90 -9
  278. package/src/composite/preferences.ts +13 -0
  279. package/src/composite/search-facts.ts +45 -0
  280. package/src/composite/settings-documentation.ts +68 -0
  281. package/src/composite/settings-help.ts +106 -0
  282. package/src/composite/settings-registry.ts +94 -0
  283. package/src/composite/text-results.ts +170 -30
  284. package/src/composite/tool-availability.ts +11 -2
  285. package/src/core/diagnostic-entry.ts +31 -8
  286. package/src/core/diagnostic-store.ts +19 -3
  287. package/src/core/extension.ts +7 -2
  288. package/src/documentation/extension.ts +12 -0
  289. package/src/documentation/registry.ts +10 -2
  290. package/src/documentation/search.ts +166 -0
  291. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  292. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  293. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +6 -7
  294. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-31.js +2 -0
  295. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  296. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +2 -0
  297. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  298. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-33.js +2 -0
  299. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +2 -0
  300. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -11
  301. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -5
  302. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +2 -0
  303. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  304. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +2 -0
  305. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  306. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-90.js +2 -0
  307. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  308. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-91.js +2 -0
  309. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +2 -0
  310. package/src/extensions/pi-agent-read/package.json +12 -12
  311. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  312. package/src/extensions/pi-agent-read/runtime/entry-47.js +1 -0
  313. package/src/extensions/pi-agent-read/runtime/entry-49.js +2 -0
  314. package/src/extensions/pi-agent-search/package.json +9 -9
  315. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +2 -0
  316. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -14
  317. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +1 -0
  318. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +1 -0
  319. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  320. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +18 -10
  321. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +68 -9
  322. package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
  323. package/src/extensions/pi-agent-search/runtime/entry-52.js +1 -0
  324. package/src/extensions/pi-agent-search/runtime/entry-53.js +1 -0
  325. package/src/extensions/pi-agent-search/runtime/entry-54.js +2 -0
  326. package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  327. package/src/extensions/pi-agent-search/src/api/presentation.ts +10 -2
  328. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
  329. package/src/extensions/pi-agent-search/src/api/search.ts +7 -0
  330. package/src/extensions/pi-agent-search/src/core/search-core.ts +23 -3
  331. package/src/extensions/pi-agent-text-editor/index.ts +2 -0
  332. package/src/extensions/pi-agent-text-editor/package.json +26 -34
  333. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  334. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +2 -0
  335. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -6
  336. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +1 -0
  337. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-62.js +2 -0
  338. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  339. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-63.js +1 -0
  340. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
  341. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -8
  342. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
  343. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +35 -2
  344. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +17 -0
  345. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -5
  346. package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +0 -1
  347. package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +1 -0
  348. package/src/extensions/pi-agent-text-editor/runtime/entry-80.js +1 -0
  349. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +2 -0
  350. package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
  351. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
  352. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
  353. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
  354. package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
  355. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +4 -1
  356. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +40 -11
  357. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  358. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
  359. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +29 -20
  360. package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
  361. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
  362. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
  363. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
  364. package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
  365. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
  366. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +35 -14
  367. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
  368. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
  369. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
  370. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
  371. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
  372. package/src/pi-agent-ide.ts +74 -15
  373. package/src/plugins/pi-agent-ide-ast/package.json +15 -41
  374. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +1 -0
  375. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +6 -5
  376. package/src/plugins/pi-agent-ide-changes/package.json +10 -11
  377. package/src/plugins/pi-agent-ide-changes/runtime/entry-36.js +1 -0
  378. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
  379. package/src/plugins/pi-agent-ide-debugger/index.ts +158 -55
  380. package/src/plugins/pi-agent-ide-debugger/src/debugmcp-client.ts +118 -0
  381. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +47 -0
  382. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +2 -0
  383. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +146 -1
  384. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +12 -0
  385. package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +497 -0
  386. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  387. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  388. package/src/plugins/pi-agent-ide-languages/runtime/entry-39.js +2 -0
  389. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  390. package/src/plugins/pi-agent-ide-lint/runtime/entry-40.js +2 -0
  391. package/src/plugins/pi-agent-ide-lsp/package.json +10 -13
  392. package/src/plugins/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
  393. package/src/plugins/pi-agent-ide-terminal/index.ts +2 -0
  394. package/src/plugins/pi-agent-ide-terminal/src/origin.ts +30 -0
  395. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +34 -0
  396. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +11 -2
  397. package/src/plugins/pi-agent-ide-terminal/src/types.ts +9 -0
  398. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +72 -26
  399. package/src/tips/core.ts +5 -2
  400. package/src/tips/extension.ts +30 -2
  401. package/src/tips/persistence.ts +29 -27
  402. package/src/tips/setup-hint.ts +19 -0
  403. package/dist/chunk-3ZGDMTMD.js +0 -25
  404. package/dist/chunk-5KFVDYCI.js +0 -1
  405. package/dist/chunk-ABFCAOU5.js +0 -1
  406. package/dist/chunk-BIG45IPN.js +0 -2
  407. package/dist/chunk-BMOJTJJJ.js +0 -3
  408. package/dist/chunk-BQ67M4NC.js +0 -3
  409. package/dist/chunk-IH5NW5JX.js +0 -11
  410. package/dist/chunk-NRZO5KJT.js +0 -9
  411. package/dist/chunk-O36UC74T.js +0 -1
  412. package/dist/chunk-OLI3JPHJ.js +0 -28
  413. package/dist/chunk-SSWUUBIR.js +0 -1
  414. package/dist/chunk-UUJJRXHG.js +0 -29
  415. package/dist/entry-21.js +0 -1
  416. package/docs/research/apply-native-capability-matrix.md +0 -174
  417. package/docs/research/apply-read-latency.md +0 -221
  418. package/docs/research/codemode-write-context.md +0 -56
  419. package/docs/research/lpt-393-fuzzy-results/file.json +0 -152
  420. package/docs/research/lpt-393-fuzzy-results/repo.json +0 -122
  421. package/docs/research/lpt-393-search-fuzzy-fallback.md +0 -97
  422. package/docs/research/native-codemode-batch-decision.md +0 -31
  423. package/docs/research/native-codemode-batching.md +0 -65
  424. package/node_modules/pi-agent-doctor/runtime/entry-19.js +0 -1
  425. package/node_modules/pi-agent-doctor/runtime/entry-20.js +0 -1
  426. package/node_modules/pi-agent-doctor/runtime/entry-21.js +0 -1
  427. package/node_modules/pi-agent-filesystem/runtime/entry-26.js +0 -2
  428. package/node_modules/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
  429. package/node_modules/pi-agent-filesystem-jq/runtime/entry-28.js +0 -2
  430. package/node_modules/pi-agent-ide-ast/runtime/entry-31.js +0 -1
  431. package/node_modules/pi-agent-ide-changes/runtime/entry-33.js +0 -1
  432. package/node_modules/pi-agent-ide-changes/runtime/entry-34.js +0 -2
  433. package/node_modules/pi-agent-ide-languages/runtime/entry-36.js +0 -2
  434. package/node_modules/pi-agent-image/runtime/entry-39.js +0 -1
  435. package/node_modules/pi-agent-invariant/runtime/entry-40.js +0 -1
  436. package/node_modules/pi-agent-pdf/runtime/entry-41.js +0 -1
  437. package/node_modules/pi-agent-search/runtime/entry-49.js +0 -1
  438. package/node_modules/pi-agent-search-text/runtime/entry-52.js +0 -2
  439. package/node_modules/pi-agent-search-text/runtime/entry-54.js +0 -1
  440. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-57.js +0 -2
  441. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -2
  442. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
  443. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-61.js +0 -2
  444. package/node_modules/pi-agent-text-editor/runtime/entry-62.js +0 -1
  445. package/node_modules/pi-agent-text-editor/runtime/entry-64.js +0 -1
  446. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
  447. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
  448. package/node_modules/pi-agent-tool-call-interception/runtime/entry-81.js +0 -1
  449. package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +0 -1
  450. package/node_modules/pi-agent-web-html/runtime/entry-84.js +0 -2
  451. package/node_modules/pi-agent-web-image/runtime/entry-85.js +0 -2
  452. package/node_modules/pi-agent-web-pdf/runtime/entry-86.js +0 -2
  453. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
  454. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-28.js +0 -2
  455. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-29.js +0 -2
  456. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-26.js +0 -2
  457. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-84.js +0 -2
  458. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-85.js +0 -2
  459. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-86.js +0 -2
  460. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +0 -2
  461. package/src/extensions/pi-agent-read/runtime/entry-42.js +0 -1
  462. package/src/extensions/pi-agent-read/runtime/entry-43.js +0 -1
  463. package/src/extensions/pi-agent-read/runtime/entry-44.js +0 -1
  464. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-52.js +0 -2
  465. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +0 -1
  466. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-54.js +0 -1
  467. package/src/extensions/pi-agent-search/runtime/entry-49.js +0 -1
  468. package/src/extensions/pi-agent-search/runtime/entry-50.js +0 -1
  469. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-57.js +0 -2
  470. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -2
  471. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
  472. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-61.js +0 -2
  473. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
  474. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
  475. package/src/extensions/pi-agent-text-editor/runtime/entry-62.js +0 -1
  476. package/src/extensions/pi-agent-text-editor/runtime/entry-63.js +0 -1
  477. package/src/extensions/pi-agent-text-editor/runtime/entry-64.js +0 -1
  478. package/src/plugins/pi-agent-ide-ast/runtime/entry-31.js +0 -1
  479. package/src/plugins/pi-agent-ide-ast/runtime/entry-32.js +0 -2
  480. package/src/plugins/pi-agent-ide-changes/runtime/entry-33.js +0 -1
  481. package/src/plugins/pi-agent-ide-changes/runtime/entry-34.js +0 -2
  482. package/src/plugins/pi-agent-ide-languages/runtime/entry-36.js +0 -2
  483. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-25.js +0 -0
  484. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem}/runtime/entry-29.js +0 -0
  485. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
  486. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-pdf}/runtime/entry-32.js +0 -0
  487. /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
  488. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
  489. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
  490. /package/node_modules/{pi-agent-read → pi-agent-image}/runtime/entry-42.js +0 -0
  491. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-43.js +0 -0
  492. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-44.js +0 -0
  493. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-47.js +0 -0
  494. /package/node_modules/{pi-agent-search → pi-agent-read}/runtime/entry-48.js +0 -0
  495. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-50.js +0 -0
  496. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-53.js +0 -0
  497. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-56.js +0 -0
  498. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-search-text}/runtime/entry-58.js +0 -0
  499. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-63.js +0 -0
  500. /package/node_modules/{pi-agent-web → pi-agent-text-editor-stale-anchor}/runtime/entry-83.js +0 -0
  501. /package/node_modules/{pi-agent-web-text → pi-agent-web}/runtime/entry-87.js +0 -0
  502. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
  503. /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-48.js +0 -0
  504. /package/src/extensions/{pi-agent-text-editor/plugins/pi-agent-text-anchor-exact → pi-agent-search/plugins/pi-agent-search-text}/runtime/entry-58.js +0 -0
  505. /package/src/extensions/{pi-agent-read/extensions/pi-agent-web → pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor}/runtime/entry-83.js +0 -0
  506. /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
  507. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
  508. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
@@ -14,6 +14,7 @@ import type {
14
14
  import {
15
15
  type AgentToolResult,
16
16
  defineTool,
17
+ type ExtensionAPI,
17
18
  type ExtensionContext,
18
19
  type ToolDefinition,
19
20
  } from "@earendil-works/pi-coding-agent";
@@ -94,12 +95,14 @@ import { writeAgentResult } from "./write-agent-result.js";
94
95
  import { mutationResultSchema, structuredMutation } from "./structured-result.js";
95
96
  import type { ResultTargetStore } from "pi-agent-resource";
96
97
 
98
+ /** Build a mutation tool; host events report terminal filesystem approvals to Herdr. */
97
99
  export function createTextTool<TParameters extends TSchema>(
98
100
  core: TextEditorCore,
99
101
  definition: TextMutationToolRegistration<TParameters>,
100
102
  annotations: ToolCallInterceptionRenderStore,
101
103
  getLastResolvedSource: () => string | undefined,
102
104
  resultTargets?: ResultTargetStore,
105
+ events?: Pick<ExtensionAPI["events"], "emit">,
103
106
  ): ToolDefinition<TParameters, FileMutationBatchResult> {
104
107
  const renderer = core.getToolRenderer(definition.name);
105
108
  const initialRenderCall = renderer?.renderCall;
@@ -301,7 +304,13 @@ export function createTextTool<TParameters extends TSchema>(
301
304
  content: [{ type: "text", text: action.summary }],
302
305
  details: {
303
306
  results: [],
304
- metadata: { semanticAction: { ...action.data, source: action.source } },
307
+ metadata: {
308
+ semanticAction: {
309
+ ...action.data,
310
+ source: action.source,
311
+ ...(action.script !== undefined && { script: action.script }),
312
+ },
313
+ },
305
314
  },
306
315
  };
307
316
  } catch (error) {
@@ -332,6 +341,7 @@ export function createTextTool<TParameters extends TSchema>(
332
341
  signal,
333
342
  context,
334
343
  verifyFileSource,
344
+ events,
335
345
  );
336
346
  }
337
347
  const directExecute = () =>
@@ -347,15 +357,9 @@ export function createTextTool<TParameters extends TSchema>(
347
357
  }),
348
358
  getLastResolvedSource(),
349
359
  );
350
- return executeTextToolWithBatch(
351
- toolCallId,
352
- directExecute,
353
- signal,
354
- onUpdate,
355
- context,
356
- );
360
+ return directExecute();
357
361
  };
358
- return execute();
362
+ return executeTextToolWithBatch(toolCallId, execute, signal, onUpdate, context);
359
363
  }),
360
364
  definition.name === "write",
361
365
  );
@@ -366,6 +370,7 @@ export function createTextTool<TParameters extends TSchema>(
366
370
  errorMessage(captured.error),
367
371
  "unknown",
368
372
  undefined,
373
+ undefined,
369
374
  definition.name === "copy",
370
375
  );
371
376
  return structuredMutation(
@@ -1498,7 +1503,14 @@ async function buildToolResult(
1498
1503
  const message = `${reason.replace(/[.!?]+$/u, "")}.${completed}`;
1499
1504
  return safe === undefined
1500
1505
  ? buildFailedTextMutationResult(core, { ...outcome.failure, message }, context, effect)
1501
- : failureToolResult(source, safe.code, message, effect, outcome.failure.rollback);
1506
+ : failureToolResult(
1507
+ source,
1508
+ safe.code,
1509
+ message,
1510
+ effect,
1511
+ outcome.failure.rollback,
1512
+ outcome.failure.code,
1513
+ );
1502
1514
  }
1503
1515
 
1504
1516
  const mutation = outcome.result as ExecutedTextMutation;
@@ -1511,6 +1523,9 @@ async function buildToolResult(
1511
1523
  semanticAction: {
1512
1524
  ...mutation.semanticAction.data,
1513
1525
  source: mutation.semanticAction.source,
1526
+ ...(mutation.semanticAction.script !== undefined && {
1527
+ script: mutation.semanticAction.script,
1528
+ }),
1514
1529
  },
1515
1530
  },
1516
1531
  },
@@ -1701,9 +1716,14 @@ async function anchorFailureToolResult(
1701
1716
  results: [result],
1702
1717
  effect: "not-applied",
1703
1718
  anchorRecovery: true,
1704
- ...(resolution.resolverId === "exact-text" && {
1705
- metadata: { exactTextFailures: [contextual.source] },
1706
- }),
1719
+ // A Copy destination failure must not block otherwise valid source selectors.
1720
+ ...(resolution.resolverId === "exact-text" &&
1721
+ !(
1722
+ contextual.toolName === "copy" &&
1723
+ (contextual.field === "targetStart" || contextual.field === "targetEnd")
1724
+ ) && {
1725
+ metadata: { exactTextFailures: [contextual.source] },
1726
+ }),
1707
1727
  ...(recovery?.kind === "candidates" && {
1708
1728
  anchorRecoveries: [
1709
1729
  {
@@ -1841,6 +1861,7 @@ function failureToolResult(
1841
1861
  reason: string,
1842
1862
  effect: "not-applied" | "applied" | "unknown",
1843
1863
  rollback?: TextResourceEditFailure["rollback"],
1864
+ stage?: string,
1844
1865
  copyExecutionFailure = false,
1845
1866
  ): { content: [{ type: "text"; text: string }]; details: FileMutationBatchResult } {
1846
1867
  const uncertain =
@@ -1868,7 +1889,7 @@ function failureToolResult(
1868
1889
  const result = new FileMutationResult({
1869
1890
  ok: false,
1870
1891
  path: source,
1871
- errors: [{ path: source, code, reason }],
1892
+ errors: [{ path: source, code, reason, ...(stage === undefined ? {} : { stage }) }],
1872
1893
  ...(fileChangedStatement === undefined
1873
1894
  ? {}
1874
1895
  : {
@@ -3,7 +3,7 @@ Runtime for intercepting streamed Pi tool calls.
3
3
  */
4
4
 
5
5
  import { Allow } from "partial-json";
6
- import { resultError, withStructuredResult } from "pi-agent-resource";
6
+ import { assertJsonData, resultError, withStructuredResult } from "pi-agent-resource";
7
7
  import { mutationDataSchema } from "#src/core/structured-result.js";
8
8
  import {
9
9
  isToolCallAnnotation,
@@ -328,6 +328,27 @@ class InterceptorImpl implements ToolCallInterceptor {
328
328
  await this.finalizeRecovery();
329
329
  this.annotateIncompleteCalls();
330
330
 
331
+ if (event.message.role === "toolResult") {
332
+ const record = this.toolCallRecords.get(event.message.toolCallId);
333
+ const guardResult = record?.blockExecution ? record.guardResult : undefined;
334
+ if (guardResult) {
335
+ // Schema validation can finish before tool_call/tool_result for an aborted prefix.
336
+ // Keep the saved guard outcome; never make the incomplete call executable.
337
+ this.toolCallRecords.delete(event.message.toolCallId);
338
+ const details = guardResult.details;
339
+ if (details !== undefined) assertJsonData(details);
340
+ const batchEntryIndex = this.toolCallBatchEntryIndexes.get(event.message.toolCallId);
341
+ if (batchEntryIndex !== undefined) this.completedBatchEntryIndexes.add(batchEntryIndex);
342
+ return {
343
+ message: {
344
+ ...event.message,
345
+ content: guardResult.content,
346
+ ...(details !== undefined && { details }),
347
+ isError: true,
348
+ },
349
+ };
350
+ }
351
+ }
331
352
  if (event.message.role !== "assistant") {
332
353
  return;
333
354
  }
@@ -8,6 +8,7 @@ import {
8
8
  createAssistantMessageEventStream,
9
9
  type Model,
10
10
  type SimpleStreamOptions,
11
+ type Provider,
11
12
  } from "@earendil-works/pi-ai";
12
13
 
13
14
  import type { GuardInterception } from "./coordinator.js";
@@ -39,7 +40,7 @@ interface StreamingSubscriber {
39
40
 
40
41
  interface SharedProviderState {
41
42
  api: string;
42
- readonly delegate: StreamSimple;
43
+ readonly originalStreamSimple: StreamSimple;
43
44
  readonly wrapper: WrappedStreamSimple;
44
45
  readonly subscribers: Set<StreamingSubscriber>;
45
46
  }
@@ -50,7 +51,7 @@ type WrappedStreamSimple = StreamSimple & { [streamingInterceptorState]?: Shared
50
51
  Install one shared stream wrapper for all interceptors using each active provider.
51
52
  */
52
53
  export function registerStreamingInterceptorProvider(
53
- pi: ExtensionAPI,
54
+ pi: Pick<ExtensionAPI, "on" | "registerProvider" | "unregisterProvider">,
54
55
  processStreamEvent: ProcessStreamEvent,
55
56
  markStreamEventProcessed: MarkStreamEventProcessed,
56
57
  finalizeStreamInterception: FinalizeStreamInterception,
@@ -64,52 +65,36 @@ export function registerStreamingInterceptorProvider(
64
65
  };
65
66
 
66
67
  const install = (model: Model<Api> | undefined, context: ExtensionContext): void => {
67
- if (!model) {
68
- return;
69
- }
70
-
68
+ if (!model) return;
71
69
  const provider = context.modelRegistry.getProvider(model.provider);
72
-
73
- if (!provider) {
74
- return;
75
- }
76
-
70
+ if (!provider) return;
71
+
72
+ const register = (wrapper: WrappedStreamSimple): void => {
73
+ const native = context.modelRegistry.getRegisteredNativeProvider(model.provider);
74
+ if (native) {
75
+ // Registering by name removes native authentication and discovery in Pi.
76
+ pi.registerProvider(withStreamSimple(native, wrapper));
77
+ } else {
78
+ const config = context.modelRegistry.getRegisteredProviderConfig(model.provider);
79
+ pi.registerProvider(model.provider, { ...config, api: model.api, streamSimple: wrapper });
80
+ }
81
+ };
77
82
  const active = installed.get(model.provider);
78
-
79
83
  if (active) {
80
84
  active.subscribers.add(subscriber);
81
-
82
- if (active.api === model.api && provider.streamSimple === active.wrapper) {
83
- return;
84
- }
85
-
85
+ if (active.api === model.api && provider.streamSimple === active.wrapper) return;
86
86
  active.api = model.api;
87
- const config = context.modelRegistry.getRegisteredProviderConfig(model.provider);
88
- pi.registerProvider(model.provider, {
89
- ...config,
90
- api: model.api,
91
- streamSimple: active.wrapper,
92
- });
87
+ register(active.wrapper);
93
88
  return;
94
89
  }
95
90
 
96
91
  const shared = (provider.streamSimple as WrappedStreamSimple)[streamingInterceptorState];
97
-
98
92
  if (shared) {
99
93
  shared.subscribers.add(subscriber);
100
94
  installed.set(model.provider, shared);
101
-
102
- if (shared.api === model.api) {
103
- return;
104
- }
105
-
95
+ if (shared.api === model.api) return;
106
96
  shared.api = model.api;
107
- const config = context.modelRegistry.getRegisteredProviderConfig(model.provider);
108
- pi.registerProvider(model.provider, {
109
- ...config,
110
- api: model.api,
111
- streamSimple: shared.wrapper,
112
- });
97
+ register(shared.wrapper);
113
98
  return;
114
99
  }
115
100
 
@@ -119,18 +104,12 @@ export function registerStreamingInterceptorProvider(
119
104
  wrapStream(delegate, currentModel, context, options, subscribers);
120
105
  const state: SharedProviderState = {
121
106
  api: model.api,
122
- delegate,
107
+ originalStreamSimple: provider.streamSimple,
123
108
  wrapper,
124
109
  subscribers,
125
110
  };
126
111
  wrapper[streamingInterceptorState] = state;
127
- const config = context.modelRegistry.getRegisteredProviderConfig(model.provider);
128
-
129
- pi.registerProvider(model.provider, {
130
- ...config,
131
- api: model.api,
132
- streamSimple: wrapper,
133
- });
112
+ register(wrapper);
134
113
  installed.set(model.provider, state);
135
114
  };
136
115
 
@@ -162,7 +141,15 @@ export function registerStreamingInterceptorProvider(
162
141
  for (const [provider, state] of installed) {
163
142
  state.subscribers.delete(subscriber);
164
143
 
165
- if (state.subscribers.size === 0) {
144
+ if (state.subscribers.size !== 0) continue;
145
+ const registry = subscriber.context?.modelRegistry;
146
+ const current = registry?.getProvider(provider);
147
+ if (current?.streamSimple !== state.wrapper) continue;
148
+ const native = registry?.getRegisteredNativeProvider(provider);
149
+ if (native) {
150
+ // Restore only our stream hook, retaining later auth/catalog updates.
151
+ pi.registerProvider(withStreamSimple(native, state.originalStreamSimple));
152
+ } else {
166
153
  pi.unregisterProvider(provider);
167
154
  }
168
155
  }
@@ -172,6 +159,14 @@ export function registerStreamingInterceptorProvider(
172
159
  });
173
160
  }
174
161
 
162
+ /** Preserve prototype methods and non-enumerable native provider fields. */
163
+ function withStreamSimple(provider: Provider, streamSimple: StreamSimple): Provider {
164
+ return Object.create(Object.getPrototypeOf(provider) as object | null, {
165
+ ...Object.getOwnPropertyDescriptors(provider),
166
+ streamSimple: { value: streamSimple, writable: true, enumerable: true, configurable: true },
167
+ }) as Provider;
168
+ }
169
+
175
170
  function wrapStream(
176
171
  delegate: StreamSimple,
177
172
  model: Model<Api>,
@@ -36,8 +36,10 @@ export function writeAgentResult(
36
36
  completions: readonly TextEditCompletion[],
37
37
  requestedPath: unknown,
38
38
  ): AgentToolResult<FileMutationBatchResult> {
39
- // Terminal input and other live resources keep their own action receipts.
39
+ // Semantic providers own their action receipts and need not emit file completions.
40
+ // Terminal input and other live resources also keep their own action receipts.
40
41
  if (
42
+ result.details.metadata?.semanticAction !== undefined ||
41
43
  (typeof requestedPath === "string" && requestedPath.startsWith("shell:")) ||
42
44
  completions.some((completion) => completion.resolvedBy !== "filesystem")
43
45
  )
@@ -3,7 +3,7 @@ import { resultInputSchema } from "pi-agent-resource";
3
3
 
4
4
  /** Build a structured source selector without changing legacy path semantics. */
5
5
  export function resultSourceProperty(description: string) {
6
- return Type.Optional({ ...resultInputSchema, description });
6
+ return Type.Optional(Type.Union(resultInputSchema.anyOf, { description }));
7
7
  }
8
8
 
9
9
  /** Build the source selector shared by text mutation schemas. */
@@ -15,11 +15,12 @@ import type { TextMutationToolRegistration } from "#src/api/mutation-tool.js";
15
15
 
16
16
  export const replaceSchema = Type.Object(
17
17
  {
18
- path: Type.Optional({
19
- ...resultInputSchema,
20
- description:
21
- "Source path, SEARCH# selector, unchanged Read/Search/Select/edit result, its UUID, or an array of such results. Omit start/end when the result selects the intended text. Changed or expired results are rejected without writing.",
22
- }),
18
+ path: Type.Optional(
19
+ Type.Union(resultInputSchema.anyOf, {
20
+ description:
21
+ "Source path, SEARCH# selector, unchanged Read/Search/Select/edit result, its UUID, or an array of such results. Omit start/end when the result selects the intended text. Changed or expired results are rejected without writing.",
22
+ }),
23
+ ),
23
24
  ...sourceRangeProperties(),
24
25
  text: Type.String({
25
26
  description:
@@ -1,21 +1,19 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor-renderer",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "diff": "^9.0.0",
10
- "pi-agent-invariant": "0.8.0",
11
- "pi-agent-text-editor": "0.8.0",
12
- "pi-agent-tool-call-interception": "0.8.0",
13
- "pi-agent-tool-ui": "0.8.0",
14
- "vscode-diff": "3.0.1"
9
+ "pi-agent-invariant": "0.8.2",
10
+ "pi-agent-text-editor": "0.8.2",
11
+ "pi-agent-tool-call-interception": "0.8.2",
12
+ "pi-agent-tool-ui": "0.8.2"
15
13
  },
16
14
  "pi": {
17
15
  "extensions": [
18
- "./runtime/entry-79.js"
16
+ "./runtime/entry-82.js"
19
17
  ]
20
18
  },
21
19
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-82.js";
2
+ export { default } from "../../../dist/entry-82.js";
@@ -931,7 +931,7 @@ function wholeFileOperationSummary(details: unknown):
931
931
  typeof error.code === "string"
932
932
  ? error.code
933
933
  : undefined;
934
- cause = code === undefined ? "file operation failed" : wholeFileFailureCause(code);
934
+ cause = code === undefined ? GENERIC_FAILURE_CAUSE : wholeFileFailureCause(code);
935
935
  }
936
936
  const label =
937
937
  effect === "unknown"
@@ -951,8 +951,19 @@ function wholeFileOperationSummary(details: unknown):
951
951
  };
952
952
  }
953
953
 
954
+ const GENERIC_FAILURE_CAUSE = "file operation failed";
955
+
954
956
  function wholeFileFailureCause(code: string): string {
955
957
  switch (code) {
958
+ case "RESULT_INPUT_REJECTED": {
959
+ return "result input was rejected";
960
+ }
961
+ case "WRITE_FAILED": {
962
+ return "resource write failed";
963
+ }
964
+ case "POST_WRITE_FAILED": {
965
+ return "post-write processing failed";
966
+ }
956
967
  case "APPLY_UNDO_OWNER_CHANGED": {
957
968
  return "resource owner changed";
958
969
  }
@@ -994,7 +1005,7 @@ function wholeFileFailureCause(code: string): string {
994
1005
  return "operation was canceled";
995
1006
  }
996
1007
  default: {
997
- return "file operation failed";
1008
+ return GENERIC_FAILURE_CAUSE;
998
1009
  }
999
1010
  }
1000
1011
  }
@@ -1002,6 +1013,28 @@ function wholeFileFailureCause(code: string): string {
1002
1013
  function userFacingFailure(
1003
1014
  agentOutput: string,
1004
1015
  details: FileMutationBatchResult | undefined,
1016
+ ): string {
1017
+ const causes = new Set(
1018
+ details?.results?.flatMap((result) =>
1019
+ // Provider reasons can contain private data; decode only public editor failure codes.
1020
+ (result.data.errors ?? []).map((error) => {
1021
+ const cause = wholeFileFailureCause(error.code ?? "");
1022
+ // A provider's own code still names the editor step that failed.
1023
+ return cause === GENERIC_FAILURE_CAUSE && error.stage !== undefined
1024
+ ? wholeFileFailureCause(error.stage)
1025
+ : cause;
1026
+ }),
1027
+ ),
1028
+ );
1029
+ return [
1030
+ mutationFailureSummary(agentOutput, details),
1031
+ ...[...causes].map((cause) => `Reason: ${cause}`),
1032
+ ...(details?.effect === "unknown" ? ["Read the affected resource before retrying."] : []),
1033
+ ].join("\n");
1034
+ }
1035
+ function mutationFailureSummary(
1036
+ agentOutput: string,
1037
+ details: FileMutationBatchResult | undefined,
1005
1038
  ): string {
1006
1039
  const rollbacks =
1007
1040
  details?.results?.flatMap((result) => (result.data.rollback ? [result.data.rollback] : [])) ??
@@ -1,4 +1,5 @@
1
1
  import { requiredValue } from "pi-agent-invariant";
2
+ import { connectResultTargets } from "pi-agent-resource";
2
3
  import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
3
4
  import {
4
5
  READ_API_VERSION,
@@ -73,6 +74,7 @@ function createHandler(
73
74
  readonly handler: ToolCallInterceptorHandler;
74
75
  readonly add: (registration: TextMutationToolRegistration) => void;
75
76
  } {
77
+ const resultTargets = connectResultTargets(pi);
76
78
  const schemas = new Map<string, TextMutationToolRegistration>();
77
79
  const toolNames: string[] = [];
78
80
  const knownPaths = new Map<number, string>();
@@ -91,6 +93,21 @@ function createHandler(
91
93
  }
92
94
 
93
95
  const arguments_ = context.partialArgs ?? context.args;
96
+ // Issued selections belong to the result-input pipeline, not filename anchor inspection.
97
+ // This also leaves unsupported selector combinations and expired IDs to their owner.
98
+ try {
99
+ for (const field of [
100
+ schema.source.field,
101
+ ...(schema.source.targets ?? []).map((target) => target.field),
102
+ ]) {
103
+ const original = arguments_[field];
104
+ const source = resultTargets.source(original, context.cwd);
105
+ if (source !== original || (typeof source === "string" && source.startsWith("RESULT#")))
106
+ return;
107
+ }
108
+ } catch {
109
+ return;
110
+ }
94
111
  const source = resolveSource(
95
112
  arguments_,
96
113
  context,
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor-stale-anchor",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-invariant": "0.8.0",
7
- "pi-agent-read": "0.8.0",
8
- "pi-agent-text-editor": "0.8.0"
6
+ "pi-agent-invariant": "0.8.2",
7
+ "pi-agent-read": "0.8.2",
8
+ "pi-agent-resource": "0.8.2",
9
+ "pi-agent-text-editor": "0.8.2"
9
10
  },
10
11
  "pi": {
11
12
  "extensions": [
12
- "./runtime/entry-80.js"
13
+ "./runtime/entry-83.js"
13
14
  ]
14
15
  },
15
16
  "peerDependencies": {
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "pi-agent-tool-call-interception",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./src/index.ts",
9
- "default": "./runtime/entry-81.js"
9
+ "default": "./runtime/entry-84.js"
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "pi-agent-tool-ui": "0.8.0"
13
+ "pi-agent-tool-ui": "0.8.2"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@earendil-works/pi-coding-agent": "*",
@@ -0,0 +1 @@
1
+ export * from "../../../dist/entry-84.js";
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "pi-agent-tool-ui",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "exports": {
6
+ "./operation-approval": {
7
+ "types": "./src/operation-approval.ts",
8
+ "default": "./runtime/entry-85.js"
9
+ },
6
10
  ".": {
7
11
  "types": "./src/index.ts",
8
- "default": "./runtime/entry-82.js"
12
+ "default": "./runtime/entry-86.js"
9
13
  }
10
14
  },
11
15
  "peerDependencies": {
@@ -0,0 +1 @@
1
+ export * from "../../../dist/entry-85.js";
@@ -0,0 +1 @@
1
+ export * from "../../../dist/entry-86.js";