pi-agent-ide 0.7.0 → 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 (323) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/chunk-6U5OU77O.js +3 -0
  3. package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
  4. package/dist/chunk-EURHXLN3.js +2 -0
  5. package/dist/{chunk-PYPPV2F5.js → chunk-F6IWZKOG.js} +6 -6
  6. package/dist/{chunk-GBLKIB6O.js → chunk-H445SHSJ.js} +2 -2
  7. package/dist/chunk-IG56UGSO.js +2 -0
  8. package/dist/chunk-IICJXZBU.js +6 -0
  9. package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
  10. package/dist/{chunk-YRF7OATP.js → chunk-KOVPDKSJ.js} +1 -1
  11. package/dist/chunk-MXLSGMRZ.js +3 -0
  12. package/dist/chunk-NRZO5KJT.js +9 -0
  13. package/dist/chunk-OB46OPMZ.js +1 -0
  14. package/dist/chunk-PKSQT6TC.js +1 -0
  15. package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
  16. package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
  17. package/dist/chunk-QUYXINGZ.js +7 -0
  18. package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
  19. package/dist/chunk-SBP3ABH4.js +5 -0
  20. package/dist/{chunk-FXNKMNSJ.js → chunk-SJ4UZ4GU.js} +1 -1
  21. package/dist/chunk-SNF7PDDX.js +11 -0
  22. package/dist/{chunk-AJRIASPQ.js → chunk-STBJO3Z3.js} +1 -1
  23. package/dist/{chunk-3HYXQ4YA.js → chunk-TQGE7RH6.js} +13 -13
  24. package/dist/{chunk-S5LXX32D.js → chunk-XDG7EQRN.js} +3 -3
  25. package/dist/{chunk-F5YZG77W.js → chunk-XH5WN5XA.js} +1 -1
  26. package/dist/chunk-YWQS33DF.js +1 -0
  27. package/dist/chunk-ZIWPKIBZ.js +1 -0
  28. package/dist/entry-11.js +1 -1
  29. package/dist/entry-13.js +1 -1
  30. package/dist/entry-14.js +1 -1
  31. package/dist/entry-15.js +1 -1
  32. package/dist/entry-17.js +1 -1
  33. package/dist/entry-25.js +2 -2
  34. package/dist/entry-26.js +1 -1
  35. package/dist/entry-27.js +2 -2
  36. package/dist/entry-28.js +1 -1
  37. package/dist/entry-29.js +1 -1
  38. package/dist/entry-31.js +15 -13
  39. package/dist/entry-33.js +2 -1
  40. package/dist/entry-37.js +6 -6
  41. package/dist/entry-41.js +1 -1
  42. package/dist/entry-42.js +1 -1
  43. package/dist/entry-43.js +1 -1
  44. package/dist/entry-44.js +1 -1
  45. package/dist/entry-45.js +20 -13
  46. package/dist/entry-46.js +1 -1
  47. package/dist/entry-49.js +1 -1
  48. package/dist/entry-50.js +1 -1
  49. package/dist/entry-51.js +8 -7
  50. package/dist/entry-52.js +1 -1
  51. package/dist/entry-53.js +1 -1
  52. package/dist/entry-54.js +1 -1
  53. package/dist/entry-56.js +1 -1
  54. package/dist/entry-57.js +1 -1
  55. package/dist/entry-58.js +1 -1
  56. package/dist/entry-60.js +1 -1
  57. package/dist/entry-62.js +1 -1
  58. package/dist/entry-65.js +1 -1
  59. package/dist/entry-66.js +1 -1
  60. package/dist/entry-68.js +1 -1
  61. package/dist/entry-70.js +1 -1
  62. package/dist/entry-75.js +1 -1
  63. package/dist/entry-77.js +51 -43
  64. package/dist/entry-78.js +14 -14
  65. package/dist/entry-79.js +1 -1
  66. package/dist/entry-80.js +1 -1
  67. package/dist/entry-82.js +5 -5
  68. package/dist/entry-83.js +1 -1
  69. package/dist/entry-84.js +1 -1
  70. package/dist/entry-85.js +1 -1
  71. package/dist/entry-86.js +1 -1
  72. package/dist/pi-agent-ide.js +37 -9
  73. package/docs/agent-guides/editing.md +35 -46
  74. package/docs/agent-guides/git-changes.md +10 -0
  75. package/docs/agent-guides/read-resources.md +9 -50
  76. package/docs/agent-guides/search-code.md +18 -17
  77. package/docs/agent-guides/select-code.md +62 -140
  78. package/docs/agent-guides/terminal.md +9 -1
  79. package/docs/configuration.md +1 -1
  80. package/docs/releases.md +4 -0
  81. package/docs/research/native-codemode-batch-decision.md +2 -0
  82. package/docs/structured-results.md +27 -62
  83. package/docs/tools.md +15 -11
  84. package/node_modules/pi-agent-doctor/package.json +1 -1
  85. package/node_modules/pi-agent-documentation/package.json +1 -1
  86. package/node_modules/pi-agent-filesystem/index.ts +7 -6
  87. package/node_modules/pi-agent-filesystem/package.json +7 -7
  88. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  89. package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
  90. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  91. package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
  92. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  93. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  94. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  95. package/node_modules/pi-agent-ide-ast/src/extension.ts +5 -4
  96. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  97. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +35 -9
  98. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +1 -1
  99. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +10 -8
  100. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +28 -3
  101. package/node_modules/pi-agent-ide-changes/index.ts +4 -3
  102. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  103. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  104. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  105. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  106. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  107. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  108. package/node_modules/pi-agent-ide-lsp/index.ts +3 -3
  109. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  110. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
  111. package/node_modules/pi-agent-image/package.json +2 -2
  112. package/node_modules/pi-agent-invariant/package.json +1 -1
  113. package/node_modules/pi-agent-pdf/package.json +2 -2
  114. package/node_modules/pi-agent-read/package.json +7 -7
  115. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  116. package/node_modules/pi-agent-read/src/api/read-parameters.ts +38 -1
  117. package/node_modules/pi-agent-read/src/api/tools/read.ts +18 -1
  118. package/node_modules/pi-agent-read/src/core/extension.ts +8 -2
  119. package/node_modules/pi-agent-read/src/core/read-core.ts +54 -35
  120. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  121. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  122. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  123. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  124. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
  125. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +108 -46
  126. package/node_modules/pi-agent-resource/package.json +1 -1
  127. package/node_modules/pi-agent-resource/src/index.ts +1 -0
  128. package/node_modules/pi-agent-resource/src/result-targets.ts +186 -9
  129. package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
  130. package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
  131. package/node_modules/pi-agent-search/package.json +5 -5
  132. package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
  133. package/node_modules/pi-agent-search/src/api/search-parameters.ts +3 -3
  134. package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
  135. package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
  136. package/node_modules/pi-agent-search-text/index.ts +1 -1
  137. package/node_modules/pi-agent-search-text/package.json +7 -7
  138. package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
  139. package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
  140. package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
  141. package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
  142. package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
  143. package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
  144. package/node_modules/pi-agent-text/package.json +2 -2
  145. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  146. package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
  147. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  148. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
  149. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
  150. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  151. package/node_modules/pi-agent-text-editor/package.json +9 -9
  152. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  153. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
  154. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  155. package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  156. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  157. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  158. package/node_modules/pi-agent-text-editor/src/core/extension.ts +10 -3
  159. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +3 -13
  160. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  161. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  162. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  163. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
  164. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  165. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
  166. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  167. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +49 -214
  168. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  169. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  170. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  171. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  172. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
  173. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
  174. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
  175. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
  176. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  177. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  178. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
  179. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  180. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  181. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  182. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  183. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  184. package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  185. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
  186. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  187. package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
  188. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  189. package/node_modules/pi-agent-web/index.ts +4 -3
  190. package/node_modules/pi-agent-web/package.json +7 -7
  191. package/node_modules/pi-agent-web/src/resolver.ts +11 -13
  192. package/node_modules/pi-agent-web-html/package.json +2 -2
  193. package/node_modules/pi-agent-web-image/package.json +3 -3
  194. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  195. package/node_modules/pi-agent-web-text/package.json +3 -3
  196. package/package.json +35 -35
  197. package/src/composite/nested-tool-rendering.ts +64 -6
  198. package/src/composite/output-limits.ts +125 -0
  199. package/src/composite/responses-tools.ts +25 -0
  200. package/src/composite/text-results.ts +372 -0
  201. package/src/documentation/extension.ts +11 -9
  202. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
  203. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  204. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  205. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
  206. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  207. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
  208. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  209. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  210. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +4 -3
  211. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  212. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  213. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  214. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  215. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  216. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
  217. package/src/extensions/pi-agent-read/package.json +7 -7
  218. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  219. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +38 -1
  220. package/src/extensions/pi-agent-read/src/api/tools/read.ts +18 -1
  221. package/src/extensions/pi-agent-read/src/core/extension.ts +8 -2
  222. package/src/extensions/pi-agent-read/src/core/read-core.ts +54 -35
  223. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  224. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  225. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  226. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  227. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
  228. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +108 -46
  229. package/src/extensions/pi-agent-search/package.json +5 -5
  230. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
  231. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
  232. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
  233. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
  234. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
  235. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
  236. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
  237. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
  238. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
  239. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +3 -3
  240. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
  241. package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
  242. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  243. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  244. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
  245. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  246. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
  247. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
  248. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  249. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  250. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  251. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  252. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  253. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
  254. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  255. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
  256. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  257. package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  258. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  259. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  260. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +10 -3
  261. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +3 -13
  262. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  263. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  264. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  265. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
  266. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  267. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
  268. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  269. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +49 -214
  270. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  271. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  272. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  273. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  274. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
  275. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
  276. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
  277. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
  278. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  279. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  280. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
  281. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  282. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  283. package/src/pi-agent-ide.ts +15 -1
  284. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  285. package/src/plugins/pi-agent-ide-ast/src/extension.ts +5 -4
  286. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  287. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +35 -9
  288. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +1 -1
  289. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +10 -8
  290. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +28 -3
  291. package/src/plugins/pi-agent-ide-changes/index.ts +4 -3
  292. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  293. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  294. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  295. package/src/plugins/pi-agent-ide-debugger/index.ts +22 -10
  296. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
  297. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
  298. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +6 -3
  299. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  300. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  301. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  302. package/src/plugins/pi-agent-ide-lsp/index.ts +3 -3
  303. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  304. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
  305. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
  306. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
  307. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
  308. package/src/plugins/pi-agent-ide-vision/index.ts +13 -4
  309. package/src/post-edit/gate.ts +13 -2
  310. package/dist/chunk-3JO7QFIL.js +0 -1
  311. package/dist/chunk-4NIFBFFR.js +0 -11
  312. package/dist/chunk-64M3SQPG.js +0 -3
  313. package/dist/chunk-7LZKOHH2.js +0 -1
  314. package/dist/chunk-EAZGN5ND.js +0 -7
  315. package/dist/chunk-FK42RSF4.js +0 -1
  316. package/dist/chunk-KBP3QUDT.js +0 -2
  317. package/dist/chunk-KR36BT5E.js +0 -1
  318. package/dist/chunk-MBUXFKIW.js +0 -3
  319. package/dist/chunk-OE7QVAI2.js +0 -5
  320. package/dist/chunk-SILJ3OL4.js +0 -9
  321. package/dist/chunk-SQKAXYIR.js +0 -2
  322. package/dist/chunk-VCGNVTXQ.js +0 -1
  323. package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
