pi-agent-ide 0.7.1 → 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 (275) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/chunk-6U5OU77O.js +3 -0
  3. package/dist/chunk-EURHXLN3.js +2 -0
  4. package/dist/{chunk-WMO6RNE2.js → chunk-F6IWZKOG.js} +6 -6
  5. package/dist/{chunk-HZEY4GT4.js → chunk-H445SHSJ.js} +2 -2
  6. package/dist/chunk-IG56UGSO.js +2 -0
  7. package/dist/chunk-IICJXZBU.js +6 -0
  8. package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
  9. package/dist/{chunk-PKKDDIWW.js → chunk-KOVPDKSJ.js} +1 -1
  10. package/dist/chunk-MXLSGMRZ.js +3 -0
  11. package/dist/chunk-OB46OPMZ.js +1 -0
  12. package/dist/chunk-PKSQT6TC.js +1 -0
  13. package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
  14. package/dist/chunk-QUYXINGZ.js +7 -0
  15. package/dist/{chunk-OMVRLWMX.js → chunk-SBP3ABH4.js} +1 -1
  16. package/dist/{chunk-4GCWGE2C.js → chunk-SJ4UZ4GU.js} +1 -1
  17. package/dist/{chunk-2TRHFMCZ.js → chunk-SNF7PDDX.js} +1 -1
  18. package/dist/{chunk-YP46DVVP.js → chunk-STBJO3Z3.js} +1 -1
  19. package/dist/{chunk-76ZK5ODR.js → chunk-TQGE7RH6.js} +13 -13
  20. package/dist/{chunk-LEEQIQ7D.js → chunk-XDG7EQRN.js} +6 -6
  21. package/dist/chunk-YWQS33DF.js +1 -0
  22. package/dist/chunk-ZIWPKIBZ.js +1 -0
  23. package/dist/entry-11.js +1 -1
  24. package/dist/entry-13.js +1 -1
  25. package/dist/entry-14.js +1 -1
  26. package/dist/entry-15.js +1 -1
  27. package/dist/entry-17.js +1 -1
  28. package/dist/entry-25.js +1 -1
  29. package/dist/entry-26.js +1 -1
  30. package/dist/entry-27.js +1 -1
  31. package/dist/entry-28.js +1 -1
  32. package/dist/entry-29.js +1 -1
  33. package/dist/entry-31.js +13 -12
  34. package/dist/entry-33.js +2 -1
  35. package/dist/entry-37.js +2 -2
  36. package/dist/entry-42.js +1 -1
  37. package/dist/entry-44.js +1 -1
  38. package/dist/entry-45.js +20 -12
  39. package/dist/entry-46.js +1 -1
  40. package/dist/entry-49.js +1 -1
  41. package/dist/entry-50.js +1 -1
  42. package/dist/entry-51.js +7 -6
  43. package/dist/entry-52.js +1 -1
  44. package/dist/entry-53.js +1 -1
  45. package/dist/entry-54.js +1 -1
  46. package/dist/entry-56.js +1 -1
  47. package/dist/entry-58.js +1 -1
  48. package/dist/entry-60.js +1 -1
  49. package/dist/entry-62.js +1 -1
  50. package/dist/entry-65.js +1 -1
  51. package/dist/entry-66.js +1 -1
  52. package/dist/entry-68.js +1 -1
  53. package/dist/entry-70.js +1 -1
  54. package/dist/entry-75.js +1 -1
  55. package/dist/entry-77.js +51 -42
  56. package/dist/entry-78.js +14 -14
  57. package/dist/entry-79.js +1 -1
  58. package/dist/entry-82.js +5 -5
  59. package/dist/entry-83.js +1 -1
  60. package/dist/entry-84.js +1 -1
  61. package/dist/entry-85.js +1 -1
  62. package/dist/entry-86.js +1 -1
  63. package/dist/pi-agent-ide.js +34 -11
  64. package/docs/agent-guides/editing.md +5 -5
  65. package/docs/agent-guides/git-changes.md +10 -0
  66. package/docs/agent-guides/read-resources.md +9 -46
  67. package/docs/agent-guides/search-code.md +7 -1
  68. package/docs/agent-guides/select-code.md +1 -0
  69. package/docs/agent-guides/terminal.md +9 -1
  70. package/docs/configuration.md +1 -1
  71. package/docs/releases.md +4 -0
  72. package/docs/research/native-codemode-batch-decision.md +2 -0
  73. package/docs/structured-results.md +2 -2
  74. package/docs/tools.md +10 -2
  75. package/node_modules/pi-agent-doctor/package.json +1 -1
  76. package/node_modules/pi-agent-documentation/package.json +1 -1
  77. package/node_modules/pi-agent-filesystem/package.json +7 -7
  78. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  79. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  80. package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
  81. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  82. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  83. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  84. package/node_modules/pi-agent-ide-ast/src/extension.ts +0 -2
  85. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  86. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +0 -3
  87. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +8 -6
  88. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +13 -5
  89. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  90. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  91. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  92. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  93. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  94. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  95. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  96. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
  97. package/node_modules/pi-agent-image/package.json +2 -2
  98. package/node_modules/pi-agent-invariant/package.json +1 -1
  99. package/node_modules/pi-agent-pdf/package.json +2 -2
  100. package/node_modules/pi-agent-read/package.json +7 -7
  101. package/node_modules/pi-agent-read/src/api/read-parameters.ts +3 -3
  102. package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -0
  103. package/node_modules/pi-agent-read/src/core/extension.ts +1 -1
  104. package/node_modules/pi-agent-read/src/core/read-core.ts +5 -1
  105. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  106. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  107. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  108. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  109. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +99 -44
  110. package/node_modules/pi-agent-resource/package.json +1 -1
  111. package/node_modules/pi-agent-resource/src/index.ts +1 -0
  112. package/node_modules/pi-agent-resource/src/result-targets.ts +6 -3
  113. package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
  114. package/node_modules/pi-agent-search/package.json +5 -5
  115. package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
  116. package/node_modules/pi-agent-search/src/api/search-parameters.ts +2 -2
  117. package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
  118. package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
  119. package/node_modules/pi-agent-search-text/package.json +7 -7
  120. package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
  121. package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
  122. package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
  123. package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
  124. package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
  125. package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
  126. package/node_modules/pi-agent-text/package.json +2 -2
  127. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  128. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  129. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  130. package/node_modules/pi-agent-text-editor/package.json +9 -9
  131. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  132. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
  133. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  134. package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  135. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  136. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  137. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  138. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  139. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  140. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -151
  141. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  142. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
  143. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  144. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +14 -13
  145. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  146. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  147. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  148. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  149. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +381 -187
  150. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +4 -2
  151. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -2
  152. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  153. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  154. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
  155. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  156. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  157. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  158. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  159. package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  160. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
  161. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  162. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  163. package/node_modules/pi-agent-web/package.json +7 -7
  164. package/node_modules/pi-agent-web/src/resolver.ts +11 -13
  165. package/node_modules/pi-agent-web-html/package.json +2 -2
  166. package/node_modules/pi-agent-web-image/package.json +3 -3
  167. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  168. package/node_modules/pi-agent-web-text/package.json +3 -3
  169. package/package.json +35 -35
  170. package/src/composite/nested-tool-rendering.ts +64 -6
  171. package/src/composite/output-limits.ts +125 -0
  172. package/src/composite/responses-tools.ts +25 -0
  173. package/src/composite/text-results.ts +158 -7
  174. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  175. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  176. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  177. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
  178. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  179. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  180. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  181. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  182. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  183. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  184. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  185. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
  186. package/src/extensions/pi-agent-read/package.json +7 -7
  187. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +3 -3
  188. package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -0
  189. package/src/extensions/pi-agent-read/src/core/extension.ts +1 -1
  190. package/src/extensions/pi-agent-read/src/core/read-core.ts +5 -1
  191. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  192. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  193. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  194. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  195. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +99 -44
  196. package/src/extensions/pi-agent-search/package.json +5 -5
  197. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
  198. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
  199. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
  200. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
  201. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
  202. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
  203. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
  204. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
  205. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +2 -2
  206. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
  207. package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
  208. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  209. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  210. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  211. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  212. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  213. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  214. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  215. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  216. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
  217. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  218. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
  219. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  220. package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  221. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  222. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  223. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  224. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  225. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  226. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -151
  227. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  228. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
  229. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  230. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +14 -13
  231. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  232. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  233. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  234. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  235. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +381 -187
  236. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +4 -2
  237. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -2
  238. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  239. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  240. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
  241. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  242. package/src/pi-agent-ide.ts +11 -0
  243. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  244. package/src/plugins/pi-agent-ide-ast/src/extension.ts +0 -2
  245. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  246. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +0 -3
  247. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +8 -6
  248. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +13 -5
  249. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  250. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  251. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  252. package/src/plugins/pi-agent-ide-debugger/index.ts +17 -7
  253. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
  254. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
  255. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +3 -2
  256. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  257. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  258. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  259. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  260. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
  261. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
  262. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
  263. package/src/plugins/pi-agent-ide-vision/index.ts +1 -0
  264. package/src/post-edit/gate.ts +13 -2
  265. package/dist/chunk-4XMY4H4V.js +0 -1
  266. package/dist/chunk-64M3SQPG.js +0 -3
  267. package/dist/chunk-CWD4O5PM.js +0 -3
  268. package/dist/chunk-D3WTDA6V.js +0 -2
  269. package/dist/chunk-EAZGN5ND.js +0 -7
  270. package/dist/chunk-GXEGY7GV.js +0 -1
  271. package/dist/chunk-MBUXFKIW.js +0 -3
  272. package/dist/chunk-PGIVHICI.js +0 -1
  273. package/dist/chunk-VMTR74FF.js +0 -2
  274. package/dist/chunk-WU6ZK6YD.js +0 -1
  275. 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
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "imports": {
@@ -13,7 +13,7 @@
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "pi-agent-resource": "0.7.1"
16
+ "pi-agent-resource": "0.7.2"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "typebox": "*"
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-constant",
3
- "version": "0.7.1",
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.1",
10
- "pi-agent-text-editor": "0.7.1"
9
+ "pi-agent-text": "0.7.2",
10
+ "pi-agent-text-editor": "0.7.2"
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.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.1",
17
- "pi-agent-text-editor": "0.7.1"
16
+ "pi-agent-text": "0.7.2",
17
+ "pi-agent-text-editor": "0.7.2"
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.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.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.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,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor",
3
- "version": "0.7.1",
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.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.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": {
@@ -3,8 +3,8 @@ import type { TextDocument } from "pi-agent-text";
3
3
  export type TextEditIntent = "edit" | "restore" | "mixed";
4
4
 
5
5
  export interface TextEditCompletion {
6
- /** Deferred writes remain observable; final updates reconcile formatting without another edit. */
7
- readonly postProcessing?: "deferred" | "final" | "complete";
6
+ /** Saved bytes remain observable even when post-edit work is deferred or interrupted. */
7
+ readonly postProcessing?: "deferred" | "final" | "complete" | "interrupted";
8
8
  readonly source: string;
9
9
  readonly resourceSource: string;
10
10
  readonly resolvedBy: string;
@@ -28,8 +28,7 @@ export { type ChangedRange, computeChangedRanges } from "#src/core/mutation-resu
28
28
  export {
29
29
  mutationDataSchema,
30
30
  mutationResultSchema,
31
- flushDataSchema,
32
- type FlushData,
31
+ type BatchMutationData,
33
32
  structuredMutation,
34
33
  type MutationData,
35
34
  } from "#src/core/structured-result.js";
@@ -5,6 +5,10 @@ import type { FileMutationBatchResult } from "./mutation-result.js";
5
5
  export interface NativeEditBatchEvent {
6
6
  readonly parentToolCallId: string;
7
7
  readonly calls: readonly string[];
8
+ /** Successful Copy calls that retained identical destination text without a write. */
9
+ readonly unchangedCopyCalls?: readonly string[];
10
+ /** Per-call Copy receipts keep destination authority and rollback evidence. */
11
+ readonly copyResults?: ReadonlyMap<string, AgentToolResult<FileMutationBatchResult>>;
8
12
  readonly result: AgentToolResult<FileMutationBatchResult>;
9
13
  }
10
14
 
@@ -14,7 +14,7 @@ export function formatStaleAnchorMessage(
14
14
  ): string {
15
15
  const context = details.context === undefined ? "" : `\n\n${details.context}`;
16
16
  return (
17
- `[SYSTEM] ${details.toolName} blocked: ${details.field} anchor "${details.anchor}" is stale. ` +
17
+ `[SYSTEM] ${details.toolName} blocked: ${details.field === "anchor" ? "anchor" : `${details.field} anchor`} "${details.anchor}" is stale. ` +
18
18
  `If the required line is represented by one of the context lines below, use that anchor. Otherwise, reread only the relevant section of "${details.path}" and regenerate the anchor. (${reason})${context}`
19
19
  );
20
20
  }
@@ -33,10 +33,42 @@ export const diffDataSchema = Type.Object(
33
33
  );
34
34
  export const diffOutputSchema = structuredResultSchema(diffDataSchema);
35
35
 
36
- const source = Type.Union([Type.String({ minLength: 1 }), readParameters]);
36
+ const comparisonReadParameters = {
37
+ ...readParameters,
38
+ properties: {
39
+ ...readParameters.properties,
40
+ path: {
41
+ ...readParameters.properties.path,
42
+ description:
43
+ "Text-readable source accepted by Read, such as a file path, URL, temp: reference, SEARCH# or RESULT# reference, or registered resource. Supply a path.",
44
+ },
45
+ offset: {
46
+ ...readParameters.properties.offset,
47
+ description:
48
+ "First text line to compare, numbered from 1. Omit or use 0 to start at line 1; negative offsets count from the end. For path#anchor, SEARCH# or RESULT# selections, count from the containing line: omitted, 0 or 1 starts there, 2 starts one line later, -1 one line earlier.",
49
+ },
50
+ limit: {
51
+ ...readParameters.properties.limit,
52
+ description:
53
+ "Maximum text lines to compare from the selected starting position. Omit to compare all resolved text in the selected range. Read's display limits do not shorten the comparison inputs.",
54
+ },
55
+ },
56
+ };
57
+ const source = Type.Union([Type.String({ minLength: 1 }), comparisonReadParameters]);
37
58
  /** Each side accepts a source string or the same request object as read. */
38
59
  export const diffParameters = Type.Object(
39
- { before: source, after: source },
60
+ {
61
+ before: {
62
+ ...source,
63
+ description:
64
+ "Source for the removed (-) side. Supply a non-empty source reference string or a Read request object. Strings identify sources, not literal text.",
65
+ },
66
+ after: {
67
+ ...source,
68
+ description:
69
+ "Source for the added (+) side. Supply a non-empty source reference string or a Read request object. Strings identify sources, not literal text.",
70
+ },
71
+ },
40
72
  { additionalProperties: false },
41
73
  );
42
74
  export type DiffRequest = Static<typeof diffParameters>;
@@ -107,13 +139,21 @@ export function comparisonText(data: ReadScriptData, requested: string): Compari
107
139
  };
108
140
  }
