pi-agent-ide 0.8.4 → 0.9.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 (649) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +24 -29
  3. package/dist/{chunk-CM3XGY72.js → chunk-2AY526TN.js} +1 -1
  4. package/dist/{chunk-LEJKDYCK.js → chunk-2TZDG2JH.js} +1 -1
  5. package/dist/{chunk-DUUOCBS3.js → chunk-35LZOKEW.js} +1 -1
  6. package/dist/chunk-3LVBARLW.js +33 -0
  7. package/dist/{chunk-XBQR74IK.js → chunk-4GBFIGH3.js} +1 -1
  8. package/dist/{chunk-PJL3UVMJ.js → chunk-4IWEKRSP.js} +1 -1
  9. package/dist/chunk-52PFWQMU.js +5 -0
  10. package/dist/chunk-5BGWNYQS.js +1 -0
  11. package/dist/chunk-5PC5INOL.js +1 -0
  12. package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
  13. package/dist/{chunk-XAHU42FP.js → chunk-6A3ORNW3.js} +2 -2
  14. package/dist/{chunk-ANM3Y5FO.js → chunk-6WCHBHFW.js} +5 -5
  15. package/dist/{chunk-IMGIDBCC.js → chunk-7D7PXIVV.js} +1 -1
  16. package/dist/chunk-7PVDTMEM.js +1 -0
  17. package/dist/chunk-AMIIOWFL.js +1 -0
  18. package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
  19. package/dist/chunk-BT2CFM7D.js +11 -0
  20. package/dist/chunk-C2JT2G5K.js +1 -0
  21. package/dist/chunk-DDH3FP4G.js +3 -0
  22. package/dist/{chunk-6T7PSDQW.js → chunk-DVNL5NZE.js} +1 -1
  23. package/dist/chunk-FEZLTM4L.js +1 -0
  24. package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
  25. package/dist/chunk-FXPY3V4L.js +10 -0
  26. package/dist/chunk-FYOU4RBH.js +2 -0
  27. package/dist/chunk-G4PRFO6G.js +1 -0
  28. package/dist/chunk-GS5ZRTUG.js +1 -0
  29. package/dist/{chunk-XXLLY66B.js → chunk-GXL4NMHR.js} +1 -1
  30. package/dist/{chunk-QT3EAHOG.js → chunk-H3GEEOOL.js} +1 -1
  31. package/dist/chunk-H5Z54BEU.js +25 -0
  32. package/dist/chunk-H7WAM5RH.js +23 -0
  33. package/dist/{chunk-Z2MNHSJ4.js → chunk-HGCJDIRR.js} +1 -1
  34. package/dist/chunk-HISGZD3C.js +81 -0
  35. package/dist/chunk-HKYVP2Q6.js +3 -0
  36. package/dist/chunk-HRBUY2FF.js +4 -0
  37. package/dist/chunk-IG5DXVDJ.js +1 -0
  38. package/dist/chunk-IOGWZNWT.js +1 -0
  39. package/dist/chunk-IUJUECXH.js +9 -0
  40. package/dist/chunk-KN6VPARZ.js +1 -0
  41. package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
  42. package/dist/chunk-LXDF2NWX.js +1 -0
  43. package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
  44. package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
  45. package/dist/chunk-MPNE25CY.js +5 -0
  46. package/dist/chunk-NA2NEU4V.js +1 -0
  47. package/dist/{chunk-ZJQRLVVV.js → chunk-O7V6G3OO.js} +1 -1
  48. package/dist/chunk-OBTT5INC.js +6 -0
  49. package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
  50. package/dist/chunk-OUCVZBOR.js +28 -0
  51. package/dist/chunk-PCGBM2D6.js +17 -0
  52. package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
  53. package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
  54. package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
  55. package/dist/chunk-RIOPUTUJ.js +6 -0
  56. package/dist/{chunk-RMI3NMQY.js → chunk-RIZARTUM.js} +2 -2
  57. package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
  58. package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
  59. package/dist/chunk-T3Z4KXOX.js +2 -0
  60. package/dist/chunk-TSQ6FBTB.js +1 -0
  61. package/dist/chunk-U7YDLVFL.js +1 -0
  62. package/dist/{chunk-KZC7TI5M.js → chunk-UD3DMY3Q.js} +1 -1
  63. package/dist/{chunk-VXP5BMW7.js → chunk-USG6WHAT.js} +1 -1
  64. package/dist/{chunk-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
  65. package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
  66. package/dist/chunk-VNWGT367.js +1 -0
  67. package/dist/chunk-WAJW4G4F.js +22 -0
  68. package/dist/chunk-WEE3NM6L.js +1 -0
  69. package/dist/{chunk-IM24DB3K.js → chunk-WES2E4VR.js} +1 -1
  70. package/dist/{chunk-RIJMXO43.js → chunk-WQIMM4SU.js} +1 -1
  71. package/dist/chunk-X2WFNMQR.js +9 -0
  72. package/dist/chunk-XCPIIDFS.js +4 -0
  73. package/dist/chunk-XE4W5YTE.js +2 -0
  74. package/dist/chunk-XUYIK4TX.js +1 -0
  75. package/dist/{chunk-AAC77UD4.js → chunk-YPYROPQF.js} +1 -1
  76. package/dist/chunk-ZXO4D5UB.js +1 -0
  77. package/dist/entry-0.js +1 -1
  78. package/dist/entry-1.js +1 -1
  79. package/dist/entry-10.js +1 -1
  80. package/dist/entry-11.js +1 -1
  81. package/dist/entry-12.js +1 -1
  82. package/dist/entry-13.js +1 -1
  83. package/dist/entry-14.js +1 -1
  84. package/dist/entry-15.js +1 -1
  85. package/dist/entry-16.js +1 -1
  86. package/dist/entry-17.js +1 -1
  87. package/dist/entry-18.js +1 -1
  88. package/dist/entry-19.js +1 -1
  89. package/dist/entry-2.js +1 -1
  90. package/dist/entry-20.js +1 -1
  91. package/dist/entry-21.js +1 -0
  92. package/dist/entry-22.js +1 -1
  93. package/dist/entry-24.js +1 -1
  94. package/dist/entry-25.js +1 -1
  95. package/dist/entry-26.js +1 -1
  96. package/dist/entry-27.js +1 -1
  97. package/dist/entry-28.js +1 -1
  98. package/dist/entry-29.js +1 -2
  99. package/dist/entry-3.js +1 -1
  100. package/dist/entry-30.js +1 -1
  101. package/dist/entry-31.js +2 -4
  102. package/dist/entry-32.js +1 -1
  103. package/dist/entry-33.js +1 -1
  104. package/dist/entry-34.js +1 -1
  105. package/dist/entry-35.js +1 -18
  106. package/dist/entry-36.js +1 -1
  107. package/dist/entry-37.js +1 -1
  108. package/dist/entry-38.js +15 -1
  109. package/dist/entry-39.js +1 -1
  110. package/dist/entry-4.js +1 -1
  111. package/dist/entry-40.js +1 -1
  112. package/dist/entry-41.js +1 -1
  113. package/dist/entry-42.js +1 -1
  114. package/dist/entry-43.js +1 -1
  115. package/dist/entry-44.js +1 -1
  116. package/dist/entry-45.js +1 -1
  117. package/dist/entry-46.js +1 -1
  118. package/dist/entry-47.js +1 -1
  119. package/dist/entry-48.js +1 -1
  120. package/dist/entry-49.js +1 -25
  121. package/dist/entry-5.js +1 -1
  122. package/dist/entry-50.js +1 -1
  123. package/dist/entry-51.js +1 -1
  124. package/dist/entry-52.js +1 -1
  125. package/dist/entry-53.js +1 -1
  126. package/dist/entry-54.js +1 -3
  127. package/dist/entry-55.js +1 -13
  128. package/dist/entry-56.js +1 -1
  129. package/dist/entry-57.js +1 -1
  130. package/dist/entry-58.js +1 -1
  131. package/dist/entry-59.js +1 -1
  132. package/dist/entry-6.js +1 -1
  133. package/dist/entry-60.js +1 -1
  134. package/dist/entry-61.js +1 -1
  135. package/dist/entry-62.js +1 -1
  136. package/dist/entry-63.js +1 -1
  137. package/dist/entry-64.js +1 -1
  138. package/dist/entry-65.js +1 -0
  139. package/dist/entry-66.js +1 -1
  140. package/dist/entry-67.js +1 -0
  141. package/dist/entry-68.js +0 -1
  142. package/dist/entry-69.js +1 -1
  143. package/dist/entry-7.js +1 -1
  144. package/dist/entry-70.js +0 -1
  145. package/dist/entry-71.js +1 -1
  146. package/dist/entry-72.js +1 -1
  147. package/dist/entry-73.js +1 -1
  148. package/dist/entry-74.js +1 -1
  149. package/dist/entry-75.js +1 -0
  150. package/dist/entry-76.js +1 -1
  151. package/dist/entry-77.js +1 -0
  152. package/dist/entry-78.js +0 -1
  153. package/dist/entry-79.js +1 -1
  154. package/dist/entry-8.js +1 -1
  155. package/dist/entry-80.js +0 -1
  156. package/dist/entry-81.js +1 -80
  157. package/dist/entry-82.js +1 -22
  158. package/dist/entry-83.js +1 -2
  159. package/dist/entry-84.js +1 -1
  160. package/dist/entry-85.js +1 -1
  161. package/dist/entry-86.js +2 -1
  162. package/dist/entry-87.js +1 -1
  163. package/dist/entry-88.js +1 -3
  164. package/dist/entry-89.js +1 -1
  165. package/dist/entry-9.js +1 -1
  166. package/dist/entry-90.js +1 -1
  167. package/dist/entry-91.js +3 -1
  168. package/dist/entry-92.js +1 -0
  169. package/dist/entry-93.js +1 -0
  170. package/dist/entry-94.js +1 -0
  171. package/dist/pi-agent-ide.js +13 -34
  172. package/docs/agent-guides/ast-search.md +58 -0
  173. package/docs/agent-guides/debugger.md +1 -1
  174. package/docs/agent-guides/editing.md +29 -58
  175. package/docs/agent-guides/git-changes.md +4 -14
  176. package/docs/agent-guides/search.md +38 -0
  177. package/docs/agent-guides/ssh.md +17 -49
  178. package/docs/agent-guides/terminal.md +9 -15
  179. package/docs/configuration.md +9 -13
  180. package/docs/extensions.md +82 -0
  181. package/docs/settings-help.md +2 -2
  182. package/docs/structured-results.md +33 -11
  183. package/docs/tools.md +24 -23
  184. package/node_modules/pi-agent-doctor/package.json +7 -7
  185. package/node_modules/pi-agent-doctor/runtime/entry-29.js +1 -0
  186. package/node_modules/pi-agent-doctor/src/workspace.ts +0 -5
  187. package/node_modules/pi-agent-documentation/package.json +2 -2
  188. package/node_modules/pi-agent-documentation/runtime/entry-30.js +1 -0
  189. package/node_modules/pi-agent-documentation/src/index.ts +26 -10
  190. package/node_modules/pi-agent-filesystem/index.ts +1 -1
  191. package/node_modules/pi-agent-filesystem/package.json +8 -8
  192. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  193. package/node_modules/pi-agent-filesystem-jq/index.ts +9 -63
  194. package/node_modules/pi-agent-filesystem-jq/package.json +12 -6
  195. package/node_modules/pi-agent-filesystem-jq/runtime/entry-33.js +1 -0
  196. package/node_modules/pi-agent-filesystem-jq/runtime/entry-34.js +2 -0
  197. package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  198. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  199. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  200. package/node_modules/pi-agent-filesystem-text/runtime/entry-36.js +2 -0
  201. package/node_modules/pi-agent-ide-ast/package.json +15 -15
  202. package/node_modules/pi-agent-ide-ast/runtime/entry-37.js +1 -0
  203. package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
  204. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  205. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  206. package/node_modules/pi-agent-ide-changes/index.ts +1 -2
  207. package/node_modules/pi-agent-ide-changes/package.json +10 -10
  208. package/node_modules/pi-agent-ide-changes/runtime/entry-39.js +1 -0
  209. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  210. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  211. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  212. package/node_modules/pi-agent-ide-languages/runtime/entry-42.js +2 -0
  213. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  214. package/node_modules/pi-agent-ide-lint/runtime/entry-43.js +2 -0
  215. package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
  216. package/node_modules/pi-agent-ide-lsp/package.json +14 -10
  217. package/node_modules/pi-agent-ide-lsp/runtime/entry-44.js +2 -0
  218. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  219. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  220. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  221. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  222. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  223. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  224. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  225. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  226. package/node_modules/pi-agent-image/package.json +3 -3
  227. package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
  228. package/node_modules/pi-agent-invariant/package.json +2 -2
  229. package/node_modules/pi-agent-pdf/package.json +3 -3
  230. package/node_modules/pi-agent-pdf/src/pdf-converter.ts +23 -1
  231. package/node_modules/pi-agent-read/package.json +12 -12
  232. package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
  233. package/node_modules/pi-agent-read/runtime/entry-52.js +2 -0
  234. package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
  235. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
  236. package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
  237. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  238. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  239. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  240. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  241. package/node_modules/pi-agent-resource/package.json +2 -2
  242. package/node_modules/pi-agent-resource/src/index.ts +8 -0
  243. package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
  244. package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
  245. package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
  246. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
  247. package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
  248. package/node_modules/pi-agent-search/package.json +9 -9
  249. package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
  250. package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
  251. package/node_modules/pi-agent-search/runtime/entry-57.js +2 -0
  252. package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
  253. package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
  254. package/node_modules/pi-agent-search/src/api/search.ts +14 -2
  255. package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
  256. package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
  257. package/node_modules/pi-agent-search-text/index.ts +34 -12
  258. package/node_modules/pi-agent-search-text/package.json +17 -15
  259. package/node_modules/pi-agent-search-text/runtime/entry-58.js +1 -0
  260. package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
  261. package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
  262. package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
  263. package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
  264. package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
  265. package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
  266. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
  267. package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
  268. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
  269. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
  270. package/node_modules/pi-agent-text/package.json +3 -3
  271. package/node_modules/pi-agent-text/runtime/entry-62.js +1 -0
  272. package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
  273. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  274. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-63.js +2 -0
  275. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  276. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-64.js +1 -0
  277. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-65.js +2 -0
  278. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  279. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
  280. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  281. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-67.js +2 -0
  282. package/node_modules/pi-agent-text-editor/package.json +26 -26
  283. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
  284. package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
  285. package/node_modules/pi-agent-text-editor/runtime/entry-83.js +1 -0
  286. package/node_modules/pi-agent-text-editor/runtime/entry-84.js +2 -0
  287. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  288. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  289. package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  290. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  291. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  292. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
  293. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  294. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
  295. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  296. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +2 -6
  297. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  298. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +17 -36
  299. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  300. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  301. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  302. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  303. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +63 -74
  304. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  305. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +7 -10
  306. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -10
  307. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +8 -8
  308. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -8
  309. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  310. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  311. package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
  312. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  313. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-85.js +2 -0
  314. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  315. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
  316. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-86.js +2 -0
  317. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  318. package/node_modules/pi-agent-tool-call-interception/runtime/entry-87.js +1 -0
  319. package/node_modules/pi-agent-tool-ui/package.json +3 -3
  320. package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
  321. package/node_modules/pi-agent-tool-ui/runtime/entry-89.js +1 -0
  322. package/node_modules/pi-agent-web/index.ts +28 -6
  323. package/node_modules/pi-agent-web/package.json +8 -8
  324. package/node_modules/pi-agent-web-html/package.json +3 -3
  325. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  326. package/node_modules/pi-agent-web-image/package.json +4 -4
  327. package/node_modules/pi-agent-web-image/runtime/entry-92.js +2 -0
  328. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  329. package/node_modules/pi-agent-web-pdf/runtime/entry-93.js +2 -0
  330. package/node_modules/pi-agent-web-text/package.json +4 -4
  331. package/node_modules/pi-agent-web-text/runtime/entry-94.js +2 -0
  332. package/package.json +65 -58
  333. package/src/api/approval.ts +2 -0
  334. package/src/api/capabilities.ts +60 -0
  335. package/src/api/read.ts +2 -0
  336. package/src/api/standalone.ts +7 -0
  337. package/src/backend/doctor-workspace.ts +0 -3
  338. package/src/backend/process-metadata-worker.py +9 -18
  339. package/src/backend/process-metadata.ts +11 -44
  340. package/src/backend/registration.ts +0 -10
  341. package/src/backend/web-browser-worker.mjs +2 -17
  342. package/src/backend/web-browser.ts +1 -26
  343. package/src/composite/builtin-extensions.ts +8 -6
  344. package/src/composite/capabilities.ts +252 -0
  345. package/src/composite/capability-schemas.ts +53 -0
  346. package/src/composite/ide-alias-rendering.ts +18 -2
  347. package/src/composite/module-labels.ts +0 -4
  348. package/src/composite/preferences.ts +0 -36
  349. package/src/composite/responses-tools.ts +27 -9
  350. package/src/composite/settings-documentation.ts +1 -2
  351. package/src/composite/text-results.ts +61 -23
  352. package/src/composite/tool-availability.ts +28 -13
  353. package/src/documentation/extension.ts +39 -15
  354. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
  355. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  356. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  357. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +9 -63
  358. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
  359. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-33.js +1 -0
  360. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-34.js +2 -0
  361. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  362. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  363. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-35.js +2 -0
  364. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  365. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-36.js +2 -0
  366. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-31.js +2 -0
  367. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
  368. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  369. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  370. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  371. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  372. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-92.js +2 -0
  373. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  374. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-93.js +2 -0
  375. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  376. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-94.js +2 -0
  377. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-90.js +2 -0
  378. package/src/extensions/pi-agent-read/package.json +12 -12
  379. package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
  380. package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
  381. package/src/extensions/pi-agent-read/runtime/entry-52.js +2 -0
  382. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
  383. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
  384. package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
  385. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  386. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  387. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  388. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  389. package/src/extensions/pi-agent-search/package.json +9 -9
  390. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
  391. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
  392. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-58.js +1 -0
  393. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
  394. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-60.js +1 -0
  395. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
  396. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
  397. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
  398. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
  399. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
  400. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
  401. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
  402. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
  403. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
  404. package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
  405. package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
  406. package/src/extensions/pi-agent-search/runtime/entry-56.js +1 -0
  407. package/src/extensions/pi-agent-search/runtime/entry-57.js +2 -0
  408. package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
  409. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
  410. package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
  411. package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
  412. package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
  413. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  414. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  415. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-63.js +2 -0
  416. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  417. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-64.js +1 -0
  418. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-65.js +2 -0
  419. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  420. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
  421. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  422. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +1 -0
  423. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-67.js +2 -0
  424. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
  425. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  426. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-85.js +2 -0
  427. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  428. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
  429. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-86.js +2 -0
  430. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
  431. package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
  432. package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +1 -0
  433. package/src/extensions/pi-agent-text-editor/runtime/entry-84.js +2 -0
  434. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  435. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  436. package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  437. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  438. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  439. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
  440. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  441. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
  442. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  443. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +2 -6
  444. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  445. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +17 -36
  446. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  447. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  448. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  449. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  450. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +63 -74
  451. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  452. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +7 -10
  453. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -10
  454. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +8 -8
  455. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -8
  456. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  457. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  458. package/src/pi-agent-ide.ts +12 -16
  459. package/src/plugins/pi-agent-ide-ast/package.json +15 -15
  460. package/src/plugins/pi-agent-ide-ast/runtime/entry-37.js +1 -0
  461. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  462. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  463. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  464. package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
  465. package/src/plugins/pi-agent-ide-changes/package.json +10 -10
  466. package/src/plugins/pi-agent-ide-changes/runtime/entry-39.js +1 -0
  467. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  468. package/src/plugins/pi-agent-ide-debugger/index.ts +31 -13
  469. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
  470. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  471. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  472. package/src/plugins/pi-agent-ide-languages/runtime/entry-42.js +2 -0
  473. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  474. package/src/plugins/pi-agent-ide-lint/runtime/entry-43.js +2 -0
  475. package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
  476. package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
  477. package/src/plugins/pi-agent-ide-lsp/runtime/entry-44.js +2 -0
  478. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  479. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  480. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  481. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  482. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  483. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  484. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  485. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  486. package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
  487. package/src/plugins/pi-agent-ide-terminal/index.ts +43 -1
  488. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +0 -18
  489. package/src/plugins/pi-agent-ide-terminal/src/search.ts +0 -3
  490. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
  491. package/src/standalone/resource-host.ts +147 -0
  492. package/src/standalone/scoped-api.ts +457 -0
  493. package/dist/chunk-2RTCSZB3.js +0 -1
  494. package/dist/chunk-4DIUPEDF.js +0 -2
  495. package/dist/chunk-6EDOLYOV.js +0 -1
  496. package/dist/chunk-6FGLAVPJ.js +0 -1
  497. package/dist/chunk-6H32W35W.js +0 -1
  498. package/dist/chunk-6OJ565FL.js +0 -2
  499. package/dist/chunk-6R3Y4AD3.js +0 -1
  500. package/dist/chunk-6TJPMBUQ.js +0 -1
  501. package/dist/chunk-6XFUICD7.js +0 -1
  502. package/dist/chunk-BHSO2MDK.js +0 -6
  503. package/dist/chunk-GBUJOR6V.js +0 -28
  504. package/dist/chunk-GSOYVIQS.js +0 -1
  505. package/dist/chunk-HSRH76JN.js +0 -3
  506. package/dist/chunk-HSZ4AQ6L.js +0 -9
  507. package/dist/chunk-I6NPILT5.js +0 -1
  508. package/dist/chunk-K7SRNBIV.js +0 -1
  509. package/dist/chunk-LCWBVOII.js +0 -3
  510. package/dist/chunk-MKEC3U2M.js +0 -4
  511. package/dist/chunk-NUM3YQGK.js +0 -1
  512. package/dist/chunk-OM4LYD3S.js +0 -1
  513. package/dist/chunk-PLKYHUNT.js +0 -1
  514. package/dist/chunk-PT35ZFLH.js +0 -33
  515. package/dist/chunk-QIJMV2P2.js +0 -2
  516. package/dist/chunk-RVU73VKN.js +0 -2
  517. package/dist/chunk-SDAH3ECM.js +0 -5
  518. package/dist/chunk-SGQWRIRJ.js +0 -10
  519. package/dist/chunk-SWBJS3U4.js +0 -1
  520. package/dist/chunk-T7I2VX3J.js +0 -1
  521. package/dist/chunk-T7MWQQIF.js +0 -3
  522. package/dist/chunk-VDP5CQHM.js +0 -3
  523. package/dist/chunk-XG7QNAKW.js +0 -9
  524. package/dist/chunk-XLWCSJMR.js +0 -1
  525. package/dist/chunk-YFP4P2FV.js +0 -1
  526. package/dist/chunk-YIXP2ALP.js +0 -9
  527. package/dist/entry-23.js +0 -1
  528. package/docs/agent-guides/diagnostics.md +0 -5
  529. package/docs/agent-guides/json-reading.md +0 -57
  530. package/docs/agent-guides/read-resources.md +0 -17
  531. package/docs/agent-guides/search-code.md +0 -76
  532. package/docs/agent-guides/select-code.md +0 -119
  533. package/docs/agent-guides/vision.md +0 -11
  534. package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
  535. package/node_modules/pi-agent-doctor/runtime/entry-23.js +0 -1
  536. package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
  537. package/node_modules/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
  538. package/node_modules/pi-agent-filesystem-text/runtime/entry-33.js +0 -2
  539. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  540. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  541. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  542. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  543. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  544. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  545. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
  546. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
  547. package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
  548. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
  549. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
  550. package/node_modules/pi-agent-ide-changes/runtime/entry-36.js +0 -1
  551. package/node_modules/pi-agent-ide-changes/runtime/entry-37.js +0 -2
  552. package/node_modules/pi-agent-ide-languages/runtime/entry-39.js +0 -2
  553. package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  554. package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
  555. package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
  556. package/node_modules/pi-agent-pdf/runtime/entry-44.js +0 -1
  557. package/node_modules/pi-agent-search/runtime/entry-52.js +0 -1
  558. package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
  559. package/node_modules/pi-agent-search-text/runtime/entry-57.js +0 -1
  560. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  561. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-62.js +0 -2
  562. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-63.js +0 -1
  563. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-64.js +0 -2
  564. package/node_modules/pi-agent-text-editor/runtime/entry-65.js +0 -1
  565. package/node_modules/pi-agent-text-editor/runtime/entry-67.js +0 -1
  566. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  567. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
  568. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
  569. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
  570. package/node_modules/pi-agent-tool-ui/runtime/entry-86.js +0 -1
  571. package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
  572. package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
  573. package/node_modules/pi-agent-web-image/runtime/entry-89.js +0 -2
  574. package/src/backend/vision-capture-worker.py +0 -319
  575. package/src/backend/vision-capture.ts +0 -165
  576. package/src/backend/vision-registration.ts +0 -104
  577. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
  578. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-31.js +0 -2
  579. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-33.js +0 -2
  580. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
  581. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
  582. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
  583. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-90.js +0 -2
  584. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
  585. package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
  586. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  587. package/src/extensions/pi-agent-read/runtime/entry-47.js +0 -1
  588. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
  589. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
  590. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +0 -1
  591. package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
  592. package/src/extensions/pi-agent-search/runtime/entry-53.js +0 -1
  593. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  594. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-62.js +0 -2
  595. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-63.js +0 -1
  596. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-64.js +0 -2
  597. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  598. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
  599. package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
  600. package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
  601. package/src/extensions/pi-agent-text-editor/runtime/entry-67.js +0 -1
  602. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  603. package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
  604. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  605. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  606. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  607. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  608. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  609. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
  610. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
  611. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
  612. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
  613. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
  614. package/src/plugins/pi-agent-ide-changes/runtime/entry-36.js +0 -1
  615. package/src/plugins/pi-agent-ide-changes/runtime/entry-37.js +0 -2
  616. package/src/plugins/pi-agent-ide-languages/runtime/entry-39.js +0 -2
  617. package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  618. package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
  619. package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
  620. package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
  621. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
  622. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
  623. /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
  624. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
  625. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem}/runtime/entry-31.js +0 -0
  626. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-32.js +0 -0
  627. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-pdf}/runtime/entry-35.js +0 -0
  628. /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-38.js +0 -0
  629. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-40.js +0 -0
  630. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-41.js +0 -0
  631. /package/node_modules/{pi-agent-read → pi-agent-image}/runtime/entry-45.js +0 -0
  632. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-46.js +0 -0
  633. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-47.js +0 -0
  634. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
  635. /package/node_modules/{pi-agent-search → pi-agent-read}/runtime/entry-51.js +0 -0
  636. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-53.js +0 -0
  637. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-56.js +0 -0
  638. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
  639. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-search-text}/runtime/entry-61.js +0 -0
  640. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-66.js +0 -0
  641. /package/node_modules/{pi-agent-web-pdf → pi-agent-web}/runtime/entry-90.js +0 -0
  642. /package/node_modules/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-91.js +0 -0
  643. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-32.js +0 -0
  644. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-91.js +0 -0
  645. /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-51.js +0 -0
  646. /package/src/extensions/{pi-agent-text-editor/plugins/pi-agent-text-anchor-exact → pi-agent-search/plugins/pi-agent-search-text}/runtime/entry-61.js +0 -0
  647. /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-38.js +0 -0
  648. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-40.js +0 -0
  649. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-41.js +0 -0