@@ -1,15 +1,43 @@
1
- import{a as B,b as _,c as $,d as V,e as X,f as M}from"./chunk-W7CASEO3.js";import{f as W}from"./chunk-XYS4FSCC.js";import{a as z}from"./chunk-YGGKGZO2.js";import"./chunk-EAZGN5ND.js";import"./chunk-VCGNVTXQ.js";import"./chunk-SQKAXYIR.js";import"./chunk-ZC65Z3CK.js";import{a as l}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=[b("ide.core",()=>import("./chunk-PYPPV2F5.js")),b("ide.tips",()=>import("./chunk-BMOJTJJJ.js")),b("ide.doctor",()=>import("./chunk-5JELU6RV.js")),b("ide.languages",()=>import("./entry-35.js"),["ide.doctor"]),b("read.core",()=>import("./entry-45.js")),b("ide.documentation",()=>import("./chunk-SILJ3OL4.js"),["read.core"]),b("read.filesystem",()=>import("./entry-25.js"),["read.core","editor.core"]),b("read.filesystem.jq",()=>import("./entry-27.js"),["read.filesystem","ide.documentation","ide.doctor"]),b("read.filesystem.image",()=>import("./entry-26.js"),["read.filesystem"]),b("read.filesystem.pdf",()=>import("./entry-28.js"),["read.filesystem"]),b("read.filesystem.text",()=>import("./entry-29.js"),["read.filesystem"]),b("read.web",()=>import("./entry-82.js"),["read.core"]),b("read.web.html",()=>import("./entry-83.js"),["read.web"]),b("read.web.image",()=>import("./entry-84.js"),["read.web"]),b("read.web.pdf",()=>import("./entry-85.js"),["read.web"]),b("read.web.text",()=>import("./entry-86.js"),["read.web"]),b("search.core",()=>import("./entry-50.js")),b("search.text",()=>import("./entry-51.js"),["search.core"]),b("editor.renderer",()=>import("./entry-78.js"),["editor.core"]),b("editor.core",()=>import("./entry-77.js")),b("editor.anchor.constant",()=>import("./entry-56.js"),["read.core","editor.core"]),b("editor.anchor.line-hash",()=>import("./entry-60.js"),["read.core","editor.core"]),b("editor.anchor.exact",()=>import("./entry-58.js"),["editor.core"]),b("editor.stale-anchor",()=>import("./entry-79.js"),["editor.core"]),b("ide.ast",()=>import("./entry-31.js"),["ide.core","read.core","search.core","editor.core"]),b("ide.formatter",()=>import("./entry-34.js"),["ide.core"]),b("ide.lint",()=>import("./entry-36.js"),["ide.core"]),b("ide.changes",()=>import("./entry-33.js"),["ide.core","read.core","editor.core"]),b("ide.lsp",()=>import("./entry-37.js"),["ide.core","read.core","search.core"]),b("ide.processes",()=>import("./chunk-S6QRG3TQ.js")),b("ide.vision",()=>import("./chunk-OE7QVAI2.js"),["ide.processes","read.core","search.core"]),b("ide.debugger",()=>import("./chunk-3HYXQ4YA.js"),["ide.processes","read.core","editor.core"]),b("ide.terminal",()=>import("./chunk-S5LXX32D.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),b("ide.diagnostics",()=>import("./chunk-KBP3QUDT.js"),["ide.core","read.core"])];function b(i,m,u=[],d=!0){return{id:i,name:L[i][0],description:L[i][1],dependencies:u,async register(r,f){await(await m()).default(r,f)},...d?{}:{defaultEnabled:!1}}}l(b,"builtin");function F(i,m,u){return{kind:"choice",id:i,name:m,description:u,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}l(F,"presentationPreference");var H=[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 O(i,m,u=[]){let d=new Map;for(let a of i){if(d.has(a.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${a.id}`);d.set(a.id,a)}for(let a of i)for(let w of a.dependencies)if(!d.has(w))throw new Error(`Pi Agent IDE extension ${a.id} has unknown dependency ${w}`);let r=new Set;for(let a of m)d.has(a)&&r.add(a);for(let a of u)if(!d.has(a))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${a}`);let f=le(d,u,r),p=new Set;for(let a of i)(a.defaultEnabled===!1&&!f.has(a.id)||r.has(a.id))&&p.add(a.id);let y=!0;for(;y;){y=!1;for(let a of i)p.has(a.id)||a.dependencies.every(w=>!p.has(w))||(p.add(a.id),y=!0)}return{enabled:i.filter(a=>!p.has(a.id)),disabled:p}}l(O,"selectBuiltinExtensions");function le(i,m,u){let d=new Set,r=[...m];for(;r.length>0;){let f=r.pop();if(!(d.has(f)||u.has(f))){d.add(f);for(let p of i.get(f)?.dependencies??[])d.has(p)||r.push(p)}}return d}l(le,"collectForcedOn");import{Input as be}from"@earendil-works/pi-tui";import{mkdir as ce,readFile as ue,writeFile as fe}from"node:fs/promises";import pe from"node:path";import{withFileMutationQueue as ge}from"@earendil-works/pi-coding-agent";async function Y(i,m,u=new Map,d=new Map,r){await ge(i,async()=>{let f=await M(i),p={};try{p=JSON.parse(await ue(i,"utf8"))}catch(t){if(!(t instanceof Error&&"code"in t&&t.code==="ENOENT"))throw t}let y=new Set(f.disabled),a=new Set(f.enabled);for(let[t,e]of m)y.delete(t),a.delete(t),e==="disabled"&&y.add(t),e==="enabled"&&a.add(t);let w={...f.preferences};for(let[t,e]of d)e===void 0?delete w[t]:w[t]=e;let o={...f.flags};for(let[t,e]of u)t==="pi-agent-ide-no-animations"&&delete p.noAnimations,t==="pi-agent-ide-no-post-processing"&&delete p.noPostProcessing,e===void 0?delete o[t]:o[t]=e;await ce(pe.dirname(i),{recursive:!0}),await fe(i,`${JSON.stringify({...p,disabled:[...y],enabled:[...a],...r===void 0?{}:{preset:r},...u.size>0?{flags:o}:{},...d.size>0?{preferences:w}:{}},null,2)}
2
- `)})}l(Y,"saveModuleChoices");import{getSettingsListTheme as me}from"@earendil-works/pi-coding-agent";import{matchesKey as j,SettingsList as he,truncateToWidth as K,visibleWidth as Q}from"@earendil-works/pi-tui";function Z(i,m,u,d,r=""){let f=["extensions","behavior","ui"],p="extensions",y=l(n=>n==="extensions"?"modules":n==="behavior"?"features":"ui","itemKey"),a=l(n=>n==="extensions"?"modules":n==="behavior"?"features":"ui","changeKey"),w=l(()=>{let n=y(p),s=m()[n]??[];return new he(s,12,me(),(h,E)=>{u(a(p),h,E);for(let T of m()[n]??[]){let A=s.find(v=>v.id===T.id);A&&Object.assign(A,T)}},()=>d(!1),{enableSearch:!0})},"createList"),o=w(),t=l(n=>i.fg("borderMuted",n),"border"),e=l((n,s)=>{if(s<=1)return t("\u2502");let h=s-2,E=K(n,h);return`${t("\u2502")}${E}${" ".repeat(Math.max(0,h-Q(E)))}${t("\u2502")}`},"row"),c=l(n=>t(n<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,n-2))}\u2524`),"rule");return{render(n){let s=Math.max(1,n),h=Math.max(1,s-4),E=` Agent IDE settings${r?` \xB7 ${r}`:""} `,T=s<=1?t("\u256D"):`${t("\u256D\u2500")}${i.fg("accent",i.bold(K(E,Math.max(0,s-3),"")))}${t(`${"\u2500".repeat(Math.max(0,s-Q(E)-3))}\u256E`)}`,A={extensions:"Features",behavior:"Behavior",ui:"UI"},v=f.map(I=>I===p?i.fg("accent",i.bold(`[ ${A[I]} ]`)):i.fg("dim",` ${A[I]} `)).join(" "),S=o.render(h).map(I=>e(` ${I} `,s)),P=i.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[T,e(` ${v} `,s),c(s),...S,c(s),e(P,s),t(s<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,s-2))}\u256F`)]},invalidate(){o.invalidate()},handleInput(n){j(n,"tab")||j(n,"shift+tab")?(p=f[(f.indexOf(p)+(j(n,"shift+tab")?2:1))%f.length]??"extensions",o=w()):j(n,"ctrl+s")?d(!0):o.handleInput(n)}}}l(Z,"createSettingsPanel");function ee(i,m=[],u=[]){i.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(d,r){if(r.hasUI)try{let f=await r.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(f===void 0)return;let p=$(process.env,void 0,r.cwd),y=f==="Project"?p.projectPath:p.globalPath,a=await M(y),w=await M(f==="Project"?p.globalPath:p.projectPath),o=new Map,t=new Map,e=new Map,c;if(!await r.ui.custom((s,h,E,T)=>{let A=Z(h,()=>{let v=new Set(a.disabled),S=new Set(a.enabled);for(let[x,g]of o)v.delete(x),S.delete(x),g==="disabled"&&v.add(x),g==="enabled"&&S.add(x);let P=O(R,[..._(R,c??a.preset??"full"),...v,..._(R,w.preset??"full"),...w.disabled],[...S,...w.enabled]);return{modules:R.map(x=>({id:x.id,label:x.name??x.id,description:`${x.description??""} Effective: ${P.disabled.has(x.id)?"off":"on"}.${w.disabled.includes(x.id)?" Disabled in the other scope.":x.dependencies.some(g=>P.disabled.has(g))?" A dependency is disabled.":""}`,currentValue:o.get(x.id)??(a.disabled.includes(x.id)?"disabled":a.enabled.includes(x.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[I(),...q("features"),...D("features")],ui:[...q("ui"),...D("ui")]};function I(){let x=c??a.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:B.find(g=>g.value===x)?.label??x,values:B.map(g=>g.label)}}function D(x){return u.filter(g=>g.group===x).map(g=>{let k=e.has(g.id)?e.get(g.id):a.preferences?.[g.id];return{id:g.id,label:g.name,description:`${g.description} Default: ${g.kind==="choice"?g.values.find(C=>C.value===g.default)?.label??g.default:g.default||"empty"}.`,currentValue:k===void 0?"default":g.kind==="choice"?g.values.find(C=>C.value===k)?.label??k:k,...g.kind==="choice"?{values:["default",...g.values.map(C=>C.label)]}:{submenu:l((C,G)=>{let N=new be,J=C==="default"?g.default:C;return J.length>0&&N.handleInput(J),N.focused=!0,N.onSubmit=de=>G(de),N.onEscape=()=>G(),N},"submenu")}}})}function q(x){return m.filter(g=>(g.group??"features")===x).map(g=>{let k=t.has(g.id)?t.get(g.id):X(a)[g.id];return{id:g.id,label:g.name,description:g.description,currentValue:k===void 0?"default":k?g.labels?.on??"enabled":g.labels?.off??"disabled",values:["default",g.labels?.off??"disabled",g.labels?.on??"enabled"]}})}},(v,S,P)=>{if(v==="modules")o.set(S,P);else if(S==="preset")c=B.find(I=>I.label===P)?.value;else if(u.some(I=>I.id===S)){let I=u.find(D=>D.id===S);e.set(S,P==="default"||P.length===0?void 0:I?.kind==="choice"?I.values.find(D=>D.label===P)?.value:P)}else t.set(S,P==="default"?void 0:P===(m.find(I=>I.id===S)?.labels?.on??"enabled"))},T,f);return{render:l(v=>A.render(v),"render"),invalidate:l(()=>A.invalidate(),"invalidate"),handleInput(v){A.handleInput(v),s.requestRender()}}})||o.size+t.size+e.size+(c===void 0?0:1)===0)return;if(await Y(y,o,t,e,c),r.ui.notify(`Saved ${f.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await r.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await r.reload();return}}catch(f){r.ui.notify(f instanceof Error?f.message:String(f),"error")}}})}l(ee,"registerModuleSettings");function te(i,m){let u=[];return{definitions:u,register(d){if(u.some(r=>r.id===d.id))throw new Error(`Duplicate feature flag: ${d.id}`);u.push(d),i.registerFlag(d.id,{type:"boolean",description:d.description,default:m[d.id]??d.default})}}}l(te,"createFeatureFlags");function ne(i){let m=new Map,u=new Set;return{api:{...i,registerTool:l(r=>{r.namespace?.name.startsWith("ide_")===!0&&m.set(r.name,{hide:l(()=>i.registerTool({...r,get description(){return r.description},get promptGuidelines(){return r.promptGuidelines},exposure:"hidden"}),"hide"),restore:l(()=>i.registerTool(r),"restore")}),u.has(r.name)?m.get(r.name)?.hide():i.registerTool(r)},"registerTool")},reconcile(r=!1,f=[]){let p=new Set,y=new Set;for(let e of i.getSettings().defaultTools??[])if(e.startsWith("-"))p.add(e.slice(1)),y.delete(e.slice(1));else{let c=e.startsWith("+")?e.slice(1):e;p.delete(c),y.add(c)}for(let[e,c]of m)p.has(e)!==u.has(e)&&(p.has(e)?(c.hide(),u.add(e)):(c.restore(),u.delete(e)));let a=i.getAllTools().filter(e=>e.exposure!=="hidden"),w=new Set(i.getActiveTools());for(let e of a)r&&m.has(e.name)&&(y.has(e.name)||e.exposure==="deferred"&&f.includes(e.name))&&w.add(e.name);r&&!p.has("tool_search")&&a.some(e=>e.name==="tool_search")&&a.some(e=>m.has(e.name)&&e.exposure==="deferred")&&w.add("tool_search");let o=i.getActiveTools(),t=[...w].filter(e=>!u.has(e));(t.length!==o.length||t.some(e=>!o.includes(e)))&&i.setActiveTools(t)}}}l(ne,"createIdeToolAvailability");import{ToolExecutionComponent as ie}from"@earendil-works/pi-coding-agent";import{Container as ye,Spacer as we,Text as oe}from"@earendil-works/pi-tui";var U="ide-nested-results",xe=256,se=512*1024,Ee=8*1024,ve=32*1024;function re(i){let m=new Map,u=new Map,d=new Map,r,f=new WeakMap,p=l((o,t,e)=>{t.result=e;try{let n=JSON.stringify(o);if(Buffer.byteLength(n)<=se){t.result=JSON.parse(JSON.stringify(e));return}}catch{}let c=e.details&&typeof e.details=="object"?Object.entries(e.details).filter(([n,s])=>(n==="source"||n==="fullOutputPath")&&typeof s=="string").map(([n,s])=>`${n}: ${String(s)}`):[];t.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...c].join(`
3
- `)}],details:void 0,isError:e.isError},t.omitted=!0,o.complete=!1},"retainResult"),y=l(()=>{u.clear(),d.clear()},"clear");i.on("session_start",(o,t)=>{y(),t.mode==="tui"&&t.ui.setWidget(U,e=>(r=e,{render:l(()=>[],"render"),invalidate:l(()=>{},"invalidate")}))}),i.on("session_tree",y),i.on("session_shutdown",y),i.on("tool_execution_start",(o,t)=>{if(o.parentToolCallId===void 0)return;let e=u.get(o.parentToolCallId)??o.parentToolCallId;if(u.set(o.toolCallId,e),o.toolName==="flush"||!m.has(o.toolName))return;let c=d.get(e);if(c||(c={parentToolCallId:e,cwd:t.cwd,calls:[],complete:!0},d.set(e,c)),c.calls.length>=xe){c.complete=!1;return}let n=JSON.stringify(o.args),s=ve-c.calls.reduce((A,v)=>A+Buffer.byteLength(JSON.stringify(v.args)),0),h=Buffer.byteLength(n)>Math.min(Ee,s),E=h?Object.fromEntries(Object.entries(o.args).map(([A,v])=>[A,typeof v=="string"?v.slice(0,200)+(v.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(n),T=Buffer.byteLength(JSON.stringify(E))<=s?E:{};c.calls.push({id:o.toolCallId,name:o.toolName,args:T}),h&&(c.complete=!1)}),i.on("tool_execution_end",o=>{let t=u.get(o.toolCallId);if(t===void 0)return;u.delete(o.toolCallId);let e=d.get(t),c=e?.calls.find(n=>n.id===o.toolCallId);if(e&&c){let n=o.result;p(e,c,{content:n.content.filter(s=>s.type!=="text"||!s.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:n.details,isError:o.isError})}}),i.on("message_end",o=>{if(o.message.role!=="toolResult")return;let t=d.get(o.message.toolCallId);if(!t)return;d.delete(o.message.toolCallId);for(let[n,s]of u)s===t.parentToolCallId&&u.delete(n);let e={...t,calls:[],complete:t.complete},c=0;for(let n of t.calls){if(n.batched)continue;let s=JSON.stringify(n);if(c+=Buffer.byteLength(s),c>se){e.complete=!1;break}e.calls.push(JSON.parse(s)),n.result||(e.complete=!1)}i.appendEntry(U,e)}),i.registerEntryRenderer(U,l(function o(t,e,c){if(!Array.isArray(t.data?.calls))return;if(!r)return{render:l(h=>r?o(t,e,c)?.render(h)??[]:[],"render"),invalidate:l(()=>{t.data&&f.get(t.data)?.invalidate()},"invalidate")};let n=f.get(t.data);if(!n){n=new ye;for(let h of t.data.calls){let E=new ie(h.name,h.id,h.renderArgs??h.args,{showImages:!0},h.omitted||!h.result?void 0:m.get(h.name),r,t.data.cwd);h.result?E.updateResult(h.result):E.updateResult({content:[{type:"text",text:"Result unavailable; history is incomplete."}],isError:!0}),n.addChild(new we(1)),n.addChild(E)}t.data.complete||n.addChild(new oe(c.fg("warning","Incomplete nested IDE presentation; some results were not retained."),0,0)),f.set(t.data,n)}let s=n.children.at(-1);!t.data.complete&&s instanceof oe&&s.setText(c.fg("warning","Incomplete nested IDE presentation; some results were not retained."));for(let h of n.children)h instanceof ie&&h.setExpanded(e.expanded);return n},"renderEntry"));let a=l(()=>{i.events.on(z,o=>{let t=o,e=d.get(t.parentToolCallId);if(!e)return;let c=W(t.result.details);for(let n of t.calls){let s=e.calls.find(h=>h.id===n);s&&(s.batched=n!==t.calls.at(-1),s.batched?s.result=void 0:(new Set(c.mutationRender?.map(h=>h.path)).size>1&&(s.renderArgs={}),p(e,s,{content:t.result.content,details:c,isError:t.result.isError===!0})))}}),i.on("tool_result",o=>{let t=o.details,e=d.get(o.toolCallId);if(e&&t&&typeof t=="object"&&"editorBatchResults"in t&&Array.isArray(t.editorBatchResults))for(let c of t.editorBatchResults)for(let n of c.data?.operations??[]){let s=e.calls.find(E=>E.id===n.id);if(!s)continue;let h=n.errors.map(E=>E.message);(h.length>0||n.effect!=="applied")&&(s.batched=!1,delete s.renderArgs,p(e,s,{content:[{type:"text",text:`${s.name}: ${n.effect}.
8
- ${h.join(`
9
- `)}`}],details:void 0,isError:h.length>0||n.effect==="unknown"}))}})},"finalize");return{api:{...i,registerTool:l(o=>{m.set(o.name,o),i.registerTool(o)},"registerTool")},finalize:a}}l(re,"createNestedIdeRendering");import{VERSION as Ie}from"@earendil-works/pi-coding-agent";import{getCurrentTools as Ae}from"@earendil-works/pi-ai";function ae(i){let m=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(i),u=[0,99,1],r=m?.slice(1,4).map(Number)?.map((f,p)=>f-(u[p]??0)).find(f=>f!==0)??0;if(m===null||r<0||r===0&&m[4]!==void 0)throw new Error(`Pi Agent IDE requires Pi 0.99.1 or newer; this host is ${i}. Update Pi before loading the extension.`)}l(ae,"assertSupportedHost");async function Se(i){ae(Ie);let m=re(i),u=ne(m.api);i.on("session_start",(y,a)=>{let w=y.reason==="reload"?[]:Ae(a.sessionManager.getBranch().flatMap(o=>o.type==="message"?[o.message]:[])).map(o=>o.name);u.reconcile(!0,w)}),i.on("before_agent_start",y=>{u.reconcile();let a=y.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
10
- `,""),w=i.getAllTools().filter(s=>s.exposure!=="hidden"),o=i.getActiveTools(),t=o.includes("tool_search")?"Use tool_search to find":o.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",e=w.filter(s=>s.namespace?.name==="ide_git").map(s=>s.name),c=[...e.length===0?[]:[`${t} ${e.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...w.some(s=>s.name==="debug"&&s.namespace?.name==="ide_debug")?[`${t} debug in ide_debug when creating a debugger session.`]:[]],n=c.length===0?a:`${a}
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}
14
+
15
+ <ide_results>
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.
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}
11
39
 
12
40
  <ide_discovery>
13
- ${c.join(`
41
+ ${o.join(`
14
42
  `)}
15
- </ide_discovery>`;return n===y.systemPrompt?void 0:{systemPrompt:n}});let d=await V($()),r=te(i,{"pi-agent-ide-no-animations":d.noAnimations??!1,"pi-agent-ide-no-post-processing":d.noPostProcessing??!1,...d.flags});r.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),r.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}),r.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}),r.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}),r.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}),r.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}),r.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}),ee(i,r.definitions,H);let f=_(R,d.preset??"full"),{enabled:p}=O(R,[...f,...d.disabled],d.enabled);for(let y of p)await y.register(u.api,{preferences:d.preferences??{}});m.finalize()}l(Se,"registerUnifiedPiAgentIde");export{Se 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};
@@ -1,76 +1,65 @@
1
1
  # Precise text editing
2
2
 
3
- Use standalone `replace`, `insert`, `delete`, `copy`, and `move` whenever each intended change is known in advance and does not depend on another change. Submit several independent edits together as separate tool calls in one assistant response, whether they affect one file or several files.
3
+ Use standalone `replace`, `insert`, `delete`, `copy`, and `move` when each change is known in advance and does not depend on another change. Submit independent calls together in one response. Use native Codemode for computed or dependent composition; it does not add grouped rollback.
4
4
 
5
- Use native Codemode for computed or dependent tool composition. Call the same standalone tools and Select; Codemode does not add grouped rollback or change their source guards. Keep straightforward independent changes in one standalone batch.
5
+ Use `write` only to create a file or deliberately replace all its contents. Use `diff` for read-only comparison.
6
6
 
7
- Use `write` only to create a file or deliberately replace its complete contents. Use `diff` for read-only comparison.
8
-
9
- ## Selecting text
7
+ ## Select the intended text
10
8
 
11
9
  Use a returned anchor when it identifies the intended text. Otherwise use the smallest unique exact string.
12
10
 
13
- Supported selectors include:
14
-
15
- - `LINE#HASH` — one current source line returned by the `anchors` view.
16
- - `scope-begin-HASH` and `scope-end-HASH` — syntax-scope boundaries returned by the `ast` view.
17
- - `SEARCH#...:line` — the complete containing line of a search result.
18
- - `SEARCH#...:match` — only the exact search match.
19
- - `begin` and `end` — the first and last existing source lines.
20
- - A unique exact string — that text fragment itself.
21
-
22
- With an `end` selector, the operation covers complete lines from the first line containing `start` through the last line containing `end`, inclusive. Without `end`, an exact string targets only that fragment, while a line or structured anchor targets its selected line or range.
11
+ - `LINE#HASH` selects a current source line from the `anchors` view.
12
+ - `scope-begin-HASH` and `scope-end-HASH` mark syntax boundaries from the `ast` view.
13
+ - `SEARCH#...:line` selects a complete containing line; `SEARCH#...:match` selects the exact match.
14
+ - `begin` and `end` select the first and last existing lines.
15
+ - A unique exact string selects that fragment.
23
16
 
24
- Selections are revision-sensitive. Re-read after a mutation before reusing a single-file line, scope, or search anchor. Complete `SEARCH#...:all` selections can refresh their original query.
17
+ With `end`, the operation covers complete lines from the first line containing `start` through the last line containing `end`, inclusive. Without `end`, an exact string selects just that fragment.
25
18
 
26
- ## Editing returned targets
19
+ After an exact-text selector fails, exact-text edits are blocked for that file. Find the intended location among the returned current anchors, or use Read/Search for another section. Edit with its anchor. After that edit succeeds, exact text is available again. Do not retry a guessed string.
27
20
 
28
- Pass a source-aware result, its `data`, a `RESULT#` reference, or an array of returned matches to the supported input field. Omit the corresponding string selectors. An ordinary file Read target selects its requested whole-line window; a Read of a `RESULT#` target stays within the original exact scope. A Search target selects exact matches. Pass a filtered matches array to edit a subset, rather than changing a whole result's preview.
21
+ Re-read after a mutation before reusing line, scope, or individual Search anchors. Complete `SEARCH#...:all` selections retain their existing query-refresh behavior.
29
22
 
30
- - `replace.path` replaces exact ranges. `delete.path` removes exact ranges but keeps the file, even for a whole-file selection.
31
- - `write.path` and `undo.file` require one whole-file target. Partial and multi-file scopes are rejected, not widened.
32
- - `copy.path` / `move.path` select source ranges; `target` selects exact destination ranges. A zero-width destination inserts. Structured source/destination arrays pair in declared order with equal counts; duplicates are removed. Unequal counts and overlapping moves are rejected.
33
- - With an ordinary string destination and no text selectors, copy/move require one whole-file source and keep byte-preserving file behavior. String destinations with `targetStart` / `targetEnd` keep their line-based semantics.
34
- - `insert` still uses its string path and anchors; it does not accept an arbitrary structured input.
23
+ ## Compose results
35
24
 
36
- A replace/insert result selects that call's resulting text, including supplied line separators. Empty replacement selects the resulting position, not the removed text. Copy/move results select only destination text, never source removals. Whole-file transfers and write select the whole destination; undo selects whole restored files. Delete returns an inspection record, never a live text target. Check `data.target` before composing; `data.targetUnavailable` explains missing verified text mapping. Binary file operations can succeed without text targets.
25
+ Results are readable text with a leading system-result envelope. The envelope is an internal reference, not file content. Do not edit it or write it into a file. Pass the unchanged result to another source parameter; outside Codemode you can also pass its UUID. Store/load keeps the same string in the current session. No internal fields need to be inspected.
37
26
 
38
- New targets are strict snapshots. Obtain fresh targets after source bytes change, the session changes, or Pi reloads. Incomplete, unsupported and expired inputs are rejected before writing. Empty replace/delete/paired transfer selections are successful no-ops with `effect: "not-applied"`; whole-file write/undo still require one file. Existing string `SEARCH#:all` refresh behavior is unchanged. Removal records, diff text and arbitrary coordinates are not live targets.
27
+ Read results select their requested source windows. Search results select exact matches. Select derives new boundaries. A displayed item reference selects that item; the whole result retains all selections, including those omitted from its preview.
39
28
 
40
- ## Choosing line separation
29
+ - `replace.path` replaces selected ranges. `delete.path` removes selected text but keeps the file, even for a whole-file selection.
30
+ - `write.path` and `undo.file` require one whole-file selection. Partial and multi-file scopes are rejected, not widened.
31
+ - `copy.path` / `move.path` select source ranges; `target` selects destination ranges. A zero-width destination inserts. Arrays pair in declared order, with equal counts and duplicates removed. Unequal counts and overlapping moves are rejected.
32
+ - Ordinary destination file paths without text selectors require one whole-file source and keep byte-preserving file transfer behavior.
33
+ - `insert` uses line-based insertion before or after its selected containing lines.
41
34
 
42
- Use `separation: "blank-line"` for a separate paragraph or section; use the default line mode for adjacent code lines, list items, or a continuation of the current block. For example, inserting `X` after `A` in `A\nB` with blank-line separation produces `A\n\nX\n\nB`.
35
+ Replace/insert results select their resulting text, including supplied line separators. Empty replacement selects the resulting position, not removed text. Copy/move results select only destination text. Whole-file transfers and write select the whole destination; undo selects restored files. Delete and binary operations provide no reusable text selection. If a result cannot supply a verified selection, inspect the file instead.
43
36
 
44
- ## Standalone mutation behavior
37
+ Results are strict snapshots. Changed files permanently retire their old IDs, even if the old bytes are restored later. Session changes and reloads also retire IDs. Empty selections are valid no-ops; incomplete or expired selections cannot authorize edits. Diff text and invented coordinates do not grant source authority.
45
38
 
46
- Batch independent mutations as separate tool calls in one assistant response. Every call in that batch is evaluated against the original file contents. Combine overlapping changes into one mutation. A rejected call does not cancel successful independent calls; retry only what was not applied.
39
+ ## Line separation
47
40
 
48
- When a text tool allows an omitted path, it can inherit the source identified by its anchor, the last read, or the preceding edit in the same batch. Supply the path when that inheritance would be ambiguous.
41
+ Use `separation: "blank-line"` for a separate paragraph or section; use default line mode for adjacent code, list items, or a continuation. Inserting `X` after `A` in `A\nB` with blank-line separation produces `A\n\nX\n\nB`.
49
42
 
50
- Use `delete` with an ordinary string path and no text selector to delete one complete file. Use a selector or structured path to remove text. Use `copy` or `move` with ordinary paths and no text selectors for whole-file operations; add selectors or structured destinations for text transfers.
43
+ ## Writes and failures
51
44
 
52
- ## Native Codemode
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.
53
46
 
54
- Check each IDE result's `status` before using its data. Structured domain errors resolve to `status: "error"` or `"partial"`; argument validation, blocking, and cancellation can still reject. Check `data.effect` and per-source effects before retrying.
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.
55
48
 
56
- Await `tools.flush({})` when later script work needs a committed receipt. Inspect its `data.operations` for final effects keyed by accepted child call ID. A failed flush does not replay edits. An empty flush succeeds with no operations.
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.
57
50
 
58
- Submit independent local text-edit calls on disjoint resource sets concurrently inside one script. Await calls on overlapping resource sets in order. Keep their selectors tied to the original file snapshots and combine overlapping edits before submitting them. Check the parent Codemode result for committed effects; a child acceptance is not proof that a file was written.
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.
59
52
 
60
- Pass a pending replace/insert/write/copy/move result directly to Search or a supported mutation input for dependent work. That boundary commits the batch and confirms its target before the dependent tool runs. The original child receipt remains `effect: "pending"`; use flush or the parent receipt for final effects. A failed or cancelled operation never grants editable targets. Another tool, a whole-file operation, or a resource-owned selector also ends the batch. Do not reuse old line anchors across that boundary.
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.
61
54
 
62
- Formatting and registered resource post-edit handlers run once per surviving resource after all calls in one native Codemode script. Reads and dependent searches inside that script see written but not yet formatted text. Flush commits writes, not final formatting. If final processing changes bytes, earlier targets are stale; repeat Read/Search. Standalone calls outside Codemode still 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.
63
56
 
64
- Inspect final results after an ordinary script error and retry only unapplied edits. Abort or deadline discards pending writes, not batches that already committed.
57
+ After an interruption, read the affected files before retrying. Retry only unapplied edits.
65
58
 
66
59
  ## Specialized resources
67
60
 
68
- Some resources attach non-text actions to the same tools:
69
-
70
- - `shell:<session>` — `write` sends exact input, `insert` sends named keys, and `delete` terminates the session.
71
- - `debug:<session>` — `insert` controls the debugger and `delete` removes a breakpoint or terminates the session.
72
- - `symbol:<file>#<selector>#name` — `replace` performs a native language-server rename when available.
73
-
74
- Read `docs:terminal`, `docs:debugger`, or `docs:search-code` before using those specialized resources.
61
+ - `shell:<session>`: write sends exact input, insert sends keys, delete terminates the session.
62
+ - `debug:<session>`: insert controls the debugger; delete removes a breakpoint or terminates it.
63
+ - `symbol:<file>#<selector>#name`: replace performs a native language-server rename when available.
75
64
 
76
- Never guess after a stale snapshot, empty selection, ambiguous target, or unknown rollback effect.
65
+ Read `docs:terminal`, `docs:debugger`, or `docs:search-code` before using these resources. Never guess after a stale snapshot, ambiguous target, incomplete selection, or unknown rollback effect.
@@ -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,58 +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
- ## Native Codemode data
31
-
32
- Check `status` before reading `data`. Use text `data.lines` and their `anchors` without parsing display rows. Use source-level `data.references` for actions such as Git changes. Follow `data.continuation` as a complete next Read request; its offset is absolute on its returned source. Check `data.truncated` and `data.fullResult` when present.
33
-
34
- Use `data.bytes` for `raw:` reads. Forward a native image from `data.blocks` with `image(block)`. Keep multi-source `data.resources` separate instead of joining unrelated ranges.
35
-
36
- ## Reusing source windows
37
-
38
- Exact filesystem text reads expose `data.target`. Pass the successful result, its data, or that `RESULT#` reference as `search.path` or `replace.path` to reuse the requested window, not just its shortened preview. Read-only derived views, bytes, images, and directory listings do not gain text-edit authority.
39
-
40
- Pass a stored `RESULT#` reference as `read.path` to inspect an exact source selection. Read may show surrounding whole-line context, but its returned target intersects that window with the original selection and keeps input completeness. Context does not grant wider edit authority.
41
-
42
- Check that a target was returned before composing source operations. Obtain a fresh Read/Search after source bytes change, the session changes, or Pi reloads. New result targets never silently refresh.
43
-
44
- ## Views
45
-
46
- Views request source-specific presentations without changing the selected resource. Common views include:
47
-
48
- - `anchors` — editable `LINE#HASH` references.
49
- - `ast` — syntax-scope boundaries.
50
- - `changes` — staged and unstaged Git changes with `CHANGE#` anchors.
51
- - `diagnostics` — findings beside source text.
52
- - `breakpoints` — current debugger breakpoint locations.
53
- - `image` — one visual frame or terminal screen.
54
- - `sequence` — several ordered visual frames.
55
-
56
- 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.
57
-
58
- 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.
@@ -12,13 +12,19 @@ Use `files:<pattern>` for paths. Slash-containing globs match workspace-relative
12
12
 
13
13
  Use possible-name groups as spelling hints, not synonyms or proof of equivalent behavior. Inspect the candidate source before choosing an edit. The original match list stays empty; each group is a separate exact alternative in the same scope.
14
14
 
15
- Inside native Codemode, use `data.fuzzy.candidates` when returned. Check each group's `selection.complete` separately from `selection.truncated`. Pass a registered local `selection` or its `target` to compatible tools for strict snapshot composition; its preview does not clip the stored candidate scope. Use its `selection.all` only when returned, or its individual match references. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. For URL groups, read the returned URL and line range; no editable Search references exist. Structured result-scoped queries stay exact and do not run this extra branch.
15
+ Inspect the displayed possible-name groups and their completeness separately. The whole Search result still selects the original empty match set, not a suggested alternative. Use the chosen group's returned references to inspect or edit that alternative. A candidate all-reference refreshes only its exact alternative, not the fuzzy ranking. For URL groups, read the returned URL and line range; no editable Search references exist. Result-scoped queries stay exact and do not run this extra branch.
16
16
 
17
17
  If the extra branch reports a budget skip, narrow `path` rather than treating the skip as proof that no nearby name exists. Keep quoted exact queries, Boolean queries, and explicit protocols exact.
18
18
 
19
19
  ## Search resources
20
20
 
21
- Inside native Codemode, check `status` and use `data.matches`, their exact `range`, and `references.line` or `references.match`. Use `data.all` only when returned. Check backend `complete` separately from public-window `truncated`; an empty successful match list is not an error.
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
+
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.
22
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
 
@@ -26,40 +32,35 @@ A single-result reference becomes stale after its file changes. Re-run the searc
26
32
 
27
33
  ## Searching returned scopes
28
34
 
29
- Pass a source-aware Read/Search/mutation result with a live target, its `data`, a `RESULT#` reference, or an array of returned matches/resources as `path` to search their exact source ranges. Local text, `regex:`, `ast:`, and `symbols:` queries support this input. Sparse ranges and files stay separate; gaps and neighboring text are not searched.
35
+ Pass an unchanged Read/Search/Select/edit result, its UUID or a `RESULT#` reference as `path`. Arrays of registered results also work. Local text, `regex:`, `ast:`, and `symbols:` queries search their exact ranges. Sparse ranges and files stay separate; gaps and neighboring text are not searched.
30
36
 
31
- A replace/insert result searches only that call's resulting text, including an empty resulting position. Copy/move search only destination text; whole-file transfers, write and undo search whole resulting files. Delete and restored absence have no live text target. In native Codemode, passing a pending result commits the batch first. Final formatting runs at script end; targets from before changed formatting become stale, not silently rebound.
37
+ A replace/insert result searches only that call's resulting text, including an empty resulting position. Copy/move search only destination text; whole-file transfers, write and undo search whole resulting files. Delete and restored absence have no live text target. In Codemode, passing a pending result commits the batch first. Final formatting runs at script end; results from before changed formatting become stale, not silently rebound.
32
38
 
33
- Pass `found.data.matches.filter(...)` to narrow a result with JavaScript. A whole result's `target` still selects its complete stored scope; changing its preview does not narrow it. Preserve returned target handles instead of reconstructing coordinates from text.
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
- Check `complete` before treating zero matches as absence. Inherited incompleteness survives 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
 
39
45
  Use `ast:<pattern>` for syntax-aware matching. `$NAME` captures one syntax node and `$$$BODY` captures several nodes. Returned search references can select multiline matches for read, replace, copy, move, and delete. An incomplete result does not provide a complete all-selection. Text replacement through an AST selection does not update imports or references automatically.
40
46
 
41
- Pass `found.data.matches[index].captures.NAME` to Search or replace to use an AST capture without Select. Each name contains an array of source targets associated with that parent match. Multi captures retain all provider nodes, including punctuation; an absent or empty capture is not an invented source range. Use ordinary JavaScript to choose nodes. AST matches and captures must be wholly contained in one requested region; they are not clipped at a scope boundary.
47
+ Use the displayed `capture NAME: RESULT#...` reference to Search or edit a capture without Select. It belongs to that parent match and retains every captured node, including punctuation. Its node count does not change the selection. An empty capture selects nothing; an absent capture has no reference. AST matches and captures must be wholly contained in one requested region; they are not clipped at a scope boundary.
42
48
 
43
49
  ```js
44
50
  const window = await tools.read({ path: "client.ts", offset: 10, limit: 4 });
45
- if (window.status !== "success") throw Error(JSON.stringify(window.errors));
46
51
  const calls = await tools.search({ path: window, query: "ast:request($OPTIONS)" });
47
- if (calls.status !== "success") throw Error(JSON.stringify(calls.errors));
48
- const options = calls.data.matches[0]?.captures.OPTIONS;
49
- if (options === undefined) throw Error("No captured options");
50
- const values = await tools.search({ path: options, query: "1000" });
51
- if (values.status !== "success") throw Error(JSON.stringify(values.errors));
52
- const changed = await tools.replace({ path: values, text: "2000" });
53
- text(changed);
52
+ text(calls);
54
53
  ```
55
54
 
55
+ Use its displayed OPTIONS reference in the next call. Store/load keeps these result strings across Codemode scripts within the same session.
56
+
56
57
  ## Symbols and graphs
57
58
 
58
59
  Use `symbols:<query>` to locate declarations and references when the source file is unknown. Use `symbol:<file>#<selector>` to read one declaration. Use `graph:<file>` for the file's top-level declarations and relationships, or `graph:<file>#<selector>` for incoming and outgoing references of one declaration.
59
60
 
60
- Pass a result scope to `symbols:` for strict discovery inside its exact ranges. Inspect `matches[].role` (`definition` or `reference`) and `matches[].symbol` for the originating declaration's identity, name, kind, source, and range. Name equality alone does not establish reference identity.
61
+ Pass a result scope to `symbols:` for strict discovery inside its exact ranges. Read the displayed definition/reference and symbol information. Name equality alone does not establish reference identity.
61
62
 
62
- Use `navigation: "references"` only when following symbols represented inside the input scope to references outside it. Navigation stays within the workspace. Path and globs define the seed scope in this mode, not the destination references. Omit navigation for strict discovery. Check `complete`; failed requests and unavailable providers are errors, not proof of absence. Text replacement through an LSP match changes only that range; it is not semantic rename.
63
+ Use `navigation: "references"` only when following symbols represented inside the input scope to references outside it. Navigation stays within the workspace. Path and globs define the seed scope in this mode, not the destination references. Omit navigation for strict discovery. Incomplete, failed or unavailable provider results do not prove absence. Text replacement through an LSP match changes only that range; it is not semantic rename.
63
64
 
64
65
  Append `#name` to an exact symbol resource only for a native language-server rename across references. If semantic support is unavailable, use a precise text or AST operation instead of pretending it was a semantic rename. Pending or empty language-server output does not prove that no declaration or reference exists.
65
66