pi-agent-ide 0.7.1 → 0.7.2

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 (275) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/chunk-6U5OU77O.js +3 -0
  3. package/dist/chunk-EURHXLN3.js +2 -0
  4. package/dist/{chunk-WMO6RNE2.js → chunk-F6IWZKOG.js} +6 -6
  5. package/dist/{chunk-HZEY4GT4.js → chunk-H445SHSJ.js} +2 -2
  6. package/dist/chunk-IG56UGSO.js +2 -0
  7. package/dist/chunk-IICJXZBU.js +6 -0
  8. package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
  9. package/dist/{chunk-PKKDDIWW.js → chunk-KOVPDKSJ.js} +1 -1
  10. package/dist/chunk-MXLSGMRZ.js +3 -0
  11. package/dist/chunk-OB46OPMZ.js +1 -0
  12. package/dist/chunk-PKSQT6TC.js +1 -0
  13. package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
  14. package/dist/chunk-QUYXINGZ.js +7 -0
  15. package/dist/{chunk-OMVRLWMX.js → chunk-SBP3ABH4.js} +1 -1
  16. package/dist/{chunk-4GCWGE2C.js → chunk-SJ4UZ4GU.js} +1 -1
  17. package/dist/{chunk-2TRHFMCZ.js → chunk-SNF7PDDX.js} +1 -1
  18. package/dist/{chunk-YP46DVVP.js → chunk-STBJO3Z3.js} +1 -1
  19. package/dist/{chunk-76ZK5ODR.js → chunk-TQGE7RH6.js} +13 -13
  20. package/dist/{chunk-LEEQIQ7D.js → chunk-XDG7EQRN.js} +6 -6
  21. package/dist/chunk-YWQS33DF.js +1 -0
  22. package/dist/chunk-ZIWPKIBZ.js +1 -0
  23. package/dist/entry-11.js +1 -1
  24. package/dist/entry-13.js +1 -1
  25. package/dist/entry-14.js +1 -1
  26. package/dist/entry-15.js +1 -1
  27. package/dist/entry-17.js +1 -1
  28. package/dist/entry-25.js +1 -1
  29. package/dist/entry-26.js +1 -1
  30. package/dist/entry-27.js +1 -1
  31. package/dist/entry-28.js +1 -1
  32. package/dist/entry-29.js +1 -1
  33. package/dist/entry-31.js +13 -12
  34. package/dist/entry-33.js +2 -1
  35. package/dist/entry-37.js +2 -2
  36. package/dist/entry-42.js +1 -1
  37. package/dist/entry-44.js +1 -1
  38. package/dist/entry-45.js +20 -12
  39. package/dist/entry-46.js +1 -1
  40. package/dist/entry-49.js +1 -1
  41. package/dist/entry-50.js +1 -1
  42. package/dist/entry-51.js +7 -6
  43. package/dist/entry-52.js +1 -1
  44. package/dist/entry-53.js +1 -1
  45. package/dist/entry-54.js +1 -1
  46. package/dist/entry-56.js +1 -1
  47. package/dist/entry-58.js +1 -1
  48. package/dist/entry-60.js +1 -1
  49. package/dist/entry-62.js +1 -1
  50. package/dist/entry-65.js +1 -1
  51. package/dist/entry-66.js +1 -1
  52. package/dist/entry-68.js +1 -1
  53. package/dist/entry-70.js +1 -1
  54. package/dist/entry-75.js +1 -1
  55. package/dist/entry-77.js +51 -42
  56. package/dist/entry-78.js +14 -14
  57. package/dist/entry-79.js +1 -1
  58. package/dist/entry-82.js +5 -5
  59. package/dist/entry-83.js +1 -1
  60. package/dist/entry-84.js +1 -1
  61. package/dist/entry-85.js +1 -1
  62. package/dist/entry-86.js +1 -1
  63. package/dist/pi-agent-ide.js +34 -11
  64. package/docs/agent-guides/editing.md +5 -5
  65. package/docs/agent-guides/git-changes.md +10 -0
  66. package/docs/agent-guides/read-resources.md +9 -46
  67. package/docs/agent-guides/search-code.md +7 -1
  68. package/docs/agent-guides/select-code.md +1 -0
  69. package/docs/agent-guides/terminal.md +9 -1
  70. package/docs/configuration.md +1 -1
  71. package/docs/releases.md +4 -0
  72. package/docs/research/native-codemode-batch-decision.md +2 -0
  73. package/docs/structured-results.md +2 -2
  74. package/docs/tools.md +10 -2
  75. package/node_modules/pi-agent-doctor/package.json +1 -1
  76. package/node_modules/pi-agent-documentation/package.json +1 -1
  77. package/node_modules/pi-agent-filesystem/package.json +7 -7
  78. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  79. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  80. package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
  81. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  82. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  83. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  84. package/node_modules/pi-agent-ide-ast/src/extension.ts +0 -2
  85. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  86. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +0 -3
  87. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +8 -6
  88. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +13 -5
  89. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  90. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  91. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  92. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  93. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  94. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  95. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  96. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
  97. package/node_modules/pi-agent-image/package.json +2 -2
  98. package/node_modules/pi-agent-invariant/package.json +1 -1
  99. package/node_modules/pi-agent-pdf/package.json +2 -2
  100. package/node_modules/pi-agent-read/package.json +7 -7
  101. package/node_modules/pi-agent-read/src/api/read-parameters.ts +3 -3
  102. package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -0
  103. package/node_modules/pi-agent-read/src/core/extension.ts +1 -1
  104. package/node_modules/pi-agent-read/src/core/read-core.ts +5 -1
  105. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  106. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  107. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  108. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  109. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +99 -44
  110. package/node_modules/pi-agent-resource/package.json +1 -1
  111. package/node_modules/pi-agent-resource/src/index.ts +1 -0
  112. package/node_modules/pi-agent-resource/src/result-targets.ts +6 -3
  113. package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
  114. package/node_modules/pi-agent-search/package.json +5 -5
  115. package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
  116. package/node_modules/pi-agent-search/src/api/search-parameters.ts +2 -2
  117. package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
  118. package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
  119. package/node_modules/pi-agent-search-text/package.json +7 -7
  120. package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
  121. package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
  122. package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
  123. package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
  124. package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
  125. package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
  126. package/node_modules/pi-agent-text/package.json +2 -2
  127. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  128. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  129. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  130. package/node_modules/pi-agent-text-editor/package.json +9 -9
  131. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  132. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
  133. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  134. package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  135. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  136. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  137. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  138. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  139. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  140. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -151
  141. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  142. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
  143. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  144. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +14 -13
  145. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  146. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  147. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  148. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  149. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +381 -187
  150. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +4 -2
  151. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -2
  152. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  153. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  154. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
  155. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  156. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  157. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  158. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  159. package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  160. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
  161. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  162. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  163. package/node_modules/pi-agent-web/package.json +7 -7
  164. package/node_modules/pi-agent-web/src/resolver.ts +11 -13
  165. package/node_modules/pi-agent-web-html/package.json +2 -2
  166. package/node_modules/pi-agent-web-image/package.json +3 -3
  167. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  168. package/node_modules/pi-agent-web-text/package.json +3 -3
  169. package/package.json +35 -35
  170. package/src/composite/nested-tool-rendering.ts +64 -6
  171. package/src/composite/output-limits.ts +125 -0
  172. package/src/composite/responses-tools.ts +25 -0
  173. package/src/composite/text-results.ts +158 -7
  174. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  175. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  176. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  177. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
  178. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  179. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  180. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  181. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  182. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  183. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  184. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  185. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
  186. package/src/extensions/pi-agent-read/package.json +7 -7
  187. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +3 -3
  188. package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -0
  189. package/src/extensions/pi-agent-read/src/core/extension.ts +1 -1
  190. package/src/extensions/pi-agent-read/src/core/read-core.ts +5 -1
  191. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  192. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  193. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  194. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  195. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +99 -44
  196. package/src/extensions/pi-agent-search/package.json +5 -5
  197. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
  198. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
  199. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
  200. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
  201. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
  202. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
  203. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
  204. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
  205. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +2 -2
  206. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
  207. package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
  208. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  209. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  210. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  211. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  212. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  213. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  214. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  215. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  216. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
  217. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  218. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +1 -2
  219. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  220. package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  221. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  222. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  223. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  224. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  225. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  226. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -151
  227. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  228. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
  229. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  230. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +14 -13
  231. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  232. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  233. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  234. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  235. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +381 -187
  236. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +4 -2
  237. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -2
  238. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  239. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  240. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +2 -3
  241. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  242. package/src/pi-agent-ide.ts +11 -0
  243. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  244. package/src/plugins/pi-agent-ide-ast/src/extension.ts +0 -2
  245. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  246. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +0 -3
  247. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +8 -6
  248. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +13 -5
  249. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  250. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  251. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  252. package/src/plugins/pi-agent-ide-debugger/index.ts +17 -7
  253. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
  254. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
  255. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +3 -2
  256. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  257. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  258. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  259. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  260. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +0 -1
  261. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
  262. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
  263. package/src/plugins/pi-agent-ide-vision/index.ts +1 -0
  264. package/src/post-edit/gate.ts +13 -2
  265. package/dist/chunk-4XMY4H4V.js +0 -1
  266. package/dist/chunk-64M3SQPG.js +0 -3
  267. package/dist/chunk-CWD4O5PM.js +0 -3
  268. package/dist/chunk-D3WTDA6V.js +0 -2
  269. package/dist/chunk-EAZGN5ND.js +0 -7
  270. package/dist/chunk-GXEGY7GV.js +0 -1
  271. package/dist/chunk-MBUXFKIW.js +0 -3
  272. package/dist/chunk-PGIVHICI.js +0 -1
  273. package/dist/chunk-VMTR74FF.js +0 -2
  274. package/dist/chunk-WU6ZK6YD.js +0 -1
  275. 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 B,c as L,d as ee,e as te,f as O}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-PKSQT6TC.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 M=[T("ide.core",()=>import("./chunk-F6IWZKOG.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-TQGE7RH6.js"),["ide.processes","read.core","editor.core"]),T("ide.terminal",()=>import("./chunk-XDG7EQRN.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),T("ide.diagnostics",()=>import("./chunk-EURHXLN3.js"),["ide.core","read.core"])];function T(e,u,g=[],d=!0){return{id:e,name:G[e][0],description:G[e][1],dependencies:g,async register(i,m){await(await u()).default(i,m)},...d?{}:{defaultEnabled:!1}}}f(T,"builtin");function F(e,u,g){return{kind:"choice",id:e,name:u,description:g,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,u,g=[]){let d=new Map;for(let l of e){if(d.has(l.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${l.id}`);d.set(l.id,l)}for(let l of e)for(let w of l.dependencies)if(!d.has(w))throw new Error(`Pi Agent IDE extension ${l.id} has unknown dependency ${w}`);let i=new Set;for(let l of u)d.has(l)&&i.add(l);for(let l of g)if(!d.has(l))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${l}`);let m=Ie(d,g,i),h=new Set;for(let l of e)(l.defaultEnabled===!1&&!m.has(l.id)||i.has(l.id))&&h.add(l.id);let v=!0;for(;v;){v=!1;for(let l of e)h.has(l.id)||l.dependencies.every(w=>!h.has(w))||(h.add(l.id),v=!0)}return{enabled:e.filter(l=>!h.has(l.id)),disabled:h}}f(U,"selectBuiltinExtensions");function Ie(e,u,g){let d=new Set,i=[...u];for(;i.length>0;){let m=i.pop();if(!(d.has(m)||g.has(m))){d.add(m);for(let h of e.get(m)?.dependencies??[])d.has(h)||i.push(h)}}return d}f(Ie,"collectForcedOn");import{Input as ke}from"@earendil-works/pi-tui";import{mkdir as Ae,readFile as Te,writeFile as ve}from"node:fs/promises";import Se from"node:path";import{withFileMutationQueue as Re}from"@earendil-works/pi-coding-agent";async function oe(e,u,g=new Map,d=new Map,i){await Re(e,async()=>{let m=await O(e),h={};try{h=JSON.parse(await Te(e,"utf8"))}catch(t){if(!(t instanceof Error&&"code"in t&&t.code==="ENOENT"))throw t}let v=new Set(m.disabled),l=new Set(m.enabled);for(let[t,s]of u)v.delete(t),l.delete(t),s==="disabled"&&v.add(t),s==="enabled"&&l.add(t);let w={...m.preferences};for(let[t,s]of d)s===void 0?delete w[t]:w[t]=s;let p={...m.flags};for(let[t,s]of g)t==="pi-agent-ide-no-animations"&&delete h.noAnimations,t==="pi-agent-ide-no-post-processing"&&delete h.noPostProcessing,s===void 0?delete p[t]:p[t]=s;await Ae(Se.dirname(e),{recursive:!0}),await ve(e,`${JSON.stringify({...h,disabled:[...v],enabled:[...l],...i===void 0?{}:{preset:i},...g.size>0?{flags:p}:{},...d.size>0?{preferences:w}:{}},null,2)}
2
+ `)})}f(oe,"saveModuleChoices");import{getSettingsListTheme as Pe}from"@earendil-works/pi-coding-agent";import{matchesKey as W,SettingsList as Ce,truncateToWidth as se,visibleWidth as re}from"@earendil-works/pi-tui";function ie(e,u,g,d,i=""){let m=["extensions","behavior","ui"],h="extensions",v=f(o=>o==="extensions"?"modules":o==="behavior"?"features":"ui","itemKey"),l=f(o=>o==="extensions"?"modules":o==="behavior"?"features":"ui","changeKey"),w=f(()=>{let o=v(h),a=u()[o]??[];return new Ce(a,12,Pe(),(r,c)=>{g(l(h),r,c);for(let E of u()[o]??[]){let b=a.find(x=>x.id===E.id);b&&Object.assign(b,E)}},()=>d(!1),{enableSearch:!0})},"createList"),p=w(),t=f(o=>e.fg("borderMuted",o),"border"),s=f((o,a)=>{if(a<=1)return t("\u2502");let r=a-2,c=se(o,r);return`${t("\u2502")}${c}${" ".repeat(Math.max(0,r-re(c)))}${t("\u2502")}`},"row"),n=f(o=>t(o<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,o-2))}\u2524`),"rule");return{render(o){let a=Math.max(1,o),r=Math.max(1,a-4),c=` Agent IDE settings${i?` \xB7 ${i}`:""} `,E=a<=1?t("\u256D"):`${t("\u256D\u2500")}${e.fg("accent",e.bold(se(c,Math.max(0,a-3),"")))}${t(`${"\u2500".repeat(Math.max(0,a-re(c)-3))}\u256E`)}`,b={extensions:"Features",behavior:"Behavior",ui:"UI"},x=m.map(A=>A===h?e.fg("accent",e.bold(`[ ${b[A]} ]`)):e.fg("dim",` ${b[A]} `)).join(" "),I=p.render(r).map(A=>s(` ${A} `,a)),R=e.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[E,s(` ${x} `,a),n(a),...I,n(a),s(R,a),t(a<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,a-2))}\u256F`)]},invalidate(){p.invalidate()},handleInput(o){W(o,"tab")||W(o,"shift+tab")?(h=m[(m.indexOf(h)+(W(o,"shift+tab")?2:1))%m.length]??"extensions",p=w()):W(o,"ctrl+s")?d(!0):p.handleInput(o)}}}f(ie,"createSettingsPanel");function ae(e,u=[],g=[]){e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(d,i){if(i.hasUI)try{let m=await i.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(m===void 0)return;let h=L(process.env,void 0,i.cwd),v=m==="Project"?h.projectPath:h.globalPath,l=await O(v),w=await O(m==="Project"?h.globalPath:h.projectPath),p=new Map,t=new Map,s=new Map,n;if(!await i.ui.custom((a,r,c,E)=>{let b=ie(r,()=>{let x=new Set(l.disabled),I=new Set(l.enabled);for(let[P,y]of p)x.delete(P),I.delete(P),y==="disabled"&&x.add(P),y==="enabled"&&I.add(P);let R=U(M,[...B(M,n??l.preset??"full"),...x,...B(M,w.preset??"full"),...w.disabled],[...I,...w.enabled]);return{modules:M.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:p.get(P.id)??(l.disabled.includes(P.id)?"disabled":l.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=n??l.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 g.filter(y=>y.group===P).map(y=>{let C=s.has(y.id)?s.get(y.id):l.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 $=new ke,V=_==="default"?y.default:_;return V.length>0&&$.handleInput(V),$.focused=!0,$.onSubmit=Ee=>z(Ee),$.onEscape=()=>z(),$},"submenu")}}})}function k(P){return u.filter(y=>(y.group??"features")===P).map(y=>{let C=t.has(y.id)?t.get(y.id):te(l)[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"]}})}},(x,I,R)=>{if(x==="modules")p.set(I,R);else if(I==="preset")n=j.find(A=>A.label===R)?.value;else if(g.some(A=>A.id===I)){let A=g.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 t.set(I,R==="default"?void 0:R===(u.find(A=>A.id===I)?.labels?.on??"enabled"))},E,m);return{render:f(x=>b.render(x),"render"),invalidate:f(()=>b.invalidate(),"invalidate"),handleInput(x){b.handleInput(x),a.requestRender()}}})||p.size+t.size+s.size+(n===void 0?0:1)===0)return;if(await oe(v,p,t,s,n),i.ui.notify(`Saved ${m.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(m){i.ui.notify(m instanceof Error?m.message:String(m),"error")}}})}f(ae,"registerModuleSettings");function de(e,u){let g=[];return{definitions:g,register(d){if(g.some(i=>i.id===d.id))throw new Error(`Duplicate feature flag: ${d.id}`);g.push(d),e.registerFlag(d.id,{type:"boolean",description:d.description,default:u[d.id]??d.default})}}}f(de,"createFeatureFlags");function le(e){let u=new Map,g=new Set;return{api:{...e,registerTool:f(i=>{i.namespace?.name.startsWith("ide_")===!0&&u.set(i.name,{hide:f(()=>e.registerTool({...i,get description(){return i.description},get promptGuidelines(){return i.promptGuidelines},exposure:"hidden"}),"hide"),restore:f(()=>e.registerTool(i),"restore")}),g.has(i.name)?u.get(i.name)?.hide():e.registerTool(i)},"registerTool")},reconcile(i=!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 n=s.startsWith("+")?s.slice(1):s;h.delete(n),v.add(n)}for(let[s,n]of u)h.has(s)!==g.has(s)&&(h.has(s)?(n.hide(),g.add(s)):(n.restore(),g.delete(s)));let l=e.getAllTools().filter(s=>s.exposure!=="hidden"),w=new Set(e.getActiveTools());for(let s of l)i&&u.has(s.name)&&(v.has(s.name)||s.exposure==="deferred"&&m.includes(s.name))&&w.add(s.name);i&&!h.has("tool_search")&&l.some(s=>s.name==="tool_search")&&l.some(s=>u.has(s.name)&&s.exposure==="deferred")&&w.add("tool_search");let p=e.getActiveTools(),t=[...w].filter(s=>!g.has(s));(t.length!==p.length||t.some(s=>!p.includes(s)))&&e.setActiveTools(t)}}}f(le,"createIdeToolAvailability");import{ToolExecutionComponent as ce}from"@earendil-works/pi-coding-agent";import{Container as _e,Spacer as Ne,Text as ue}from"@earendil-works/pi-tui";var J="ide-nested-results",Me=256,fe=512*1024,De=8*1024,$e=32*1024;function pe(e){let u=new Map,g=new Map,d=new Map,i,m=new WeakMap,h=f((p,t,s)=>{t.result=s;try{let o=JSON.stringify(p);if(Buffer.byteLength(o)<=fe){t.result=JSON.parse(JSON.stringify(s));return}}catch{}let n=s.details&&typeof s.details=="object"?Object.entries(s.details).filter(([o,a])=>(o==="source"||o==="fullOutputPath")&&typeof a=="string").map(([o,a])=>`${o}: ${String(a)}`):[];t.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...n].join(`
3
+ `)}],details:void 0,isError:s.isError},t.omitted=!0,p.complete=!1},"retainResult"),v=f(()=>{g.clear(),d.clear()},"clear");e.on("session_start",(p,t)=>{v(),t.mode==="tui"&&t.ui.setWidget(J,s=>(i=s,{render:f(()=>[],"render"),invalidate:f(()=>{},"invalidate")}))}),e.on("session_tree",v),e.on("session_shutdown",v),e.on("tool_execution_start",(p,t)=>{if(p.parentToolCallId===void 0)return;let s=g.get(p.parentToolCallId)??p.parentToolCallId;if(g.set(p.toolCallId,s),!u.has(p.toolName))return;let n=d.get(s);if(n||(n={parentToolCallId:s,cwd:t.cwd,calls:[],complete:!0},d.set(s,n)),n.calls.length>=Me){n.complete=!1;return}let o=JSON.stringify(p.args),a=$e-n.calls.reduce((b,x)=>b+Buffer.byteLength(JSON.stringify(x.args)),0),r=Buffer.byteLength(o)>Math.min(De,a),c=r?Object.fromEntries(Object.entries(p.args).map(([b,x])=>[b,typeof x=="string"?x.slice(0,200)+(x.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(o),E=Buffer.byteLength(JSON.stringify(c))<=a?c:{};n.calls.push({id:p.toolCallId,name:p.toolName,args:E}),r&&(n.complete=!1)}),e.on("tool_execution_end",p=>{let t=g.get(p.toolCallId);if(t===void 0)return;g.delete(p.toolCallId);let s=d.get(t),n=s?.calls.find(o=>o.id===p.toolCallId);if(s&&n){let o=p.result;h(s,n,{content:o.content.filter(a=>a.type!=="text"||!a.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:o.details,isError:p.isError})}}),e.on("message_end",p=>{if(p.message.role!=="toolResult")return;let t=d.get(p.message.toolCallId);if(!t)return;d.delete(p.message.toolCallId);for(let[o,a]of g)a===t.parentToolCallId&&g.delete(o);let s={...t,calls:[],complete:t.complete},n=0;for(let o of t.calls){if(o.batched)continue;let a=JSON.stringify(o);if(n+=Buffer.byteLength(a),n>fe){s.complete=!1;break}s.calls.push(JSON.parse(a)),o.result||(s.complete=!1)}e.appendEntry(J,s)}),e.registerEntryRenderer(J,f(function p(t,s,n){if(!Array.isArray(t.data?.calls))return;if(!i)return{render:f(r=>i?p(t,s,n)?.render(r)??[]:[],"render"),invalidate:f(()=>{t.data&&m.get(t.data)?.invalidate()},"invalidate")};let o=m.get(t.data);if(!o){o=new _e;for(let r of t.data.calls){let c=new ce(r.name,r.id,r.renderArgs??r.args,{showImages:!0},r.omitted||!r.result?void 0:u.get(r.name),i,t.data.cwd);r.result?c.updateResult(r.result):c.updateResult({content:[{type:"text",text:"Result unavailable; history is incomplete."}],isError:!0}),o.addChild(new Ne(1)),o.addChild(c)}t.data.complete||o.addChild(new ue(n.fg("warning","Incomplete nested IDE presentation; some results were not retained."),0,0)),m.set(t.data,o)}let a=o.children.at(-1);!t.data.complete&&a instanceof ue&&a.setText(n.fg("warning","Incomplete nested IDE presentation; some results were not retained."));for(let r of o.children)r instanceof ce&&r.setExpanded(s.expanded);return o},"renderEntry"));let l=f(()=>{e.events.on(Z,p=>{let t=p,s=d.get(t.parentToolCallId);if(!s)return;let n=q(t.result.details),o=t.calls.findLast(r=>!t.unchangedCopyCalls?.includes(r)),a="callIdsByResult"in n&&Array.isArray(n.callIdsByResult)?n.callIdsByResult:[];for(let r of t.calls){let c=s.calls.find(I=>I.id===r);if(!c)continue;let E=n.results?.filter((I,R)=>(a[R]===r||a.length===0&&t.calls.length===1)&&I.data.errors?.some(A=>A.code==="POST_WRITE_FAILED"||A.code==="POST_EDIT_FAILED"))??[];if(c.postWriteFailure=E.length>0,c.postWriteFailure){c.batched=!1,delete c.renderArgs,h(s,c,{content:t.result.content,details:{results:E,effect:"applied"},isError:!0});continue}let b=t.copyResults?.get(r),x=b?.details.metadata?.copyRollback;if(c.name==="copy"&&b&&(x==="restored"||x==="failed")){c.copyRollback=x,c.batched=!1,h(s,c,{content:b.content,details:q(b.details),isError:!0});continue}c.unchangedCopy=c.name==="copy"&&t.unchangedCopyCalls?.includes(r)===!0,c.batched=!c.unchangedCopy&&r!==o,c.unchangedCopy?h(s,c,{content:[{type:"text",text:"No changes: destination already has this text."}],details:{},isError:!1}):c.batched?c.result=void 0:(new Set(n.mutationRender?.map(I=>I.path)).size>1&&(c.renderArgs={}),c.rollback=n.results?.some(I=>I.data.rollback!==void 0)===!0,h(s,c,{content:t.result.content,details:n,isError:t.result.isError===!0||c.rollback}))}}),e.on("tool_result",p=>{let t=p.details,s=d.get(p.toolCallId);if(s&&t&&typeof t=="object"&&"editorBatchResults"in t&&Array.isArray(t.editorBatchResults))for(let n of t.editorBatchResults)for(let o of n.data?.operations??[]){let a=s.calls.find(c=>c.id===o.id);if(!a)continue;let r=o.errors.map(c=>c.message);a.rollback||a.postWriteFailure||a.copyRollback!==void 0||a.unchangedCopy&&r.length===0&&o.effect==="not-applied"||(r.length>0||o.effect!=="applied")&&(a.batched=!1,delete a.renderArgs,h(s,a,{content:[{type:"text",text:`${a.name}: ${o.effect}.
8
+ ${r.join(`
9
+ `)}`}],details:void 0,isError:r.length>0||o.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:f(p=>{u.set(p.name,p),e.registerTool(p)},"registerTool")},finalize:l}}f(pe,"createNestedIdeRendering");import{createCanvas as Be,loadImage as Oe}from"@napi-rs/canvas";import{DEFAULT_MAX_BYTES as je,DEFAULT_MAX_LINES as Le,truncateHead as Fe}from"@earendil-works/pi-coding-agent";var N={bytes:je,lines:Le,pixels:4e6,images:20,imageBytes:20*1024*1024};async function D(e,u="",g){let d=typeof u=="string"?[u]:u,i=[],m=e.flatMap(r=>{if(r.type!=="text")return[];let c=d.find(E=>E.length>0&&r.text.endsWith(E));return c?(i.push(c),[r.text.slice(0,-c.length)]):[r.text]}).join(`
10
+ `),h=i.join(""),v=Fe(m,{maxBytes:N.bytes,maxLines:N.lines}),l=[],w;if(v.truncated&&g!==void 0)try{w=await g(m)}catch{l.push("[Full output could not be saved. Narrow the request to inspect it.]")}v.truncated&&l.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&&l.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 p=e.filter(r=>r.type==="image"),t=p.slice(0,N.images),s=[],n=Math.floor(N.pixels/Math.max(1,t.length)),o=0,a=p.length-t.length;for(let[r,c]of t.entries())try{let E=Buffer.from(c.data,"base64"),b=await Oe(E),x=Math.min(1,Math.sqrt(n/(b.width*b.height))),I=Math.min(n,Math.max(1,Math.floor(b.height*x))),R=Math.min(Math.floor(n/I),Math.max(1,Math.floor(b.width*x))),A=E,S=c.mimeType;if(x<1||o+A.byteLength>N.imageBytes){let k=Be(R,I);k.getContext("2d").drawImage(b,0,0,R,I),A=await k.encode("png"),S="image/png"}if(o+A.byteLength>N.imageBytes){a++;continue}o+=A.byteLength,s.push({type:"image",data:A.toString("base64"),mimeType:S}),x<1&&l.push(`[Image ${r+1} resized from ${b.width}x${b.height} to ${R}x${I} to fit the shared media budget.]`)}catch{a++,l.push(`[Image ${r+1} could not be decoded and was not returned.]`)}return a>0&&l.push(`[${a} images omitted from the result. Read fewer frames or a smaller image region.]`),{text:v.firstLineExceedsLimit?Ue(m):v.content,textTruncated:v.truncated,images:s,notices:l,metadataSuffix:h,fullOutput:w}}f(D,"limitIdeOutput");function Ue(e){let u=0,g=0;for(let d of e){let i=Buffer.byteLength(d);if(u+i>N.bytes)break;u+=i,g+=d.length}return e.slice(0,g)}f(Ue,"bytePrefix");var ge={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 me(e){let u=Q(e),g=new Set,d=new K,i=f(n=>d.saveFile(n),"saveFullOutput"),m=new Set,h=new Map;Y(e,{protocol:H,apiVersion:X,id:"ide-output-retention",setup(n){n.setOutputSaver(i)}}),e.on("session_shutdown",()=>d.dispose());let v=f((n,o)=>{let a=o;return n!=="tool_call"?e.on(n,a):e.on("tool_call",async(r,c)=>{let E=await a(r,c);if(!E?.block||!g.has(r.toolName)||E.reason===void 0)return E;let b=await D([{type:"text",text:E.reason}],"",i);return m.add(r.toolCallId),{...E,reason:b.text+(b.notices.length?`
11
+
12
+ ${b.notices.join(`
13
+ `)}`:"")}})},"on"),l=new Map,w=new Map,p=f(()=>{l.clear(),w.clear(),m.clear(),h.clear()},"clear");e.on("session_start",p),e.on("session_shutdown",p),e.on("before_agent_start",n=>({systemPrompt:`${n.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",n=>{n.parentToolCallId!==void 0&&l.set(n.toolCallId,l.get(n.parentToolCallId)??n.parentToolCallId)}),v("tool_call",(n,o)=>{if(!g.has(n.toolName))return;let a={...n.input};try{for(let r of ge[n.toolName]??[]){let c=a[r];if(c!==void 0)if(n.toolName==="diff"&&c!==null&&typeof c=="object"&&"path"in c)a[r]={...c,path:u.source(c.path,o.cwd,!0)};else{let E=u.source(c,o.cwd,n.toolName==="read"?!0:["write","insert","delete"].includes(n.toolName)?"live":!1);if(n.toolName==="read"&&Array.isArray(E)){let b=u.resolve(E,o.cwd);a[r]=u.register(b.targets,o.cwd,b.complete)}else a[r]=E}}n.toolName==="select"&&a.operation&&typeof a.operation=="object"&&"scopes"in a.operation&&(a.operation={...a.operation,scopes:u.source(a.operation.scopes,o.cwd)});for(let r of["text","content"]){let c=a[r];if(typeof c=="string"&&(c.trimStart().startsWith("<system-result")||/<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>/iu.test(c)))return{block:!0,reason:"A system result reference is not file content. Do not insert it into a file."}}Object.assign(n.input,a)}catch(r){return{block:!0,reason:r instanceof Error?r.message:String(r)}}});let t=f(n=>{g.add(n.name);let o={},a=Object.getOwnPropertyDescriptors(n);delete a.outputSchema;let r=f(async(...b)=>{let x=await n.execute(...b).catch(async A=>{let S=await D([{type:"text",text:A instanceof Error?A.message:String(A)}],"",i);throw m.add(b[0]),S.notices.length===0?A:new Error(S.text+`
18
+
19
+ ${S.notices.join(`
20
+ `)}`,{cause:A})}),I=await D(x.content,he(x.details),i),R=I.text+I.metadataSuffix;return{...x,content:[{type:"text",text:R+(I.notices.length?`
21
+
22
+ ${I.notices.join(`
23
+ `)}`:"")},...I.images]}},"execute");a.execute={value:r,enumerable:!0,configurable:!0,writable:!0};let c=n.renderCall;if(c){let b=f((x,I,R)=>c(We(n.name,x),I,R),"renderCall");a.renderCall={value:b,enumerable:!0,configurable:!0,writable:!0}}let E=n.renderResult;if(E){let b=f((x,I,R,A)=>E({...x,content:x.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");a.renderResult={value:b,enumerable:!0,configurable:!0,writable:!0}}Object.defineProperties(o,a),e.registerTool(o)},"registerTool"),s=f(()=>{e.on("context",async n=>({messages:await Promise.all(n.messages.map(async o=>{if(o.role!=="toolResult"||!o.isError||!g.has(o.toolName)||m.has(o.toolCallId)||o.content.some(r=>r.type==="text"&&r.text.startsWith("<system-result")))return o;let a=h.get(o.toolCallId);return a===void 0&&(a=D(o.content,"",i).then(r=>[{type:"text",text:r.text+(r.notices.length?`
24
+
25
+ ${r.notices.join(`
26
+ `)}`:"")},...r.images]),h.set(o.toolCallId,a)),{...o,content:await a}}))})),e.on("tool_result",async(n,o)=>{if(n.toolName==="codemode"){u.refreshAll();let S=w.get(n.toolCallId)??[];w.delete(n.toolCallId);for(let[C,_]of l)_===n.toolCallId&&l.delete(C);let k=n.content.filter(C=>C.type==="text"&&C.text.startsWith(`
27
+
28
+ ---
29
+
30
+ # Guide:`)),P=n.content.filter(C=>!k.includes(C)),y=await D([...P,...S],"",i);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(!g.has(n.toolName))return;let a=n.content.filter(S=>S.type==="text").map(S=>S.text).join(`
34
+ `),r=n.structuredContent,c=r!==null&&typeof r=="object"&&"data"in r?r:{status:n.isError?"error":"success",data:r},E=c.data,b=E!==null&&typeof E=="object"&&"effect"in E&&E.effect==="applied"&&"targetUnavailable"in E&&typeof E.targetUnavailable=="string"?E.targetUnavailable:void 0,x=b===void 0?a:`${a}
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=ye(c),R=u.publish(c,x,o.cwd,I),A=l.get(n.toolCallId);if(l.delete(n.toolCallId),A!==void 0){let S=n.content.filter(k=>k.type==="image");S.length&&w.set(A,[...w.get(A)??[],...S])}return{content:[{type:"text",text:R},...n.content.filter(S=>S.type!=="text")]}})},"finalize");return{api:{...e,on:v,registerTool:t},finalize:s}}f(me,"createIdeTextResults");function he(e){if(e===null||typeof e!="object")return[];let u="outputNotice"in e&&typeof e.outputNotice=="string"?[e.outputNotice]:[];if("resources"in e&&Array.isArray(e.resources)){let g=e.resources;for(let d of g)d!==null&&typeof d=="object"&&"details"in d&&u.push(...he(d.details))}return u}f(he,"outputNotices");function We(e,u){let g=f(i=>{if(Array.isArray(i))return i.map(g);if(typeof i!="string")return i;let m=/^<system-result\b[^>]*><uuid>([a-f\d-]{36})<\/uuid>/u.exec(i)?.[1];return m?`RESULT#${m}`:i},"label"),d={...u};for(let i of ge[e]??[])Object.assign(d,{[i]:g(u[i])});return d}f(We,"displaySources");function ye(e){if(e===null||typeof e!="object"||!("data"in e))return[];let u=e.data;return u===null||typeof u!="object"?[]:"resources"in u&&Array.isArray(u.resources)?u.resources.flatMap(d=>ye({data:d})):"files"in u&&Array.isArray(u.files)?u.files.flatMap(d=>d!==null&&typeof d=="object"&&"source"in d&&typeof d.source=="string"&&/^(?:shell|debug):/u.test(d.source)?[d.source]:[]):"source"in u&&typeof u.source=="string"?[u.source]:[]}f(ye,"resultResources");function be(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}f(be,"isRecord");function we(e,u){if(!be(e)||!Array.isArray(e.tools))return e;let g=e.tools,d=g.map(i=>!be(i)||i.type!=="function"||typeof i.name!="string"||!u.has(i.name)||i.strict!==void 0?i:{...i,strict:!1});return d.some((i,m)=>i!==g[m])?{...e,tools:d}:e}f(we,"preserveResponsesToolOmission");import{VERSION as qe}from"@earendil-works/pi-coding-agent";import{getCurrentTools as Ge}from"@earendil-works/pi-ai";function xe(e){let u=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e),g=[0,99,1],i=u?.slice(1,4).map(Number)?.map((m,h)=>m-(g[h]??0)).find(m=>m!==0)??0;if(u===null||i<0||i===0&&u[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(xe,"assertSupportedHost");async function Je(e){xe(qe);let u=pe(e),g=me(u.api),d=le(g.api);e.on("before_provider_request",(l,w)=>{if(w.model?.api!=="openai-responses")return;let p=new Set(e.getAllTools().filter(t=>t.namespace?.name.startsWith("ide_")).map(t=>t.name));return we(l.payload,p)}),e.on("session_start",(l,w)=>{let p=l.reason==="reload"?[]:Ge(w.sessionManager.getBranch().flatMap(t=>t.type==="message"?[t.message]:[])).map(t=>t.name);d.reconcile(!0,p)}),e.on("before_agent_start",l=>{d.reconcile();let w=l.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
+ `,""),p=e.getAllTools().filter(r=>r.exposure!=="hidden"),t=e.getActiveTools(),s=t.includes("tool_search")?"Use tool_search to find":t.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",n=p.filter(r=>r.namespace?.name==="ide_git").map(r=>r.name),o=[...n.length===0?[]:[`${s} ${n.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...p.some(r=>r.name==="debug"&&r.namespace?.name==="ide_debug")?[`${s} debug in ide_debug when creating a debugger session.`]:[]],a=o.length===0?w:`${w}
16
39
 
17
40
  <ide_discovery>
18
- ${r.join(`
41
+ ${o.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 a===l.systemPrompt?void 0:{systemPrompt:a}});let i=await ee(L()),m=de(e,{"pi-agent-ide-no-animations":i.noAnimations??!1,"pi-agent-ide-no-post-processing":i.noPostProcessing??!1,...i.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=B(M,i.preset??"full"),{enabled:v}=U(M,[...h,...i.disabled],i.enabled);for(let l of v)await l.register(d.api,{preferences:i.preferences??{}});u.finalize(),g.finalize()}f(Je,"registerUnifiedPiAgentIde");export{Je as default};
@@ -42,19 +42,19 @@ Use `separation: "blank-line"` for a separate paragraph or section; use default
42
42
 
43
43
  ## Writes and failures
44
44
 
45
+ 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.
46
+
45
47
  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
48
 
47
49
  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
50
 
49
51
  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
52
 
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.
53
+ 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
54
 
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.
55
+ 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
56
 
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.
57
+ After an interruption, read the affected files before retrying. Retry only unapplied edits.
58
58
 
59
59
  ## Specialized resources
60
60
 
@@ -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
 
package/docs/releases.md CHANGED
@@ -14,6 +14,10 @@ Squash-merging `develop` into `main` makes their histories diverge. The **Synchr
14
14
 
15
15
  See [Develop nightly](nightly.md). Nightlies test a pinned `develop` commit and keep an installable package and test reports in GitHub Actions for 30 days. They do not publish to npm.
16
16
 
17
+ ## Flaky debugger checks
18
+
19
+ Real debugger integration tests and adapter/platform jobs still run, but their results are non-blocking and kept outside the shared CI test totals and badges. They have separate jobs and reports marked flaky. A failed debugger job does not reject a release candidate. Pure debugger unit tests, other source/runtime checks, and editor tests remain blocking. In particular, Delete is not part of this exception.
20
+
17
21
  ## Start a release
18
22
 
19
23
  Choose a release cut by its full commit SHA. If that commit is not yet on main, promote it through a separate pinned branch such as `chore/promote-X.Y.Z`, not a PR whose head is the moving `develop` branch. Keep that promotion head unchanged while CI runs. New develop merges do not join the release unless its scope is explicitly changed. After promotion and main-to-develop synchronization succeed, start the versioned release below. See `.pi/skills/publish-pi-agent-ide/SKILL.md` for the agent runbook.
@@ -2,6 +2,8 @@
2
2
 
3
3
  This records the original batching decision. LPT-403 later removed Apply without changing the native batching policy.
4
4
 
5
+ LPT-439 later made Write immediate: pending edits commit before Write, and Write saves and finishes its post-edit processing before returning. If an existing file already matches the supplied content, Write returns its whole-file selection without writing or running post-edit handlers. A missing empty file is still created. Write does not join the pending batch. The policy below still applies to other eligible text edits.
6
+
5
7
  ## Question
6
8
 
7
9
  Should sequential editor calls in native Codemode share only original coordinates, or also one combined write, and where should that batch end?
@@ -31,7 +31,7 @@ Read-only views, raw bytes, images and directory listings do not acquire text-ed
31
31
 
32
32
  ## Internal records
33
33
 
34
- Each tool owns its validated record. Read, Search, Select, Diff, terminals, Git and debugger operations keep their own domain adapters. File edit receipts contain only operation, observed effect, file states and an optional verified selection handle. Delete omits selection fields. Flush separately records committed operation effects and errors; it does not reuse a giant resource-action schema.
34
+ Each tool owns its validated record. Read, Search, Select, Diff, terminals, Git and debugger operations keep their own domain adapters. File edit receipts contain only operation, observed effect, file states and an optional verified selection handle. Delete omits selection fields. The parent Codemode result retains committed operation effects and errors.
35
35
 
36
36
  The text registry stores only ownership, a digest of the issued text, source references, resource identities and whether the result can be consumed. It does not copy line arrays, removed file contents, image bytes or debugger records into a second ledger. Source ranges and snapshots remain in the source-target store.
37
37
 
@@ -44,7 +44,7 @@ Read's private native record contains image type and MIME metadata, not another
44
44
 
45
45
  Failed tools reject in Codemode. Use try/catch or Promise.allSettled when independent calls may fail. Inspect the readable file/operation effects and final parent result before retrying. An error does not prove rollback.
46
46
 
47
- Flush commits writes, not final formatting. Final post-edit processing can retire earlier snapshots. Ordinary script errors keep accepted edits; abort/deadline discards pending writes, not already committed batches.
47
+ Automatic batch boundaries save pending edits, not their final formatting. Write finishes its own post-edit processing before returning. Final post-edit processing can retire earlier snapshots. Ordinary script errors keep accepted edits; abort/deadline discards pending writes, not already committed batches.
48
48
 
49
49
  After an exact-text selector fails, the tool returns current anchors and blocks further exact-text edits for that file. Use a current anchor for the next successful edit. Exact text is then available again.
50
50
 
package/docs/tools.md CHANGED
@@ -6,7 +6,15 @@ The project is experimental. The behavior below describes the current implementa
6
6
 
7
7
  ## Readable results and composition
8
8
 
9
- IDE tools return readable text in direct calls and Codemode. A leading system-result envelope carries a registered UUID; it is not file content. Pass the unchanged result to another source parameter, or use its UUID in a direct call. The system resolves the private source records. Check the readable file effects before retrying failed edits. See [IDE result composition](./structured-results.md) for reference lifetime and `tools.flush({})`.
9
+ IDE tools return readable text in direct calls and Codemode. A leading system-result envelope carries a registered UUID; it is not file content. Pass the unchanged result to another source parameter, or use its UUID in a direct call. The system resolves the private source records. Check the readable file effects before retrying failed edits. See [IDE result composition](./structured-results.md) for reference lifetime and automatic commit boundaries.
10
+
11
+ ## Shared output limits
12
+
13
+ Every IDE tool, including nested calls and the combined Codemode result, shares a useful-text limit of 50 KiB or 2,000 lines. Images share a limit of 20 frames, 4,000,000 pixels and 20 MiB of image bytes per result. Notices, guides and composition references are added afterward and are not part of these budgets.
14
+
15
+ When the shared text limit truncates a result, the complete useful text is saved to a private temporary file. The result names that file. Use Read with `offset` and `limit` to continue, or `raw:` byte windows for a line that is too large. The file is removed when its owning runtime is disposed. Media is resized or omitted, not archived.
16
+
17
+ An explicit request limit still selects what the tool produces; the saved file does not undo that filter. Truncation does not shorten private source selections or change file-edit effects. Terminal results also link to their complete session log.
10
18
 
11
19
  ## Resource references
12
20
 
@@ -38,7 +46,7 @@ A source field such as `path` or mutation `target` is therefore a resource field
38
46
  - AST-aware code views;
39
47
  - LSP diagnostics, symbols, references, and call graphs.
40
48
 
41
- A read result may include anchors, diagnostics, Git changes, or structural markers. Large text results are bounded, and supported resolvers can retain the complete output in a temporary resource.
49
+ A read result may include anchors, diagnostics, Git changes, or structural markers. Large text results are bounded. The shared limiter retains complete truncated text in a temporary file.
42
50
 
43
51
  Read sources are not assumed to be writable. The read and text-editor cores keep separate resolver registries so a derived view cannot be edited by accident.
44
52
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-doctor",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-documentation",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-image": "0.7.1",
10
- "pi-agent-invariant": "0.7.1",
11
- "pi-agent-read": "0.7.1",
12
- "pi-agent-resource": "0.7.1",
13
- "pi-agent-text": "0.7.1",
14
- "pi-agent-text-editor": "0.7.1"
9
+ "pi-agent-image": "0.7.2",
10
+ "pi-agent-invariant": "0.7.2",
11
+ "pi-agent-read": "0.7.2",
12
+ "pi-agent-resource": "0.7.2",
13
+ "pi-agent-text": "0.7.2",
14
+ "pi-agent-text-editor": "0.7.2"
15
15
  },
16
16
  "pi": {
17
17
  "extensions": [
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem-image",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#extension": "./index.ts"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-image": "0.7.1",
10
- "pi-agent-resource": "0.7.1"
9
+ "pi-agent-image": "0.7.2",
10
+ "pi-agent-resource": "0.7.2"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [