pi-agent-ide 0.3.0 → 0.5.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 (413) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +7 -6
  3. package/dist/chunk-25CZ5ZIU.js +3 -0
  4. package/dist/chunk-526E364R.js +3 -0
  5. package/dist/chunk-5PLV4HLG.js +1 -0
  6. package/dist/chunk-5QQABP47.js +14 -0
  7. package/dist/{chunk-72EEL2DW.js → chunk-6CZO43OH.js} +1 -1
  8. package/dist/chunk-AWXVJ5AC.js +1 -0
  9. package/dist/chunk-BGUSBUUD.js +26 -0
  10. package/dist/{chunk-CW53ZTU3.js → chunk-DQXPQOF7.js} +1 -1
  11. package/dist/chunk-EJ5OACQM.js +1 -0
  12. package/dist/chunk-ESPNEJHK.js +1 -0
  13. package/dist/chunk-G725MARR.js +16 -0
  14. package/dist/{chunk-M5L42DWE.js → chunk-HKXDP2FD.js} +2 -2
  15. package/dist/chunk-IQD6PON5.js +0 -0
  16. package/dist/chunk-J34VKQGJ.js +1 -0
  17. package/dist/chunk-J4RTW44E.js +1 -0
  18. package/dist/{chunk-HGPUI7F3.js → chunk-KII2JQC5.js} +1 -1
  19. package/dist/{chunk-CEKXBS55.js → chunk-L7JMDDSD.js} +1 -1
  20. package/dist/{chunk-EWNWKDMP.js → chunk-LY6U5EAD.js} +1 -1
  21. package/dist/{chunk-ERVMDQGX.js → chunk-MGCHOGQD.js} +1 -1
  22. package/dist/{chunk-LRYE2WCN.js → chunk-O6LE42GK.js} +1 -1
  23. package/dist/{chunk-KAB3AYA2.js → chunk-OBNING2A.js} +1 -1
  24. package/dist/chunk-QH4ZUDOD.js +1 -0
  25. package/dist/{chunk-VFBLX4TG.js → chunk-T6LX2RX5.js} +1 -1
  26. package/dist/{chunk-AADJ2KIB.js → chunk-U22JNO6N.js} +1 -1
  27. package/dist/chunk-U2JKHKLK.js +0 -0
  28. package/dist/{chunk-SSHZEWWV.js → chunk-WGGIQ7IJ.js} +1 -1
  29. package/dist/chunk-ZG2MWXCR.js +2 -0
  30. package/dist/chunk-ZUMN6U77.js +27 -0
  31. package/dist/entry-10.js +1 -1
  32. package/dist/entry-11.js +1 -1
  33. package/dist/entry-12.js +1 -1
  34. package/dist/entry-13.js +1 -1
  35. package/dist/entry-14.js +1 -1
  36. package/dist/entry-15.js +1 -0
  37. package/dist/entry-17.js +1 -1
  38. package/dist/entry-18.js +1 -1
  39. package/dist/entry-19.js +1 -1
  40. package/dist/entry-20.js +1 -1
  41. package/dist/entry-21.js +1 -2
  42. package/dist/entry-22.js +2 -1
  43. package/dist/entry-23.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 +1 -12
  47. package/dist/entry-27.js +12 -1
  48. package/dist/entry-28.js +1 -1
  49. package/dist/entry-29.js +1 -1
  50. package/dist/entry-30.js +1 -1
  51. package/dist/entry-31.js +1 -4
  52. package/dist/entry-32.js +3 -8
  53. package/dist/entry-33.js +9 -1
  54. package/dist/entry-34.js +1 -1
  55. package/dist/entry-35.js +1 -1
  56. package/dist/entry-36.js +1 -1
  57. package/dist/entry-37.js +1 -1
  58. package/dist/entry-38.js +1 -1
  59. package/dist/entry-39.js +1 -1
  60. package/dist/entry-40.js +1 -18
  61. package/dist/entry-41.js +18 -1
  62. package/dist/entry-42.js +1 -1
  63. package/dist/entry-43.js +1 -1
  64. package/dist/entry-44.js +1 -1
  65. package/dist/entry-45.js +1 -7
  66. package/dist/entry-46.js +7 -11
  67. package/dist/entry-47.js +11 -1
  68. package/dist/entry-48.js +1 -1
  69. package/dist/entry-49.js +1 -1
  70. package/dist/entry-50.js +1 -1
  71. package/dist/entry-51.js +1 -1
  72. package/dist/entry-52.js +1 -1
  73. package/dist/entry-53.js +1 -1
  74. package/dist/entry-54.js +1 -1
  75. package/dist/entry-55.js +1 -0
  76. package/dist/entry-56.js +0 -1
  77. package/dist/entry-57.js +1 -0
  78. package/dist/entry-58.js +0 -1
  79. package/dist/entry-59.js +1 -1
  80. package/dist/entry-60.js +1 -1
  81. package/dist/entry-61.js +1 -1
  82. package/dist/entry-62.js +1 -1
  83. package/dist/entry-63.js +1 -1
  84. package/dist/entry-64.js +1 -0
  85. package/dist/entry-65.js +0 -1
  86. package/dist/entry-66.js +1 -0
  87. package/dist/entry-67.js +0 -1
  88. package/dist/entry-68.js +1 -1
  89. package/dist/entry-69.js +1 -1
  90. package/dist/entry-70.js +1 -123
  91. package/dist/entry-71.js +198 -25
  92. package/dist/entry-72.js +30 -2
  93. package/dist/entry-73.js +2 -1
  94. package/dist/entry-74.js +1 -1
  95. package/dist/entry-75.js +1 -1
  96. package/dist/entry-76.js +1 -3
  97. package/dist/entry-77.js +3 -1
  98. package/dist/entry-78.js +1 -1
  99. package/dist/entry-79.js +1 -1
  100. package/dist/entry-8.js +1 -1
  101. package/dist/entry-80.js +1 -0
  102. package/dist/entry-9.js +1 -1
  103. package/dist/pi-agent-ide.js +3 -3
  104. package/docs/configuration.md +1 -1
  105. package/docs/tools.md +11 -0
  106. package/docs/user-hooks.md +68 -0
  107. package/node_modules/pi-agent-doctor/package.json +6 -6
  108. package/node_modules/pi-agent-doctor/runtime/entry-21.js +1 -0
  109. package/node_modules/pi-agent-doctor/src/catalog.ts +9 -1
  110. package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +5 -0
  111. package/node_modules/pi-agent-filesystem/package.json +7 -7
  112. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  113. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  114. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  115. package/node_modules/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
  116. package/node_modules/pi-agent-ide-ast/package.json +32 -11
  117. package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  118. package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +2 -0
  119. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +16 -8
  120. package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
  121. package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +22 -17
  122. package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
  123. package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
  124. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +4 -1
  125. package/node_modules/pi-agent-ide-changes/index.ts +3 -1
  126. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  127. package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  128. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
  129. package/node_modules/pi-agent-ide-formatter/package.json +9 -4
  130. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  131. package/node_modules/pi-agent-ide-lint/package.json +13 -8
  132. package/node_modules/pi-agent-ide-lsp/index.ts +4 -1
  133. package/node_modules/pi-agent-ide-lsp/package.json +15 -10
  134. package/node_modules/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
  135. package/node_modules/pi-agent-image/package.json +3 -3
  136. package/node_modules/pi-agent-invariant/package.json +2 -2
  137. package/node_modules/pi-agent-pdf/package.json +3 -3
  138. package/node_modules/pi-agent-read/package.json +11 -11
  139. package/node_modules/pi-agent-read/runtime/entry-40.js +0 -1
  140. package/node_modules/pi-agent-read/runtime/entry-41.js +2 -0
  141. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  142. package/node_modules/pi-agent-read/src/api/rendering.ts +1 -1
  143. package/node_modules/pi-agent-read/src/api/tools/read.ts +32 -0
  144. package/node_modules/pi-agent-read/src/core/read-core.ts +8 -0
  145. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
  146. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +66 -4
  147. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +105 -5
  148. package/node_modules/pi-agent-resource/package.json +2 -2
  149. package/node_modules/pi-agent-resource/src/resource.ts +2 -0
  150. package/node_modules/pi-agent-search/package.json +7 -7
  151. package/node_modules/pi-agent-search/runtime/entry-45.js +0 -1
  152. package/node_modules/pi-agent-search/src/api/search-parameters.ts +5 -1
  153. package/node_modules/pi-agent-search-text/index.ts +1 -1
  154. package/node_modules/pi-agent-search-text/package.json +9 -9
  155. package/node_modules/pi-agent-search-text/runtime/entry-47.js +1 -0
  156. package/node_modules/pi-agent-search-text/src/resolvers.ts +47 -19
  157. package/node_modules/pi-agent-search-text/src/search-backend.ts +6 -15
  158. package/node_modules/pi-agent-search-text/src/search-presentation.ts +80 -0
  159. package/node_modules/pi-agent-search-text/src/search-renderer.ts +17 -1
  160. package/node_modules/pi-agent-search-text/src/search-result.ts +32 -12
  161. package/node_modules/pi-agent-search-text/src/search-session.ts +6 -3
  162. package/node_modules/pi-agent-text/package.json +3 -3
  163. package/node_modules/pi-agent-text/runtime/entry-49.js +1 -0
  164. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  165. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
  166. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  167. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  168. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
  169. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  170. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  171. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
  172. package/node_modules/pi-agent-text-editor/package.json +25 -25
  173. package/node_modules/pi-agent-text-editor/runtime/entry-70.js +0 -1
  174. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
  175. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
  176. package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  177. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
  178. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
  179. package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  180. package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
  181. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
  182. package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
  183. package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
  184. package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +37 -8
  185. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
  186. package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
  187. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
  188. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
  189. package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
  190. package/node_modules/pi-agent-text-editor/src/core/extension.ts +3 -2
  191. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
  192. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +4 -4
  193. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
  194. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  195. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +182 -10
  196. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +135 -6
  197. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
  198. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
  199. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
  200. package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -0
  201. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  202. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +60 -2
  203. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  204. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
  205. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  206. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  207. package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +1 -0
  208. package/node_modules/pi-agent-web/package.json +7 -7
  209. package/node_modules/pi-agent-web-html/package.json +3 -3
  210. package/node_modules/pi-agent-web-image/package.json +4 -4
  211. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  212. package/node_modules/pi-agent-web-text/package.json +4 -4
  213. package/node_modules/pi-agent-web-text/runtime/entry-80.js +2 -0
  214. package/package.json +61 -38
  215. package/src/api/hooks.ts +168 -0
  216. package/src/api/text-editor.ts +2 -0
  217. package/src/composite/builtin-extensions.ts +13 -0
  218. package/src/composite/extensions-config.ts +18 -0
  219. package/src/composite/module-labels.ts +12 -0
  220. package/src/composite/module-settings-store.ts +17 -1
  221. package/src/composite/module-settings.ts +34 -4
  222. package/src/composite/preferences.ts +26 -0
  223. package/src/composite/settings-panel.ts +62 -30
  224. package/src/core/reload-resource-store.ts +34 -0
  225. package/src/doctor/tip-provider.ts +1 -0
  226. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  227. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  228. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  229. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  230. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
  231. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +2 -0
  232. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  233. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  234. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  235. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  236. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  237. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +2 -0
  238. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +2 -0
  239. package/src/extensions/pi-agent-read/package.json +11 -11
  240. package/src/extensions/pi-agent-read/runtime/entry-40.js +0 -1
  241. package/src/extensions/pi-agent-read/runtime/entry-41.js +2 -0
  242. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  243. package/src/extensions/pi-agent-read/src/api/rendering.ts +1 -1
  244. package/src/extensions/pi-agent-read/src/api/tools/read.ts +32 -0
  245. package/src/extensions/pi-agent-read/src/core/read-core.ts +8 -0
  246. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
  247. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +66 -4
  248. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +105 -5
  249. package/src/extensions/pi-agent-search/package.json +7 -7
  250. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
  251. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
  252. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +1 -0
  253. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +1 -0
  254. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +47 -19
  255. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +6 -15
  256. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +80 -0
  257. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +17 -1
  258. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +32 -12
  259. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +6 -3
  260. package/src/extensions/pi-agent-search/runtime/entry-45.js +0 -1
  261. package/src/extensions/pi-agent-search/runtime/entry-46.js +2 -0
  262. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +5 -1
  263. package/src/extensions/pi-agent-text-editor/package.json +25 -25
  264. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  265. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
  266. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  267. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  268. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
  269. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  270. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  271. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
  272. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -0
  273. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  274. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +60 -2
  275. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  276. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
  277. package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +0 -1
  278. package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +2 -0
  279. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
  280. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
  281. package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  282. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
  283. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
  284. package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  285. package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
  286. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
  287. package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
  288. package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
  289. package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +37 -8
  290. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
  291. package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
  292. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
  293. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
  294. package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
  295. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +3 -2
  296. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
  297. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +4 -4
  298. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
  299. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  300. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +182 -10
  301. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +135 -6
  302. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
  303. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
  304. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
  305. package/src/pi-agent-ide.ts +2 -1
  306. package/src/plugins/pi-agent-ide-ast/package.json +32 -11
  307. package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  308. package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +2 -0
  309. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +16 -8
  310. package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
  311. package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +22 -17
  312. package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
  313. package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
  314. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +4 -1
  315. package/src/plugins/pi-agent-ide-changes/index.ts +3 -1
  316. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  317. package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  318. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
  319. package/src/plugins/pi-agent-ide-debugger/index.ts +573 -0
  320. package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +73 -0
  321. package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +306 -0
  322. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +338 -0
  323. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +349 -0
  324. package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +39 -0
  325. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +152 -0
  326. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +1344 -0
  327. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +14 -0
  328. package/src/plugins/pi-agent-ide-formatter/package.json +9 -4
  329. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  330. package/src/plugins/pi-agent-ide-lint/package.json +13 -8
  331. package/src/plugins/pi-agent-ide-lsp/index.ts +4 -1
  332. package/src/plugins/pi-agent-ide-lsp/package.json +15 -10
  333. package/src/plugins/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
  334. package/src/plugins/pi-agent-ide-processes/index.ts +28 -0
  335. package/src/plugins/pi-agent-ide-processes/src/registry.ts +81 -0
  336. package/src/plugins/pi-agent-ide-processes/src/ui.ts +252 -0
  337. package/src/plugins/pi-agent-ide-terminal/index.ts +40 -0
  338. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +52 -0
  339. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +30 -0
  340. package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +204 -0
  341. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +452 -0
  342. package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +127 -0
  343. package/src/plugins/pi-agent-ide-terminal/src/search.ts +159 -0
  344. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +642 -0
  345. package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +56 -0
  346. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +151 -0
  347. package/src/plugins/pi-agent-ide-terminal/src/types.ts +78 -0
  348. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +212 -0
  349. package/dist/chunk-5MSNYFDE.js +0 -1
  350. package/dist/chunk-B5KB2I7J.js +0 -3
  351. package/dist/chunk-NMFQGKPE.js +0 -2
  352. package/dist/chunk-OVUYPHDE.js +0 -1
  353. package/dist/chunk-RHV5STR3.js +0 -3
  354. package/dist/chunk-TPIHQYK2.js +0 -14
  355. package/dist/chunk-VCCMVQXU.js +0 -1
  356. package/dist/chunk-VZJIZXSH.js +0 -14
  357. package/dist/entry-16.js +0 -1
  358. package/node_modules/pi-agent-doctor/runtime/entry-16.js +0 -1
  359. package/node_modules/pi-agent-filesystem/runtime/entry-21.js +0 -2
  360. package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +0 -1
  361. package/node_modules/pi-agent-ide-changes/runtime/entry-27.js +0 -1
  362. package/node_modules/pi-agent-image/runtime/entry-33.js +0 -1
  363. package/node_modules/pi-agent-resource/runtime/entry-41.js +0 -1
  364. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
  365. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
  366. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
  367. package/node_modules/pi-agent-text-editor/runtime/entry-54.js +0 -1
  368. package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +0 -1
  369. package/node_modules/pi-agent-web/runtime/entry-75.js +0 -2
  370. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-22.js +0 -2
  371. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-21.js +0 -2
  372. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +0 -2
  373. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +0 -2
  374. package/src/extensions/pi-agent-read/runtime/entry-36.js +0 -1
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-46.js +0 -2
  376. package/src/extensions/pi-agent-search/runtime/entry-42.js +0 -1
  377. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
  378. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
  379. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
  380. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-71.js +0 -2
  381. package/src/extensions/pi-agent-text-editor/runtime/entry-54.js +0 -1
  382. package/src/plugins/pi-agent-ide-ast/runtime/entry-25.js +0 -1
  383. package/src/plugins/pi-agent-ide-changes/runtime/entry-27.js +0 -1
  384. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-22.js +0 -0
  385. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
  386. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
  387. /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
  388. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
  389. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
  390. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
  391. /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-34.js +0 -0
  392. /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-35.js +0 -0
  393. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-36.js +0 -0
  394. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-42.js +0 -0
  395. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-46.js +0 -0
  396. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-48.js +0 -0
  397. /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-71.js +0 -0
  398. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
  399. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-74.js +0 -0
  400. /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-76.js +0 -0
  401. /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
  402. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
  403. /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
  404. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
  405. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
  406. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
  407. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
  408. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
  409. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
  410. /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
  411. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
  412. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
  413. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
