pi-agent-ide 0.7.1 → 0.7.3

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 (307) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +3 -1
  3. package/dist/{chunk-PKKDDIWW.js → chunk-2ZMMRINH.js} +1 -1
  4. package/dist/chunk-6U5OU77O.js +3 -0
  5. package/dist/chunk-BYZSBXUK.js +2 -0
  6. package/dist/{chunk-LEEQIQ7D.js → chunk-CEX73RI5.js} +6 -6
  7. package/dist/chunk-DZWTKF2K.js +1 -0
  8. package/dist/{chunk-WMO6RNE2.js → chunk-EOKEQ3YH.js} +6 -6
  9. package/dist/{chunk-HZEY4GT4.js → chunk-H445SHSJ.js} +2 -2
  10. package/dist/{chunk-4GCWGE2C.js → chunk-HZ5BNF3A.js} +1 -1
  11. package/dist/chunk-IG56UGSO.js +2 -0
  12. package/dist/chunk-IICJXZBU.js +6 -0
  13. package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
  14. package/dist/chunk-MXLSGMRZ.js +3 -0
  15. package/dist/{chunk-76ZK5ODR.js → chunk-NHKPP2AI.js} +13 -13
  16. package/dist/chunk-OB46OPMZ.js +1 -0
  17. package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
  18. package/dist/chunk-QUYXINGZ.js +7 -0
  19. package/dist/{chunk-OMVRLWMX.js → chunk-SBP3ABH4.js} +1 -1
  20. package/dist/{chunk-YP46DVVP.js → chunk-STBJO3Z3.js} +1 -1
  21. package/dist/{chunk-2TRHFMCZ.js → chunk-TXOTNK6B.js} +1 -1
  22. package/dist/chunk-WLZIUMJL.js +1 -0
  23. package/dist/chunk-ZIWPKIBZ.js +1 -0
  24. package/dist/entry-11.js +1 -1
  25. package/dist/entry-13.js +1 -1
  26. package/dist/entry-14.js +1 -1
  27. package/dist/entry-15.js +1 -1
  28. package/dist/entry-17.js +1 -1
  29. package/dist/entry-25.js +1 -1
  30. package/dist/entry-26.js +1 -1
  31. package/dist/entry-27.js +1 -1
  32. package/dist/entry-28.js +1 -1
  33. package/dist/entry-29.js +1 -1
  34. package/dist/entry-31.js +12 -11
  35. package/dist/entry-33.js +3 -1
  36. package/dist/entry-37.js +6 -6
  37. package/dist/entry-42.js +1 -1
  38. package/dist/entry-44.js +1 -1
  39. package/dist/entry-45.js +20 -12
  40. package/dist/entry-46.js +1 -1
  41. package/dist/entry-49.js +1 -1
  42. package/dist/entry-50.js +1 -1
  43. package/dist/entry-51.js +7 -6
  44. package/dist/entry-52.js +1 -1
  45. package/dist/entry-53.js +1 -1
  46. package/dist/entry-54.js +1 -1
  47. package/dist/entry-56.js +1 -1
  48. package/dist/entry-58.js +1 -1
  49. package/dist/entry-60.js +1 -1
  50. package/dist/entry-62.js +1 -1
  51. package/dist/entry-65.js +1 -1
  52. package/dist/entry-66.js +1 -1
  53. package/dist/entry-68.js +1 -1
  54. package/dist/entry-70.js +1 -1
  55. package/dist/entry-75.js +1 -1
  56. package/dist/entry-77.js +63 -49
  57. package/dist/entry-78.js +15 -14
  58. package/dist/entry-79.js +1 -1
  59. package/dist/entry-82.js +5 -5
  60. package/dist/entry-83.js +1 -1
  61. package/dist/entry-84.js +1 -1
  62. package/dist/entry-85.js +1 -1
  63. package/dist/entry-86.js +1 -1
  64. package/dist/pi-agent-ide.js +34 -11
  65. package/docs/agent-guides/editing.md +14 -7
  66. package/docs/agent-guides/git-changes.md +10 -0
  67. package/docs/agent-guides/read-resources.md +9 -46
  68. package/docs/agent-guides/search-code.md +7 -1
  69. package/docs/agent-guides/select-code.md +1 -0
  70. package/docs/agent-guides/terminal.md +9 -1
  71. package/docs/configuration.md +22 -1
  72. package/docs/development.md +4 -0
  73. package/docs/directory-operations.md +45 -0
  74. package/docs/releases.md +12 -0
  75. package/docs/research/codemode-write-context.md +56 -0
  76. package/docs/research/native-codemode-batch-decision.md +2 -0
  77. package/docs/structured-results.md +2 -2
  78. package/docs/tools.md +10 -2
  79. package/docs/user-hooks.md +26 -0
  80. package/node_modules/pi-agent-doctor/package.json +1 -1
  81. package/node_modules/pi-agent-documentation/package.json +1 -1
  82. package/node_modules/pi-agent-filesystem/package.json +7 -7
  83. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  84. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  85. package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
  86. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  87. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  88. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  89. package/node_modules/pi-agent-ide-ast/src/extension.ts +3 -3
  90. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +9 -4
  91. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +0 -3
  92. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +8 -6
  93. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +13 -5
  94. package/node_modules/pi-agent-ide-changes/package.json +9 -8
  95. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +82 -4
  96. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  97. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  98. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  99. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  100. package/node_modules/pi-agent-ide-lsp/index.ts +1 -1
  101. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  102. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +2 -1
  103. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
  104. package/node_modules/pi-agent-image/package.json +2 -2
  105. package/node_modules/pi-agent-invariant/package.json +1 -1
  106. package/node_modules/pi-agent-pdf/package.json +2 -2
  107. package/node_modules/pi-agent-read/package.json +7 -7
  108. package/node_modules/pi-agent-read/src/api/read-parameters.ts +3 -3
  109. package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -0
  110. package/node_modules/pi-agent-read/src/core/extension.ts +1 -1
  111. package/node_modules/pi-agent-read/src/core/read-core.ts +5 -1
  112. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  113. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  114. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  115. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  116. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +99 -44
  117. package/node_modules/pi-agent-resource/package.json +1 -1
  118. package/node_modules/pi-agent-resource/src/index.ts +1 -0
  119. package/node_modules/pi-agent-resource/src/result-targets.ts +6 -3
  120. package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
  121. package/node_modules/pi-agent-search/package.json +5 -5
  122. package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
  123. package/node_modules/pi-agent-search/src/api/search-parameters.ts +2 -2
  124. package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
  125. package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
  126. package/node_modules/pi-agent-search-text/package.json +7 -7
  127. package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
  128. package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
  129. package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
  130. package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
  131. package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
  132. package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
  133. package/node_modules/pi-agent-text/package.json +2 -2
  134. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  135. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  136. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  137. package/node_modules/pi-agent-text-editor/package.json +9 -9
  138. package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +24 -0
  139. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  140. package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  141. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
  142. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  143. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +4 -1
  144. package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  145. package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +284 -0
  146. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  147. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  148. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +32 -3
  149. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +30 -40
  150. package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
  151. package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +164 -0
  152. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +36 -12
  153. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +25 -1
  154. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  155. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +286 -162
  156. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  157. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
  158. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +46 -11
  159. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +21 -14
  160. package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +96 -0
  161. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  162. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +155 -22
  163. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  164. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +126 -32
  165. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +428 -189
  166. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +66 -0
  167. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -4
  168. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +15 -6
  169. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  170. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  171. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +6 -4
  172. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
  173. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  174. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  175. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  176. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +75 -11
  177. package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  178. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
  179. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  180. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  181. package/node_modules/pi-agent-web/package.json +7 -7
  182. package/node_modules/pi-agent-web/src/resolver.ts +11 -13
  183. package/node_modules/pi-agent-web-html/package.json +2 -2
  184. package/node_modules/pi-agent-web-image/package.json +3 -3
  185. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  186. package/node_modules/pi-agent-web-text/package.json +3 -3
  187. package/package.json +36 -35
  188. package/src/api/hooks.ts +24 -0
  189. package/src/composite/nested-tool-rendering.ts +184 -77
  190. package/src/composite/output-limits.ts +125 -0
  191. package/src/composite/responses-tools.ts +25 -0
  192. package/src/composite/text-results.ts +158 -7
  193. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  194. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  195. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  196. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
  197. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  198. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  199. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  200. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  201. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  202. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  203. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  204. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
  205. package/src/extensions/pi-agent-read/package.json +7 -7
  206. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +3 -3
  207. package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -0
  208. package/src/extensions/pi-agent-read/src/core/extension.ts +1 -1
  209. package/src/extensions/pi-agent-read/src/core/read-core.ts +5 -1
  210. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  211. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  212. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  213. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  214. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +99 -44
  215. package/src/extensions/pi-agent-search/package.json +5 -5
  216. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
  217. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
  218. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
  219. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
  220. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
  221. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
  222. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
  223. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
  224. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +2 -2
  225. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
  226. package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
  227. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  228. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  229. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  230. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  231. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  232. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  233. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +75 -11
  234. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  235. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
  236. package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +24 -0
  237. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  238. package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  239. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
  240. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  241. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +4 -1
  242. package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  243. package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +284 -0
  244. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  245. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  246. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +32 -3
  247. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +30 -40
  248. package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
  249. package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +164 -0
  250. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +36 -12
  251. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +25 -1
  252. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  253. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +286 -162
  254. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  255. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
  256. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +46 -11
  257. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +21 -14
  258. package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +96 -0
  259. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  260. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +155 -22
  261. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  262. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +126 -32
  263. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +428 -189
  264. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +66 -0
  265. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -4
  266. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +15 -6
  267. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  268. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  269. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +6 -4
  270. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
  271. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  272. package/src/pi-agent-ide.ts +11 -0
  273. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  274. package/src/plugins/pi-agent-ide-ast/src/extension.ts +3 -3
  275. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +9 -4
  276. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +0 -3
  277. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +8 -6
  278. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +13 -5
  279. package/src/plugins/pi-agent-ide-changes/package.json +9 -8
  280. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +82 -4
  281. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  282. package/src/plugins/pi-agent-ide-debugger/index.ts +20 -8
  283. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
  284. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
  285. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +3 -2
  286. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  287. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  288. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  289. package/src/plugins/pi-agent-ide-lsp/index.ts +1 -1
  290. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  291. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +2 -1
  292. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
  293. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
  294. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
  295. package/src/plugins/pi-agent-ide-vision/index.ts +1 -0
  296. package/src/post-edit/gate.ts +13 -2
  297. package/dist/chunk-4XMY4H4V.js +0 -1
  298. package/dist/chunk-64M3SQPG.js +0 -3
  299. package/dist/chunk-CWD4O5PM.js +0 -3
  300. package/dist/chunk-D3WTDA6V.js +0 -2
  301. package/dist/chunk-EAZGN5ND.js +0 -7
  302. package/dist/chunk-GXEGY7GV.js +0 -1
  303. package/dist/chunk-MBUXFKIW.js +0 -3
  304. package/dist/chunk-PGIVHICI.js +0 -1
  305. package/dist/chunk-VMTR74FF.js +0 -2
  306. package/dist/chunk-WU6ZK6YD.js +0 -1
  307. package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-search",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -20,10 +20,10 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "pi-agent-documentation": "0.7.1",
