pi-agent-ide 0.7.1 → 0.7.3

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 (307) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +3 -1
  3. package/dist/{chunk-PKKDDIWW.js → chunk-2ZMMRINH.js} +1 -1
  4. package/dist/chunk-6U5OU77O.js +3 -0
  5. package/dist/chunk-BYZSBXUK.js +2 -0
  6. package/dist/{chunk-LEEQIQ7D.js → chunk-CEX73RI5.js} +6 -6
  7. package/dist/chunk-DZWTKF2K.js +1 -0
  8. package/dist/{chunk-WMO6RNE2.js → chunk-EOKEQ3YH.js} +6 -6
  9. package/dist/{chunk-HZEY4GT4.js → chunk-H445SHSJ.js} +2 -2
  10. package/dist/{chunk-4GCWGE2C.js → chunk-HZ5BNF3A.js} +1 -1
  11. package/dist/chunk-IG56UGSO.js +2 -0
  12. package/dist/chunk-IICJXZBU.js +6 -0
  13. package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
  14. package/dist/chunk-MXLSGMRZ.js +3 -0
  15. package/dist/{chunk-76ZK5ODR.js → chunk-NHKPP2AI.js} +13 -13
  16. package/dist/chunk-OB46OPMZ.js +1 -0
  17. package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
  18. package/dist/chunk-QUYXINGZ.js +7 -0
  19. package/dist/{chunk-OMVRLWMX.js → chunk-SBP3ABH4.js} +1 -1
  20. package/dist/{chunk-YP46DVVP.js → chunk-STBJO3Z3.js} +1 -1
  21. package/dist/{chunk-2TRHFMCZ.js → chunk-TXOTNK6B.js} +1 -1
  22. package/dist/chunk-WLZIUMJL.js +1 -0
  23. package/dist/chunk-ZIWPKIBZ.js +1 -0
  24. package/dist/entry-11.js +1 -1
  25. package/dist/entry-13.js +1 -1
  26. package/dist/entry-14.js +1 -1
  27. package/dist/entry-15.js +1 -1
  28. package/dist/entry-17.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 -1
  32. package/dist/entry-28.js +1 -1
  33. package/dist/entry-29.js +1 -1
  34. package/dist/entry-31.js +12 -11
  35. package/dist/entry-33.js +3 -1
  36. package/dist/entry-37.js +6 -6
  37. package/dist/entry-42.js +1 -1
  38. package/dist/entry-44.js +1 -1
  39. package/dist/entry-45.js +20 -12
  40. package/dist/entry-46.js +1 -1
  41. package/dist/entry-49.js +1 -1
  42. package/dist/entry-50.js +1 -1
  43. package/dist/entry-51.js +7 -6
  44. package/dist/entry-52.js +1 -1
  45. package/dist/entry-53.js +1 -1
  46. package/dist/entry-54.js +1 -1
  47. package/dist/entry-56.js +1 -1
  48. package/dist/entry-58.js +1 -1
  49. package/dist/entry-60.js +1 -1
  50. package/dist/entry-62.js +1 -1
  51. package/dist/entry-65.js +1 -1
  52. package/dist/entry-66.js +1 -1
  53. package/dist/entry-68.js +1 -1
  54. package/dist/entry-70.js +1 -1
  55. package/dist/entry-75.js +1 -1
  56. package/dist/entry-77.js +63 -49
  57. package/dist/entry-78.js +15 -14
  58. package/dist/entry-79.js +1 -1
  59. package/dist/entry-82.js +5 -5
  60. package/dist/entry-83.js +1 -1
  61. package/dist/entry-84.js +1 -1
  62. package/dist/entry-85.js +1 -1
  63. package/dist/entry-86.js +1 -1
  64. package/dist/pi-agent-ide.js +34 -11
  65. package/docs/agent-guides/editing.md +14 -7
  66. package/docs/agent-guides/git-changes.md +10 -0
  67. package/docs/agent-guides/read-resources.md +9 -46
  68. package/docs/agent-guides/search-code.md +7 -1
  69. package/docs/agent-guides/select-code.md +1 -0
  70. package/docs/agent-guides/terminal.md +9 -1
  71. package/docs/configuration.md +22 -1
  72. package/docs/development.md +4 -0
  73. package/docs/directory-operations.md +45 -0
  74. package/docs/releases.md +12 -0
  75. package/docs/research/codemode-write-context.md +56 -0
  76. package/docs/research/native-codemode-batch-decision.md +2 -0
  77. package/docs/structured-results.md +2 -2
  78. package/docs/tools.md +10 -2
  79. package/docs/user-hooks.md +26 -0
  80. package/node_modules/pi-agent-doctor/package.json +1 -1
  81. package/node_modules/pi-agent-documentation/package.json +1 -1
  82. package/node_modules/pi-agent-filesystem/package.json +7 -7
  83. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  84. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  85. package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
  86. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  87. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  88. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  89. package/node_modules/pi-agent-ide-ast/src/extension.ts +3 -3
  90. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +9 -4
  91. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +0 -3
  92. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +8 -6
  93. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +13 -5
  94. package/node_modules/pi-agent-ide-changes/package.json +9 -8
  95. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +82 -4
  96. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  97. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  98. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  99. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  100. package/node_modules/pi-agent-ide-lsp/index.ts +1 -1
  101. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  102. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +2 -1
  103. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
  104. package/node_modules/pi-agent-image/package.json +2 -2
  105. package/node_modules/pi-agent-invariant/package.json +1 -1
  106. package/node_modules/pi-agent-pdf/package.json +2 -2
  107. package/node_modules/pi-agent-read/package.json +7 -7
  108. package/node_modules/pi-agent-read/src/api/read-parameters.ts +3 -3
  109. package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -0
  110. package/node_modules/pi-agent-read/src/core/extension.ts +1 -1
  111. package/node_modules/pi-agent-read/src/core/read-core.ts +5 -1
  112. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  113. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  114. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  115. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  116. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +99 -44
  117. package/node_modules/pi-agent-resource/package.json +1 -1
  118. package/node_modules/pi-agent-resource/src/index.ts +1 -0
  119. package/node_modules/pi-agent-resource/src/result-targets.ts +6 -3
  120. package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
  121. package/node_modules/pi-agent-search/package.json +5 -5
  122. package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
  123. package/node_modules/pi-agent-search/src/api/search-parameters.ts +2 -2
  124. package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
  125. package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
  126. package/node_modules/pi-agent-search-text/package.json +7 -7
  127. package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
  128. package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
  129. package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
  130. package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
  131. package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
  132. package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
  133. package/node_modules/pi-agent-text/package.json +2 -2
  134. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  135. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  136. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  137. package/node_modules/pi-agent-text-editor/package.json +9 -9
  138. package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +24 -0
  139. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  140. package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  141. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
  142. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  143. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +4 -1
  144. package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  145. package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +284 -0
  146. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  147. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  148. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +32 -3
  149. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +30 -40
  150. package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
  151. package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +164 -0
  152. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +36 -12
  153. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +25 -1
  154. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  155. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +286 -162
  156. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  157. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
  158. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +46 -11
  159. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +21 -14
  160. package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +96 -0
  161. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  162. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +155 -22
  163. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  164. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +126 -32
  165. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +428 -189
  166. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +66 -0
  167. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -4
  168. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +15 -6
  169. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  170. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  171. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +6 -4
  172. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
  173. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  174. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  175. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  176. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +75 -11
  177. package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  178. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
  179. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  180. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  181. package/node_modules/pi-agent-web/package.json +7 -7
  182. package/node_modules/pi-agent-web/src/resolver.ts +11 -13
  183. package/node_modules/pi-agent-web-html/package.json +2 -2
  184. package/node_modules/pi-agent-web-image/package.json +3 -3
  185. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  186. package/node_modules/pi-agent-web-text/package.json +3 -3
  187. package/package.json +36 -35
  188. package/src/api/hooks.ts +24 -0
  189. package/src/composite/nested-tool-rendering.ts +184 -77
  190. package/src/composite/output-limits.ts +125 -0
  191. package/src/composite/responses-tools.ts +25 -0
  192. package/src/composite/text-results.ts +158 -7
  193. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  194. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  195. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  196. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
  197. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  198. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  199. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  200. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  201. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  202. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  203. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  204. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
  205. package/src/extensions/pi-agent-read/package.json +7 -7
  206. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +3 -3
  207. package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -0
  208. package/src/extensions/pi-agent-read/src/core/extension.ts +1 -1
  209. package/src/extensions/pi-agent-read/src/core/read-core.ts +5 -1
  210. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  211. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  212. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  213. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  214. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +99 -44
  215. package/src/extensions/pi-agent-search/package.json +5 -5
  216. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
  217. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
  218. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
  219. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
  220. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
  221. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
  222. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
  223. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
  224. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +2 -2
  225. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
  226. package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
  227. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  228. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  229. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  230. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  231. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  232. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  233. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +75 -11
  234. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  235. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
  236. package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +24 -0
  237. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  238. package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  239. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
  240. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  241. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +4 -1
  242. package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  243. package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +284 -0
  244. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  245. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  246. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +32 -3
  247. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +30 -40
  248. package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
  249. package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +164 -0
  250. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +36 -12
  251. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +25 -1
  252. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  253. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +286 -162
  254. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  255. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
  256. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +46 -11
  257. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +21 -14
  258. package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +96 -0
  259. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  260. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +155 -22
  261. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  262. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +126 -32
  263. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +428 -189
  264. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +66 -0
  265. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -4
  266. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +15 -6
  267. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  268. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  269. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +6 -4
  270. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
  271. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  272. package/src/pi-agent-ide.ts +11 -0
  273. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  274. package/src/plugins/pi-agent-ide-ast/src/extension.ts +3 -3
  275. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +9 -4
  276. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +0 -3
  277. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +8 -6
  278. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +13 -5
  279. package/src/plugins/pi-agent-ide-changes/package.json +9 -8
  280. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +82 -4
  281. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  282. package/src/plugins/pi-agent-ide-debugger/index.ts +20 -8
  283. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
  284. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
  285. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +3 -2
  286. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  287. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  288. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  289. package/src/plugins/pi-agent-ide-lsp/index.ts +1 -1
  290. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  291. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +2 -1
  292. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
  293. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
  294. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
  295. package/src/plugins/pi-agent-ide-vision/index.ts +1 -0
  296. package/src/post-edit/gate.ts +13 -2
  297. package/dist/chunk-4XMY4H4V.js +0 -1
  298. package/dist/chunk-64M3SQPG.js +0 -3
  299. package/dist/chunk-CWD4O5PM.js +0 -3
  300. package/dist/chunk-D3WTDA6V.js +0 -2
  301. package/dist/chunk-EAZGN5ND.js +0 -7
  302. package/dist/chunk-GXEGY7GV.js +0 -1
  303. package/dist/chunk-MBUXFKIW.js +0 -3
  304. package/dist/chunk-PGIVHICI.js +0 -1
  305. package/dist/chunk-VMTR74FF.js +0 -2
  306. package/dist/chunk-WU6ZK6YD.js +0 -1
  307. package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
