pi-agent-ide 0.6.2 → 0.6.4

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 (366) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +8 -1
  3. package/dist/chunk-2P2OGO3G.js +2 -0
  4. package/dist/{chunk-5QQABP47.js → chunk-3BBJZSMS.js} +1 -1
  5. package/dist/chunk-5J43L2RL.js +11 -0
  6. package/dist/{chunk-ITSNK5YG.js → chunk-7AVXUV4A.js} +2 -2
  7. package/dist/chunk-BAYETTZZ.js +16 -0
  8. package/dist/{chunk-VCTK4JSN.js → chunk-BSICWXMH.js} +1 -1
  9. package/dist/chunk-BVK5A7ED.js +28 -0
  10. package/dist/{chunk-ZM4L5AGN.js → chunk-EDURPQAV.js} +3 -2
  11. package/dist/{chunk-L7JMDDSD.js → chunk-FBOW7XOV.js} +1 -1
  12. package/dist/{chunk-25CZ5ZIU.js → chunk-FUG2TEKI.js} +1 -1
  13. package/dist/chunk-FZBCKIJJ.js +1 -0
  14. package/dist/chunk-HPUAIWIH.js +25 -0
  15. package/dist/chunk-I5JLCFUX.js +1 -0
  16. package/dist/chunk-KUPHNMUK.js +2 -0
  17. package/dist/{chunk-NTYXZ3EL.js → chunk-KVHDMIZS.js} +1 -1
  18. package/dist/{chunk-QDST6VIU.js → chunk-KZC7TI5M.js} +1 -1
  19. package/dist/chunk-MIZAFRDR.js +1 -0
  20. package/dist/chunk-PJPA5EEE.js +2 -0
  21. package/dist/{chunk-GUTQ3PWL.js → chunk-PLKYHUNT.js} +1 -1
  22. package/dist/chunk-QEJGED4V.js +28 -0
  23. package/dist/chunk-SILJ3OL4.js +9 -0
  24. package/dist/{chunk-VXD6FZP5.js → chunk-TQZBVOTT.js} +3 -3
  25. package/dist/chunk-VBICI5YA.js +1 -0
  26. package/dist/chunk-VWW3RLUX.js +12 -0
  27. package/dist/{chunk-O6LE42GK.js → chunk-WJTHY6AG.js} +1 -1
  28. package/dist/chunk-YGGKGZO2.js +1 -0
  29. package/dist/chunk-ZODCBFBL.js +2 -0
  30. package/dist/chunk-ZPT5D4VP.js +2 -0
  31. package/dist/entry-0.js +1 -1
  32. package/dist/entry-11.js +1 -1
  33. package/dist/entry-13.js +1 -1
  34. package/dist/entry-14.js +1 -1
  35. package/dist/entry-15.js +1 -1
  36. package/dist/entry-16.js +1 -1
  37. package/dist/entry-17.js +1 -1
  38. package/dist/entry-25.js +2 -2
  39. package/dist/entry-26.js +1 -1
  40. package/dist/entry-27.js +1 -1
  41. package/dist/entry-28.js +1 -1
  42. package/dist/entry-29.js +1 -1
  43. package/dist/entry-30.js +1 -1
  44. package/dist/entry-31.js +11 -11
  45. package/dist/entry-33.js +1 -1
  46. package/dist/entry-37.js +2 -2
  47. package/dist/entry-42.js +1 -1
  48. package/dist/entry-44.js +1 -1
  49. package/dist/entry-45.js +13 -12
  50. package/dist/entry-46.js +1 -1
  51. package/dist/entry-49.js +1 -1
  52. package/dist/entry-50.js +4 -4
  53. package/dist/entry-51.js +9 -9
  54. package/dist/entry-52.js +1 -1
  55. package/dist/entry-53.js +1 -1
  56. package/dist/entry-55.js +1 -1
  57. package/dist/entry-56.js +1 -1
  58. package/dist/entry-57.js +1 -1
  59. package/dist/entry-58.js +1 -1
  60. package/dist/entry-59.js +1 -1
  61. package/dist/entry-60.js +1 -1
  62. package/dist/entry-61.js +1 -1
  63. package/dist/entry-63.js +1 -1
  64. package/dist/entry-66.js +1 -1
  65. package/dist/entry-68.js +1 -1
  66. package/dist/entry-69.js +1 -1
  67. package/dist/entry-70.js +1 -1
  68. package/dist/entry-71.js +1 -0
  69. package/dist/entry-72.js +0 -1
  70. package/dist/entry-73.js +1 -0
  71. package/dist/entry-74.js +0 -1
  72. package/dist/entry-75.js +1 -1
  73. package/dist/entry-76.js +1 -1
  74. package/dist/entry-77.js +1 -315
  75. package/dist/entry-78.js +324 -25
  76. package/dist/entry-79.js +18 -2
  77. package/dist/entry-80.js +2 -1
  78. package/dist/entry-81.js +1 -1
  79. package/dist/entry-82.js +1 -3
  80. package/dist/entry-83.js +5 -3
  81. package/dist/entry-84.js +3 -1
  82. package/dist/entry-85.js +1 -1
  83. package/dist/entry-86.js +1 -1
  84. package/dist/entry-87.js +1 -0
  85. package/dist/pi-agent-ide.js +15 -3
  86. package/docs/agent-guides/apply.md +1 -1
  87. package/docs/agent-guides/editing.md +16 -0
  88. package/docs/agent-guides/json-reading.md +19 -3
  89. package/docs/agent-guides/read-resources.md +6 -0
  90. package/docs/agent-guides/search-code.md +5 -1
  91. package/docs/agent-guides/terminal.md +1 -1
  92. package/docs/code-review.md +99 -0
  93. package/docs/configuration.md +34 -0
  94. package/docs/development.md +15 -19
  95. package/docs/nightly.md +7 -0
  96. package/docs/releases.md +42 -0
  97. package/docs/research/native-codemode-batch-decision.md +27 -0
  98. package/docs/research/native-codemode-batching.md +65 -0
  99. package/docs/structured-results.md +59 -0
  100. package/docs/tools.md +18 -2
  101. package/node_modules/pi-agent-doctor/package.json +1 -1
  102. package/node_modules/pi-agent-documentation/package.json +1 -1
  103. package/node_modules/pi-agent-documentation/src/index.ts +1 -1
  104. package/node_modules/pi-agent-filesystem/index.ts +6 -1
  105. package/node_modules/pi-agent-filesystem/package.json +7 -6
  106. package/node_modules/pi-agent-filesystem/src/path-recovery.ts +109 -0
  107. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  108. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  109. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  110. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  111. package/node_modules/pi-agent-ide-ast/package.json +10 -10
  112. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
  113. package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +6 -2
  114. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +17 -0
  115. package/node_modules/pi-agent-ide-changes/index.ts +3 -9
  116. package/node_modules/pi-agent-ide-changes/package.json +8 -7
  117. package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
  118. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +125 -47
  119. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  120. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  121. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  122. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  123. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +19 -0
  124. package/node_modules/pi-agent-image/package.json +2 -2
  125. package/node_modules/pi-agent-invariant/package.json +1 -1
  126. package/node_modules/pi-agent-pdf/package.json +2 -2
  127. package/node_modules/pi-agent-read/package.json +7 -7
  128. package/node_modules/pi-agent-read/src/api/tools/read.ts +31 -2
  129. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
  130. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
  131. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +216 -0
  132. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +119 -72
  133. package/node_modules/pi-agent-resource/package.json +1 -1
  134. package/node_modules/pi-agent-resource/src/index.ts +12 -0
  135. package/node_modules/pi-agent-resource/src/resource-access.ts +55 -0
  136. package/node_modules/pi-agent-resource/src/resource-scheduler.ts +204 -0
  137. package/node_modules/pi-agent-resource/src/tool-result.ts +125 -0
  138. package/node_modules/pi-agent-search/package.json +5 -4
  139. package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
  140. package/node_modules/pi-agent-search/src/api/search.ts +11 -0
  141. package/node_modules/pi-agent-search/src/api/structured-result.ts +93 -0
  142. package/node_modules/pi-agent-search/src/core/extension.ts +40 -14
  143. package/node_modules/pi-agent-search/src/core/search-core.ts +136 -77
  144. package/node_modules/pi-agent-search-text/index.ts +3 -0
  145. package/node_modules/pi-agent-search-text/package.json +6 -6
  146. package/node_modules/pi-agent-search-text/src/resolvers.ts +17 -0
  147. package/node_modules/pi-agent-search-text/src/search-backend.ts +104 -8
  148. package/node_modules/pi-agent-search-text/src/search-query.ts +42 -34
  149. package/node_modules/pi-agent-search-text/src/search-recipe.ts +18 -4
  150. package/node_modules/pi-agent-search-text/src/search-renderer.ts +37 -3
  151. package/node_modules/pi-agent-search-text/src/search-session.ts +21 -13
  152. package/node_modules/pi-agent-text/package.json +2 -2
  153. package/node_modules/pi-agent-text/src/text-document.ts +15 -10
  154. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  155. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  156. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +4 -3
  157. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  158. package/node_modules/pi-agent-text-editor/index.ts +4 -2
  159. package/node_modules/pi-agent-text-editor/package.json +21 -17
  160. package/node_modules/pi-agent-text-editor/runtime/entry-77.js +0 -1
  161. package/node_modules/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
  162. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
  163. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
  164. package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +4 -0
  165. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +95 -34
  166. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +1 -1
  167. package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +4 -0
  168. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +20 -11
  169. package/node_modules/pi-agent-text-editor/src/core/apply/structured-result.ts +251 -0
  170. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +32 -12
  171. package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +154 -132
  172. package/node_modules/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
  173. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +74 -18
  174. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
  175. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -0
  176. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  177. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +640 -0
  178. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
  179. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +314 -0
  180. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +52 -11
  181. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +143 -138
  182. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
  183. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +242 -116
  184. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +109 -47
  185. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
  186. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
  187. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +7 -4
  188. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +24 -3
  189. package/node_modules/pi-agent-text-editor-renderer/index.ts +8 -1
  190. package/node_modules/pi-agent-text-editor-renderer/package.json +7 -6
  191. package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +262 -129
  192. package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
  193. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
  194. package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
  195. package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +16 -1
  196. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  197. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +2 -0
  198. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  199. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  200. package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +1 -0
  201. package/node_modules/pi-agent-web/index.ts +20 -0
  202. package/node_modules/pi-agent-web/package.json +8 -7
  203. package/node_modules/pi-agent-web/src/search.ts +112 -0
  204. package/node_modules/pi-agent-web-html/package.json +3 -3
  205. package/node_modules/pi-agent-web-image/package.json +4 -4
  206. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  207. package/node_modules/pi-agent-web-text/package.json +4 -4
  208. package/node_modules/pi-agent-web-text/runtime/entry-87.js +2 -0
  209. package/package.json +42 -36
  210. package/skills/capture-code-review-rule/SKILL.md +60 -0
  211. package/src/code-review/config.ts +68 -0
  212. package/src/code-review/extension.ts +105 -0
  213. package/src/code-review/fragments.ts +26 -0
  214. package/src/code-review/reviewer.ts +198 -0
  215. package/src/composite/host-version.ts +13 -0
  216. package/src/composite/nested-tool-rendering.ts +298 -0
  217. package/src/composite/tool-availability.ts +90 -0
  218. package/src/core/extension.ts +2 -0
  219. package/src/documentation/extension.ts +81 -145
  220. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +6 -1
  221. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -6
  222. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  223. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  224. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  225. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  226. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/path-recovery.ts +109 -0
  227. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +20 -0
  228. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -7
  229. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  230. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  231. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  232. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  233. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +2 -0
  234. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +2 -0
  235. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +112 -0
  236. package/src/extensions/pi-agent-read/package.json +7 -7
  237. package/src/extensions/pi-agent-read/src/api/tools/read.ts +31 -2
  238. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
  239. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
  240. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +216 -0
  241. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +119 -72
  242. package/src/extensions/pi-agent-search/package.json +5 -4
  243. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +3 -0
  244. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
  245. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +17 -0
  246. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +104 -8
  247. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +42 -34
  248. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +18 -4
  249. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +37 -3
  250. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +21 -13
  251. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
  252. package/src/extensions/pi-agent-search/src/api/search.ts +11 -0
  253. package/src/extensions/pi-agent-search/src/api/structured-result.ts +93 -0
  254. package/src/extensions/pi-agent-search/src/core/extension.ts +40 -14
  255. package/src/extensions/pi-agent-search/src/core/search-core.ts +136 -77
  256. package/src/extensions/pi-agent-text-editor/index.ts +4 -2
  257. package/src/extensions/pi-agent-text-editor/package.json +21 -17
  258. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  259. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  260. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +4 -3
  261. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  262. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +8 -1
  263. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +7 -6
  264. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +262 -129
  265. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
  266. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
  267. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
  268. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +16 -1
  269. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  270. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +2 -0
  271. package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +0 -1
  272. package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +2 -0
  273. package/src/extensions/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
  274. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
  275. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
  276. package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +4 -0
  277. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +95 -34
  278. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +1 -1
  279. package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +4 -0
  280. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +20 -11
  281. package/src/extensions/pi-agent-text-editor/src/core/apply/structured-result.ts +251 -0
  282. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +32 -12
  283. package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +154 -132
  284. package/src/extensions/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
  285. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +74 -18
  286. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
  287. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -0
  288. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  289. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +640 -0
  290. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
  291. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +314 -0
  292. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +52 -11
  293. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +143 -138
  294. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
  295. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +242 -116
  296. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +109 -47
  297. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
  298. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
  299. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +7 -4
  300. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +24 -3
  301. package/src/pi-agent-ide.ts +61 -2
  302. package/src/plugins/pi-agent-ide-ast/package.json +10 -10
  303. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
  304. package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +6 -2
  305. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +17 -0
  306. package/src/plugins/pi-agent-ide-changes/index.ts +3 -9
  307. package/src/plugins/pi-agent-ide-changes/package.json +8 -7
  308. package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
  309. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +125 -47
  310. package/src/plugins/pi-agent-ide-debugger/index.ts +63 -17
  311. package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +18 -2
  312. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +24 -4
  313. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +68 -2
  314. package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +357 -0
  315. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -3
  316. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +13 -13
  317. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  318. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  319. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  320. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  321. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +19 -0
  322. package/src/plugins/pi-agent-ide-terminal/index.ts +12 -2
  323. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
  324. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +65 -30
  325. package/src/plugins/pi-agent-ide-terminal/src/search.ts +13 -8
  326. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +1 -0
  327. package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +100 -0
  328. package/src/plugins/pi-agent-ide-terminal/src/steering.ts +62 -0
  329. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +97 -45
  330. package/src/plugins/pi-agent-ide-terminal/src/types.ts +3 -1
  331. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +15 -6
  332. package/src/plugins/pi-agent-ide-vision/index.ts +16 -1
  333. package/dist/chunk-3E2NTWCN.js +0 -2
  334. package/dist/chunk-4LUW26BX.js +0 -10
  335. package/dist/chunk-5VSE5X5R.js +0 -2
  336. package/dist/chunk-CEX3VOJ7.js +0 -2
  337. package/dist/chunk-FA6BKC5Y.js +0 -1
  338. package/dist/chunk-FEDVTZJG.js +0 -1
  339. package/dist/chunk-HMLH43ZS.js +0 -4
  340. package/dist/chunk-KII2JQC5.js +0 -1
  341. package/dist/chunk-LVWMWWWF.js +0 -28
  342. package/dist/chunk-P7XO5CIP.js +0 -2
  343. package/dist/chunk-PZFOOHY2.js +0 -15
  344. package/dist/chunk-S3ZPXWX7.js +0 -2
  345. package/dist/chunk-T7CZIACQ.js +0 -27
  346. package/dist/chunk-YT42LKFV.js +0 -16
  347. package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
  348. package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +0 -1
  349. package/node_modules/pi-agent-web/runtime/entry-82.js +0 -2
  350. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-83.js +0 -2
  351. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +0 -2
  352. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
  353. package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
  354. /package/dist/{chunk-4U2GUKNJ.js → chunk-F7NVAC4Q.js} +0 -0
  355. /package/dist/{chunk-ROXXK6TW.js → chunk-PXWDDBBC.js} +0 -0
  356. /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-78.js +0 -0
  357. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
  358. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-81.js +0 -0
  359. /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-83.js +0 -0
  360. /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
  361. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
  362. /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
  363. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
  364. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
  365. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
  366. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