@@ -0,0 +1,252 @@
1
+ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { Type } from "typebox";
3
+ import { Text } from "@earendil-works/pi-tui";
4
+ import {
5
+ IDE_CAPABILITIES_REGISTER,
6
+ IDE_CAPABILITIES_READY,
7
+ IDE_CAPABILITIES_VERSION,
8
+ type IdeCapability,
9
+ type IdeCapabilityRegistration,
10
+ type IdeCapabilitySchema,
11
+ } from "#src/api/capabilities.js";
12
+ import { composeCapabilitySchema } from "./capability-schemas.js";
13
+
14
+ const ENTRY = "ide-capabilities/v1";
15
+
16
+ function record(value: unknown): value is Record<string, unknown> {
17
+ return typeof value === "object" && value !== null && !Array.isArray(value);
18
+ }
19
+
20
+ function validate(value: unknown): asserts value is IdeCapability {
21
+ if (!record(value) || typeof value.id !== "string") throw new Error("Invalid IDE capability");
22
+ if (value.version !== IDE_CAPABILITIES_VERSION || !/^[a-z][a-z0-9._-]*$/u.test(value.id))
23
+ throw new Error("Invalid IDE capability identity");
24
+ if (
25
+ !Array.isArray(value.tools) ||
26
+ value.tools.some((name: unknown) => typeof name !== "string" || !name)
27
+ )
28
+ throw new Error("Invalid IDE capability tools");
29
+ if (value.tools.length === 0 && value.discovery === undefined)
30
+ throw new Error("A capability needs an existing tool or a discovery loader");
31
+ if (value.discovery !== undefined) {
32
+ const discovery = value.discovery;
33
+ if (
34
+ !record(discovery) ||
35
+ typeof discovery.name !== "string" ||
36
+ !/^ide_capability_[a-z0-9_]+$/u.test(discovery.name) ||
37
+ typeof discovery.description !== "string" ||
38
+ !discovery.description.trim()
39
+ )
40
+ throw new Error("Invalid capability discovery metadata");
41
+ if (
42
+ discovery.namespace !== undefined &&
43
+ (!record(discovery.namespace) ||
44
+ typeof discovery.namespace.name !== "string" ||
45
+ typeof discovery.namespace.description !== "string")
46
+ )
47
+ throw new Error("Invalid capability namespace");
48
+ }
49
+ if (!record(value.schemas)) throw new Error("Invalid capability schemas");
50
+ for (const schema of Object.values(value.schemas)) {
51
+ if (
52
+ !record(schema) ||
53
+ (schema.description !== undefined && typeof schema.description !== "string") ||
54
+ (schema.parameters !== undefined &&
55
+ (!record(schema.parameters) ||
56
+ Object.values(schema.parameters).some((text) => typeof text !== "string"))) ||
57
+ (schema.promptGuidelines !== undefined &&
58
+ (!Array.isArray(schema.promptGuidelines) ||
59
+ schema.promptGuidelines.some((text) => typeof text !== "string")))
60
+ )
61
+ throw new Error("Invalid capability schema metadata");
62
+ }
63
+ }
64
+
65
+ /** Own additive metadata and republication while all tool execution stays with its original owner. */
66
+ export function createIdeCapabilities(pi: ExtensionAPI) {
67
+ const capabilities = new Map<string, IdeCapability>();
68
+ const publishers = new Map<
69
+ string,
70
+ (contributions: readonly IdeCapabilitySchema[]) => () => void
71
+ >();
72
+ const installedLoaders = new Set<string>();
73
+ let active = new Set<string>();
74
+ let runtimeReady = false;
75
+ const visibleTools = () =>
76
+ new Set(
77
+ pi
78
+ .getAllTools()
79
+ .filter((tool) => tool.exposure !== "hidden")
80
+ .map((tool) => tool.name),
81
+ );
82
+ const triggers = (capability: IdeCapability) => [
83
+ ...capability.tools,
84
+ ...(capability.discovery ? [capability.discovery.name] : []),
85
+ ];
86
+ const available = (capability: IdeCapability, visible: Set<string>) =>
87
+ triggers(capability).some((name) => visible.has(name));
88
+ const refresh = () => {
89
+ if (!runtimeReady) return;
90
+ const visible = visibleTools();
91
+ const publications = [...publishers].map(([name, prepare]) => {
92
+ const contributions = [...capabilities.values()]
93
+ .filter((capability) => active.has(capability.id) && available(capability, visible))
94
+ .flatMap((capability) =>
95
+ capability.schemas[name] === undefined ? [] : [capability.schemas[name]],
96
+ );
97
+ return prepare(contributions);
98
+ });
99
+ for (const publish of publications) publish();
100
+ };
101
+ const registerTool: ExtensionAPI["registerTool"] = (base) => {
102
+ let previous: string | undefined;
103
+ const prepare = (contributions: readonly IdeCapabilitySchema[]) => {
104
+ const definition = composeCapabilitySchema(base, contributions);
105
+ const signature = JSON.stringify([
106
+ definition.description,
107
+ definition.parameters,
108
+ definition.promptGuidelines,
109
+ ]);
110
+ return () => {
111
+ if (signature === previous) return;
112
+ pi.registerTool(definition);
113
+ previous = signature;
114
+ };
115
+ };
116
+ for (const capability of capabilities.values()) {
117
+ const schema = capability.schemas[base.name];
118
+ if (schema !== undefined) prepare([schema]);
119
+ }
120
+ publishers.set(base.name, prepare);
121
+ // Preserve live getters for plugins that finish registering later in the same startup.
122
+ pi.registerTool(base);
123
+ refresh();
124
+ };
125
+ const activate = (names: readonly string[]) => {
126
+ const visible = visibleTools();
127
+ let changed = false;
128
+ for (const capability of capabilities.values()) {
129
+ if (
130
+ !active.has(capability.id) &&
131
+ available(capability, visible) &&
132
+ triggers(capability).some((name) => names.includes(name) && visible.has(name))
133
+ ) {
134
+ active.add(capability.id);
135
+ changed = true;
136
+ }
137
+ }
138
+ if (changed) {
139
+ pi.appendEntry(ENTRY, { version: 1, active: [...active] });
140
+ refresh();
141
+ }
142
+ };
143
+ const installLoader = (capability: IdeCapability) => {
144
+ const discovery = capability.discovery;
145
+ if (discovery === undefined || installedLoaders.has(discovery.name)) return;
146
+ if (pi.getAllTools().some((tool) => tool.name === discovery.name))
147
+ throw new Error(`Capability loader name is already registered: ${discovery.name}`);
148
+ pi.registerTool({
149
+ name: discovery.name,
150
+ label: discovery.name,
151
+ description: discovery.description,
152
+ exposure: "deferred",
153
+ namespace: discovery.namespace,
154
+ parameters: Type.Object({}),
155
+ renderResult(result) {
156
+ return new Text(
157
+ result.content.flatMap((block) => (block.type === "text" ? [block.text] : [])).join("\n"),
158
+ 0,
159
+ 0,
160
+ );
161
+ },
162
+ async execute() {
163
+ activate([discovery.name]);
164
+ return {
165
+ content: [{ type: "text", text: `Enabled capability ${capability.id}.` }],
166
+ details: { capability: capability.id },
167
+ };
168
+ },
169
+ });
170
+ installedLoaders.add(discovery.name);
171
+ };
172
+ const restore = (context: ExtensionContext) => {
173
+ active = new Set();
174
+ for (const entry of context.sessionManager.getBranch()) {
175
+ if (
176
+ entry.type !== "custom" ||
177
+ entry.customType !== ENTRY ||
178
+ !record(entry.data) ||
179
+ entry.data.version !== 1 ||
180
+ !Array.isArray(entry.data.active)
181
+ )
182
+ continue;
183
+ active = new Set(entry.data.active.filter((id): id is string => typeof id === "string"));
184
+ }
185
+ refresh();
186
+ };
187
+ const unsubscribe = pi.events.on(IDE_CAPABILITIES_REGISTER, (value) => {
188
+ const request = value as IdeCapabilityRegistration;
189
+ try {
190
+ const capability = request.capability;
191
+ validate(capability);
192
+ if (capabilities.has(capability.id))
193
+ throw new Error(`Duplicate capability: ${capability.id}`);
194
+ const loader = capability.discovery?.name;
195
+ if (
196
+ loader !== undefined &&
197
+ (publishers.has(loader) ||
198
+ [...capabilities.values()].some((other) => other.discovery?.name === loader) ||
199
+ (runtimeReady && pi.getAllTools().some((tool) => tool.name === loader)))
200
+ )
201
+ throw new Error(`Capability loader name is already registered: ${loader}`);
202
+ for (const [name, schema] of Object.entries(capability.schemas))
203
+ publishers.get(name)?.([schema]);
204
+ const snapshot = structuredClone(capability);
205
+ if (runtimeReady) installLoader(snapshot);
206
+ capabilities.set(snapshot.id, snapshot);
207
+ refresh();
208
+ request.accept();
209
+ } catch (error) {
210
+ request.accept(error instanceof Error ? error : new Error(String(error)));
211
+ }
212
+ });
213
+ pi.on("session_shutdown", unsubscribe);
214
+ pi.on("tool_call", (event) => activate([event.toolName]));
215
+ pi.on("tool_result", (event) => {
216
+ // A tool can register its capability inside execute(), after its first tool_call hook.
217
+ activate([event.toolName]);
218
+ if (
219
+ event.toolName !== "tool_search" ||
220
+ event.isError ||
221
+ !record(event.details) ||
222
+ !Array.isArray(event.details.loaded)
223
+ )
224
+ return;
225
+ activate(event.details.loaded.filter((name): name is string => typeof name === "string"));
226
+ });
227
+ pi.events.emit(IDE_CAPABILITIES_READY, { version: IDE_CAPABILITIES_VERSION });
228
+ return {
229
+ api: { ...pi, registerTool },
230
+ finalize(afterLoaders: () => void) {
231
+ pi.on("session_start", (_event, context) => {
232
+ runtimeReady = true;
233
+ const failures: string[] = [];
234
+ for (const capability of capabilities.values()) {
235
+ try {
236
+ installLoader(capability);
237
+ } catch (error) {
238
+ capabilities.delete(capability.id);
239
+ failures.push(error instanceof Error ? error.message : String(error));
240
+ }
241
+ }
242
+ afterLoaders();
243
+ restore(context);
244
+ if (failures.length > 0) throw new Error(failures.join("\n"));
245
+ });
246
+ pi.on("session_tree", (_event, context) => restore(context));
247
+ pi.on("session_compact", (_event, context) => restore(context));
248
+ pi.on("before_agent_start", refresh);
249
+ pi.on("turn_start", refresh);
250
+ },
251
+ };
252
+ }
@@ -0,0 +1,53 @@
1
+ import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
2
+ import type { IdeCapabilitySchema } from "#src/api/capabilities.js";
3
+
4
+ function joinUnique(values: readonly (string | undefined)[]): string {
5
+ return [
6
+ ...new Set(values.filter((value): value is string => value !== undefined && value !== "")),
7
+ ].join("\n");
8
+ }
9
+
10
+ /** Compose from the original definition on every refresh; never accumulate earlier revisions. */
11
+ export function composeCapabilitySchema<
12
+ T extends Pick<ToolDefinition, "name" | "description" | "parameters" | "promptGuidelines">,
13
+ >(base: T, contributions: readonly IdeCapabilitySchema[]): T {
14
+ if (contributions.length === 0) return base;
15
+ const source = base.parameters as { properties?: Record<string, Record<string, unknown>> };
16
+ if (source.properties === undefined)
17
+ throw new Error(`Capability target is not an object schema: ${base.name}`);
18
+ const properties = { ...source.properties };
19
+ for (const contribution of contributions) {
20
+ for (const parameter of Object.keys(contribution.parameters ?? {})) {
21
+ if (!Object.hasOwn(properties, parameter))
22
+ throw new Error(`Unknown capability parameter: ${base.name}.${parameter}`);
23
+ }
24
+ }
25
+ for (const [parameter, schema] of Object.entries(properties)) {
26
+ const additions = contributions.map((item) => item.parameters?.[parameter]);
27
+ if (additions.some((value) => value !== undefined)) {
28
+ properties[parameter] = {
29
+ ...schema,
30
+ description: joinUnique([
31
+ typeof schema.description === "string" ? schema.description : undefined,
32
+ ...additions,
33
+ ]),
34
+ };
35
+ }
36
+ }
37
+ return {
38
+ ...base,
39
+ // Pi's in-flight run can retain the previous toolGuidelines map. Include activated rules
40
+ // in the declaration too, so the next tool-state revision delivers them without a new turn.
41
+ description: joinUnique([
42
+ base.description,
43
+ ...contributions.flatMap((item) => [item.description, ...(item.promptGuidelines ?? [])]),
44
+ ]),
45
+ parameters: { ...base.parameters, properties },
46
+ promptGuidelines: [
47
+ ...new Set([
48
+ ...(base.promptGuidelines ?? []),
49
+ ...contributions.flatMap((item) => item.promptGuidelines ?? []),
50
+ ]),
51
+ ],
52
+ };
53
+ }
@@ -59,7 +59,7 @@ export function registerIdeAliasCompatibility(
59
59
  const definition = native === undefined ? undefined : definitions.get(native);
60
60
  if (!definition) continue;
61
61
  const descriptors = Object.getOwnPropertyDescriptors(definition);
62
- // Preserve live metadata getters and outputSchema, but keep the alias's exposure and identity.
62
+ // Preserve live metadata getters and outputSchema without presenting a second IDE contract.
63
63
  delete descriptors.namespace;
64
64
  descriptors.name = {
65
65
  value: alias.name,
@@ -68,7 +68,23 @@ export function registerIdeAliasCompatibility(
68
68
  writable: true,
69
69
  };
70
70
  descriptors.exposure = {
71
- value: alias.exposure,
71
+ // Deferred aliases remain callable by scripts without duplicating the Codemode catalogue.
72
+ value: alias.exposure === "model-only" ? alias.exposure : "deferred",
73
+ enumerable: true,
74
+ configurable: true,
75
+ writable: true,
76
+ };
77
+ const prepareLoadout: ToolDefinition["prepareLoadout"] = (loadout) => {
78
+ const changes = definition.prepareLoadout?.(loadout);
79
+ if (!loadout.declared.some((tool) => tool.name === definition.name)) return changes;
80
+ // Keep the connector's active route and wire remapping, but declare the source only once.
81
+ return {
82
+ ...changes,
83
+ hiddenDeclarations: [...(changes?.hiddenDeclarations ?? []), alias.name],
84
+ };
85
+ };
86
+ descriptors.prepareLoadout = {
87
+ value: prepareLoadout,
72
88
  enumerable: true,
73
89
  configurable: true,
74
90
  writable: true,
@@ -15,10 +15,6 @@ export const moduleLabels = {
15
15
  "Agent IDE processes",
16
16
  "Show active terminal and debugger sessions in one shared process surface.",
17
17
  ],
18
- "ide.vision": [
19
- "Agent vision",
20
- "Inspect process metadata and capture supported windows and web pages as images.",
21
- ],
22
18
  "ide.debugger": [
23
19
  "Debugger sessions",
24
20
  "Debug local programs through addressable DAP sessions and anchored breakpoints.",
@@ -75,40 +75,4 @@ export const AGENT_IDE_PREFERENCES: readonly AgentIdePreference[] = [
75
75
  { value: "off", label: "Off" },
76
76
  ],
77
77
  },
78
- {
79
- kind: "text",
80
- id: "vision.sequenceDurationSeconds",
81
- name: "Vision sequence duration",
82
- description:
83
- "Default sequence duration in seconds. Requests may override it, up to 10 seconds.",
84
- default: "2",
85
- group: "features",
86
- },
87
- {
88
- kind: "text",
89
- id: "vision.sequenceIntervalSeconds",
90
- name: "Vision sequence interval",
91
- description:
92
- "Default seconds between sequence frames. A sequence may contain at most 20 frames.",
93
- default: "0.5",
94
- group: "features",
95
- },
96
- {
97
- kind: "text",
98
- id: "vision.imageScale",
99
- name: "Vision image scale",
100
- description: "Default image downscale from greater than 0 through 1.",
101
- default: "0.5",
102
- group: "features",
103
- },
104
- {
105
- kind: "text",
106
- id: "vision.allowedExecutables",
107
- name: "Vision allowed executables",
108
- description:
109
- "Comma-separated executable file names that may be captured without arbitrary-window access.",
110
- default: "",
111
- group: "features",
112
- placeholder: "Unity.exe,UnrealEditor.exe",
113
- },
114
78
  ];
@@ -2,14 +2,8 @@ function isRecord(value: unknown): value is Record<string, unknown> {
2
2
  return typeof value === "object" && value !== null && !Array.isArray(value);
3
3
  }
4
4
 
5
- /** Opt IDE function tools out of implicit Responses strictness without changing their schemas. */
6
- export function preserveResponsesToolOmission(
7
- payload: unknown,
8
- names: ReadonlySet<string>,
9
- ): unknown {
10
- if (!isRecord(payload) || !Array.isArray(payload.tools)) return payload;
11
- const original = payload.tools;
12
- const tools = original.map((tool: unknown) => {
5
+ function relaxed(tools: readonly unknown[], names: ReadonlySet<string>): readonly unknown[] {
6
+ const next = tools.map((tool) => {
13
7
  if (
14
8
  !isRecord(tool) ||
15
9
  tool.type !== "function" ||
@@ -21,5 +15,29 @@ export function preserveResponsesToolOmission(
21
15
  // Responses can make every optional property required when strict is omitted.
22
16
  return { ...tool, strict: false };
23
17
  });
24
- return tools.some((tool, index) => tool !== original[index]) ? { ...payload, tools } : payload;
18
+ return next.some((tool, index) => tool !== tools[index]) ? next : tools;
19
+ }
20
+
21
+ /** Opt IDE declarations in both Responses tool locations out of implicit strictness. */
22
+ export function preserveResponsesToolOmission(
23
+ payload: unknown,
24
+ names: ReadonlySet<string>,
25
+ ): unknown {
26
+ if (!isRecord(payload)) return payload;
27
+ let next = payload;
28
+ if (Array.isArray(payload.tools)) {
29
+ const tools = relaxed(payload.tools, names);
30
+ if (tools !== payload.tools) next = { ...next, tools };
31
+ }
32
+ const original = payload.input;
33
+ if (Array.isArray(original)) {
34
+ const input = original.map((item: unknown) => {
35
+ if (!isRecord(item) || item.type !== "additional_tools" || !Array.isArray(item.tools))
36
+ return item;
37
+ const tools = relaxed(item.tools, names);
38
+ return tools === item.tools ? item : { ...item, tools };
39
+ });
40
+ if (input.some((item, index) => item !== original[index])) next = { ...next, input };
41
+ }
42
+ return next;
25
43
  }
@@ -11,8 +11,7 @@ export function createIdeSettingsDocumentation(
11
11
  ): AgentDocumentation {
12
12
  return {
13
13
  id: "ide-settings",
14
- description:
15
- "Registered IDE settings, choices, defaults, configuration scopes and inheritance.",
14
+ description: "IDE settings and their scopes",
16
15
  triggers: [{ tool: "read", resourcePrefixes: ["docs:ide-settings"] }],
17
16
  get markdown() {
18
17
  const catalog = {
@@ -9,16 +9,28 @@ import type {
9
9
  AgentToolResult,
10
10
  } from "@earendil-works/pi-coding-agent";
11
11
  import type { JsonValue } from "@earendil-works/pi-ai";
12
- import { connectResultTargets, TempResourceStore } from "pi-agent-resource";
12
+ import {
13
+ connectResultImages,
14
+ connectResultTargets,
15
+ resultErrorSchema,
16
+ TempResourceStore,
17
+ } from "pi-agent-resource";
18
+ import { Type } from "typebox";
19
+ import { Value } from "typebox/value";
13
20
  import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
14
21
  import { READ_PROTOCOL, READ_API_VERSION } from "pi-agent-read/api/plugin-protocol";
15
22
  import { limitIdeOutput } from "./output-limits.js";
16
23
  import { searchFacts, searchFactsSchema } from "./search-facts.js";
17
24
 
25
+ /** Tools whose Codemode value is `{ result, hasMatches, complete }`. */
26
+ const searchTools = new Set(["search", "ast_search", "lsp_search", "file_search"]);
27
+
18
28
  const sourceFields: Record<string, readonly string[]> = {
19
29
  read: ["path"],
20
30
  search: ["path"],
21
- select: ["path"],
31
+ ast_search: ["path"],
32
+ lsp_search: ["path"],
33
+ file_search: ["path"],
22
34
  replace: ["path"],
23
35
  insert: ["path"],
24
36
  delete: ["path"],
@@ -52,12 +64,20 @@ const imageBlockSchema = {
52
64
  },
53
65
  required: ["type", "data", "mimeType", "note"],
54
66
  };
67
+ const readFailureSchema = Type.Object(
68
+ {
69
+ status: Type.Literal("error"),
70
+ errors: Type.Array(resultErrorSchema, { minItems: 1 }),
71
+ },
72
+ { additionalProperties: false },
73
+ );
55
74
  /**
56
- * Codemode Read resolves to the composition text, or to native image blocks that image() and
57
- * models.classify() accept. The note carries the same readable, composable result text.
75
+ * Read resolves to text, native image blocks or the public failure envelope.
76
+ * Successful image notes carry the same readable, composable result text.
58
77
  */
59
78
  const readValueSchema = {
60
79
  anyOf: [
80
+ readFailureSchema,
61
81
  { type: "string" },
62
82
  imageBlockSchema,
63
83
  {
@@ -102,12 +122,23 @@ function record(value: unknown): value is Record<string, unknown> {
102
122
  return value !== null && typeof value === "object";
103
123
  }
104
124
 
125
+ /** Project only validated public errors; discard private Read data and renderer details. */
126
+ function readFailure(outcome: unknown): JsonValue | undefined {
127
+ if (!record(outcome) || outcome.status !== "error") return undefined;
128
+ const failure = { status: "error", errors: outcome.errors };
129
+ return Value.Check(readFailureSchema, failure) ? failure : undefined;
130
+ }
105
131
  /** Keep tool records private while strings carry registered composition references. */
106
- export function createIdeTextResults(pi: ExtensionAPI) {
132
+ export function createIdeTextResults(
133
+ pi: ExtensionAPI,
134
+ options: { readonly resourceOutput?: boolean; readonly promptSection?: string } = {},
135
+ ) {
107
136
  const store = connectResultTargets(pi);
137
+ const resultImages = connectResultImages(pi);
108
138
  const names = new Set<string>();
109
139
  const outputs = new TempResourceStore();
110
- const saveFullOutput = (text: string) => outputs.saveFile(text);
140
+ const saveFullOutput = (text: string) =>
141
+ options.resourceOutput ? outputs.save(text) : outputs.saveFile(text);
111
142
  const contextErrors = new Map<
112
143
  string,
113
144
  { source: string; content: Promise<AgentToolResult<unknown>["content"]> }
@@ -136,6 +167,17 @@ export function createIdeTextResults(pi: ExtensionAPI) {
136
167
  id: "ide-output-retention",
137
168
  setup(api) {
138
169
  api.setOutputSaver(saveFullOutput);
170
+ if (options.resourceOutput)
171
+ api.addResolver({
172
+ priority: -1000,
173
+ resolver: {
174
+ id: "ide-output-retention",
175
+ async tryResolve(source, context) {
176
+ const result = await outputs.resolver.tryResolve(source, context);
177
+ return result.kind === "failed" ? { kind: "not-handled" } : result;
178
+ },
179
+ },
180
+ });
139
181
  },
140
182
  });
141
183
  pi.on("session_shutdown", () => outputs.dispose());
@@ -187,8 +229,8 @@ export function createIdeTextResults(pi: ExtensionAPI) {
187
229
  pi.on("session_start", clear);
188
230
  pi.on("session_shutdown", clear);
189
231
  pi.on("before_agent_start", (event) => {
190
- event.systemPromptOptions.sections.ide_results =
191
- "Direct IDE calls return readable text. In Codemode, Search returns { result, hasMatches, complete }; pass its result string to other tools for composition. An image Read returns an image block: show it with image(), pass it to models.classify() images, and pass its note string to other tools. Other text results remain strings. The leading system-result envelope is an internal reference, not file content; do not edit it. Compose tools by passing the unchanged result string to a source parameter. Outside Codemode, pass the same text or its UUID. Store/load preserves results within the session. Use returned anchors to choose individual selections. Changed snapshots and previous sessions cannot be reused.";
232
+ event.systemPromptOptions.sections[options.promptSection ?? "ide_results"] =
233
+ 'Direct IDE calls return readable text. In Codemode, search tools return { result, hasMatches, complete }; pass its result string to other tools for composition. An image Read returns an image block: show it with image(), pass it to models.classify() images, and pass its note string to other tools. A completed Read failure returns { status: "error", errors }; inspect errors before using its value. Successful text Reads and other text tools return strings. The leading system-result envelope is an internal reference, not file content; do not edit it. Compose tools by passing the unchanged result string to a source parameter. Outside Codemode, pass the same text or its UUID. Store/load preserves results within the session. Use returned anchors to choose individual selections. Changed snapshots and previous sessions cannot be reused.';
192
234
  });
193
235
  pi.on("tool_execution_start", (event) => {
194
236
  if (event.parentToolCallId !== undefined)
@@ -224,17 +266,6 @@ export function createIdeTextResults(pi: ExtensionAPI) {
224
266
  } else input[field] = source;
225
267
  }
226
268
  }
227
- if (
228
- event.toolName === "select" &&
229
- input.operation &&
230
- typeof input.operation === "object" &&
231
- "scopes" in input.operation
232
- ) {
233
- input.operation = {
234
- ...input.operation,
235
- scopes: store.source(input.operation.scopes, context.cwd),
236
- };
237
- }
238
269
  for (const field of ["text", "content"]) {
239
270
  const value = input[field];
240
271
  if (
@@ -259,7 +290,7 @@ export function createIdeTextResults(pi: ExtensionAPI) {
259
290
  const descriptors = Object.getOwnPropertyDescriptors(definition);
260
291
  // Keep readable composition strings except for explicitly declared public script values.
261
292
  delete descriptors.outputSchema;
262
- if (definition.name === "search")
293
+ if (searchTools.has(definition.name))
263
294
  descriptors.outputSchema = {
264
295
  value: searchFactsSchema,
265
296
  enumerable: true,
@@ -429,15 +460,22 @@ export function createIdeTextResults(pi: ExtensionAPI) {
429
460
  ? original
430
461
  : `${original}\n\nThis result has no verified text selection: ${targetUnavailable}\nRead/Search the file before the next edit; do not repeat the applied edit.`;
431
462
  const resources = resultResources(outcome);
432
- const shown = store.publish(outcome, readable, context.cwd, resources);
433
463
  const succeeded = !event.isError && outcome.status !== "error";
464
+ const shown = store.publish(outcome, readable, context.cwd, resources);
465
+ resultImages.keep(
466
+ shown,
467
+ context.cwd,
468
+ event.toolName === "read" && succeeded
469
+ ? event.content.filter((block): block is ImageBlock => block.type === "image")
470
+ : [],
471
+ );
434
472
  const value =
435
- event.toolName === "search" && succeeded
473
+ searchTools.has(event.toolName) && succeeded
436
474
  ? searchFacts(outcome, shown)
437
475
  : event.toolName === "read"
438
476
  ? succeeded
439
477
  ? readValue(event.content, shown)
440
- : undefined
478
+ : readFailure(record)
441
479
  : providerValue(event.details);
442
480
  const parent = parents.get(event.toolCallId);
443
481
  parents.delete(event.toolCallId);