pi-agent-ide 0.7.0 → 0.7.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 (323) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/chunk-6U5OU77O.js +3 -0
  3. package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
  4. package/dist/chunk-EURHXLN3.js +2 -0
  5. package/dist/{chunk-PYPPV2F5.js → chunk-F6IWZKOG.js} +6 -6
  6. package/dist/{chunk-GBLKIB6O.js → chunk-H445SHSJ.js} +2 -2
  7. package/dist/chunk-IG56UGSO.js +2 -0
  8. package/dist/chunk-IICJXZBU.js +6 -0
  9. package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
  10. package/dist/{chunk-YRF7OATP.js → chunk-KOVPDKSJ.js} +1 -1
  11. package/dist/chunk-MXLSGMRZ.js +3 -0
  12. package/dist/chunk-NRZO5KJT.js +9 -0
  13. package/dist/chunk-OB46OPMZ.js +1 -0
  14. package/dist/chunk-PKSQT6TC.js +1 -0
  15. package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
  16. package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
  17. package/dist/chunk-QUYXINGZ.js +7 -0
  18. package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
  19. package/dist/chunk-SBP3ABH4.js +5 -0
  20. package/dist/{chunk-FXNKMNSJ.js → chunk-SJ4UZ4GU.js} +1 -1
  21. package/dist/chunk-SNF7PDDX.js +11 -0
  22. package/dist/{chunk-AJRIASPQ.js → chunk-STBJO3Z3.js} +1 -1
  23. package/dist/{chunk-3HYXQ4YA.js → chunk-TQGE7RH6.js} +13 -13
  24. package/dist/{chunk-S5LXX32D.js → chunk-XDG7EQRN.js} +3 -3
  25. package/dist/{chunk-F5YZG77W.js → chunk-XH5WN5XA.js} +1 -1
  26. package/dist/chunk-YWQS33DF.js +1 -0
  27. package/dist/chunk-ZIWPKIBZ.js +1 -0
  28. package/dist/entry-11.js +1 -1
  29. package/dist/entry-13.js +1 -1
  30. package/dist/entry-14.js +1 -1
  31. package/dist/entry-15.js +1 -1
  32. package/dist/entry-17.js +1 -1
  33. package/dist/entry-25.js +2 -2
  34. package/dist/entry-26.js +1 -1
  35. package/dist/entry-27.js +2 -2
  36. package/dist/entry-28.js +1 -1
  37. package/dist/entry-29.js +1 -1
  38. package/dist/entry-31.js +15 -13
  39. package/dist/entry-33.js +2 -1
  40. package/dist/entry-37.js +6 -6
  41. package/dist/entry-41.js +1 -1
  42. package/dist/entry-42.js +1 -1
  43. package/dist/entry-43.js +1 -1
  44. package/dist/entry-44.js +1 -1
  45. package/dist/entry-45.js +20 -13
  46. package/dist/entry-46.js +1 -1
  47. package/dist/entry-49.js +1 -1
  48. package/dist/entry-50.js +1 -1
  49. package/dist/entry-51.js +8 -7
  50. package/dist/entry-52.js +1 -1
  51. package/dist/entry-53.js +1 -1
  52. package/dist/entry-54.js +1 -1
  53. package/dist/entry-56.js +1 -1
  54. package/dist/entry-57.js +1 -1
  55. package/dist/entry-58.js +1 -1
  56. package/dist/entry-60.js +1 -1
  57. package/dist/entry-62.js +1 -1
  58. package/dist/entry-65.js +1 -1
  59. package/dist/entry-66.js +1 -1
  60. package/dist/entry-68.js +1 -1
  61. package/dist/entry-70.js +1 -1
  62. package/dist/entry-75.js +1 -1
  63. package/dist/entry-77.js +51 -43
  64. package/dist/entry-78.js +14 -14
  65. package/dist/entry-79.js +1 -1
  66. package/dist/entry-80.js +1 -1
  67. package/dist/entry-82.js +5 -5
  68. package/dist/entry-83.js +1 -1
  69. package/dist/entry-84.js +1 -1
  70. package/dist/entry-85.js +1 -1
  71. package/dist/entry-86.js +1 -1
  72. package/dist/pi-agent-ide.js +37 -9
  73. package/docs/agent-guides/editing.md +35 -46
  74. package/docs/agent-guides/git-changes.md +10 -0
  75. package/docs/agent-guides/read-resources.md +9 -50
  76. package/docs/agent-guides/search-code.md +18 -17
  77. package/docs/agent-guides/select-code.md +62 -140
  78. package/docs/agent-guides/terminal.md +9 -1
  79. package/docs/configuration.md +1 -1
  80. package/docs/releases.md +4 -0
  81. package/docs/research/native-codemode-batch-decision.md +2 -0
  82. package/docs/structured-results.md +27 -62
  83. package/docs/tools.md +15 -11
  84. package/node_modules/pi-agent-doctor/package.json +1 -1
  85. package/node_modules/pi-agent-documentation/package.json +1 -1
  86. package/node_modules/pi-agent-filesystem/index.ts +7 -6
  87. package/node_modules/pi-agent-filesystem/package.json +7 -7
  88. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  89. package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
  90. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  91. package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
  92. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  93. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  94. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  95. package/node_modules/pi-agent-ide-ast/src/extension.ts +5 -4
  96. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  97. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +35 -9
  98. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +1 -1
  99. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +10 -8
  100. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +28 -3
  101. package/node_modules/pi-agent-ide-changes/index.ts +4 -3
  102. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  103. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  104. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  105. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  106. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  107. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  108. package/node_modules/pi-agent-ide-lsp/index.ts +3 -3
  109. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  110. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
  111. package/node_modules/pi-agent-image/package.json +2 -2
  112. package/node_modules/pi-agent-invariant/package.json +1 -1
  113. package/node_modules/pi-agent-pdf/package.json +2 -2
  114. package/node_modules/pi-agent-read/package.json +7 -7
  115. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  116. package/node_modules/pi-agent-read/src/api/read-parameters.ts +38 -1
  117. package/node_modules/pi-agent-read/src/api/tools/read.ts +18 -1
  118. package/node_modules/pi-agent-read/src/core/extension.ts +8 -2
  119. package/node_modules/pi-agent-read/src/core/read-core.ts +54 -35
  120. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  121. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  122. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  123. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  124. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
  125. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +108 -46
  126. package/node_modules/pi-agent-resource/package.json +1 -1
  127. package/node_modules/pi-agent-resource/src/index.ts +1 -0
  128. package/node_modules/pi-agent-resource/src/result-targets.ts +186 -9
  129. package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
  130. package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
  131. package/node_modules/pi-agent-search/package.json +5 -5
  132. package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
  133. package/node_modules/pi-agent-search/src/api/search-parameters.ts +3 -3
  134. package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
  135. package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
  136. package/node_modules/pi-agent-search-text/index.ts +1 -1
  137. package/node_modules/pi-agent-search-text/package.json +7 -7
  138. package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
  139. package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
  140. package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
  141. package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
  142. package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
  143. package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
  144. package/node_modules/pi-agent-text/package.json +2 -2
  145. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  146. package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
  147. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  148. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
  149. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
  150. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  151. package/node_modules/pi-agent-text-editor/package.json +9 -9
  152. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  153. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
  154. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  155. package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  156. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  157. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  158. package/node_modules/pi-agent-text-editor/src/core/extension.ts +10 -3
  159. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +3 -13
  160. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  161. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  162. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  163. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
  164. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  165. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
  166. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  167. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +49 -214
  168. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  169. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  170. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  171. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  172. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
  173. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
  174. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
  175. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
  176. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  177. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  178. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
  179. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  180. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  181. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  182. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  183. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  184. package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  185. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
  186. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  187. package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
  188. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  189. package/node_modules/pi-agent-web/index.ts +4 -3
  190. package/node_modules/pi-agent-web/package.json +7 -7
  191. package/node_modules/pi-agent-web/src/resolver.ts +11 -13
  192. package/node_modules/pi-agent-web-html/package.json +2 -2
  193. package/node_modules/pi-agent-web-image/package.json +3 -3
  194. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  195. package/node_modules/pi-agent-web-text/package.json +3 -3
  196. package/package.json +35 -35
  197. package/src/composite/nested-tool-rendering.ts +64 -6
  198. package/src/composite/output-limits.ts +125 -0
  199. package/src/composite/responses-tools.ts +25 -0
  200. package/src/composite/text-results.ts +372 -0
  201. package/src/documentation/extension.ts +11 -9
  202. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
  203. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  204. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  205. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
  206. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  207. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
  208. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  209. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  210. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +4 -3
  211. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  212. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  213. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  214. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  215. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  216. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
  217. package/src/extensions/pi-agent-read/package.json +7 -7
  218. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  219. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +38 -1
  220. package/src/extensions/pi-agent-read/src/api/tools/read.ts +18 -1
  221. package/src/extensions/pi-agent-read/src/core/extension.ts +8 -2
  222. package/src/extensions/pi-agent-read/src/core/read-core.ts +54 -35
  223. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  224. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  225. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  226. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  227. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
  228. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +108 -46
  229. package/src/extensions/pi-agent-search/package.json +5 -5
  230. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
  231. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
  232. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
  233. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
  234. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
  235. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
  236. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
  237. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
  238. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
  239. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +3 -3
  240. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
  241. package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
  242. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  243. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  244. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
  245. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  246. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
  247. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
  248. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  249. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  250. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  251. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  252. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  253. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
  254. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  255. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
  256. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  257. package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  258. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  259. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  260. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +10 -3
  261. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +3 -13
  262. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  263. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  264. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  265. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
  266. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  267. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
  268. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  269. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +49 -214
  270. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  271. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  272. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  273. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  274. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
  275. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
  276. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
  277. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
  278. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  279. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  280. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
  281. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  282. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  283. package/src/pi-agent-ide.ts +15 -1
  284. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  285. package/src/plugins/pi-agent-ide-ast/src/extension.ts +5 -4
  286. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  287. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +35 -9
  288. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +1 -1
  289. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +10 -8
  290. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +28 -3
  291. package/src/plugins/pi-agent-ide-changes/index.ts +4 -3
  292. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  293. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  294. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  295. package/src/plugins/pi-agent-ide-debugger/index.ts +22 -10
  296. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
  297. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
  298. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +6 -3
  299. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  300. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  301. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  302. package/src/plugins/pi-agent-ide-lsp/index.ts +3 -3
  303. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  304. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
  305. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
  306. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
  307. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
  308. package/src/plugins/pi-agent-ide-vision/index.ts +13 -4
  309. package/src/post-edit/gate.ts +13 -2
  310. package/dist/chunk-3JO7QFIL.js +0 -1
  311. package/dist/chunk-4NIFBFFR.js +0 -11
  312. package/dist/chunk-64M3SQPG.js +0 -3
  313. package/dist/chunk-7LZKOHH2.js +0 -1
  314. package/dist/chunk-EAZGN5ND.js +0 -7
  315. package/dist/chunk-FK42RSF4.js +0 -1
  316. package/dist/chunk-KBP3QUDT.js +0 -2
  317. package/dist/chunk-KR36BT5E.js +0 -1
  318. package/dist/chunk-MBUXFKIW.js +0 -3
  319. package/dist/chunk-OE7QVAI2.js +0 -5
  320. package/dist/chunk-SILJ3OL4.js +0 -9
  321. package/dist/chunk-SQKAXYIR.js +0 -2
  322. package/dist/chunk-VCGNVTXQ.js +0 -1
  323. package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