24
- "pi-agent-resource": "0.7.1",
25
- "pi-agent-tool-call-interception": "0.7.1",
26
- "pi-agent-tool-ui": "0.7.1"
23
+ "pi-agent-documentation": "0.7.3",
24
+ "pi-agent-resource": "0.7.3",
25
+ "pi-agent-tool-call-interception": "0.7.3",
26
+ "pi-agent-tool-ui": "0.7.3"
27
27
  },
28
28
  "pi": {
29
29
  "extensions": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-search-text",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -24,12 +24,12 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "pi-agent-doctor": "0.7.1",
28
- "pi-agent-invariant": "0.7.1",
29
- "pi-agent-search": "0.7.1",
30
- "pi-agent-text": "0.7.1",
31
- "pi-agent-text-editor": "0.7.1",
32
- "pi-agent-tool-ui": "0.7.1"
27
+ "pi-agent-doctor": "0.7.3",
28
+ "pi-agent-invariant": "0.7.3",
29
+ "pi-agent-search": "0.7.3",
30
+ "pi-agent-text": "0.7.3",
31
+ "pi-agent-text-editor": "0.7.3",
32
+ "pi-agent-tool-ui": "0.7.3"
33
33
  },
34
34
  "pi": {
35
35
  "extensions": [
@@ -300,7 +300,7 @@ function formatSearchSession(
300
300
  const heading = anchorsRegistered
301
301
  ? session.complete
302
302
  ? `SEARCH#${session.id}:all:line / SEARCH#${session.id}:all:match — ${summary}`
303
- : `${summary} (limit reached; no all anchors were registered)`
303
+ : `${summary} (incomplete results; no all anchors were registered)`
304
304
  : `${summary} (files changed during search; results shown without anchors)`;
305
305
  const lines = anchorsRegistered ? [SEARCH_ANCHOR_LEGEND, heading] : [heading];
306
306
  const indices = new Map(session.matches.map((match, index) => [match, index + 1]));
@@ -340,6 +340,16 @@ function formatSearchSession(
340
340
  }
341
341
  }
342
342
 
343
+ const omittedFiles = fileCount - presentation.files.length;
344
+ if (omittedFiles > 0) {
345
+ const shownMatches = presentation.files.reduce(
346
+ (total, file) => total + (file.kind === "detailed" ? file.matches.length : file.matchCount),
347
+ 0,
348
+ );
349
+ lines.push(
350
+ `\n… ${omittedFiles} more files (${count - shownMatches} matches) not displayed. Narrow path, include, or query to see them.`,
351
+ );
352
+ }
343
353
  return lines.join("\n");
344
354
  }
345
355
 
@@ -86,7 +86,7 @@ export async function runScopedSearch(
86
86
  notices.push(
87
87
  fallback.mode === "regex"
88
88
  ? "Search fallback: no literal matches; tried unquoted terms as regex."
89
- : "Search fallback: no matches in earlier modes; tried separate words.",
89
+ : "Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.",
90
90
  );
91
91
  } catch (error) {
92
92
  if (
@@ -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,7 +7,7 @@ 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,
@@ -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.1",
3
+ "version": "0.7.3",
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.1",
83
- "pi-agent-invariant": "0.7.1",
84
- "pi-agent-read": "0.7.1",
85
- "pi-agent-resource": "0.7.1",
86
- "pi-agent-search": "0.7.1",
87
- "pi-agent-text": "0.7.1",
88
- "pi-agent-tool-call-interception": "0.7.1",
89
- "pi-agent-tool-ui": "0.7.1",
82
+ "pi-agent-documentation": "0.7.3",
83
+ "pi-agent-invariant": "0.7.3",
84
+ "pi-agent-read": "0.7.3",
85
+ "pi-agent-resource": "0.7.3",
86
+ "pi-agent-search": "0.7.3",
87
+ "pi-agent-text": "0.7.3",
88
+ "pi-agent-tool-call-interception": "0.7.3",
89
+ "pi-agent-tool-ui": "0.7.3",
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.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-text": "0.7.1",
10
- "pi-agent-text-editor": "0.7.1"
9
+ "pi-agent-text": "0.7.3",
10
+ "pi-agent-text-editor": "0.7.3"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-exact",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
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.1",
17
- "pi-agent-text-editor": "0.7.1"
16
+ "pi-agent-text": "0.7.3",
17
+ "pi-agent-text-editor": "0.7.3"
18
18
  },
19
19
  "pi": {
20
20
  "extensions": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-line-hash",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
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.1",
16
- "pi-agent-read": "0.7.1",
17
- "pi-agent-text": "0.7.1",
18
- "pi-agent-text-editor": "0.7.1"
15
+ "pi-agent-invariant": "0.7.3",
16
+ "pi-agent-read": "0.7.3",
17
+ "pi-agent-text": "0.7.3",
18
+ "pi-agent-text-editor": "0.7.3"
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.1",
3
+ "version": "0.7.3",
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.1",
11
- "pi-agent-text-editor": "0.7.1",
12
- "pi-agent-tool-call-interception": "0.7.1",
13
- "pi-agent-tool-ui": "0.7.1",
10
+ "pi-agent-invariant": "0.7.3",
11
+ "pi-agent-text-editor": "0.7.3",
12
+ "pi-agent-tool-call-interception": "0.7.3",
13
+ "pi-agent-tool-ui": "0.7.3",
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,33 @@ 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
- const wholeFileSucceeded = wholeFileOperationSucceeded(result.details);
278
- if (wholeFileSucceeded !== undefined) {
296
+ const wholeFileEffect = wholeFileOperationEffect(result.details);
297
+ if (wholeFileEffect !== undefined) {
298
+ const applied = wholeFileEffect === "applied";
299
+ const unknown = wholeFileEffect === "unknown";
300
+ const affected = registration.name === "delete" ? "the source" : "source and destination";
279
301
  return new Text(
280
302
  theme.fg(
281
- wholeFileSucceeded ? "success" : "error",
282
- wholeFileSucceeded ? "✓ Applied" : "✗ Not applied",
303
+ unknown ? "warning" : applied ? "success" : "error",
304
+ unknown
305
+ ? `Effects unknown · ${registration.name} failed; read ${affected} before retrying`
306
+ : applied
307
+ ? registration.name === "copy" &&
308
+ typeof result.details.metadata?.targetUnavailable === "string"
309
+ ? "✓ Applied · no verified text selection; read destination before further edits"
310
+ : "✓ Applied"
311
+ : "✗ Not applied",
283
312
  ),
284
313
  0,
285
314
  0,
@@ -292,7 +321,19 @@ function createRenderer(
292
321
  )
293
322
  .map((item) => item.text)
294
323
  .join("\n");
295
- const displayedOutput = context.isError ? userFacingFailure(output) : output;
324
+ const rollback =
325
+ registration.name === "copy" ? result.details.metadata?.copyRollback : undefined;
326
+ const uncertainExecution =
327
+ registration.name === "copy" && result.details.metadata?.copyExecution === "uncertain";
328
+ const displayedOutput = context.isError
329
+ ? uncertainExecution
330
+ ? "Copy failed · effects uncertain; read destination before retrying"
331
+ : rollback === "restored"
332
+ ? "Copy failed · changes rolled back"
333
+ : rollback === "failed"
334
+ ? "Copy failed · rollback failed; read destination before retrying"
335
+ : userFacingFailure(output, result.details)
336
+ : output;
296
337
  return new Text(
297
338
  displayedOutput.length === 0
298
339
  ? ""
@@ -856,19 +897,42 @@ function semanticRange(start: string, end: string): string {
856
897
  : `${start}–${end}`;
857
898
  }
858
899
 
859
- function wholeFileOperationSucceeded(details: unknown): boolean | undefined {
900
+ function wholeFileOperationEffect(
901
+ details: unknown,
902
+ ): "applied" | "not-applied" | "unknown" | undefined {
860
903
  if (details === null || typeof details !== "object" || !("metadata" in details)) return undefined;
861
904
  const metadata = details.metadata;
862
905
  if (metadata === null || typeof metadata !== "object" || !("semanticAction" in metadata))
863
906
  return undefined;
864
907
  const action = metadata.semanticAction;
865
908
  if (action === null || typeof action !== "object" || !("kind" in action)) return undefined;
866
- return action.kind === "file-operation" && "ok" in action && typeof action.ok === "boolean"
867
- ? action.ok
909
+ if (action.kind !== "file-operation" || !("effect" in action)) return undefined;
910
+ return action.effect === "applied" ||
911
+ action.effect === "not-applied" ||
912
+ action.effect === "unknown"
913
+ ? action.effect
868
914
  : undefined;
869
915
  }
870
916
 
871
- function userFacingFailure(agentOutput: string): string {
917
+ function userFacingFailure(
918
+ agentOutput: string,
919
+ details: FileMutationBatchResult | undefined,
920
+ ): string {
921
+ const rollbacks =
922
+ details?.results?.flatMap((result) => (result.data.rollback ? [result.data.rollback] : [])) ??
923
+ [];
924
+ if (rollbacks.length > 0) {
925
+ const failed = [...new Set(rollbacks.flatMap((rollback) => rollback.failedSources))];
926
+ const restored = [...new Set(rollbacks.flatMap((rollback) => rollback.restoredSources))];
927
+ return [
928
+ failed.length === 0 ? "Rolled back · write failed" : "State unknown · rollback failed",
929
+ ...(failed.length > 0 ? [`Unknown: ${failed.join(", ")}`] : []),
930
+ ...(restored.length > 0 ? [`Rolled back: ${restored.join(", ")}`] : []),
931
+ ].join("\n");
932
+ }
933
+ if (details?.effect === "unknown") return "Effects unknown · edit failed";
934
+ if (details?.effect === "applied") return "Saved · post-write step failed";
935
+ if (details?.metadata?.rollback === "restored") return "Rolled back · edit failed";
872
936
  if (/\banchor\b[\s\S]*\bis ambiguous\./iu.test(agentOutput)) {
873
937
  return "Not changed · selection is ambiguous";
874
938
  }
@@ -9,12 +9,25 @@ export function summarizeStatuses(
9
9
  ) {
10
10
  const formatted = new Set<string>();
11
11
  const formatters = new Set<string>();
12
+ const alreadyFormatted = new Set<string>();
13
+ const unchangedFormatters = new Set<string>();
12
14
  const remaining = new Map<string, { status: MutationDiffStatus; paths: Set<string> }>();
13
15
  for (const resource of resources)
14
16
  for (const status of resource.diffStatuses ?? []) {
15
- if (status.formatter !== undefined && status.tone === "success") {
16
- formatted.add(resource.path);
17
- formatters.add(status.formatter);
17
+ if (
18
+ status.formatter !== undefined &&
19
+ status.tone === "success" &&
20
+ (status.formattingStatus === undefined ||
21
+ status.formattingStatus === "changed" ||
22
+ status.formattingStatus === "unchanged")
23
+ ) {
24
+ if (status.formattingStatus === "unchanged") {
25
+ alreadyFormatted.add(resource.path);
26
+ unchangedFormatters.add(status.formatter);
27
+ } else {
28
+ formatted.add(resource.path);
29
+ formatters.add(status.formatter);
30
+ }
18
31
  continue;
19
32
  }
20
33
  const key = JSON.stringify([status.text, status.tone]);
@@ -28,6 +41,8 @@ export function summarizeStatuses(
28
41
  return {
29
42
  formatted: [...formatted],
30
43
  formatters: [...formatters],
44
+ alreadyFormatted: [...alreadyFormatted],
45
+ unchangedFormatters: [...unchangedFormatters],
31
46
  statuses: [...remaining.values()].map(({ status, paths }) => ({ status, paths: [...paths] })),
32
47
  };
33
48
  }