pi-agent-ide 0.6.4 → 0.7.1

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 (431) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +2 -2
  3. package/dist/{chunk-AWXVJ5AC.js → chunk-2RTCSZB3.js} +1 -1
  4. package/dist/chunk-2TRHFMCZ.js +11 -0
  5. package/dist/{chunk-WJTHY6AG.js → chunk-4GCWGE2C.js} +1 -1
  6. package/dist/chunk-4XMY4H4V.js +1 -0
  7. package/dist/{chunk-BSICWXMH.js → chunk-64M3SQPG.js} +1 -1
  8. package/dist/{chunk-QEJGED4V.js → chunk-76ZK5ODR.js} +2 -2
  9. package/dist/{chunk-3BBJZSMS.js → chunk-7LD2OQH3.js} +1 -1
  10. package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
  11. package/dist/chunk-CWD4O5PM.js +3 -0
  12. package/dist/chunk-D3WTDA6V.js +2 -0
  13. package/dist/chunk-EAZGN5ND.js +7 -0
  14. package/dist/chunk-GXEGY7GV.js +1 -0
  15. package/dist/chunk-HZEY4GT4.js +2 -0
  16. package/dist/chunk-LEEQIQ7D.js +28 -0
  17. package/dist/chunk-NRZO5KJT.js +9 -0
  18. package/dist/chunk-OMVRLWMX.js +5 -0
  19. package/dist/{chunk-VBICI5YA.js → chunk-PGIVHICI.js} +1 -1
  20. package/dist/{chunk-FBOW7XOV.js → chunk-PKKDDIWW.js} +1 -1
  21. package/dist/chunk-PNU3E7IO.js +3 -0
  22. package/dist/chunk-PS2B6THP.js +3 -0
  23. package/dist/{chunk-FUG2TEKI.js → chunk-QFTBY67N.js} +2 -2
  24. package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
  25. package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
  26. package/dist/chunk-VMTR74FF.js +2 -0
  27. package/dist/{chunk-HPUAIWIH.js → chunk-WMO6RNE2.js} +1 -1
  28. package/dist/chunk-WU6ZK6YD.js +1 -0
  29. package/dist/{chunk-GIRAEVUJ.js → chunk-XH5WN5XA.js} +1 -1
  30. package/dist/chunk-XYS4FSCC.js +12 -0
  31. package/dist/chunk-YP46DVVP.js +2 -0
  32. package/dist/entry-11.js +1 -1
  33. package/dist/entry-13.js +1 -1
  34. package/dist/entry-14.js +1 -1
  35. package/dist/entry-15.js +1 -1
  36. package/dist/entry-17.js +1 -1
  37. package/dist/entry-25.js +2 -2
  38. package/dist/entry-26.js +1 -1
  39. package/dist/entry-27.js +2 -2
  40. package/dist/entry-28.js +1 -1
  41. package/dist/entry-29.js +1 -1
  42. package/dist/entry-30.js +1 -1
  43. package/dist/entry-31.js +12 -9
  44. package/dist/entry-33.js +1 -1
  45. package/dist/entry-37.js +6 -6
  46. package/dist/entry-41.js +1 -1
  47. package/dist/entry-42.js +1 -1
  48. package/dist/entry-43.js +1 -1
  49. package/dist/entry-44.js +1 -1
  50. package/dist/entry-45.js +13 -14
  51. package/dist/entry-46.js +1 -1
  52. package/dist/entry-49.js +1 -1
  53. package/dist/entry-50.js +3 -6
  54. package/dist/entry-51.js +11 -9
  55. package/dist/entry-52.js +1 -1
  56. package/dist/entry-53.js +1 -1
  57. package/dist/entry-54.js +1 -1
  58. package/dist/entry-56.js +1 -1
  59. package/dist/entry-57.js +1 -1
  60. package/dist/entry-58.js +1 -1
  61. package/dist/entry-60.js +1 -1
  62. package/dist/entry-61.js +0 -1
  63. package/dist/entry-62.js +1 -0
  64. package/dist/entry-63.js +0 -1
  65. package/dist/entry-64.js +1 -0
  66. package/dist/entry-65.js +1 -1
  67. package/dist/entry-66.js +1 -1
  68. package/dist/entry-67.js +1 -1
  69. package/dist/entry-68.js +1 -1
  70. package/dist/entry-69.js +1 -1
  71. package/dist/entry-70.js +1 -1
  72. package/dist/entry-71.js +0 -1
  73. package/dist/entry-72.js +1 -0
  74. package/dist/entry-73.js +0 -1
  75. package/dist/entry-74.js +1 -0
  76. package/dist/entry-75.js +1 -1
  77. package/dist/entry-76.js +1 -1
  78. package/dist/entry-77.js +66 -1
  79. package/dist/entry-78.js +14 -325
  80. package/dist/entry-79.js +2 -18
  81. package/dist/entry-80.js +1 -2
  82. package/dist/entry-81.js +1 -1
  83. package/dist/entry-82.js +5 -1
  84. package/dist/entry-83.js +3 -5
  85. package/dist/entry-84.js +1 -3
  86. package/dist/entry-85.js +1 -1
  87. package/dist/entry-86.js +1 -1
  88. package/dist/pi-agent-ide.js +14 -9
  89. package/docs/agent-guides/editing.md +38 -33
  90. package/docs/agent-guides/git-changes.md +1 -1
  91. package/docs/agent-guides/read-resources.md +8 -4
  92. package/docs/agent-guides/search-code.md +34 -2
  93. package/docs/agent-guides/select-code.md +115 -0
  94. package/docs/configuration.md +12 -17
  95. package/docs/development.md +2 -1
  96. package/docs/releases.md +1 -1
  97. package/docs/research/apply-native-capability-matrix.md +174 -0
  98. package/docs/research/apply-read-latency.md +2 -0
  99. package/docs/research/lpt-393-fuzzy-results/file.json +152 -0
  100. package/docs/research/lpt-393-fuzzy-results/repo.json +122 -0
  101. package/docs/research/lpt-393-search-fuzzy-fallback.md +97 -0
  102. package/docs/research/native-codemode-batch-decision.md +2 -0
  103. package/docs/research/native-codemode-batching.md +1 -1
  104. package/docs/structured-results.md +30 -38
  105. package/docs/tools.md +11 -11
  106. package/docs/user-hooks.md +1 -1
  107. package/node_modules/pi-agent-doctor/package.json +1 -1
  108. package/node_modules/pi-agent-documentation/package.json +1 -1
  109. package/node_modules/pi-agent-filesystem/index.ts +7 -6
  110. package/node_modules/pi-agent-filesystem/package.json +7 -7
  111. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  112. package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
  113. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  114. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  115. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  116. package/node_modules/pi-agent-ide-ast/package.json +15 -10
  117. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +193 -0
  118. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +59 -0
  119. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +5 -1
  120. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +204 -0
  121. package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +2 -0
  122. package/node_modules/pi-agent-ide-ast/src/extension.ts +10 -5
  123. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +184 -0
  124. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +142 -27
  125. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +104 -0
  126. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +384 -0
  127. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +41 -0
  128. package/node_modules/pi-agent-ide-ast/src/source-text.ts +92 -0
  129. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +214 -0
  130. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +268 -0
  131. package/node_modules/pi-agent-ide-changes/index.ts +6 -21
  132. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  133. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +2 -2
  134. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
  135. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  136. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  137. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  138. package/node_modules/pi-agent-ide-lsp/index.ts +5 -5
  139. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  140. package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +5 -0
  141. package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +8 -2
  142. package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +19 -0
  143. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +204 -118
  144. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +2 -17
  145. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +92 -45
  146. package/node_modules/pi-agent-image/package.json +2 -2
  147. package/node_modules/pi-agent-invariant/package.json +1 -1
  148. package/node_modules/pi-agent-pdf/package.json +2 -2
  149. package/node_modules/pi-agent-read/package.json +7 -7
  150. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  151. package/node_modules/pi-agent-read/src/api/read-parameters.ts +40 -3
  152. package/node_modules/pi-agent-read/src/api/tools/read.ts +11 -1
  153. package/node_modules/pi-agent-read/src/core/extension.ts +18 -1
  154. package/node_modules/pi-agent-read/src/core/read-core.ts +50 -35
  155. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +93 -0
  156. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +5 -3
  157. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +17 -3
  158. package/node_modules/pi-agent-resource/package.json +1 -1
  159. package/node_modules/pi-agent-resource/src/index.ts +10 -0
  160. package/node_modules/pi-agent-resource/src/result-targets.ts +407 -0
  161. package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
  162. package/node_modules/pi-agent-search/package.json +5 -5
  163. package/node_modules/pi-agent-search/src/api/fuzzy.ts +208 -0
  164. package/node_modules/pi-agent-search/src/api/presentation.ts +68 -0
  165. package/node_modules/pi-agent-search/src/api/search-parameters.ts +9 -3
  166. package/node_modules/pi-agent-search/src/api/search-scope.ts +22 -0
  167. package/node_modules/pi-agent-search/src/api/search.ts +28 -0
  168. package/node_modules/pi-agent-search/src/api/structured-result.ts +69 -14
  169. package/node_modules/pi-agent-search/src/core/extension.ts +56 -16
  170. package/node_modules/pi-agent-search/src/core/search-core.ts +9 -1
  171. package/node_modules/pi-agent-search-text/index.ts +3 -1
  172. package/node_modules/pi-agent-search-text/package.json +7 -6
  173. package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +164 -0
  174. package/node_modules/pi-agent-search-text/src/resolvers.ts +161 -30
  175. package/node_modules/pi-agent-search-text/src/scoped-search.ts +103 -0
  176. package/node_modules/pi-agent-search-text/src/search-backend.ts +104 -17
  177. package/node_modules/pi-agent-search-text/src/search-renderer.ts +89 -292
  178. package/node_modules/pi-agent-search-text/src/search-result.ts +77 -0
  179. package/node_modules/pi-agent-search-text/src/search-session.ts +96 -11
  180. package/node_modules/pi-agent-text/package.json +2 -2
  181. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  182. package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
  183. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  184. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
  185. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
  186. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  187. package/node_modules/pi-agent-text-editor/index.ts +0 -5
  188. package/node_modules/pi-agent-text-editor/package.json +26 -31
  189. package/node_modules/pi-agent-text-editor/runtime/entry-77.js +1 -0
  190. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -1
  191. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
  192. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
  193. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +4 -23
  194. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +2 -2
  195. package/node_modules/pi-agent-text-editor/src/core/extension.ts +22 -5
  196. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +29 -4
  197. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +4 -14
  198. package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +76 -0
  199. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +1 -1
  200. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +168 -0
  201. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +217 -30
  202. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +22 -0
  203. package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +78 -0
  204. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +175 -0
  205. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +86 -154
  206. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +6 -1
  207. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +0 -75
  208. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +238 -244
  209. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
  210. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +9 -11
  211. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -5
  212. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +5 -5
  213. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -7
  214. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +8 -8
  215. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +8 -3
  216. package/node_modules/pi-agent-text-editor-renderer/index.ts +1 -72
  217. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  218. package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +19 -5
  219. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
  220. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  221. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  222. package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +1 -0
  223. package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
  224. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  225. package/node_modules/pi-agent-tool-ui/src/index.ts +7 -0
  226. package/node_modules/pi-agent-tool-ui/src/result-panel.ts +298 -0
  227. package/node_modules/pi-agent-web/index.ts +7 -3
  228. package/node_modules/pi-agent-web/package.json +8 -8
  229. package/node_modules/pi-agent-web/runtime/entry-82.js +2 -0
  230. package/node_modules/pi-agent-web/src/search.ts +111 -2
  231. package/node_modules/pi-agent-web-html/package.json +3 -3
  232. package/node_modules/pi-agent-web-image/package.json +4 -4
  233. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  234. package/node_modules/pi-agent-web-text/package.json +4 -4
  235. package/package.json +35 -36
  236. package/src/composite/module-labels.ts +1 -1
  237. package/src/composite/preferences.ts +0 -5
  238. package/src/composite/text-results.ts +221 -0
  239. package/src/documentation/extension.ts +11 -9
  240. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
  241. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  242. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  243. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
  244. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  245. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  246. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  247. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +7 -3
  248. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  249. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  250. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-83.js +2 -0
  251. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  252. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  253. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  254. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +2 -0
  255. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +111 -2
  256. package/src/extensions/pi-agent-read/package.json +7 -7
  257. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  258. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +40 -3
  259. package/src/extensions/pi-agent-read/src/api/tools/read.ts +11 -1
  260. package/src/extensions/pi-agent-read/src/core/extension.ts +18 -1
  261. package/src/extensions/pi-agent-read/src/core/read-core.ts +50 -35
  262. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +93 -0
  263. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +5 -3
  264. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +17 -3
  265. package/src/extensions/pi-agent-search/package.json +5 -5
  266. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +3 -1
  267. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -6
  268. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +164 -0
  269. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +161 -30
  270. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +103 -0
  271. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +104 -17
  272. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +89 -292
  273. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +77 -0
  274. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +96 -11
  275. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +208 -0
  276. package/src/extensions/pi-agent-search/src/api/presentation.ts +68 -0
  277. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +9 -3
  278. package/src/extensions/pi-agent-search/src/api/search-scope.ts +22 -0
  279. package/src/extensions/pi-agent-search/src/api/search.ts +28 -0
  280. package/src/extensions/pi-agent-search/src/api/structured-result.ts +69 -14
  281. package/src/extensions/pi-agent-search/src/core/extension.ts +56 -16
  282. package/src/extensions/pi-agent-search/src/core/search-core.ts +9 -1
  283. package/src/extensions/pi-agent-text-editor/index.ts +0 -5
  284. package/src/extensions/pi-agent-text-editor/package.json +26 -31
  285. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  286. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
  287. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  288. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
  289. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
  290. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  291. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +1 -72
  292. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  293. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +2 -0
  294. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +19 -5
  295. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
  296. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  297. package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +1 -0
  298. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -1
  299. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
  300. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
  301. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +4 -23
  302. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +2 -2
  303. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +22 -5
  304. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +29 -4
  305. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +4 -14
  306. package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +76 -0
  307. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +1 -1
  308. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +168 -0
  309. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +217 -30
  310. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +22 -0
  311. package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +78 -0
  312. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +175 -0
  313. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +86 -154
  314. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +6 -1
  315. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +0 -75
  316. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +238 -244
  317. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
  318. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +9 -11
  319. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -5
  320. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +5 -5
  321. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -7
  322. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +8 -8
  323. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +8 -3
  324. package/src/pi-agent-ide.ts +4 -7
  325. package/src/plugins/pi-agent-ide-ast/package.json +15 -10
  326. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +193 -0
  327. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +59 -0
  328. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +5 -1
  329. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +204 -0
  330. package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +2 -0
  331. package/src/plugins/pi-agent-ide-ast/src/extension.ts +10 -5
  332. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +184 -0
  333. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +142 -27
  334. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +104 -0
  335. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +384 -0
  336. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +41 -0
  337. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +92 -0
  338. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +214 -0
  339. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +268 -0
  340. package/src/plugins/pi-agent-ide-changes/index.ts +6 -21
  341. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  342. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +2 -2
  343. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
  344. package/src/plugins/pi-agent-ide-debugger/index.ts +5 -3
  345. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +5 -3
  346. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  347. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  348. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  349. package/src/plugins/pi-agent-ide-lsp/index.ts +5 -5
  350. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  351. package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +5 -0
  352. package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +8 -2
  353. package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +19 -0
  354. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +204 -118
  355. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +2 -17
  356. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +92 -45
  357. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
  358. package/src/plugins/pi-agent-ide-terminal/src/search.ts +10 -36
  359. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -1
  360. package/src/plugins/pi-agent-ide-vision/index.ts +31 -4
  361. package/dist/chunk-2P2OGO3G.js +0 -2
  362. package/dist/chunk-5J43L2RL.js +0 -11
  363. package/dist/chunk-6EYWFBNG.js +0 -0
  364. package/dist/chunk-7AVXUV4A.js +0 -7
  365. package/dist/chunk-7WCZOO5I.js +0 -1
  366. package/dist/chunk-BAYETTZZ.js +0 -16
  367. package/dist/chunk-BVK5A7ED.js +0 -28
  368. package/dist/chunk-F7NVAC4Q.js +0 -0
  369. package/dist/chunk-FZBCKIJJ.js +0 -1
  370. package/dist/chunk-I5JLCFUX.js +0 -1
  371. package/dist/chunk-KUPHNMUK.js +0 -2
  372. package/dist/chunk-MIZAFRDR.js +0 -1
  373. package/dist/chunk-PJPA5EEE.js +0 -2
  374. package/dist/chunk-PXWDDBBC.js +0 -0
  375. package/dist/chunk-SILJ3OL4.js +0 -9
  376. package/dist/chunk-TQZBVOTT.js +0 -5
  377. package/dist/chunk-VWW3RLUX.js +0 -12
  378. package/dist/chunk-YHUTTZC6.js +0 -2
  379. package/dist/chunk-ZODCBFBL.js +0 -2
  380. package/dist/entry-87.js +0 -1
  381. package/docs/agent-guides/apply.md +0 -333
  382. package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +0 -3
  383. package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +0 -159
  384. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +0 -405
  385. package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +0 -50
  386. package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +0 -11
  387. package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +0 -203
  388. package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +0 -55
  389. package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +0 -276
  390. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +0 -13
  391. package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +0 -25
  392. package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +0 -405
  393. package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +0 -137
  394. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
  395. package/node_modules/pi-agent-text-editor/src/core/apply/structured-result.ts +0 -251
  396. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +0 -168
  397. package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +0 -942
  398. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
  399. package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +0 -1
  400. package/node_modules/pi-agent-web-text/runtime/entry-87.js +0 -2
  401. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +0 -2
  402. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +0 -2
  403. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
  404. package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +0 -2
  405. package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +0 -3
  406. package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +0 -159
  407. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +0 -405
  408. package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +0 -50
  409. package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +0 -11
  410. package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +0 -203
  411. package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +0 -55
  412. package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +0 -276
  413. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +0 -13
  414. package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +0 -25
  415. package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +0 -405
  416. package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +0 -137
  417. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
  418. package/src/extensions/pi-agent-text-editor/src/core/apply/structured-result.ts +0 -251
  419. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +0 -168
  420. package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +0 -942
  421. /package/node_modules/{pi-agent-text-editor → pi-agent-text-editor-renderer}/runtime/entry-78.js +0 -0
  422. /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-79.js +0 -0
  423. /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-81.js +0 -0
  424. /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-83.js +0 -0
  425. /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-84.js +0 -0
  426. /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-85.js +0 -0
  427. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-86.js +0 -0
  428. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-84.js +0 -0
  429. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-85.js +0 -0
  430. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-86.js +0 -0
  431. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-79.js +0 -0
