pi-agent-ide 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (461) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +10 -3
  3. package/dist/{chunk-AWXVJ5AC.js → chunk-2RTCSZB3.js} +1 -1
  4. package/dist/chunk-3HYXQ4YA.js +28 -0
  5. package/dist/chunk-3JO7QFIL.js +1 -0
  6. package/dist/chunk-4NIFBFFR.js +11 -0
  7. package/dist/{chunk-VCTK4JSN.js → chunk-64M3SQPG.js} +1 -1
  8. package/dist/{chunk-5QQABP47.js → chunk-7LD2OQH3.js} +1 -1
  9. package/dist/chunk-7LZKOHH2.js +1 -0
  10. package/dist/chunk-AJRIASPQ.js +2 -0
  11. package/dist/chunk-EAZGN5ND.js +7 -0
  12. package/dist/{chunk-ZM4L5AGN.js → chunk-EDURPQAV.js} +3 -2
  13. package/dist/{chunk-GIRAEVUJ.js → chunk-F5YZG77W.js} +1 -1
  14. package/dist/chunk-FK42RSF4.js +1 -0
  15. package/dist/{chunk-O6LE42GK.js → chunk-FXNKMNSJ.js} +1 -1
  16. package/dist/chunk-GBLKIB6O.js +2 -0
  17. package/dist/chunk-KBP3QUDT.js +2 -0
  18. package/dist/chunk-KR36BT5E.js +1 -0
  19. package/dist/{chunk-NTYXZ3EL.js → chunk-KVHDMIZS.js} +1 -1
  20. package/dist/{chunk-QDST6VIU.js → chunk-KZC7TI5M.js} +1 -1
  21. package/dist/chunk-OE7QVAI2.js +5 -0
  22. package/dist/{chunk-GUTQ3PWL.js → chunk-PLKYHUNT.js} +1 -1
  23. package/dist/chunk-PNU3E7IO.js +3 -0
  24. package/dist/chunk-PS2B6THP.js +3 -0
  25. package/dist/chunk-PYPPV2F5.js +25 -0
  26. package/dist/{chunk-25CZ5ZIU.js → chunk-QFTBY67N.js} +3 -3
  27. package/dist/chunk-S5LXX32D.js +28 -0
  28. package/dist/chunk-SILJ3OL4.js +9 -0
  29. package/dist/chunk-SQKAXYIR.js +2 -0
  30. package/dist/chunk-VCGNVTXQ.js +1 -0
  31. package/dist/chunk-XYS4FSCC.js +12 -0
  32. package/dist/chunk-YGGKGZO2.js +1 -0
  33. package/dist/{chunk-L7JMDDSD.js → chunk-YRF7OATP.js} +1 -1
  34. package/dist/chunk-ZPT5D4VP.js +2 -0
  35. package/dist/entry-0.js +1 -1
  36. package/dist/entry-11.js +1 -1
  37. package/dist/entry-13.js +1 -1
  38. package/dist/entry-14.js +1 -1
  39. package/dist/entry-15.js +1 -1
  40. package/dist/entry-16.js +1 -1
  41. package/dist/entry-17.js +1 -1
  42. package/dist/entry-25.js +2 -2
  43. package/dist/entry-26.js +1 -1
  44. package/dist/entry-27.js +1 -1
  45. package/dist/entry-28.js +1 -1
  46. package/dist/entry-29.js +1 -1
  47. package/dist/entry-30.js +1 -1
  48. package/dist/entry-31.js +11 -9
  49. package/dist/entry-33.js +1 -1
  50. package/dist/entry-37.js +6 -6
  51. package/dist/entry-42.js +1 -1
  52. package/dist/entry-44.js +1 -1
  53. package/dist/entry-45.js +12 -11
  54. package/dist/entry-46.js +1 -1
  55. package/dist/entry-49.js +1 -1
  56. package/dist/entry-50.js +3 -6
  57. package/dist/entry-51.js +11 -9
  58. package/dist/entry-52.js +1 -1
  59. package/dist/entry-53.js +1 -1
  60. package/dist/entry-54.js +1 -1
  61. package/dist/entry-55.js +1 -1
  62. package/dist/entry-56.js +1 -1
  63. package/dist/entry-57.js +1 -1
  64. package/dist/entry-58.js +1 -1
  65. package/dist/entry-59.js +1 -1
  66. package/dist/entry-60.js +1 -1
  67. package/dist/entry-61.js +0 -1
  68. package/dist/entry-62.js +1 -0
  69. package/dist/entry-63.js +0 -1
  70. package/dist/entry-64.js +1 -0
  71. package/dist/entry-65.js +1 -1
  72. package/dist/entry-66.js +1 -1
  73. package/dist/entry-67.js +1 -1
  74. package/dist/entry-68.js +1 -1
  75. package/dist/entry-69.js +1 -1
  76. package/dist/entry-70.js +1 -1
  77. package/dist/entry-72.js +1 -1
  78. package/dist/entry-75.js +1 -1
  79. package/dist/entry-77.js +50 -307
  80. package/dist/entry-78.js +14 -26
  81. package/dist/entry-79.js +2 -2
  82. package/dist/entry-80.js +1 -1
  83. package/dist/entry-81.js +1 -1
  84. package/dist/entry-82.js +5 -3
  85. package/dist/entry-83.js +1 -1
  86. package/dist/entry-84.js +1 -1
  87. package/dist/entry-85.js +1 -1
  88. package/dist/entry-86.js +1 -1
  89. package/dist/pi-agent-ide.js +15 -3
  90. package/docs/agent-guides/editing.md +31 -3
  91. package/docs/agent-guides/git-changes.md +1 -1
  92. package/docs/agent-guides/json-reading.md +19 -3
  93. package/docs/agent-guides/read-resources.md +15 -1
  94. package/docs/agent-guides/search-code.md +43 -2
  95. package/docs/agent-guides/select-code.md +194 -0
  96. package/docs/agent-guides/terminal.md +1 -1
  97. package/docs/code-review.md +99 -0
  98. package/docs/configuration.md +36 -7
  99. package/docs/development.md +16 -19
  100. package/docs/nightly.md +7 -0
  101. package/docs/releases.md +42 -0
  102. package/docs/research/apply-native-capability-matrix.md +174 -0
  103. package/docs/research/apply-read-latency.md +2 -0
  104. package/docs/research/lpt-393-fuzzy-results/file.json +152 -0
  105. package/docs/research/lpt-393-fuzzy-results/repo.json +122 -0
  106. package/docs/research/lpt-393-search-fuzzy-fallback.md +97 -0
  107. package/docs/research/native-codemode-batch-decision.md +29 -0
  108. package/docs/research/native-codemode-batching.md +65 -0
  109. package/docs/structured-results.md +86 -0
  110. package/docs/tools.md +24 -4
  111. package/docs/user-hooks.md +1 -1
  112. package/node_modules/pi-agent-doctor/package.json +1 -1
  113. package/node_modules/pi-agent-documentation/package.json +1 -1
  114. package/node_modules/pi-agent-documentation/src/index.ts +1 -1
  115. package/node_modules/pi-agent-filesystem/index.ts +6 -1
  116. package/node_modules/pi-agent-filesystem/package.json +7 -6
  117. package/node_modules/pi-agent-filesystem/src/path-recovery.ts +109 -0
  118. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  119. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  120. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  121. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  122. package/node_modules/pi-agent-ide-ast/package.json +15 -10
  123. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +193 -0
  124. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +59 -0
  125. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +5 -1
  126. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +204 -0
  127. package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +2 -0
  128. package/node_modules/pi-agent-ide-ast/src/extension.ts +4 -2
  129. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +184 -0
  130. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
  131. package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +6 -2
  132. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +110 -7
  133. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +104 -0
  134. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +384 -0
  135. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +41 -0
  136. package/node_modules/pi-agent-ide-ast/src/source-text.ts +92 -0
  137. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +214 -0
  138. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +251 -0
  139. package/node_modules/pi-agent-ide-changes/index.ts +2 -24
  140. package/node_modules/pi-agent-ide-changes/package.json +8 -7
  141. package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
  142. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +126 -48
  143. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
  144. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  145. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  146. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  147. package/node_modules/pi-agent-ide-lsp/index.ts +2 -2
  148. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  149. package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +5 -0
  150. package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +8 -2
  151. package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +19 -0
  152. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +204 -118
  153. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +2 -17
  154. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +92 -30
  155. package/node_modules/pi-agent-image/package.json +2 -2
  156. package/node_modules/pi-agent-invariant/package.json +1 -1
  157. package/node_modules/pi-agent-pdf/package.json +2 -2
  158. package/node_modules/pi-agent-read/package.json +7 -7
  159. package/node_modules/pi-agent-read/src/api/read-parameters.ts +2 -2
  160. package/node_modules/pi-agent-read/src/api/tools/read.ts +35 -2
  161. package/node_modules/pi-agent-read/src/core/extension.ts +11 -0
  162. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
  163. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
  164. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +93 -0
  165. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +218 -0
  166. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +127 -73
  167. package/node_modules/pi-agent-resource/package.json +1 -1
  168. package/node_modules/pi-agent-resource/src/index.ts +22 -0
  169. package/node_modules/pi-agent-resource/src/resource-access.ts +55 -0
  170. package/node_modules/pi-agent-resource/src/resource-scheduler.ts +204 -0
  171. package/node_modules/pi-agent-resource/src/result-targets.ts +233 -0
  172. package/node_modules/pi-agent-resource/src/tool-result.ts +125 -0
  173. package/node_modules/pi-agent-search/package.json +5 -4
  174. package/node_modules/pi-agent-search/src/api/fuzzy.ts +208 -0
  175. package/node_modules/pi-agent-search/src/api/presentation.ts +68 -0
  176. package/node_modules/pi-agent-search/src/api/search-parameters.ts +13 -6
  177. package/node_modules/pi-agent-search/src/api/search-scope.ts +22 -0
  178. package/node_modules/pi-agent-search/src/api/search.ts +39 -0
  179. package/node_modules/pi-agent-search/src/api/structured-result.ts +148 -0
  180. package/node_modules/pi-agent-search/src/core/extension.ts +90 -24
  181. package/node_modules/pi-agent-search/src/core/search-core.ts +145 -78
  182. package/node_modules/pi-agent-search-text/index.ts +6 -1
  183. package/node_modules/pi-agent-search-text/package.json +7 -6
  184. package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +164 -0
  185. package/node_modules/pi-agent-search-text/src/resolvers.ts +174 -26
  186. package/node_modules/pi-agent-search-text/src/scoped-search.ts +103 -0
  187. package/node_modules/pi-agent-search-text/src/search-backend.ts +201 -18
  188. package/node_modules/pi-agent-search-text/src/search-query.ts +42 -34
  189. package/node_modules/pi-agent-search-text/src/search-recipe.ts +18 -4
  190. package/node_modules/pi-agent-search-text/src/search-renderer.ts +90 -259
  191. package/node_modules/pi-agent-search-text/src/search-result.ts +77 -0
  192. package/node_modules/pi-agent-search-text/src/search-session.ts +110 -17
  193. package/node_modules/pi-agent-text/package.json +2 -2
  194. package/node_modules/pi-agent-text/src/text-document.ts +15 -10
  195. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  196. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  197. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +4 -3
  198. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  199. package/node_modules/pi-agent-text-editor/index.ts +4 -7
  200. package/node_modules/pi-agent-text-editor/package.json +20 -21
  201. package/node_modules/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
  202. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
  203. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
  204. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
  205. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
  206. package/node_modules/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
  207. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +78 -41
  208. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
  209. package/node_modules/pi-agent-text-editor/src/core/extension.ts +12 -2
  210. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +35 -4
  211. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +1 -1
  212. package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +76 -0
  213. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  214. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +168 -0
  215. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +820 -0
  216. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
  217. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +22 -0
  218. package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +78 -0
  219. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +175 -0
  220. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +412 -0
  221. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +149 -139
  222. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
  223. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +236 -185
  224. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +253 -203
  225. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
  226. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
  227. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +9 -6
  228. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -5
  229. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +5 -5
  230. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -7
  231. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +8 -8
  232. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +8 -3
  233. package/node_modules/pi-agent-text-editor-renderer/index.ts +9 -73
  234. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -5
  235. package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +276 -129
  236. package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
  237. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
  238. package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
  239. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
  240. package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +16 -1
  241. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
  242. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  243. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  244. package/node_modules/pi-agent-tool-ui/src/index.ts +7 -0
  245. package/node_modules/pi-agent-tool-ui/src/result-panel.ts +298 -0
  246. package/node_modules/pi-agent-web/index.ts +23 -0
  247. package/node_modules/pi-agent-web/package.json +7 -6
  248. package/node_modules/pi-agent-web/src/search.ts +221 -0
  249. package/node_modules/pi-agent-web-html/package.json +2 -2
  250. package/node_modules/pi-agent-web-image/package.json +3 -3
  251. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  252. package/node_modules/pi-agent-web-text/package.json +3 -3
  253. package/package.json +42 -37
  254. package/skills/capture-code-review-rule/SKILL.md +60 -0
  255. package/src/code-review/config.ts +68 -0
  256. package/src/code-review/extension.ts +105 -0
  257. package/src/code-review/fragments.ts +26 -0
  258. package/src/code-review/reviewer.ts +198 -0
  259. package/src/composite/host-version.ts +13 -0
  260. package/src/composite/module-labels.ts +1 -1
  261. package/src/composite/nested-tool-rendering.ts +298 -0
  262. package/src/composite/preferences.ts +0 -5
  263. package/src/composite/tool-availability.ts +90 -0
  264. package/src/core/extension.ts +2 -0
  265. package/src/documentation/extension.ts +81 -145
  266. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +6 -1
  267. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -6
  268. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  269. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  270. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  271. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  272. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/path-recovery.ts +109 -0
  273. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +23 -0
  274. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -6
  275. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  276. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  277. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  278. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  279. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +221 -0
  280. package/src/extensions/pi-agent-read/package.json +7 -7
  281. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +2 -2
  282. package/src/extensions/pi-agent-read/src/api/tools/read.ts +35 -2
  283. package/src/extensions/pi-agent-read/src/core/extension.ts +11 -0
  284. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
  285. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
  286. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +93 -0
  287. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +218 -0
  288. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +127 -73
  289. package/src/extensions/pi-agent-search/package.json +5 -4
  290. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +6 -1
  291. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -6
  292. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +164 -0
  293. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +174 -26
  294. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +103 -0
  295. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +201 -18
  296. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +42 -34
  297. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +18 -4
  298. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +90 -259
  299. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +77 -0
  300. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +110 -17
  301. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +208 -0
  302. package/src/extensions/pi-agent-search/src/api/presentation.ts +68 -0
  303. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +13 -6
  304. package/src/extensions/pi-agent-search/src/api/search-scope.ts +22 -0
  305. package/src/extensions/pi-agent-search/src/api/search.ts +39 -0
  306. package/src/extensions/pi-agent-search/src/api/structured-result.ts +148 -0
  307. package/src/extensions/pi-agent-search/src/core/extension.ts +90 -24
  308. package/src/extensions/pi-agent-search/src/core/search-core.ts +145 -78
  309. package/src/extensions/pi-agent-text-editor/index.ts +4 -7
  310. package/src/extensions/pi-agent-text-editor/package.json +20 -21
  311. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  312. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  313. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +4 -3
  314. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  315. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +9 -73
  316. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -5
  317. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +276 -129
  318. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
  319. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
  320. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
  321. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
  322. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +16 -1
  323. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
  324. package/src/extensions/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
  325. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
  326. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
  327. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
  328. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
  329. package/src/extensions/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
  330. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +78 -41
  331. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
  332. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +12 -2
  333. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +35 -4
  334. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +1 -1
  335. package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +76 -0
  336. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  337. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +168 -0
  338. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +820 -0
  339. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
  340. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +22 -0
  341. package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +78 -0
  342. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +175 -0
  343. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +412 -0
  344. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +149 -139
  345. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
  346. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +236 -185
  347. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +253 -203
  348. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
  349. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
  350. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +9 -6
  351. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -5
  352. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +5 -5
  353. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -7
  354. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +8 -8
  355. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +8 -3
  356. package/src/pi-agent-ide.ts +61 -8
  357. package/src/plugins/pi-agent-ide-ast/package.json +15 -10
  358. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +193 -0
  359. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +59 -0
  360. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +5 -1
  361. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +204 -0
  362. package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +2 -0
  363. package/src/plugins/pi-agent-ide-ast/src/extension.ts +4 -2
  364. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +184 -0
  365. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +6 -1
  366. package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +6 -2
  367. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +110 -7
  368. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +104 -0
  369. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +384 -0
  370. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +41 -0
  371. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +92 -0
  372. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +214 -0
  373. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +251 -0
  374. package/src/plugins/pi-agent-ide-changes/index.ts +2 -24
  375. package/src/plugins/pi-agent-ide-changes/package.json +8 -7
  376. package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
  377. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +126 -48
  378. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
  379. package/src/plugins/pi-agent-ide-debugger/index.ts +63 -17
  380. package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +18 -2
  381. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +24 -4
  382. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +68 -2
  383. package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +357 -0
  384. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -3
  385. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +13 -13
  386. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  387. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  388. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  389. package/src/plugins/pi-agent-ide-lsp/index.ts +2 -2
  390. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  391. package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +5 -0
  392. package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +8 -2
  393. package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +19 -0
  394. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +204 -118
  395. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +2 -17
  396. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +92 -30
  397. package/src/plugins/pi-agent-ide-terminal/index.ts +12 -2
  398. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
  399. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +65 -30
  400. package/src/plugins/pi-agent-ide-terminal/src/search.ts +16 -37
  401. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +1 -0
  402. package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +100 -0
  403. package/src/plugins/pi-agent-ide-terminal/src/steering.ts +62 -0
  404. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +98 -46
  405. package/src/plugins/pi-agent-ide-terminal/src/types.ts +3 -1
  406. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +15 -6
  407. package/src/plugins/pi-agent-ide-vision/index.ts +35 -1
  408. package/dist/chunk-3E2NTWCN.js +0 -2
  409. package/dist/chunk-4LUW26BX.js +0 -10
  410. package/dist/chunk-4U2GUKNJ.js +0 -0
  411. package/dist/chunk-5VSE5X5R.js +0 -2
  412. package/dist/chunk-6EYWFBNG.js +0 -0
  413. package/dist/chunk-7WCZOO5I.js +0 -1
  414. package/dist/chunk-CEX3VOJ7.js +0 -2
  415. package/dist/chunk-FA6BKC5Y.js +0 -1
  416. package/dist/chunk-FEDVTZJG.js +0 -1
  417. package/dist/chunk-HMLH43ZS.js +0 -4
  418. package/dist/chunk-ITSNK5YG.js +0 -7
  419. package/dist/chunk-KII2JQC5.js +0 -1
  420. package/dist/chunk-LVWMWWWF.js +0 -28
  421. package/dist/chunk-P7XO5CIP.js +0 -2
  422. package/dist/chunk-PZFOOHY2.js +0 -15
  423. package/dist/chunk-ROXXK6TW.js +0 -0
  424. package/dist/chunk-S3ZPXWX7.js +0 -2
  425. package/dist/chunk-T7CZIACQ.js +0 -27
  426. package/dist/chunk-VXD6FZP5.js +0 -5
  427. package/dist/chunk-YHUTTZC6.js +0 -2
  428. package/dist/chunk-YT42LKFV.js +0 -16
  429. package/docs/agent-guides/apply.md +0 -333
  430. package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +0 -3
  431. package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +0 -155
  432. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +0 -344
  433. package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +0 -50
  434. package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +0 -11
  435. package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +0 -203
  436. package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +0 -55
  437. package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +0 -276
  438. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +0 -13
  439. package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +0 -25
  440. package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +0 -405
  441. package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +0 -133
  442. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
  443. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +0 -148
  444. package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +0 -920
  445. package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
  446. package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +0 -3
  447. package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +0 -155
  448. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +0 -344
  449. package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +0 -50
  450. package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +0 -11
  451. package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +0 -203
  452. package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +0 -55
  453. package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +0 -276
  454. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +0 -13
  455. package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +0 -25
  456. package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +0 -405
  457. package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +0 -133
  458. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
  459. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +0 -148
  460. package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +0 -920
  461. package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