@@ -23,7 +23,7 @@ export interface SearchPresentation {
23
23
  readonly files: readonly SearchPresentationFile[];
24
24
  }
25
25
 
26
- /** Selects bounded search details while preserving complete low-volume files. */
26
+ /** Shares one item budget between complete small files, compact summaries and groups. */
27
27
  export function planSearchPresentation(
28
28
  matches: readonly TextSearchMatch[],
29
29
  detailBudget: number,
@@ -36,45 +36,55 @@ export function planSearchPresentation(
36
36
  }
37
37
 
38
38
  const compacted = new Set<string>();
39
- let detailedCount = matches.length;
39
+ let itemCount = matches.length;
40
40
  const noisiestFirst = [...bySource].sort(
41
41
  ([leftSource, left], [rightSource, right]) =>
42
42
  right.length - left.length || leftSource.localeCompare(rightSource),
43
43
  );
44
44
  for (const [source, sourceMatches] of noisiestFirst) {
45
- if (detailedCount <= detailBudget) break;
45
+ if (itemCount <= detailBudget) break;
46
46
  compacted.add(source);
47
- detailedCount -= sourceMatches.length;
47
+ itemCount -= sourceMatches.length - 1;
48
48
  }
49
49
 
50
- const files = [...bySource]
51
- .sort(([left], [right]) => left.localeCompare(right))
52
- .map(([source, sourceMatches]): SearchPresentationFile => {
53
- if (!compacted.has(source)) {
54
- return { kind: "detailed", source, matches: sourceMatches };
55
- }
56
-
57
- const counts = new Map<string, number>();
58
- for (const match of sourceMatches) {
59
- counts.set(match.lineText, (counts.get(match.lineText) ?? 0) + 1);
60
- }
61
- return {
62
- kind: "compacted",
63
- source,
64
- matchCount: sourceMatches.length,
65
- uniqueLineCount: counts.size,
66
- groups:
67
- bySource.size === 1
68
- ? [...counts]
69
- .sort(
70
- ([leftText, leftCount], [rightText, rightCount]) =>
71
- rightCount - leftCount || leftText.localeCompare(rightText),
72
- )
73
- .slice(0, detailBudget)
74
- .map(([text, matchCount]) => ({ text, matchCount }))
75
- : [],
76
- };
50
+ const files: SearchPresentationFile[] = [];
51
+ let remaining = detailBudget;
52
+ // Keep complete small files before spending the remaining budget on noisy summaries.
53
+ const ordered = [...bySource].sort(
54
+ ([left], [right]) =>
55
+ Number(compacted.has(left)) - Number(compacted.has(right)) || left.localeCompare(right),
56
+ );
57
+ for (const [source, sourceMatches] of ordered) {
58
+ if (!compacted.has(source)) {
59
+ if (sourceMatches.length > remaining) continue;
60
+ files.push({ kind: "detailed", source, matches: sourceMatches });
61
+ remaining -= sourceMatches.length;
62
+ continue;
63
+ }
64
+ if (remaining < 1) continue;
65
+ remaining--;
66
+ const counts = new Map<string, number>();
67
+ for (const match of sourceMatches)
68
+ counts.set(match.lineText, (counts.get(match.lineText) ?? 0) + 1);
69
+ const groups =
70
+ bySource.size === 1
71
+ ? [...counts]
72
+ .sort(
73
+ ([leftText, leftCount], [rightText, rightCount]) =>
74
+ rightCount - leftCount || leftText.localeCompare(rightText),
75
+ )
76
+ .slice(0, remaining)
77
+ .map(([text, matchCount]) => ({ text, matchCount }))
78
+ : [];
79
+ remaining -= groups.length;
80
+ files.push({
81
+ kind: "compacted",
82
+ source,
83
+ matchCount: sourceMatches.length,
84
+ uniqueLineCount: counts.size,
85
+ groups,
77
86
  });
78
-
87
+ }
88
+ files.sort((left, right) => left.source.localeCompare(right.source));
79
89
  return { files };
80
90
  }
@@ -66,7 +66,7 @@ export async function runSearchRecipe(
66
66
  notices.push(
67
67
  fallback.mode === "regex"
68
68
  ? "Search fallback: no literal matches; tried unquoted terms as regex."
69
- : "Search fallback: no matches in earlier modes; tried separate words.",
69
+ : "Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.",
70
70
  );
71
71
  } catch (error) {
72
72
  if (fallback.mode !== "regex" || !isRegexSyntaxError(error) || signal?.aborted) throw error;
@@ -146,6 +146,12 @@ function searchViewport(details: SearchToolDetails, expanded: boolean): readonly
146
146
  }
147
147
  }
148
148
 
149
+ if ((details.omittedFileCount ?? 0) > 0)
150
+ rows.push({
151
+ kind: "summary",
152
+ text: `… ${details.omittedFileCount} more files (${details.omittedMatchCount} matches) · narrow path, include, or query`,
153
+ });
154
+
149
155
  if (details.fuzzy !== undefined || expanded || rows.length <= COMPACT_SEARCH_ROWS) {
150
156
  return rows;
151
157
  }
@@ -51,6 +51,9 @@ export interface SearchToolDetails {
51
51
  readonly matchCount: number;
52
52
  readonly fileCount: number;
53
53
  readonly complete: boolean;
54
+ /** Files and matches retained internally but not shown within the item budget. */
55
+ readonly omittedFileCount?: number;
56
+ readonly omittedMatchCount?: number;
54
57
  readonly files: readonly SearchResultFile[];
55
58
  readonly fuzzy?: FuzzyResultData;
56
59
  readonly fuzzyPresentation?: FuzzySearchPresentation;
@@ -71,6 +74,7 @@ export function createSearchToolDetails(
71
74
  detailBudget = 50,
72
75
  ): SearchToolDetails {
73
76
  const presentation = planSearchPresentation(matches, detailBudget);
77
+ const fileCount = new Set(matches.map((match) => match.source)).size;
74
78
  const files = presentation.files.map((file): SearchResultFile =>
75
79
  file.kind === "detailed"
76
80
  ? createSearchResultFile(file.source, file.matches, cwd)
@@ -88,7 +92,14 @@ export function createSearchToolDetails(
88
92
  ...(sessionId !== undefined && { sessionId }),
89
93
  query,
90
94
  matchCount: matches.length,
91
- fileCount: files.length,
95
+ fileCount,
96
+ ...(presentation.files.length < fileCount
97
+ ? {
98
+ omittedFileCount: fileCount - files.length,
99
+ omittedMatchCount:
100
+ matches.length - files.reduce((count, file) => count + file.matchCount, 0),
101
+ }
102
+ : {}),
92
103
  complete,
93
104
  files,
94
105
  };
@@ -159,6 +170,8 @@ export function isSearchToolDetails(value: unknown): value is SearchToolDetails
159
170
  typeof value.query !== "string" ||
160
171
  !isCount(value.matchCount) ||
161
172
  !isCount(value.fileCount) ||
173
+ (value.omittedFileCount !== undefined && !isCount(value.omittedFileCount)) ||
174
+ (value.omittedMatchCount !== undefined && !isCount(value.omittedMatchCount)) ||
162
175
  typeof value.complete !== "boolean" ||
163
176
  (value.sessionId !== undefined && typeof value.sessionId !== "string") ||
164
177
  (value.fuzzy !== undefined && !isFuzzyResultData(value.fuzzy)) ||
@@ -171,8 +184,9 @@ export function isSearchToolDetails(value: unknown): value is SearchToolDetails
171
184
 
172
185
  const files = value.files as readonly SearchResultFile[];
173
186
  return (
174
- value.fileCount === files.length &&
175
- value.matchCount === files.reduce((count, file) => count + file.matchCount, 0)
187
+ value.fileCount === files.length + (value.omittedFileCount ?? 0) &&
188
+ value.matchCount ===
189
+ files.reduce((count, file) => count + file.matchCount, 0) + (value.omittedMatchCount ?? 0)
176
190
  );
177
191
  }
178
192
 
@@ -200,7 +200,11 @@ export function formatFuzzyCandidate(candidate: FuzzyCandidateData): string {
200
200
  `Possible name: ${candidate.identifier} (${candidate.reason})`,
201
201
  `${candidate.matchCount}${suffix} ${candidate.matchCount === 1 && candidate.selection.complete ? "match" : "matches"} in ${candidate.fileCount}${suffix} ${candidate.fileCount === 1 && candidate.selection.complete ? "file" : "files"}`,
202
202
  `Exact alternative: ${JSON.stringify(candidate.identifier)} (case-sensitive, whole identifier)`,
203
- ...(candidate.selection.complete ? [] : ["Capture limit reached; no complete all reference."]),
203
+ ...(candidate.selection.complete
204
+ ? []
205
+ : [
206
+ "Capture limit reached; no complete all reference. Inspect the returned location; do not treat this candidate as a complete match set.",
207
+ ]),
204
208
  ...(read
205
209
  ? [`Read: ${read}${reference || !first ? "" : ` · line ${first.range.startLine}`}`]
206
210
  : []),
@@ -7,12 +7,12 @@ export const searchSchema = Type.Object(
7
7
  query: Type.String({
8
8
  minLength: 1,
9
9
  description:
10
- "Text to find, a Boolean expression, or a prefixed query described below, such as files:*.ts. Quote text to keep it literal, or use regex:<pattern> for regular-expression matching.",
10
+ "Text to find or a Boolean expression. Quote text to keep it literal. Use regex:<pattern> for regular expressions, files:<pattern> for file paths, ast:<pattern> for syntax patterns, symbols:<query> for language symbols, or process:<query> for running processes.",
11
11
  }),
12
12
  path: Type.Optional({
13
13
  ...resultInputSchema,
14
14
  description:
15
- "File, directory, URL, or a source-aware Read/Search/Select/mutation result with a live target, RESULT# reference, or array of returned targets. Result scopes search only their exact ranges unless symbols: navigation explicitly follows external references; plain preview text is not a source.",
15
+ "File, directory, URL, unchanged Read/Search/Select/edit result, its UUID, or an array of such results. Results select only their registered ranges unless symbols: navigation follows external references.",
16
16
  }),
17
17
  navigation: Type.Optional(
18
18
  Type.Literal("references", {
@@ -28,7 +28,7 @@ export const searchSchema = Type.Object(
28
28
  Type.Integer({
29
29
  minimum: 1,
30
30
  maximum: 1000,
31
- description: "Maximum detailed results returned to the agent (default 50)",
31
+ description: "Maximum displayed items, including compact file summaries (default 50).",
32
32
  }),
33
33
  ),
34
34
  },
@@ -125,7 +125,8 @@ export default async function registerSearchCore(
125
125
  openWorldHint: false,
126
126
  },
127
127
  label: "search",
128
- description: "Use search to locate workspace text, file paths, and code structures.",
128
+ description:
129
+ "Use search to find text, file paths, syntax patterns, language symbols, web-page text, and running processes.",
129
130
  promptSnippet:
130
131
  "Search files and text with literals or regular expressions, plus syntax trees and language symbols",
131
132
  get promptGuidelines(): string[] {
@@ -254,18 +254,27 @@ export function createSearchCore(): SearchCore {
254
254
  const missingAdapter = data === undefined;
255
255
  return withStructuredResult(
256
256
  {
257
- content:
258
- entry.registration.fallback && protocolLike
257
+ content: [
258
+ ...(entry.registration.fallback && protocolLike
259
259
  ? [
260
260
  {
261
- type: "text",
261
+ type: "text" as const,
262
262
  text: emptyProtocol
263
263
  ? "Search fallback: empty protocol query; searched the original text."
264
264
  : "Search fallback: unhandled protocol query; searched the original text.",
265
265
  },
266
266
  ...formatted.content,
267
267
  ]
268
- : formatted.content,
268
+ : formatted.content),
269
+ ...(isRecord(data) && data.complete === false
270
+ ? [
271
+ {
272
+ type: "text" as const,
273
+ text: "Search coverage is incomplete. Do not conclude absence or use this result as an edit scope.",
274
+ },
275
+ ]
276
+ : []),
277
+ ],
269
278
  details: { resolverId: resolver.id, payload: formatted.details },
270
279
  ...(audience === "script" && {
271
280
  script: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -79,14 +79,14 @@
79
79
  "fs-extra": "^11.4.0",
80
80
  "oxfmt": "0.64.0",
81
81
  "partial-json": "^0.1.7",
82
- "pi-agent-documentation": "0.7.0",
83
- "pi-agent-invariant": "0.7.0",
84
- "pi-agent-read": "0.7.0",
85
- "pi-agent-resource": "0.7.0",
86
- "pi-agent-search": "0.7.0",
87
- "pi-agent-text": "0.7.0",
88
- "pi-agent-tool-call-interception": "0.7.0",
89
- "pi-agent-tool-ui": "0.7.0",
82
+ "pi-agent-documentation": "0.7.2",
83
+ "pi-agent-invariant": "0.7.2",
84
+ "pi-agent-read": "0.7.2",
85
+ "pi-agent-resource": "0.7.2",
86
+ "pi-agent-search": "0.7.2",
87
+ "pi-agent-text": "0.7.2",
88
+ "pi-agent-tool-call-interception": "0.7.2",
89
+ "pi-agent-tool-ui": "0.7.2",
90
90
  "typebox-guard": "npm:typebox@^1.1.38"
91
91
  },
92
92
  "pi": {
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-constant",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-text": "0.7.0",
10
- "pi-agent-text-editor": "0.7.0"
9
+ "pi-agent-text": "0.7.2",
10
+ "pi-agent-text-editor": "0.7.2"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
@@ -1,3 +1,4 @@
1
+ import path from "node:path";
1
2
  import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
2
3
  import {
3
4
  TEXT_EDITOR_API_VERSION,
@@ -5,22 +6,83 @@ import {
5
6
  TEXT_SEARCH_ANCHOR_KIND,
6
7
  type TextEditorPlugin,
7
8
  } from "pi-agent-text-editor/api/plugin-protocol";
8
-
9
9
  import { createExactTextAnchorResolver } from "./src/anchor.js";
10
10
  import { parseExactTextRecoveryConfig } from "./src/config.js";
11
-
12
11
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
13
12
 
14
- /** Registers unique exact text as the final search-anchor fallback. */
13
+ interface RecoveryDetails {
14
+ metadata?: { exactTextFailures?: string[] };
15
+ source?: string;
16
+ nativeEditBatch?: { state: string };
17
+ results?: { data?: { ok?: boolean; path?: string } }[];
18
+ }
19
+
20
+ /** Recognize issued source/anchor syntax only after its tool has validated it. */
21
+ function usesRegisteredSelector(input: Record<string, unknown>): boolean {
22
+ return [
23
+ "path",
24
+ "file",
25
+ "target",
26
+ "start",
27
+ "end",
28
+ "anchor",
29
+ "targetStart",
30
+ "targetEnd",
31
+ "change",
32
+ ].some((field) => {
33
+ const value = input[field];
34
+ const values: unknown[] = Array.isArray(value) ? value : [value];
35
+ return values.some(
36
+ (value: unknown) =>
37
+ typeof value === "string" &&
38
+ /^(?:RESULT#|SEARCH#|CHANGE#|scope-(?:begin|end)-|\d+#[a-f\d]+$|begin$|end$|<system-result)/iu.test(
39
+ value,
40
+ ),
41
+ );
42
+ });
43
+ }
44
+
45
+ /** Register exact text and require an issued selector after an explicit-text failure. */
15
46
  export default async function registerExactTextAnchor(pi: ExtensionAPI): Promise<void> {
47
+ const blocked = new Set<string>();
48
+ const pendingRecovery = new Set<string>();
49
+ const key = (source: string, cwd: string) => path.resolve(cwd, source);
50
+ const clear = () => {
51
+ blocked.clear();
52
+ pendingRecovery.clear();
53
+ };
54
+ pi.on("session_start", clear);
55
+ pi.on("session_shutdown", clear);
56
+ pi.on("agent_end", () => pendingRecovery.clear());
57
+ pi.on("tool_result", (event, context) => {
58
+ const details = event.details as RecoveryDetails | undefined;
59
+ for (const source of details?.metadata?.exactTextFailures ?? []) {
60
+ blocked.add(key(source, context.cwd));
61
+ pendingRecovery.delete(key(source, context.cwd));
62
+ }
63
+ if (event.isError || !usesRegisteredSelector(event.input)) return;
64
+ if (details?.nativeEditBatch?.state === "accepted" && details.source) {
65
+ const source = key(details.source, context.cwd);
66
+ if (blocked.has(source)) pendingRecovery.add(source);
67
+ return;
68
+ }
69
+ for (const result of details?.results ?? []) {
70
+ if (result.data?.ok && result.data.path) blocked.delete(key(result.data.path, context.cwd));
71
+ }
72
+ });
16
73
  const plugin = {
17
74
  protocol: TEXT_EDITOR_PROTOCOL,
18
75
  apiVersion: TEXT_EDITOR_API_VERSION,
19
76
  id: "text-anchor-exact",
20
77
  setup(api) {
78
+ api.onDidEdit((completion) => {
79
+ const source = key(completion.resourceSource, completion.cwd);
80
+ if (pendingRecovery.delete(source)) blocked.delete(source);
81
+ });
21
82
  api.addAnchorResolver({
22
83
  resolver: createExactTextAnchorResolver(
23
84
  parseExactTextRecoveryConfig(api.recoveryConfig("exactText")),
85
+ (source, cwd) => blocked.has(key(source, cwd)),
24
86
  ),
25
87
  kind: TEXT_SEARCH_ANCHOR_KIND,
26
88
  type: "auxiliary",
@@ -29,6 +91,5 @@ export default async function registerExactTextAnchor(pi: ExtensionAPI): Promise
29
91
  });
30
92
  },
31
93
  } satisfies TextEditorPlugin;
32
-
33
94
  await connectTextEditorPlugin(pi, plugin);
34
95
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-exact",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -13,8 +13,8 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "fast-fuzzy": "1.12.0",
16
- "pi-agent-text": "0.7.0",
17
- "pi-agent-text-editor": "0.7.0"
16
+ "pi-agent-text": "0.7.2",
17
+ "pi-agent-text-editor": "0.7.2"
18
18
  },
19
19
  "pi": {
20
20
  "extensions": [
@@ -18,7 +18,10 @@ interface NormalizedText {
18
18
  }
19
19
 
20
20
  /** Creates the catch-all resolver for unique exact text spans. */
21
- export function createExactTextAnchorResolver(config: ExactTextRecoveryConfig): TextAnchorResolver {
21
+ export function createExactTextAnchorResolver(
22
+ config: ExactTextRecoveryConfig,
23
+ requiresAnchor: (source: string, cwd: string) => boolean = () => false,
24
+ ): TextAnchorResolver {
22
25
  return {
23
26
  id: "exact-text",
24
27
  description:
@@ -30,7 +33,14 @@ export function createExactTextAnchorResolver(config: ExactTextRecoveryConfig):
30
33
  return "selected text";
31
34
  },
32
35
  tryResolve(value, context) {
33
- return Promise.resolve(resolveExactTextAnchor(value, context));
36
+ return Promise.resolve(
37
+ requiresAnchor(context.source, context.cwd)
38
+ ? rejected(
39
+ "invalid",
40
+ "Exact-text editing is blocked for this file; use a current returned anchor for the next edit.",
41
+ )
42
+ : resolveExactTextAnchor(value, context),
43
+ );
34
44
  },
35
45
  recover(value, context) {
36
46
  return recoverExactText(value, context, config);
@@ -25,9 +25,10 @@ export default async function registerLineHashTextAnchor(pi: ExtensionAPI): Prom
25
25
  id: "text-anchor-line-hash",
26
26
  setup(api) {
27
27
  api.addView({ view: "anchors", presenter });
28
- api.describe(
29
- 'views: ["anchors"] — LINE#HASH references for editing individual source lines.',
30
- );
28
+ api.describe({
29
+ views:
30
+ "anchors — annotate text with returned line references in the form LINE#HASH, e.g. 12#A4F0 (line number 12 and its content hash). These references select source lines in edits or path#anchor reads; display annotations are not file content.",
31
+ });
31
32
  },
32
33
  } satisfies ReadPlugin;
33
34
  const editorPlugin = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-line-hash",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -12,10 +12,10 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "pi-agent-invariant": "0.7.0",
16
- "pi-agent-read": "0.7.0",
17
- "pi-agent-text": "0.7.0",
18
- "pi-agent-text-editor": "0.7.0"
15
+ "pi-agent-invariant": "0.7.2",
16
+ "pi-agent-read": "0.7.2",
17
+ "pi-agent-text": "0.7.2",
18
+ "pi-agent-text-editor": "0.7.2"
19
19
  },
20
20
  "pi": {
21
21
  "extensions": [
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor-renderer",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
9
  "diff": "^9.0.0",
10
- "pi-agent-invariant": "0.7.0",
11
- "pi-agent-text-editor": "0.7.0",
12
- "pi-agent-tool-call-interception": "0.7.0",
13
- "pi-agent-tool-ui": "0.7.0",
10
+ "pi-agent-invariant": "0.7.2",
11
+ "pi-agent-text-editor": "0.7.2",
12
+ "pi-agent-tool-call-interception": "0.7.2",
13
+ "pi-agent-tool-ui": "0.7.2",
14
14
  "vscode-diff": "3.0.1"
15
15
  },
16
16
  "pi": {
@@ -317,6 +317,17 @@ function renderTail(
317
317
  : `Formatted ${grouped.formatted.length} files by ${by}`;
318
318
  statuses.unshift(theme.fg("success", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ")));
319
319
  }
320
+ if (grouped.alreadyFormatted.length > 0) {
321
+ const by =
322
+ grouped.unchangedFormatters.length === 1
323
+ ? grouped.unchangedFormatters[0]
324
+ : `${grouped.unchangedFormatters.length} formatters`;
325
+ const label =
326
+ resources.length === 1
327
+ ? `Already formatted (${by})`
328
+ : `Already formatted ${grouped.alreadyFormatted.length} files by ${by}`;
329
+ statuses.unshift(theme.fg("success", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ")));
330
+ }
320
331
  const text = [counts, ...statuses]
321
332
  .filter((item) => item !== undefined)
322
333
  .join(theme.fg("dim", " · "));
@@ -251,7 +251,17 @@ function createRenderer(
251
251
  options.expanded,
252
252
  theme,
253
253
  );
254
- return new Text("", 0, 0);
254
+ return new Text(
255
+ registration.name === "copy" &&
256
+ typeof result.details.metadata?.targetUnavailable === "string"
257
+ ? theme.fg(
258
+ "muted",
259
+ "No verified text selection. Read the destination before further edits.",
260
+ )
261
+ : "",
262
+ 0,
263
+ 0,
264
+ );
255
265
  }
256
266
 
257
267
  clearTypingRuntime(state);
@@ -272,14 +282,28 @@ function createRenderer(
272
282
  state.panel?.setPreviewResources([]);
273
283
 
274
284
  if (!context.isError && result.details.metadata?.emptyTargets === true) {
275
- return new Text(theme.fg("muted", "No changes · empty target set"), 0, 0);
285
+ return new Text(
286
+ theme.fg(
287
+ "muted",
288
+ registration.name === "copy"
289
+ ? "No changes: empty selection."
290
+ : "No changes · empty target set",
291
+ ),
292
+ 0,
293
+ 0,
294
+ );
276
295
  }
277
296
  const wholeFileSucceeded = wholeFileOperationSucceeded(result.details);
278
297
  if (wholeFileSucceeded !== undefined) {
279
298
  return new Text(
280
299
  theme.fg(
281
300
  wholeFileSucceeded ? "success" : "error",
282
- wholeFileSucceeded ? "✓ Applied" : "✗ Not applied",
301
+ wholeFileSucceeded
302
+ ? registration.name === "copy" &&
303
+ typeof result.details.metadata?.targetUnavailable === "string"
304
+ ? "✓ Applied · no verified text selection; read destination before further edits"
305
+ : "✓ Applied"
306
+ : "✗ Not applied",
283
307
  ),
284
308
  0,
285
309
  0,
@@ -292,7 +316,19 @@ function createRenderer(
292
316
  )
293
317
  .map((item) => item.text)
294
318
  .join("\n");
295
- const displayedOutput = context.isError ? userFacingFailure(output) : output;
319
+ const rollback =
320
+ registration.name === "copy" ? result.details.metadata?.copyRollback : undefined;
321
+ const uncertainExecution =
322
+ registration.name === "copy" && result.details.metadata?.copyExecution === "uncertain";
323
+ const displayedOutput = context.isError
324
+ ? uncertainExecution
325
+ ? "Copy failed · effects uncertain; read destination before retrying"
326
+ : rollback === "restored"
327
+ ? "Copy failed · changes rolled back"
328
+ : rollback === "failed"
329
+ ? "Copy failed · rollback failed; read destination before retrying"
330
+ : userFacingFailure(output, result.details)
331
+ : output;
296
332
  return new Text(
297
333
  displayedOutput.length === 0
298
334
  ? ""
@@ -868,7 +904,20 @@ function wholeFileOperationSucceeded(details: unknown): boolean | undefined {
868
904
  : undefined;
869
905
  }
870
906
 
871
- function userFacingFailure(agentOutput: string): string {
907
+ function userFacingFailure(
908
+ agentOutput: string,
909
+ details: FileMutationBatchResult | undefined,
910
+ ): string {
911
+ const rollback = details?.results?.find((result) => result.data.rollback !== undefined)?.data
912
+ .rollback;
913
+ if (rollback !== undefined) {
914
+ return rollback.failedSources.length === 0
915
+ ? "Rolled back · write failed"
916
+ : "State unknown · rollback failed";
917
+ }
918
+ if (details?.effect === "unknown") return "Effects unknown · edit failed";
919
+ if (details?.effect === "applied") return "Saved · post-write step failed";
920
+ if (details?.metadata?.rollback === "restored") return "Rolled back · edit failed";
872
921
  if (/\banchor\b[\s\S]*\bis ambiguous\./iu.test(agentOutput)) {
873
922
  return "Not changed · selection is ambiguous";
874
923
  }