pi-agent-ide 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (606) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +24 -29
  3. package/dist/chunk-2AY526TN.js +3 -0
  4. package/dist/{chunk-LEJKDYCK.js → chunk-2TZDG2JH.js} +1 -1
  5. package/dist/{chunk-XBQR74IK.js → chunk-4GBFIGH3.js} +1 -1
  6. package/dist/{chunk-PJL3UVMJ.js → chunk-4IWEKRSP.js} +1 -1
  7. package/dist/chunk-52PFWQMU.js +5 -0
  8. package/dist/chunk-5BGWNYQS.js +1 -0
  9. package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
  10. package/dist/chunk-64JTD2DJ.js +1 -0
  11. package/dist/{chunk-XAHU42FP.js → chunk-6A3ORNW3.js} +2 -2
  12. package/dist/{chunk-ANM3Y5FO.js → chunk-6WCHBHFW.js} +5 -5
  13. package/dist/{chunk-IMGIDBCC.js → chunk-7D7PXIVV.js} +1 -1
  14. package/dist/chunk-7PVDTMEM.js +1 -0
  15. package/dist/chunk-7SG756UO.js +4 -0
  16. package/dist/{chunk-GBUJOR6V.js → chunk-7URANI6I.js} +14 -14
  17. package/dist/{chunk-4W7GH3T7.js → chunk-AJZVKDYC.js} +1 -1
  18. package/dist/chunk-AMIIOWFL.js +1 -0
  19. package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
  20. package/dist/chunk-C2JT2G5K.js +1 -0
  21. package/dist/chunk-CVOYSEBE.js +1 -0
  22. package/dist/chunk-DDH3FP4G.js +3 -0
  23. package/dist/chunk-FEZLTM4L.js +1 -0
  24. package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
  25. package/dist/chunk-FKKAHI62.js +11 -0
  26. package/dist/chunk-FS3KCKFX.js +9 -0
  27. package/dist/chunk-FYOU4RBH.js +2 -0
  28. package/dist/chunk-G4PRFO6G.js +1 -0
  29. package/dist/chunk-GS5ZRTUG.js +1 -0
  30. package/dist/{chunk-XXLLY66B.js → chunk-GXL4NMHR.js} +1 -1
  31. package/dist/{chunk-QT3EAHOG.js → chunk-H3GEEOOL.js} +1 -1
  32. package/dist/chunk-H5Z54BEU.js +25 -0
  33. package/dist/chunk-H7WAM5RH.js +23 -0
  34. package/dist/chunk-HT7LZN5A.js +9 -0
  35. package/dist/chunk-IG5DXVDJ.js +1 -0
  36. package/dist/chunk-K4UTEMDU.js +1 -0
  37. package/dist/chunk-KFBRL2V4.js +3 -0
  38. package/dist/chunk-KN6VPARZ.js +1 -0
  39. package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
  40. package/dist/chunk-LTADNZKW.js +2 -0
  41. package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
  42. package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
  43. package/dist/chunk-NA2NEU4V.js +1 -0
  44. package/dist/chunk-OBTT5INC.js +6 -0
  45. package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
  46. package/dist/chunk-PLMHBXWI.js +10 -0
  47. package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
  48. package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
  49. package/dist/chunk-QM5WDEFI.js +1 -0
  50. package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
  51. package/dist/chunk-RIOPUTUJ.js +6 -0
  52. package/dist/chunk-RVFMH77U.js +82 -0
  53. package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
  54. package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
  55. package/dist/{chunk-PT35ZFLH.js → chunk-TNAUCNUT.js} +12 -12
  56. package/dist/{chunk-DUUOCBS3.js → chunk-TVH2ND35.js} +1 -1
  57. package/dist/chunk-TVSZYABY.js +5 -0
  58. package/dist/chunk-TVXZE4KW.js +4 -0
  59. package/dist/chunk-U7YDLVFL.js +1 -0
  60. package/dist/{chunk-KZC7TI5M.js → chunk-UD3DMY3Q.js} +1 -1
  61. package/dist/{chunk-VXP5BMW7.js → chunk-USG6WHAT.js} +1 -1
  62. package/dist/{chunk-RMI3NMQY.js → chunk-V4J3TLCV.js} +2 -2
  63. package/dist/{chunk-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
  64. package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
  65. package/dist/{chunk-6T7PSDQW.js → chunk-VN3XBH2Q.js} +1 -1
  66. package/dist/chunk-WAJW4G4F.js +22 -0
  67. package/dist/chunk-WEE3NM6L.js +1 -0
  68. package/dist/{chunk-IM24DB3K.js → chunk-WES2E4VR.js} +1 -1
  69. package/dist/{chunk-RIJMXO43.js → chunk-WQIMM4SU.js} +1 -1
  70. package/dist/chunk-WUO3UW4J.js +17 -0
  71. package/dist/chunk-XE4W5YTE.js +2 -0
  72. package/dist/chunk-XUYIK4TX.js +1 -0
  73. package/dist/{chunk-ZJQRLVVV.js → chunk-Y74EKJOY.js} +1 -1
  74. package/dist/{chunk-AAC77UD4.js → chunk-YPYROPQF.js} +1 -1
  75. package/dist/chunk-ZXO4D5UB.js +1 -0
  76. package/dist/entry-0.js +1 -1
  77. package/dist/entry-1.js +1 -1
  78. package/dist/entry-10.js +1 -1
  79. package/dist/entry-11.js +1 -1
  80. package/dist/entry-12.js +1 -1
  81. package/dist/entry-13.js +1 -1
  82. package/dist/entry-14.js +1 -1
  83. package/dist/entry-15.js +1 -1
  84. package/dist/entry-16.js +1 -1
  85. package/dist/entry-17.js +1 -1
  86. package/dist/entry-18.js +1 -1
  87. package/dist/entry-19.js +1 -1
  88. package/dist/entry-2.js +1 -1
  89. package/dist/entry-20.js +1 -1
  90. package/dist/entry-21.js +1 -0
  91. package/dist/entry-23.js +1 -1
  92. package/dist/entry-24.js +1 -1
  93. package/dist/entry-25.js +1 -1
  94. package/dist/entry-26.js +1 -1
  95. package/dist/entry-27.js +1 -1
  96. package/dist/entry-28.js +1 -1
  97. package/dist/entry-29.js +1 -2
  98. package/dist/entry-3.js +1 -1
  99. package/dist/entry-30.js +2 -1
  100. package/dist/entry-31.js +1 -4
  101. package/dist/entry-32.js +1 -1
  102. package/dist/entry-33.js +1 -1
  103. package/dist/entry-34.js +1 -1
  104. package/dist/entry-35.js +1 -18
  105. package/dist/entry-36.js +1 -1
  106. package/dist/entry-37.js +15 -1
  107. package/dist/entry-38.js +1 -1
  108. package/dist/entry-39.js +1 -1
  109. package/dist/entry-4.js +1 -1
  110. package/dist/entry-40.js +1 -1
  111. package/dist/entry-41.js +1 -1
  112. package/dist/entry-42.js +1 -1
  113. package/dist/entry-43.js +1 -1
  114. package/dist/entry-44.js +1 -1
  115. package/dist/entry-45.js +1 -1
  116. package/dist/entry-46.js +1 -1
  117. package/dist/entry-47.js +1 -1
  118. package/dist/entry-48.js +1 -1
  119. package/dist/entry-49.js +1 -25
  120. package/dist/entry-5.js +1 -1
  121. package/dist/entry-50.js +1 -1
  122. package/dist/entry-51.js +1 -1
  123. package/dist/entry-52.js +1 -1
  124. package/dist/entry-53.js +1 -1
  125. package/dist/entry-54.js +1 -3
  126. package/dist/entry-55.js +1 -13
  127. package/dist/entry-56.js +1 -1
  128. package/dist/entry-57.js +1 -1
  129. package/dist/entry-58.js +1 -1
  130. package/dist/entry-59.js +1 -1
  131. package/dist/entry-6.js +1 -1
  132. package/dist/entry-60.js +1 -1
  133. package/dist/entry-61.js +1 -1
  134. package/dist/entry-62.js +1 -1
  135. package/dist/entry-63.js +1 -1
  136. package/dist/entry-64.js +1 -1
  137. package/dist/entry-65.js +1 -0
  138. package/dist/entry-66.js +1 -1
  139. package/dist/entry-68.js +1 -1
  140. package/dist/entry-69.js +0 -1
  141. package/dist/entry-7.js +1 -1
  142. package/dist/entry-70.js +1 -1
  143. package/dist/entry-71.js +1 -1
  144. package/dist/entry-72.js +1 -1
  145. package/dist/entry-73.js +1 -1
  146. package/dist/entry-74.js +1 -1
  147. package/dist/entry-75.js +1 -0
  148. package/dist/entry-76.js +1 -1
  149. package/dist/entry-78.js +1 -1
  150. package/dist/entry-79.js +0 -1
  151. package/dist/entry-8.js +1 -1
  152. package/dist/entry-80.js +1 -1
  153. package/dist/entry-81.js +1 -80
  154. package/dist/entry-82.js +1 -22
  155. package/dist/entry-83.js +1 -2
  156. package/dist/entry-84.js +1 -1
  157. package/dist/entry-85.js +2 -1
  158. package/dist/entry-86.js +1 -1
  159. package/dist/entry-87.js +1 -1
  160. package/dist/entry-88.js +1 -3
  161. package/dist/entry-89.js +1 -1
  162. package/dist/entry-9.js +1 -1
  163. package/dist/entry-90.js +3 -1
  164. package/dist/entry-91.js +1 -1
  165. package/dist/entry-92.js +1 -0
  166. package/dist/entry-93.js +1 -0
  167. package/dist/pi-agent-ide.js +10 -34
  168. package/docs/agent-guides/ast-search.md +58 -0
  169. package/docs/agent-guides/debugger.md +1 -1
  170. package/docs/agent-guides/editing.md +26 -58
  171. package/docs/agent-guides/git-changes.md +4 -14
  172. package/docs/agent-guides/search.md +38 -0
  173. package/docs/agent-guides/ssh.md +17 -49
  174. package/docs/agent-guides/terminal.md +9 -15
  175. package/docs/configuration.md +9 -13
  176. package/docs/extensions.md +82 -0
  177. package/docs/settings-help.md +2 -2
  178. package/docs/structured-results.md +33 -11
  179. package/docs/tools.md +23 -22
  180. package/node_modules/pi-agent-doctor/package.json +7 -7
  181. package/node_modules/pi-agent-doctor/src/workspace.ts +0 -5
  182. package/node_modules/pi-agent-documentation/package.json +2 -2
  183. package/node_modules/pi-agent-documentation/runtime/entry-29.js +1 -0
  184. package/node_modules/pi-agent-documentation/src/index.ts +26 -10
  185. package/node_modules/pi-agent-filesystem/index.ts +1 -1
  186. package/node_modules/pi-agent-filesystem/package.json +8 -8
  187. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  188. package/node_modules/pi-agent-filesystem-jq/index.ts +9 -63
  189. package/node_modules/pi-agent-filesystem-jq/package.json +12 -6
  190. package/node_modules/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  191. package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  192. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  193. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  194. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  195. package/node_modules/pi-agent-ide-ast/package.json +15 -15
  196. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +13 -1
  197. package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
  198. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  199. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  200. package/node_modules/pi-agent-ide-changes/index.ts +1 -2
  201. package/node_modules/pi-agent-ide-changes/package.json +10 -10
  202. package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  203. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  204. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  205. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  206. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  207. package/node_modules/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  208. package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
  209. package/node_modules/pi-agent-ide-lsp/package.json +14 -10
  210. package/node_modules/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  211. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  212. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  213. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  214. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  215. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  216. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  217. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  218. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  219. package/node_modules/pi-agent-image/package.json +3 -3
  220. package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
  221. package/node_modules/pi-agent-invariant/package.json +2 -2
  222. package/node_modules/pi-agent-pdf/package.json +3 -3
  223. package/node_modules/pi-agent-pdf/src/pdf-converter.ts +23 -1
  224. package/node_modules/pi-agent-read/package.json +12 -12
  225. package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
  226. package/node_modules/pi-agent-read/runtime/entry-51.js +2 -0
  227. package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
  228. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
  229. package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
  230. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  231. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  232. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  233. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  234. package/node_modules/pi-agent-resource/package.json +2 -2
  235. package/node_modules/pi-agent-resource/src/index.ts +8 -0
  236. package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
  237. package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
  238. package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
  239. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
  240. package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
  241. package/node_modules/pi-agent-search/package.json +9 -9
  242. package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
  243. package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
  244. package/node_modules/pi-agent-search/runtime/entry-56.js +2 -0
  245. package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
  246. package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
  247. package/node_modules/pi-agent-search/src/api/search.ts +14 -2
  248. package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
  249. package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
  250. package/node_modules/pi-agent-search-text/index.ts +34 -12
  251. package/node_modules/pi-agent-search-text/package.json +17 -15
  252. package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
  253. package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
  254. package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
  255. package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
  256. package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
  257. package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
  258. package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
  259. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
  260. package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
  261. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
  262. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
  263. package/node_modules/pi-agent-text/package.json +3 -3
  264. package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
  265. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  266. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  267. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  268. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
  269. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  270. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  271. package/node_modules/pi-agent-text-editor/package.json +26 -26
  272. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
  273. package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
  274. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  275. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  276. package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  277. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  278. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  279. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
  280. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  281. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
  282. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  283. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  284. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  285. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  286. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  287. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  288. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  289. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  290. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  291. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  292. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  293. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  294. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  295. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  296. package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
  297. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  298. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  299. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  300. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
  301. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  302. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  303. package/node_modules/pi-agent-tool-ui/package.json +3 -3
  304. package/node_modules/pi-agent-tool-ui/runtime/entry-87.js +1 -0
  305. package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
  306. package/node_modules/pi-agent-web/index.ts +28 -6
  307. package/node_modules/pi-agent-web/package.json +8 -8
  308. package/node_modules/pi-agent-web-html/package.json +3 -3
  309. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  310. package/node_modules/pi-agent-web-image/package.json +4 -4
  311. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  312. package/node_modules/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  313. package/node_modules/pi-agent-web-text/package.json +4 -4
  314. package/node_modules/pi-agent-web-text/runtime/entry-93.js +2 -0
  315. package/package.json +61 -58
  316. package/src/api/approval.ts +2 -0
  317. package/src/api/read.ts +2 -0
  318. package/src/api/standalone.ts +7 -0
  319. package/src/backend/doctor-workspace.ts +0 -3
  320. package/src/backend/process-metadata-worker.py +9 -18
  321. package/src/backend/process-metadata.ts +11 -44
  322. package/src/backend/registration.ts +0 -10
  323. package/src/backend/web-browser-worker.mjs +2 -17
  324. package/src/backend/web-browser.ts +1 -26
  325. package/src/composite/builtin-extensions.ts +8 -6
  326. package/src/composite/ide-alias-rendering.ts +18 -2
  327. package/src/composite/module-labels.ts +0 -4
  328. package/src/composite/preferences.ts +0 -36
  329. package/src/composite/settings-documentation.ts +1 -2
  330. package/src/composite/text-results.ts +61 -23
  331. package/src/documentation/extension.ts +39 -15
  332. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
  333. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  334. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  335. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +9 -63
  336. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
  337. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  338. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  339. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  340. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  341. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  342. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-35.js +2 -0
  343. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +2 -0
  344. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
  345. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  346. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  347. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  348. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  349. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  350. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  351. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  352. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-93.js +2 -0
  353. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +2 -0
  354. package/src/extensions/pi-agent-read/package.json +12 -12
  355. package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
  356. package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
  357. package/src/extensions/pi-agent-read/runtime/entry-51.js +2 -0
  358. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
  359. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
  360. package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
  361. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  362. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  363. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  364. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  365. package/src/extensions/pi-agent-search/package.json +9 -9
  366. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
  367. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
  368. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  369. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
  370. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-60.js +1 -0
  371. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
  372. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
  373. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
  374. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
  376. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
  377. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
  378. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
  379. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
  380. package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
  381. package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
  382. package/src/extensions/pi-agent-search/runtime/entry-56.js +2 -0
  383. package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
  384. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
  385. package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
  386. package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
  387. package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
  388. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  389. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  390. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  391. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  392. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
  393. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  394. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-65.js +1 -0
  395. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  396. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
  397. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  398. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  399. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  400. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
  401. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  402. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
  403. package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
  404. package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +2 -0
  405. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  406. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  407. package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  408. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  409. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  410. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
  411. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  412. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
  413. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  414. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  415. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  416. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  417. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  418. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  419. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  420. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  421. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  422. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  423. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  424. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  425. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  426. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  427. package/src/pi-agent-ide.ts +8 -15
  428. package/src/plugins/pi-agent-ide-ast/package.json +15 -15
  429. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +13 -1
  430. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  431. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  432. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  433. package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
  434. package/src/plugins/pi-agent-ide-changes/package.json +10 -10
  435. package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  436. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  437. package/src/plugins/pi-agent-ide-debugger/index.ts +17 -4
  438. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
  439. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  440. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  441. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  442. package/src/plugins/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  443. package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
  444. package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
  445. package/src/plugins/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  446. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  447. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  448. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  449. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  450. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  451. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  452. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  453. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  454. package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
  455. package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
  456. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +10 -7
  457. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
  458. package/src/standalone/resource-host.ts +147 -0
  459. package/src/standalone/scoped-api.ts +457 -0
  460. package/dist/chunk-2RTCSZB3.js +0 -1
  461. package/dist/chunk-4DIUPEDF.js +0 -2
  462. package/dist/chunk-6EDOLYOV.js +0 -1
  463. package/dist/chunk-6FGLAVPJ.js +0 -1
  464. package/dist/chunk-6H32W35W.js +0 -1
  465. package/dist/chunk-6OJ565FL.js +0 -2
  466. package/dist/chunk-6R3Y4AD3.js +0 -1
  467. package/dist/chunk-6TJPMBUQ.js +0 -1
  468. package/dist/chunk-6XFUICD7.js +0 -1
  469. package/dist/chunk-BHSO2MDK.js +0 -6
  470. package/dist/chunk-GSOYVIQS.js +0 -1
  471. package/dist/chunk-HSRH76JN.js +0 -3
  472. package/dist/chunk-HSZ4AQ6L.js +0 -9
  473. package/dist/chunk-I6NPILT5.js +0 -1
  474. package/dist/chunk-K7SRNBIV.js +0 -1
  475. package/dist/chunk-LCWBVOII.js +0 -3
  476. package/dist/chunk-MKEC3U2M.js +0 -4
  477. package/dist/chunk-NUM3YQGK.js +0 -1
  478. package/dist/chunk-OM4LYD3S.js +0 -1
  479. package/dist/chunk-PLKYHUNT.js +0 -1
  480. package/dist/chunk-QIJMV2P2.js +0 -2
  481. package/dist/chunk-RVU73VKN.js +0 -2
  482. package/dist/chunk-SDAH3ECM.js +0 -5
  483. package/dist/chunk-SGQWRIRJ.js +0 -10
  484. package/dist/chunk-SWBJS3U4.js +0 -1
  485. package/dist/chunk-T7I2VX3J.js +0 -1
  486. package/dist/chunk-T7MWQQIF.js +0 -3
  487. package/dist/chunk-UEVGZUII.js +0 -3
  488. package/dist/chunk-VDP5CQHM.js +0 -3
  489. package/dist/chunk-XG7QNAKW.js +0 -9
  490. package/dist/chunk-XLWCSJMR.js +0 -1
  491. package/dist/chunk-YFP4P2FV.js +0 -1
  492. package/dist/chunk-YIXP2ALP.js +0 -9
  493. package/dist/entry-22.js +0 -1
  494. package/docs/agent-guides/diagnostics.md +0 -5
  495. package/docs/agent-guides/json-reading.md +0 -57
  496. package/docs/agent-guides/read-resources.md +0 -17
  497. package/docs/agent-guides/search-code.md +0 -76
  498. package/docs/agent-guides/select-code.md +0 -119
  499. package/docs/agent-guides/vision.md +0 -11
  500. package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
  501. package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
  502. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  503. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  504. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  505. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  506. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  507. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  508. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  509. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
  510. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
  511. package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
  512. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
  513. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
  514. package/node_modules/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  515. package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  516. package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
  517. package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
  518. package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
  519. package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
  520. package/node_modules/pi-agent-search-text/runtime/entry-56.js +0 -1
  521. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  522. package/node_modules/pi-agent-text-editor/runtime/entry-66.js +0 -1
  523. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  524. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
  525. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
  526. package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
  527. package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
  528. package/src/backend/vision-capture-worker.py +0 -319
  529. package/src/backend/vision-capture.ts +0 -165
  530. package/src/backend/vision-registration.ts +0 -104
  531. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
  532. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  533. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
  534. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
  535. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
  536. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
  537. package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
  538. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  539. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
  540. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
  541. package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
  542. package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
  543. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  544. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +0 -1
  545. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  546. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
  547. package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
  548. package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
  549. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  550. package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
  551. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  552. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  553. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  554. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  555. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  556. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
  557. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
  558. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
  559. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
  560. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
  561. package/src/plugins/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  562. package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  563. package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
  564. package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
  565. package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
  566. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
  567. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
  568. /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
  569. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
  570. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-30.js +0 -0
  571. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  572. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  573. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-35.js +0 -0
  574. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  575. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  576. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  577. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  578. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
  579. /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-44.js +0 -0
  580. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-45.js +0 -0
  581. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-46.js +0 -0
  582. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
  583. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-52.js +0 -0
  584. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
  585. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-61.js +0 -0
  586. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  587. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  588. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  589. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-65.js +0 -0
  590. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-83.js +0 -0
  591. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-86.js +0 -0
  592. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-89.js +0 -0
  593. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  594. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  595. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  596. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  597. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  598. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  599. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  600. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  601. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  602. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  603. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  604. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  605. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  606. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
@@ -1,319 +0,0 @@
1
- """Read one authorized X11 drawable. No controller desktop or root-image window fallback."""
2
- import ctypes as c
3
- import json
4
- import os
5
- import struct
6
- import sys
7
- import zlib
8
-
9
- MAX_PIXELS = 16 * 1024 * 1024
10
- MAX_BYTES = 20 * 1024 * 1024
11
-
12
-
13
- class Refused(Exception):
14
- pass
15
-
16
-
17
- def process_identity(pid):
18
- try:
19
- with open(f"/proc/{pid}/stat", encoding="utf8") as file:
20
- ticks = file.read().rsplit(")", 1)[1].split()[19]
21
- with open("/proc/sys/kernel/random/boot_id", encoding="ascii") as file:
22
- boot = file.read().strip()
23
- return boot + ":" + ticks, os.readlink(f"/proc/{pid}/exe")
24
- except FileNotFoundError:
25
- raise Refused("ENOENT")
26
- except PermissionError:
27
- raise Refused("EACCES")
28
-
29
-
30
- class Image(c.Structure):
31
- _fields_ = [("width", c.c_int), ("height", c.c_int), ("xoffset", c.c_int),
32
- ("format", c.c_int), ("data", c.c_void_p), ("byte_order", c.c_int),
33
- ("bitmap_unit", c.c_int), ("bitmap_bit_order", c.c_int), ("bitmap_pad", c.c_int),
34
- ("depth", c.c_int), ("bytes_per_line", c.c_int), ("bits_per_pixel", c.c_int),
35
- ("red_mask", c.c_ulong), ("green_mask", c.c_ulong), ("blue_mask", c.c_ulong)]
36
-
37
-
38
- class Extension(c.Structure):
39
- _fields_ = [("name", c.c_char_p), ("global_id", c.c_int)]
40
-
41
-
42
- class ProtocolRequest(c.Structure):
43
- _fields_ = [("count", c.c_size_t), ("ext", c.POINTER(Extension)),
44
- ("opcode", c.c_uint8), ("isvoid", c.c_uint8)]
45
-
46
-
47
- class Iovec(c.Structure):
48
- _fields_ = [("base", c.c_void_p), ("length", c.c_size_t)]
49
-
50
-
51
- def trusted_client_query(display):
52
- """Check X-Resource 1.2 on this Xlib connection without reading any pixels."""
53
- try:
54
- bridge = c.CDLL("libX11-xcb.so.1")
55
- xcb = c.CDLL("libxcb.so.1")
56
- except OSError:
57
- raise Refused("CAPABILITY_UNAVAILABLE")
58
- pointer = c.c_void_p
59
- bridge.XGetXCBConnection.restype = pointer
60
- bridge.XGetXCBConnection.argtypes = [pointer]
61
- # Share the grabbed Xlib connection. A second client would wait behind XGrabServer.
62
- connection = bridge.XGetXCBConnection(display)
63
- if not connection:
64
- raise Refused("CAPABILITY_UNAVAILABLE")
65
- extension = Extension(b"X-Resource", 0)
66
- xcb.xcb_get_extension_data.restype = pointer
67
- xcb.xcb_get_extension_data.argtypes = [pointer, c.POINTER(Extension)]
68
- information = xcb.xcb_get_extension_data(connection, c.byref(extension))
69
- if not information or c.string_at(information, 12)[8] != 1:
70
- raise Refused("CAPABILITY_UNAVAILABLE")
71
- xcb.xcb_send_request.restype = c.c_uint
72
- xcb.xcb_send_request.argtypes = [pointer, c.c_int, c.POINTER(Iovec), c.POINTER(ProtocolRequest)]
73
- xcb.xcb_wait_for_reply.restype = pointer
74
- xcb.xcb_wait_for_reply.argtypes = [pointer, c.c_uint, c.POINTER(pointer)]
75
- libc = c.CDLL(None)
76
- libc.free.argtypes = [pointer]
77
- libc.free.restype = None
78
-
79
- def query(opcode, data):
80
- buffer = c.create_string_buffer(data)
81
- # libxcb reserves two iovecs before the request for its wire header.
82
- vectors = (Iovec * 4)()
83
- vectors[2] = Iovec(c.cast(buffer, pointer), len(data))
84
- vectors[3] = Iovec(None, (-len(data)) & 3)
85
- protocol = ProtocolRequest(2, c.pointer(extension), opcode, 0)
86
- sequence = xcb.xcb_send_request(connection, 1,
87
- c.cast(c.byref(vectors, 2 * c.sizeof(Iovec)), c.POINTER(Iovec)), c.byref(protocol))
88
- error = pointer()
89
- reply = xcb.xcb_wait_for_reply(connection, sequence, c.byref(error)) if sequence else None
90
- try:
91
- if error or not reply:
92
- raise Refused("CAPABILITY_UNAVAILABLE")
93
- header = c.string_at(reply, 32)
94
- size = struct.unpack_from("=I", header, 4)[0] * 4
95
- if header[0] != 1 or size > 4096:
96
- raise Refused("CAPABILITY_UNAVAILABLE")
97
- return header + c.string_at(reply + 32, size)
98
- finally:
99
- if error:
100
- libc.free(error)
101
- if reply:
102
- libc.free(reply)
103
-
104
- version = query(0, struct.pack("=BBHBB2x", 0, 0, 0, 1, 2))
105
- if struct.unpack_from("=HH", version, 8) < (1, 2):
106
- raise Refused("CAPABILITY_UNAVAILABLE")
107
- return query
108
-
109
-
110
- def trusted_window_pid(display, window):
111
- """Ask for the server-observed local client PID, not a window property."""
112
- query = trusted_client_query(display)
113
- identifiers = query(4, struct.pack("=BBHIII", 0, 0, 0, 1, window, 2))
114
- # One requested client and one LOCAL_CLIENT_PID value (length is bytes).
115
- if len(identifiers) != 48 or struct.unpack_from("=I", identifiers, 8)[0] != 1:
116
- raise Refused("CAPABILITY_UNAVAILABLE")
117
- _, mask, length, pid = struct.unpack_from("=IIII", identifiers, 32)
118
- if mask != 2 or length != 4 or pid == 0:
119
- raise Refused("CAPABILITY_UNAVAILABLE")
120
- return pid
121
-
122
- def display_library():
123
- if not os.environ.get("DISPLAY"):
124
- raise Refused("DESKTOP_UNAVAILABLE")
125
- try:
126
- x = c.CDLL("libX11.so.6")
127
- except OSError:
128
- raise Refused("CAPABILITY_UNAVAILABLE")
129
- return x
130
-
131
-
132
- def probe():
133
- """Connect to the native desktop and check trusted identity support. Never acquire pixels."""
134
- x = display_library()
135
- x.XOpenDisplay.restype = c.c_void_p
136
- x.XOpenDisplay.argtypes = [c.c_char_p]
137
- x.XCloseDisplay.restype = c.c_int
138
- x.XCloseDisplay.argtypes = [c.c_void_p]
139
- display = x.XOpenDisplay(None)
140
- if not display:
141
- raise Refused("DESKTOP_UNAVAILABLE")
142
- try:
143
- try:
144
- trusted_client_query(display)
145
- except Refused as error:
146
- return {"display": True, "window": False, "error": str(error)}
147
- return {"display": True, "window": True}
148
- finally:
149
- x.XCloseDisplay(display)
150
-
151
-
152
- def capture(request):
153
- x = display_library()
154
- pointer, number = c.c_void_p, c.c_ulong
155
- def bind(name, result, arguments):
156
- function = getattr(x, name)
157
- function.restype, function.argtypes = result, arguments
158
- return function
159
- open_display = bind("XOpenDisplay", pointer, [c.c_char_p])
160
- close_display = bind("XCloseDisplay", c.c_int, [pointer])
161
- root_window = bind("XRootWindow", number, [pointer, c.c_int])
162
- screen_count = bind("XScreenCount", c.c_int, [pointer])
163
- query_tree = bind("XQueryTree", c.c_int, [pointer, number, c.POINTER(number),
164
- c.POINTER(number), c.POINTER(c.POINTER(number)), c.POINTER(c.c_uint)])
165
- get_geometry = bind("XGetGeometry", c.c_int, [pointer, number, c.POINTER(number),
166
- c.POINTER(c.c_int), c.POINTER(c.c_int), c.POINTER(c.c_uint), c.POINTER(c.c_uint),
167
- c.POINTER(c.c_uint), c.POINTER(c.c_uint)])
168
- translate = bind("XTranslateCoordinates", c.c_int, [pointer, number, number,
169
- c.c_int, c.c_int, c.POINTER(c.c_int), c.POINTER(c.c_int), c.POINTER(number)])
170
- atom = bind("XInternAtom", number, [pointer, c.c_char_p, c.c_int])
171
- get_property = bind("XGetWindowProperty", c.c_int, [pointer, number, number, c.c_long,
172
- c.c_long, c.c_int, number, c.POINTER(number), c.POINTER(c.c_int),
173
- c.POINTER(number), c.POINTER(number), c.POINTER(pointer)])
174
- free = bind("XFree", c.c_int, [pointer])
175
- get_image = bind("XGetImage", c.POINTER(Image), [pointer, number, c.c_int, c.c_int,
176
- c.c_uint, c.c_uint, number, c.c_int])
177
- destroy_image = bind("XDestroyImage", c.c_int, [c.POINTER(Image)])
178
- grab = bind("XGrabServer", c.c_int, [pointer])
179
- ungrab = bind("XUngrabServer", c.c_int, [pointer])
180
- sync = bind("XSync", c.c_int, [pointer, c.c_int])
181
- error_handler = c.CFUNCTYPE(c.c_int, pointer, pointer)
182
- error_seen = []
183
- @error_handler
184
- def on_error(_display, _event):
185
- error_seen.append(True)
186
- return 0
187
- bind("XSetErrorHandler", pointer, [error_handler])(on_error)
188
- display = open_display(None)
189
- if not display:
190
- raise Refused("DESKTOP_UNAVAILABLE")
191
- image = None
192
- grabbed = False
193
- try:
194
- def children(window):
195
- root, parent, count = number(), number(), c.c_uint()
196
- values = c.POINTER(number)()
197
- if not query_tree(display, window, c.byref(root), c.byref(parent), c.byref(values), c.byref(count)):
198
- raise Refused("EACCES")
199
- try:
200
- if count.value > 4096:
201
- raise Refused("CONTENT_LIMIT")
202
- return list(values[:count.value])
203
- finally:
204
- if values:
205
- free(values)
206
- def geometry(window, root, include_border=False):
207
- owner, child = number(), number()
208
- left, top, rx, ry = c.c_int(), c.c_int(), c.c_int(), c.c_int()
209
- width, height, border, depth = c.c_uint(), c.c_uint(), c.c_uint(), c.c_uint()
210
- if not get_geometry(display, window, c.byref(owner), c.byref(left), c.byref(top),
211
- c.byref(width), c.byref(height), c.byref(border), c.byref(depth)):
212
- raise Refused("EACCES")
213
- if not translate(display, window, root, 0, 0, c.byref(rx), c.byref(ry), c.byref(child)):
214
- raise Refused("EACCES")
215
- edge = border.value if include_border else 0
216
- return rx.value - edge, ry.value - edge, width.value + 2 * edge, height.value + 2 * edge
217
- pid_atom = atom(display, b"_NET_WM_PID", 1)
218
- def window_pid(window):
219
- actual, count, remaining = number(), number(), number()
220
- format = c.c_int()
221
- value = pointer()
222
- result = get_property(display, window, pid_atom, 0, 1, 0, 6,
223
- c.byref(actual), c.byref(format), c.byref(count), c.byref(remaining), c.byref(value))
224
- try:
225
- if result == 0 and actual.value == 6 and format.value == 32 and count.value == 1 and remaining.value == 0:
226
- return c.cast(value, c.POINTER(number))[0]
227
- return None
228
- finally:
229
- if value:
230
- free(value)
231
- grab(display)
232
- grabbed = True
233
- if request["kind"] == "display":
234
- index = request["index"]
235
- if index < 0 or index >= screen_count(display):
236
- raise Refused("ENOENT")
237
- root = drawable = root_window(display, index)
238
- else:
239
- pid = request["pid"]
240
- expected = (request["identity"], request["executable"])
241
- if process_identity(pid) != expected:
242
- raise Refused("STALE_PROCESS")
243
- matches = []
244
- visited = 0
245
- for screen in range(screen_count(display)):
246
- root = root_window(display, screen)
247
- top_windows = children(root)
248
- pending = [(window, position) for position, window in enumerate(top_windows)]
249
- while pending:
250
- window, position = pending.pop()
251
- visited += 1
252
- if visited > 4096:
253
- raise Refused("CONTENT_LIMIT")
254
- if pid_atom and window_pid(window) == pid:
255
- matches.append((root, window, top_windows[position + 1:]))
256
- pending.extend((child, position) for child in children(window))
257
- if not matches:
258
- raise Refused("ENOENT")
259
- if len(matches) != 1:
260
- raise Refused("AMBIGUOUS_WINDOW")
261
- root, drawable, above = matches[0]
262
- sync(display, 0)
263
- if trusted_window_pid(display, drawable) != pid:
264
- raise Refused("EACCES")
265
- left, top, width, height = geometry(drawable, root)
266
- for other in above:
267
- ox, oy, ow, oh = geometry(other, root, include_border=True)
268
- if left < ox + ow and ox < left + width and top < oy + oh and oy < top + height:
269
- # XGetImage has undefined obscured pixels. Never replace them with root pixels.
270
- raise Refused("WINDOW_OBSCURED")
271
- _, _, width, height = geometry(drawable, root)
272
- if width < 1 or height < 1 or width * height > MAX_PIXELS:
273
- raise Refused("PIXEL_LIMIT")
274
- image = get_image(display, drawable, 0, 0, width, height, number(-1), 2)
275
- sync(display, 0)
276
- if not image or error_seen:
277
- raise Refused("EACCES")
278
- if request["kind"] == "window" and process_identity(request["pid"]) != expected:
279
- raise Refused("STALE_PROCESS")
280
- ungrab(display)
281
- grabbed = False
282
- pixels = image.contents
283
- if (pixels.width, pixels.height) != (width, height) or pixels.xoffset != 0 or pixels.byte_order != 0 or pixels.bits_per_pixel not in (24, 32) or (pixels.red_mask, pixels.green_mask, pixels.blue_mask) != (0xff0000, 0xff00, 0xff):
284
- raise Refused("CAPABILITY_UNAVAILABLE")
285
- step = pixels.bits_per_pixel // 8
286
- if pixels.bytes_per_line < width * step or pixels.bytes_per_line * height > MAX_PIXELS * 4:
287
- raise Refused("PIXEL_LIMIT")
288
- raw = c.string_at(pixels.data, pixels.bytes_per_line * height)
289
- scanlines = bytearray()
290
- for row in range(height):
291
- data = raw[row * pixels.bytes_per_line:row * pixels.bytes_per_line + width * step]
292
- rgb = bytearray(width * 3)
293
- rgb[0::3], rgb[1::3], rgb[2::3] = data[2::step], data[1::step], data[0::step]
294
- scanlines.extend(b"\0" + rgb)
295
- def chunk(kind, data):
296
- return struct.pack("!I", len(data)) + kind + data + struct.pack("!I", zlib.crc32(kind + data))
297
- png = b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack("!IIBBBBB", width, height, 8, 2, 0, 0, 0)) + chunk(b"IDAT", zlib.compress(scanlines)) + chunk(b"IEND", b"")
298
- if len(png) > MAX_BYTES:
299
- raise Refused("BYTE_LIMIT")
300
- return png
301
- finally:
302
- if image:
303
- destroy_image(image)
304
- if grabbed:
305
- ungrab(display)
306
- close_display(display)
307
-
308
-
309
- try:
310
- request = json.loads(sys.argv[1])
311
- if request["kind"] == "probe":
312
- print(json.dumps(probe()))
313
- else:
314
- sys.stdout.buffer.write(capture(request))
315
- except Refused as error:
316
- print(json.dumps({"error": str(error)}))
317
- except Exception:
318
- # Do not return display names, authorization paths, native logs or environment values.
319
- print(json.dumps({"error": "CAPABILITY_UNAVAILABLE"}))
@@ -1,165 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import type { SshBackendRegistry } from "./registry.js";
3
- import type { SshTarget } from "./ssh.js";
4
- import { SshBackendError } from "./ssh.js";
5
- import { readOwnedSshCommand } from "./owned-read-command.js";
6
-
7
- /** A native target frame request. Window identity must come from an authorized target snapshot. */
8
- export type SshCaptureRequest =
9
- | {
10
- readonly kind: "window";
11
- readonly pid: number;
12
- readonly identity: string;
13
- readonly executable: string;
14
- }
15
- | { readonly kind: "display"; readonly index: number };
16
-
17
- /** Connect to target X11 and check trusted client support without pixels or opt-in changes.
18
- * This is readiness only, not authorization for any particular window or display.
19
- */
20
- export async function probeSshCapture(
21
- target: SshTarget,
22
- source: string,
23
- signal?: AbortSignal,
24
- ): Promise<{
25
- display: { ok: boolean; detail: string };
26
- window: { ok: boolean; detail: string };
27
- }> {
28
- signal?.throwIfAborted();
29
- worker ??= readFile(new URL("./vision-capture-worker.py", import.meta.url), "utf8");
30
- const result = await readOwnedSshCommand(
31
- target,
32
- "python3",
33
- ["-c", await worker, JSON.stringify({ kind: "probe" })],
34
- source,
35
- { signal, timeoutMs: 5_000, maxBytes: 128 * 1024 },
36
- );
37
- signal?.throwIfAborted();
38
- if (result.exitCode !== 0)
39
- throw new SshBackendError("CAPABILITY_UNAVAILABLE", source, "not-applied");
40
- let reply: unknown;
41
- try {
42
- reply = JSON.parse(result.stdout.toString("utf8"));
43
- } catch {
44
- throw new SshBackendError("INVALID_RESPONSE", source, "not-applied");
45
- }
46
- if (typeof reply !== "object" || reply === null)
47
- throw new SshBackendError("INVALID_RESPONSE", source, "not-applied");
48
- if (
49
- "display" in reply &&
50
- reply.display === true &&
51
- "window" in reply &&
52
- typeof reply.window === "boolean" &&
53
- (reply.window || ("error" in reply && reply.error === "CAPABILITY_UNAVAILABLE"))
54
- ) {
55
- return {
56
- display: {
57
- ok: true,
58
- detail: "Target X11 connection opened without pixels; capture opt-in unchanged",
59
- },
60
- window: {
61
- ok: reply.window,
62
- detail: reply.window
63
- ? "Target X-Resource 1.2 is available; individual window authorization is not checked"
64
- : `CAPABILITY_UNAVAILABLE: ${source} (trusted X11 client identity unavailable)`,
65
- },
66
- };
67
- }
68
- const code =
69
- "error" in reply && typeof reply.error === "string" && refusalCodes.has(reply.error)
70
- ? reply.error
71
- : "INVALID_RESPONSE";
72
- throw new SshBackendError(code, source, "not-applied");
73
- }
74
- let worker: Promise<string> | undefined;
75
- const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
76
- const refusalCodes = new Set([
77
- "DESKTOP_UNAVAILABLE",
78
- "CAPABILITY_UNAVAILABLE",
79
- "ENOENT",
80
- "EACCES",
81
- "STALE_PROCESS",
82
- "AMBIGUOUS_WINDOW",
83
- "WINDOW_OBSCURED",
84
- "CONTENT_LIMIT",
85
- "PIXEL_LIMIT",
86
- "BYTE_LIMIT",
87
- ]);
88
-
89
- /** Acquire bounded X11 pixels on the configured target, never from the controller desktop.
90
- * The caller checks capture opt-in and authorizes the exact target executable before each frame.
91
- * The worker rechecks boot/start identity and executable around the requested drawable read.
92
- */
93
- export async function captureSshFrame(
94
- registry: SshBackendRegistry,
95
- source: string,
96
- request: SshCaptureRequest,
97
- signal?: AbortSignal,
98
- ): Promise<Uint8Array> {
99
- signal?.throwIfAborted();
100
- const prefix = request.kind === "window" ? "window:" : "display:";
101
- if (!source.startsWith(`${prefix}ssh://`))
102
- throw new SshBackendError("INVALID_SOURCE", source, "not-applied");
103
- const uri = new URL(source.slice(prefix.length));
104
- const selected = request.kind === "window" ? request.pid : request.index;
105
- if (
106
- uri.username ||
107
- uri.password ||
108
- uri.port ||
109
- uri.search ||
110
- !Number.isSafeInteger(selected) ||
111
- (request.kind === "window"
112
- ? selected < 1 || uri.pathname !== `/${selected}` || uri.hash !== ""
113
- : selected < 0 ||
114
- uri.pathname !== "/" ||
115
- (uri.hash !== `#${selected}` && !(selected === 0 && uri.hash === "")))
116
- )
117
- throw new SshBackendError("INVALID_SOURCE", source, "not-applied");
118
- try {
119
- const owner = registry.resolve(`ssh://${uri.hostname}/`);
120
- if (!owner) throw new SshBackendError("UNSUPPORTED_SOURCE", source, "not-applied");
121
- worker ??= readFile(new URL("./vision-capture-worker.py", import.meta.url), "utf8");
122
- const result = await readOwnedSshCommand(
123
- owner.backend.target,
124
- "python3",
125
- ["-c", await worker, JSON.stringify(request)],
126
- source,
127
- { signal, timeoutMs: 10_000, maxBytes: 20 * 1024 * 1024 },
128
- );
129
- signal?.throwIfAborted();
130
- if (result.exitCode !== 0)
131
- throw new SshBackendError("CAPABILITY_UNAVAILABLE", source, "not-applied");
132
- if (result.stdout.subarray(0, 8).equals(PNG_SIGNATURE)) {
133
- if (
134
- result.stdout.length < 33 ||
135
- result.stdout.length > 20 * 1024 * 1024 ||
136
- result.stdout.toString("ascii", 12, 16) !== "IHDR"
137
- )
138
- throw new SshBackendError("INVALID_RESPONSE", source, "not-applied");
139
- const width = result.stdout.readUInt32BE(16),
140
- height = result.stdout.readUInt32BE(20);
141
- if (width < 1 || height < 1 || width * height > 16 * 1024 * 1024)
142
- throw new SshBackendError("PIXEL_LIMIT", source, "not-applied");
143
- return result.stdout;
144
- }
145
- let reply: unknown;
146
- try {
147
- reply = JSON.parse(result.stdout.toString("utf8"));
148
- } catch {
149
- throw new SshBackendError("INVALID_RESPONSE", source, "not-applied");
150
- }
151
- const code =
152
- typeof reply === "object" &&
153
- reply !== null &&
154
- "error" in reply &&
155
- typeof reply.error === "string" &&
156
- refusalCodes.has(reply.error)
157
- ? reply.error
158
- : "INVALID_RESPONSE";
159
- throw new SshBackendError(code, source, "not-applied");
160
- } catch (error) {
161
- if (error instanceof SshBackendError)
162
- throw new SshBackendError(error.code, source, error.effect);
163
- throw error;
164
- }
165
- }
@@ -1,104 +0,0 @@
1
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import type { BuiltinExtensionContext } from "#src/composite/selection.js";
3
- import {
4
- registerVisionWithOwner,
5
- type ProcessOwnerAccess,
6
- type CaptureOwnerAccess,
7
- } from "#src/plugins/pi-agent-ide-vision/index.js";
8
- import { resolvePiAgentIdeExtensionsConfigPaths } from "#src/composite/extensions-config.js";
9
- import { readSshTargets, resolveSshConfigPaths } from "./config.js";
10
- import { SshBackendRegistry } from "./registry.js";
11
- import { SshBackendError } from "./ssh.js";
12
- import { readSshProcessMetadata } from "./process-metadata.js";
13
- import { captureSshFrame } from "./vision-capture.js";
14
- import { parseSshWebSource } from "./web-owner.js";
15
- import { captureSshBrowserImage } from "./web-browser.js";
16
-
17
- /** Add explicit target process namespaces without changing ordinary local discovery or capture. */
18
- export function createSshProcessOwner(registry: SshBackendRegistry): ProcessOwnerAccess {
19
- return {
20
- async read(source, signal) {
21
- if (!source.startsWith("process:ssh://")) return undefined;
22
- const uri = new URL(source.slice("process:".length));
23
- if (
24
- uri.username ||
25
- uri.password ||
26
- uri.port ||
27
- uri.search ||
28
- uri.hash ||
29
- !/^\/[1-9][0-9]*$/u.test(uri.pathname)
30
- )
31
- throw new SshBackendError("INVALID_SOURCE", source, "not-applied");
32
- try {
33
- const [metadata] = await readSshProcessMetadata(
34
- registry,
35
- `ssh://${uri.hostname}/`,
36
- Number(uri.pathname.slice(1)),
37
- signal,
38
- );
39
- if (!metadata) throw new SshBackendError("ENOENT", source, "not-applied");
40
- return metadata;
41
- } catch (error) {
42
- if (error instanceof SshBackendError)
43
- throw new SshBackendError(error.code, source, error.effect);
44
- throw error;
45
- }
46
- },
47
- async list(scope, signal) {
48
- if (!scope.startsWith("ssh://")) return undefined;
49
- return readSshProcessMetadata(registry, scope, undefined, signal);
50
- },
51
- };
52
- }
53
-
54
- /** Bridge authorized target snapshots to native pixel acquisition; local capture is never used. */
55
- export function createSshCaptureOwner(registry: SshBackendRegistry): CaptureOwnerAccess {
56
- return {
57
- captureWindow(source, process, signal) {
58
- if (!process.executable)
59
- throw new SshBackendError("CAPABILITY_UNAVAILABLE", source, "not-applied");
60
- return captureSshFrame(
61
- registry,
62
- source,
63
- {
64
- kind: "window",
65
- pid: process.pid,
66
- identity: process.identity,
67
- executable: process.executable,
68
- },
69
- signal,
70
- );
71
- },
72
- async captureWeb(source, signal) {
73
- const parsed = parseSshWebSource(source);
74
- if (!parsed) throw new SshBackendError("INVALID_SOURCE", source, "not-applied");
75
- try {
76
- const owner = registry.resolve(`ssh://${parsed.target}/`);
77
- if (!owner) throw new SshBackendError("UNSUPPORTED_SOURCE", source, "not-applied");
78
- return await captureSshBrowserImage(owner.backend.target, parsed.url, source, signal);
79
- } catch (error) {
80
- if (error instanceof SshBackendError)
81
- throw new SshBackendError(error.code, source, error.effect);
82
- throw error;
83
- }
84
- },
85
- captureDisplay(source, index, signal) {
86
- return captureSshFrame(registry, source, { kind: "display", index }, signal);
87
- },
88
- };
89
- }
90
- /** Register enabled vision/process providers lazily; unused targets launch no probes. */
91
- export default async function registerOwnedVision(
92
- pi: ExtensionAPI,
93
- context?: BuiltinExtensionContext,
94
- ): Promise<void> {
95
- const registry = new SshBackendRegistry(
96
- await readSshTargets(resolveSshConfigPaths(resolvePiAgentIdeExtensionsConfigPaths())),
97
- );
98
- await registerVisionWithOwner(
99
- pi,
100
- context,
101
- createSshProcessOwner(registry),
102
- createSshCaptureOwner(registry),
103
- );
104
- }
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../../../dist/entry-30.js";
2
- export { default } from "../../../../../../../../dist/entry-30.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../../../dist/entry-32.js";
2
- export { default } from "../../../../../../../../dist/entry-32.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../dist/entry-29.js";
2
- export { default } from "../../../../../../dist/entry-29.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../../../dist/entry-88.js";
2
- export { default } from "../../../../../../../../dist/entry-88.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../../../dist/entry-89.js";
2
- export { default } from "../../../../../../../../dist/entry-89.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../dist/entry-87.js";
2
- export { default } from "../../../../../../dist/entry-87.js";
@@ -1 +0,0 @@
1
- export * from "../../../../dist/entry-45.js";
@@ -1 +0,0 @@
1
- export * from "../../../../dist/entry-46.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../dist/entry-55.js";
2
- export { default } from "../../../../../../dist/entry-55.js";
@@ -1 +0,0 @@
1
- export * from "../../../../../../dist/entry-56.js";
@@ -1 +0,0 @@
1
- export * from "../../../../dist/entry-51.js";
@@ -1 +0,0 @@
1
- export * from "../../../../dist/entry-52.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../dist/entry-60.js";
2
- export { default } from "../../../../../../dist/entry-60.js";
@@ -1 +0,0 @@
1
- export * from "../../../../../../dist/entry-61.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../dist/entry-82.js";
2
- export { default } from "../../../../../../dist/entry-82.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../../../dist/entry-83.js";
2
- export { default } from "../../../../../../dist/entry-83.js";
@@ -1 +0,0 @@
1
- export * from "../../../../dist/entry-65.js";
@@ -1 +0,0 @@
1
- export * from "../../../../dist/entry-66.js";
@@ -1 +0,0 @@
1
- export * from "../../../../dist/entry-34.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../dist/entry-35.js";
2
- export { default } from "../../../../dist/entry-35.js";