@@ -1,3 +1,15 @@
1
- import{a as N,b as M,c as L,d as V,e as G,f as $}from"./chunk-W7CASEO3.js";import{a as l}from"./chunk-EI7MMDWY.js";var O={"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","Apply guarded text and whole-file changes, including Apply scripts."],"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 k=[n("ide.core",()=>import("./chunk-HMLH43ZS.js")),n("ide.tips",()=>import("./chunk-BMOJTJJJ.js")),n("ide.doctor",()=>import("./chunk-5JELU6RV.js")),n("ide.languages",()=>import("./entry-35.js"),["ide.doctor"]),n("read.core",()=>import("./entry-45.js")),n("ide.documentation",()=>import("./chunk-PZFOOHY2.js"),["read.core"]),n("read.filesystem",()=>import("./entry-25.js"),["read.core","editor.core"]),n("read.filesystem.jq",()=>import("./entry-27.js"),["read.filesystem","ide.documentation","ide.doctor"]),n("read.filesystem.image",()=>import("./entry-26.js"),["read.filesystem"]),n("read.filesystem.pdf",()=>import("./entry-28.js"),["read.filesystem"]),n("read.filesystem.text",()=>import("./entry-29.js"),["read.filesystem"]),n("read.web",()=>import("./entry-82.js"),["read.core"]),n("read.web.html",()=>import("./entry-83.js"),["read.web"]),n("read.web.image",()=>import("./entry-84.js"),["read.web"]),n("read.web.pdf",()=>import("./entry-85.js"),["read.web"]),n("read.web.text",()=>import("./entry-86.js"),["read.web"]),n("search.core",()=>import("./entry-50.js")),n("search.text",()=>import("./entry-51.js"),["search.core"]),n("editor.renderer",()=>import("./entry-78.js"),["editor.core"]),n("editor.core",()=>import("./entry-77.js")),n("editor.anchor.constant",()=>import("./entry-56.js"),["read.core","editor.core"]),n("editor.anchor.line-hash",()=>import("./entry-60.js"),["read.core","editor.core"]),n("editor.anchor.exact",()=>import("./entry-58.js"),["editor.core"]),n("editor.stale-anchor",()=>import("./entry-79.js"),["editor.core"]),n("ide.ast",()=>import("./entry-31.js"),["ide.core","read.core","search.core","editor.core"]),n("ide.formatter",()=>import("./entry-34.js"),["ide.core"]),n("ide.lint",()=>import("./entry-36.js"),["ide.core"]),n("ide.changes",()=>import("./entry-33.js"),["ide.core","read.core","editor.core"]),n("ide.lsp",()=>import("./entry-37.js"),["ide.core","read.core","search.core"]),n("ide.processes",()=>import("./chunk-S6QRG3TQ.js")),n("ide.vision",()=>import("./chunk-VXD6FZP5.js"),["ide.processes","read.core","search.core"]),n("ide.debugger",()=>import("./chunk-T7CZIACQ.js"),["ide.processes","read.core","editor.core"]),n("ide.terminal",()=>import("./chunk-LVWMWWWF.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),n("ide.diagnostics",()=>import("./chunk-3E2NTWCN.js"),["ide.core","read.core"])];function n(i,u,a=[],r=!0){return{id:i,name:O[i][0],description:O[i][1],dependencies:a,async register(c,s){await(await u()).default(c,s)},...r?{}:{defaultEnabled:!1}}}l(n,"builtin");function B(i,u,a){return{kind:"choice",id:i,name:u,description:a,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}l(B,"presentationPreference");var z=[B("ui.applyPreview","Apply preview","Choose how Apply source previews are displayed."),B("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),B("ui.read","Read","Choose how Read calls and results are displayed."),B("ui.search","Search","Choose how Search calls and results are displayed."),B("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 j(i,u,a=[]){let r=new Map;for(let t of i){if(r.has(t.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${t.id}`);r.set(t.id,t)}for(let t of i)for(let h of t.dependencies)if(!r.has(h))throw new Error(`Pi Agent IDE extension ${t.id} has unknown dependency ${h}`);let c=new Set;for(let t of u)r.has(t)&&c.add(t);for(let t of a)if(!r.has(t))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${t}`);let s=ee(r,a,c),d=new Set;for(let t of i)(t.defaultEnabled===!1&&!s.has(t.id)||c.has(t.id))&&d.add(t.id);let E=!0;for(;E;){E=!1;for(let t of i)d.has(t.id)||t.dependencies.every(h=>!d.has(h))||(d.add(t.id),E=!0)}return{enabled:i.filter(t=>!d.has(t.id)),disabled:d}}l(j,"selectBuiltinExtensions");function ee(i,u,a){let r=new Set,c=[...u];for(;c.length>0;){let s=c.pop();if(!(r.has(s)||a.has(s))){r.add(s);for(let d of i.get(s)?.dependencies??[])r.has(d)||c.push(d)}}return r}l(ee,"collectForcedOn");import{Input as de}from"@earendil-works/pi-tui";import{mkdir as te,readFile as ie,writeFile as ne}from"node:fs/promises";import se from"node:path";import{withFileMutationQueue as oe}from"@earendil-works/pi-coding-agent";async function K(i,u,a=new Map,r=new Map,c){await oe(i,async()=>{let s=await $(i),d={};try{d=JSON.parse(await ie(i,"utf8"))}catch(o){if(!(o instanceof Error&&"code"in o&&o.code==="ENOENT"))throw o}let E=new Set(s.disabled),t=new Set(s.enabled);for(let[o,m]of u)E.delete(o),t.delete(o),m==="disabled"&&E.add(o),m==="enabled"&&t.add(o);let h={...s.preferences};for(let[o,m]of r)m===void 0?delete h[o]:h[o]=m;let y={...s.flags};for(let[o,m]of a)o==="pi-agent-ide-no-animations"&&delete d.noAnimations,o==="pi-agent-ide-no-post-processing"&&delete d.noPostProcessing,m===void 0?delete y[o]:y[o]=m;await te(se.dirname(i),{recursive:!0}),await ne(i,`${JSON.stringify({...d,disabled:[...E],enabled:[...t],...c===void 0?{}:{preset:c},...a.size>0?{flags:y}:{},...r.size>0?{preferences:h}:{}},null,2)}
2
- `)})}l(K,"saveModuleChoices");import{getSettingsListTheme as re}from"@earendil-works/pi-coding-agent";import{matchesKey as q,SettingsList as ae,truncateToWidth as H,visibleWidth as J}from"@earendil-works/pi-tui";function X(i,u,a,r,c=""){let s=["extensions","behavior","ui"],d="extensions",E=l(p=>p==="extensions"?"modules":p==="behavior"?"features":"ui","itemKey"),t=l(p=>p==="extensions"?"modules":p==="behavior"?"features":"ui","changeKey"),h=l(()=>{let p=E(d),g=u()[p]??[];return new ae(g,12,re(),(P,A)=>{a(t(d),P,A);for(let C of u()[p]??[]){let I=g.find(w=>w.id===C.id);I&&Object.assign(I,C)}},()=>r(!1),{enableSearch:!0})},"createList"),y=h(),o=l(p=>i.fg("borderMuted",p),"border"),m=l((p,g)=>{if(g<=1)return o("\u2502");let P=g-2,A=H(p,P);return`${o("\u2502")}${A}${" ".repeat(Math.max(0,P-J(A)))}${o("\u2502")}`},"row"),S=l(p=>o(p<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,p-2))}\u2524`),"rule");return{render(p){let g=Math.max(1,p),P=Math.max(1,g-4),A=` Agent IDE settings${c?` \xB7 ${c}`:""} `,C=g<=1?o("\u256D"):`${o("\u256D\u2500")}${i.fg("accent",i.bold(H(A,Math.max(0,g-3),"")))}${o(`${"\u2500".repeat(Math.max(0,g-J(A)-3))}\u256E`)}`,I={extensions:"Features",behavior:"Behavior",ui:"UI"},w=s.map(b=>b===d?i.fg("accent",i.bold(`[ ${I[b]} ]`)):i.fg("dim",` ${I[b]} `)).join(" "),v=y.render(P).map(b=>m(` ${b} `,g)),x=i.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[C,m(` ${w} `,g),S(g),...v,S(g),m(x,g),o(g<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,g-2))}\u256F`)]},invalidate(){y.invalidate()},handleInput(p){q(p,"tab")||q(p,"shift+tab")?(d=s[(s.indexOf(d)+(q(p,"shift+tab")?2:1))%s.length]??"extensions",y=h()):q(p,"ctrl+s")?r(!0):y.handleInput(p)}}}l(X,"createSettingsPanel");function Q(i,u=[],a=[]){i.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(r,c){if(c.hasUI)try{let s=await c.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(s===void 0)return;let d=L(process.env,void 0,c.cwd),E=s==="Project"?d.projectPath:d.globalPath,t=await $(E),h=await $(s==="Project"?d.globalPath:d.projectPath),y=new Map,o=new Map,m=new Map,S;if(!await c.ui.custom((g,P,A,C)=>{let I=X(P,()=>{let w=new Set(t.disabled),v=new Set(t.enabled);for(let[f,e]of y)w.delete(f),v.delete(f),e==="disabled"&&w.add(f),e==="enabled"&&v.add(f);let x=j(k,[...M(k,S??t.preset??"full"),...w,...M(k,h.preset??"full"),...h.disabled],[...v,...h.enabled]);return{modules:k.map(f=>({id:f.id,label:f.name??f.id,description:`${f.description??""} Effective: ${x.disabled.has(f.id)?"off":"on"}.${h.disabled.includes(f.id)?" Disabled in the other scope.":f.dependencies.some(e=>x.disabled.has(e))?" A dependency is disabled.":""}`,currentValue:y.get(f.id)??(t.disabled.includes(f.id)?"disabled":t.enabled.includes(f.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[b(),..._("features"),...F("features")],ui:[..._("ui"),...F("ui")]};function b(){let f=S??t.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:N.find(e=>e.value===f)?.label??f,values:N.map(e=>e.label)}}function F(f){return a.filter(e=>e.group===f).map(e=>{let R=m.has(e.id)?m.get(e.id):t.preferences?.[e.id];return{id:e.id,label:e.name,description:`${e.description} Default: ${e.kind==="choice"?e.values.find(D=>D.value===e.default)?.label??e.default:e.default||"empty"}.`,currentValue:R===void 0?"default":e.kind==="choice"?e.values.find(D=>D.value===R)?.label??R:R,...e.kind==="choice"?{values:["default",...e.values.map(D=>D.label)]}:{submenu:l((D,U)=>{let T=new de,W=D==="default"?e.default:D;return W.length>0&&T.handleInput(W),T.focused=!0,T.onSubmit=Z=>U(Z),T.onEscape=()=>U(),T},"submenu")}}})}function _(f){return u.filter(e=>(e.group??"features")===f).map(e=>{let R=o.has(e.id)?o.get(e.id):G(t)[e.id];return{id:e.id,label:e.name,description:e.description,currentValue:R===void 0?"default":R?e.labels?.on??"enabled":e.labels?.off??"disabled",values:["default",e.labels?.off??"disabled",e.labels?.on??"enabled"]}})}},(w,v,x)=>{if(w==="modules")y.set(v,x);else if(v==="preset")S=N.find(b=>b.label===x)?.value;else if(a.some(b=>b.id===v)){let b=a.find(F=>F.id===v);m.set(v,x==="default"||x.length===0?void 0:b?.kind==="choice"?b.values.find(F=>F.label===x)?.value:x)}else o.set(v,x==="default"?void 0:x===(u.find(b=>b.id===v)?.labels?.on??"enabled"))},C,s);return{render:l(w=>I.render(w),"render"),invalidate:l(()=>I.invalidate(),"invalidate"),handleInput(w){I.handleInput(w),g.requestRender()}}})||y.size+o.size+m.size+(S===void 0?0:1)===0)return;if(await K(E,y,o,m,S),c.ui.notify(`Saved ${s.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await c.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await c.reload();return}}catch(s){c.ui.notify(s instanceof Error?s.message:String(s),"error")}}})}l(Q,"registerModuleSettings");function Y(i,u){let a=[];return{definitions:a,register(r){if(a.some(c=>c.id===r.id))throw new Error(`Duplicate feature flag: ${r.id}`);a.push(r),i.registerFlag(r.id,{type:"boolean",description:r.description,default:u[r.id]??r.default})}}}l(Y,"createFeatureFlags");async function le(i){i.on("before_agent_start",s=>{let d=s.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
3
- `,"");return d===s.systemPrompt?void 0:{systemPrompt:d}});let u=await V(L()),a=Y(i,{"pi-agent-ide-no-animations":u.noAnimations??!1,"pi-agent-ide-no-post-processing":u.noPostProcessing??!1,...u.flags});a.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),a.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}),a.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}),a.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}),a.register({id:"pi-agent-ide-no-apply",name:"Disable Apply",description:"Hide the Apply tool. Standalone read, search and editing tools remain available.",default:!1}),a.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}),Q(i,a.definitions,z);let r=M(k,u.preset??"full"),{enabled:c}=j(k,[...r,...u.disabled],u.enabled);for(let s of c)await s.register(i,{preferences:u.preferences??{}})}l(le,"registerUnifiedPiAgentIde");export{le as default};
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(`
4
+
5
+ ---
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}
11
+
12
+ <ide_discovery>
13
+ ${c.join(`
14
+ `)}
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};
@@ -2,7 +2,7 @@
2
2
 
3
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.
4
4
 
5
- Use `apply` only when the work requires computation, conditions, selection composition, checkpoints, or one coherent cross-file transaction. Do not replace a straightforward standalone batch with a JavaScript Apply program. Read `docs:apply` before writing an Apply script.
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.
6
6
 
7
7
  Use `write` only to create a file or deliberately replace its complete contents. Use `diff` for read-only comparison.
8
8
 
@@ -23,9 +23,23 @@ With an `end` selector, the operation covers complete lines from the first line
23
23
 
24
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.
25
25
 
26
+ ## Editing returned targets
27
+
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.
29
+
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.
35
+
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.
37
+
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.
39
+
26
40
  ## Choosing line separation
27
41
 
28
- 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`. In Apply, pass `{ separation: "blank-line" }` as the third argument to a linewise `insertAfter` or `insertBefore`.
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`.
29
43
 
30
44
  ## Standalone mutation behavior
31
45
 
@@ -33,7 +47,21 @@ Batch independent mutations as separate tool calls in one assistant response. Ev
33
47
 
34
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.
35
49
 
36
- Use `delete` with a path and no text selector to delete one complete file. Use a selector to remove text. Use `copy` or `move` with no text selectors for whole-file operations; add source and destination selectors for text transfers.
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.
51
+
52
+ ## Native Codemode
53
+
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.
55
+
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.
57
+
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.
59
+
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.
61
+
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.
63
+
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.
37
65
 
38
66
  ## Specialized resources
39
67
 
@@ -2,4 +2,4 @@
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
- Use `undo` with an `APPLY#` receipt to restore every path from one Apply checkpoint atomically. 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.
5
+ 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.
@@ -1,6 +1,6 @@
1
- # Read JSON with jq
1
+ # Read JSON and JSONL with jq
2
2
 
3
- Use a `jq:` view when a JSON resource is too large or you need a structured subset.
3
+ Use a `jq:` view when a JSON or JSONL file is too large or you need a structured subset. Use the same view for Pi session `.jsonl` files; no separate format option or shell command is needed.
4
4
 
5
5
  ```json
6
6
  { "path": "package.json", "views": ["jq:.scripts"] }
@@ -19,6 +19,22 @@ jq:[.items[].price] | add
19
19
 
20
20
  A filter may produce no values, one value, or several values. Output keeps jq's normal pretty-printed JSON form.
21
21
 
22
+ ## Session files and other JSONL input
23
+
24
+ jq runs the filter separately on each input JSON value. For JSONL, each record is one value, not an item in a combined array.
25
+
26
+ ```json
27
+ {
28
+ "path": "session.jsonl",
29
+ "views": ["jq:select(.type == \"message\") | {id, role: .message.role}"],
30
+ "limit": 100
31
+ }
32
+ ```
33
+
34
+ Use `select(...)` to choose records and extract only the fields you need. The filter runs over the complete file before Read selects output lines. `offset` does not skip input records, and output line numbers are not JSONL record numbers.
35
+
36
+ Malformed input fails the whole Read with jq's parse error and input line/column. Earlier valid records are not returned as a successful partial result.
37
+
22
38
  ## Read part of the result
23
39
 
24
40
  `offset` and `limit` select lines from the transformed jq output, not from the original file.
@@ -33,7 +49,7 @@ Follow the continuation offset returned by Read. Oversized complete output may a
33
49
 
34
50
  - Supply exactly one non-empty `jq:` view.
35
51
  - Do not combine `jq:` with annotation views. Their source coordinates would not describe the transformed JSON.
36
- - The resource must contain valid JSON.
52
+ - The file must contain valid JSON or a stream of JSON values, such as JSONL.
37
53
  - jq must be installed and available on the project or system `PATH`.
38
54
  - Module loading is disabled. The process receives only a minimal environment and the selected JSON on standard input.
39
55
  - Execution is limited to five seconds and 10 MB of jq output.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Selecting a source
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#` references, and enabled protocol resources.
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.
6
6
 
7
7
  Common protocol resources include:
8
8
 
@@ -27,6 +27,20 @@ For `raw:` resources, offsets and limits count bytes. A negative offset counts f
27
27
 
28
28
  Temporary resources remain available only in their owning runtime.
29
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
+
30
44
  ## Views
31
45
 
32
46
  Views request source-specific presentations without changing the selected resource. Common views include:
@@ -8,22 +8,63 @@ Use uppercase `AND` and `OR`, infix `NOT`, `||`, or a space-separated `|` for Bo
8
8
 
9
9
  Use `files:<pattern>` for paths. Slash-containing globs match workspace-relative paths; basename globs match at any depth. Narrow with `path`, `include`, and `exclude` before broadening a noisy query.
10
10
 
11
+ ## Possible names after zero matches
12
+
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
+
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.
16
+
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
+
11
19
  ## Search resources
12
20
 
13
- Every result exposes `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.
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.
22
+
23
+ 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.
14
24
 
15
25
  A single-result reference becomes stale after its file changes. Re-run the search before reuse. A complete `:all` reference refreshes its original query when selected files change. Compacted output retains complete all-selections.
16
26
 
27
+ ## Searching returned scopes
28
+
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.
30
+
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.
32
+
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.
34
+
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.
36
+
17
37
  ## AST search
18
38
 
19
- 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, delete, and Apply. An incomplete result does not provide a complete all-selection. Text replacement through an AST selection does not update imports or references automatically.
39
+ 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
+
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.
42
+
43
+ ```js
44
+ const window = await tools.read({ path: "client.ts", offset: 10, limit: 4 });
45
+ if (window.status !== "success") throw Error(JSON.stringify(window.errors));
46
+ 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);
54
+ ```
20
55
 
21
56
  ## Symbols and graphs
22
57
 
23
58
  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.
24
59
 
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
+
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
+
25
64
  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.
26
65
 
27
66
  ## Other search protocols
28
67
 
68
+ Use an HTTP(S) URL as `path` to search converted page text with a literal or `regex:` query. No prior Read is needed. Web results keep the requested URL and do not expose editable `SEARCH#` references. Use Read on that URL for more context.
69
+
29
70
  Use `process:<query>` for running processes. Use `path: "shell:<session>"` to search retained terminal output beyond its current tail.
