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
@@ -1,10 +1,14 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { requiredValue } from "pi-agent-invariant";
2
3
  import { ResourceScheduler, resourceAccesses } from "pi-agent-resource";
3
4
  import type { TextResourceEditOutcome } from "./text-editor-core.js";
4
5
 
5
6
  type Completed = Exclude<TextResourceEditOutcome<unknown>, { readonly kind: "failed" }>;
6
7
  type Finalize = () => Promise<Completed>;
7
- const active = new AsyncLocalStorage<Map<string, Finalize>>();
8
+ const active = new AsyncLocalStorage<{
9
+ readonly pending: Map<string, Finalize>;
10
+ readonly immediate: boolean;
11
+ }>();
8
12
  const notifications = new AsyncLocalStorage<Array<() => void>>();
9
13
 
10
14
  /** Schedule observers only after every file in the current finalization has settled. */
@@ -27,27 +31,32 @@ export async function collectPostEditNotifications<T>(work: () => Promise<T>): P
27
31
 
28
32
  /** Replace intermediate post-processing with the latest written state of this resource. */
29
33
  export function deferPostEdit(source: string, finalize: Finalize): boolean {
30
- const pending = active.getStore();
31
- if (!pending) return false;
32
- pending.set(source, finalize);
34
+ const scope = active.getStore();
35
+ if (!scope) return false;
36
+ if (scope.immediate) {
37
+ scope.pending.delete(source);
38
+ return false;
39
+ }
40
+ scope.pending.set(source, finalize);
33
41
  return true;
34
42
  }
35
43
 
36
44
  /** Optional read enrichment must not start checks on an intermediate edited snapshot. */
37
45
  export function hasDeferredPostEdit(source: string): boolean {
38
- return active.getStore()?.has(source) ?? false;
46
+ return active.getStore()?.pending.has(source) ?? false;
39
47
  }
40
48
 
41
49
  /** Stop deferred processing when a later operation removes or moves the resource. */
42
50
  export function forgetDeferredPostEdit(source: string): void {
43
- active.getStore()?.delete(source);
51
+ active.getStore()?.pending.delete(source);
44
52
  }
45
53
  /** Writes stay immediate; finishing drains each surviving final resource once. */