@@ -1,59 +1,51 @@
1
- # Native IDE results
1
+ # Readable IDE results and private records
2
2
 
3
- Read, Search, text mutations, Apply, diff, Git index tools, and debugger creation declare an `outputSchema` and return `structuredContent`. Native Codemode receives that object. Normal calls keep their readable content and existing renderers. Renderer `details` are not a script API.
3
+ IDE tools expose readable text in direct calls and native Codemode. The existing Read views, Search anchors, edit effects and diffs remain the agent-facing output. Select shows its selected text and item references. Agents do not receive the private result records or need to inspect their fields.
4
4
 
5
- The shared envelope is:
5
+ ## Composition
6
6
 
7
- ```ts
8
- { status: "success", data: /* tool data */, errors: [] }
9
- { status: "error" | "partial", data?: /* observed data */, errors: [{ code, message, source? }] }
7
+ Each result starts with a labelled system-result envelope containing a random UUID. It is not part of a file and must not be edited or inserted into file contents.
8
+
9
+ ```js
10
+ const source = await tools.read({ path: "notes.txt" });
11
+ const matches = await tools.search({ path: source, query: "old" });
12
+ const selected = await tools.select({ path: matches, operation: { kind: "trim", side: "both" } });
13
+ text(await tools.replace({ path: selected, text: "new" }));
10
14
  ```
11
15
 
12
- `success` means the requested operation completed, including a search with no matches. `partial` means some work completed while other work failed. Output clipping is reported separately; it does not make a successful read an execution failure. `error` and `partial` set native `isError`.
16
+ Pass the unchanged result to a supported source parameter. Direct calls also accept its UUID. Store/load retains the result string across scripts in the same session. Displayed item and capture references allow narrower selections without inspecting private arrays.
13
17
 
14
- Check `status` before using data. Domain errors with structured results resolve in native Codemode; they do not automatically throw. Invalid arguments, blocked calls, and cancellation can still reject. A mutation error does not imply rollback. Check its observed effects before retrying.
18
+ A result identifies its backend-owned ranges, not the text in its preview. Shortened output does not clip a complete selection or make an incomplete selection complete. Read around a selection may show context without granting authority to edit it.
15
19
 
16
- ## Data by tool
20
+ ## Reference ownership
17
21
 
18
- - **Read:** `kind` is `text`, `bytes`, `native`, or `resources`. Text has original numbered `lines`, line endings, optional editable `anchors`, and source-level `references`. Bytes have exact `bytes: number[]`, byte offset, selected length, and total size. Native content has ordered text/image `blocks`; pass an image block to `image(...)`. Multi-source selections keep separate child resources.
19
- - **Search:** `matches` have a source, exact line/column range, optional matched text, and optional `references.line` / `references.match` selectors. Columns are zero-based UTF-16 offsets. `complete` describes the backend search; `truncated` describes the public window. `all` selectors exist only for complete registered selections. File searches return paths. Other resolvers return their documented JSON domain data under `kind: "custom"`.
20
- - **Mutations:** `operationId` identifies the call. `effect` and per-source `files` distinguish `pending`, `applied`, `not-applied`, and `unknown`. Recovery candidates, semantic action fields, and transaction receipts are included when available. Full before/after documents are not copied into receipts.
21
- - **Flush:** `operations` link final effects and errors to accepted child call IDs. It also returns per-source effects. An empty flush succeeds with no operations. A failed flush retains writes that happened and never replays accepted edits.
22
- - **Apply:** `operations` keep read and mutation outcomes in call order, including failed work. `files` and `transactions` retain committed checkpoints after a later failure. `values` contain only output explicitly requested by the script, not hidden snapshots.
23
- - **Diff:** returns source identities, equality, added/removed counts, and bounded unified diff text. It does not repeat both source documents.
24
- - **Git index tools:** return action, change selector, file, index state, observed effect, and whether it was already in the requested state.
25
- - **Debugger:** creation returns session, source, and breakpoint resource references plus configuration and status. Debugger mutation actions return selected breakpoint or evaluation fields, not full session snapshots.
22
+ The session registry issues UUIDs and maps them to source handles. A guessed or computed hash has no authority unless the registry issued that reference. UUIDs are opaque references, not content hashes or signatures.
26
23
 
27
- ## Native editor commits
24
+ The registry validates session/worktree ownership, exact full-output identity, successful source status and live snapshots. Copying a valid ID within its session is intentional reuse, not forgery. Altering the body while keeping the envelope is rejected. An ID cannot grant wider ranges than its original selection.
28
25
 
29
- Sequential local edits share original snapshots. Child success with `effect: "pending"` means accepted, not written. Await an explicit flush when the script needs the final receipt:
26
+ Changed files permanently retire old source and derived references. Restoring the old bytes does not revive them. Actual edit completions and script boundaries observe filesystem generations; retained source bytes are verified before use. Reload and session changes clear the registry.
30
27
 
31
- ```ts
32
- const found = await tools.search({ query: "old", path: "note.txt" });
33
- if (found.status !== "success") throw new Error(found.errors[0].message);
34
- const changed = await tools.replace({ path: found.data.matches[0].references.match, text: "new" });
35
- if (changed.status !== "success") throw new Error(changed.errors[0].message);
36
- const saved = await tools.flush({});
37
- text(saved);
38
- ```
28
+ Pending edits reserve source handles without granting authority to unconfirmed writes. A dependent source operation commits the batch before using such a handle. Failed or cancelled edits cannot confirm it. Independent peer edits retain their original snapshots until the common commit.
29
+
30
+ Read-only views, raw bytes, images and directory listings do not acquire text-edit authority. Their IDs can identify the resource for another read. Live shell/debugger references can be used only with their owning resource operations. File deletion supplies no reusable text selection.
39
31
 
40
- Resource-owned selectors may commit immediately rather than joining the local batch. Another tool or parent completion also commits pending local edits. The parent Codemode result records automatic commits in `details.editorBatchResults`; those reports contain receipts, not source snapshots. Ordinary script errors keep accepted independent edits. Abort and deadline discard pending edits but do not undo earlier commits.
32
+ ## Internal records
41
33
 
42
- ## Bounds and continuation
34
+ Each tool owns its validated record. Read, Search, Select, Diff, terminals, Git and debugger operations keep their own domain adapters. File edit receipts contain only operation, observed effect, file states and an optional verified selection handle. Delete omits selection fields. Flush separately records committed operation effects and errors; it does not reuse a giant resource-action schema.
43
35
 
44
- Public structured results must be finite plain JSON and fit within 1 MiB. Text windows keep at most 2,000 lines and 512 KiB of serialized line data. Raw byte windows keep at most 32,768 bytes, within the normal raw-read display budget. Registered search results keep the first 100 matches and at most 4 KiB of matched text per match.
36
+ The text registry stores only ownership, a digest of the issued text, source references, resource identities and whether the result can be consumed. It does not copy line arrays, removed file contents, image bytes or debugger records into a second ledger. Source ranges and snapshots remain in the source-target store.
45
37
 
46
- Read `continuation` is a complete next request with a resolved source and absolute offset. Follow it rather than recomputing offsets from a rendered annotation. `fullResult` identifies retained complete output when available. A huge indivisible block or invalid adapter returns an explicit error rather than a clipped success. Temporary references belong to their runtime.
38
+ The unified registration adapter omits public outputSchema. Pi's supported Codemode execution path therefore returns each tool's existing text instead of structuredContent. Public tool_result hooks register the private source metadata and return the readable text with its envelope. This does not modify Pi, rewrite scripts, add VM methods, or recognize JSON in Codemode output.
47
39
 
48
- Native structured content is not copied into stored session messages. Existing compact renderer details stay separate. Scripts that explicitly print large data still store what they print.
49
- Guides attached to native structured child calls stay on the readable parent result, even when the script prints only selected data. They do not become fields in the public data schema.
40
+ Nested image blocks are delivered on the parent Codemode result; their bytes are not printed as text. Images remain ordinary native image content.
41
+ Read's private native record contains image type and MIME metadata, not another copy of the image bytes. Large images therefore do not overflow the JSON-record budget while their native content stays unchanged.
50
42
 
51
- ## Resolver adapters
43
+ ## Errors and writes
52
44
 
53
- Search resolvers must provide `toScriptData(payload, formattedDetails)`. Select documented JSON domain fields or use `selectionData` from `pi-agent-search/api/search`. Missing adapters fail with `STRUCTURED_ADAPTER_REQUIRED`; invalid schema or non-JSON values fail with `INVALID_STRUCTURED_RESULT`. Neither case falls back to display-text parsing or raw payload dumping.
45
+ Failed tools reject in Codemode. Use try/catch or Promise.allSettled when independent calls may fail. Inspect the readable file/operation effects and final parent result before retrying. An error does not prove rollback.
54
46
 
55
- Standard Read Resources use the core text/bytes/native projection. Read handlers that return their own result must supply `script: ReadScriptData`; custom content needs an explicit supported projection. Source-level references and line anchors come from presenters, not parsed annotations.
47
+ Flush commits writes, not final formatting. Final post-edit processing can retire earlier snapshots. Ordinary script errors keep accepted edits; abort/deadline discards pending writes, not already committed batches.
56
48
 
57
- The shared validation helpers live in `pi-agent-resource`. Read and Search export their data/output schemas through their existing public tool APIs. Text mutation schemas and `structuredMutation` are exported through `pi-agent-text-editor/api/mutation-result`.
49
+ After an exact-text selector fails, the tool returns current anchors and blocks further exact-text edits for that file. Use a current anchor for the next successful edit. Exact text is then available again.
58
50
 
59
- Shell command results keep their separate native process contract. This change does not add a shared result store, cross-session handles, binary editing, or a new Apply interpreter.
51
+ See [editing](./agent-guides/editing.md), [Read](./agent-guides/read-resources.md) and [Select](./agent-guides/select-code.md) for their source and boundary contracts.
package/docs/tools.md CHANGED
@@ -4,9 +4,9 @@ Pi Agent IDE explores a small tool surface for coding agents. The goal is to kee
4
4
 
5
5
  The project is experimental. The behavior below describes the current implementation, not a performance guarantee.
6
6
 
7
- ## Native structured results
7
+ ## Readable results and composition
8
8
 
9
- IDE tools declare native result schemas. Codemode receives typed data and explicit success/error/partial outcomes instead of display strings. Check status and mutation effects before continuing or retrying. See [Native IDE results](./structured-results.md) for fields, resolver adapters, bounds, and `tools.flush({})`.
9
+ IDE tools return readable text in direct calls and Codemode. A leading system-result envelope carries a registered UUID; it is not file content. Pass the unchanged result to another source parameter, or use its UUID in a direct call. The system resolves the private source records. Check the readable file effects before retrying failed edits. See [IDE result composition](./structured-results.md) for reference lifetime and `tools.flush({})`.
10
10
 
11
11
  ## Resource references
12
12
 
@@ -52,7 +52,7 @@ When `path` is a typed text resource, `read` returns one independent chunk for e
52
52
 
53
53
  Use `read({path: "raw:sample.bin", offset: 0, limit: 64})` to inspect original local file bytes, including PDF and image headers. In `raw:` mode only, offset is zero-based in bytes (negative from EOF), and limit is a non-negative byte count. The output shows hexadecimal offsets, hex bytes, and printable ASCII. Follow its returned byte offset to continue. No views or text anchors apply.
54
54
 
55
- Inside Apply, the same call returns `kind: "bytes"`, `source`, `byteOffset`, `byteLength`, `totalBytes`, `bytes: number[]`, and `ok`. The script receives the complete selected range; the displayed answer stays bounded. Use `result(doc)` to retain the hex view rather than printing the byte array. This is read-only; byte editing and byte diff are not included.
55
+ Codemode receives the same bounded hex view as a direct call. Use `text(result)` or return it to display that view. Follow the displayed offset or continuation reference. This is read-only; byte editing and byte diff are not included.
56
56
 
57
57
  ### Diagnostic completion
58
58
 
@@ -76,16 +76,12 @@ Window and display capture use `node-screenshots` on Linux and macOS. Desktop or
76
76
 
77
77
  ## Terminal sessions
78
78
 
79
- Native Codemode scripts receive a structured shell result. `output` holds up to 1 MiB of ANSI-free PTY output; empty output is `""`. Longer logs keep their first and last 512 KiB, cut at UTF-8 character boundaries. `truncated` reports missing output, not whether the process has finished. `output_ranges` gives the zero-based, end-exclusive byte ranges joined into `output`, with no added headings or omission marker. `full_output_path` points to the UTF-8 log, which keeps growing while the process runs and stays available until the session is deleted.
80
-
81
- The native fields `exit_code` and `wall_time_seconds` describe the process, not tool transport. `exit_code` is absent until known. IDE fields `session`, `source`, `status`, `background`, `wait_reason`, `completion_reason`, `signal`, and `error` describe the persistent session. A wait timeout leaves a running session, not a failed command. Nonzero exits and shell startup failures still return structured data to scripts. Normal model output and stored renderer details keep the shorter terminal preview limits.
79
+ Codemode receives the same readable shell status and output as direct calls. The result includes its session source and a reference to the complete log when output is shortened. A wait timeout leaves a running session, not a failed command. Inspect the reported exit status and effects; failed tools can reject.
82
80
 
83
81
  ```ts