@@ -0,0 +1,194 @@
1
+ # Select source boundaries
2
+
3
+ Use Search to find text or code by a predicate. Use Select when an existing target needs new text or structural boundaries. Ordinary JavaScript chooses returned items; it cannot grant source authority to reconstructed coordinates or strings.
4
+
5
+ ## AST operations
6
+
7
+ AST operations support JavaScript (.js/.mjs/.cjs) and TypeScript (.ts/.mts/.cts), without JSX/TSX. Syntax errors and unavailable providers are errors, not evidence of absence. Text operations do not require a parser.
8
+
9
+ ### Enclosing constructs
10
+
11
+ Use `{kind:"object", object:"function"}` to find the nearest function containing the entire seed. An exact function selects itself. Set level:2 for the next outer function; levels count only the requested category. The optional relation/extent spellings remain enclosing/around. Enclosing can expand outside a Read/Search window and reports each input association and expansion. Seeds crossing separate constructs are rejected instead of choosing from their first character.
12
+
13
+ Supported object categories:
14
+
15
+ - function: declarations, expressions, arrows, class/object methods, async/generator forms and bodyless TS signatures. Default parameter expressions belong to their function.
16
+ - call: calls and new expressions.
17
+ - class, if, switch, loop (for/for-in/for-of/while/do), try and catch.
18
+ - binding: a variable declarator, not the surrounding const/let/var statement. assignment: ordinary and compound assignment expressions.
19
+ - object/array: literals and destructuring patterns; property: key/value pairs and shorthand object properties.
20
+ - return and throw.
21
+
22
+ These are syntax categories, not resolved symbol identities. Parser-only wrappers, punctuation, type nodes and comments do not become extra public construct categories. Class fields, JSX/TSX and other unlisted forms are not promised as constructs. ownBody is not implemented.
23
+
24
+ ### Navigate
25
+
26
+ Use `{kind:"navigate", relation:"parent"}` on an exact named syntax node. Returned constructs skip parser-only wrappers. Exact part/capture targets can be used directly; if a text range cuts through a node, first use object/enclosing. When several nested nodes have identical bounds, the supported construct takes precedence; otherwise the innermost exact named node is the starting node. A whole-file seed is not implicitly split into constructs.
27
+
28
+ - parent returns the nearest normalized construct ancestor, excluding the starting node.
29
+ - ancestors returns all normalized ancestors in source order, excluding the starting node.
30
+ - children returns the nearest nested constructs. descendants returns all nested constructs. Neither includes the starting node.
31
+ - siblings requires an exact normalized construct. direction previous/next returns its immediate neighbor under the same normalized parent; omit direction or use all for every other sibling. Top-level constructs share the document root. Missing parents/neighbors are valid absence.
32
+
33
+ Set object to filter results by category after navigation. A filter never changes topology: parent with object:function does not jump past an intervening call; children with object:call does not jump through an if. previous/next do not skip a different-category neighbor. Use ancestors/descendants when deeper matching constructs are wanted.
34
+
35
+ Ancestors and descendants can overlap. Choose the intended disjoint targets before editing; edit tools still reject overlapping writes. JavaScript chooses items by syntax.object or source/range; the item's stored target supplies source authority.
36
+
37
+ ### Named parts
38
+
39
+ Use `{kind:"part", part:"arguments"}` on an exact construct. Parts retain provider boundaries and delimiters: a function block body includes braces, parameter/argument lists include parentheses, return/type annotations include their colon, and an else/finalizer clause includes its keyword. A single unparenthesized arrow parameter has no invented parentheses; an expression arrow body is its exact expression.
40
+
41
+ | Construct | Supported parts |
42
+ | ----------------------------------------- | ---------------------------------------------------------- |
43
+ | function | name, parameters, returnType, body |
44
+ | call/new | callee, arguments |
45
+ | class | name, body |
46
+ | if | condition, then, else |
47
+ | switch | condition, body |
48
+ | classic for | initializer, condition, update, body |
49
+ | for-in / for-of | left, iterable, body |
50
+ | while / do | condition, body |
51
+ | try | body, handler, finalizer |
52
+ | catch | parameter, body |
53
+ | finally clause returned by part/finalizer | body |
54
+ | binding | name, type, value |
55
+ | assignment | left, right |
56
+ | property | key, value; shorthand selects the same identifier for both |
57
+ | return / throw | value |
58
+
59
+ A supported optional part that is absent produces no selection and increments missingInputs: anonymous function name, optional else, bodyless TS declaration, missing annotation, bare return, optional catch parameter, or new without arguments. Unsupported parts return an error listing available names. Objects and arrays do not invent a body or arguments part; use navigation for nested constructs and AST Search for scalar elements. For argument/parameter separator ownership, use elementExtent below; array/object list extents are not implemented.
60
+
61
+ Structural items include parser-derived syntax.object and, for part selections, syntax.part where a normalized owner exists. These labels are descriptive, not editable authority. Read takes the item's target string; its displayed line context never widens the exact part's source scope.
62
+
63
+ ```js
64
+ const found = await tools.search({ path: "client.ts", query: "ast:send($$$ARGS)" });
65
+ const call = await tools.select({ path: found, operation: { kind: "object", object: "call" } });
66
+ const args = await tools.select({ path: call, operation: { kind: "part", part: "arguments" } });
67
+ await tools.read({ path: args.data.target });
68
+ const number = await tools.search({ path: args, query: "10" });
69
+ await tools.replace({ path: number, text: "20" });
70
+ ```
71
+
72
+ ## List element extents
73
+
74
+ Use `{kind:"elementExtent", extent:"inside"}` on an exact direct JS/TS call/new argument or parenthesized function/method/arrow parameter. AST captures can provide those element targets. Variadic captures may also contain punctuation; choose the element items in JavaScript before passing them here. Commas themselves are not elements. A typed/default parameter must include its type/default, not just its name. Partial expressions, whole lists, array/object elements and unparenthesized arrow parameters are unsupported; this operation never silently selects an enclosing element.
75
+
76
+ `inside` keeps only the element. `around` adds owned comma/whitespace, reports expansion and preserves list parentheses:
77
+
78
+ | Element | around includes |
79
+ | ----------------------------------- | -------------------------------------------------------------------------------------- |
80
+ | First or middle with a next element | Element through the next element's start, including the following comma and whitespace |
81
+ | Last with a trailing comma | Element through the closing parenthesis, excluding the parenthesis |
82
+ | Last without a trailing comma | Previous element's end through this element's end; keeps closing whitespace |
83
+ | Only element | Entire list interior, including leading/trailing whitespace and any trailing comma |
84
+
85
+ Both adjacent gaps must contain only the expected comma and whitespace for around. Comments in those gaps return AMBIGUOUS_LIST_TRIVIA instead of guessing their owner. Comments inside the element are retained. inside does not assign neighboring trivia and remains available when an around request is refused.
86
+
87
+ Example: `send(a, b, c)` selects `b, ` around b and `, c` around c. Removing either single extent preserves the comma structure. Several selected extents can overlap: edit tools still reject overlap; do not assume arbitrary bulk deletion is repaired. Source bytes and CRLF stay exact.
88
+
89
+ Copy/move transports precisely the selected bytes, not a refactoring. A following-comma extent can be inserted before an existing destination element; a preceding-comma extent can be inserted after one. Destination syntax, parameter ordering and semantic validity are the caller's responsibility. Read the extent's target to preview it before editing. No new edit input contract or implicit syntax repair is provided.
90
+
91
+ ```js
92
+ const found = await tools.search({ path: "client.ts", query: "ast:send($FIRST, $MIDDLE, $LAST)" });
93
+ const element = await tools.select({
94
+ path: found.data.matches[0].captures.MIDDLE,
95
+ operation: { kind: "elementExtent", extent: "around" },
96
+ });
97
+ await tools.read({ path: element.data.target });
98
+ await tools.delete({ path: element });
99
+ ```
100
+
101
+ ## Text operations
102
+
103
+ Use `operation.kind` to choose a text transformation:
104
+
105
+ - `range` with startLine/startColumn/endLine/endColumn selects absolute source coordinates in one source. Lines are one-based, columns UTF-16 and the end exclusive. The entire requested range must fit one input region.
106
+ - `lines` with first/last selects inclusive absolute complete lines in one source, including their existing line endings. Require containment in one input region.
107
+ - `between` with non-empty literal start/end markers and extent inside/around/lines pairs the next opening marker with the nearest following closing marker, then resumes after that pair. inside excludes markers; around includes them; lines explicitly expands to complete containing lines. There is no nesting or bracket balancing. Identical markers pair successive occurrences. An unmatched opening is an error; no opening is valid absence.
108
+ - `sliceText` with non-negative from and optional to slices each region by relative UTF-16 offsets. to is exclusive and defaults to the region end. This slices source text, not the items array.
109
+ - `trim` with side start/end/both removes Unicode whitespace from those edges of each region. Whitespace-only input returns a zero-width point at its end.
110
+ - `split` with a non-empty literal delimiter returns segments without the delimiter. Empty segments remain zero-width points.
111
+ - `linesOf` explicitly expands each region to its complete containing lines. An exclusive end at next-line column zero leaves that untouched next line out.
112
+ - `position` with edge before/after returns each region's zero-width start/end. Use a whole-file Read for file edges.
113
+ - `columns` with from/to returns the exclusive UTF-16 column interval on each touched line, without line endings. Every interval must fit both its line and input scope.
114
+
115
+ Except for range/lines, apply each operation independently to every input region. Keep files and sparse gaps separate; markers or delimiters cannot span those gaps. Invalid bounds, short-line columns and boundaries inside surrogate pairs or CRLF are errors, not clipped ranges. Preserve original CRLF/LF/bare-CR endings and unterminated EOF. Only linesOf and between/lines explicitly expand text input and report expansion.
116
+
117
+ Resolve registered anchors through existing Read inputs, then pass their verified target to Select. Use Search for regex captures rather than a second regex language inside Select. Use JavaScript array slice/filter to choose items; use sliceText to derive source boundaries.
118
+
119
+ ```js
120
+ const source = await tools.read({ path: "notes.txt", offset: 2, limit: 1 });
121
+ const inside = await tools.select({
122
+ path: source,
123
+ operation: { kind: "between", start: "<", end: ">", extent: "inside" },
124
+ });
125
+ const value = await tools.select({
126
+ path: inside,
127
+ operation: { kind: "trim", side: "both" },
128
+ });
129
+ await tools.read({ path: value.data.target });
130
+ await tools.replace({ path: value, text: "new value" });
131
+ ```
132
+
133
+ Select works as an ordinary tool as well as inside native Codemode. A position can be consumed by replace or a paired copy/move destination for exact insertion. insert keeps its string-path/anchor contract.
134
+
135
+ ## Range sets
136
+
137
+ Use path for candidates and operation.scopes for comparison scopes. Both accept verified results/data/targets/item arrays and readable source strings. Match sets by file and snapshot, never by array order; different files do not match. Every input is verified even when it has no counterpart. Stale or incompatible snapshots reject the operation.
138
+
139
+ - within retains a complete candidate only when one scope contains it. It does not clip or join adjacent scopes for containment.
140
+ - intersection clips each candidate to the union of comparison scopes.
141
+ - difference subtracts the union of scopes from each candidate and returns separate surviving fragments.
142
+ - merge explicitly joins overlapping candidates. Set adjacent:true to also join touching nonempty ranges; default false. Never fill a real gap.
143
+
144
+ Clipping/subtraction keeps different candidate seeds separate. Equal output geometry is deduplicated; origins retain the candidate associations, not comparison scopes. Merge retains every contributor and reports its expansion relative to each candidate.
145
+
146
+ A point belongs to a nonempty [start,end) range at its included start but not its excluded end. Equal points match. Intersection with an explicit point keeps that point when contained; touching nonempty text does not create a point. Difference removes covered candidate points, but subtracting a point does not cut text. Merge absorbs covered points and keeps other points separate without extending text or bridging gaps. EOF points are outside a range ending at EOF.
147
+
148
+ Empty comparison scopes make within/intersection empty and difference unchanged. Empty candidates stay empty. Binary output complete is the conjunction of both inputs, including unmatched comparison files. Incomplete scopes do not establish absence or authorize an edit. missingInputs counts candidates that produce no output.
149
+
150
+ ```js
151
+ const candidates = await tools.search({ path: "notes.txt", query: "regex:<[^>]+>" });
152
+ const protectedText = await tools.search({ path: candidates, query: "KEEP" });
153
+ const editable = await tools.select({
154
+ path: candidates,
155
+ operation: { kind: "difference", scopes: protectedText },
156
+ });
157
+ const found = await tools.search({ path: editable, query: "old" });
158
+ await tools.replace({ path: found, text: "new" });
159
+ ```
160
+
161
+ ## Source inputs and results
162
+
163
+ path accepts compatible Read/Search/mutation/Select results, their data, RESULT# references and arrays of returned items. A file path obtains a fresh whole-file Read snapshot; the chosen operation still must make sense for that entire seed. A multi-function file is not implicitly split into functions.
164
+
165
+ The result has kind selection, a complete stored target, items with individual targets, exact ranges and original-input associations, complete, totalItems, missingInputs and truncated. Lines are one-based and columns are UTF-16; character ends are exclusive. Identical output geometry is deduplicated while origins retain the separate input ranges. Empty results remain valid source sets. Unsupported part inputs, ambiguity and stale/expired inputs are errors.
166
+
167
+ Items are limited to 100 and each text preview to 1000 UTF-16 code units. truncated describes presentation, not execution completeness. The top-level target retains all selected ranges. complete inherits input completeness; an incomplete result cannot establish absence or safely authorize edits. Source snapshots stay strict: refresh Read/Search after edits, session changes or reload. Select never writes or runs formatting.
168
+
169
+ ## Compose with existing tools
170
+
171
+ ```js
172
+ const calls = await tools.search({ path: "client.ts", query: "ast:legacyRequest($OPTIONS)" });
173
+ const owners = await tools.select({
174
+ path: calls,
175
+ operation: {
176
+ kind: "object",
177
+ object: "function",
178
+ relation: "enclosing",
179
+ level: 1,
180
+ extent: "around",
181
+ },
182
+ });
183
+ const body = await tools.select({
184
+ path: owners.data.items[0],
185
+ operation: { kind: "part", part: "body" },
186
+ });
187
+ const retry = await tools.search({ path: body, query: "ast:retry($$$ARGS)" });
188
+ ```
189
+
190
+ A body includes nested functions. To test for retry in that function's own body, select each retry call's nearest enclosing function and compare its source/range to the original owner. This keeps outer retry calls containing callbacks while excluding calls in nested functions or their default parameters. Do not establish absence from incomplete Search or clipped items.
191
+
192
+ For the initial timeout scenario, retain the original legacyRequest calls associated with eligible owners, use AST captures for inline object-literal options and their direct timeout values, preview, then replace only those values. Do not edit unrelated or nested-object properties, resolve variables, or imply semantic identity from a syntactic call name.
193
+
194
+ Search and compatible edits consume selection results through their stored targets. Read keeps its existing string-path schema: pass the result's target (for example, `read({path:body.data.target})`), not the whole object. Its whole-line context does not change the exact selection target. Whole-file write/undo still reject partial selections; selection never widens their guards. insert keeps its existing string/anchor contract. Formatting at the end of a native Codemode script may invalidate earlier selection targets just like other source results.
@@ -1,6 +1,6 @@
1
1
  # Terminal and process workflow
2
2
 
3
- Use `bash` for project commands. Keep short commands in the foreground. Start servers, watchers, and long builds with `background: true`; continue other work rather than polling. Read the returned `shell:<session>` resource for status and bounded output. Search that resource to locate retained output outside the current tail.
3
+ Use the registered shell tool (`bash` or `powershell`) for project commands. Check its command parameter for the actual shell and write that shell's syntax; do not infer syntax from the tool name or operating system. Keep short commands in the foreground. Start servers, watchers, and long builds with `background: true`; continue other work rather than polling. Read the returned `shell:<session>` resource for status and bounded output. Search that resource to locate retained output outside the current tail.
4
4
 
5
5
  Use `write` on a shell resource to send exact text without Enter. Use `insert` for named keys and chords such as `Enter`, `Ctrl+C`, or `Up`. Delete a shell resource to terminate and remove the session. Add the `image` view only when cursor position, ANSI layout, or a full-screen interface matters. Use a bounded `sequence:duration=<seconds>,interval=<seconds>,scale=<ratio>` view when changes over time matter.
6
6