109
141
  if (data.kind === "bytes")
110
- throw Object.assign(new Error(`Byte sources are not text: ${data.source}`), {
111
- code: "UNSUPPORTED_CONTENT",
112
- });
142
+ throw Object.assign(
143
+ new Error(
144
+ `Byte sources are not text: ${data.source}\nIf this is a text file, use its path without raw:.`,
145
+ ),
146
+ {
147
+ code: "UNSUPPORTED_CONTENT",
148
+ },
149
+ );
113
150
  if (data.blocks.length === 0 || data.blocks.some((block) => block.type !== "text"))
114
- throw Object.assign(new Error(`Source is not text: ${data.source}`), {
115
- code: "UNSUPPORTED_CONTENT",
116
- });
151
+ throw Object.assign(
152
+ new Error(`Source is not text: ${data.source}\nUse a source that Read resolves to text.`),
153
+ {
154
+ code: "UNSUPPORTED_CONTENT",
155
+ },
156
+ );
117
157
  return {
118
158
  source: data.source,
119
159
  sources: [data.source],
@@ -166,8 +206,7 @@ export function registerDiff(
166
206
  parameters: diffParameters,
167
207
  outputSchema: diffOutputSchema,
168
208
  promptSnippet: "Compare two text-readable sources",
169
- description:
170
- "Use diff to compare two sources. before and after accept a source string or a read request {path, offset?, limit?, views?}. Use any source that read can resolve as text. Omit limit to compare complete resolved text; read presentation limits do not clip comparison inputs. Multiple resolved resources are joined with one newline separator in resolver order. Diff line numbers are relative to each selected text, not the original file when a window is selected. Native non-text content is rejected. Output uses the existing text diff and a shared output budget; oversized output has a full temporary reference.",
209
+ description: "Use diff to compare two text-readable sources without changing them.",
171
210
  renderCall(_args, theme) {
172
211
  return new Text(theme.fg("toolTitle", theme.bold("Diff")), 0, 0);
173
212
  },
@@ -195,7 +234,10 @@ export function registerDiff(
195
234
  const full = diffText(comparison);
196
235
  const bounded = truncateHead(full);
197
236
  const temporarySource = bounded.truncated ? await read.saveTemporary(full) : undefined;
198
- const footer = temporarySource === undefined ? "" : `\nFull diff: ${temporarySource}`;
237
+ const footer =
238
+ temporarySource === undefined
239
+ ? ""
240
+ : `\nDiff output is truncated; the comparison used the complete resolved inputs.\nUse read with path "${temporarySource}" for the full diff.`;
199
241
  return withStructuredResult(
200
242
  {
201
243
  content: [
@@ -205,7 +247,7 @@ export function registerDiff(
205
247
  temporarySource === undefined
206
248
  ? full
207
249
  : truncateHead(full, {
208
- maxLines: DEFAULT_MAX_LINES - 2,
250
+ maxLines: DEFAULT_MAX_LINES - footer.split("\n").length,
209
251
  maxBytes: DEFAULT_MAX_BYTES - Buffer.byteLength(footer),
210
252
  }).content + footer,
211
253
  },
@@ -4,5 +4,5 @@ export const EDITING_GUIDELINES = [
4
4
  "Use an available anchor when it selects exactly the intended text; otherwise use minimal unique exact text. Keep the edit limited to the intended content.",
5
5
  "When search broadens to separate words, treat its results as location hints. Refine the query before using those matches for replacement.",
6
6
  "Use standalone mutation tools in one assistant-response batch when each change is known in advance and does not depend on another change. This is the default for several independent edits in one file or across files. Every call is evaluated against the original file snapshots. Combine overlapping changes into one mutation. Use native Codemode for computed or dependent tool composition; it keeps the same tool contracts and does not add grouped rollback. Check each batch result and retry only unapplied changes.",
7
- "Inside native Codemode, submit independent local text-edit calls on disjoint resource sets concurrently; await calls on overlapping sets in order. Check each result's status. Await tools.flush({}) when later script work needs a committed receipt. Check the parent result for automatic batch commits before retrying an accepted call. Read docs:editing for batch boundaries and dependent work.",
7
+ "Inside Codemode, run independent edits on different resources concurrently; run edits on the same resource in order. Check the final Codemode result and retry only unapplied changes. Read docs:editing when you need a write report inside the script.",
8
8
  ] as const;
@@ -287,6 +287,27 @@ export class FileMutationAgentResult {
287
287
 
288
288
  // ── Success formatting ────────────────────────────────────────────────
289
289
 
290
+ private formatFormatting(formatting: FileMutationResult["data"]["formatting"]): string {
291
+ const by = formatting?.formatter === undefined ? "" : ` (${formatting.formatter})`;
292
+ switch (formatting?.status) {
293
+ case "changed": {
294
+ return `Formatted${by}.`;
295
+ }
296
+ case "unchanged": {
297
+ return `Already formatted${by}.`;
298
+ }
299
+ case "unavailable": {
300
+ return "No formatter is available for this file.";
301
+ }
302
+ case "failed": {
303
+ return `Formatting failed${by}. Read the saved file before retrying.`;
304
+ }
305
+ default: {
306
+ return `Formatting: ${formatting?.status ?? "not-reported"}${by}.`;
307
+ }
308
+ }
309
+ }
310
+
290
311
  private formatSuccess(fmr: FileMutationResult): string {
291
312
  const operations = fmr.data.operations ?? [];
292
313
  const verbs: Record<string, string> = {
@@ -295,7 +316,6 @@ export class FileMutationAgentResult {
295
316
  delete: "Deleted selected text",
296
317
  copy: "Copied selected text",
297
318
  move: "Moved selected text",
298
- write: "Wrote file content",
299
319
  undo: "Restored file content",
300
320
  stage: "Staged selected changes",
301
321
  unstage: "Unstaged selected changes",
@@ -304,15 +324,24 @@ export class FileMutationAgentResult {
304
324
  operations.length === 0
305
325
  ? "Changes applied."
306
326
  : operations
307
- .map(
308
- ({ operation, changes }) =>
309
- `${verbs[operation] ?? `Applied ${operation}`}: ${changes} text change(s) in this file.`,
327
+ .map(({ operation, changes }) =>
328
+ operation === "write"
329
+ ? "Saved file."
330
+ : `${verbs[operation] ?? `Applied ${operation}`}: ${changes} text change(s) in this file.`,
310
331
  )
311
332
  .join("\n"),
312
- `Formatting: ${fmr.data.formatting?.status ?? "not-reported"}${fmr.data.formatting?.formatter === undefined ? "" : ` (${fmr.data.formatting.formatter})`}.`,
333
+ this.formatFormatting(fmr.data.formatting),
313
334
  ];
314
335
 
315
- for (const status of fmr.data.diffStatuses ?? []) blocks.push(status.text);
336
+ for (const status of fmr.data.diffStatuses ?? []) {
337
+ if (
338
+ status.formattingStatus !== undefined &&
339
+ status.formattingStatus === fmr.data.formatting?.status &&
340
+ status.formatter === fmr.data.formatting.formatter
341
+ )
342
+ continue;
343
+ blocks.push(status.text);
344
+ }
316
345
  for (const diff of fmr.diffs) {
317
346
  const path = /^--- (.+)$/m.exec(diff)?.[1] ?? fmr.path ?? "<unknown file>";
318
347
  blocks.push(renderFinalStateFragment(fmr, path).join("\n"));
@@ -29,6 +29,8 @@ export interface MutationFormatting {
29
29
  export interface MutationDiffStatus {
30
30
  /** Formatter identity allows multi-file summaries without parsing display text. */
31
31
  readonly formatter?: string;
32
+ /** Observed formatter state for this label, kept distinct from file edit counts. */
33
+ readonly formattingStatus?: MutationFormatting["status"];
32
34
  readonly text: string;
33
35
  readonly tone?: "muted" | "success" | "warning" | "error";
34
36
  }
@@ -236,6 +238,8 @@ export interface FileMutationData {
236
238
 
237
239
  staleDiagnostic?: StaleAnchorDiagnostic | undefined;
238
240
  fileChangedStatement?: string | undefined;
241
+ /** Failed rollback resources; an empty list means all attempted writes were restored. */
242
+ rollback?: { readonly failedSources: readonly string[] } | undefined;
239
243
 
240
244
  // ── Transient engine fields ──
241
245
  snapshot?: MutationSnapshot | undefined;
@@ -325,7 +329,21 @@ export class FileMutationResult {
325
329
  readonly data: FileMutationData;
326
330
 
327
331
  public constructor(data?: FileMutationData) {
328
- this.data = data ?? {};
332
+ const formatting = data?.formatting;
333
+ this.data =
334
+ formatting === undefined || data?.diffStatuses === undefined
335
+ ? (data ?? {})
336
+ : {
337
+ ...data,
338
+ diffStatuses: data.diffStatuses.map((status) =>
339
+ status.formattingStatus !== undefined ||
340
+ formatting.formatter === undefined ||
341
+ status.formatter !== formatting.formatter ||
342
+ (status.tone !== "success" && status.tone !== "error")
343
+ ? status
344
+ : { ...status, formattingStatus: formatting.status },
345
+ ),
346
+ };
329
347
  }
330
348
 
331
349
  // ── Getters ──