@@ -43,6 +43,8 @@ import type { BatchExecutionReporter } from "#src/core/text-edit-batch-execution
43
43
  import type {
44
44
  TextEditorCore,
45
45
  TextResourceEditFailure,
46
+ ResolveResourceTextAnchor,
47
+ TextResourceEditRequest,
46
48
  TextResourcesEditOutcome,
47
49
  } from "#src/core/text-editor-core.js";
48
50
  import type {
@@ -61,7 +63,8 @@ interface PlannedTextMutation extends TextMutation {
61
63
  readonly resultPresentations: ReadonlyMap<string, MutationResultPresentation>;
62
64
  }
63
65
 
64
- interface PlannedTextBatch {
66
+ export interface PlannedTextBatch {
67
+ readonly changes: ReadonlyMap<string, readonly TextChange[]>;
65
68
  readonly mutations: readonly {
66
69
  readonly callId: string;
67
70
  readonly mutation: PlannedTextMutation;
@@ -169,6 +172,125 @@ export function registerTextEditBatching(pi: ExtensionAPI, core: TextEditorCore)
169
172
  registerToolBatch(pi, definition);
170
173
  }
171
174
 
175
+ /** Plan mutations once against one snapshot; callers choose when to commit them. */
176
+ export async function planRegisteredTextBatch(
177
+ registrations: ReadonlyMap<string, AnyTextMutationToolRegistration>,
178
+ parameters: TextBatchParams,
179
+ texts: ReadonlyMap<string, string>,
180
+ resolveAnchor: ResolveResourceTextAnchor,
181
+ context: ExtensionContext,
182
+ signal: AbortSignal | undefined,
183
+ renderArguments: (toolCallId: string, patch: Readonly<Record<string, unknown>>) => void,
184
+ priorChanges: ReadonlyMap<string, readonly TextChange[]> = new Map(),
185
+ ): Promise<PlannedTextBatch> {
186
+ const mutations: PlannedTextBatch["mutations"][number][] = [];
187
+ const failures: PlannedTextBatch["failures"][number][] = [];
188
+ const changes = new Map([...priorChanges].map(([source, edits]) => [source, [...edits]]));
189
+ // Compute against immutable snapshots together; accept conflicts in call order.
190
+ const planned = await Promise.allSettled(
191
+ parameters.edits.map(async (entry): Promise<PlannedTextBatch["mutations"][number]> => {
192
+ const registration = requiredValue(registrations.get(entry.op));
193
+ const { callId, op: _op, ...input } = entry;
194
+ const sources = mutationSources(registration, input);
195
+ const sourceFor = (field: string): string => requiredValue(sources.get(field));
196
+ const documentFor = (source: string) =>
197
+ new TextChangeDocument(requiredValue(texts.get(source)));
198
+ const majorAnchorSources = new Set<string>();
199
+ const publish = (field: string, state: ToolCallAnchorRenderState) =>
200
+ renderArguments(callId, {
201
+ [TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH]: { [field]: state },
202
+ });
203
+ const resolveAnchors = async (field: string) => {
204
+ const descriptor = (registration.anchors ?? []).find((anchor) => anchor.field === field);
205
+ const value = input[field];
206
+ const source = descriptor === undefined ? undefined : sources.get(descriptor.sourceField);
207
+ if (descriptor === undefined || typeof value !== "string" || source === undefined) {
208
+ publish(field, { kind: "failed" });
209
+ throw new Error(`Unable to resolve mutation anchor ${field}`);
210
+ }
211
+ try {
212
+ const anchor = await resolveAnchor(source, value, descriptor.kinds);
213
+ if (resolvedTextAnchorType(anchor) === "major") majorAnchorSources.add(source);
214
+ const rendered = renderTextAnchor(anchor, value, { source, anchor });
215
+ publish(field, {
216
+ kind: "resolved",
217
+ full: rendered.full,
218
+ compact: rendered.compact,
219
+ resolverId: rendered.resolverId,
220
+ });
221
+ return new Map([[source, anchor]]);
222
+ } catch (error) {
223
+ publish(field, { kind: "failed" });
224
+ throw contextualizeTextMutationAnchorError(
225
+ error,
226
+ registration.name,
227
+ field,
228
+ source,
229
+ value,
230
+ );
231
+ }
232
+ };
233
+ const mutationContext = {
234
+ cwd: context.cwd,
235
+ ...(signal !== undefined && { signal }),
236
+ sourceDocument: documentFor(sourceFor(registration.source.field)),
237
+ sourceFor,
238
+ documentFor,
239
+ targetDocument: (field: string) => documentFor(sourceFor(field)),
240
+ resolveAnchors,
241
+ async resolveAnchor(field: string) {
242
+ return requiredValue((await resolveAnchors(field)).values().next().value);
243
+ },
244
+ };
245
+ await preflightMutationAnchors(registration, input, mutationContext);
246
+ const mutation = await registration.mutate(mutationContext, input);
247
+ return {
248
+ callId,
249
+ mutation: {
250
+ ...mutation,
251
+ operation: registration.name,
252
+ resultPresentations: new Map(
253
+ [...mutation.edits.keys()].map((source) => [
254
+ source,
255
+ majorAnchorSources.has(source) ? "major-anchor" : "plain",
256
+ ]),
257
+ ),
258
+ },
259
+ };
260
+ }),
261
+ );
262
+ for (const [index, result] of planned.entries()) {
263
+ const entry = requiredValue(parameters.edits[index]);
264
+ const { callId, op: _op, ...input } = entry;
265
+ const registration = requiredValue(registrations.get(entry.op));
266
+ const sources = mutationSources(registration, input);
267
+ try {
268
+ if (result.status === "rejected") throw result.reason;
269
+ const mutation = result.value.mutation;
270
+ for (const [source, edit] of mutation.edits) {
271
+ if (
272
+ edit.changes.some((change) =>
273
+ (changes.get(source) ?? []).some((prior) => textChangesConflict(prior, change)),
274
+ )
275
+ ) {
276
+ throw new Error(`Text mutation ${callId} overlaps an earlier successful mutation.`);
277
+ }
278
+ }
279
+ mutations.push(result.value);
280
+ for (const [source, edit] of mutation.edits)
281
+ changes.set(source, [...(changes.get(source) ?? []), ...edit.changes]);
282
+ } catch (error) {
283
+ if (parameters.failureMode === "abort") throw error;
284
+ failures.push({
285
+ callId,
286
+ source: sources.get(registration.source.field) ?? "",
287
+ error,
288
+ effect: "not-applied",
289
+ });
290
+ }
291
+ }
292
+ return { changes, mutations, failures };
293
+ }
172
294
  export async function executeRegisteredTextBatch(
173
295
  core: TextEditorCore,
174
296
  registrations: ReadonlyMap<string, AnyTextMutationToolRegistration>,
@@ -178,6 +300,7 @@ export async function executeRegisteredTextBatch(
178
300
  context: ExtensionContext,
179
301
  reporter: BatchExecutionReporter,
180
302
  renderArguments: (toolCallId: string, patch: Readonly<Record<string, unknown>>) => void,
303
+ planned?: PlannedTextBatch,
181
304
  ): Promise<AgentToolResult<TextBatchDetails>> {
182
305
  const prepared = parameters.edits.map((entry) => {
183
306
  const registration = registrations.get(entry.op);
@@ -192,7 +315,7 @@ export async function executeRegisteredTextBatch(
192
315
  const intents = new Set(prepared.map(({ registration }) => registration.intent ?? "edit"));
193
316
  const intent: TextEditIntent =
194
317
  intents.size > 1 ? "mixed" : (intents.values().next().value ?? "edit");
195
- const requests = new Map<string, { source: string; read: true; allowReadFailure?: true }>();
318
+ const requests = new Map<string, TextResourceEditRequest>();
196
319
 
197
320
  for (const item of prepared) {
198
321
  for (const source of item.sources.values()) {
@@ -201,6 +324,9 @@ export async function executeRegisteredTextBatch(
201
324
  item.registration.name === "write" &&
202
325
  source === item.sources.get(item.registration.source.field);
203
326
  requests.set(source, {
327
+ ...(parameters.expectedExistence?.has(source) && {
328
+ expectedExistence: parameters.expectedExistence.get(source),
329
+ }),
204
330
  source,
205
331
  read: true,
206
332
  ...((current?.allowReadFailure === true || isAllowReadFailure) && {
@@ -219,144 +345,23 @@ export async function executeRegisteredTextBatch(
219
345
  [...requests.values()],
220
346
  { cwd: context.cwd, intent, ...(signal !== undefined && { signal }) },
221
347
  async (texts, resolveAnchor) => {
222
- const mutations: PlannedTextBatch["mutations"][number][] = [];
223
- const failures: PlannedTextBatch["failures"][number][] = [];
224
- const changes = new Map<string, TextChange[]>();
225
- if (parameters.expectedContent !== undefined) {
226
- for (const [source, expected] of parameters.expectedContent) {
227
- if (!texts.has(source)) {
228
- throw new Error(`Snapshot source ${source} is not part of this edit batch.`);
229
- }
230
- if (texts.get(source) !== expected) {
231
- throw new Error(`Snapshot source ${source} changed before the edit batch.`);
232
- }
348
+ for (const [source, expected] of parameters.expectedContent ?? []) {
349
+ if (!texts.has(source) || texts.get(source) !== expected) {
350
+ throw new Error(`Snapshot source ${source} changed before the edit batch.`);
233
351
  }
234
352
  }
235
-
236
- for (const item of prepared) {
237
- const sourceFor = (field: string): string => {
238
- const source = item.sources.get(field);
239
-
240
- if (source === undefined) {
241
- throw new Error(`Unknown mutation source field ${field}`);
242
- }
243
-
244
- return source;
245
- };
246
- const documentFor = (source: string): TextChangeDocument => {
247
- const text = texts.get(source);
248
-
249
- if (text === undefined) {
250
- throw new Error(`Unknown mutation resource ${source}`);
251
- }
252
-
253
- return new TextChangeDocument(text);
254
- };
255
-
256
- const majorAnchorSources = new Set<string>();
257
- const publishAnchorRenderPatch = (
258
- field: string,
259
- state: ToolCallAnchorRenderState,
260
- ): void => {
261
- renderArguments(item.callId, {
262
- [TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH]: { [field]: state },
263
- });
264
- };
265
- const resolveAnchors = async (field: string) => {
266
- const descriptor = (item.registration.anchors ?? []).find(
267
- (anchor) => anchor.field === field,
268
- );
269
- const value = item.input[field];
270
- const source =
271
- descriptor === undefined ? undefined : item.sources.get(descriptor.sourceField);
272
-
273
- if (descriptor === undefined || typeof value !== "string" || source === undefined) {
274
- publishAnchorRenderPatch(field, { kind: "failed" });
275
- throw new Error(`Unable to resolve mutation anchor ${field}`);
276
- }
277
-
278
- try {
279
- const anchor = await resolveAnchor(source, value, descriptor.kinds);
280
- if (resolvedTextAnchorType(anchor) === "major") {
281
- majorAnchorSources.add(source);
282
- }
283
- const rendered = renderTextAnchor(anchor, value, { source, anchor });
284
- publishAnchorRenderPatch(field, {
285
- kind: "resolved",
286
- full: rendered.full,
287
- compact: rendered.compact,
288
- resolverId: rendered.resolverId,
289
- });
290
- return new Map([[source, anchor]]);
291
- } catch (error) {
292
- publishAnchorRenderPatch(field, { kind: "failed" });
293
- throw contextualizeTextMutationAnchorError(
294
- error,
295
- item.registration.name,
296
- field,
297
- source,
298
- value,
299
- );
300
- }
301
- };
302
- try {
303
- const mutationContext = {
304
- cwd: context.cwd,
305
- ...(signal !== undefined && { signal }),
306
- sourceDocument: documentFor(sourceFor(item.registration.source.field)),
307
- sourceFor,
308
- documentFor,
309
- targetDocument: (field: string) => documentFor(sourceFor(field)),
310
- resolveAnchors,
311
- async resolveAnchor(field: string) {
312
- const resolved = await resolveAnchors(field);
313
- return requiredValue(resolved.values().next().value);
314
- },
315
- };
316
- await preflightMutationAnchors(item.registration, item.input, mutationContext);
317
- const mutation = await item.registration.mutate(mutationContext, item.input);
318
- for (const [source, edit] of mutation.edits) {
319
- const existing = changes.get(source) ?? [];
320
- if (
321
- edit.changes.some((change) =>
322
- existing.some((prior) => textChangesConflict(prior, change)),
323
- )
324
- ) {
325
- throw new Error(
326
- `Text mutation ${item.callId} overlaps an earlier successful mutation.`,
327
- );
328
- }
329
- }
330
- mutations.push({
331
- callId: item.callId,
332
- mutation: {
333
- ...mutation,
334
-
335
- operation: item.registration.name,
336
- resultPresentations: new Map(
337
- [...mutation.edits.keys()].map((source) => [
338
- source,
339
- majorAnchorSources.has(source) ? "major-anchor" : "plain",
340
- ]),
341
- ),
342
- },
343
- });
344
-
345
- for (const [source, edit] of mutation.edits) {
346
- changes.set(source, [...(changes.get(source) ?? []), ...edit.changes]);
347
- }
348
- } catch (error) {
349
- if (parameters.failureMode === "abort") throw error;
350
- failures.push({
351
- callId: item.callId,
352
- source: item.sources.get(item.registration.source.field) ?? "",
353
- error,
354
- effect: "not-applied",
355
- });
356
- }
357
- }
358
-
359
- return { changes, result: { mutations, failures } };
353
+ const result =
354
+ planned ??
355
+ (await planRegisteredTextBatch(
356
+ registrations,
357
+ parameters,
358
+ texts,
359
+ resolveAnchor,
360
+ context,
361
+ signal,
362
+ renderArguments,
363
+ ));
364
+ return { changes: result.changes, result };
360
365
  },
361
366
  );
362
367
  } catch (error) {
@@ -10,6 +10,8 @@ export interface TextBatchParams {
10
10
  readonly edits: readonly TextBatchEntry[];
11
11
  /** Optional whole-file revisions that every affected source must still match. */
12
12
  readonly expectedContent?: ReadonlyMap<string, string>;
13
+ /** Reject creation or deletion by another writer while a batch is pending. */
14
+ readonly expectedExistence?: ReadonlyMap<string, boolean>;
13
15
  /** Abort the complete plan when any entry is invalid instead of applying valid peers. */
14
16
  readonly failureMode?: "continue" | "abort";
15
17
  }