pi-agent-ide 0.2.2 → 0.4.0

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 (403) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +13 -8
  3. package/dist/chunk-3SE372WC.js +3 -0
  4. package/dist/chunk-5MSNYFDE.js +1 -0
  5. package/dist/chunk-5VSE5X5R.js +2 -0
  6. package/dist/chunk-6DZA4CLO.js +4 -0
  7. package/dist/chunk-6EYWFBNG.js +0 -0
  8. package/dist/{chunk-ORAPGW7W.js → chunk-72EEL2DW.js} +1 -1
  9. package/dist/chunk-7JYQMAEL.js +14 -0
  10. package/dist/{chunk-T2RPMEM2.js → chunk-7UGNGK7Y.js} +1 -1
  11. package/dist/{chunk-STUZZM5B.js → chunk-AADJ2KIB.js} +1 -1
  12. package/dist/{chunk-XF5PVZOS.js → chunk-B5KB2I7J.js} +1 -1
  13. package/dist/chunk-DQF5QMJ2.js +1 -0
  14. package/dist/chunk-EJ5OACQM.js +1 -0
  15. package/dist/chunk-GFW5QPQV.js +2 -0
  16. package/dist/{chunk-LQYZG62K.js → chunk-GUTQ3PWL.js} +1 -1
  17. package/dist/chunk-HGPUI7F3.js +1 -0
  18. package/dist/{chunk-OBWZ5RYN.js → chunk-HKMBQLEK.js} +1 -1
  19. package/dist/chunk-ITSNK5YG.js +7 -0
  20. package/dist/chunk-J34VKQGJ.js +1 -0
  21. package/dist/chunk-KAB3AYA2.js +1 -0
  22. package/dist/{chunk-76WHES5H.js → chunk-M5L42DWE.js} +5 -5
  23. package/dist/chunk-M5MJP7Z2.js +1 -0
  24. package/dist/chunk-NMFQGKPE.js +2 -0
  25. package/dist/chunk-NTYXZ3EL.js +3 -0
  26. package/dist/{chunk-P6T3Q7LB.js → chunk-QDST6VIU.js} +1 -1
  27. package/dist/chunk-ROXXK6TW.js +0 -0
  28. package/dist/{chunk-WNMGUALD.js → chunk-TI5GMJ7Q.js} +1 -1
  29. package/dist/{chunk-4ZTEPMJO.js → chunk-TPIHQYK2.js} +1 -1
  30. package/dist/chunk-XSTHESNR.js +25 -0
  31. package/dist/{chunk-THSCUT2L.js → chunk-Y7ZMR4LT.js} +1 -1
  32. package/dist/chunk-YHADTHQM.js +1 -0
  33. package/dist/{chunk-KZBAJFCV.js → chunk-Z3VC3S2T.js} +1 -1
  34. package/dist/{chunk-ZXN3TWWW.js → chunk-ZM4L5AGN.js} +1 -1
  35. package/dist/{chunk-E2RESHYR.js → chunk-ZTYWHL2F.js} +1 -1
  36. package/dist/entry-0.js +1 -1
  37. package/dist/entry-1.js +1 -1
  38. package/dist/entry-10.js +1 -1
  39. package/dist/entry-12.js +1 -1
  40. package/dist/entry-13.js +1 -1
  41. package/dist/entry-14.js +1 -1
  42. package/dist/entry-2.js +1 -1
  43. package/dist/entry-21.js +1 -1
  44. package/dist/entry-24.js +1 -1
  45. package/dist/entry-25.js +1 -1
  46. package/dist/entry-26.js +10 -5
  47. package/dist/entry-28.js +1 -1
  48. package/dist/entry-29.js +1 -1
  49. package/dist/entry-31.js +3 -3
  50. package/dist/entry-32.js +6 -5
  51. package/dist/entry-36.js +1 -1
  52. package/dist/entry-37.js +1 -1
  53. package/dist/entry-38.js +1 -1
  54. package/dist/entry-39.js +1 -1
  55. package/dist/entry-4.js +1 -1
  56. package/dist/entry-40.js +12 -8
  57. package/dist/entry-42.js +1 -1
  58. package/dist/entry-43.js +1 -1
  59. package/dist/entry-44.js +1 -1
  60. package/dist/entry-45.js +4 -4
  61. package/dist/entry-46.js +10 -10
  62. package/dist/entry-47.js +1 -1
  63. package/dist/entry-48.js +1 -1
  64. package/dist/entry-49.js +1 -1
  65. package/dist/entry-50.js +1 -1
  66. package/dist/entry-51.js +1 -1
  67. package/dist/entry-52.js +1 -1
  68. package/dist/entry-53.js +1 -1
  69. package/dist/entry-54.js +1 -0
  70. package/dist/entry-55.js +0 -1
  71. package/dist/entry-56.js +1 -0
  72. package/dist/entry-57.js +0 -1
  73. package/dist/entry-58.js +1 -1
  74. package/dist/entry-59.js +1 -1
  75. package/dist/entry-60.js +1 -1
  76. package/dist/entry-61.js +1 -1
  77. package/dist/entry-62.js +1 -1
  78. package/dist/entry-63.js +1 -0
  79. package/dist/entry-64.js +0 -1
  80. package/dist/entry-65.js +1 -0
  81. package/dist/entry-66.js +0 -1
  82. package/dist/entry-67.js +1 -1
  83. package/dist/entry-68.js +1 -1
  84. package/dist/entry-69.js +1 -59
  85. package/dist/entry-70.js +123 -4
  86. package/dist/entry-71.js +30 -1
  87. package/dist/entry-72.js +2 -29
  88. package/dist/entry-73.js +1 -2
  89. package/dist/entry-74.js +1 -1
  90. package/dist/entry-75.js +1 -1
  91. package/dist/entry-76.js +3 -1
  92. package/dist/entry-77.js +1 -3
  93. package/dist/entry-78.js +1 -1
  94. package/dist/entry-79.js +1 -1
  95. package/dist/pi-agent-ide.js +3 -2
  96. package/docs/configuration.md +32 -11
  97. package/docs/tools.md +17 -0
  98. package/node_modules/pi-agent-doctor/package.json +1 -1
  99. package/node_modules/pi-agent-filesystem/package.json +6 -6
  100. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  101. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  102. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  103. package/node_modules/pi-agent-ide-ast/package.json +9 -9
  104. package/node_modules/pi-agent-ide-ast/src/extension.ts +4 -3
  105. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +68 -45
  106. package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +8 -1
  107. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +83 -5
  108. package/node_modules/pi-agent-ide-changes/index.ts +21 -5
  109. package/node_modules/pi-agent-ide-changes/package.json +6 -6
  110. package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
  111. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +4 -2
  112. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  113. package/node_modules/pi-agent-ide-formatter/src/formatter.ts +26 -8
  114. package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -1
  115. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  116. package/node_modules/pi-agent-ide-lint/index.ts +46 -17
  117. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  118. package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -1
  119. package/node_modules/pi-agent-ide-lsp/index.ts +126 -8
  120. package/node_modules/pi-agent-ide-lsp/package.json +9 -8
  121. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
  122. package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +18 -3
  123. package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +4 -0
  124. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
  125. package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
  126. package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
  127. package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
  128. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
  129. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
  130. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
  131. package/node_modules/pi-agent-image/package.json +2 -2
  132. package/node_modules/pi-agent-invariant/package.json +1 -1
  133. package/node_modules/pi-agent-pdf/package.json +2 -2
  134. package/node_modules/pi-agent-read/package.json +6 -6
  135. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  136. package/node_modules/pi-agent-read/src/api/read-parameters.ts +29 -0
  137. package/node_modules/pi-agent-read/src/api/tools/read.ts +73 -1
  138. package/node_modules/pi-agent-read/src/core/read-core.ts +26 -2
  139. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
  140. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
  141. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +64 -14
  142. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
  143. package/node_modules/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
  144. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +73 -44
  145. package/node_modules/pi-agent-resource/package.json +1 -1
  146. package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
  147. package/node_modules/pi-agent-resource/src/resource.ts +2 -0
  148. package/node_modules/pi-agent-search/package.json +3 -3
  149. package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  150. package/node_modules/pi-agent-search/src/api/search-parameters.ts +25 -0
  151. package/node_modules/pi-agent-search/src/api/search.ts +55 -1
  152. package/node_modules/pi-agent-search/src/core/extension.ts +2 -23
  153. package/node_modules/pi-agent-search/src/core/search-core.ts +28 -3
  154. package/node_modules/pi-agent-search-text/index.ts +44 -4
  155. package/node_modules/pi-agent-search-text/package.json +6 -6
  156. package/node_modules/pi-agent-search-text/src/search-session.ts +65 -25
  157. package/node_modules/pi-agent-text/package.json +2 -2
  158. package/node_modules/pi-agent-text/src/text-document.ts +5 -0
  159. package/node_modules/pi-agent-text/src/text-target.ts +4 -0
  160. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  161. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  162. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  163. package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
  164. package/node_modules/pi-agent-text-editor/index.ts +1 -3
  165. package/node_modules/pi-agent-text-editor/package.json +34 -24
  166. package/node_modules/pi-agent-text-editor/runtime/entry-69.js +0 -1
  167. package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
  168. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
  169. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
  170. package/node_modules/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
  171. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
  172. package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +3 -0
  173. package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  174. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
  175. package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
  176. package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
  177. package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
  178. package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
  179. package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +216 -0
  180. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
  181. package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
  182. package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
  183. package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +133 -0
  184. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
  185. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
  186. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
  187. package/node_modules/pi-agent-text-editor/src/core/extension.ts +6 -0
  188. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
  189. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +153 -0
  190. package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
  191. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +1 -0
  192. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +6 -1
  193. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
  194. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
  195. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +17 -0
  196. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +212 -51
  197. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +273 -11
  198. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +1 -1
  199. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +1 -1
  200. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
  201. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +1 -1
  202. package/node_modules/pi-agent-text-editor-renderer/index.ts +88 -1
  203. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  204. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +42 -25
  205. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +20 -12
  206. package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
  207. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  208. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  209. package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +1 -0
  210. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  211. package/node_modules/pi-agent-web/package.json +7 -7
  212. package/node_modules/pi-agent-web/runtime/entry-75.js +2 -0
  213. package/node_modules/pi-agent-web/src/browser-loader.ts +1 -0
  214. package/node_modules/pi-agent-web-html/package.json +3 -3
  215. package/node_modules/pi-agent-web-image/package.json +4 -4
  216. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  217. package/node_modules/pi-agent-web-text/package.json +4 -4
  218. package/package.json +41 -38
  219. package/src/api/plugin-protocol.ts +10 -2
  220. package/src/api/tool-config.ts +73 -2
  221. package/src/code-view/diagnostic-view.ts +22 -3
  222. package/src/composite/builtin-extensions.ts +10 -15
  223. package/src/composite/extensions-config.ts +59 -0
  224. package/src/composite/feature-flags.ts +32 -0
  225. package/src/composite/module-labels.ts +59 -0
  226. package/src/composite/module-settings-store.ts +60 -0
  227. package/src/composite/module-settings.ts +162 -0
  228. package/src/composite/preferences.ts +26 -0
  229. package/src/composite/selection.ts +4 -4
  230. package/src/composite/settings-panel.ts +103 -0
  231. package/src/core/diagnostic-delivery.ts +29 -0
  232. package/src/core/diagnostic-entry.ts +51 -3
  233. package/src/core/diagnostic-store.ts +56 -5
  234. package/src/core/extension.ts +34 -33
  235. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
  236. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  237. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  238. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  239. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  240. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  241. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +2 -0
  242. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  243. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  244. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  245. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +2 -0
  246. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/browser-loader.ts +1 -0
  247. package/src/extensions/pi-agent-read/package.json +6 -6
  248. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  249. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +29 -0
  250. package/src/extensions/pi-agent-read/src/api/tools/read.ts +73 -1
  251. package/src/extensions/pi-agent-read/src/core/read-core.ts +26 -2
  252. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
  253. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
  254. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +64 -14
  255. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
  256. package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
  257. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +73 -44
  258. package/src/extensions/pi-agent-search/package.json +3 -3
  259. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +44 -4
  260. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
  261. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +65 -25
  262. package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  263. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +25 -0
  264. package/src/extensions/pi-agent-search/src/api/search.ts +55 -1
  265. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -23
  266. package/src/extensions/pi-agent-search/src/core/search-core.ts +28 -3
  267. package/src/extensions/pi-agent-text-editor/index.ts +1 -3
  268. package/src/extensions/pi-agent-text-editor/package.json +34 -24
  269. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  270. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  271. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  272. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
  273. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +88 -1
  274. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  275. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +42 -25
  276. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +20 -12
  277. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
  278. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  279. package/src/extensions/pi-agent-text-editor/runtime/entry-69.js +0 -1
  280. package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +2 -0
  281. package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
  282. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
  283. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
  284. package/src/extensions/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
  285. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
  286. package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +3 -0
  287. package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  288. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
  289. package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
  290. package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
  291. package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
  292. package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
  293. package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +216 -0
  294. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
  295. package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
  296. package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
  297. package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +133 -0
  298. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
  299. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
  300. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
  301. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +6 -0
  302. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
  303. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +153 -0
  304. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
  305. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +1 -0
  306. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +6 -1
  307. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
  308. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
  309. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +17 -0
  310. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +212 -51
  311. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +273 -11
  312. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +1 -1
  313. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +1 -1
  314. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
  315. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +1 -1
  316. package/src/pi-agent-ide.ts +43 -8
  317. package/src/plugins/pi-agent-ide-ast/package.json +9 -9
  318. package/src/plugins/pi-agent-ide-ast/src/extension.ts +4 -3
  319. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +68 -45
  320. package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +8 -1
  321. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +83 -5
  322. package/src/plugins/pi-agent-ide-changes/index.ts +21 -5
  323. package/src/plugins/pi-agent-ide-changes/package.json +6 -6
  324. package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
  325. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +4 -2
  326. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +62 -11
  327. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  328. package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +26 -8
  329. package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -1
  330. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  331. package/src/plugins/pi-agent-ide-lint/index.ts +46 -17
  332. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  333. package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -1
  334. package/src/plugins/pi-agent-ide-lsp/index.ts +126 -8
  335. package/src/plugins/pi-agent-ide-lsp/package.json +9 -8
  336. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
  337. package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +18 -3
  338. package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +4 -0
  339. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
  340. package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
  341. package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
  342. package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
  343. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
  344. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
  345. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
  346. package/src/plugins/pi-agent-ide-terminal/index.ts +34 -0
  347. package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +238 -0
  348. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +461 -0
  349. package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +127 -0
  350. package/src/plugins/pi-agent-ide-terminal/src/search.ts +159 -0
  351. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +529 -0
  352. package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +56 -0
  353. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +157 -0
  354. package/src/plugins/pi-agent-ide-terminal/src/types.ts +66 -0
  355. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +336 -0
  356. package/src/post-edit/gate.ts +15 -2
  357. package/dist/chunk-4U6KGABH.js +0 -1
  358. package/dist/chunk-6ACQQBUY.js +0 -7
  359. package/dist/chunk-GFWDXTOB.js +0 -4
  360. package/dist/chunk-JASLOB2X.js +0 -1
  361. package/dist/chunk-JJVXUL5U.js +0 -2
  362. package/dist/chunk-KCEOTU5Z.js +0 -3
  363. package/dist/chunk-KVGQG43U.js +0 -1
  364. package/dist/chunk-QJFRAMK7.js +0 -2
  365. package/dist/chunk-RAZOACDD.js +0 -2
  366. package/dist/chunk-RIGRP3FD.js +0 -1
  367. package/dist/chunk-VCCMVQXU.js +0 -1
  368. package/dist/chunk-X6MPU7UO.js +0 -3
  369. package/dist/chunk-YPHXLAQF.js +0 -1
  370. package/dist/entry-80.js +0 -1
  371. package/node_modules/pi-agent-text-editor/src/core/tool-description.ts +0 -14
  372. package/node_modules/pi-agent-text-editor-argument-order/index.ts +0 -26
  373. package/node_modules/pi-agent-text-editor-argument-order/package.json +0 -16
  374. package/node_modules/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
  375. package/node_modules/pi-agent-text-editor-overwrite/index.ts +0 -365
  376. package/node_modules/pi-agent-text-editor-overwrite/package.json +0 -17
  377. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
  378. package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +0 -1
  379. package/node_modules/pi-agent-web-text/runtime/entry-80.js +0 -2
  380. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +0 -2
  381. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
  382. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/index.ts +0 -26
  383. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +0 -16
  384. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-70.js +0 -2
  385. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
  386. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +0 -365
  387. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +0 -17
  388. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
  389. package/src/extensions/pi-agent-text-editor/src/core/tool-description.ts +0 -14
  390. /package/dist/{chunk-3H2EU7VQ.js → chunk-4U2GUKNJ.js} +0 -0
  391. /package/node_modules/{pi-agent-text-editor-argument-order → pi-agent-text-editor}/runtime/entry-70.js +0 -0
  392. /package/node_modules/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
  393. /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
  394. /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-74.js +0 -0
  395. /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-76.js +0 -0
  396. /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
  397. /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
  398. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
  399. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
  400. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
  401. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
  402. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
  403. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