@@ -75,6 +75,7 @@ import { TextSelectionAnchor } from "#src/api/text-selection-anchor.js";
75
75
  import type { ToolCallAnchorRenderState } from "pi-agent-tool-call-interception";
76
76
  import type { Static, TSchema } from "typebox";
77
77
  import type { ScriptMutationOutcome } from "#src/core/apply/mutation-outcome.js";
78
+ import { executeWholeFileTool, isWholeFileInvocation } from "#src/core/file-operation-tools.js";
78
79
 
79
80
  export function createTextTool<TParameters extends TSchema>(
80
81
  core: TextEditorCore,
@@ -84,6 +85,8 @@ export function createTextTool<TParameters extends TSchema>(
84
85
  getLastResolvedSource: () => string | undefined,
85
86
  ): ToolDefinition<TParameters, FileMutationBatchResult> {
86
87
  const renderer = core.getToolRenderer(definition.name);
88
+ const initialRenderCall = renderer?.renderCall;
89
+ const initialRenderResult = renderer?.renderResult;
87
90
 
88
91
  const tool = withToolCallInterceptionRendering<TParameters, FileMutationBatchResult, unknown>(
89
92
  defineTool<TParameters, FileMutationBatchResult, unknown>({
@@ -103,16 +106,55 @@ export function createTextTool<TParameters extends TSchema>(
103
106
  definition.source.inherited ? definition.source.field : undefined,
104
107
  getLastResolvedSource(),
105
108
  definition.anchors ?? [],
109
+ definition.wholeFileOperation !== undefined,
106
110
  ),
107
111
  ...(renderer?.renderShell !== undefined && { renderShell: renderer.renderShell }),
108
- ...(renderer?.renderCall !== undefined && { renderCall: renderer.renderCall }),
109
- ...(renderer?.renderResult !== undefined && { renderResult: renderer.renderResult }),
112
+ ...(initialRenderCall !== undefined && {
113
+ renderCall: (...arguments_: Parameters<typeof initialRenderCall>) =>
114
+ (core.getToolRenderer(definition.name)?.renderCall ?? initialRenderCall)(...arguments_),
115
+ }),
116
+ ...(initialRenderResult !== undefined && {
117
+ renderResult: (...arguments_: Parameters<typeof initialRenderResult>) =>
118
+ (core.getToolRenderer(definition.name)?.renderResult ?? initialRenderResult)(
119
+ ...arguments_,
120
+ ),
121
+ }),
110
122
  async execute(toolCallId, parameters, signal, onUpdate, context) {
123
+ const input = asMutationParameters<TParameters>(parameters);
124
+ if (definition.direct?.matches(input) === true) {
125
+ try {
126
+ const action = await definition.direct.execute(
127
+ { cwd: context.cwd, ...(signal !== undefined && { signal }) },
128
+ input,
129
+ );
130
+ return {
131
+ content: [{ type: "text", text: action.summary }],
132
+ details: {
133
+ results: [],
134
+ metadata: { semanticAction: { ...action.data, source: action.source } },
135
+ },
136
+ };
137
+ } catch (error) {
138
+ const code =
139
+ error !== null && typeof error === "object" && "code" in error
140
+ ? String(error.code)
141
+ : "DIRECT_MUTATION_FAILED";
142
+ return failureToolResult(
143
+ "transaction" in input ? String(input.transaction) : "",
144
+ code,
145
+ error instanceof Error ? error.message : String(error),
146
+ "not-applied",
147
+ );
148
+ }
149
+ }
150
+ if (isWholeFileInvocation(definition.wholeFileOperation, input)) {
151
+ return executeWholeFileTool(core, definition.wholeFileOperation, input, signal, context);
152
+ }
111
153
  const directExecute = () =>
112
154
  executeTextMutation(
113
155
  core,
114
156
  definition,
115
- asMutationParameters<TParameters>(parameters),
157
+ input,
116
158
  signal,
117
159
  context,
118
160
  (field, state) =>
@@ -132,7 +174,9 @@ export function createTextTool<TParameters extends TSchema>(
132
174
  return [
133
175
  definition.description,
134
176
  definition.source.inherited
135
- ? `When ${definition.source.field} is omitted, the tool can reuse the file identified by the supplied anchor, the last read, or the preceding edit in the same batch.`
177
+ ? definition.wholeFileOperation === undefined
178
+ ? `When ${definition.source.field} is omitted, the tool can reuse the file identified by the supplied anchor, the last read, or the preceding edit in the same batch.`
179
+ : `When ${definition.source.field} is omitted, the tool can reuse the file identified by a supplied text anchor.`
136
180
  : "",
137
181
  pluginPromptGuideline() ?? "",
138
182
  ]
@@ -149,6 +193,7 @@ function prepareGuardedArguments<TParameters extends TSchema>(
149
193
  sourceField: string | undefined,
150
194
  lastResolvedSource: string | undefined,
151
195
  anchorFields: NonNullable<TextMutationToolRegistration["anchors"]>,
196
+ hasWholeFileMode: boolean,
152
197
  ): ReturnType<
153
198
  NonNullable<ToolDefinition<TParameters, FileMutationBatchResult>["prepareArguments"]>
154
199
  > {
@@ -167,7 +212,8 @@ function prepareGuardedArguments<TParameters extends TSchema>(
167
212
  sourceField !== undefined &&
168
213
  !(sourceField in prepared) &&
169
214
  lastResolvedSource !== undefined &&
170
- !hasExplicitAnchor
215
+ !hasExplicitAnchor &&
216
+ !hasWholeFileMode
171
217
  ) {
172
218
  prepared[sourceField] = lastResolvedSource;
173
219
  }
@@ -686,11 +732,14 @@ export async function previewTextMutation(
686
732
 
687
733
  try {
688
734
  const sources = await resolveMutationSources(core, definition, request.input, request);
735
+ const semanticHandler = core.getSemanticMutationHandler(definition.name, request.input);
689
736
  return await core.previewTexts(
690
737
  sources.resources.map((source) => ({
691
738
  source,
692
739
  read: true,
693
- ...(definition.name === "write" && { allowReadFailure: true }),
740
+ ...(semanticHandler === undefined
741
+ ? definition.name === "write" && { allowReadFailure: true }
742
+ : { requireWrite: false }),
694
743
  })),
695
744
  { cwd: request.cwd, ...(request.signal !== undefined && { signal: request.signal }) },
696
745
  async (texts, resolveAnchor) => {
@@ -703,6 +752,9 @@ export async function previewTextMutation(
703
752
  resolveAnchor,
704
753
  );
705
754
  await preflightMutationAnchors(definition, request.input, mutationContext);
755
+ if (semanticHandler !== undefined) {
756
+ return { changes: new Map(), result: { edits: new Map() } };
757
+ }
706
758
  const mutation = await definition.mutate(mutationContext, request.input);
707
759
 
708
760
  return {
@@ -814,6 +866,52 @@ export async function executeTextMutationPipeline<TParameters extends TSchema>(
814
866
  state,
815
867
  lastResolvedSource,
816
868
  );
869
+ const semanticHandler = core.getSemanticMutationHandler(definition.name, state.input);
870
+ if (semanticHandler !== undefined) {
871
+ return await core.editTexts(
872
+ sources.resources.map((resourceSource) => ({
873
+ source: resourceSource,
874
+ read: true,
875
+ requireWrite: false,
876
+ })),
877
+ {
878
+ cwd: state.cwd,
879
+ intent: definition.intent ?? "edit",
880
+ ...(state.signal !== undefined && { signal: state.signal }),
881
+ },
882
+ async (texts, resolveAnchor) => {
883
+ for (const target of sources.targets) {
884
+ if (
885
+ target.expectedContent !== undefined &&
886
+ texts.get(target.source) !== target.expectedContent
887
+ ) {
888
+ throw new Error(
889
+ "The selected source changed before the semantic action. Resolve it again.",
890
+ );
891
+ }
892
+ }
893
+ const mutationContext = createMutationContext(
894
+ definition,
895
+ state.input,
896
+ state,
897
+ sources,
898
+ texts,
899
+ resolveAnchor,
900
+ publishAnchorRenderState,
901
+ );
902
+ await preflightMutationAnchors(definition, state.input, mutationContext);
903
+ const semanticAction = await semanticHandler.execute(mutationContext, state.input);
904
+ return {
905
+ changes: new Map(),
906
+ result: withResultPresentations(
907
+ { edits: new Map(), semanticAction },
908
+ mutationContext,
909
+ ),
910
+ resourceEffect: true,
911
+ };
912
+ },
913
+ );
914
+ }
817
915
  const outcome = await core.editTexts(
818
916
  sources.resources.map((resourceSource) => ({
819
917
  source: resourceSource,
@@ -905,6 +1003,7 @@ export async function executeScriptMutation<TParameters extends TSchema>(
905
1003
  definition.source.inherited ? definition.source.field : undefined,
906
1004
  lastResolvedSource,
907
1005
  definition.anchors ?? [],
1006
+ definition.wholeFileOperation !== undefined,
908
1007
  );
909
1008
  if (!Value.Check(definition.parameters, parameters)) {
910
1009
  throw Object.assign(new Error(`Invalid arguments for ${definition.name}`), {
@@ -968,6 +1067,22 @@ export async function executeScriptMutation<TParameters extends TSchema>(
968
1067
  recoveries: await scriptAnchorRecoveries(outcome.failure.cause),
969
1068
  };
970
1069
  const mutation = outcome.result as ExecutedTextMutation;
1070
+ if (mutation.semanticAction !== undefined) {
1071
+ return {
1072
+ operation: definition.name,
1073
+ ok: true,
1074
+ effect: "applied",
1075
+ files: [],
1076
+ completed: [mutation.semanticAction.source],
1077
+ metadata: {
1078
+ semanticAction: {
1079
+ ...mutation.semanticAction.data,
1080
+ source: mutation.semanticAction.source,
1081
+ },
1082
+ },
1083
+ errors: [],
1084
+ };
1085
+ }
971
1086
  const files = outcome.resources.flatMap((resource) => {
972
1087
  const edit = mutation.edits.get(resource.source);
973
1088
  if (edit === undefined) return [];
@@ -1165,6 +1280,20 @@ async function buildToolResult(
1165
1280
  }
1166
1281
 
1167
1282
  const mutation = outcome.result as ExecutedTextMutation;
1283
+ if (mutation.semanticAction !== undefined) {
1284
+ return {
1285
+ content: [{ type: "text", text: mutation.semanticAction.summary }],
1286
+ details: {
1287
+ results: [],
1288
+ metadata: {
1289
+ semanticAction: {
1290
+ ...mutation.semanticAction.data,
1291
+ source: mutation.semanticAction.source,
1292
+ },
1293
+ },
1294
+ },
1295
+ };
1296
+ }
1168
1297
  const results = outcome.resources.flatMap((resource) => {
1169
1298
  const resultSource = resource.source;
1170
1299
  const edit = mutation.edits.get(resultSource);
@@ -31,7 +31,7 @@ export const copySchema = Type.Object(
31
31
  target: Type.Optional(
32
32
  Type.String({
33
33
  description:
34
- "Target resource reference or file path; a returned SEARCH# reference may select the destination; defaults to the source",
34
+ "Target resource reference or file path. Required for a whole-file operation; defaults to the source for selected text.",
35
35
  }),
36
36
  ),
37
37
  targetStart: Type.Optional(
@@ -46,6 +46,11 @@ export const copySchema = Type.Object(
46
46
  "Optional inclusive destination end. Replaces whole lines through the last line containing this anchor, including SEARCH :match. May differ in type from targetStart; both must resolve uniquely in the target file and in forward order. Omit to insert after targetStart instead.",
47
47
  }),
48
48
  ),
49
+ overwrite: Type.Optional(
50
+ Type.Boolean({
51
+ description: "Allow replacing an existing regular target file. Defaults to false.",
52
+ }),
53
+ ),
49
54
  },
50
55
  { additionalProperties: false },
51
56
  );
@@ -61,11 +66,11 @@ interface CopyParameters {
61
66
 
62
67
  export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> = {
63
68
  name: "copy",
69
+ wholeFileOperation: "copy",
64
70
  description:
65
- "Use copy to duplicate existing text within or between files while keeping the source. Select the source and destination without reproducing the text in your call. The copy is inserted at the destination or replaces a destination range.",
71
+ "Use copy to copy one regular file when path and target are supplied without text selectors, or to duplicate selected text within or between files. Whole-file targets require overwrite: true when they already exist.",
66
72
 
67
- promptSnippet:
68
- "Make precise file edits by copying text within or between files using exact matches or anchors",
73
+ promptSnippet: "Copy regular files, or copy selected text within or between files",
69
74
  parameters: copySchema,
70
75
  source: { field: "path", inherited: true, targets: [{ field: "target", fallbackTo: "path" }] },
71
76
  anchors: [
@@ -42,10 +42,11 @@ interface DeleteParameters {
42
42
 
43
43
  export const deleteMutationTool: TextMutationToolRegistration<typeof deleteSchema> = {
44
44
  name: "delete",
45
+ wholeFileOperation: "delete",
45
46
  description:
46
- "Use delete to remove an existing text fragment or an inclusive range of whole lines. Select only the content to remove; surrounding text is kept.",
47
+ "Use delete to permanently delete one regular file when path is supplied without text selectors, or to remove selected text. Whole-file deletion rejects directories and symlinks.",
47
48
 
48
- promptSnippet: "Make precise file edits by deleting text using exact matches or anchors",
49
+ promptSnippet: "Delete regular files, or delete selected text using exact matches or anchors",
49
50
  parameters: deleteSchema,
50
51
  source: { field: "path", inherited: true },
51
52
  anchors: [
@@ -33,7 +33,7 @@ export const moveSchema = Type.Object(
33
33
  target: Type.Optional(
34
34
  Type.String({
35
35
  description:
36
- "Target resource reference or file path; a returned SEARCH# reference may select the destination; defaults to the source",
36
+ "Target resource reference or file path. Required for a whole-file operation; defaults to the source for selected text.",
37
37
  }),
38
38
  ),
39
39
  targetStart: Type.Optional(
@@ -48,6 +48,11 @@ export const moveSchema = Type.Object(
48
48
  "Optional inclusive destination end. Replaces whole lines through the last line containing this anchor, including SEARCH :match. May differ in type from targetStart; both must resolve uniquely in the target file and in forward order. Omit to insert after targetStart instead.",
49
49
  }),
50
50
  ),
51
+ overwrite: Type.Optional(
52
+ Type.Boolean({
53
+ description: "Allow replacing an existing regular target file. Defaults to false.",
54
+ }),
55
+ ),
51
56
  },
52
57
  { additionalProperties: false },
53
58
  );
@@ -63,11 +68,11 @@ interface MoveParameters {
63
68
 
64
69
  export const moveMutationTool: TextMutationToolRegistration<typeof moveSchema> = {
65
70
  name: "move",
71
+ wholeFileOperation: "move",
66
72
  description:
67
- "Use move to relocate existing text within or between files. Select the source and destination without reproducing the text in your call. The selected text is removed from the source and inserted at the destination, or replaces a destination range.",
73
+ "Use move to move or rename one regular file when path and target are supplied without text selectors, or to relocate selected text within or between files. Whole-file targets require overwrite: true when they already exist.",
68
74
 
69
- promptSnippet:
70
- "Make precise file edits by moving text within or between files using exact matches or anchors",
75
+ promptSnippet: "Move or rename regular files, or move selected text within or between files",
71
76
  parameters: moveSchema,
72
77
  source: { field: "path", inherited: true, targets: [{ field: "target", fallbackTo: "path" }] },
73
78
  anchors: [
@@ -72,6 +72,11 @@ export default async function registerTextEditorRenderer(pi: ExtensionAPI): Prom
72
72
  .map(([key, value]) => `${key}: ${display(value)}`)
73
73
  .join(" · ");
74
74
  const suffix = parameters ? ` ${theme.fg("dim", parameters)}` : "";
75
+ if (call.name === "result")
76
+ return `${theme.fg("toolTitle", theme.bold("result"))} ${theme.fg(
77
+ "accent",
78
+ call.arguments.arguments ? display(call.arguments.arguments) : parameters,
79
+ )}`;
75
80
  if (registration)
76
81
  return (
77
82
  renderWrittenMutationHeader(
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor-renderer",
3
- "version": "0.3.0",
3
+ "version": "0.5.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.3.0",
11
- "pi-agent-text-editor": "0.3.0",
12
- "pi-agent-tool-call-interception": "0.3.0",
13
- "pi-agent-tool-ui": "0.3.0"
10
+ "pi-agent-invariant": "0.5.0",
11
+ "pi-agent-text-editor": "0.5.0",
12
+ "pi-agent-tool-call-interception": "0.5.0",
13
+ "pi-agent-tool-ui": "0.5.0"
14
14
  },
15
15
  "pi": {
16
16
  "extensions": [
17
- "./runtime/entry-71.js"
17
+ "./runtime/entry-72.js"
18
18
  ]
19
19
  },
20
20
  "peerDependencies": {
@@ -106,9 +106,8 @@ function createRenderer(
106
106
  return {
107
107
  tool,
108
108
  fallback: true,
109
- ...(tool === "write" && { renderShell: "self" as const }),
110
109
  renderCall(arguments_, theme, context) {
111
- const component = panel(context.lastComponent, theme, tool === "write");
110
+ const component = panel(context.lastComponent, theme, false);
112
111
  const input = asInput(arguments_);
113
112
  const state = context.state as RenderState;
114
113
  state.registration = registration;
@@ -257,6 +256,33 @@ function createRenderer(
257
256
  );
258
257
  state.panel?.setPreviewResources([]);
259
258
 
259
+ if (registration.name === "undo" && typeof state.input?.transaction === "string") {
260
+ const restored = restoredApplyPathCount(result.details);
261
+ const succeeded = restored !== undefined && !context.isError;
262
+ return new Text(
263
+ theme.fg(
264
+ succeeded ? "success" : "error",
265
+ succeeded
266
+ ? `✓ Undo applied · ${String(restored)} ${restored === 1 ? "file" : "files"}`
267
+ : "✗ Undo not applied",
268
+ ),
269
+ 0,
270
+ 0,
271
+ );
272
+ }
273
+
274
+ const wholeFileSucceeded = wholeFileOperationSucceeded(result.details);
275
+ if (wholeFileSucceeded !== undefined) {
276
+ return new Text(
277
+ theme.fg(
278
+ wholeFileSucceeded ? "success" : "error",
279
+ wholeFileSucceeded ? "✓ Applied" : "✗ Not applied",
280
+ ),
281
+ 0,
282
+ 0,
283
+ );
284
+ }
285
+
260
286
  const output = result.content
261
287
  .filter(
262
288
  (item): item is { readonly type: "text"; readonly text: string } => item.type === "text",
@@ -719,6 +745,8 @@ function renderHeader(
719
745
  expanded: boolean,
720
746
  ): string {
721
747
  const source = registration.source;
748
+ if (registration.name === "undo" && typeof input.transaction === "string")
749
+ return `${theme.fg("toolTitle", theme.bold("undo"))} ${theme.fg("muted", "· Apply transaction")}`;
722
750
  const path = stringValue(input[source.field]);
723
751
  const previewResources = preview?.kind === "completed" ? preview.resources : [];
724
752
  const displayedPath =
@@ -831,6 +859,36 @@ function semanticRange(start: string, end: string): string {
831
859
  : `${start}–${end}`;
832
860
  }
833
861
 
862
+ function restoredApplyPathCount(details: unknown): number | undefined {
863
+ if (details === null || typeof details !== "object" || !("metadata" in details)) return undefined;
864
+ const metadata = details.metadata;
865
+ if (metadata === null || typeof metadata !== "object" || !("semanticAction" in metadata))
866
+ return undefined;
867
+ const action = metadata.semanticAction;
868
+ if (
869
+ action === null ||
870
+ typeof action !== "object" ||
871
+ !("kind" in action) ||
872
+ action.kind !== "apply-undo" ||
873
+ !("restored" in action) ||
874
+ !Array.isArray(action.restored)
875
+ )
876
+ return undefined;
877
+ return action.restored.length;
878
+ }
879
+
880
+ function wholeFileOperationSucceeded(details: unknown): boolean | undefined {
881
+ if (details === null || typeof details !== "object" || !("metadata" in details)) return undefined;
882
+ const metadata = details.metadata;
883
+ if (metadata === null || typeof metadata !== "object" || !("semanticAction" in metadata))
884
+ return undefined;
885
+ const action = metadata.semanticAction;
886
+ if (action === null || typeof action !== "object" || !("kind" in action)) return undefined;
887
+ return action.kind === "file-operation" && "ok" in action && typeof action.ok === "boolean"
888
+ ? action.ok
889
+ : undefined;
890
+ }
891
+
834
892
  function userFacingFailure(agentOutput: string): string {
835
893
  if (/\banchor\b[\s\S]*\bis ambiguous\./iu.test(agentOutput)) {
836
894
  return "Not changed · selection is ambiguous";
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor-stale-anchor",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-invariant": "0.3.0",
7
- "pi-agent-read": "0.3.0",
8
- "pi-agent-text-editor": "0.3.0"
6
+ "pi-agent-invariant": "0.5.0",
7
+ "pi-agent-read": "0.5.0",
8
+ "pi-agent-text-editor": "0.5.0"
9
9
  },
10
10
  "pi": {
11
11
  "extensions": [
12
- "./runtime/entry-72.js"
12
+ "./runtime/entry-73.js"
13
13
  ]
14
14
  },
15
15
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-73.js";
2
+ export { default } from "../../../dist/entry-73.js";
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "pi-agent-tool-call-interception",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./src/index.ts",
9
- "default": "./runtime/entry-73.js"
9
+ "default": "./runtime/entry-74.js"
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "pi-agent-tool-ui": "0.3.0"
13
+ "pi-agent-tool-ui": "0.5.0"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@earendil-works/pi-coding-agent": "*",
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "pi-agent-tool-ui",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./src/index.ts",
8
- "default": "./runtime/entry-74.js"
8
+ "default": "./runtime/entry-75.js"
9
9
  }
10
10
  },
11
11
  "peerDependencies": {
@@ -0,0 +1 @@
1
+ export * from "../../../dist/entry-75.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-web",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,16 +8,16 @@
8
8
  "dependencies": {
9
9
  "defuddle": "^0.19.1",
10
10
  "linkedom": "^0.18.12",
11
- "pi-agent-doctor": "0.3.0",
12
- "pi-agent-image": "0.3.0",
13
- "pi-agent-read": "0.3.0",
14
- "pi-agent-resource": "0.3.0",
15
- "pi-agent-text": "0.3.0",
11
+ "pi-agent-doctor": "0.5.0",
12
+ "pi-agent-image": "0.5.0",
13
+ "pi-agent-read": "0.5.0",
14
+ "pi-agent-resource": "0.5.0",
15
+ "pi-agent-text": "0.5.0",
16
16
  "playwright-core": "^1.62.1"
17
17
  },
18
18
  "pi": {
19
19
  "extensions": [
20
- "./runtime/entry-75.js"
20
+ "./runtime/entry-76.js"
21
21
  ]
22
22
  },
23
23
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-web-html",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,11 +8,11 @@
8
8
  "dependencies": {
9
9
  "defuddle": "^0.19.1",
10
10
  "linkedom": "^0.18.12",
11
- "pi-agent-resource": "0.3.0"
11
+ "pi-agent-resource": "0.5.0"
12
12
  },
13
13
  "pi": {
14
14
  "extensions": [
15
- "./runtime/entry-76.js"
15
+ "./runtime/entry-77.js"
16
16
  ]
17
17
  },
18
18
  "peerDependencies": {
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pi-agent-web-image",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-image": "0.3.0",
7
- "pi-agent-resource": "0.3.0"
6
+ "pi-agent-image": "0.5.0",
7
+ "pi-agent-resource": "0.5.0"
8
8
  },
9
9
  "pi": {
10
10
  "extensions": [
11
- "./runtime/entry-77.js"
11
+ "./runtime/entry-78.js"
12
12
  ]
13
13
  },
14
14
  "peerDependencies": {
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pi-agent-web-pdf",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-pdf": "0.3.0",
7
- "pi-agent-resource": "0.3.0"
6
+ "pi-agent-pdf": "0.5.0",
7
+ "pi-agent-resource": "0.5.0"
8
8
  },
9
9
  "pi": {
10
10
  "extensions": [
11
- "./runtime/entry-78.js"
11
+ "./runtime/entry-79.js"
12
12
  ]
13
13
  },
14
14
  "peerDependencies": {
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pi-agent-web-text",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-resource": "0.3.0",
7
- "pi-agent-text": "0.3.0"
6
+ "pi-agent-resource": "0.5.0",
7
+ "pi-agent-text": "0.5.0"
8
8
  },
9
9
  "pi": {
10
10
  "extensions": [
11
- "./runtime/entry-79.js"
11
+ "./runtime/entry-80.js"
12
12
  ]
13
13
  },
14
14
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-80.js";
2
+ export { default } from "../../../dist/entry-80.js";