46
54
  export function createPostEditScope(cwd = process.cwd()) {
47
55
  const pending = new Map<string, Finalize>();
48
56
  return {
49
- run<T>(operation: () => T): T {
50
- return active.run(pending, operation);
57
+ /** Immediate processing replaces older deferred work for the same written resource. */
58
+ run<T>(operation: () => T, immediate = false): T {
59
+ return active.run({ pending, immediate }, operation);
51
60
  },
52
61
  forget(source: string): void {
53
62
  pending.delete(source);
@@ -56,7 +65,11 @@ export function createPostEditScope(cwd = process.cwd()) {
56
65
  sources(): readonly string[] {
57
66
  return [...pending.keys()];
58
67
  },
59
- async finish(onCompleted?: (outcome: Completed) => void): Promise<Completed[]> {
68
+ /** Report each final resource outcome; a failed finalization does not undo its write. */
69
+ async finish(
70
+ onCompleted?: (outcome: Completed) => void,
71
+ onFailed?: (source: string, error: unknown) => void,
72
+ ): Promise<Completed[]> {
60
73
  const work = [...pending];
61
74
  pending.clear();
62
75
  const completed: Completed[] = [];
@@ -68,9 +81,15 @@ export function createPostEditScope(cwd = process.cwd()) {
68
81
  scheduler.run(resourceAccesses(source, cwd, "write"), finalize),
69
82
  ),
70
83
  );
71
- for (const outcome of outcomes) {
84
+ for (const [index, outcome] of outcomes.entries()) {
85
+ const source = requiredValue(work[index])[0];
72
86
  if (outcome.status === "rejected") {
73
87
  errors.push(outcome.reason);
88
+ try {
89
+ onFailed?.(source, outcome.reason);
90
+ } catch (error) {
91
+ errors.push(error);
92
+ }
74
93
  continue;
75
94
  }
76
95
  completed.push(outcome.value);
@@ -78,6 +97,11 @@ export function createPostEditScope(cwd = process.cwd()) {
78
97
  onCompleted?.(outcome.value);
79
98
  } catch (error) {
80
99
  errors.push(error);
100
+ try {
101
+ onFailed?.(source, error);
102
+ } catch (failure) {
103
+ errors.push(failure);
104
+ }
81
105
  }
82
106
  }
83
107
  });
@@ -1,12 +1,30 @@
1
1
  import type { ResolvedResultTargets } from "pi-agent-resource";
2
2
  import { TextChangeDocument } from "./text-change-engine.js";
3
3
 
4
- /** Require a verified selection of one complete file before a whole-file operation. */
5
- export function wholeFileResultSource(result: ResolvedResultTargets): string {
4
+ const writePartialReason =
5
+ "Write received a partial file selection. Use replace to edit that selection, or Read the whole file before deliberately replacing all its contents.";
6
+
7
+ /** Require one complete file; name Write to provide its specific recovery instructions. */
8
+ export function wholeFileResultSource(
9
+ result: ResolvedResultTargets,
10
+ operation?: "write" | "undo",
11
+ ): string {
6
12
  const target = result.targets[0];
7
13
  const range = target?.ranges[0];
8
- if (result.targets.length !== 1 || target?.ranges.length !== 1 || range === undefined)
14
+ if (result.targets.length !== 1 || target?.ranges.length !== 1 || range === undefined) {
15
+ if (operation === "write") {
16
+ if (result.targets.length === 0)
17
+ throw new Error(
18
+ "Write received no file selection. Read the intended whole file before replacing it.",
19
+ );
20
+ if (result.targets.length > 1)
21
+ throw new Error(
22
+ "Write received multiple files. Choose one file and Read its whole contents before replacing it.",
23
+ );
24
+ throw new Error(writePartialReason);
25
+ }
9
26
  throw new Error("This operation requires one whole-file result target.");
27
+ }
10
28
  const document = new TextChangeDocument(target.expectedContent);
11
29
  const selected = document.range(
12
30
  range.start.lineNumber,
@@ -16,7 +34,9 @@ export function wholeFileResultSource(result: ResolvedResultTargets): string {
16
34
  );
17
35
  if (selected.from !== 0 || selected.to !== document.length)
18
36
  throw new Error(
19
- "This operation requires one whole-file result target; partial scopes are not widened.",
37
+ operation === "write"
38
+ ? writePartialReason
39
+ : "This operation requires one whole-file result target; partial scopes are not widened.",
20
40
  );
21
41
  return target.source;
22
42
  }
@@ -46,7 +46,7 @@ export async function prepareResultTransfer(
46
46
  const selected = store.resolveOrdered(input[field], cwd);
47
47
  if (!selected.complete)
48
48
  throw new Error(
49
- "Incomplete result targets cannot establish a complete transfer; repeat Search.",
49
+ "Incomplete result targets cannot establish a complete transfer. Run Search again with a higher limit or a narrower query, then use the complete result.",
50
50
  );
51
51
  await store.verify(selected, signal);
52
52
  input[field] = store.register(selected.targets, cwd);
@@ -168,7 +168,12 @@ export async function prepareResultTransfer(
168
168
  for (const span of sources)
169
169
  append(span, { from: span.from, to: span.to, insert: "" }, false);
170
170
  }
171
- for (const transfer of planned) append(transfer.target, transfer.change, true);
171
+ for (const transfer of planned)
172
+ append(
173
+ transfer.target,
174
+ operation === "copy" ? { ...transfer.change, allowUnchanged: true } : transfer.change,
175
+ true,
176
+ );
172
177
  return { edits };
173
178
  },
174
179
  };
@@ -1,9 +1,6 @@
1
1
  import { Type, type Static } from "typebox";
2
- import { Value } from "typebox/value";
3
2
  import {
4
- MAX_STRUCTURED_BYTES,
5
3
  resultError,
6
- resultErrorSchema,
7
4
  structuredResultSchema,
8
5
  withStructuredResult,
9
6
  type StructuredResult,
@@ -23,142 +20,56 @@ const file = Type.Object(
23
20
  {
24
21
  source: Type.String(),
25
22
  effect,
26
- action: Type.Optional(Type.String()),
27
23
  state: Type.Optional(
28
24
  Type.Union([Type.Literal("present"), Type.Literal("absent"), Type.Literal("unknown")]),
29
25
  ),
30
26
  },
31
27
  { additionalProperties: false },
32
28
  );
33
- const operation = Type.Object(
34
- {
35
- id: Type.String(),
36
- operation: Type.String(),
37
- effect,
38
- errors: Type.Array(resultErrorSchema),
39
- status: Type.Optional(
40
- Type.Union([
41
- Type.Literal("success"),
42
- Type.Literal("error"),
43
- Type.Literal("warning"),
44
- Type.Literal("unknown"),
45
- ]),
46
- ),
47
- sources: Type.Optional(Type.Array(Type.String())),
48
- warnings: Type.Optional(Type.Array(resultErrorSchema)),
49
- },
50
- { additionalProperties: false },
51
- );
52
- export const mutationDataSchema = Type.Object(
53
- {
54
- operation: Type.String(),
55
- effect,
56
- operationId: Type.Optional(Type.String()),
57
- target: Type.Optional(
58
- Type.String({
59
- description:
60
- "Backend-owned resulting-text scope: replace/insert text, write's whole file, copy/move destinations, or undo's whole restored files. Delete never supplies a live target. Pending handles require a confirmed commit.",
61
- }),
62
- ),
63
- targetUnavailable: Type.Optional(
64
- Type.String({
65
- description:
66
- "Why a completed mutation could not provide a safe resulting-text target. The write effect is reported separately.",
67
- }),
68
- ),
69
- files: Type.Array(file),
70
- changes: Type.Optional(
71
- Type.Array(
72
- Type.Object(
73
- {
74
- source: Type.String(),
75
- from: Type.Integer({
76
- description:
77
- "Inclusive zero-based UTF-16 offset in the pre-edit snapshot; not a live selector.",
78
- }),
79
- to: Type.Integer({
80
- description:
81
- "Exclusive zero-based UTF-16 offset in the pre-edit snapshot; not a live selector.",
82
- }),
83
- removedText: Type.String(),
84
- insertedText: Type.String(),
85
- },
86
- { additionalProperties: false },
87
- ),
88
- ),
89
- ),
90
- changesUnavailable: Type.Optional(
91
- Type.String({
92
- description: "Why the exact change record is omitted; applied effects remain reported.",
93
- }),
94
- ),
95
- operations: Type.Optional(Type.Array(operation)),
96
- parentToolCallId: Type.Optional(Type.String()),
97
- recovery: Type.Optional(
98
- Type.Array(
99
- Type.Object({
100
- source: Type.String(),
101
- field: Type.String(),
102
- anchor: Type.String(),
103
- total: Type.Integer(),
104
- candidates: Type.Array(
105
- Type.Object({
106
- rank: Type.Integer(),
107
- range: Type.Object({
108
- start: Type.Object({ lineNumber: Type.Integer(), column: Type.Integer() }),
109
- end: Type.Object({ lineNumber: Type.Integer(), column: Type.Integer() }),
110
- }),
111
- }),
112
- ),
113
- }),
114
- ),
115
- ),
116
- action: Type.Optional(
117
- Type.Object(
118
- {
119
- source: Type.String(),
120
- kind: Type.Optional(Type.String()),
121
- status: Type.Optional(Type.String()),
122
- command: Type.Optional(Type.String()),
123
- deleted: Type.Optional(Type.Boolean()),
124
- session: Type.Optional(Type.String()),
125
- file: Type.Optional(Type.String()),
126
- line: Type.Optional(Type.Integer()),
127
- verified: Type.Optional(Type.Boolean()),
128
- evaluation: Type.Optional(
129
- Type.Object(
130
- {
131
- expression: Type.String(),
132
- result: Type.String(),
133
- type: Type.Optional(Type.String()),
134
- variablesReference: Type.Integer(),
135
- },
136
- { additionalProperties: false },
137
- ),
138
- ),
139
- breakpoints: Type.Optional(
140
- Type.Array(
141
- Type.Object(
142
- {
143
- source: Type.String(),
144
- file: Type.String(),
145
- line: Type.Integer(),
146
- verified: Type.Boolean(),
147
- },
148
- { additionalProperties: false },
149
- ),
150
- ),
151
- ),
152
- },
153
- { additionalProperties: false },
154
- ),
155
- ),
156
- },
157
- { additionalProperties: false },
158
- );
159
- export const mutationOutputSchema = structuredResultSchema(mutationDataSchema);
160
- /** Public receipt fields are defined by the native output schema. */
161
- export type MutationData = Static<typeof mutationDataSchema>;
29
+ const receipt = { effect, files: Type.Array(file) };
30
+
31
+ /** Validate one file tool's result. Recovery, rendering and resource actions stay in details. */
32
+ export function mutationDataSchema(operation: string) {
33
+ return Type.Object(
34
+ {
35
+ operation: Type.Literal(operation),
36
+ ...receipt,
37
+ operationId: Type.Optional(Type.String()),
38
+ ...(operation === "delete"
39
+ ? {}
40
+ : {
41
+ target: Type.Optional(Type.String()),
42
+ targetUnavailable: Type.Optional(Type.String()),
43
+ }),
44
+ },
45
+ { additionalProperties: false },
46
+ );
47
+ }
48
+ /** Internal validation schema for a single tool, not an agent-facing return declaration. */
49
+ export function mutationResultSchema(operation: string) {
50
+ return structuredResultSchema(mutationDataSchema(operation));
51
+ }
52
+ /** Observed file and operation effects retained on the parent native script. */
53
+ export interface BatchMutationData {
54
+ operation: "batch";
55
+ effect: MutationData["effect"];
56
+ files: MutationData["files"];
57
+ operations: {
58
+ id: string;
59
+ operation: string;
60
+ effect: MutationData["effect"];
61
+ errors: ResultError[];
62
+ }[];
63
+ }
64
+ /** Small internal receipt used to collect observed file effects. */
65
+ export interface MutationData {
66
+ operation: string;
67
+ effect: Static<typeof effect>;
68
+ files: Static<typeof file>[];
69
+ operationId?: string;
70
+ target?: string;
71
+ targetUnavailable?: string;
72
+ }
162
73
  type MutationFile = MutationData["files"][number];
163
74
  function record(value: unknown): value is Record<string, unknown> {
164
75
  return typeof value === "object" && value !== null;
@@ -180,16 +91,13 @@ export function mutationOutcome(
180
91
  data: {
181
92
  operation,
182
93
  effect: "pending",
183
- ...(typeof details.metadata?.resultTarget === "string"
94
+ ...(operation !== "delete" && typeof details.metadata?.resultTarget === "string"
184
95
  ? { target: details.metadata.resultTarget }
185
96
  : {}),
186
97
  files:
187
98
  typeof detailRecord.source === "string"
188
99
  ? [{ source: detailRecord.source, effect: "pending" }]
189
100
  : [],
190
- ...(typeof native.parentToolCallId === "string"
191
- ? { parentToolCallId: native.parentToolCallId }
192
- : {}),
193
101
  },
194
102
  };
195
103
  const observed = new Set(completions.map((completion) => completion.resourceSource));
@@ -286,20 +194,6 @@ export function mutationOutcome(
286
194
  const file = unique.find((file) => file.source === state.source);
287
195
  if (file && (state.state === "present" || state.state === "absent")) file.state = state.state;
288
196
  }
289
- const changes = (results ?? [])
290
- .filter((item) => item.data.ok)
291
- .flatMap((item) => {
292
- const source = item.data.path;
293
- if (source === undefined) return [];
294
- return (item.data.rawChanges ?? []).map((change) => ({
295
- source,
296
- from: change.fromA,
297
- to: change.toA,
298
- removedText: change.removedText,
299
- insertedText: change.insertedText,
300
- }));
301
- });
302
- const changesFit = Buffer.byteLength(JSON.stringify(changes)) <= MAX_STRUCTURED_BYTES / 2;
303
197
  const known = unique.some((file) => file.effect === "applied");
304
198
  if (result.isError && errors.length === 0)
305
199
  errors.push({ code: "MUTATION_FAILED", message: "Mutation failed" });
@@ -312,52 +206,13 @@ export function mutationOutcome(
312
206
  )
313
207
  errors.push({ code: "UNKNOWN_RESULT", message: "Mutation effects were not reported" });
314
208
  const effect =
209
+ details.effect === "unknown" ||
315
210
  unique.some((file) => file.effect === "unknown") ||
316
211
  errors.some((error) => error.code === "UNKNOWN_RESULT")
317
212
  ? "unknown"
318
213
  : known
319
214
  ? "applied"
320
215
  : "not-applied";
321
- const action =
322
- semantic && typeof semantic.source === "string"
323
- ? {
324
- source: semantic.source,
325
- ...(typeof semantic.kind === "string" ? { kind: semantic.kind } : {}),
326
- ...(typeof semantic.status === "string" ? { status: semantic.status } : {}),
327
- ...(typeof semantic.command === "string" ? { command: semantic.command } : {}),
328
- ...(typeof semantic.deleted === "boolean" ? { deleted: semantic.deleted } : {}),
329
- ...(typeof semantic.session === "string" ? { session: semantic.session } : {}),
330
- ...(typeof semantic.file === "string" ? { file: semantic.file } : {}),
331
- ...(typeof semantic.line === "number" ? { line: semantic.line } : {}),
332
- ...(typeof semantic.verified === "boolean" ? { verified: semantic.verified } : {}),
333
- ...(record(semantic.evaluation)
334
- ? {
335
- evaluation: {
336
- expression: semantic.evaluation.expression,
337
- result: semantic.evaluation.result,
338
- variablesReference: semantic.evaluation.variablesReference,
339
- ...(typeof semantic.evaluation.type === "string"
340
- ? { type: semantic.evaluation.type }
341
- : {}),
342
- },
343
- }
344
- : {}),
345
- ...(Array.isArray(semantic.breakpoints)
346
- ? {
347
- breakpoints: semantic.breakpoints.filter(record).map((breakpoint) => ({
348
- source: breakpoint.source,
349
- file: breakpoint.file,
350
- line: breakpoint.line,
351
- verified: breakpoint.verified,
352
- })),
353
- }
354
- : {}),
355
- }
356
- : undefined;
357
- const checkedAction =
358
- action && Value.Check(mutationDataSchema.properties.action, action) ? action : undefined;
359
- if (action && !checkedAction)
360
- errors.push(resultError("Action adapter returned invalid fields", "INVALID_STRUCTURED_RESULT"));
361
216
  return {
362
217
  status:
363
218
  errors.length === 0
@@ -369,32 +224,12 @@ export function mutationOutcome(
369
224
  operation,
370
225
  effect,
371
226
  files: unique,
372
- ...(changes.length === 0
373
- ? {}
374
- : changesFit
375
- ? { changes }
376
- : {
377
- changesUnavailable:
378
- "Exact change record exceeds the 512 KiB receipt budget; it was not clipped.",
379
- }),
380
- ...(typeof details.metadata?.resultTarget === "string"
227
+ ...(operation !== "delete" && typeof details.metadata?.resultTarget === "string"
381
228
  ? { target: details.metadata.resultTarget }
382
229
  : {}),
383
- ...(typeof details.metadata?.targetUnavailable === "string"
230
+ ...(operation !== "delete" && typeof details.metadata?.targetUnavailable === "string"
384
231
  ? { targetUnavailable: details.metadata.targetUnavailable }
385
232
  : {}),
386
- ...(details.anchorRecoveries === undefined
387
- ? {}
388
- : {
389
- recovery: details.anchorRecoveries.map((item) => ({
390
- source: item.path,
391
- field: item.field,
392
- anchor: item.anchor,
393
- total: item.total,
394
- candidates: [...item.candidates],
395
- })),
396
- }),
397
- ...(checkedAction ? { action: checkedAction } : {}),
398
233
  },
399
234
  errors,
400
235
  };
@@ -408,5 +243,5 @@ export function structuredMutation(
408
243
  ) {
409
244
  const outcome = mutationOutcome(result, operation, completions);
410
245
  if (outcome.data && operationId !== undefined) outcome.data.operationId = operationId;
411
- return withStructuredResult(result, mutationDataSchema, outcome);
246
+ return withStructuredResult(result, mutationDataSchema(operation), outcome);
412
247
  }
@@ -8,6 +8,8 @@ export interface TextRange {
8
8
 
9
9
  export interface TextChange extends TextRange {
10
10
  readonly insert: string;
11
+ /** Copy may retain a destination range even when its text is already identical. */
12
+ readonly allowUnchanged?: true;
11
13
  }
12
14
 
13
15
  export interface AppliedTextChange {
@@ -220,7 +222,9 @@ export function applyTextChanges(
220
222
  validateChanges(source.length, ordered);
221
223
  if (
222
224
  !(creating && source.length === 0) &&
223
- ordered.some((change) => source.slice(change.from, change.to) === change.insert)
225
+ ordered.some(
226
+ (change) => !change.allowUnchanged && source.slice(change.from, change.to) === change.insert,
227
+ )
224
228
  ) {
225
229
  throw new Error("Text changes must change the document.");
226
230
  }