84
82
  const result = await tools.bash({ command: "your-command" });
85
- text({
86
- status: result.status,
87
- errors: result.output.split("\n").filter((line) => line.includes("error")),
88
- });
83
+ text(result);
84
+ text(await tools.read({ path: result }));
89
85
  ```
90
86
 
91
87
  `bash` (Linux/WSL) or `powershell` (Windows) starts a command in the user's configured system shell. Its schema and prompt guidance name that shell at runtime, so the agent writes Bash, zsh, PowerShell, or Command Prompt syntax as appropriate. Commands are not translated between shell languages.
@@ -93,7 +89,7 @@ text({
93
89
  Every run returns a stable `shell:<session>` source. Synchronous runs wait for the real exit status. Background runs return immediately, remain visible below the editor, and send one completion message that wakes the agent; nearby completions are combined without losing individual results. `/terminals` opens the active and recent session overlay.
94
90
  The UI tab in `/agent-ide-settings` controls persistent active-terminal presentation: Detailed cards (default), Compact count, or Off. Detailed cards replace the separate active count instead of showing both. This setting does not hide ordinary run results or completion messages.
95
91
 
96
- Use `read` on the returned source for status and bounded output. Compact cards show the latest 12 output rows and count omitted earlier rows; expanded cards show all retained rows. Add `views: ["image"]` to receive a PNG of the ANSI-aware virtual terminal screen. Use `write` to send exact text without Enter. Use `insert` for named keys and chords such as `Enter`, `Ctrl+C`, `Ctrl+Shift+Left`, or Unix caret controls such as `^U`; separate multiple keys with spaces or commas. Batched `apply` calls can send several terminal inputs without file formatting or diagnostics. Use `search` with the `shell:<session>` path to search retained output, including rows outside the current screen. `delete` terminates the owned process tree when needed, disposes the virtual screen, and removes the session. `replace` does not apply to terminal sessions.
92
+ Use `read` on the returned source for status and bounded output. Compact cards show the latest 12 output rows and count omitted earlier rows; expanded cards show all retained rows. Add `views: ["image"]` to receive a PNG of the ANSI-aware virtual terminal screen. Use `write` to send exact text without Enter. Use `insert` for named keys and chords such as `Enter`, `Ctrl+C`, `Ctrl+Shift+Left`, or Unix caret controls such as `^U`; separate multiple keys with spaces or commas. A native Codemode script can send several terminal inputs without file formatting or diagnostics. Use `search` with the `shell:<session>` path to search retained output, including rows outside the current screen. `delete` terminates the owned process tree when needed, disposes the virtual screen, and removes the session. `replace` does not apply to terminal sessions.
97
93
 
98
94
  Deleting an active session first requests graceful termination, then forcefully terminates its process tree after the grace period. Deletion does not undo file or network effects. Sessions survive extension reloads in the current Pi process. Shutdown stops live processes; sessions are not reattached after restart.
99
95
 
@@ -108,6 +104,10 @@ A resolver decides whether it understands a query. The first successful resolver
108
104
 
109
105
  Local text search tries literal terms first. If there are no matches, it retries unquoted terms as regex. If that also finds nothing, an ordinary multi-word query falls back to separate words. Each fallback is reported. Invalid optional regex is skipped, while I/O errors, cancellation, and regex runtime errors stay errors. `regex:<pattern>` forces regex-only matching and reports invalid patterns.
110
106
 
107
+ After all ordinary attempts finish with zero matches, a single unquoted ASCII identifier can return separate possible-name groups. They cover naming-style changes, one extra or missing edge component, and small typos, strongest first. Each name is verified exactly in the same scope. These are spelling suggestions, not synonyms, automatic corrections, or proof of equivalent behavior. Quoted, Boolean, explicit regex and other protocol queries do not use this branch.
108
+
109
+ Local groups provide current Read selections; a complete candidate all-reference refreshes only its exact alternative. URL groups reuse the already converted page text and provide URL line ranges without editable Search references. Name collection, capture and output have fixed budgets; a skip or limited capture is explicit. Narrow the scope if a budget is reached.
110
+
111
111
  Boolean queries keep their conditions across literal and regex attempts. They support uppercase `AND`, `OR`, infix `NOT`, `||`, and space-separated `|`. Adjacent terms imply `AND`; `AND` and `NOT` bind more tightly than `OR`. Parentheses containing Boolean operators group conditions. Regex groups, classes, and escapes stay inside terms: `(?:foo|bar)\d+ AND "keep.me" NOT ignored`. An unspaced `foo|bar` is searched as literal text first, then as regex alternatives. Single or double quotes keep a term literal in every attempt. Quoted and Boolean queries never fall back to separate words. Invalid Boolean expressions report the source column and expected syntax.
112
112
 
113
113
  Empty protocol queries such as `symbols:` and unhandled prefixes such as `unknown:needle` search their original text, including the prefix. The tool reports this fallback. Nonempty installed protocols keep their specialized behavior; service errors, timeouts, and successful protocol searches with no results do not launch local text search. Plugins mark a local fallback resolver with `fallback: true`; these resolvers run after specialists regardless of numeric priority and receive empty protocol queries directly.
@@ -43,7 +43,7 @@ export default function (pi: ExtensionAPI) {
43
43
  }
44
44
  ```