@@ -62,13 +62,65 @@ export interface SearchActionRegistration {
62
62
  execute(reference: string, input: unknown, context: SearchContext): Promise<unknown>;
63
63
  }
64
64
 
65
+ /** Full resolver data plus registered selection details, separate from rendered output. */
66
+ export interface SearchScriptData {
67
+ readonly resolverId: string;
68
+ readonly data: unknown;
69
+ readonly details: unknown;
70
+ }
71
+
72
+ /** A search execution with optional data for script callers. */
73
+ export interface SearchToolResult extends AgentToolResult<SearchToolDetails> {
74
+ readonly script?: SearchScriptData;
75
+ }
76
+ /** Exact text ranges discovered by any search backend. Columns are zero-based UTF-16 offsets. */
77
+ export interface SearchSelectionMatch {
78
+ readonly source: string;
79
+ readonly lineNumber: number;
80
+ readonly endLineNumber?: number;
81
+ readonly startColumn: number;
82
+ readonly endColumn: number;
83
+ readonly matchedText: string;
84
+ readonly lineText: string;
85
+ }
86
+ export interface SearchSelectionSnapshot {
87
+ readonly matches: readonly SearchSelectionMatch[];
88
+ readonly complete: boolean;
89
+ readonly notices?: readonly string[];
90
+ }
91
+ /** Keep the original backend when refreshing an all-selection or observing an edit. */
92
+ export interface SearchSelectionRegistration extends SearchSelectionSnapshot {
93
+ readonly request: SearchRequest;
94
+ readonly refresh: (signal?: AbortSignal) => Promise<SearchSelectionSnapshot>;
95
+ }
96
+ export interface RegisteredSearchSelection {
97
+ readonly id: string;
98
+ readonly matches: readonly SearchSelectionMatch[];
99
+ readonly complete: boolean;
100
+ }
101
+ export type SearchSelectionProvider = (
102
+ selection: SearchSelectionRegistration,
103
+ context: SearchContext,
104
+ ) => Promise<RegisteredSearchSelection>;
65
105
  export interface SearchPluginApi {
66
106
  addResolver(registration: SearchResolverRegistration): void;
107
+ /** Register the one shared SEARCH reference store. */
108
+ addSelectionProvider(provider: SearchSelectionProvider): void;
109
+ /** Register exact ranges with the shared store, retaining backend refresh behavior. */
110
+ registerSelection(
111
+ selection: SearchSelectionRegistration,
112
+ context: SearchContext,
113
+ ): Promise<RegisteredSearchSelection>;
67
114
  addAction(registration: SearchActionRegistration): void;
68
115
  describe(description: SearchDescriptionSource): void;
69
116
  /** Add an operational guideline while this search plugin is active. */
70
117
  addPromptGuideline(guideline: SearchDescriptionSource): void;
71
- search(request: SearchRequest, context: SearchContext): Promise<AgentToolResult<unknown>>;
118
+ /** Execute configured resolvers and register references before returning script data. */
119
+ search(
120
+ request: SearchRequest,
121
+ context: SearchContext,
122
+ audience?: "agent" | "script",
123
+ ): Promise<SearchToolResult>;
72
124
  runAction(request: SearchActionRequest, context: SearchContext): Promise<unknown>;
73
125
  }
