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
@@ -0,0 +1,80 @@
1
+ import type { TextSearchMatch } from "#src/search-session.js";
2
+
3
+ export interface SearchPresentationGroup {
4
+ readonly text: string;
5
+ readonly matchCount: number;
6
+ }
7
+
8
+ export type SearchPresentationFile =
9
+ | {
10
+ readonly kind: "detailed";
11
+ readonly source: string;
12
+ readonly matches: readonly TextSearchMatch[];
13
+ }
14
+ | {
15
+ readonly kind: "compacted";
16
+ readonly source: string;
17
+ readonly matchCount: number;
18
+ readonly uniqueLineCount: number;
19
+ readonly groups: readonly SearchPresentationGroup[];
20
+ };
21
+
22
+ export interface SearchPresentation {
23
+ readonly files: readonly SearchPresentationFile[];
24
+ }
25
+
26
+ /** Selects bounded search details while preserving complete low-volume files. */
27
+ export function planSearchPresentation(
28
+ matches: readonly TextSearchMatch[],
29
+ detailBudget: number,
30
+ ): SearchPresentation {
31
+ const bySource = new Map<string, TextSearchMatch[]>();
32
+ for (const match of matches) {
33
+ const sourceMatches = bySource.get(match.source) ?? [];
34
+ sourceMatches.push(match);
35
+ bySource.set(match.source, sourceMatches);
36
+ }
37
+
38
+ const compacted = new Set<string>();
39
+ let detailedCount = matches.length;
40
+ const noisiestFirst = [...bySource].sort(
41
+ ([leftSource, left], [rightSource, right]) =>
42
+ right.length - left.length || leftSource.localeCompare(rightSource),
43
+ );
44
+ for (const [source, sourceMatches] of noisiestFirst) {
45
+ if (detailedCount <= detailBudget) break;
46
+ compacted.add(source);
47
+ detailedCount -= sourceMatches.length;
48
+ }
49
+
50
+ const files = [...bySource]
51
+ .sort(([left], [right]) => left.localeCompare(right))
52
+ .map(([source, sourceMatches]): SearchPresentationFile => {
53
+ if (!compacted.has(source)) {
54
+ return { kind: "detailed", source, matches: sourceMatches };
55
+ }
56
+
57
+ const counts = new Map<string, number>();
58
+ for (const match of sourceMatches) {
59
+ counts.set(match.lineText, (counts.get(match.lineText) ?? 0) + 1);
60
+ }
61
+ return {
62
+ kind: "compacted",
63
+ source,
64
+ matchCount: sourceMatches.length,
65
+ uniqueLineCount: counts.size,
66
+ groups:
67
+ bySource.size === 1
68
+ ? [...counts]
69
+ .sort(
70
+ ([leftText, leftCount], [rightText, rightCount]) =>
71
+ rightCount - leftCount || leftText.localeCompare(rightText),
72
+ )
73
+ .slice(0, detailBudget)
74
+ .map(([text, matchCount]) => ({ text, matchCount }))
75
+ : [],
76
+ };
77
+ });
78
+
79
+ return { files };
80
+ }
@@ -50,6 +50,7 @@ interface SearchRenderContext {
50
50
  type SearchPanelRow =
51
51
  | { readonly kind: "file"; readonly file: SearchResultFile }
52
52
  | { readonly kind: "line"; readonly file: SearchResultFile; readonly line: SearchResultLine }
53
+ | { readonly kind: "summary"; readonly text: string }
53
54
  | { readonly kind: "omitted"; readonly matches: number }
54
55
  | { readonly kind: "empty" };
55
56
 
@@ -141,7 +142,18 @@ function searchViewport(details: SearchToolDetails, expanded: boolean): readonly
141
142
  ? [{ kind: "empty" } satisfies SearchPanelRow]
142
143
  : details.files.flatMap((file): SearchPanelRow[] => [
143
144
  { kind: "file", file },
144
- ...file.lines.map((line): SearchPanelRow => ({ kind: "line", file, line })),
145
+ ...(file.uniqueLineCount === undefined
146
+ ? file.lines.map((line): SearchPanelRow => ({ kind: "line", file, line }))
147
+ : [
148
+ {
149
+ kind: "summary",
150
+ text: `${String(file.uniqueLineCount)} unique line texts · search this path with a narrower query`,
151
+ } satisfies SearchPanelRow,
152
+ ...(file.groups ?? []).map((group): SearchPanelRow => ({
153
+ kind: "summary",
154
+ text: `×${String(group.matchCount)} ${group.text}`,
155
+ })),
156
+ ]),
145
157
  ]);
146
158
 
147
159
  if (expanded || rows.length <= COMPACT_SEARCH_ROWS) {
@@ -190,6 +202,10 @@ function renderPanelRow(
190
202
  return renderMatchLine(row.line, width, gutterWidth, theme);
191
203
  }
192
204
 
205
+ if (row.kind === "summary") {
206
+ return [framed(theme.fg("dim", ` ${safeText(row.text)}`), width, theme)];
207
+ }
208
+
193
209
  if (row.kind === "omitted") {
194
210
  const hint = `${keyText("app.tools.expand")} to expand`;
195
211
  return [
@@ -2,6 +2,7 @@ import path from "node:path";
2
2
  import { pathToFileURL } from "node:url";
3
3
 
4
4
  import type { TextSearchMatch } from "#src/search-session.js";
5
+ import { planSearchPresentation } from "#src/search-presentation.js";
5
6
 
6
7
  export interface SearchResultRange {
7
8
  readonly from: number;
@@ -15,10 +16,17 @@ export interface SearchResultLine {
15
16
  readonly ranges: readonly SearchResultRange[];
16
17
  }
17
18
 
19
+ export interface SearchResultGroup {
20
+ readonly text: string;
21
+ readonly matchCount: number;
22
+ }
23
+
18
24
  export interface SearchResultFile {
19
25
  readonly path: string;
20
26
  readonly link: string;
21
27
  readonly matchCount: number;
28
+ readonly uniqueLineCount?: number;
29
+ readonly groups?: readonly SearchResultGroup[];
22
30
  readonly lines: readonly SearchResultLine[];
23
31
  }
24
32
 
@@ -43,17 +51,21 @@ export function createSearchToolDetails(
43
51
  complete: boolean,
44
52
  cwd: string,
45
53
  sessionId?: string,
54
+ detailBudget = 50,
46
55
  ): SearchToolDetails {
47
- const matchesBySource = new Map<string, TextSearchMatch[]>();
48
-
49
- for (const match of matches) {
50
- const source = path.resolve(match.source);
51
- matchesBySource.set(source, [...(matchesBySource.get(source) ?? []), match]);
52
- }
53
-
54
- const files = [...matchesBySource]
55
- .sort(([left], [right]) => left.localeCompare(right))
56
- .map(([source, sourceMatches]) => createSearchResultFile(source, sourceMatches, cwd));
56
+ const presentation = planSearchPresentation(matches, detailBudget);
57
+ const files = presentation.files.map((file): SearchResultFile =>
58
+ file.kind === "detailed"
59
+ ? createSearchResultFile(file.source, file.matches, cwd)
60
+ : {
61
+ path: displaySource(file.source, cwd),
62
+ link: pathToFileURL(file.source).href,
63
+ matchCount: file.matchCount,
64
+ uniqueLineCount: file.uniqueLineCount,
65
+ groups: file.groups,
66
+ lines: [],
67
+ },
68
+ );
57
69
 
58
70
  return {
59
71
  ...(sessionId !== undefined && { sessionId }),
@@ -141,9 +153,17 @@ function isSearchResultFile(value: unknown): value is SearchResultFile {
141
153
  return false;
142
154
  }
143
155
 
156
+ const lines = value.lines as readonly SearchResultLine[];
157
+ const groups = value.groups;
144
158
  return (
145
- value.matchCount ===
146
- (value.lines as readonly SearchResultLine[]).reduce((count, line) => count + line.matchCount, 0)
159
+ (groups === undefined ||
160
+ (Array.isArray(groups) &&
161
+ groups.every(
162
+ (group) => isRecord(group) && typeof group.text === "string" && isCount(group.matchCount),
163
+ ))) &&
164
+ (value.uniqueLineCount === undefined || isCount(value.uniqueLineCount)) &&
165
+ (lines.length === 0 ||
166
+ value.matchCount === lines.reduce((count, line) => count + line.matchCount, 0))
147
167
  );
148
168
  }
149
169
 
@@ -92,9 +92,12 @@ export function createSearchSessionIdentity(
92
92
  match.matchedText,
93
93
  match.lineText,
94
94
  ]);
95
- const normalizedRecipe = normalizeRecipe(recipe ?? { query, regex: true }, root);
95
+ const { limit: _detailBudget, ...selectionRecipe } = normalizeRecipe(
96
+ recipe ?? { query, regex: true },
97
+ root,
98
+ );
96
99
  return createHash("sha256")
97
- .update(JSON.stringify([query, root, normalizedRecipe, identity]))
100
+ .update(JSON.stringify([query, root, selectionRecipe, identity]))
98
101
  .digest("hex")
99
102
  .toUpperCase();
100
103
  }
@@ -124,7 +127,7 @@ function normalizeRecipe(recipe: SearchRecipe, cwd: string): Record<string, unkn
124
127
  exclude: recipe.exclude ?? "",
125
128
  caseSensitive: recipe.caseSensitive === true,
126
129
  wholeWord: recipe.wholeWord === true,
127
- limit: recipe.limit ?? 100,
130
+ limit: recipe.limit ?? 50,
128
131
  regex: recipe.regex === true,
129
132
  fallbacks: recipe.fallbacks ?? [],
130
133
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "imports": {
@@ -9,11 +9,11 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./src/index.ts",
12
- "default": "./runtime/entry-48.js"
12
+ "default": "./runtime/entry-49.js"
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "pi-agent-resource": "0.3.0"
16
+ "pi-agent-resource": "0.5.0"
17
17
  },
18
18
  "peerDependencies": {
19
19
  "typebox": "*"
@@ -0,0 +1 @@
1
+ export * from "../../../dist/entry-49.js";
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-constant",
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
- "pi-agent-text": "0.3.0",
10
- "pi-agent-text-editor": "0.3.0"
9
+ "pi-agent-text": "0.5.0",
10
+ "pi-agent-text-editor": "0.5.0"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
14
- "./runtime/entry-49.js"
14
+ "./runtime/entry-50.js"
15
15
  ]
16
16
  },
17
17
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-50.js";
2
+ export { default } from "../../../dist/entry-50.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-exact",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,17 +8,17 @@
8
8
  "exports": {
9
9
  "./api/anchor": {
10
10
  "types": "./src/anchor.ts",
11
- "default": "./runtime/entry-50.js"
11
+ "default": "./runtime/entry-51.js"
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
15
  "fast-fuzzy": "1.12.0",
16
- "pi-agent-text": "0.3.0",
17
- "pi-agent-text-editor": "0.3.0"
16
+ "pi-agent-text": "0.5.0",
17
+ "pi-agent-text-editor": "0.5.0"
18
18
  },
19
19
  "pi": {
20
20
  "extensions": [
21
- "./runtime/entry-51.js"
21
+ "./runtime/entry-52.js"
22
22
  ]
23
23
  },
24
24
  "peerDependencies": {
@@ -1,2 +1 @@
1
1
  export * from "../../../dist/entry-51.js";
2
- export { default } from "../../../dist/entry-51.js";
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-52.js";
2
+ export { default } from "../../../dist/entry-52.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-line-hash",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,18 +8,18 @@
8
8
  "exports": {
9
9
  "./api/anchor": {
10
10
  "types": "./src/anchor.ts",
11
- "default": "./runtime/entry-52.js"
11
+ "default": "./runtime/entry-53.js"
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "pi-agent-invariant": "0.3.0",
16
- "pi-agent-read": "0.3.0",
17
- "pi-agent-text": "0.3.0",
18
- "pi-agent-text-editor": "0.3.0"
15
+ "pi-agent-invariant": "0.5.0",
16
+ "pi-agent-read": "0.5.0",
17
+ "pi-agent-text": "0.5.0",
18
+ "pi-agent-text-editor": "0.5.0"
19
19
  },
20
20
  "pi": {
21
21
  "extensions": [
22
- "./runtime/entry-53.js"
22
+ "./runtime/entry-54.js"
23
23
  ]
24
24
  },
25
25
  "peerDependencies": {
@@ -1,2 +1 @@
1
1
  export * from "../../../dist/entry-53.js";
2
- export { default } from "../../../dist/entry-53.js";
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-54.js";
2
+ export { default } from "../../../dist/entry-54.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,67 +8,67 @@
8
8
  "exports": {
9
9
  "./api/apply-renderer": {
10
10
  "types": "./src/api/apply-renderer.ts",
11
- "default": "./runtime/entry-54.js"
11
+ "default": "./runtime/entry-55.js"
12
12
  },
13
13
  "./api/anchor-inspection": {
14
14
  "types": "./src/api/anchor-inspection.ts",
15
- "default": "./runtime/entry-55.js"
15
+ "default": "./runtime/entry-56.js"
16
16
  },
17
17
  "./api/connect-plugin": {
18
18
  "types": "./src/api/connect-plugin.ts",
19
- "default": "./runtime/entry-56.js"
19
+ "default": "./runtime/entry-57.js"
20
20
  },
21
21
  "./api/edit-completion": {
22
22
  "types": "./src/api/edit-completion.ts",
23
- "default": "./runtime/entry-57.js"
23
+ "default": "./runtime/entry-58.js"
24
24
  },
25
25
  "./api/edit-pipeline": {
26
26
  "types": "./src/api/edit-pipeline.ts",
27
- "default": "./runtime/entry-58.js"
27
+ "default": "./runtime/entry-59.js"
28
28
  },
29
29
  "./api/plugin-protocol": {
30
30
  "types": "./src/api/plugin-protocol.ts",
31
- "default": "./runtime/entry-59.js"
31
+ "default": "./runtime/entry-60.js"
32
32
  },
33
33
  "./api/stale-anchor-message": {
34
34
  "types": "./src/api/stale-anchor-message.ts",
35
- "default": "./runtime/entry-60.js"
35
+ "default": "./runtime/entry-61.js"
36
36
  },
37
37
  "./api/text-selection-anchor": {
38
38
  "types": "./src/api/text-selection-anchor.ts",
39
- "default": "./runtime/entry-61.js"
39
+ "default": "./runtime/entry-62.js"
40
40
  },
41
41
  "./api/post-edit": {
42
42
  "types": "./src/api/post-edit.ts",
43
- "default": "./runtime/entry-62.js"
43
+ "default": "./runtime/entry-63.js"
44
44
  },
45
45
  "./api/mutation-result": {
46
46
  "types": "./src/api/mutation-result.ts",
47
- "default": "./runtime/entry-63.js"
47
+ "default": "./runtime/entry-64.js"
48
48
  },
49
49
  "./api/mutation-guard": {
50
50
  "types": "./src/api/mutation-guard.ts",
51
- "default": "./runtime/entry-64.js"
51
+ "default": "./runtime/entry-65.js"
52
52
  },
53
53
  "./api/mutation-tool": {
54
54
  "types": "./src/api/mutation-tool.ts",
55
- "default": "./runtime/entry-65.js"
55
+ "default": "./runtime/entry-66.js"
56
56
  },
57
57
  "./api/mutation-preview": {
58
58
  "types": "./src/api/mutation-preview.ts",
59
- "default": "./runtime/entry-66.js"
59
+ "default": "./runtime/entry-67.js"
60
60
  },
61
61
  "./api/last-resolved-resource": {
62
62
  "types": "./src/api/last-resolved-resource.ts",
63
- "default": "./runtime/entry-67.js"
63
+ "default": "./runtime/entry-68.js"
64
64
  },
65
65
  "./api/tool-call-interceptor": {
66
66
  "types": "./src/api/tool-call-interceptor.ts",
67
- "default": "./runtime/entry-68.js"
67
+ "default": "./runtime/entry-69.js"
68
68
  },
69
69
  "./api/tool-renderer": {
70
70
  "types": "./src/api/tool-renderer.ts",
71
- "default": "./runtime/entry-69.js"
71
+ "default": "./runtime/entry-70.js"
72
72
  }
73
73
  },
74
74
  "dependencies": {
@@ -79,19 +79,19 @@
79
79
  "fs-extra": "^11.4.0",
80
80
  "oxfmt": "0.64.0",
81
81
  "partial-json": "^0.1.7",
82
- "pi-agent-invariant": "0.3.0",
83
- "pi-agent-read": "0.3.0",
84
- "pi-agent-resource": "0.3.0",
85
- "pi-agent-search": "0.3.0",
86
- "pi-agent-text": "0.3.0",
87
- "pi-agent-tool-call-interception": "0.3.0",
88
- "pi-agent-tool-ui": "0.3.0",
82
+ "pi-agent-invariant": "0.5.0",
83
+ "pi-agent-read": "0.5.0",
84
+ "pi-agent-resource": "0.5.0",
85
+ "pi-agent-search": "0.5.0",
86
+ "pi-agent-text": "0.5.0",
87
+ "pi-agent-tool-call-interception": "0.5.0",
88
+ "pi-agent-tool-ui": "0.5.0",
89
89
  "run": "2.1.4",
90
90
  "typebox-guard": "npm:typebox@^1.1.38"
91
91
  },
92
92
  "pi": {
93
93
  "extensions": [
94
- "./runtime/entry-70.js"
94
+ "./runtime/entry-71.js"
95
95
  ]
96
96
  },
97
97
  "peerDependencies": {
@@ -1,2 +1 @@
1
1
  export * from "../../../dist/entry-70.js";
2
- export { default } from "../../../dist/entry-70.js";
@@ -15,4 +15,10 @@ export interface TextEditCompletion {
15
15
  readonly intent: TextEditIntent;
16
16
  }
17
17
 
18
- export type TextEditCompletionListener = (completion: TextEditCompletion) => void | Promise<void>;
18
+ export interface TextEditCompletionFeedback {
19
+ readonly feedback: string;
20
+ readonly tone?: "info" | "warning" | "error";
21
+ }
22
+ export type TextEditCompletionListener = (
23
+ completion: TextEditCompletion,
24
+ ) => void | TextEditCompletionFeedback | Promise<void | TextEditCompletionFeedback>;
@@ -2,6 +2,7 @@ import { Type } from "typebox";
2
2
  import { Value } from "typebox/value";
3
3
 
4
4
  import type { TextEditorToolId } from "#src/api/plugin-protocol.js";
5
+ import type { TextSemanticMutationHandler } from "#src/api/mutation-tool.js";
5
6
 
6
7
  export type TextEditPipelineStage = "text-pre-edit" | "text-edit" | "text-post-edit";
7
8
 
@@ -43,6 +44,8 @@ export type TextEditHandlerRegistration =
43
44
  | { readonly stage: "text-post-edit"; readonly handler: TextEditHandler };
44
45
 
45
46
  export interface TextEditorToolPluginApi {
47
+ /** Handle selected invocations as anchored non-file effects before document writes. */
48
+ addSemanticHandler(handler: TextSemanticMutationHandler): void;
46
49
  addHandler(registration: TextEditHandlerRegistration): void;
47
50
  describe(description: string): void;
48
51
  }
@@ -1,5 +1,6 @@
1
1
  import type { TextEditIntent } from "#src/api/edit-completion.js";
2
2
  import type { AppliedTextChange } from "#src/core/text-change-engine.js";
3
+ export type { AppliedTextChange } from "#src/core/text-change-engine.js";
3
4
  import type { TextDocument } from "pi-agent-text";
4
5
 
5
6
  export interface TextMutationPlanResource {
@@ -9,6 +9,8 @@ export interface TextMutationEdit {
9
9
  }
10
10
 
11
11
  export interface TextMutation {
12
+ /** Non-file action completed through this mutation invocation. */
13
+ readonly semanticAction?: TextSemanticMutationResult;
12
14
  readonly edits: ReadonlyMap<string, TextMutationEdit>;
13
15
  readonly afterWrite?: () => void | Promise<void>;
14
16
  }
@@ -56,6 +58,40 @@ export function isMutationAnchorValue(
56
58
  );
57
59
  }
58
60
 
61
+ /** A non-file effect performed through an existing text mutation tool. */
62
+ export interface TextSemanticMutationResult {
63
+ /** Addressable resource created or changed by the action. */
64
+ readonly source: string;
65
+ /** Compact agent-facing outcome. */
66
+ readonly summary: string;
67
+ /** Structured receipt shared by standalone tools and Apply. */
68
+ readonly data: Readonly<Record<string, unknown>>;
69
+ }
70
+
71
+ /** Handles one tool invocation after its current source and anchors are available. */
72
+ export interface TextSemanticMutationHandler {
73
+ /** Select invocations owned by this handler without performing side effects. */
74
+ readonly matches: (input: unknown) => boolean;
75
+ /** Perform the non-file effect against the fresh source snapshot. */
76
+ readonly execute: (
77
+ context: TextMutationContext,
78
+ input: unknown,
79
+ ) => TextSemanticMutationResult | Promise<TextSemanticMutationResult>;
80
+ }
81
+ export interface DirectTextMutationContext {
82
+ readonly cwd: string;
83
+ readonly signal?: AbortSignal;
84
+ }
85
+
86
+ /** A mutation mode that owns its complete multi-resource transaction. */
87
+ export interface DirectTextMutationHandler {
88
+ readonly matches: (input: unknown) => boolean;
89
+ readonly execute: (
90
+ context: DirectTextMutationContext,
91
+ input: unknown,
92
+ ) => TextSemanticMutationResult | Promise<TextSemanticMutationResult>;
93
+ }
94
+
59
95
  export type TextMutationIntent = Exclude<TextEditIntent, "mixed">;
60
96
 
61
97
  export interface TextMutationToolRegistration<TParameters extends TSchema = TSchema> {
@@ -71,6 +107,10 @@ export interface TextMutationToolRegistration<TParameters extends TSchema = TSch
71
107
  readonly source: TextMutationSourceDescriptor;
72
108
  readonly anchors?: readonly TextMutationAnchorField[];
73
109
  readonly pair?: readonly [string, string];
110
+ /** Execute a host transaction without opening one primary text resource. */
111
+ readonly direct?: DirectTextMutationHandler;
112
+ /** Whole-file operation used when the invocation contains no text selectors. */
113
+ readonly wholeFileOperation?: "copy" | "move" | "delete";
74
114
  readonly mutate: (
75
115
  context: TextMutationContext,
76
116
  parameters: Static<TParameters>,
@@ -90,6 +130,13 @@ export function assertTextMutationToolRegistration(value: AnyTextMutationToolReg
90
130
  throw new TypeError(`Mutation tool ${value.name} has an invalid description or operation`);
91
131
  }
92
132
 
133
+ if (
134
+ value.direct !== undefined &&
135
+ (typeof value.direct.matches !== "function" || typeof value.direct.execute !== "function")
136
+ ) {
137
+ throw new TypeError(`Mutation tool ${value.name} has an invalid direct operation`);
138
+ }
139
+
93
140
  const intent: unknown = (value as { readonly intent?: unknown }).intent;
94
141
 
95
142
  if (intent !== undefined && intent !== "edit" && intent !== "restore") {
@@ -40,7 +40,7 @@ export interface ScriptIndexOperation {
40
40
  }
41
41
  export const TEXT_EDITOR_PROTOCOL = "pi-agent-text-editor";
42
42
 
43
- export const TEXT_EDITOR_API_VERSION = 20;
43
+ export const TEXT_EDITOR_API_VERSION = 22;
44
44
 
45
45
  export const TEXT_POSITION_ANCHOR_KIND = "pi-agent-text-editor/position";
46
46
 
@@ -92,6 +92,11 @@ export interface TextEditorRecoveryConfigSection {
92
92
  readonly settings: unknown;
93
93
  }
94
94
  export interface TextEditorPluginApi {
95
+ /** Restore a session-scoped Apply transaction receipt atomically. */
96
+ restoreApplyUndo(
97
+ transaction: string,
98
+ signal?: AbortSignal,
99
+ ): Promise<{ readonly transaction: string; readonly restored: readonly string[] }>;
95
100
  addResolver(registration: ResourceResolverRegistration): void;
96
101
  inspectTextAnchors(request: TextAnchorInspectionRequest): Promise<TextAnchorInspectionOutcome>;
97
102
  addAnchorResolver(registration: TextAnchorResolverRegistration): void;
@@ -13,12 +13,15 @@ export type TextEditorToolRendererRegistration = Pick<
13
13
  > & {
14
14
  readonly tool: TextEditorToolId;
15
15
  readonly fallback?: boolean;
16
+ /** Select this renderer for matching tool arguments or results; unmatched values use the previous renderer. */
17
+ readonly matches?: (value: unknown, phase: "call" | "result") => boolean;
16
18
  };
17
19
 
18
20
  const rendererFunctionSchema = Type.Function([], Type.Unknown());
19
21
  const toolRendererRegistrationSchema = Type.Object({
20
22
  tool: Type.String({ pattern: "\\S" }),
21
23
  fallback: Type.Optional(Type.Boolean()),
24
+ matches: Type.Optional(rendererFunctionSchema),
22
25
  renderCall: Type.Optional(rendererFunctionSchema),
23
26
  renderResult: Type.Optional(rendererFunctionSchema),
24
27
  renderShell: Type.Optional(Type.Union([Type.Literal("default"), Type.Literal("self")])),