45
45
 
46
- The hook receives one complete plan after Resource and anchor resolution but before the first write. It covers standalone mutation tools and Apply. A denial or thrown error leaves every Resource unchanged.
46
+ The hook receives one complete plan after Resource and anchor resolution but before the first write. It covers standalone mutation tools, including calls through native Codemode. A denial or thrown error leaves every Resource unchanged.
47
47
 
48
48
  ## Check saved edits
49
49
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-doctor",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-documentation",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -36,12 +36,13 @@ export default async function registerFilesystemPlugin(pi: ExtensionAPI): Promis
36
36
  renderResult: renderReadResult,
37
37
  recoverFailure: recoverFilesystemPath,
38
38
  });
39
- api.describe(() =>
40
- renderContentDescription(
41
- "File path — file content; directory path — entry listing. Relative, absolute and file:// paths accepted.",
42
- readHost.listDescriptions(),
43
- ),
44
- );
39
+ api.describe({
40
+ path: () =>
41
+ renderContentDescription(
42
+ "File path — file content; directory path — entry listing. Relative, absolute and file:// paths accepted.",
43
+ readHost.listDescriptions(),
44
+ ),
45
+ });
45
46
  },
46
47
  } satisfies ReadPlugin;
47
48
  const textEditorPlugin = {
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-image": "0.6.4",
10
- "pi-agent-invariant": "0.6.4",
11
- "pi-agent-read": "0.6.4",
12
- "pi-agent-resource": "0.6.4",
13
- "pi-agent-text": "0.6.4",
14
- "pi-agent-text-editor": "0.6.4"
9
+ "pi-agent-image": "0.7.1",
10
+ "pi-agent-invariant": "0.7.1",
11
+ "pi-agent-read": "0.7.1",
12
+ "pi-agent-resource": "0.7.1",
13
+ "pi-agent-text": "0.7.1",
14
+ "pi-agent-text-editor": "0.7.1"
15
15
  },
16
16
  "pi": {
17
17
  "extensions": [
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem-image",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#extension": "./index.ts"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-image": "0.6.4",
10
- "pi-agent-resource": "0.6.4"
9
+ "pi-agent-image": "0.7.1",
10
+ "pi-agent-resource": "0.7.1"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
@@ -71,9 +71,10 @@ const readPlugin = {
71
71
  return { kind: "continue", context: { ...context, state: transformed } };
72
72
  },
73
73
  });
74
- api.describe(
75
- 'JSON files accept views such as ["jq:.scripts | keys"] to query them with the installed jq executable.',
76
- );
74
+ api.describe({
75
+ views:
76
+ 'jq:<filter> — query local JSON text with the installed jq executable, e.g. ["jq:.scripts | keys"]. Exactly one non-empty jq filter is required; it cannot be combined with other views. offset/limit apply to the transformed output, not original source lines.',
77
+ });
77
78
  },
78
79
  } satisfies ReadPlugin;
79
80
 
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem-jq",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
9
  "cross-spawn": "^7.0.6",
10
- "pi-agent-doctor": "0.6.4",
11
- "pi-agent-documentation": "0.6.4",
12
- "pi-agent-read": "0.6.4",
13
- "pi-agent-text": "0.6.4"
10
+ "pi-agent-doctor": "0.7.1",
11
+ "pi-agent-documentation": "0.7.1",
12
+ "pi-agent-read": "0.7.1",
13
+ "pi-agent-text": "0.7.1"
14
14
  },
15
15
  "pi": {
16
16
  "extensions": [
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem-pdf",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-pdf": "0.6.4",
7
- "pi-agent-resource": "0.6.4"
6
+ "pi-agent-pdf": "0.7.1",
7
+ "pi-agent-resource": "0.7.1"
8
8
  },
9
9
  "pi": {
10
10
  "extensions": [
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem-text",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#extension": "./index.ts"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-resource": "0.6.4",
10
- "pi-agent-text": "0.6.4"
9
+ "pi-agent-resource": "0.7.1",
10
+ "pi-agent-text": "0.7.1"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-ide-ast",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -31,14 +31,17 @@
31
31
  "@tree-sitter-grammars/tree-sitter-toml": "^0.7.0",
32
32
  "@tree-sitter-grammars/tree-sitter-yaml": "^0.7.1",
33
33
  "cross-spawn": "^7.0.6",
34
- "pi-agent-doctor": "0.6.4",
35
- "pi-agent-invariant": "0.6.4",
36
- "pi-agent-read": "0.6.4",
37
- "pi-agent-resource": "0.6.4",
38
- "pi-agent-search": "0.6.4",
39
- "pi-agent-search-text": "0.6.4",
40
- "pi-agent-text": "0.6.4",
41
- "pi-agent-text-editor": "0.6.4",
34
+ "pi-agent-doctor": "0.7.1",
35
+ "pi-agent-documentation": "0.7.1",
36
+ "pi-agent-invariant": "0.7.1",
37
+ "pi-agent-read": "0.7.1",
38
+ "pi-agent-resource": "0.7.1",
39
+ "pi-agent-search": "0.7.1",
40
+ "pi-agent-search-text": "0.7.1",
41
+ "pi-agent-text": "0.7.1",
42
+ "pi-agent-text-editor": "0.7.1",
43
+ "pi-agent-tool-call-interception": "0.7.1",
44
+ "pi-agent-tool-ui": "0.7.1",
42
45
  "tree-sitter-cpp": "^0.23.4",
43
46
  "tree-sitter-javascript": "^0.25.0",
44
47
  "tree-sitter-json": "^0.24.8",
@@ -54,7 +57,9 @@
54
57
  },
55
58
  "peerDependencies": {
56
59
  "@earendil-works/pi-coding-agent": "*",
57
- "pi-agent-ide": "0.6.4"
60
+ "@earendil-works/pi-tui": "*",
61
+ "pi-agent-ide": "0.7.1",
62
+ "typebox": "*"
58
63
  },
59
64
  "peerDependenciesMeta": {
60
65
  "pi-agent-ide": {
@@ -0,0 +1,193 @@
1
+ import type { AstObject, AstPart } from "#src/select-schema.js";
2
+ import { SelectionError } from "#src/selection-region.js";
3
+ import type { SyntaxNode } from "./syntax-tree.js";
4
+
5
+ const categories: Readonly<Record<string, AstObject>> = {
6
+ function_declaration: "function",
7
+ generator_function_declaration: "function",
8
+ function_expression: "function",
9
+ generator_function: "function",
10
+ arrow_function: "function",
11
+ method_definition: "function",
12
+ function_signature: "function",
13
+ method_signature: "function",
14
+ abstract_method_signature: "function",
15
+ call_expression: "call",
16
+ new_expression: "call",
17
+ class_declaration: "class",
18
+ class: "class",
19
+ abstract_class_declaration: "class",
20
+ if_statement: "if",
21
+ switch_statement: "switch",
22
+ for_statement: "loop",
23
+ for_in_statement: "loop",
24
+ while_statement: "loop",
25
+ do_statement: "loop",
26
+ try_statement: "try",
27
+ catch_clause: "catch",
28
+ variable_declarator: "binding",
29
+ assignment_expression: "assignment",
30
+ augmented_assignment_expression: "assignment",
31
+ object: "object",
32
+ object_pattern: "object",
33
+ pair: "property",
34
+ pair_pattern: "property",
35
+ shorthand_property_identifier: "property",
36
+ shorthand_property_identifier_pattern: "property",
37
+ array: "array",
38
+ array_pattern: "array",
39
+ return_statement: "return",
40
+ throw_statement: "throw",
41
+ };
42
+
43
+ /** One document-local syntax node with stable parent identity, not a persistent second tree store. */
44
+ export interface ConstructNode {
45
+ readonly node: SyntaxNode;
46
+ readonly object: AstObject | undefined;
47
+ readonly parent: ConstructNode | undefined;
48
+ readonly children: ConstructNode[];
49
+ }
50
+
51
+ /** Index existing named syntax nodes once; do not expose parser-only wrapper names to callers. */
52
+ export function constructIndex(root: SyntaxNode, signal?: AbortSignal): ConstructNode[] {
53
+ const nodes: ConstructNode[] = [];
54
+ const pending: Array<{ node: SyntaxNode; parent: ConstructNode | undefined }> = [
55
+ { node: root, parent: undefined },
56
+ ];
57
+ while (pending.length) {
58
+ signal?.throwIfAborted();
59
+ const current = pending.pop();
60
+ if (!current) continue;
61
+ const indexed: ConstructNode = {
62
+ node: current.node,
63
+ object: categories[current.node.type],
64
+ parent: current.parent,
65
+ children: [],
66
+ };
67
+ current.parent?.children.push(indexed);
68
+ nodes.push(indexed);
69
+ for (const node of current.node.namedChildren.toReversed())
70
+ pending.push({ node, parent: indexed });
71
+ }
72
+ return nodes;
73
+ }
74
+
75
+ /** Find the nearest recognized parent without changing topology for a category filter. */
76
+ export function constructParent(input: ConstructNode): ConstructNode | undefined {
77
+ let parent = input.parent;
78
+ while (parent && !parent.object) parent = parent.parent;
79
+ return parent;
80
+ }
81
+
82
+ /** Return direct construct children or all descendants, skipping syntax-only wrappers. */
83
+ export function constructChildren(
84
+ input: ConstructNode,
85
+ all: boolean,
86
+ signal?: AbortSignal,
87
+ ): ConstructNode[] {
88
+ const nodes: ConstructNode[] = [];
89
+ const pending = [...input.children].reverse();
90
+ while (pending.length) {
91
+ signal?.throwIfAborted();
92
+ const node = pending.pop();
93
+ if (!node) continue;
94
+ if (node.object) nodes.push(node);
95
+ if (all || !node.object) pending.push(...node.children.toReversed());
96
+ }
97
+ return nodes;
98
+ }
99
+
100
+ type PartFields = readonly (readonly [AstPart, readonly string[]])[];
101
+ const parts: Readonly<Record<AstObject, PartFields>> = {
102
+ function: [
103
+ ["name", ["name"]],
104
+ ["body", ["body"]],
105
+ ["parameters", ["parameters", "parameter"]],
106
+ ["returnType", ["return_type"]],
107
+ ],
108
+ call: [
109
+ ["callee", ["function", "constructor"]],
110
+ ["arguments", ["arguments"]],
111
+ ],
112
+ class: [
113
+ ["name", ["name"]],
114
+ ["body", ["body"]],
115
+ ],
116
+ if: [
117
+ ["condition", ["condition"]],
118
+ ["then", ["consequence"]],
119
+ ["else", ["alternative"]],
120
+ ],
121
+ switch: [
122
+ ["condition", ["value"]],
123
+ ["body", ["body"]],
124
+ ],
125
+ loop: [
126
+ ["condition", ["condition"]],
127
+ ["body", ["body"]],
128
+ ],
129
+ try: [
130
+ ["body", ["body"]],
131
+ ["handler", ["handler"]],
132
+ ["finalizer", ["finalizer"]],
133
+ ],
134
+ catch: [
135
+ ["body", ["body"]],
136
+ ["parameter", ["parameter"]],
137
+ ],
138
+ binding: [
139
+ ["name", ["name"]],
140
+ ["type", ["type"]],
141
+ ["value", ["value"]],
142
+ ],
143
+ assignment: [
144
+ ["left", ["left"]],
145
+ ["right", ["right"]],
146
+ ],
147
+ property: [
148
+ ["key", ["key"]],
149
+ ["value", ["value"]],
150
+ ],
151
+ return: [["value", []]],
152
+ throw: [["value", []]],
153
+ object: [],
154
+ array: [],
155
+ };
156
+ /** Publish only parts that have an explicit meaning for this construct form. */
157
+ function partFields(input: ConstructNode): PartFields {
158
+ if (input.node.type === "for_statement")
159
+ return [
160
+ ["initializer", ["initializer"]],
161
+ ["condition", ["condition"]],
162
+ ["update", ["increment"]],
163
+ ["body", ["body"]],
164
+ ];
165
+ if (input.node.type === "for_in_statement")
166
+ return [
167
+ ["left", ["left"]],
168
+ ["iterable", ["right"]],
169
+ ["body", ["body"]],
170
+ ];
171
+ if (input.node.type === "finally_clause") return [["body", ["body"]]];
172
+ return input.object ? parts[input.object] : [];
173
+ }
174
+
175
+ /** Select provider-derived parts exactly; optional absence is different from an unsupported request. */
176
+ export function constructPart(input: ConstructNode, part: AstPart): SyntaxNode | undefined {
177
+ const available = partFields(input);
178
+ const fields = available.find(([name]) => name === part)?.[1];
179
+ if (!fields)
180
+ throw new SelectionError(
181
+ "UNSUPPORTED_PART",
182
+ `Unsupported part ${part} for ${input.object ?? "this syntax container"}; supported parts: ${available.map(([name]) => name).join(", ") || "none"}. Use navigate children/descendants for nested constructs.`,
183
+ );
184
+ if (input.object === "property" && input.node.type.startsWith("shorthand_property_identifier"))
185
+ return input.node;
186
+ if (input.object === "return" || input.object === "throw")
187
+ return input.node.namedChildren.find((node) => node.type !== "comment");
188
+ for (const field of fields) {
189
+ const node = input.node.childForFieldName(field);
190
+ if (node) return node;
191
+ }
192
+ return undefined;
193
+ }