pi-agent-ide 0.5.1 → 0.6.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 (322) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +10 -4
  3. package/dist/chunk-22CLOM2D.js +1 -0
  4. package/dist/{chunk-LY6U5EAD.js → chunk-2527OQ4Y.js} +1 -1
  5. package/dist/chunk-3XJ3KDPZ.js +16 -0
  6. package/dist/chunk-5JELU6RV.js +7 -0
  7. package/dist/chunk-DDKHZZDO.js +5 -0
  8. package/dist/chunk-FEDVTZJG.js +1 -0
  9. package/dist/chunk-HSM6R7IB.js +27 -0
  10. package/dist/chunk-K5G4FDXD.js +1 -0
  11. package/dist/chunk-M5IVSCR2.js +1 -0
  12. package/dist/chunk-OYWIZII6.js +1 -0
  13. package/dist/{chunk-7ALCBKCW.js → chunk-PCZH7GOX.js} +11 -11
  14. package/dist/{chunk-DQXPQOF7.js → chunk-SQ7ZTGOP.js} +1 -1
  15. package/dist/entry-10.js +1 -1
  16. package/dist/entry-11.js +1 -1
  17. package/dist/entry-12.js +1 -1
  18. package/dist/entry-13.js +1 -1
  19. package/dist/entry-14.js +1 -1
  20. package/dist/entry-15.js +1 -1
  21. package/dist/entry-16.js +1 -0
  22. package/dist/entry-18.js +1 -1
  23. package/dist/entry-19.js +1 -1
  24. package/dist/entry-20.js +1 -1
  25. package/dist/entry-21.js +1 -1
  26. package/dist/entry-22.js +1 -2
  27. package/dist/entry-23.js +2 -1
  28. package/dist/entry-24.js +1 -1
  29. package/dist/entry-25.js +1 -1
  30. package/dist/entry-26.js +1 -1
  31. package/dist/entry-27.js +1 -12
  32. package/dist/entry-28.js +12 -1
  33. package/dist/entry-29.js +1 -1
  34. package/dist/entry-30.js +1 -1
  35. package/dist/entry-31.js +1 -1
  36. package/dist/entry-32.js +1 -4
  37. package/dist/entry-33.js +3 -8
  38. package/dist/entry-34.js +9 -1
  39. package/dist/entry-35.js +1 -1
  40. package/dist/entry-36.js +1 -1
  41. package/dist/entry-37.js +1 -1
  42. package/dist/entry-38.js +1 -1
  43. package/dist/entry-39.js +1 -1
  44. package/dist/entry-40.js +1 -1
  45. package/dist/entry-41.js +1 -18
  46. package/dist/entry-42.js +18 -1
  47. package/dist/entry-43.js +1 -1
  48. package/dist/entry-44.js +1 -1
  49. package/dist/entry-45.js +1 -1
  50. package/dist/entry-46.js +1 -7
  51. package/dist/entry-47.js +7 -11
  52. package/dist/entry-48.js +11 -1
  53. package/dist/entry-49.js +1 -1
  54. package/dist/entry-50.js +1 -1
  55. package/dist/entry-51.js +1 -1
  56. package/dist/entry-52.js +1 -1
  57. package/dist/entry-53.js +1 -1
  58. package/dist/entry-54.js +1 -1
  59. package/dist/entry-55.js +1 -1
  60. package/dist/entry-56.js +1 -0
  61. package/dist/entry-57.js +0 -1
  62. package/dist/entry-58.js +1 -0
  63. package/dist/entry-59.js +0 -1
  64. package/dist/entry-60.js +1 -1
  65. package/dist/entry-61.js +1 -1
  66. package/dist/entry-62.js +1 -1
  67. package/dist/entry-63.js +1 -1
  68. package/dist/entry-64.js +1 -1
  69. package/dist/entry-65.js +1 -0
  70. package/dist/entry-66.js +0 -1
  71. package/dist/entry-67.js +1 -0
  72. package/dist/entry-68.js +0 -1
  73. package/dist/entry-69.js +1 -1
  74. package/dist/entry-70.js +1 -1
  75. package/dist/entry-71.js +1 -203
  76. package/dist/entry-72.js +254 -25
  77. package/dist/entry-73.js +30 -2
  78. package/dist/entry-74.js +2 -1
  79. package/dist/entry-75.js +1 -1
  80. package/dist/entry-76.js +1 -3
  81. package/dist/entry-77.js +3 -3
  82. package/dist/entry-78.js +3 -1
  83. package/dist/entry-79.js +1 -1
  84. package/dist/entry-80.js +1 -1
  85. package/dist/entry-81.js +1 -0
  86. package/dist/pi-agent-ide.js +3 -3
  87. package/docs/configuration.md +3 -1
  88. package/docs/tools.md +12 -0
  89. package/node_modules/pi-agent-doctor/package.json +6 -6
  90. package/node_modules/pi-agent-doctor/runtime/entry-22.js +1 -0
  91. package/node_modules/pi-agent-filesystem/package.json +7 -7
  92. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  93. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  94. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  95. package/node_modules/pi-agent-filesystem-text/runtime/entry-26.js +2 -0
  96. package/node_modules/pi-agent-ide-ast/package.json +12 -11
  97. package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +0 -1
  98. package/node_modules/pi-agent-ide-ast/runtime/entry-28.js +2 -0
  99. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +8 -6
  100. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  101. package/node_modules/pi-agent-ide-changes/runtime/entry-29.js +0 -1
  102. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  103. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  104. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  105. package/node_modules/pi-agent-ide-lint/src/command-linter.ts +3 -1
  106. package/node_modules/pi-agent-ide-lsp/package.json +10 -10
  107. package/node_modules/pi-agent-ide-lsp/runtime/entry-34.js +2 -0
  108. package/node_modules/pi-agent-image/package.json +3 -3
  109. package/node_modules/pi-agent-invariant/package.json +2 -2
  110. package/node_modules/pi-agent-pdf/package.json +3 -3
  111. package/node_modules/pi-agent-read/package.json +11 -11
  112. package/node_modules/pi-agent-read/runtime/entry-41.js +0 -1
  113. package/node_modules/pi-agent-read/runtime/entry-42.js +2 -0
  114. package/node_modules/pi-agent-read/src/api/read-parameters.ts +2 -2
  115. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +11 -6
  116. package/node_modules/pi-agent-resource/package.json +2 -2
  117. package/node_modules/pi-agent-search/package.json +7 -7
  118. package/node_modules/pi-agent-search/runtime/entry-46.js +0 -1
  119. package/node_modules/pi-agent-search-text/package.json +9 -9
  120. package/node_modules/pi-agent-search-text/runtime/entry-48.js +1 -0
  121. package/node_modules/pi-agent-text/package.json +3 -3
  122. package/node_modules/pi-agent-text/runtime/entry-50.js +1 -0
  123. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  124. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-51.js +2 -0
  125. package/node_modules/pi-agent-text-anchor-exact/index.ts +3 -3
  126. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  127. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +0 -1
  128. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-53.js +2 -0
  129. package/node_modules/pi-agent-text-anchor-exact/src/config.ts +2 -2
  130. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  131. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-54.js +0 -1
  132. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-55.js +2 -0
  133. package/node_modules/pi-agent-text-editor/package.json +25 -25
  134. package/node_modules/pi-agent-text-editor/runtime/entry-71.js +0 -1
  135. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +125 -3
  136. package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +1 -1
  137. package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +14 -0
  138. package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +32 -3
  139. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +21 -19
  140. package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +37 -0
  141. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +85 -34
  142. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +2 -3
  143. package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +589 -241
  144. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +5 -0
  145. package/node_modules/pi-agent-text-editor/src/core/text-editor-config.ts +3 -3
  146. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +9 -1
  147. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +53 -0
  148. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +11 -41
  149. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +8 -18
  150. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +11 -41
  151. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -19
  152. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  153. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  154. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-74.js +2 -0
  155. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  156. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  157. package/node_modules/pi-agent-tool-ui/runtime/entry-76.js +1 -0
  158. package/node_modules/pi-agent-web/package.json +7 -7
  159. package/node_modules/pi-agent-web-html/package.json +3 -3
  160. package/node_modules/pi-agent-web-image/package.json +4 -4
  161. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  162. package/node_modules/pi-agent-web-text/package.json +4 -4
  163. package/node_modules/pi-agent-web-text/runtime/entry-81.js +2 -0
  164. package/package.json +43 -38
  165. package/src/api/path-identity.ts +15 -0
  166. package/src/composite/builtin-extensions.ts +7 -2
  167. package/src/composite/module-labels.ts +4 -0
  168. package/src/composite/module-settings.ts +34 -14
  169. package/src/composite/preferences.ts +46 -3
  170. package/src/composite/selection.ts +5 -1
  171. package/src/doctor/inventory.ts +7 -2
  172. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  173. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  174. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  175. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  176. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-26.js +2 -0
  177. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-23.js +2 -0
  178. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  179. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  180. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  181. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  182. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  183. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-81.js +2 -0
  184. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-77.js +2 -0
  185. package/src/extensions/pi-agent-read/package.json +11 -11
  186. package/src/extensions/pi-agent-read/runtime/entry-41.js +0 -1
  187. package/src/extensions/pi-agent-read/runtime/entry-42.js +2 -0
  188. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +2 -2
  189. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +11 -6
  190. package/src/extensions/pi-agent-search/package.json +7 -7
  191. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
  192. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +1 -0
  193. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-49.js +1 -0
  194. package/src/extensions/pi-agent-search/runtime/entry-46.js +0 -1
  195. package/src/extensions/pi-agent-search/runtime/entry-47.js +2 -0
  196. package/src/extensions/pi-agent-text-editor/package.json +25 -25
  197. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  198. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-51.js +2 -0
  199. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +3 -3
  200. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  201. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +0 -1
  202. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-53.js +2 -0
  203. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/config.ts +2 -2
  204. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  205. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-54.js +0 -1
  206. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-55.js +2 -0
  207. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  208. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  209. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-74.js +2 -0
  210. package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +0 -1
  211. package/src/extensions/pi-agent-text-editor/runtime/entry-72.js +2 -0
  212. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +125 -3
  213. package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +1 -1
  214. package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +14 -0
  215. package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +32 -3
  216. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +21 -19
  217. package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +37 -0
  218. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +85 -34
  219. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +2 -3
  220. package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +589 -241
  221. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +5 -0
  222. package/src/extensions/pi-agent-text-editor/src/core/text-editor-config.ts +3 -3
  223. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +9 -1
  224. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +53 -0
  225. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +11 -41
  226. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +8 -18
  227. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +11 -41
  228. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -19
  229. package/src/pi-agent-ide.ts +15 -2
  230. package/src/plugins/pi-agent-ide-ast/package.json +12 -11
  231. package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +0 -1
  232. package/src/plugins/pi-agent-ide-ast/runtime/entry-28.js +2 -0
  233. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +8 -6
  234. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  235. package/src/plugins/pi-agent-ide-changes/runtime/entry-29.js +0 -1
  236. package/src/plugins/pi-agent-ide-debugger/index.ts +2 -8
  237. package/src/plugins/pi-agent-ide-debugger/src/adapter-executables.ts +31 -0
  238. package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +3 -1
  239. package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +24 -23
  240. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -2
  241. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +55 -17
  242. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -22
  243. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  244. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  245. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  246. package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +3 -1
  247. package/src/plugins/pi-agent-ide-lsp/package.json +10 -10
  248. package/src/plugins/pi-agent-ide-lsp/runtime/entry-34.js +2 -0
  249. package/src/plugins/pi-agent-ide-processes/src/registry.ts +4 -0
  250. package/src/plugins/pi-agent-ide-processes/src/ui.ts +18 -9
  251. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +1 -0
  252. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +1 -0
  253. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +2 -2
  254. package/src/plugins/pi-agent-ide-terminal/src/types.ts +1 -0
  255. package/src/plugins/pi-agent-ide-vision/index.ts +232 -0
  256. package/src/plugins/pi-agent-ide-vision/src/vision.ts +530 -0
  257. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +30 -0
  258. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +33 -0
  259. package/dist/chunk-5PLV4HLG.js +0 -1
  260. package/dist/chunk-G725MARR.js +0 -16
  261. package/dist/chunk-HKXDP2FD.js +0 -7
  262. package/dist/chunk-IRECDTJG.js +0 -27
  263. package/dist/chunk-J4RTW44E.js +0 -1
  264. package/dist/chunk-NZYDMBM6.js +0 -1
  265. package/dist/chunk-WGGIQ7IJ.js +0 -1
  266. package/dist/entry-17.js +0 -1
  267. package/node_modules/pi-agent-doctor/runtime/entry-17.js +0 -1
  268. package/node_modules/pi-agent-filesystem/runtime/entry-22.js +0 -2
  269. package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  270. package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  271. package/node_modules/pi-agent-image/runtime/entry-34.js +0 -1
  272. package/node_modules/pi-agent-resource/runtime/entry-42.js +0 -1
  273. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +0 -2
  274. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  275. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  276. package/node_modules/pi-agent-text-editor/runtime/entry-55.js +0 -1
  277. package/node_modules/pi-agent-tool-call-interception/runtime/entry-74.js +0 -1
  278. package/node_modules/pi-agent-web/runtime/entry-76.js +0 -2
  279. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-23.js +0 -2
  280. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +0 -2
  281. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-77.js +0 -2
  282. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
  283. package/src/extensions/pi-agent-read/runtime/entry-37.js +0 -1
  284. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +0 -2
  285. package/src/extensions/pi-agent-search/runtime/entry-43.js +0 -1
  286. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +0 -2
  287. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  288. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  289. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-72.js +0 -2
  290. package/src/extensions/pi-agent-text-editor/runtime/entry-55.js +0 -1
  291. package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  292. package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  293. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-23.js +0 -0
  294. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-24.js +0 -0
  295. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-25.js +0 -0
  296. /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-30.js +0 -0
  297. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-31.js +0 -0
  298. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-32.js +0 -0
  299. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-33.js +0 -0
  300. /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-35.js +0 -0
  301. /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-36.js +0 -0
  302. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-37.js +0 -0
  303. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-43.js +0 -0
  304. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-47.js +0 -0
  305. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-49.js +0 -0
  306. /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-72.js +0 -0
  307. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-73.js +0 -0
  308. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-75.js +0 -0
  309. /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-77.js +0 -0
  310. /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-78.js +0 -0
  311. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-79.js +0 -0
  312. /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-80.js +0 -0
  313. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-24.js +0 -0
  314. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-25.js +0 -0
  315. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-78.js +0 -0
  316. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-79.js +0 -0
  317. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-80.js +0 -0
  318. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-73.js +0 -0
  319. /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-30.js +0 -0
  320. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-31.js +0 -0
  321. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-32.js +0 -0
  322. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-33.js +0 -0
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-constant",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-text": "0.5.1",
10
- "pi-agent-text-editor": "0.5.1"
9
+ "pi-agent-text": "0.6.0",
10
+ "pi-agent-text-editor": "0.6.0"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
14
- "./runtime/entry-50.js"
14
+ "./runtime/entry-51.js"
15
15
  ]