74
126
 
@@ -87,3 +139,5 @@ export interface SearchToolDetails {
87
139
  readonly cause?: unknown;
88
140
  };
89
141
  }
142
+
143
+ export { searchSchema } from "#src/api/search-parameters.js";
@@ -17,7 +17,7 @@ import {
17
17
  ToolCallInterceptionRenderStore,
18
18
  withToolCallInterceptionRendering,
19
19
  } from "pi-agent-tool-call-interception";
20
- import { type Static, Type } from "typebox";
20
+ import type { Static } from "typebox";
21
21
 
22
22
  import {
23
23
  isSearchPluginRegistrationRequest,
@@ -33,28 +33,7 @@ import { runWithSearchTimeout } from "#src/core/search-timeout.js";
33
33
 
34
34
  import type { SearchToolDetails } from "#src/api/search.js";
35
35
 
36
- const searchSchema = Type.Object(
37
- {
38
- query: Type.String({
39
- minLength: 1,
40
- description:
41
- "Text to find, a Boolean expression, or a prefixed query described below, such as files:*.ts. Quote text to keep it literal, or use regex:<pattern> for regular-expression matching.",
42
- }),
43
- path: Type.Optional(
44
- Type.String({ description: "Optional file or directory scope for local search" }),
45
- ),
46
- include: Type.Optional(Type.String({ description: "Optional include glob for local search" })),
47
- exclude: Type.Optional(Type.String({ description: "Optional exclude glob for local search" })),
48
- caseSensitive: Type.Optional(
49
- Type.Boolean({ description: "Match letter case in local search" }),
50
- ),
51
- wholeWord: Type.Optional(Type.Boolean({ description: "Match complete words in local search" })),
52
- limit: Type.Optional(
53
- Type.Integer({ minimum: 1, maximum: 1000, description: "Maximum results (default 100)" }),
54
- ),
55
- },
56
- { additionalProperties: false },
57
- );
36
+ import { searchSchema } from "#src/api/search-parameters.js";
58
37
 
59
38
  /** Arguments accepted by the search tool. */
60
39
  export type SearchParameters = Static<typeof searchSchema>;
@@ -3,6 +3,7 @@ import { withBlockedToolResult } from "pi-agent-tool-call-interception";
3
3
  import type { SearchPlugin } from "#src/api/plugin-protocol.js";
4
4
  import type {
5
5
  SearchActionRegistration,
6
+ SearchSelectionProvider,
6
7
  SearchContext,
7
8
  SearchDescriptionSource,
8
9
  SearchPluginApi,
@@ -10,6 +11,7 @@ import type {
10
11
  SearchResolutionAttempt,
11
12
  SearchResolverRegistration,
12
13
  SearchToolDetails,
14
+ SearchToolResult,
13
15
  } from "#src/api/search.js";
14
16
  import type { AgentToolResult } from "@earendil-works/pi-coding-agent";
15
17
 
@@ -25,7 +27,8 @@ export interface SearchCore {
25
27
  execute(
26
28
  request: SearchRequest,
27
29
  context: SearchContext,
28
- ): Promise<AgentToolResult<SearchToolDetails>>;
30
+ audience?: "agent" | "script",
31
+ ): Promise<SearchToolResult>;
29
32
  runAction(
30
33
  reference: string,
31
34
  capability: string,
@@ -41,6 +44,7 @@ export interface SearchCore {
41
44
 
42
45
  export function createSearchCore(): SearchCore {
43
46
  const resolvers: RegisteredResolver[] = [];
47
+ let selectionProvider: SearchSelectionProvider | undefined;
44
48
  const actions = new Map<string, SearchActionRegistration>();
45
49
  const promptGuidelines = new Map<string, SearchDescriptionSource[]>();
46
50
  const descriptions = new Map<string, SearchDescriptionSource>();
@@ -62,9 +66,22 @@ export function createSearchCore(): SearchCore {
62
66
  const ready = queue.then(async () => {
63
67
  const draftResolvers: SearchResolverRegistration[] = [];
64
68
  const draftActions: SearchActionRegistration[] = [];
69
+ let draftSelectionProvider: SearchSelectionProvider | undefined;
65
70
  let draftDescription: SearchDescriptionSource | undefined;
66
71
  const draftPromptGuidelines: SearchDescriptionSource[] = [];
67
72
  const api: SearchPluginApi = {
73
+ addSelectionProvider(provider) {
74
+ if (draftSelectionProvider !== undefined || selectionProvider !== undefined)
75
+ throw new Error("Search selection provider is already registered");
76
+ draftSelectionProvider = provider;
77
+ },
78
+ registerSelection(selection, context) {
79
+ if (selectionProvider === undefined)
80
+ throw new Error(
81
+ "Search selections are unavailable. Enable the shared search selection plugin.",
82
+ );
83
+ return selectionProvider(selection, context);
84
+ },
68
85
  addResolver(registration): void {
69
86
  assertResolver(registration);
70
87
  draftResolvers.push(registration);
@@ -83,7 +100,7 @@ export function createSearchCore(): SearchCore {
83
100
  addPromptGuideline(guideline): void {
84
101
  draftPromptGuidelines.push(normalizeDescriptionSource(guideline));
85
102
  },
86
- search: (request, context) => core.execute(request, context),
103
+ search: (request, context, audience) => core.execute(request, context, audience),
87
104
  runAction(request, context): Promise<unknown> {
88
105
  return core.runAction(
89
106
  request.reference,
@@ -123,6 +140,7 @@ export function createSearchCore(): SearchCore {
123
140
  for (const registration of draftResolvers) {
124
141
  resolvers.push({ pluginId: plugin.id, registration, order: resolvers.length });
125
142
  }
143
+ if (draftSelectionProvider !== undefined) selectionProvider = draftSelectionProvider;
126
144
 
127
145
  for (const action of draftActions) {
128
146
  actions.set(actionKey(action.resolverId, action.capability), action);
@@ -145,7 +163,7 @@ export function createSearchCore(): SearchCore {
145
163
  async waitForPendingPlugins(): Promise<void> {
146
164
  await Promise.all(plugins.values());
147
165
  },
148
- async execute(request, context): Promise<AgentToolResult<SearchToolDetails>> {
166
+ async execute(request, context, audience = "agent"): Promise<SearchToolResult> {
149
167
  if (request.query.trim().length === 0) {
150
168
  return failure("INVALID_REQUEST", "Search query must not be empty");
151
169
  }
@@ -223,6 +241,13 @@ export function createSearchCore(): SearchCore {
223
241
  ]
224
242
  : formatted.content,
225
243
  details: { resolverId: resolver.id, payload: formatted.details },
244
+ ...(audience === "script" && {
245
+ script: {
246
+ resolverId: resolver.id,
247
+ data: attempt.payload,
248
+ details: formatted.details,
249
+ },
250
+ }),
226
251
  ...(formatted.usage !== undefined && { usage: formatted.usage }),
227
252
  };
228
253
  } catch (error) {
@@ -9,9 +9,7 @@ export default async function registerTextEditor(pi: ExtensionAPI): Promise<void
9
9
  const core = await registerTextEditorCore(pi);
10
10
  registerBuiltinEditFilter(pi);
11
11
 
12
- if (!process.argv.includes("--old-tools")) {
13
- registerTextEditorTools(pi, core);
14
- }
12
+ registerTextEditorTools(pi, core);
15
13
 
16
14
  registerTextEditBatching(pi, core);
17
15
  }
@@ -1,87 +1,97 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "imports": {
6
- "#src/*": "./src/*",
7
- "#overwrite/*": "./plugins/pi-agent-text-editor-overwrite/*"
6
+ "#src/*": "./src/*"
8
7
  },
9
8
  "exports": {
9
+ "./api/apply-renderer": {
10
+ "types": "./src/api/apply-renderer.ts",
11
+ "default": "./runtime/entry-54.js"
12
+ },
10
13
  "./api/anchor-inspection": {
11
14
  "types": "./src/api/anchor-inspection.ts",
12
- "default": "./runtime/entry-54.js"
15
+ "default": "./runtime/entry-55.js"
13
16
  },
14
17
  "./api/connect-plugin": {
15
18
  "types": "./src/api/connect-plugin.ts",
16
- "default": "./runtime/entry-55.js"
19
+ "default": "./runtime/entry-56.js"
17
20
  },
18
21
  "./api/edit-completion": {
19
22
  "types": "./src/api/edit-completion.ts",
20
- "default": "./runtime/entry-56.js"
23
+ "default": "./runtime/entry-57.js"
21
24
  },
22
25
  "./api/edit-pipeline": {
23
26
  "types": "./src/api/edit-pipeline.ts",
24
- "default": "./runtime/entry-57.js"
27
+ "default": "./runtime/entry-58.js"
25
28
  },
26
29
  "./api/plugin-protocol": {
27
30
  "types": "./src/api/plugin-protocol.ts",
28
- "default": "./runtime/entry-58.js"
31
+ "default": "./runtime/entry-59.js"
29
32
  },
30
33
  "./api/stale-anchor-message": {
31
34
  "types": "./src/api/stale-anchor-message.ts",
32
- "default": "./runtime/entry-59.js"
35
+ "default": "./runtime/entry-60.js"
33
36
  },
34
37
  "./api/text-selection-anchor": {
35
38
  "types": "./src/api/text-selection-anchor.ts",
36
- "default": "./runtime/entry-60.js"
39
+ "default": "./runtime/entry-61.js"
37
40
  },
38
41
  "./api/post-edit": {
39
42
  "types": "./src/api/post-edit.ts",
40
- "default": "./runtime/entry-61.js"
43
+ "default": "./runtime/entry-62.js"
41
44
  },
42
45
  "./api/mutation-result": {
43
46
  "types": "./src/api/mutation-result.ts",
44
- "default": "./runtime/entry-62.js"
47
+ "default": "./runtime/entry-63.js"
45
48
  },
46
49
  "./api/mutation-guard": {
47
50
  "types": "./src/api/mutation-guard.ts",
48
- "default": "./runtime/entry-63.js"
51
+ "default": "./runtime/entry-64.js"
49
52
  },
50
53
  "./api/mutation-tool": {
51
54
  "types": "./src/api/mutation-tool.ts",
52
- "default": "./runtime/entry-64.js"
55
+ "default": "./runtime/entry-65.js"
53
56
  },
54
57
  "./api/mutation-preview": {
55
58
  "types": "./src/api/mutation-preview.ts",
56
- "default": "./runtime/entry-65.js"
59
+ "default": "./runtime/entry-66.js"
57
60
  },
58
61
  "./api/last-resolved-resource": {
59
62
  "types": "./src/api/last-resolved-resource.ts",
60
- "default": "./runtime/entry-66.js"
63
+ "default": "./runtime/entry-67.js"
61
64
  },
62
65
  "./api/tool-call-interceptor": {
63
66
  "types": "./src/api/tool-call-interceptor.ts",
64
- "default": "./runtime/entry-67.js"
67
+ "default": "./runtime/entry-68.js"
65
68
  },
66
69
  "./api/tool-renderer": {
67
70
  "types": "./src/api/tool-renderer.ts",
68
- "default": "./runtime/entry-68.js"
71
+ "default": "./runtime/entry-69.js"
69
72
  }
70
73
  },
71
74
  "dependencies": {
72
75
  "@codemirror/state": "^6.5.0",
76
+ "@lezer/common": "^1.5.2",
77
+ "@lezer/javascript": "^1.5.4",
73
78
  "diff": "^9.0.0",
79
+ "fs-extra": "^11.4.0",
80
+ "oxfmt": "0.64.0",
74
81
  "partial-json": "^0.1.7",
75
- "pi-agent-invariant": "0.2.2",
76
- "pi-agent-read": "0.2.2",
77
- "pi-agent-resource": "0.2.2",
78
- "pi-agent-text": "0.2.2",
79
- "pi-agent-tool-call-interception": "0.2.2",
82
+ "pi-agent-invariant": "0.4.0",
83
+ "pi-agent-read": "0.4.0",
84
+ "pi-agent-resource": "0.4.0",
85
+ "pi-agent-search": "0.4.0",
86
+ "pi-agent-text": "0.4.0",
87
+ "pi-agent-tool-call-interception": "0.4.0",
88
+ "pi-agent-tool-ui": "0.4.0",
89
+ "run": "2.1.4",
80
90
  "typebox-guard": "npm:typebox@^1.1.38"
81
91
  },
82
92
  "pi": {
83
93
  "extensions": [
84
- "./runtime/entry-69.js"
94
+ "./runtime/entry-70.js"
85
95
  ]
86
96
  },
87
97
  "peerDependencies": {
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-constant",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-text": "0.2.2",
10
- "pi-agent-text-editor": "0.2.2"
9
+ "pi-agent-text": "0.4.0",
10
+ "pi-agent-text-editor": "0.4.0"
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.2.2",
3
+ "version": "0.4.0",
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.2.2",
17
- "pi-agent-text-editor": "0.2.2"
16
+ "pi-agent-text": "0.4.0",
17
+ "pi-agent-text-editor": "0.4.0"
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.2.2",
3
+ "version": "0.4.0",
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.2.2",
16
- "pi-agent-read": "0.2.2",
17
- "pi-agent-text": "0.2.2",
18
- "pi-agent-text-editor": "0.2.2"
15
+ "pi-agent-invariant": "0.4.0",
16
+ "pi-agent-read": "0.4.0",
17
+ "pi-agent-text": "0.4.0",
18
+ "pi-agent-text-editor": "0.4.0"
19
19
  },
20
20
  "pi": {
21
21
  "extensions": [
@@ -32,6 +32,7 @@ export function createLineHashPresenter(): TextLinePresenter {
32
32
 
33
33
  return {
34
34
  ...line,
35
+ anchors: [...new Set([...(line.anchors ?? []), item.anchor.value])],
35
36
  presentation: {
36
37
  ...line.presentation,
37
38
  prefix: `${item.anchor.value.padStart(anchorWidth)}|${line.presentation?.prefix ?? ""}`,
@@ -1,3 +1,12 @@
1
+ import path from "node:path";
2
+ import { Text } from "@earendil-works/pi-tui";
3
+ import {
4
+ createApplyResultRenderer,
5
+ createApplyCallRenderer,
6
+ } from "pi-agent-text-editor/api/apply-renderer";
7
+ import type { AnyTextMutationToolRegistration } from "pi-agent-text-editor/api/mutation-tool";
8
+ import { MutationPanel } from "./src/mutation-panel.js";
9
+ import { resolveMutationResultResources } from "./src/mutation-result.js";
1
10
  import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
2
11
  import {
3
12
  TEXT_EDITOR_API_VERSION,
@@ -6,7 +15,7 @@ import {
6
15
  } from "pi-agent-text-editor/api/plugin-protocol";
7
16
 
8
17
  import { createMutationAnimationPressure } from "./src/animation-pressure.js";
9
- import { registerMutationRenderers } from "./src/renderer.js";
18
+ import { registerMutationRenderers, renderWrittenMutationHeader } from "./src/renderer.js";
10
19
 
11
20
  import { compactMutationDetails } from "./src/persisted-result.js";
12
21
  import type { FileMutationBatchResult } from "pi-agent-text-editor/api/mutation-result";
@@ -20,6 +29,84 @@ export default async function registerTextEditorRenderer(pi: ExtensionAPI): Prom
20
29
  apiVersion: TEXT_EDITOR_API_VERSION,
21
30
  id: "text-editor-renderer",
22
31
  setup(api) {
32
+ const registrations = new Map<string, AnyTextMutationToolRegistration>();
33
+ api.onMutationTool((registration) => registrations.set(registration.name, registration));
34
+ api.addToolRenderer({
35
+ tool: "diff",
36
+ renderResult(result, options, theme, context) {
37
+ const details = result.details as FileMutationBatchResult | undefined;
38
+ if (context.isError || details?.results === undefined)
39
+ return new Text(
40
+ result.content
41
+ .filter((block) => block.type === "text")
42
+ .map((block) => block.text)
43
+ .join("\n"),
44
+ 0,
45
+ 0,
46
+ );
47
+ const panel = new MutationPanel(theme);
48
+ panel.setBackground("toolSuccessBg");
49
+ panel.setExpanded(options.expanded);
50
+ panel.setResourceLabelsVisible(true);
51
+ panel.setResultResources(resolveMutationResultResources(details, undefined));
52
+ return panel;
53
+ },
54
+ });
55
+ api.addToolRenderer({
56
+ tool: "apply",
57
+ renderCall: createApplyCallRenderer((call, theme) => {
58
+ const registration = registrations.get(call.name === "remove" ? "delete" : call.name);
59
+ const display = (argument: typeof call.path) =>
60
+ argument ? (argument.literal ? argument.text : `‹${argument.text}›`) : "…";
61
+ const source = display(
62
+ call.arguments[registration?.source.field ?? "path"] ?? call.arguments.file,
63
+ );
64
+ const identityKeys =
65
+ call.name === "diff"
66
+ ? ["before", "after"]
67
+ : call.name === "search"
68
+ ? ["path", "query"]
69
+ : [registration?.source.field ?? (call.arguments.file ? "file" : "path"), "target"];
70
+ const parameters = Object.entries(call.arguments)
71
+ .filter(([key]) => !identityKeys.includes(key))
72
+ .map(([key, value]) => `${key}: ${display(value)}`)
73
+ .join(" · ");
74
+ const suffix = parameters ? ` ${theme.fg("dim", parameters)}` : "";
75
+ if (registration)
76
+ return (
77
+ renderWrittenMutationHeader(
78
+ registration,
79
+ {
80
+ [registration.source.field]: source,
81
+ ...(call.target ? { target: display(call.target) } : {}),
82
+ },
83
+ theme,
84
+ ) + suffix
85
+ );
86
+ const identity =
87
+ call.name === "search"
88
+ ? `${display(call.query)}${call.path ? ` · ${source}` : ""}`
89
+ : call.name === "diff"
90
+ ? `${display(call.before)} → ${display(call.after)}`
91
+ : `${source}${call.target ? ` → ${display(call.target)}` : ""}`;
92
+ return `${theme.fg("toolTitle", theme.bold(call.name))} ${theme.fg("accent", identity)}${suffix}`;
93
+ }),
94
+ renderResult: createApplyResultRenderer((details, theme, expanded, cwd) => {
95
+ const panel = new MutationPanel(theme);
96
+ panel.setBackground("toolSuccessBg");
97
+ panel.setExpanded(expanded);
98
+ panel.setResourceLabelsVisible(true);
99
+ panel.setResultResources(
100
+ resolveMutationResultResources(details, undefined).map((resource) => ({
101
+ ...resource,
102
+ path: path.isAbsolute(resource.path)
103
+ ? path.relative(cwd, resource.path)
104
+ : resource.path,
105
+ })),
106
+ );
107
+ return panel;
108
+ }),
109
+ });
23
110
  const tools = new Set<string>();
24
111
  api.onMutationTool(({ name }) => tools.add(name));
25
112
  registerMutationRenderers(
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor-renderer",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
9
  "diff": "^9.0.0",
10
- "pi-agent-invariant": "0.2.2",
11
- "pi-agent-text-editor": "0.2.2",
12
- "pi-agent-tool-call-interception": "0.2.2",
13
- "pi-agent-tool-ui": "0.2.2"
10
+ "pi-agent-invariant": "0.4.0",
11
+ "pi-agent-text-editor": "0.4.0",
12
+ "pi-agent-tool-call-interception": "0.4.0",
13
+ "pi-agent-tool-ui": "0.4.0"
14
14
  },
15
15
  "pi": {
16
16
  "extensions": [
17
- "./runtime/entry-72.js"
17
+ "./runtime/entry-71.js"
18
18
  ]
19
19
  },
20
20
  "peerDependencies": {
@@ -16,6 +16,7 @@ import { createDiffModel, type DiffModel, type DiffRow } from "./diff-model.js";
16
16
  import { type DiffPanelResource, renderDiffPanel } from "./diff-renderer.js";
17
17
 
18
18
  import type { MutationRenderResource } from "./render-resource.js";
19
+ import { summarizeStatuses } from "./status-summary.js";
19
20
 
20
21
  type ToolBackground = "toolPendingBg" | "toolSuccessBg" | "toolErrorBg";
21
22
 
@@ -236,32 +237,48 @@ function renderTail(
236
237
  width: number,
237
238
  ): string[] {
238
239
  const counts = renderCounts(resources, theme);
239
- const statuses = resources.flatMap((resource) =>
240
- [
241
- ...(resource.diffStatuses ?? []),
242
- ...(resource.model?.omittedChanges === undefined
243
- ? []
244
- : [
245
- {
246
- text: resource.model.omittedChanges.unavailable
247
- ? "Local diff unavailable: alignment limit reached"
248
- : [
249
- ...(resource.model.omittedChanges.outside > 0
250
- ? [`${resource.model.omittedChanges.outside} changed rows outside this area`]
251
- : []),
252
- ...(resource.model.omittedChanges.ambiguous > 0
253
- ? [`${resource.model.omittedChanges.ambiguous} changed rows unassigned`]
254
- : []),
255
- ].join("; "),
256
- tone: "warning" as const,
257
- },
258
- ]),
259
- ].map((status) => {
260
- const label = resources.length > 1 ? `${resource.path}: ${status.text}` : status.text;
261
- // Contributions are plain text; control characters must not alter terminal rows.
262
- return theme.fg(status.tone ?? "muted", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " "));
263
- }),
240
+ const grouped = summarizeStatuses(
241
+ resources.map((resource) => ({
242
+ path: resource.path,
243
+ diffStatuses: [
244
+ ...(resource.diffStatuses ?? []),
245
+ ...(resource.model?.omittedChanges === undefined
246
+ ? []
247
+ : [
248
+ {
249
+ text: resource.model.omittedChanges.unavailable
250
+ ? "Local diff unavailable: alignment limit reached"
251
+ : [
252
+ ...(resource.model.omittedChanges.outside > 0
253
+ ? [
254
+ `${resource.model.omittedChanges.outside} changed rows outside this area`,
255
+ ]
256
+ : []),
257
+ ...(resource.model.omittedChanges.ambiguous > 0
258
+ ? [`${resource.model.omittedChanges.ambiguous} changed rows unassigned`]
259
+ : []),
260
+ ].join("; "),
261
+ tone: "warning" as const,
262
+ },
263
+ ]),
264
+ ],
265
+ })),
264
266
  );
267
+ const statuses = grouped.statuses.map(({ status, paths }) => {
268
+ const label = resources.length > 1 ? `${paths.join(", ")}: ${status.text}` : status.text;
269
+ return theme.fg(status.tone ?? "muted", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " "));
270
+ });
271
+ if (grouped.formatted.length > 0) {
272
+ const by =
273
+ grouped.formatters.length === 1
274
+ ? grouped.formatters[0]
275
+ : `${grouped.formatters.length} formatters`;
276
+ const label =
277
+ resources.length === 1
278
+ ? `Formatted (${by})`
279
+ : `Formatted ${grouped.formatted.length} files by ${by}`;
280
+ statuses.unshift(theme.fg("success", label.replace(/[\u0000-\u001f\u007f-\u009f]/g, " ")));
281
+ }
265
282
  const text = [counts, ...statuses]
266
283
  .filter((item) => item !== undefined)
267
284
  .join(theme.fg("dim", " · "));