@@ -1,20 +1,43 @@
1
- import{a as $,b as D,c as B,d as X,e as H,f as M}from"./chunk-W7CASEO3.js";import{f as z}from"./chunk-XYS4FSCC.js";import{a as V}from"./chunk-YGGKGZO2.js";import"./chunk-EAZGN5ND.js";import"./chunk-4XMY4H4V.js";import{I as J}from"./chunk-CWD4O5PM.js";import"./chunk-ZC65Z3CK.js";import{a as u}from"./chunk-EI7MMDWY.js";var L={"ide.core":["IDE services","Shared services used by language, formatting and diagnostic modules."],"ide.tips":["Getting started tips","Show contextual guidance while setting up a project."],"ide.documentation":["Progressive agent documentation","Expose packaged guides and attach them on first relevant tool use."],"ide.doctor":["Setup doctor","Check external tools and help configure project support."],"ide.languages":["Language setup","Discover languages and their recommended toolchains."],"ide.processes":["Agent IDE processes","Show active terminal and debugger sessions in one shared process surface."],"ide.vision":["Agent vision","Inspect process metadata and capture supported windows and web pages as images."],"ide.debugger":["Debugger sessions","Debug local programs through addressable DAP sessions and anchored breakpoints."],"ide.terminal":["Terminal sessions","Run and manage local interactive and background terminal processes."],"read.core":["Read tools","Read sources through the configured readers and views."],"read.filesystem":["Local files","Resolve files and folders from the local filesystem."],"read.filesystem.jq":["JSON queries","Query local JSON files through jq read views."],"read.filesystem.image":["Local images","Read local images as visual content."],"read.filesystem.pdf":["Local PDFs","Extract readable content from local PDF documents."],"read.filesystem.text":["Local text","Read local text files with their source coordinates."],"read.web":["Web sources","Read remote sources over HTTP and HTTPS."],"read.web.html":["Web pages","Extract readable content from HTML pages."],"read.web.image":["Web images","Read remote images as visual content."],"read.web.pdf":["Web PDFs","Extract text from remote PDF documents."],"read.web.text":["Web text","Read remote plain-text sources."],"search.core":["Search tools","Run searches through the configured search providers."],"search.text":["Text search","Find text and files and register reusable search selections."],"editor.core":["Editing tools","Make guarded text and whole-file changes, directly or through native Codemode."],"editor.renderer":["Edit previews","Display changes in the shared colored diff panels."],"editor.anchor.constant":["File boundary selectors","Use begin and end to select file boundaries."],"editor.anchor.line-hash":["Checked line selectors","Select lines with hashes that detect stale content."],"editor.anchor.exact":["Exact text selectors","Locate edit ranges using unique source text."],"editor.stale-anchor":["Stale selection recovery","Provide recovery guidance when an edit selection is outdated."],"ide.ast":["Structural code support","Read code outlines and search or edit exact syntax-tree nodes."],"ide.formatter":["Code formatting","Run configured formatters after edits."],"ide.lint":["Lint checks","Run configured linters and collect their findings."],"ide.changes":["Git changes","Inspect and manage uncommitted changes and undo history."],"ide.lsp":["Language servers","Resolve symbols, rename references and collect language-server diagnostics."],"ide.diagnostics":["Diagnostic views","Show diagnostic findings through read views and sources."]};var R=[y("ide.core",()=>import("./chunk-WMO6RNE2.js")),y("ide.tips",()=>import("./chunk-BMOJTJJJ.js")),y("ide.doctor",()=>import("./chunk-5JELU6RV.js")),y("ide.languages",()=>import("./entry-35.js"),["ide.doctor"]),y("read.core",()=>import("./entry-45.js")),y("ide.documentation",()=>import("./chunk-NRZO5KJT.js"),["read.core"]),y("read.filesystem",()=>import("./entry-25.js"),["read.core","editor.core"]),y("read.filesystem.jq",()=>import("./entry-27.js"),["read.filesystem","ide.documentation","ide.doctor"]),y("read.filesystem.image",()=>import("./entry-26.js"),["read.filesystem"]),y("read.filesystem.pdf",()=>import("./entry-28.js"),["read.filesystem"]),y("read.filesystem.text",()=>import("./entry-29.js"),["read.filesystem"]),y("read.web",()=>import("./entry-82.js"),["read.core"]),y("read.web.html",()=>import("./entry-83.js"),["read.web"]),y("read.web.image",()=>import("./entry-84.js"),["read.web"]),y("read.web.pdf",()=>import("./entry-85.js"),["read.web"]),y("read.web.text",()=>import("./entry-86.js"),["read.web"]),y("search.core",()=>import("./entry-50.js")),y("search.text",()=>import("./entry-51.js"),["search.core"]),y("editor.renderer",()=>import("./entry-78.js"),["editor.core"]),y("editor.core",()=>import("./entry-77.js")),y("editor.anchor.constant",()=>import("./entry-56.js"),["read.core","editor.core"]),y("editor.anchor.line-hash",()=>import("./entry-60.js"),["read.core","editor.core"]),y("editor.anchor.exact",()=>import("./entry-58.js"),["editor.core"]),y("editor.stale-anchor",()=>import("./entry-79.js"),["editor.core"]),y("ide.ast",()=>import("./entry-31.js"),["ide.core","read.core","search.core","editor.core"]),y("ide.formatter",()=>import("./entry-34.js"),["ide.core"]),y("ide.lint",()=>import("./entry-36.js"),["ide.core"]),y("ide.changes",()=>import("./entry-33.js"),["ide.core","read.core","editor.core"]),y("ide.lsp",()=>import("./entry-37.js"),["ide.core","read.core","search.core"]),y("ide.processes",()=>import("./chunk-S6QRG3TQ.js")),y("ide.vision",()=>import("./chunk-OMVRLWMX.js"),["ide.processes","read.core","search.core"]),y("ide.debugger",()=>import("./chunk-76ZK5ODR.js"),["ide.processes","read.core","editor.core"]),y("ide.terminal",()=>import("./chunk-LEEQIQ7D.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),y("ide.diagnostics",()=>import("./chunk-VMTR74FF.js"),["ide.core","read.core"])];function y(o,c,g=[],a=!0){return{id:o,name:L[o][0],description:L[o][1],dependencies:g,async register(i,f){await(await c()).default(i,f)},...a?{}:{defaultEnabled:!1}}}u(y,"builtin");function j(o,c,g){return{kind:"choice",id:o,name:c,description:g,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}u(j,"presentationPreference");var Y=[j("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),j("ui.read","Read","Choose how Read calls and results are displayed."),j("ui.search","Search","Choose how Search calls and results are displayed."),j("ui.terminal","Terminal","Choose how shell commands and terminal output are displayed."),{kind:"choice",id:"processes.activity",name:"Active Agent IDE processes",description:"Choose detailed process cards, a compact active count, or no persistent Agent IDE process UI.",default:"detailed",group:"ui",values:[{value:"detailed",label:"Detailed cards"},{value:"compact",label:"Compact count"},{value:"off",label:"Off"}]},{kind:"text",id:"vision.sequenceDurationSeconds",name:"Vision sequence duration",description:"Default sequence duration in seconds. Requests may override it, up to 10 seconds.",default:"2",group:"features"},{kind:"text",id:"vision.sequenceIntervalSeconds",name:"Vision sequence interval",description:"Default seconds between sequence frames. A sequence may contain at most 20 frames.",default:"0.5",group:"features"},{kind:"text",id:"vision.imageScale",name:"Vision image scale",description:"Default image downscale from greater than 0 through 1.",default:"0.5",group:"features"},{kind:"text",id:"vision.allowedExecutables",name:"Vision allowed executables",description:"Comma-separated executable file names that may be captured without arbitrary-window access.",default:"",group:"features",placeholder:"Unity.exe,UnrealEditor.exe"}];function O(o,c,g=[]){let a=new Map;for(let n of o){if(a.has(n.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${n.id}`);a.set(n.id,n)}for(let n of o)for(let b of n.dependencies)if(!a.has(b))throw new Error(`Pi Agent IDE extension ${n.id} has unknown dependency ${b}`);let i=new Set;for(let n of c)a.has(n)&&i.add(n);for(let n of g)if(!a.has(n))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${n}`);let f=pe(a,g,i),m=new Set;for(let n of o)(n.defaultEnabled===!1&&!f.has(n.id)||i.has(n.id))&&m.add(n.id);let x=!0;for(;x;){x=!1;for(let n of o)m.has(n.id)||n.dependencies.every(b=>!m.has(b))||(m.add(n.id),x=!0)}return{enabled:o.filter(n=>!m.has(n.id)),disabled:m}}u(O,"selectBuiltinExtensions");function pe(o,c,g){let a=new Set,i=[...c];for(;i.length>0;){let f=i.pop();if(!(a.has(f)||g.has(f))){a.add(f);for(let m of o.get(f)?.dependencies??[])a.has(m)||i.push(m)}}return a}u(pe,"collectForcedOn");import{Input as Ee}from"@earendil-works/pi-tui";import{mkdir as ge,readFile as me,writeFile as he}from"node:fs/promises";import be from"node:path";import{withFileMutationQueue as ye}from"@earendil-works/pi-coding-agent";async function K(o,c,g=new Map,a=new Map,i){await ye(o,async()=>{let f=await M(o),m={};try{m=JSON.parse(await me(o,"utf8"))}catch(e){if(!(e instanceof Error&&"code"in e&&e.code==="ENOENT"))throw e}let x=new Set(f.disabled),n=new Set(f.enabled);for(let[e,t]of c)x.delete(e),n.delete(e),t==="disabled"&&x.add(e),t==="enabled"&&n.add(e);let b={...f.preferences};for(let[e,t]of a)t===void 0?delete b[e]:b[e]=t;let s={...f.flags};for(let[e,t]of g)e==="pi-agent-ide-no-animations"&&delete m.noAnimations,e==="pi-agent-ide-no-post-processing"&&delete m.noPostProcessing,t===void 0?delete s[e]:s[e]=t;await ge(be.dirname(o),{recursive:!0}),await he(o,`${JSON.stringify({...m,disabled:[...x],enabled:[...n],...i===void 0?{}:{preset:i},...g.size>0?{flags:s}:{},...a.size>0?{preferences:b}:{}},null,2)}
2
- `)})}u(K,"saveModuleChoices");import{getSettingsListTheme as we}from"@earendil-works/pi-coding-agent";import{matchesKey as F,SettingsList as xe,truncateToWidth as Q,visibleWidth as Z}from"@earendil-works/pi-tui";function ee(o,c,g,a,i=""){let f=["extensions","behavior","ui"],m="extensions",x=u(r=>r==="extensions"?"modules":r==="behavior"?"features":"ui","itemKey"),n=u(r=>r==="extensions"?"modules":r==="behavior"?"features":"ui","changeKey"),b=u(()=>{let r=x(m),d=c()[r]??[];return new xe(d,12,we(),(l,w)=>{g(n(m),l,w);for(let v of c()[r]??[]){let S=d.find(I=>I.id===v.id);S&&Object.assign(S,v)}},()=>a(!1),{enableSearch:!0})},"createList"),s=b(),e=u(r=>o.fg("borderMuted",r),"border"),t=u((r,d)=>{if(d<=1)return e("\u2502");let l=d-2,w=Q(r,l);return`${e("\u2502")}${w}${" ".repeat(Math.max(0,l-Z(w)))}${e("\u2502")}`},"row"),p=u(r=>e(r<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,r-2))}\u2524`),"rule");return{render(r){let d=Math.max(1,r),l=Math.max(1,d-4),w=` Agent IDE settings${i?` \xB7 ${i}`:""} `,v=d<=1?e("\u256D"):`${e("\u256D\u2500")}${o.fg("accent",o.bold(Q(w,Math.max(0,d-3),"")))}${e(`${"\u2500".repeat(Math.max(0,d-Z(w)-3))}\u256E`)}`,S={extensions:"Features",behavior:"Behavior",ui:"UI"},I=f.map(A=>A===m?o.fg("accent",o.bold(`[ ${S[A]} ]`)):o.fg("dim",` ${S[A]} `)).join(" "),T=s.render(l).map(A=>t(` ${A} `,d)),P=o.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[v,t(` ${I} `,d),p(d),...T,p(d),t(P,d),e(d<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,d-2))}\u256F`)]},invalidate(){s.invalidate()},handleInput(r){F(r,"tab")||F(r,"shift+tab")?(m=f[(f.indexOf(m)+(F(r,"shift+tab")?2:1))%f.length]??"extensions",s=b()):F(r,"ctrl+s")?a(!0):s.handleInput(r)}}}u(ee,"createSettingsPanel");function te(o,c=[],g=[]){o.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(a,i){if(i.hasUI)try{let f=await i.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(f===void 0)return;let m=B(process.env,void 0,i.cwd),x=f==="Project"?m.projectPath:m.globalPath,n=await M(x),b=await M(f==="Project"?m.globalPath:m.projectPath),s=new Map,e=new Map,t=new Map,p;if(!await i.ui.custom((d,l,w,v)=>{let S=ee(l,()=>{let I=new Set(n.disabled),T=new Set(n.enabled);for(let[E,h]of s)I.delete(E),T.delete(E),h==="disabled"&&I.add(E),h==="enabled"&&T.add(E);let P=O(R,[...D(R,p??n.preset??"full"),...I,...D(R,b.preset??"full"),...b.disabled],[...T,...b.enabled]);return{modules:R.map(E=>({id:E.id,label:E.name??E.id,description:`${E.description??""} Effective: ${P.disabled.has(E.id)?"off":"on"}.${b.disabled.includes(E.id)?" Disabled in the other scope.":E.dependencies.some(h=>P.disabled.has(h))?" A dependency is disabled.":""}`,currentValue:s.get(E.id)??(n.disabled.includes(E.id)?"disabled":n.enabled.includes(E.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[A(),...q("features"),..._("features")],ui:[...q("ui"),..._("ui")]};function A(){let E=p??n.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:$.find(h=>h.value===E)?.label??E,values:$.map(h=>h.label)}}function _(E){return g.filter(h=>h.group===E).map(h=>{let k=t.has(h.id)?t.get(h.id):n.preferences?.[h.id];return{id:h.id,label:h.name,description:`${h.description} Default: ${h.kind==="choice"?h.values.find(C=>C.value===h.default)?.label??h.default:h.default||"empty"}.`,currentValue:k===void 0?"default":h.kind==="choice"?h.values.find(C=>C.value===k)?.label??k:k,...h.kind==="choice"?{values:["default",...h.values.map(C=>C.label)]}:{submenu:u((C,G)=>{let N=new Ee,W=C==="default"?h.default:C;return W.length>0&&N.handleInput(W),N.focused=!0,N.onSubmit=fe=>G(fe),N.onEscape=()=>G(),N},"submenu")}}})}function q(E){return c.filter(h=>(h.group??"features")===E).map(h=>{let k=e.has(h.id)?e.get(h.id):H(n)[h.id];return{id:h.id,label:h.name,description:h.description,currentValue:k===void 0?"default":k?h.labels?.on??"enabled":h.labels?.off??"disabled",values:["default",h.labels?.off??"disabled",h.labels?.on??"enabled"]}})}},(I,T,P)=>{if(I==="modules")s.set(T,P);else if(T==="preset")p=$.find(A=>A.label===P)?.value;else if(g.some(A=>A.id===T)){let A=g.find(_=>_.id===T);t.set(T,P==="default"||P.length===0?void 0:A?.kind==="choice"?A.values.find(_=>_.label===P)?.value:P)}else e.set(T,P==="default"?void 0:P===(c.find(A=>A.id===T)?.labels?.on??"enabled"))},v,f);return{render:u(I=>S.render(I),"render"),invalidate:u(()=>S.invalidate(),"invalidate"),handleInput(I){S.handleInput(I),d.requestRender()}}})||s.size+e.size+t.size+(p===void 0?0:1)===0)return;if(await K(x,s,e,t,p),i.ui.notify(`Saved ${f.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await i.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await i.reload();return}}catch(f){i.ui.notify(f instanceof Error?f.message:String(f),"error")}}})}u(te,"registerModuleSettings");function ne(o,c){let g=[];return{definitions:g,register(a){if(g.some(i=>i.id===a.id))throw new Error(`Duplicate feature flag: ${a.id}`);g.push(a),o.registerFlag(a.id,{type:"boolean",description:a.description,default:c[a.id]??a.default})}}}u(ne,"createFeatureFlags");function oe(o){let c=new Map,g=new Set;return{api:{...o,registerTool:u(i=>{i.namespace?.name.startsWith("ide_")===!0&&c.set(i.name,{hide:u(()=>o.registerTool({...i,get description(){return i.description},get promptGuidelines(){return i.promptGuidelines},exposure:"hidden"}),"hide"),restore:u(()=>o.registerTool(i),"restore")}),g.has(i.name)?c.get(i.name)?.hide():o.registerTool(i)},"registerTool")},reconcile(i=!1,f=[]){let m=new Set,x=new Set;for(let t of o.getSettings().defaultTools??[])if(t.startsWith("-"))m.add(t.slice(1)),x.delete(t.slice(1));else{let p=t.startsWith("+")?t.slice(1):t;m.delete(p),x.add(p)}for(let[t,p]of c)m.has(t)!==g.has(t)&&(m.has(t)?(p.hide(),g.add(t)):(p.restore(),g.delete(t)));let n=o.getAllTools().filter(t=>t.exposure!=="hidden"),b=new Set(o.getActiveTools());for(let t of n)i&&c.has(t.name)&&(x.has(t.name)||t.exposure==="deferred"&&f.includes(t.name))&&b.add(t.name);i&&!m.has("tool_search")&&n.some(t=>t.name==="tool_search")&&n.some(t=>c.has(t.name)&&t.exposure==="deferred")&&b.add("tool_search");let s=o.getActiveTools(),e=[...b].filter(t=>!g.has(t));(e.length!==s.length||e.some(t=>!s.includes(t)))&&o.setActiveTools(e)}}}u(oe,"createIdeToolAvailability");import{ToolExecutionComponent as se}from"@earendil-works/pi-coding-agent";import{Container as Ie,Spacer as Ae,Text as re}from"@earendil-works/pi-tui";var U="ide-nested-results",ve=256,ie=512*1024,Se=8*1024,Te=32*1024;function ae(o){let c=new Map,g=new Map,a=new Map,i,f=new WeakMap,m=u((s,e,t)=>{e.result=t;try{let r=JSON.stringify(s);if(Buffer.byteLength(r)<=ie){e.result=JSON.parse(JSON.stringify(t));return}}catch{}let p=t.details&&typeof t.details=="object"?Object.entries(t.details).filter(([r,d])=>(r==="source"||r==="fullOutputPath")&&typeof d=="string").map(([r,d])=>`${r}: ${String(d)}`):[];e.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...p].join(`
3
- `)}],details:void 0,isError:t.isError},e.omitted=!0,s.complete=!1},"retainResult"),x=u(()=>{g.clear(),a.clear()},"clear");o.on("session_start",(s,e)=>{x(),e.mode==="tui"&&e.ui.setWidget(U,t=>(i=t,{render:u(()=>[],"render"),invalidate:u(()=>{},"invalidate")}))}),o.on("session_tree",x),o.on("session_shutdown",x),o.on("tool_execution_start",(s,e)=>{if(s.parentToolCallId===void 0)return;let t=g.get(s.parentToolCallId)??s.parentToolCallId;if(g.set(s.toolCallId,t),s.toolName==="flush"||!c.has(s.toolName))return;let p=a.get(t);if(p||(p={parentToolCallId:t,cwd:e.cwd,calls:[],complete:!0},a.set(t,p)),p.calls.length>=ve){p.complete=!1;return}let r=JSON.stringify(s.args),d=Te-p.calls.reduce((S,I)=>S+Buffer.byteLength(JSON.stringify(I.args)),0),l=Buffer.byteLength(r)>Math.min(Se,d),w=l?Object.fromEntries(Object.entries(s.args).map(([S,I])=>[S,typeof I=="string"?I.slice(0,200)+(I.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(r),v=Buffer.byteLength(JSON.stringify(w))<=d?w:{};p.calls.push({id:s.toolCallId,name:s.toolName,args:v}),l&&(p.complete=!1)}),o.on("tool_execution_end",s=>{let e=g.get(s.toolCallId);if(e===void 0)return;g.delete(s.toolCallId);let t=a.get(e),p=t?.calls.find(r=>r.id===s.toolCallId);if(t&&p){let r=s.result;m(t,p,{content:r.content.filter(d=>d.type!=="text"||!d.text.startsWith(`
1
+ import{a as j,b as $,c as L,d as ee,e as te,f as B}from"./chunk-W7CASEO3.js";import{f as q}from"./chunk-IM24DB3K.js";import{a as Z}from"./chunk-YGGKGZO2.js";import"./chunk-QUYXINGZ.js";import"./chunk-WLZIUMJL.js";import{a as Y}from"./chunk-BU7IZLKB.js";import{a as H,b as X}from"./chunk-S5PL5DFQ.js";import{J as Q,d as K}from"./chunk-6U5OU77O.js";import"./chunk-ZC65Z3CK.js";import{a as f}from"./chunk-EI7MMDWY.js";var G={"ide.core":["IDE services","Shared services used by language, formatting and diagnostic modules."],"ide.tips":["Getting started tips","Show contextual guidance while setting up a project."],"ide.documentation":["Progressive agent documentation","Expose packaged guides and attach them on first relevant tool use."],"ide.doctor":["Setup doctor","Check external tools and help configure project support."],"ide.languages":["Language setup","Discover languages and their recommended toolchains."],"ide.processes":["Agent IDE processes","Show active terminal and debugger sessions in one shared process surface."],"ide.vision":["Agent vision","Inspect process metadata and capture supported windows and web pages as images."],"ide.debugger":["Debugger sessions","Debug local programs through addressable DAP sessions and anchored breakpoints."],"ide.terminal":["Terminal sessions","Run and manage local interactive and background terminal processes."],"read.core":["Read tools","Read sources through the configured readers and views."],"read.filesystem":["Local files","Resolve files and folders from the local filesystem."],"read.filesystem.jq":["JSON queries","Query local JSON files through jq read views."],"read.filesystem.image":["Local images","Read local images as visual content."],"read.filesystem.pdf":["Local PDFs","Extract readable content from local PDF documents."],"read.filesystem.text":["Local text","Read local text files with their source coordinates."],"read.web":["Web sources","Read remote sources over HTTP and HTTPS."],"read.web.html":["Web pages","Extract readable content from HTML pages."],"read.web.image":["Web images","Read remote images as visual content."],"read.web.pdf":["Web PDFs","Extract text from remote PDF documents."],"read.web.text":["Web text","Read remote plain-text sources."],"search.core":["Search tools","Run searches through the configured search providers."],"search.text":["Text search","Find text and files and register reusable search selections."],"editor.core":["Editing tools","Make guarded text and whole-file changes, directly or through native Codemode."],"editor.renderer":["Edit previews","Display changes in the shared colored diff panels."],"editor.anchor.constant":["File boundary selectors","Use begin and end to select file boundaries."],"editor.anchor.line-hash":["Checked line selectors","Select lines with hashes that detect stale content."],"editor.anchor.exact":["Exact text selectors","Locate edit ranges using unique source text."],"editor.stale-anchor":["Stale selection recovery","Provide recovery guidance when an edit selection is outdated."],"ide.ast":["Structural code support","Read code outlines and search or edit exact syntax-tree nodes."],"ide.formatter":["Code formatting","Run configured formatters after edits."],"ide.lint":["Lint checks","Run configured linters and collect their findings."],"ide.changes":["Git changes","Inspect and manage uncommitted changes and undo history."],"ide.lsp":["Language servers","Resolve symbols, rename references and collect language-server diagnostics."],"ide.diagnostics":["Diagnostic views","Show diagnostic findings through read views and sources."]};var O=[T("ide.core",()=>import("./chunk-EOKEQ3YH.js")),T("ide.tips",()=>import("./chunk-BMOJTJJJ.js")),T("ide.doctor",()=>import("./chunk-5JELU6RV.js")),T("ide.languages",()=>import("./entry-35.js"),["ide.doctor"]),T("read.core",()=>import("./entry-45.js")),T("ide.documentation",()=>import("./chunk-NRZO5KJT.js"),["read.core"]),T("read.filesystem",()=>import("./entry-25.js"),["read.core","editor.core"]),T("read.filesystem.jq",()=>import("./entry-27.js"),["read.filesystem","ide.documentation","ide.doctor"]),T("read.filesystem.image",()=>import("./entry-26.js"),["read.filesystem"]),T("read.filesystem.pdf",()=>import("./entry-28.js"),["read.filesystem"]),T("read.filesystem.text",()=>import("./entry-29.js"),["read.filesystem"]),T("read.web",()=>import("./entry-82.js"),["read.core"]),T("read.web.html",()=>import("./entry-83.js"),["read.web"]),T("read.web.image",()=>import("./entry-84.js"),["read.web"]),T("read.web.pdf",()=>import("./entry-85.js"),["read.web"]),T("read.web.text",()=>import("./entry-86.js"),["read.web"]),T("search.core",()=>import("./entry-50.js")),T("search.text",()=>import("./entry-51.js"),["search.core"]),T("editor.renderer",()=>import("./entry-78.js"),["editor.core"]),T("editor.core",()=>import("./entry-77.js")),T("editor.anchor.constant",()=>import("./entry-56.js"),["read.core","editor.core"]),T("editor.anchor.line-hash",()=>import("./entry-60.js"),["read.core","editor.core"]),T("editor.anchor.exact",()=>import("./entry-58.js"),["editor.core"]),T("editor.stale-anchor",()=>import("./entry-79.js"),["editor.core"]),T("ide.ast",()=>import("./entry-31.js"),["ide.core","read.core","search.core","editor.core"]),T("ide.formatter",()=>import("./entry-34.js"),["ide.core"]),T("ide.lint",()=>import("./entry-36.js"),["ide.core"]),T("ide.changes",()=>import("./entry-33.js"),["ide.core","read.core","editor.core"]),T("ide.lsp",()=>import("./entry-37.js"),["ide.core","read.core","search.core"]),T("ide.processes",()=>import("./chunk-S6QRG3TQ.js")),T("ide.vision",()=>import("./chunk-SBP3ABH4.js"),["ide.processes","read.core","search.core"]),T("ide.debugger",()=>import("./chunk-NHKPP2AI.js"),["ide.processes","read.core","editor.core"]),T("ide.terminal",()=>import("./chunk-CEX73RI5.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),T("ide.diagnostics",()=>import("./chunk-BYZSBXUK.js"),["ide.core","read.core"])];function T(e,l,p=[],c=!0){return{id:e,name:G[e][0],description:G[e][1],dependencies:p,async register(r,m){await(await l()).default(r,m)},...c?{}:{defaultEnabled:!1}}}f(T,"builtin");function F(e,l,p){return{kind:"choice",id:e,name:l,description:p,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}f(F,"presentationPreference");var ne=[F("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),F("ui.read","Read","Choose how Read calls and results are displayed."),F("ui.search","Search","Choose how Search calls and results are displayed."),F("ui.terminal","Terminal","Choose how shell commands and terminal output are displayed."),{kind:"choice",id:"processes.activity",name:"Active Agent IDE processes",description:"Choose detailed process cards, a compact active count, or no persistent Agent IDE process UI.",default:"detailed",group:"ui",values:[{value:"detailed",label:"Detailed cards"},{value:"compact",label:"Compact count"},{value:"off",label:"Off"}]},{kind:"text",id:"vision.sequenceDurationSeconds",name:"Vision sequence duration",description:"Default sequence duration in seconds. Requests may override it, up to 10 seconds.",default:"2",group:"features"},{kind:"text",id:"vision.sequenceIntervalSeconds",name:"Vision sequence interval",description:"Default seconds between sequence frames. A sequence may contain at most 20 frames.",default:"0.5",group:"features"},{kind:"text",id:"vision.imageScale",name:"Vision image scale",description:"Default image downscale from greater than 0 through 1.",default:"0.5",group:"features"},{kind:"text",id:"vision.allowedExecutables",name:"Vision allowed executables",description:"Comma-separated executable file names that may be captured without arbitrary-window access.",default:"",group:"features",placeholder:"Unity.exe,UnrealEditor.exe"}];function U(e,l,p=[]){let c=new Map;for(let u of e){if(c.has(u.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${u.id}`);c.set(u.id,u)}for(let u of e)for(let w of u.dependencies)if(!c.has(w))throw new Error(`Pi Agent IDE extension ${u.id} has unknown dependency ${w}`);let r=new Set;for(let u of l)c.has(u)&&r.add(u);for(let u of p)if(!c.has(u))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${u}`);let m=Te(c,p,r),h=new Set;for(let u of e)(u.defaultEnabled===!1&&!m.has(u.id)||r.has(u.id))&&h.add(u.id);let v=!0;for(;v;){v=!1;for(let u of e)h.has(u.id)||u.dependencies.every(w=>!h.has(w))||(h.add(u.id),v=!0)}return{enabled:e.filter(u=>!h.has(u.id)),disabled:h}}f(U,"selectBuiltinExtensions");function Te(e,l,p){let c=new Set,r=[...l];for(;r.length>0;){let m=r.pop();if(!(c.has(m)||p.has(m))){c.add(m);for(let h of e.get(m)?.dependencies??[])c.has(h)||r.push(h)}}return c}f(Te,"collectForcedOn");import{Input as Ne}from"@earendil-works/pi-tui";import{mkdir as ve,readFile as Se,writeFile as Re}from"node:fs/promises";import Pe from"node:path";import{withFileMutationQueue as Ce}from"@earendil-works/pi-coding-agent";async function oe(e,l,p=new Map,c=new Map,r){await Ce(e,async()=>{let m=await B(e),h={};try{h=JSON.parse(await Se(e,"utf8"))}catch(n){if(!(n instanceof Error&&"code"in n&&n.code==="ENOENT"))throw n}let v=new Set(m.disabled),u=new Set(m.enabled);for(let[n,s]of l)v.delete(n),u.delete(n),s==="disabled"&&v.add(n),s==="enabled"&&u.add(n);let w={...m.preferences};for(let[n,s]of c)s===void 0?delete w[n]:w[n]=s;let g={...m.flags};for(let[n,s]of p)n==="pi-agent-ide-no-animations"&&delete h.noAnimations,n==="pi-agent-ide-no-post-processing"&&delete h.noPostProcessing,s===void 0?delete g[n]:g[n]=s;await ve(Pe.dirname(e),{recursive:!0}),await Re(e,`${JSON.stringify({...h,disabled:[...v],enabled:[...u],...r===void 0?{}:{preset:r},...p.size>0?{flags:g}:{},...c.size>0?{preferences:w}:{}},null,2)}
2
+ `)})}f(oe,"saveModuleChoices");import{getSettingsListTheme as ke}from"@earendil-works/pi-coding-agent";import{matchesKey as W,SettingsList as _e,truncateToWidth as se,visibleWidth as re}from"@earendil-works/pi-tui";function ie(e,l,p,c,r=""){let m=["extensions","behavior","ui"],h="extensions",v=f(i=>i==="extensions"?"modules":i==="behavior"?"features":"ui","itemKey"),u=f(i=>i==="extensions"?"modules":i==="behavior"?"features":"ui","changeKey"),w=f(()=>{let i=v(h),o=l()[i]??[];return new _e(o,12,ke(),(a,d)=>{p(u(h),a,d);for(let x of l()[i]??[]){let b=o.find(E=>E.id===x.id);b&&Object.assign(b,x)}},()=>c(!1),{enableSearch:!0})},"createList"),g=w(),n=f(i=>e.fg("borderMuted",i),"border"),s=f((i,o)=>{if(o<=1)return n("\u2502");let a=o-2,d=se(i,a);return`${n("\u2502")}${d}${" ".repeat(Math.max(0,a-re(d)))}${n("\u2502")}`},"row"),t=f(i=>n(i<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,i-2))}\u2524`),"rule");return{render(i){let o=Math.max(1,i),a=Math.max(1,o-4),d=` Agent IDE settings${r?` \xB7 ${r}`:""} `,x=o<=1?n("\u256D"):`${n("\u256D\u2500")}${e.fg("accent",e.bold(se(d,Math.max(0,o-3),"")))}${n(`${"\u2500".repeat(Math.max(0,o-re(d)-3))}\u256E`)}`,b={extensions:"Features",behavior:"Behavior",ui:"UI"},E=m.map(A=>A===h?e.fg("accent",e.bold(`[ ${b[A]} ]`)):e.fg("dim",` ${b[A]} `)).join(" "),I=g.render(a).map(A=>s(` ${A} `,o)),R=e.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[x,s(` ${E} `,o),t(o),...I,t(o),s(R,o),n(o<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,o-2))}\u256F`)]},invalidate(){g.invalidate()},handleInput(i){W(i,"tab")||W(i,"shift+tab")?(h=m[(m.indexOf(h)+(W(i,"shift+tab")?2:1))%m.length]??"extensions",g=w()):W(i,"ctrl+s")?c(!0):g.handleInput(i)}}}f(ie,"createSettingsPanel");function ae(e,l=[],p=[]){e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(c,r){if(r.hasUI)try{let m=await r.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(m===void 0)return;let h=L(process.env,void 0,r.cwd),v=m==="Project"?h.projectPath:h.globalPath,u=await B(v),w=await B(m==="Project"?h.globalPath:h.projectPath),g=new Map,n=new Map,s=new Map,t;if(!await r.ui.custom((o,a,d,x)=>{let b=ie(a,()=>{let E=new Set(u.disabled),I=new Set(u.enabled);for(let[P,y]of g)E.delete(P),I.delete(P),y==="disabled"&&E.add(P),y==="enabled"&&I.add(P);let R=U(O,[...$(O,t??u.preset??"full"),...E,...$(O,w.preset??"full"),...w.disabled],[...I,...w.enabled]);return{modules:O.map(P=>({id:P.id,label:P.name??P.id,description:`${P.description??""} Effective: ${R.disabled.has(P.id)?"off":"on"}.${w.disabled.includes(P.id)?" Disabled in the other scope.":P.dependencies.some(y=>R.disabled.has(y))?" A dependency is disabled.":""}`,currentValue:g.get(P.id)??(u.disabled.includes(P.id)?"disabled":u.enabled.includes(P.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[A(),...k("features"),...S("features")],ui:[...k("ui"),...S("ui")]};function A(){let P=t??u.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:j.find(y=>y.value===P)?.label??P,values:j.map(y=>y.label)}}function S(P){return p.filter(y=>y.group===P).map(y=>{let C=s.has(y.id)?s.get(y.id):u.preferences?.[y.id];return{id:y.id,label:y.name,description:`${y.description} Default: ${y.kind==="choice"?y.values.find(_=>_.value===y.default)?.label??y.default:y.default||"empty"}.`,currentValue:C===void 0?"default":y.kind==="choice"?y.values.find(_=>_.value===C)?.label??C:C,...y.kind==="choice"?{values:["default",...y.values.map(_=>_.label)]}:{submenu:f((_,z)=>{let D=new Ne,V=_==="default"?y.default:_;return V.length>0&&D.handleInput(V),D.focused=!0,D.onSubmit=Ae=>z(Ae),D.onEscape=()=>z(),D},"submenu")}}})}function k(P){return l.filter(y=>(y.group??"features")===P).map(y=>{let C=n.has(y.id)?n.get(y.id):te(u)[y.id];return{id:y.id,label:y.name,description:y.description,currentValue:C===void 0?"default":C?y.labels?.on??"enabled":y.labels?.off??"disabled",values:["default",y.labels?.off??"disabled",y.labels?.on??"enabled"]}})}},(E,I,R)=>{if(E==="modules")g.set(I,R);else if(I==="preset")t=j.find(A=>A.label===R)?.value;else if(p.some(A=>A.id===I)){let A=p.find(S=>S.id===I);s.set(I,R==="default"||R.length===0?void 0:A?.kind==="choice"?A.values.find(S=>S.label===R)?.value:R)}else n.set(I,R==="default"?void 0:R===(l.find(A=>A.id===I)?.labels?.on??"enabled"))},x,m);return{render:f(E=>b.render(E),"render"),invalidate:f(()=>b.invalidate(),"invalidate"),handleInput(E){b.handleInput(E),o.requestRender()}}})||g.size+n.size+s.size+(t===void 0?0:1)===0)return;if(await oe(v,g,n,s,t),r.ui.notify(`Saved ${m.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await r.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await r.reload();return}}catch(m){r.ui.notify(m instanceof Error?m.message:String(m),"error")}}})}f(ae,"registerModuleSettings");function de(e,l){let p=[];return{definitions:p,register(c){if(p.some(r=>r.id===c.id))throw new Error(`Duplicate feature flag: ${c.id}`);p.push(c),e.registerFlag(c.id,{type:"boolean",description:c.description,default:l[c.id]??c.default})}}}f(de,"createFeatureFlags");function le(e){let l=new Map,p=new Set;return{api:{...e,registerTool:f(r=>{r.namespace?.name.startsWith("ide_")===!0&&l.set(r.name,{hide:f(()=>e.registerTool({...r,get description(){return r.description},get promptGuidelines(){return r.promptGuidelines},exposure:"hidden"}),"hide"),restore:f(()=>e.registerTool(r),"restore")}),p.has(r.name)?l.get(r.name)?.hide():e.registerTool(r)},"registerTool")},reconcile(r=!1,m=[]){let h=new Set,v=new Set;for(let s of e.getSettings().defaultTools??[])if(s.startsWith("-"))h.add(s.slice(1)),v.delete(s.slice(1));else{let t=s.startsWith("+")?s.slice(1):s;h.delete(t),v.add(t)}for(let[s,t]of l)h.has(s)!==p.has(s)&&(h.has(s)?(t.hide(),p.add(s)):(t.restore(),p.delete(s)));let u=e.getAllTools().filter(s=>s.exposure!=="hidden"),w=new Set(e.getActiveTools());for(let s of u)r&&l.has(s.name)&&(v.has(s.name)||s.exposure==="deferred"&&m.includes(s.name))&&w.add(s.name);r&&!h.has("tool_search")&&u.some(s=>s.name==="tool_search")&&u.some(s=>l.has(s.name)&&s.exposure==="deferred")&&w.add("tool_search");let g=e.getActiveTools(),n=[...w].filter(s=>!p.has(s));(n.length!==g.length||n.some(s=>!g.includes(s)))&&e.setActiveTools(n)}}}f(le,"createIdeToolAvailability");import{ToolExecutionComponent as ce}from"@earendil-works/pi-coding-agent";import{Container as Oe,Spacer as Me,Text as ue}from"@earendil-works/pi-tui";var J="ide-nested-results",fe=256,pe=512*1024,ge=8*1024,De=32*1024,$e=f(()=>({argumentsTruncated:!1,resultsOmitted:!1,callsOmitted:!1,resultsUnavailable:!1}),"retained");function Be(e){let l=e.retention,p=[l?.argumentsTruncated&&"arguments shortened",l?.resultsOmitted&&"result displays omitted",l?.callsOmitted&&"call panels omitted",l?.resultsUnavailable&&"results unavailable"].filter(Boolean);if(p.length>0)return`Nested IDE display: ${p.join("; ")}. Tool execution and parent output are unchanged.`;if(!l&&e.complete===!1)return"Nested IDE display is incomplete; omission details are unavailable."}f(Be,"retentionWarning");function me(e){let l=new Map,p=new Map,c=new Map,r,m=new WeakMap,h=f((g,n,s)=>{n.result=s,n.resultOmitted=!1;try{let i=JSON.stringify(g);if(Buffer.byteLength(i)<=pe){n.result=JSON.parse(JSON.stringify(s));return}}catch{}let t=s.details&&typeof s.details=="object"?Object.entries(s.details).filter(([i,o])=>(i==="source"||i==="fullOutputPath")&&typeof o=="string").map(([i,o])=>`${i}: ${String(o)}`):[];n.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...t].join(`
3
+ `)}],details:void 0,isError:s.isError},n.resultOmitted=!0},"retainResult"),v=f(()=>{p.clear(),c.clear()},"clear");e.on("session_start",(g,n)=>{v(),n.mode==="tui"&&n.ui.setWidget(J,s=>(r=s,{render:f(()=>[],"render"),invalidate:f(()=>{},"invalidate")}))}),e.on("session_tree",v),e.on("session_shutdown",v),e.on("tool_execution_start",(g,n)=>{if(g.parentToolCallId===void 0)return;let s=p.get(g.parentToolCallId)??g.parentToolCallId;if(p.set(g.toolCallId,s),!l.has(g.toolName))return;let t=c.get(s);if(t||(t={parentToolCallId:s,cwd:n.cwd,calls:[],retention:$e()},c.set(s,t)),t.calls.length>=fe){t.retention.callsOmitted=!0;return}let i=JSON.stringify(g.args),o=De-t.calls.reduce((b,E)=>b+Buffer.byteLength(JSON.stringify(E.args)),0)-(fe-t.calls.length-1)*2,a=Buffer.byteLength(i)>Math.min(ge,o),d=a?Object.fromEntries(Object.entries(g.args).map(([b,E])=>[b,typeof E=="string"?E.slice(0,200)+(E.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(i),x=Buffer.byteLength(JSON.stringify(d))<=Math.min(ge,o)?d:{};t.calls.push({id:g.toolCallId,name:g.toolName,args:x,argumentsTruncated:a})}),e.on("tool_execution_end",g=>{let n=p.get(g.toolCallId);if(n===void 0)return;p.delete(g.toolCallId);let s=c.get(n),t=s?.calls.find(i=>i.id===g.toolCallId);if(s&&t){let i=g.result;h(s,t,{content:i.content.filter(o=>o.type!=="text"||!o.text.startsWith(`
4
4
 
5
5
  ---
6
6
 
7
- # Guide:`)),details:r.details,isError:s.isError})}}),o.on("message_end",s=>{if(s.message.role!=="toolResult")return;let e=a.get(s.message.toolCallId);if(!e)return;a.delete(s.message.toolCallId);for(let[r,d]of g)d===e.parentToolCallId&&g.delete(r);let t={...e,calls:[],complete:e.complete},p=0;for(let r of e.calls){if(r.batched)continue;let d=JSON.stringify(r);if(p+=Buffer.byteLength(d),p>ie){t.complete=!1;break}t.calls.push(JSON.parse(d)),r.result||(t.complete=!1)}o.appendEntry(U,t)}),o.registerEntryRenderer(U,u(function s(e,t,p){if(!Array.isArray(e.data?.calls))return;if(!i)return{render:u(l=>i?s(e,t,p)?.render(l)??[]:[],"render"),invalidate:u(()=>{e.data&&f.get(e.data)?.invalidate()},"invalidate")};let r=f.get(e.data);if(!r){r=new Ie;for(let l of e.data.calls){let w=new se(l.name,l.id,l.renderArgs??l.args,{showImages:!0},l.omitted||!l.result?void 0:c.get(l.name),i,e.data.cwd);l.result?w.updateResult(l.result):w.updateResult({content:[{type:"text",text:"Result unavailable; history is incomplete."}],isError:!0}),r.addChild(new Ae(1)),r.addChild(w)}e.data.complete||r.addChild(new re(p.fg("warning","Incomplete nested IDE presentation; some results were not retained."),0,0)),f.set(e.data,r)}let d=r.children.at(-1);!e.data.complete&&d instanceof re&&d.setText(p.fg("warning","Incomplete nested IDE presentation; some results were not retained."));for(let l of r.children)l instanceof se&&l.setExpanded(t.expanded);return r},"renderEntry"));let n=u(()=>{o.events.on(V,s=>{let e=s,t=a.get(e.parentToolCallId);if(!t)return;let p=z(e.result.details);for(let r of e.calls){let d=t.calls.find(l=>l.id===r);d&&(d.batched=r!==e.calls.at(-1),d.batched?d.result=void 0:(new Set(p.mutationRender?.map(l=>l.path)).size>1&&(d.renderArgs={}),m(t,d,{content:e.result.content,details:p,isError:e.result.isError===!0})))}}),o.on("tool_result",s=>{let e=s.details,t=a.get(s.toolCallId);if(t&&e&&typeof e=="object"&&"editorBatchResults"in e&&Array.isArray(e.editorBatchResults))for(let p of e.editorBatchResults)for(let r of p.data?.operations??[]){let d=t.calls.find(w=>w.id===r.id);if(!d)continue;let l=r.errors.map(w=>w.message);(l.length>0||r.effect!=="applied")&&(d.batched=!1,delete d.renderArgs,m(t,d,{content:[{type:"text",text:`${d.name}: ${r.effect}.
8
- ${l.join(`
9
- `)}`}],details:void 0,isError:l.length>0||r.effect==="unknown"}))}})},"finalize");return{api:{...o,registerTool:u(s=>{c.set(s.name,s),o.registerTool(s)},"registerTool")},finalize:n}}u(ae,"createNestedIdeRendering");var de={read:["path"],search:["path"],select:["path"],replace:["path"],insert:["path"],delete:["path"],write:["path"],copy:["path","target"],move:["path","target"],undo:["file"],diff:["before","after"]};function le(o){let c=J(o),g=new Set,a=new Map,i=new Map,f=u(()=>{a.clear(),i.clear()},"clear");o.on("session_start",f),o.on("session_shutdown",f),o.on("before_agent_start",n=>({systemPrompt:`${n.systemPrompt}
7
+ # Guide:`)),details:i.details,isError:g.isError})}}),e.on("message_end",g=>{if(g.message.role!=="toolResult")return;let n=c.get(g.message.toolCallId);if(!n)return;c.delete(g.message.toolCallId);for(let[o,a]of p)a===n.parentToolCallId&&p.delete(o);let s=n.calls.filter(o=>!o.batched),t={...n,calls:[],retention:{...n.retention,argumentsTruncated:s.some(o=>o.argumentsTruncated===!0),resultsOmitted:s.some(o=>o.resultOmitted===!0),resultsUnavailable:s.some(o=>!o.result)}},i=Buffer.byteLength(JSON.stringify(t));for(let o of s){let a=JSON.stringify(o);if(i+=Buffer.byteLength(a)+(t.calls.length>0?1:0),i>pe){t.retention.callsOmitted=!0;break}t.calls.push(JSON.parse(a))}e.appendEntry(J,t)}),e.registerEntryRenderer(J,f(function g(n,s,t){if(!Array.isArray(n.data?.calls))return;if(!r)return{render:f(d=>r?g(n,s,t)?.render(d)??[]:[],"render"),invalidate:f(()=>{n.data&&m.get(n.data)?.invalidate()},"invalidate")};let i=Be(n.data),o=m.get(n.data);if(!o){o=new Oe;for(let d of n.data.calls){let x=new ce(d.name,d.id,d.renderArgs??d.args,{showImages:!0},d.resultOmitted||d.omitted||!d.result?void 0:l.get(d.name),r,n.data.cwd);d.result?x.updateResult(d.result):x.updateResult({content:[{type:"text",text:"Result unavailable in this saved display."}],isError:!0}),o.addChild(new Me(1)),o.addChild(x)}i&&o.addChild(new ue(t.fg("warning",i),0,0)),m.set(n.data,o)}let a=o.children.at(-1);i&&a instanceof ue&&a.setText(t.fg("warning",i));for(let d of o.children)d instanceof ce&&d.setExpanded(s.expanded);return o},"renderEntry"));let u=f(()=>{e.events.on(Z,g=>{let n=g,s=c.get(n.parentToolCallId);if(!s)return;let t=q(n.result.details),i=n.calls.findLast(a=>!n.unchangedCopyCalls?.includes(a)),o="callIdsByResult"in t&&Array.isArray(t.callIdsByResult)?t.callIdsByResult:[];for(let a of n.calls){let d=s.calls.find(I=>I.id===a);if(!d)continue;let x=t.results?.filter((I,R)=>(o[R]===a||o.length===0&&n.calls.length===1)&&I.data.errors?.some(A=>A.code==="POST_WRITE_FAILED"||A.code==="POST_EDIT_FAILED"))??[];if(d.postWriteFailure=x.length>0,d.postWriteFailure){d.batched=!1,delete d.renderArgs,h(s,d,{content:n.result.content,details:{results:x,effect:"applied"},isError:!0});continue}let b=n.copyResults?.get(a),E=b?.details.metadata?.copyRollback;if(d.name==="copy"&&b&&(E==="restored"||E==="failed")){d.copyRollback=E,d.batched=!1,h(s,d,{content:b.content,details:q(b.details),isError:!0});continue}d.unchangedCopy=d.name==="copy"&&n.unchangedCopyCalls?.includes(a)===!0,d.batched=!d.unchangedCopy&&a!==i,d.unchangedCopy?h(s,d,{content:[{type:"text",text:"No changes: destination already has this text."}],details:{},isError:!1}):d.batched?d.result=void 0:(new Set(t.mutationRender?.map(I=>I.path)).size>1&&(d.renderArgs={}),d.rollback=t.results?.some(I=>I.data.rollback!==void 0)===!0,h(s,d,{content:n.result.content,details:t,isError:n.result.isError===!0||d.rollback}))}}),e.on("tool_result",g=>{let n=g.details,s=c.get(g.toolCallId);if(s&&n&&typeof n=="object"&&"editorBatchResults"in n&&Array.isArray(n.editorBatchResults))for(let t of n.editorBatchResults)for(let i of t.data?.operations??[]){let o=s.calls.find(d=>d.id===i.id);if(!o)continue;let a=i.errors.map(d=>d.message);o.rollback||o.postWriteFailure||o.copyRollback!==void 0||o.unchangedCopy&&a.length===0&&i.effect==="not-applied"||(a.length>0||i.effect!=="applied")&&(o.batched=!1,delete o.renderArgs,h(s,o,{content:[{type:"text",text:`${o.name}: ${i.effect}.
8
+ ${a.join(`
9
+ `)}`}],details:void 0,isError:a.length>0||i.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:f(g=>{l.set(g.name,g),e.registerTool(g)},"registerTool")},finalize:u}}f(me,"createNestedIdeRendering");import{createCanvas as je,loadImage as Le}from"@napi-rs/canvas";import{DEFAULT_MAX_BYTES as Fe,DEFAULT_MAX_LINES as Ue,truncateHead as We}from"@earendil-works/pi-coding-agent";var N={bytes:Fe,lines:Ue,pixels:4e6,images:20,imageBytes:20*1024*1024};async function M(e,l="",p){let c=typeof l=="string"?[l]:l,r=[],m=e.flatMap(a=>{if(a.type!=="text")return[];let d=c.find(x=>x.length>0&&a.text.endsWith(x));return d?(r.push(d),[a.text.slice(0,-d.length)]):[a.text]}).join(`
10
+ `),h=r.join(""),v=We(m,{maxBytes:N.bytes,maxLines:N.lines}),u=[],w;if(v.truncated&&p!==void 0)try{w=await p(m)}catch{u.push("[Full output could not be saved. Narrow the request to inspect it.]")}v.truncated&&u.push(`[Output truncated: useful content is limited to ${N.bytes} bytes / ${N.lines} lines. Narrow the request or read a smaller source range.]`),w!==void 0&&u.push(`[Full output: ${JSON.stringify(w)}. Read with offset/limit, or read ${JSON.stringify("raw:"+w)} for byte ranges. Available until this runtime is disposed.]`);let g=e.filter(a=>a.type==="image"),n=g.slice(0,N.images),s=[],t=Math.floor(N.pixels/Math.max(1,n.length)),i=0,o=g.length-n.length;for(let[a,d]of n.entries())try{let x=Buffer.from(d.data,"base64"),b=await Le(x),E=Math.min(1,Math.sqrt(t/(b.width*b.height))),I=Math.min(t,Math.max(1,Math.floor(b.height*E))),R=Math.min(Math.floor(t/I),Math.max(1,Math.floor(b.width*E))),A=x,S=d.mimeType;if(E<1||i+A.byteLength>N.imageBytes){let k=je(R,I);k.getContext("2d").drawImage(b,0,0,R,I),A=await k.encode("png"),S="image/png"}if(i+A.byteLength>N.imageBytes){o++;continue}i+=A.byteLength,s.push({type:"image",data:A.toString("base64"),mimeType:S}),E<1&&u.push(`[Image ${a+1} resized from ${b.width}x${b.height} to ${R}x${I} to fit the shared media budget.]`)}catch{o++,u.push(`[Image ${a+1} could not be decoded and was not returned.]`)}return o>0&&u.push(`[${o} images omitted from the result. Read fewer frames or a smaller image region.]`),{text:v.firstLineExceedsLimit?qe(m):v.content,textTruncated:v.truncated,images:s,notices:u,metadataSuffix:h,fullOutput:w}}f(M,"limitIdeOutput");function qe(e){let l=0,p=0;for(let c of e){let r=Buffer.byteLength(c);if(l+r>N.bytes)break;l+=r,p+=c.length}return e.slice(0,p)}f(qe,"bytePrefix");var he={read:["path"],search:["path"],select:["path"],replace:["path"],insert:["path"],delete:["path"],write:["path"],copy:["path","target"],move:["path","target"],undo:["file"],diff:["before","after"]};function ye(e){let l=Q(e),p=new Set,c=new K,r=f(t=>c.saveFile(t),"saveFullOutput"),m=new Set,h=new Map;Y(e,{protocol:H,apiVersion:X,id:"ide-output-retention",setup(t){t.setOutputSaver(r)}}),e.on("session_shutdown",()=>c.dispose());let v=f((t,i)=>{let o=i;return t!=="tool_call"?e.on(t,o):e.on("tool_call",async(a,d)=>{let x=await o(a,d);if(!x?.block||!p.has(a.toolName)||x.reason===void 0)return x;let b=await M([{type:"text",text:x.reason}],"",r);return m.add(a.toolCallId),{...x,reason:b.text+(b.notices.length?`
11
+
12
+ ${b.notices.join(`
13
+ `)}`:"")}})},"on"),u=new Map,w=new Map,g=f(()=>{u.clear(),w.clear(),m.clear(),h.clear()},"clear");e.on("session_start",g),e.on("session_shutdown",g),e.on("before_agent_start",t=>({systemPrompt:`${t.systemPrompt}
10
14
 
11
15
  <ide_results>
12
16
  IDE tools return readable text. The leading system-result envelope is an internal reference, not file content; do not edit it. Compose tools by passing the unchanged result to a source parameter. Outside Codemode, pass the same text or its UUID. Store/load preserves these strings within the session. Use returned anchors to choose individual selections. Changed snapshots and previous sessions cannot be reused.
13
- </ide_results>`})),o.on("tool_execution_start",n=>{n.parentToolCallId!==void 0&&a.set(n.toolCallId,a.get(n.parentToolCallId)??n.parentToolCallId)}),o.on("tool_call",(n,b)=>{if(!g.has(n.toolName))return;let s={...n.input};try{for(let e of de[n.toolName]??[]){let t=s[e];if(t!==void 0)if(n.toolName==="diff"&&t!==null&&typeof t=="object"&&"path"in t)s[e]={...t,path:c.source(t.path,b.cwd,!0)};else{let p=c.source(t,b.cwd,n.toolName==="read"?!0:["write","insert","delete"].includes(n.toolName)?"live":!1);if(n.toolName==="read"&&Array.isArray(p)){let r=c.resolve(p,b.cwd);s[e]=c.register(r.targets,b.cwd,r.complete)}else s[e]=p}}n.toolName==="select"&&s.operation&&typeof s.operation=="object"&&"scopes"in s.operation&&(s.operation={...s.operation,scopes:c.source(s.operation.scopes,b.cwd)});for(let e of["text","content"]){let t=s[e];if(typeof t=="string"&&(t.trimStart().startsWith("<system-result")||/<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>/iu.test(t)))return{block:!0,reason:"A system result reference is not file content. Do not insert it into a file."}}Object.assign(n.input,s)}catch(e){return{block:!0,reason:e instanceof Error?e.message:String(e)}}});let m=u(n=>{g.add(n.name);let b={},s=Object.getOwnPropertyDescriptors(n);delete s.outputSchema;let e=n.renderCall;if(e){let p=u((r,d,l)=>e(Pe(n.name,r),d,l),"renderCall");s.renderCall={value:p,enumerable:!0,configurable:!0,writable:!0}}let t=n.renderResult;if(t){let p=u((r,d,l,w)=>t({...r,content:r.content.map(v=>v.type==="text"?{...v,text:v.text.replace(/^<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>\n/u,"")}:v)},d,l,w),"renderer");s.renderResult={value:p,enumerable:!0,configurable:!0,writable:!0}}Object.defineProperties(b,s),o.registerTool(b)},"registerTool"),x=u(()=>{o.on("tool_result",(n,b)=>{if(n.toolName==="codemode"){c.refreshAll();let l=i.get(n.toolCallId)??[];i.delete(n.toolCallId);for(let[w,v]of a)v===n.toolCallId&&a.delete(w);return l.length?{content:[...n.content,...l]}:void 0}if(!g.has(n.toolName))return;let s=n.content.filter(l=>l.type==="text").map(l=>l.text).join(`
14
- `),e=n.structuredContent,t=e!==null&&typeof e=="object"&&"data"in e?e:{status:n.isError?"error":"success",data:e},p=ce(t),r=c.publish(t,s,b.cwd,p),d=a.get(n.toolCallId);if(a.delete(n.toolCallId),d!==void 0){let l=n.content.filter(w=>w.type==="image");l.length&&i.set(d,[...i.get(d)??[],...l])}return{content:[{type:"text",text:r},...n.content.filter(l=>l.type!=="text")]}})},"finalize");return{api:{...o,registerTool:m},finalize:x}}u(le,"createIdeTextResults");function Pe(o,c){let g=u(i=>{if(Array.isArray(i))return i.map(g);if(typeof i!="string")return i;let f=/^<system-result\b[^>]*><uuid>([a-f\d-]{36})<\/uuid>/u.exec(i)?.[1];return f?`RESULT#${f}`:i},"label"),a={...c};for(let i of de[o]??[])Object.assign(a,{[i]:g(c[i])});return a}u(Pe,"displaySources");function ce(o){if(o===null||typeof o!="object"||!("data"in o))return[];let c=o.data;return c===null||typeof c!="object"?[]:"resources"in c&&Array.isArray(c.resources)?c.resources.flatMap(a=>ce({data:a})):"files"in c&&Array.isArray(c.files)?c.files.flatMap(a=>a!==null&&typeof a=="object"&&"source"in a&&typeof a.source=="string"&&/^(?:shell|debug):/u.test(a.source)?[a.source]:[]):"source"in c&&typeof c.source=="string"?[c.source]:[]}u(ce,"resultResources");import{VERSION as Ce}from"@earendil-works/pi-coding-agent";import{getCurrentTools as Re}from"@earendil-works/pi-ai";function ue(o){let c=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(o),g=[0,99,1],i=c?.slice(1,4).map(Number)?.map((f,m)=>f-(g[m]??0)).find(f=>f!==0)??0;if(c===null||i<0||i===0&&c[4]!==void 0)throw new Error(`Pi Agent IDE requires Pi 0.99.1 or newer; this host is ${o}. Update Pi before loading the extension.`)}u(ue,"assertSupportedHost");async function ke(o){ue(Ce);let c=ae(o),g=le(c.api),a=oe(g.api);o.on("session_start",(n,b)=>{let s=n.reason==="reload"?[]:Re(b.sessionManager.getBranch().flatMap(e=>e.type==="message"?[e.message]:[])).map(e=>e.name);a.reconcile(!0,s)}),o.on("before_agent_start",n=>{a.reconcile();let b=n.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
15
- `,""),s=o.getAllTools().filter(l=>l.exposure!=="hidden"),e=o.getActiveTools(),t=e.includes("tool_search")?"Use tool_search to find":e.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",p=s.filter(l=>l.namespace?.name==="ide_git").map(l=>l.name),r=[...p.length===0?[]:[`${t} ${p.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...s.some(l=>l.name==="debug"&&l.namespace?.name==="ide_debug")?[`${t} debug in ide_debug when creating a debugger session.`]:[]],d=r.length===0?b:`${b}
17
+ </ide_results>`})),e.on("tool_execution_start",t=>{t.parentToolCallId!==void 0&&u.set(t.toolCallId,u.get(t.parentToolCallId)??t.parentToolCallId)}),v("tool_call",(t,i)=>{if(!p.has(t.toolName))return;let o={...t.input};try{for(let a of he[t.toolName]??[]){let d=o[a];if(d!==void 0)if(t.toolName==="diff"&&d!==null&&typeof d=="object"&&"path"in d)o[a]={...d,path:l.source(d.path,i.cwd,!0)};else{let x=l.source(d,i.cwd,t.toolName==="read"?!0:["write","insert","delete"].includes(t.toolName)?"live":!1);if(t.toolName==="read"&&Array.isArray(x)){let b=l.resolve(x,i.cwd);o[a]=l.register(b.targets,i.cwd,b.complete)}else o[a]=x}}t.toolName==="select"&&o.operation&&typeof o.operation=="object"&&"scopes"in o.operation&&(o.operation={...o.operation,scopes:l.source(o.operation.scopes,i.cwd)});for(let a of["text","content"]){let d=o[a];if(typeof d=="string"&&(d.trimStart().startsWith("<system-result")||/<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>/iu.test(d)))return{block:!0,reason:"A system result reference is not file content. Do not insert it into a file."}}Object.assign(t.input,o)}catch(a){return{block:!0,reason:a instanceof Error?a.message:String(a)}}});let n=f(t=>{p.add(t.name);let i={},o=Object.getOwnPropertyDescriptors(t);delete o.outputSchema;let a=f(async(...b)=>{let E=await t.execute(...b).catch(async A=>{let S=await M([{type:"text",text:A instanceof Error?A.message:String(A)}],"",r);throw m.add(b[0]),S.notices.length===0?A:new Error(S.text+`
18
+
19
+ ${S.notices.join(`
20
+ `)}`,{cause:A})}),I=await M(E.content,be(E.details),r),R=I.text+I.metadataSuffix;return{...E,content:[{type:"text",text:R+(I.notices.length?`
21
+
22
+ ${I.notices.join(`
23
+ `)}`:"")},...I.images]}},"execute");o.execute={value:a,enumerable:!0,configurable:!0,writable:!0};let d=t.renderCall;if(d){let b=f((E,I,R)=>d(Ge(t.name,E),I,R),"renderCall");o.renderCall={value:b,enumerable:!0,configurable:!0,writable:!0}}let x=t.renderResult;if(x){let b=f((E,I,R,A)=>x({...E,content:E.content.map(S=>S.type==="text"?{...S,text:S.text.replace(/^<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>\n/u,"")}:S)},I,R,A),"renderer");o.renderResult={value:b,enumerable:!0,configurable:!0,writable:!0}}Object.defineProperties(i,o),e.registerTool(i)},"registerTool"),s=f(()=>{e.on("context",async t=>({messages:await Promise.all(t.messages.map(async i=>{if(i.role!=="toolResult"||!i.isError||!p.has(i.toolName)||m.has(i.toolCallId)||i.content.some(a=>a.type==="text"&&a.text.startsWith("<system-result")))return i;let o=h.get(i.toolCallId);return o===void 0&&(o=M(i.content,"",r).then(a=>[{type:"text",text:a.text+(a.notices.length?`
24
+
25
+ ${a.notices.join(`
26
+ `)}`:"")},...a.images]),h.set(i.toolCallId,o)),{...i,content:await o}}))})),e.on("tool_result",async(t,i)=>{if(t.toolName==="codemode"){l.refreshAll();let S=w.get(t.toolCallId)??[];w.delete(t.toolCallId);for(let[C,_]of u)_===t.toolCallId&&u.delete(C);let k=t.content.filter(C=>C.type==="text"&&C.text.startsWith(`
27
+
28
+ ---
29
+
30
+ # Guide:`)),P=t.content.filter(C=>!k.includes(C)),y=await M([...P,...S],"",r);return{content:[...y.textTruncated?[{type:"text",text:y.text}]:P.filter(C=>C.type==="text"),...y.images,...y.notices.length?[{type:"text",text:`
31
+
32
+ ${y.notices.join(`
33
+ `)}`}]:[],...k]}}if(!p.has(t.toolName))return;let o=t.content.filter(S=>S.type==="text").map(S=>S.text).join(`
34
+ `),a=t.structuredContent,d=a!==null&&typeof a=="object"&&"data"in a?a:{status:t.isError?"error":"success",data:a},x=d.data,b=x!==null&&typeof x=="object"&&"effect"in x&&x.effect==="applied"&&"targetUnavailable"in x&&typeof x.targetUnavailable=="string"?x.targetUnavailable:void 0,E=b===void 0?o:`${o}
35
+
36
+ This result has no verified text selection: ${b}
37
+ Read/Search the file before the next edit; do not repeat the applied edit.`,I=xe(d),R=l.publish(d,E,i.cwd,I),A=u.get(t.toolCallId);if(u.delete(t.toolCallId),A!==void 0){let S=t.content.filter(k=>k.type==="image");S.length&&w.set(A,[...w.get(A)??[],...S])}return{content:[{type:"text",text:R},...t.content.filter(S=>S.type!=="text")]}})},"finalize");return{api:{...e,on:v,registerTool:n},finalize:s}}f(ye,"createIdeTextResults");function be(e){if(e===null||typeof e!="object")return[];let l="outputNotice"in e&&typeof e.outputNotice=="string"?[e.outputNotice]:[];if("resources"in e&&Array.isArray(e.resources)){let p=e.resources;for(let c of p)c!==null&&typeof c=="object"&&"details"in c&&l.push(...be(c.details))}return l}f(be,"outputNotices");function Ge(e,l){let p=f(r=>{if(Array.isArray(r))return r.map(p);if(typeof r!="string")return r;let m=/^<system-result\b[^>]*><uuid>([a-f\d-]{36})<\/uuid>/u.exec(r)?.[1];return m?`RESULT#${m}`:r},"label"),c={...l};for(let r of he[e]??[])Object.assign(c,{[r]:p(l[r])});return c}f(Ge,"displaySources");function xe(e){if(e===null||typeof e!="object"||!("data"in e))return[];let l=e.data;return l===null||typeof l!="object"?[]:"resources"in l&&Array.isArray(l.resources)?l.resources.flatMap(c=>xe({data:c})):"files"in l&&Array.isArray(l.files)?l.files.flatMap(c=>c!==null&&typeof c=="object"&&"source"in c&&typeof c.source=="string"&&/^(?:shell|debug):/u.test(c.source)?[c.source]:[]):"source"in l&&typeof l.source=="string"?[l.source]:[]}f(xe,"resultResources");function we(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}f(we,"isRecord");function Ee(e,l){if(!we(e)||!Array.isArray(e.tools))return e;let p=e.tools,c=p.map(r=>!we(r)||r.type!=="function"||typeof r.name!="string"||!l.has(r.name)||r.strict!==void 0?r:{...r,strict:!1});return c.some((r,m)=>r!==p[m])?{...e,tools:c}:e}f(Ee,"preserveResponsesToolOmission");import{VERSION as Je}from"@earendil-works/pi-coding-agent";import{getCurrentTools as ze}from"@earendil-works/pi-ai";function Ie(e){let l=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e),p=[0,99,1],r=l?.slice(1,4).map(Number)?.map((m,h)=>m-(p[h]??0)).find(m=>m!==0)??0;if(l===null||r<0||r===0&&l[4]!==void 0)throw new Error(`Pi Agent IDE requires Pi 0.99.1 or newer; this host is ${e}. Update Pi before loading the extension.`)}f(Ie,"assertSupportedHost");async function Ve(e){Ie(Je);let l=me(e),p=ye(l.api),c=le(p.api);e.on("before_provider_request",(u,w)=>{if(w.model?.api!=="openai-responses")return;let g=new Set(e.getAllTools().filter(n=>n.namespace?.name.startsWith("ide_")).map(n=>n.name));return Ee(u.payload,g)}),e.on("session_start",(u,w)=>{let g=u.reason==="reload"?[]:ze(w.sessionManager.getBranch().flatMap(n=>n.type==="message"?[n.message]:[])).map(n=>n.name);c.reconcile(!0,g)}),e.on("before_agent_start",u=>{c.reconcile();let w=u.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
38
+ `,""),g=e.getAllTools().filter(a=>a.exposure!=="hidden"),n=e.getActiveTools(),s=n.includes("tool_search")?"Use tool_search to find":n.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",t=g.filter(a=>a.namespace?.name==="ide_git").map(a=>a.name),i=[...t.length===0?[]:[`${s} ${t.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...g.some(a=>a.name==="debug"&&a.namespace?.name==="ide_debug")?[`${s} debug in ide_debug when creating a debugger session.`]:[]],o=i.length===0?w:`${w}
16
39
 
17
40
  <ide_discovery>
18
- ${r.join(`
41
+ ${i.join(`
19
42
  `)}
20
- </ide_discovery>`;return d===n.systemPrompt?void 0:{systemPrompt:d}});let i=await X(B()),f=ne(o,{"pi-agent-ide-no-animations":i.noAnimations??!1,"pi-agent-ide-no-post-processing":i.noPostProcessing??!1,...i.flags});f.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),f.register({id:"pi-agent-ide-no-post-processing",name:"Skip automatic post-processing",description:"Skip automatic formatting and diagnostics after edits. Explicit diagnostic reads still work.",default:!1}),f.register({id:"pi-agent-ide-vision-arbitrary-windows",name:"Capture arbitrary windows",description:"Allow window:PID capture for processes not owned by Agent IDE. Keep disabled unless the agent may inspect other desktop apps.",default:!1}),f.register({id:"pi-agent-ide-vision-displays",name:"Capture full displays",description:"Allow display screenshots through display: and display:#N resources. Keep disabled unless the agent may inspect the full desktop.",default:!1}),f.register({id:"pi-agent-ide-no-diagnostic-buffer",name:"Immediate diagnostic notices",description:"Send findings immediately instead of combining reports received over five seconds.",group:"ui",default:!1}),f.register({id:"pi-agent-ide-code-review",name:"Jev code review",description:"Review saved edit fragments against project YAML rules in the background. Sends code to a connected Jev provider.",default:!1}),f.register({id:"pi-agent-ide-code-review-capture",name:"Capture code-review rules",description:"Use the packaged skill to propose reusable rules from user review feedback. Save only after confirmation.",default:!1}),te(o,f.definitions,Y);let m=D(R,i.preset??"full"),{enabled:x}=O(R,[...m,...i.disabled],i.enabled);for(let n of x)await n.register(a.api,{preferences:i.preferences??{}});c.finalize(),g.finalize()}u(ke,"registerUnifiedPiAgentIde");export{ke as default};
43
+ </ide_discovery>`;return o===u.systemPrompt?void 0:{systemPrompt:o}});let r=await ee(L()),m=de(e,{"pi-agent-ide-no-animations":r.noAnimations??!1,"pi-agent-ide-no-post-processing":r.noPostProcessing??!1,...r.flags});m.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),m.register({id:"pi-agent-ide-no-post-processing",name:"Skip automatic post-processing",description:"Skip automatic formatting and diagnostics after edits. Explicit diagnostic reads still work.",default:!1}),m.register({id:"pi-agent-ide-vision-arbitrary-windows",name:"Capture arbitrary windows",description:"Allow window:PID capture for processes not owned by Agent IDE. Keep disabled unless the agent may inspect other desktop apps.",default:!1}),m.register({id:"pi-agent-ide-vision-displays",name:"Capture full displays",description:"Allow display screenshots through display: and display:#N resources. Keep disabled unless the agent may inspect the full desktop.",default:!1}),m.register({id:"pi-agent-ide-no-diagnostic-buffer",name:"Immediate diagnostic notices",description:"Send findings immediately instead of combining reports received over five seconds.",group:"ui",default:!1}),m.register({id:"pi-agent-ide-code-review",name:"Jev code review",description:"Review saved edit fragments against project YAML rules in the background. Sends code to a connected Jev provider.",default:!1}),m.register({id:"pi-agent-ide-code-review-capture",name:"Capture code-review rules",description:"Use the packaged skill to propose reusable rules from user review feedback. Save only after confirmation.",default:!1}),ae(e,m.definitions,ne);let h=$(O,r.preset??"full"),{enabled:v}=U(O,[...h,...r.disabled],r.enabled);for(let u of v)await u.register(c.api,{preferences:r.preferences??{}});l.finalize(),p.finalize()}f(Ve,"registerUnifiedPiAgentIde");export{Ve as default};
@@ -29,32 +29,39 @@ Read results select their requested source windows. Search results select exact
29
29
  - `replace.path` replaces selected ranges. `delete.path` removes selected text but keeps the file, even for a whole-file selection.
30
30
  - `write.path` and `undo.file` require one whole-file selection. Partial and multi-file scopes are rejected, not widened.
31
31
  - `copy.path` / `move.path` select source ranges; `target` selects destination ranges. A zero-width destination inserts. Arrays pair in declared order, with equal counts and duplicates removed. Unequal counts and overlapping moves are rejected.
32
- - Ordinary destination file paths without text selectors require one whole-file source and keep byte-preserving file transfer behavior.
32
+ - Move succeeds without writes for valid empty arrays and paired zero-width selections. Empty arrays return no selection; paired points return only the unchanged destination points. The usual validation and overlap guards still apply.
33
+ - Ordinary filesystem paths without selectors copy or move one whole object: a regular file, directory tree, or symlink. Result inputs remain text selections; a directory listing does not authorize a whole-directory transfer.
33
34
  - `insert` uses line-based insertion before or after its selected containing lines.
34
35
 
35
- Replace/insert results select their resulting text, including supplied line separators. Empty replacement selects the resulting position, not removed text. Copy/move results select only destination text. Whole-file transfers and write select the whole destination; undo selects restored files. Delete and binary operations provide no reusable text selection. If a result cannot supply a verified selection, inspect the file instead.
36
+ Replace/insert results select their resulting text, including supplied line separators. Empty replacement selects the resulting position, not removed text. Copy/move results select only destination text. Whole regular-text-file transfers and write select the whole destination; undo selects restored files. Delete and binary operations provide no reusable text selection. If a result cannot supply a verified selection, inspect the file instead.
36
37
 
37
38
  Results are strict snapshots. Changed files permanently retire their old IDs, even if the old bytes are restored later. Session changes and reloads also retire IDs. Empty selections are valid no-ops; incomplete or expired selections cannot authorize edits. Diff text and invented coordinates do not grant source authority.
38
39
 
40
+ ## Whole filesystem objects
41
+
42
+ Use ordinary paths without text selectors for whole-object Delete, Copy, and Move. Delete removes directory contents recursively and unlinks symlinks without following their targets. Copy merges directory contents into the exact target directory and keeps destination-only entries. Move replaces an existing target directory and removes destination-only entries. Both transfers create missing parents, preserve file bytes and symlink text, and reject symlink destinations, type conflicts, and overlapping trees. Relative links keep their text; moving them can change what they point to.
43
+
44
+ Directory and symlink transfers have no reusable text selection. Read their ordinary paths to inspect them. A failure before filesystem execution reports `not-applied`; a failure after execution starts reports `unknown`. Inspect both paths before retrying an unknown transfer. Recursive transfers and cross-device Move have no atomic rollback. Cancellation before execution prevents a transfer; in-flight filesystem work may finish.
45
+
39
46
  ## Line separation
40
47
 
41
48
  Use `separation: "blank-line"` for a separate paragraph or section; use default line mode for adjacent code, list items, or a continuation. Inserting `X` after `A` in `A\nB` with blank-line separation produces `A\n\nX\n\nB`.
42
49
 
43
50
  ## Writes and failures
44
51
 
52
+ When Write changes or creates a file, it saves the file and finishes post-edit processing before returning, including in Codemode. If an existing file already matches the supplied content, Write returns its whole-file selection without writing or running post-edit handlers. Earlier pending edits commit before Write. Other eligible text edits keep their pending-batch behavior.
53
+
45
54
  Independent calls share the original snapshots. Combine overlapping edits into one mutation. A rejected call does not cancel successful peers; retry only unapplied changes.
46
55
 
47
56
  An omitted path can inherit the file identified by an anchor, the last read, or the preceding edit in the batch. Supply the path when that would be ambiguous.
48
57
 
49
58
  An ordinary `delete.path` without selectors deletes a complete regular file. A result input removes only selected text. Ordinary copy/move paths without selectors transfer whole files and replace an existing regular destination file.
50
59
 
51
- Inside Codemode, await independent edits on disjoint resources concurrently and overlapping resources in order. Pass a pending edit result directly to another source tool for dependent work; that boundary commits the batch before consuming the result. Await `tools.flush({})` when you need a committed receipt. Its text reports file and operation effects. A failed flush never replays edits.
52
-
53
- Failed tools reject in Codemode. Use try/catch or Promise.allSettled when independent calls may fail. Inspect the parent result for actual committed effects: an acceptance is not proof of writing, and an error is not proof of rollback.
60
+ Inside Codemode, await independent edits on disjoint resources concurrently and overlapping resources in order. Pass a pending edit result directly to another source tool for dependent work; that boundary commits the batch before consuming the result.
54
61
 
55
- Formatting and registered post-edit handlers run once per surviving resource at script end, not at flush or dependency boundaries. Reads inside the script see written but not yet formatted text. If final processing changes bytes, repeat Read/Search. Standalone edits finish post-edit work immediately.
62
+ Failed tools reject in Codemode. Use try/catch or Promise.allSettled when independent calls may fail. Inspect the parent result for actual committed effects: an acceptance is not proof of writing, and an error is not proof of rollback. Read the affected files when the result cannot confirm their final state.
56
63
 
57
- Ordinary script errors keep accepted edits. Abort or deadline discards pending writes, not batches that already committed. Inspect final results and retry only unapplied edits.
64
+ After an interruption, read the affected files before retrying. Retry only unapplied edits.
58
65
 
59
66
  ## Specialized resources
60
67
 
@@ -2,4 +2,14 @@
2
2
 
3
3
  Read a tracked file with `views: ["changes"]` to see staged and unstaged hunks and current `CHANGE#` anchors. Stage or unstage only the selected current change. Anchors are revision-sensitive, so re-read after index or worktree changes.
4
4
 
5
+ If an unstage anchor is stale, read the file again with `views: ["changes"]` and select a current change.
6
+
7
+ After a failed or interrupted unstage call, inspect the index with `git diff --cached -- <file>` before retrying. Do not assume the error means the index stayed unchanged.
8
+
5
9
  Use a `CHANGE#` anchor to restore that selected Git change to `HEAD` in both worktree and index. Use `last` with a file only for that file's latest text-editor transaction. Inspect current changes before destructive restoration.
10
+
11
+ Undo applies the restore before returning, including in Codemode. Earlier pending edits commit before Undo runs. Formatting and registered post-edit handlers run at script end in Codemode; read the file again if they change its bytes.
12
+
13
+ `last` restores one saved transaction, not an undo history or redo. A successful restore clears that saved transaction.
14
+
15
+ After a failed or interrupted Git restore, read the file and inspect the index with `git diff --cached -- <file>` before retrying. Text restoration can succeed before an index update fails. Retry only the work that remains unapplied.
@@ -1,54 +1,17 @@
1
- # Read resources workflow
1
+ # Read results and selections
2
2
 
3
- ## Selecting a source
3
+ ## Preserve source boundaries
4
4
 
5
- `path` selects a resource. Supported providers include regular files and directories, `file:` URLs, HTTP(S) URLs, PDFs, images, returned `temp:` references, `SEARCH#` and `RESULT#` references, and enabled protocol resources.
5
+ A Read result retains the requested source window. When reading a selection, Read may display surrounding whole lines. That context does not widen the selection used by later tools.
6
6
 
7
- Common protocol resources include:
7
+ Read-only views, bytes, images and directory listings do not grant text-edit authority. Read the original text source when you need an editable selection.
8
8
 
9
- - `raw:<file>` — original bytes without decoding.
10
- - `docs:` and `docs:<id>` — packaged agent guidance.
11
- - `ast:<path>` — compact syntax outline.
12
- - `symbol:<file>#<selector>` — one declaration.
13
- - `graph:<file>` and `graph:<file>#<selector>` — declarations and relationships.
14
- - `diagnostics:<path>` — lint and language-server findings.
15
- - `process:<PID>` — process metadata.
16
- - `window:<PID>` and `display:` — visual capture when enabled.
17
- - `shell:<session>` — terminal state and retained output.
18
- - `debug:<session>` — debugger state.
9
+ ## Continue with another tool
19
10
 
20
- A source may also include a returned anchor, such as `notes.txt#12#A4F0`. A `SEARCH#` reference already identifies its source, so pass it directly as `path`.
11
+ Search a Read result to look only inside its selection. Use Select to derive new boundaries before editing.
21
12
 
22
- ## Windows and continuation
13
+ Read `docs:select-code` for selection workflows and `docs:editing` for using results in mutations.
23
14
 
24
- For text resources, `offset` is a one-based starting line and `limit` is the maximum number of lines. Zero starts at the first line; negative offsets count from the end. On an anchored path, offsets are relative to the containing source line. Follow returned continuation offsets or temporary references instead of repeating an oversized read.
15
+ ## Comparing text sources
25
16
 
26
- For `raw:` resources, offsets and limits count bytes. A negative offset counts from the end and a zero limit reads no bytes. Raw resources do not accept text anchors or views.
27
-
28
- Temporary resources remain available only in their owning runtime.
29
-
30
- ## Readable results and composition
31
-
32
- Read returns the same file text or requested views in direct calls and Codemode. It adds a leading system-result envelope with a UUID. The envelope is an internal reference, not file content; do not edit or insert it into a file. Follow the displayed continuation offset or temp reference for more output. Raw reads show hexadecimal bytes. Nested image reads also deliver their images on the parent Codemode result.
33
-
34
- Pass an unchanged result as `read.path`, `search.path`, `select.path` or a supported edit source parameter. Outside Codemode, its UUID works too. Store/load retains these strings within the session. Read results keep their requested source windows, not just the shortened preview. Read-only derived views, bytes, images and directory listings do not gain text-edit authority.
35
-
36
- Read of a selected result may show surrounding whole-line context, but later tools remain restricted to its original exact selection. Context does not grant wider edit authority.
37
-
38
- Changed snapshots permanently retire their old IDs, even if the file is restored later. Obtain a fresh Read/Search after changes, session switches or reloads. Unsupported and expired references are errors, not empty results.
39
-
40
- ## Views
41
-
42
- Views request source-specific presentations without changing the selected resource. Common views include:
43
-
44
- - `anchors` — editable `LINE#HASH` references.
45
- - `ast` — syntax-scope boundaries.
46
- - `changes` — staged and unstaged Git changes with `CHANGE#` anchors.
47
- - `diagnostics` — findings beside source text.
48
- - `breakpoints` — current debugger breakpoint locations.
49
- - `image` — one visual frame or terminal screen.
50
- - `sequence` — several ordered visual frames.
51
-
52
- Combine views only when both presentations are needed. Read the smallest useful source window and treat unsupported source/view combinations as errors rather than silently substituting another resource.
53
-
54
- For image grid selection, `limit` is the square cell size in output pixels and `offset` is the zero-based row-major cell number. `limit` without `offset` selects cell zero; `offset` without `limit` is invalid.
17
+ When a Diff source resolves to several resources, their text is joined with one newline separator in resolver order. Diff line numbers refer to each compared text, not original source line numbers when a window is selected.
@@ -20,6 +20,12 @@ If the extra branch reports a budget skip, narrow `path` rather than treating th
20
20
 
21
21
  Search returns readable matches and references in direct calls and Codemode. An empty successful search is not an error. Incomplete results say so; do not treat their zero matches as proof of absence.
22
22
 
23
+ If Search fails, fix the reported input, scope or provider problem before retrying. Keep the intended search scope; do not treat the failure as zero matches.
24
+
25
+ If Search is interrupted or cancelled, do not treat it as zero matches or completed coverage. Do not use its unfinished result as an edit scope. Retry only when the search is still wanted, and use the new result.
26
+
27
+ If a result has no local edit references, use its locations to inspect the source, not as an edit scope. For changed local files, repeat Search or Read to obtain a current selection before editing.
28
+
23
29
  Local text results expose `SEARCH#HASH:N:line` for its containing line and `SEARCH#HASH:N:match` for the exact match. Complete selections use `:all:line` or `:all:match`. Pass these references directly to read or editing tools; omit the file path when an all-selection spans files.
24
30
 
25
31
  A single-result reference becomes stale after its file changes. Re-run the search before reuse. A complete `:all` reference refreshes its original query when selected files change. Compacted output retains complete all-selections.
@@ -32,7 +38,7 @@ A replace/insert result searches only that call's resulting text, including an e
32
38
 
33
39
  Use a displayed item or capture reference for a subset. The whole result retains its complete stored scope; editing copied preview text never narrows that scope.
34
40
 
35
- Incomplete scopes cannot authorize edits, even through non-empty subsets. Empty arrays select no sources; they do not default to the workspace. Result-scoped text Boolean queries and text include/exclude globs remain unsupported. AST and LSP providers retain their own path/glob filters. File/process and unsupported provider scopes fail without widening the scope.
41
+ Incomplete registered result scopes cannot authorize edits, even through non-empty subsets. A numbered local text Search reference remains editable while its file snapshot is current, even if collection was incomplete. Use it only for its containing line or exact match, not as a complete match set. Empty arrays select no sources; they do not default to the workspace. Result-scoped text Boolean queries and text include/exclude globs remain unsupported. AST and LSP providers retain their own path/glob filters. File/process and unsupported provider scopes fail without widening the scope.
36
42
 
37
43
  ## AST search
38
44
 
@@ -96,6 +96,7 @@ Pass candidates in `path` and comparison results in `operation.scopes`. Both acc
96
96
  Points belong to a nonempty range at its included start, not its excluded end. Equal points match. Intersection with a contained point keeps it; touching ranges do not create points. Difference removes covered candidate points but point scopes do not cut text. Merge absorbs covered points without extending ranges. EOF points are outside a range ending at EOF.
97
97
 
98
98
  Empty scopes make within/intersection empty and difference unchanged. Incomplete inputs cannot establish absence or authorize edits. Select never writes or formats.
99
+ Repeat the operation after interruption. Do not treat cancellation as an empty result.
99
100
 
100
101
  ```js
101
102
  const candidates = await tools.search({ path: "notes.txt", query: "regex:<[^>]+>" });
@@ -2,6 +2,14 @@
2
2
 
3
3
  Use the registered shell tool (`bash` or `powershell`) for project commands. Check its command parameter for the actual shell and write that shell's syntax; do not infer syntax from the tool name or operating system. Keep short commands in the foreground. Start servers, watchers, and long builds with `background: true`; continue other work rather than polling. Read the returned `shell:<session>` resource for status and bounded output. Search that resource to locate retained output outside the current tail.
4
4
 
5
+ Check `status` and `exitCode` before treating a process as successfully completed. A returned background session or a released foreground wait is not a completion report. A timeout, detected input prompt, or turn interruption releases the wait without stopping a live process. Read the same `shell:` source to continue; it also survives extension reloads.
6
+
7
+ Send input only when `status` is `running`. Do not treat `stopping`, `stopped`, or `cancelled` as a preserved interactive wait. Before retrying a failed or interrupted command, inspect any returned session. If no source was returned, use `process:<query>` search to check for a process that may have started. Failure does not undo command side effects.
8
+
9
+ Use the log path in a truncation notice to inspect omitted output.
10
+
5
11
  Use `write` on a shell resource to send exact text without Enter. Use `insert` for named keys and chords such as `Enter`, `Ctrl+C`, or `Up`. Delete a shell resource to terminate and remove the session. Add the `image` view only when cursor position, ANSI layout, or a full-screen interface matters. Use a bounded `sequence:duration=<seconds>,interval=<seconds>,scale=<ratio>` view when changes over time matter.
6
12
 
7
- Use `process:<query>` search before reading `process:<PID>` or capturing `window:<PID>`. Do not assume silent background work has completed.
13
+ Use `process:<query>` search before reading `process:<PID>` or capturing `window:<PID>`.
14
+
15
+ If a session returns as running in background and no independent work remains, finish your turn instead of polling. Pi wakes the agent when the session completes. A still-running session also gets one inspection notice after two minutes without terminal activity, once the agent is idle. Read the session when that notice arrives and decide whether to keep waiting, send input, or delete it. An inspection notice is not proof of failure or completion.
@@ -75,7 +75,7 @@ Built-in entry modules are imported only after selection. Disabled built-ins, in
75
75
 
76
76
  ## Animations and post-edit processing
77
77
 
78
- Standalone editing tools validate source snapshots before writing. Native Codemode composes those same tools and can commit pending local edits with `tools.flush({})`. Accepted child calls are not proof of persistence. Ordinary script errors keep accepted edits; aborts discard only pending work. Formatting runs once per surviving changed file at script end, followed by diagnostics. Text copy/move destinations receive post-processing; binary contents stay unchanged.
78
+ Standalone editing tools validate source snapshots before writing. Native Codemode commits eligible pending local edits before a dependent tool or when the script ends. Accepted child calls are not proof of persistence. Ordinary script errors keep accepted edits; aborts discard only pending work. Batched edits finish formatting and diagnostics at script end. Write commits earlier pending edits and finishes its own post-edit processing before returning. Text copy/move destinations receive post-processing; binary contents stay unchanged.
79
79
 
80
80
  Automatic diagnostic findings are grouped for five seconds from the first finding. The UI tab’s **Immediate diagnostic notices** option (`pi-agent-ide-no-diagnostic-buffer`) disables this delay. Combined notices keep each file and reporting tool identifiable. Empty completed diagnostic reads tell the agent that checks finished without findings, but do not draw an empty diagnostic panel. Pending, unavailable and incomplete checks are not reported as clean.
81
81
 
@@ -229,6 +229,27 @@ No tip appears when built-in mappings already cover the project. Empty projects,
229
229
 
230
230
  Each actionable state has its own stable fingerprint. The same state is shown once per project, while a materially different later problem can produce a new tip. Like other startup tips, it never enters model context. See [Startup tip provider](./extensions.md#startup-tip-provider) for the provider contract and persistence behavior.
231
231
 
232
+ ### Temporary-directory deletion
233
+
234
+ Delete skips the external/non-Git confirmation for descendants of temporary roots. Defaults are `tmp`, `.tmp`, `temp`, and `.temp` under the current Git worktree root (or cwd without Git) and your home directory, plus the system temporary directory. The system root follows the OS environment, such as `TMPDIR` on Linux or `TEMP`/`TMP` on Windows.
235
+
236
+ Configure this in `<agent-dir>/pi-agent-ide/deletion.json` globally, or `<project>/.pi/pi-agent-ide/deletion.json` for one project. `<agent-dir>` defaults to `~/.pi/agent` and follows `PI_CODING_AGENT_DIR`.
237
+
238
+ ```json
239
+ {
240
+ "temporaryDirectories": {
241
+ "mode": "extend",
242
+ "paths": ["scratch", "~/build-scratch"]
243
+ }
244
+ }
245
+ ```
246
+
247
+ `extend` adds to the lower layer; `replace` replaces it. Layers apply in this order: defaults, global, project. A project replacement overrides both defaults and global settings. Use `{"temporaryDirectories":{"mode":"replace","paths":[]}}` to disable the exception.
248
+
249
+ Relative global paths start at your home directory; relative project paths start at the worktree root, or cwd without Git. Absolute paths and a leading `~/` are supported. Globs and other shell expansion are not supported. Custom roots resolve symlinks; named defaults do not grant access to a redirected root's destination. Missing roots are skipped. Settings are read for each deletion and checked again before removal. Invalid settings block directory/symlink deletion rather than falling back.
250
+
251
+ The exception does not apply to the temporary roots themselves, tracked/staged contents, failed Git checks inside the current project, or protected project/Git/filesystem paths. Parent links must resolve inside an allowed root. Unlinking the final symlink leaves its destination alone. Hooks still apply. Copy and Move keep their existing safeguards, and regular-file deletion is unchanged.
252
+
232
253
  ### Exact text recovery
233
254
 
234
255
  Exact text anchors work without configuration. Optional recovery settings live in `.pi/pi-agent-ide/text-editor.json`:
@@ -63,6 +63,10 @@ CI uses the same four shards without changing test or job timeouts. Set `REPORT_
63
63
 
64
64
  `--no-extensions` also disables Pi's native built-ins. Native fixtures explicitly load `builtin:codemode`, `builtin:tool-search`, and `builtin:mcp`; ordinary fixtures do not. `native-host.integration.test.ts` checks the version inside the launched process, deferred discovery, nested execution, and isolation from personal MCP servers.
65
65
 
66
+ ### Paid model capability checks
67
+
68
+ Tool changes also require reviewing the matrix and supported tool chains in `benchmarks/tool-capabilities/README.md` in the checkout. Run `pnpm check:capabilities` for its free schema/coverage gate; it is included in `pnpm check`. The real-model suite uses `pnpm validate:tools:models --run --model PROFILE_ID` only with explicit paid permission. It runs isolated cases and checks both outcomes and actual routes. It is not part of ordinary tests or CI.
69
+
66
70
  ### Watch integration tests live
67
71
 
68
72
  Use the project command to watch every test in one file:
@@ -0,0 +1,45 @@
1
+ # Directory and symlink operations
2
+
3
+ Delete, Copy, and Move accept ordinary filesystem paths without text selectors. The same implementation runs for standalone calls and calls nested in native Codemode. Read results, directory listings, and other registered selections do not become whole-directory authority.
4
+
5
+ ## Capability table
6
+
7
+ | Operation | Directory behavior | Symlink behavior | Guards and failure effects |
8
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
9
+ | Delete | Remove the directory and all contents recursively. | Unlink only the link, including a broken link. Never follow links inside a removed tree. | Existing before-delete hooks, protected paths, and host approval policy apply. Refusal is `not-applied`; a filesystem failure after removal starts is `unknown`. |
10
+ | Copy | Copy into the exact target path. Create missing parents. Merge into an existing directory, overwrite matching regular files, and keep destination-only entries. | Copy link text without following the target, including standalone and broken links. | Preflight the source tree and matching destination entries. Refuse aliases, overlapping trees, symlink destinations, unsupported object types, and type conflicts before writes. Protect project roots, ancestors, and current Git control data from recursive overwrites. After-start failure is `unknown`. |
11
+ | Move | Move into the exact target path. Create missing parents. Replace an existing directory, removing its old destination-only entries. | Move the link object without following its target, including standalone and broken links. | Apply Copy's top-level transfer checks and Delete's safety policy to directory/link source removal and existing destination removal. Recheck both approved objects before execution. After-start failure is `unknown`. |
12
+
13
+ A target names the resulting object, not a containing directory with an implicit source-name child. For example, Copy from `source` to `new/target` produces `new/target/nested`, not `new/target/source/nested`.
14
+
15
+ Symlink text is preserved exactly. A relative link can point somewhere different after relocation. Existing symlink destinations are rejected, even if their referents match. Copy also rejects a conflicting link at any matching destination entry. Destination-only links are left alone by Copy; replacing a Move destination removes the links, not their referents. File/directory/link type conflicts are refused rather than converted.
16
+
17
+ Only regular files, directories, and symlink objects are supported within source trees. Recursive transfers preserve file bytes and empty directories; they do not promise preserved timestamps, ownership, or hard-link relationships. Directory and link targets are not post-processed as text and have no reusable text selection. Inspect their ordinary paths with Read.
18
+
19
+ ## Move safety policy
20
+
21
+ For directory and symlink Move sources, and existing directory destinations, the same before-delete hook runs before any removal or dialog. Denial or a thrown hook error blocks the transfer. Tracked or newly staged entries, external targets, missing Git worktrees, and failed Git checks require host approval. No available dialog means no transfer. Untracked internal targets need no dialog. There is no agent approval argument.
22
+
23
+ Protected project roots, ancestors, filesystem roots, and current Git control paths cannot be moved or recursively overwritten. Parent symlinks are resolved for identity, containment, and project-boundary checks; the final link object is not dereferenced. The project boundary is the Git worktree containing Pi's cwd. Without Git, cwd and its ancestors remain protected.
24
+
25
+ Move obtains all required approvals and rechecks each object afterwards. Changes to identity, Git classification, source-tree entries, or matching destination entries during preflight prevent dispatch. These checks are not an atomic filesystem lock against other processes. Ordinary-file overwrite behavior and selected-text editing remain unchanged.
26
+
27
+ For hook setup and the existing Delete policy, see [File hooks](user-hooks.md).
28
+
29
+ ## Cross-device moves, cancellation, and partial failure
30
+
31
+ Move first attempts a filesystem rename. On a cross-device error, the filesystem library copies the object and then removes the source. The copy and removal phases can fail separately. Replacement may already have removed destination contents when a later phase fails.
32
+
33
+ Cancellation before filesystem execution prevents the transfer. The recursive filesystem primitives are not interruptible through the tool's abort signal once dispatched; in-flight work may finish. A failed filesystem call after dispatch reports `unknown`, even when the precise effects cannot be established.
34
+
35
+ There is no recursive undo or atomic rollback. After an unknown result, inspect both source and target before deciding whether to retry. Earlier successful operations in the same Codemode script are not rolled back when a later operation fails.
36
+
37
+ ## Executable checks
38
+
39
+ - [Transfer unit tests](https://github.com/alexshpunt/pi-agent-ide/blob/develop/src/extensions/pi-agent-text-editor/tests/core/directory-transfers.test.ts): binary bytes, empty directories, link text, merge/replace behavior, aliases, nested destinations, conflicts, hooks/approvals, changed objects, cancellation, real Linux cross-device moves, and controlled partial failures.
40
+ - [Delete policy unit tests](https://github.com/alexshpunt/pi-agent-ide/blob/develop/src/extensions/pi-agent-text-editor/tests/core/delete-policy.test.ts): deletion guards and uncertain recursive effects.
41
+ - [Real-Pi transfer cases](https://github.com/alexshpunt/pi-agent-ide/blob/develop/tests/integration/directory-transfers.integration.test.ts): direct and native Codemode transfers, preserved source/sentinel bytes, host approval, and refusal paths.
42
+ - [Real-Pi Delete cases](https://github.com/alexshpunt/pi-agent-ide/blob/develop/tests/integration/delete-objects.integration.test.ts): both call routes and fail-closed host guards.
43
+ - [Paid capability matrix](https://github.com/alexshpunt/pi-agent-ide/blob/develop/benchmarks/tool-capabilities/README.md): executable `directory-transfers` and `directory-transfer-gates` cases have direct and Codemode routes. They are not model-verified until explicitly run with paid permission. Free coverage checks do not prove model execution.
44
+
45
+ These contracts are checked on Linux/WSL. The cross-device test uses `/dev/shm` and runs only on Linux. Other operating systems are not verified by that test.