16
16
  },
17
17
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-51.js";
2
+ export { default } from "../../../dist/entry-51.js";
@@ -2,7 +2,7 @@ import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin
2
2
  import {
3
3
  TEXT_EDITOR_API_VERSION,
4
4
  TEXT_EDITOR_PROTOCOL,
5
- TEXT_POSITION_ANCHOR_KIND,
5
+ TEXT_SEARCH_ANCHOR_KIND,
6
6
  type TextEditorPlugin,
7
7
  } from "pi-agent-text-editor/api/plugin-protocol";
8
8
 
@@ -11,7 +11,7 @@ import { parseExactTextRecoveryConfig } from "./src/config.js";
11
11
 
12
12
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
13
13
 
14
- /** Registers unique exact text as the final position-anchor fallback. */
14
+ /** Registers unique exact text as the final search-anchor fallback. */
15
15
  export default async function registerExactTextAnchor(pi: ExtensionAPI): Promise<void> {
16
16
  const plugin = {
17
17
  protocol: TEXT_EDITOR_PROTOCOL,
@@ -22,7 +22,7 @@ export default async function registerExactTextAnchor(pi: ExtensionAPI): Promise
22
22
  resolver: createExactTextAnchorResolver(
23
23
  parseExactTextRecoveryConfig(api.recoveryConfig("exactText")),
24
24
  ),
25
- kind: TEXT_POSITION_ANCHOR_KIND,
25
+ kind: TEXT_SEARCH_ANCHOR_KIND,
26
26
  type: "auxiliary",
27
27
  describeInPrompt: false,
28
28
  priority: 10_000,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-exact",
3
- "version": "0.5.1",
3
+ "version": "0.6.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-51.js"
11
+ "default": "./runtime/entry-52.js"
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
15
  "fast-fuzzy": "1.12.0",
16
- "pi-agent-text": "0.5.1",
17
- "pi-agent-text-editor": "0.5.1"
16
+ "pi-agent-text": "0.6.0",
17
+ "pi-agent-text-editor": "0.6.0"
18
18
  },
19
19
  "pi": {
20
20
  "extensions": [
21
- "./runtime/entry-52.js"
21
+ "./runtime/entry-53.js"
22
22
  ]
23
23
  },
24
24
  "peerDependencies": {
@@ -1,2 +1 @@
1
1
  export * from "../../../dist/entry-52.js";
2
- export { default } from "../../../dist/entry-52.js";
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-53.js";
2
+ export { default } from "../../../dist/entry-53.js";
@@ -27,7 +27,7 @@ export const DEFAULT_EXACT_TEXT_RECOVERY_CONFIG: ExactTextRecoveryConfig = {
27
27
  maxQuerySizeKiB: 1024,
28
28
  seedLimit: 3,
29
29
  blockLineVariance: 2,
30
- contextLines: 5,
30
+ contextLines: 15,
31
31
  timeoutMs: 2000,
32
32
  };
33
33
 
@@ -90,7 +90,7 @@ export function loadExactTextRecoveryConfig(cwd: string): ExactTextRecoveryConfi
90
90
  }
91
91
  assertKeys(recovery, ["contextLines", "timeoutMs", "exactText"], "recovery");
92
92
  return parseExactTextRecoveryConfig({
93
- contextLines: optionalInteger(recovery.contextLines, "contextLines", 0, 20) ?? 5,
93
+ contextLines: optionalInteger(recovery.contextLines, "contextLines", 0, 20) ?? 15,
94
94
  timeoutMs: optionalInteger(recovery.timeoutMs, "timeoutMs", 1, 10_000) ?? 2000,
95
95
  settings: recovery.exactText,
96
96
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-anchor-line-hash",
3
- "version": "0.5.1",
3
+ "version": "0.6.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-53.js"
11
+ "default": "./runtime/entry-54.js"
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "pi-agent-invariant": "0.5.1",
16
- "pi-agent-read": "0.5.1",
17
- "pi-agent-text": "0.5.1",
18
- "pi-agent-text-editor": "0.5.1"
15
+ "pi-agent-invariant": "0.6.0",
16
+ "pi-agent-read": "0.6.0",
17
+ "pi-agent-text": "0.6.0",
18
+ "pi-agent-text-editor": "0.6.0"
19
19
  },
20
20
  "pi": {
21
21
  "extensions": [
22
- "./runtime/entry-54.js"
22
+ "./runtime/entry-55.js"
23
23
  ]
24
24
  },
25
25
  "peerDependencies": {
@@ -1,2 +1 @@
1
1
  export * from "../../../dist/entry-54.js";
2
- export { default } from "../../../dist/entry-54.js";
@@ -0,0 +1,2 @@
1
+ export * from "../../../dist/entry-55.js";
2
+ export { default } from "../../../dist/entry-55.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-text-editor",
3
- "version": "0.5.1",
3
+ "version": "0.6.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-55.js"
11
+ "default": "./runtime/entry-56.js"
12
12
  },
13
13
  "./api/anchor-inspection": {
14
14
  "types": "./src/api/anchor-inspection.ts",
15
- "default": "./runtime/entry-56.js"
15
+ "default": "./runtime/entry-57.js"
16
16
  },
17
17
  "./api/connect-plugin": {
18
18
  "types": "./src/api/connect-plugin.ts",
19
- "default": "./runtime/entry-57.js"
19
+ "default": "./runtime/entry-58.js"
20
20
  },
21
21
  "./api/edit-completion": {
22
22
  "types": "./src/api/edit-completion.ts",
23
- "default": "./runtime/entry-58.js"
23
+ "default": "./runtime/entry-59.js"
24
24
  },
25
25
  "./api/edit-pipeline": {
26
26
  "types": "./src/api/edit-pipeline.ts",
27
- "default": "./runtime/entry-59.js"
27
+ "default": "./runtime/entry-60.js"
28
28
  },
29
29
  "./api/plugin-protocol": {
30
30
  "types": "./src/api/plugin-protocol.ts",
31
- "default": "./runtime/entry-60.js"
31
+ "default": "./runtime/entry-61.js"
32
32
  },
33
33
  "./api/stale-anchor-message": {
34
34
  "types": "./src/api/stale-anchor-message.ts",
35
- "default": "./runtime/entry-61.js"
35
+ "default": "./runtime/entry-62.js"
36
36
  },
37
37
  "./api/text-selection-anchor": {
38
38
  "types": "./src/api/text-selection-anchor.ts",
39
- "default": "./runtime/entry-62.js"
39
+ "default": "./runtime/entry-63.js"
40
40
  },
41
41
  "./api/post-edit": {
42
42
  "types": "./src/api/post-edit.ts",
43
- "default": "./runtime/entry-63.js"
43
+ "default": "./runtime/entry-64.js"
44
44
  },
45
45
  "./api/mutation-result": {
46
46
  "types": "./src/api/mutation-result.ts",
47
- "default": "./runtime/entry-64.js"
47
+ "default": "./runtime/entry-65.js"
48
48
  },
49
49
  "./api/mutation-guard": {
50
50
  "types": "./src/api/mutation-guard.ts",
51
- "default": "./runtime/entry-65.js"
51
+ "default": "./runtime/entry-66.js"
52
52
  },
53
53
  "./api/mutation-tool": {
54
54
  "types": "./src/api/mutation-tool.ts",
55
- "default": "./runtime/entry-66.js"
55
+ "default": "./runtime/entry-67.js"
56
56
  },
57
57
  "./api/mutation-preview": {
58
58
  "types": "./src/api/mutation-preview.ts",
59
- "default": "./runtime/entry-67.js"
59
+ "default": "./runtime/entry-68.js"
60
60
  },
61
61
  "./api/last-resolved-resource": {
62
62
  "types": "./src/api/last-resolved-resource.ts",
63
- "default": "./runtime/entry-68.js"
63
+ "default": "./runtime/entry-69.js"
64
64
  },
65
65
  "./api/tool-call-interceptor": {
66
66
  "types": "./src/api/tool-call-interceptor.ts",
67
- "default": "./runtime/entry-69.js"
67
+ "default": "./runtime/entry-70.js"
68
68
  },
69
69
  "./api/tool-renderer": {
70
70
  "types": "./src/api/tool-renderer.ts",
71
- "default": "./runtime/entry-70.js"
71
+ "default": "./runtime/entry-71.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.5.1",
83
- "pi-agent-read": "0.5.1",
84
- "pi-agent-resource": "0.5.1",
85
- "pi-agent-search": "0.5.1",
86
- "pi-agent-text": "0.5.1",
87
- "pi-agent-tool-call-interception": "0.5.1",
88
- "pi-agent-tool-ui": "0.5.1",
82
+ "pi-agent-invariant": "0.6.0",
83
+ "pi-agent-read": "0.6.0",
84
+ "pi-agent-resource": "0.6.0",
85
+ "pi-agent-search": "0.6.0",
86
+ "pi-agent-text": "0.6.0",
87
+ "pi-agent-tool-call-interception": "0.6.0",
88
+ "pi-agent-tool-ui": "0.6.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-71.js"
94
+ "./runtime/entry-72.js"
95
95
  ]
96
96
  },
97
97
  "peerDependencies": {
@@ -1,2 +1 @@
1
1
  export * from "../../../dist/entry-71.js";
2
- export { default } from "../../../dist/entry-71.js";
@@ -10,7 +10,11 @@ import { Value } from "typebox/value";
10
10
  import type { TextEditorCore } from "#src/core/text-editor-core.js";
11
11
  import { ApplyResults } from "#src/core/apply/results.js";
12
12
  import { serializeApplyError, type ApplyRuntimeHost } from "#src/core/apply/runtime.js";
13
- import { executeEditorTransaction } from "#src/core/apply/transaction.js";
13
+ import { executeEditorTransaction, type EditorSnapshot } from "#src/core/apply/transaction.js";
14
+ import { TextSelectionAnchor } from "#src/api/text-selection-anchor.js";
15
+ import { TextAnchorResolutionError } from "#src/core/text-anchor-registry.js";
16
+ import { buildFailedTextMutationResult } from "#src/core/text-mutation.js";
17
+ import { TextMutationAnchorResolutionError } from "#src/core/text-mutation-anchor-error.js";
14
18
 
15
19
  /** Configured IDE services and ordinary tool schemas, shared with the standalone tools. */
16
20
  export interface ApplyServices {
@@ -41,6 +45,91 @@ export function createApplyExecution(
41
45
  ? "read"
42
46
  : "mutation";
43
47
  let recorded = false;
48
+ const resolveMutationTarget = async (): Promise<unknown> => {
49
+ const request = arguments_ as {
50
+ snapshot?: { id?: unknown; source?: unknown; content?: unknown };
51
+ query?: unknown;
52
+ };
53
+ const snapshot = request.snapshot;
54
+ const content = snapshot?.content;
55
+ if (
56
+ snapshot === undefined ||
57
+ typeof snapshot.id !== "string" ||
58
+ typeof snapshot.source !== "string" ||
59
+ typeof content !== "string" ||
60
+ typeof request.query !== "string"
61
+ )
62
+ throw failure("INVALID_ARGUMENTS", "Invalid mutation-target resolution request");
63
+ let anchor;
64
+ try {
65
+ anchor = await services.editor.resolveAnchorInText({
66
+ source: snapshot.source,
67
+ content,
68
+ value: request.query,
69
+ cwd: context.cwd,
70
+ signal,
71
+ });
72
+ } catch (error) {
73
+ if (!(error instanceof TextAnchorResolutionError)) throw error;
74
+ const cause = new TextMutationAnchorResolutionError(
75
+ "apply",
76
+ "target",
77
+ snapshot.source,
78
+ request.query,
79
+ error,
80
+ );
81
+ const presentation = await buildFailedTextMutationResult(
82
+ services.editor,
83
+ { code: "RESOLVE_FAILED", source: snapshot.source, message: error.message, cause },
84
+ { ...context, signal },
85
+ );
86
+ return {
87
+ selections: [],
88
+ warning: {
89
+ code: "EMPTY_SELECTION",
90
+ message: presentation.content
91
+ .filter((block) => block.type === "text")
92
+ .map((block) => block.text)
93
+ .join("\n"),
94
+ presentation: {
95
+ anchorRecoveries: presentation.details.anchorRecoveries,
96
+ },
97
+ },
98
+ };
99
+ }
100
+ const starts = lineStarts(content);
101
+ if (!TextSelectionAnchor.is(anchor)) {
102
+ const from = starts[anchor.lineNumber - 1];
103
+ if (from === undefined)
104
+ throw failure("INVALID_SELECTION", "Anchor line is outside the opened snapshot");
105
+ const to = starts[anchor.lineNumber] ?? content.length;
106
+ return {
107
+ selections: [
108
+ {
109
+ document: snapshot.id,
110
+ from,
111
+ to,
112
+ text: content.slice(from, to),
113
+ linewise: true,
114
+ },
115
+ ],
116
+ };
117
+ }
118
+ return {
119
+ selections: anchor.ranges.map((range) => {
120
+ const from = positionOffset(starts, range.start.lineNumber, range.start.column);
121
+ const to = positionOffset(starts, range.end.lineNumber, range.end.column);
122
+ return {
123
+ document: snapshot.id,
124
+ from,
125
+ to,
126
+ text: content.slice(from, to),
127
+ ...(range.linewise === true && { linewise: true }),
128
+ };
129
+ }),
130
+ };
131
+ };
132
+ if (tool === "editorResolve") return await resolveMutationTarget();
44
133
  try {
45
134
  if (tool === "editorApply") {
46
135
  let value;
@@ -61,13 +150,36 @@ export function createApplyExecution(
61
150
  if (typeof source === "string") scope.forget(source);
62
151
  throw error;
63
152
  }
64
- results.record(id, "mutation", value);
153
+ const requestedSnapshots =
154
+ (arguments_ as { snapshots?: readonly EditorSnapshot[] }).snapshots ?? [];
155
+ const refreshed = await Promise.all(
156
+ requestedSnapshots.map(async (snapshot) => {
157
+ const outcome = await services.read.read(
158
+ { path: snapshot.source },
159
+ { cwd: context.cwd, signal },
160
+ "script",
161
+ );
162
+ const script = outcome.script;
163
+ return !outcome.isError &&
164
+ script?.kind === "text" &&
165
+ typeof script.content === "string"
166
+ ? {
167
+ id: snapshot.id,
168
+ source: outcome.details.source ?? script.source,
169
+ content: script.content,
170
+ lines: script.lines,
171
+ }
172
+ : { id: snapshot.id, unavailable: true };
173
+ }),
174
+ );
175
+ const response = { ...value, snapshots: refreshed };
176
+ results.record(id, "mutation", response);
65
177
  recorded = true;
66
178
  for (const file of value.files) {
67
179
  results.updateFile(file.source, file.before, file.after);
68
180
  lastSource = file.source;
69
181
  }
70
- return value;
182
+ return response;
71
183
  }
72
184
  if (tool === "editorOpen") {
73
185
  if (!Value.Check(readParameters, arguments_))
@@ -199,6 +311,16 @@ export function createApplyExecution(
199
311
  };
200
312
  }
201
313
 
314
+ function lineStarts(content: string): number[] {
315
+ const starts = [0];
316
+ for (let index = 0; index < content.length; index += 1)
317
+ if (content[index] === "\n") starts.push(index + 1);
318
+ return starts;
319
+ }
320
+ function positionOffset(starts: readonly number[], line: number, column: number): number {
321
+ return (starts[line - 1] ?? 0) + column;
322
+ }
323
+
202
324
  function failure(code: string, message: string, details?: unknown): Error {
203
325
  return Object.assign(new Error(message), { code, details });
204
326
  }
@@ -10,7 +10,7 @@ const helpers = new Set([
10
10
  "deleteFile",
11
11
  "copyFile",
12
12
  "moveFile",
13
- "apply",
13
+ "flush",
14
14
  "result",
15
15
  ]);
16
16
 
@@ -28,6 +28,20 @@ export interface ScriptMutationOutcome {
28
28
  readonly effect: "not-applied" | "applied" | "unknown";
29
29
  readonly files: readonly ScriptMutationFile[];
30
30
  readonly completed: readonly string[];
31
+ /** Per-operation outcomes in staging order for Apply transactions. */
32
+ readonly operations?: readonly {
33
+ readonly index: number;
34
+ readonly kind: string;
35
+ readonly status: "applied" | "warning" | "failed" | "unknown" | "blocked";
36
+ readonly effect: "not-applied" | "applied" | "unknown";
37
+ readonly resources: readonly string[];
38
+ readonly error?: { readonly code: string; readonly message: string };
39
+ readonly warning?: {
40
+ readonly code: string;
41
+ readonly message: string;
42
+ readonly presentation?: unknown;
43
+ };
44
+ }[];
31
45
  /** Session-scoped receipt accepted by undo. */
32
46
  readonly transaction?: string;
33
47
  readonly recoveries?: readonly ScriptAnchorRecovery[];
@@ -42,6 +42,7 @@ export async function renderApplyOutput(
42
42
  for (const operation of selected.automatic) {
43
43
  if (
44
44
  operation.kind === "read" ||
45
+ hasOperationWarnings(operation.value) ||
45
46
  isFailure(operation.value) ||
46
47
  (operation.value !== null &&
47
48
  typeof operation.value === "object" &&
@@ -140,6 +141,18 @@ function expandReadSection(section: {
140
141
  ? resources.flatMap((read) => expandReadSection({ content: read.content, read }))
141
142
  : [section];
142
143
  }
144
+ function hasOperationWarnings(value: unknown): boolean {
145
+ return (
146
+ value !== null &&
147
+ typeof value === "object" &&
148
+ "operations" in value &&
149
+ Array.isArray(value.operations) &&
150
+ (value.operations as unknown[]).some(
151
+ (item) =>
152
+ item !== null && typeof item === "object" && "status" in item && item.status === "warning",
153
+ )
154
+ );
155
+ }
143
156
  function isFailure(value: unknown): boolean {
144
157
  return value !== null && typeof value === "object" && "ok" in value && value.ok === false;
145
158
  }
@@ -153,7 +166,7 @@ function formatApplyFailure(code: string, message: string): string {
153
166
  NOT_FOUND:
154
167
  "The requested text or selection was not found. Read the current file and select existing text.",
155
168
  AMBIGUOUS_MATCH:
156
- "The selection matched more than once. Use a larger unique fragment or findAll().",
169
+ "The selection matched more than once. Use a larger unique fragment or a current candidate anchor.",
157
170
  STALE_EDITOR:
158
171
  "This editor handle was already committed. Open the file again before staging more changes.",
159
172
  STALE_SELECTION:
@@ -190,12 +203,14 @@ function renderValue(value: unknown): Content {
190
203
  typeof value.operation === "string"
191
204
  ) {
192
205
  const lines = [
193
- `${value.operation}: ${"effect" in value ? String(value.effect) : isFailure(value) ? "failed" : "completed"}`,
206
+ `${value.operation}: ${isFailure(value) && "effect" in value && value.effect === "applied" ? "partially applied" : "effect" in value ? String(value.effect) : isFailure(value) ? "failed" : "completed"}`,
194
207
  ];
195
208
  if ("path" in value && typeof value.path === "string") lines.push(value.path);
196
209
  if ("target" in value && typeof value.target === "string")
197
210
  lines.push(`Target: ${value.target}`);
198
- if ("errors" in value && Array.isArray(value.errors))
211
+ if ("operations" in value && Array.isArray(value.operations))
212
+ lines.push(...value.operations.map(formatOperationOutcome));
213
+ else if ("errors" in value && Array.isArray(value.errors))
199
214
  lines.push(...value.errors.map(formatReceiptError));
200
215
  if ("error" in value) lines.push(formatReceiptError(value.error));
201
216
  if (
@@ -236,6 +251,20 @@ function asReadResult(value: unknown): ReadToolResult | undefined {
236
251
  return { content: renderValue(value), details: value as ReadResultDetails };
237
252
  }
238
253
 
254
+ function formatOperationOutcome(value: unknown): string {
255
+ if (value === null || typeof value !== "object") return String(value);
256
+ const index = "index" in value ? Number(value.index) + 1 : "?";
257
+ const kind = "kind" in value ? String(value.kind) : "operation";
258
+ const status = "status" in value ? String(value.status) : "unknown";
259
+ const detail =
260
+ "warning" in value
261
+ ? ` — ${formatReceiptError(value.warning)}`
262
+ : "error" in value
263
+ ? ` — ${formatReceiptError(value.error)}`
264
+ : "";
265
+ return `${index}. ${kind}: ${status}${detail}`;
266
+ }
267
+
239
268
  function formatReceiptError(value: unknown): string {
240
269
  if (value === null || typeof value !== "object") return String(value);
241
270
  const source = "source" in value ? String(value.source) : undefined;
@@ -8,40 +8,42 @@ result(value)
8
8
  Transactional editor:
9
9
  const file = open(path | {path, views?})
10
10
  file.source; file.content; file.lines
11
- file.find(text) // exactly one match or an error
12
- file.findAll(text) // stable selections from the original snapshot
13
- file.select(searchMatch) // text, regex, or AST search match
14
- file.between(start, end, {inside?: boolean})
15
- file.line(first, last?)
16
- file.replace(selection, text)
17
- file.remove(selection)
18
- file.insertBefore(selection, text)
19
- file.insertAfter(selection, text)
20
- file.replaceAll(text, replacement)
11
+ file.find(text) // immutable SelectionSet with every exact match, including zero
12
+ file.select(searchMatch) // one-range SelectionSet
13
+ file.between(start, end, {inside?: boolean}) // every sequential non-overlapping pair
14
+ file.line(first, last?) // one-range SelectionSet
15
+ file.replace(textOrSet, replacement)
16
+ file.remove(textOrSet)
17
+ file.insertBefore(textOrSet, text)
18
+ file.insertAfter(textOrSet, text)
19
+ copy(sourceSet, destinationSet)
20
+ move(sourceSet, destinationSet)
21
21
  createFile(path, content)
22
22
  deleteFile(path)
23
23
  copyFile(path, target, {overwrite?: boolean})
24
24
  moveFile(path, target, {overwrite?: boolean})
25
- apply()
25
+ flush()
26
26
 
27
- open() returns an immutable snapshot. Selection methods produce snapshot-bound ranges. Mutation methods only stage changes; they do not modify files. All selections in one transaction refer to the original snapshots, so earlier staged edits never shift later selections. Missing or ambiguous exact matches and overlapping selections reject the transaction.
27
+ open() returns an immutable snapshot. Selection helpers return immutable snapshot-bound SelectionSets. find() returns zero or more ranges; an empty result is not an error. Mutation methods accept a direct string or SelectionSet and stage one operation for every selected range. A direct string uses every configured in-document resolver in standalone order: structured anchors first, then exact text fallback. Resolver rejection does not fall through to literal text. Position-only anchors select their natural whole line. An empty set stages a non-applying warning; exact-query provenance can include fuzzy recovery candidates and fresh line anchors. Recovery never applies a guessed edit.
28
28
 
29
- Call apply() explicitly to validate and commit all staged text and file operations together. One transaction may affect several files. A successful commit returns a session-scoped APPLY# receipt; pass it to undo({ transaction: "APPLY#..." }) before any touched path changes to restore the whole transaction. After a successful apply(), old editor handles are stale; call open() again for another transaction. A script may commit several transactions, and later reads observe earlier commits. Staged operations left without apply() do not change files and are reported as uncommitted.
29
+ All selections in one transaction refer to the current opened snapshots, so earlier staged edits never shift later selections. After each checkpoint, opened file handles refresh to actual post-outcome contents and lines; SelectionSets created before that checkpoint become stale. copy() and move() concatenate source ranges in document order and replicate that payload at every destination range. move() stages destination effects before source removals. Whole-file copyFile() and moveFile() remain separate.
30
30
 
31
- Before each commit the host verifies snapshots, resource types, ranges, overlaps, source existence, and destination conflicts. A preflight failure changes nothing. If execution fails after writing begins, the host restores captured resources and reports whether rollback completed. Do not describe an incomplete rollback as atomic success.
31
+ Pending operations commit once when the JavaScript completes normally. If the script throws, pending operations do not commit. Use flush() as an optional mid-script checkpoint. Operations run in staging order: the first valid overlapping operation wins, and later conflicts fail without undoing independent work. Check every per-operation outcome and retry only failed or blocked work. When a checkpoint changes a file, it creates one session-scoped APPLY# receipt. Explicit flush() returns it; automatic finalization reports it in the tool result. Pass the receipt to undo({ transaction: "APPLY#..." }) before any successfully changed path changes to restore all successful effects. After flush(), reuse the same opened handles and create fresh SelectionSets. Every checkpoint clears all staged operations, including failed operations and warnings. With no pending mutations, completion creates no transaction or receipt.
32
32
 
33
- Use find() for one expected occurrence, findAll()/replaceAll() for intentional repeated edits, between() for a uniquely delimited block, and line() only when line identity is genuinely part of the task. Generate replacement text with ordinary JavaScript, but never rebuild and submit a complete existing file.
33
+ Before each operation the host verifies snapshots, resource types, ranges, overlaps, source existence, and destination conflicts. A failed operation changes nothing when rollback completes. If rollback is incomplete, its effect is unknown and later dependent operations are blocked. Do not describe an unknown effect as success.
34
+
35
+ Use find() for all exact occurrences, between() for sequential delimited ranges, select() for search results, and line() only when line identity is part of the task. Use direct strings when a configured anchor or unique exact-text fallback should select one target within the opened snapshot. Generate replacement text with ordinary JavaScript.
34
36
 
35
37
  Example:
36
38
  const config = open("src/config.ts");
37
39
  const test = open("tests/config.test.ts");
38
- config.replace(config.find("legacyMode"), "stableMode");
39
- test.replaceAll("legacyMode", "stableMode");
40
- apply();
40
+ config.replace("legacyMode", "stableMode");
41
+ test.replace(test.find("legacyMode"), "stableMode");
42
+ // Normal completion commits both staged edits.
41
43
 
42
44
  Read accepts file paths, URLs, temp/search/debug/shell/diagnostics/symbol/graph resources, and supported views. Search accepts literal, regex:, files:, ast:, and symbols: queries. File changes and read-only calls are shown automatically. Use result(value) only to expose additional calculated data; do not call it merely to display committed changes.
43
45
 
44
- Do not retry by guessing argument names. Inspect structured error codes such as NOT_FOUND, AMBIGUOUS_MATCH, STALE_SNAPSHOT, INVALID_TRANSACTION, and TRANSACTION_FAILED.
46
+ Do not retry by guessing argument names. Inspect structured error codes such as EMPTY_SELECTION, STALE_SNAPSHOT, INVALID_TRANSACTION, and TRANSACTION_FAILED.
45
47
  `;
46
48
 
47
49
  /** Agent-facing guide for the guarded Apply editor. */