pi-agent-ide 0.8.4 → 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 (603) hide show
  1. package/CHANGELOG.md +59 -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-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-Z2MNHSJ4.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/extension.ts +8 -8
  197. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  198. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  199. package/node_modules/pi-agent-ide-changes/index.ts +1 -2
  200. package/node_modules/pi-agent-ide-changes/package.json +10 -10
  201. package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  202. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  203. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  204. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  205. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  206. package/node_modules/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  207. package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
  208. package/node_modules/pi-agent-ide-lsp/package.json +14 -10
  209. package/node_modules/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  210. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  211. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  212. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  213. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  214. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  215. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  216. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  217. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  218. package/node_modules/pi-agent-image/package.json +3 -3
  219. package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
  220. package/node_modules/pi-agent-invariant/package.json +2 -2
  221. package/node_modules/pi-agent-pdf/package.json +3 -3
  222. package/node_modules/pi-agent-pdf/src/pdf-converter.ts +23 -1
  223. package/node_modules/pi-agent-read/package.json +12 -12
  224. package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
  225. package/node_modules/pi-agent-read/runtime/entry-51.js +2 -0
  226. package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
  227. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
  228. package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
  229. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  230. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  231. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  232. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  233. package/node_modules/pi-agent-resource/package.json +2 -2
  234. package/node_modules/pi-agent-resource/src/index.ts +8 -0
  235. package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
  236. package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
  237. package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
  238. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
  239. package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
  240. package/node_modules/pi-agent-search/package.json +9 -9
  241. package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
  242. package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
  243. package/node_modules/pi-agent-search/runtime/entry-56.js +2 -0
  244. package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
  245. package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
  246. package/node_modules/pi-agent-search/src/api/search.ts +14 -2
  247. package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
  248. package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
  249. package/node_modules/pi-agent-search-text/index.ts +34 -12
  250. package/node_modules/pi-agent-search-text/package.json +17 -15
  251. package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
  252. package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
  253. package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
  254. package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
  255. package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
  256. package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
  257. package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
  258. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
  259. package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
  260. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
  261. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
  262. package/node_modules/pi-agent-text/package.json +3 -3
  263. package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
  264. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  265. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  266. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  267. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
  268. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  269. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  270. package/node_modules/pi-agent-text-editor/package.json +26 -26
  271. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
  272. package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
  273. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  274. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  275. package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  276. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  277. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  278. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
  279. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  280. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
  281. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  282. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  283. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  284. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  285. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  286. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  287. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  288. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  289. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  290. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  291. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  292. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  293. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  294. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  295. package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
  296. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  297. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  298. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  299. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
  300. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  301. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  302. package/node_modules/pi-agent-tool-ui/package.json +3 -3
  303. package/node_modules/pi-agent-tool-ui/runtime/entry-87.js +1 -0
  304. package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
  305. package/node_modules/pi-agent-web/index.ts +28 -6
  306. package/node_modules/pi-agent-web/package.json +8 -8
  307. package/node_modules/pi-agent-web-html/package.json +3 -3
  308. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  309. package/node_modules/pi-agent-web-image/package.json +4 -4
  310. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  311. package/node_modules/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  312. package/node_modules/pi-agent-web-text/package.json +4 -4
  313. package/node_modules/pi-agent-web-text/runtime/entry-93.js +2 -0
  314. package/package.json +61 -58
  315. package/src/api/approval.ts +2 -0
  316. package/src/api/read.ts +2 -0
  317. package/src/api/standalone.ts +7 -0
  318. package/src/backend/doctor-workspace.ts +0 -3
  319. package/src/backend/process-metadata-worker.py +9 -18
  320. package/src/backend/process-metadata.ts +11 -44
  321. package/src/backend/registration.ts +0 -10
  322. package/src/backend/web-browser-worker.mjs +2 -17
  323. package/src/backend/web-browser.ts +1 -26
  324. package/src/composite/builtin-extensions.ts +8 -6
  325. package/src/composite/ide-alias-rendering.ts +18 -2
  326. package/src/composite/module-labels.ts +0 -4
  327. package/src/composite/preferences.ts +0 -36
  328. package/src/composite/settings-documentation.ts +1 -2
  329. package/src/composite/text-results.ts +61 -23
  330. package/src/documentation/extension.ts +39 -15
  331. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
  332. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  333. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  334. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +9 -63
  335. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
  336. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  337. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  338. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  339. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  340. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  341. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-35.js +2 -0
  342. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +2 -0
  343. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
  344. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  345. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  346. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  347. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  348. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  349. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  350. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  351. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-93.js +2 -0
  352. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +2 -0
  353. package/src/extensions/pi-agent-read/package.json +12 -12
  354. package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
  355. package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
  356. package/src/extensions/pi-agent-read/runtime/entry-51.js +2 -0
  357. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
  358. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
  359. package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
  360. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  361. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  362. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  363. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  364. package/src/extensions/pi-agent-search/package.json +9 -9
  365. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
  366. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
  367. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  368. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
  369. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-60.js +1 -0
  370. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
  371. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
  372. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
  373. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
  374. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
  376. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
  377. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
  378. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
  379. package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
  380. package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
  381. package/src/extensions/pi-agent-search/runtime/entry-56.js +2 -0
  382. package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
  383. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
  384. package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
  385. package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
  386. package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
  387. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  388. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  389. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  390. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  391. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
  392. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  393. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-65.js +1 -0
  394. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  395. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
  396. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  397. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  398. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  399. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
  400. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  401. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
  402. package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
  403. package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +2 -0
  404. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  405. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  406. package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  407. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  408. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  409. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
  410. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  411. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
  412. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  413. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  414. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  415. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  416. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  417. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  418. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  419. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  420. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  421. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  422. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  423. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  424. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  425. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  426. package/src/pi-agent-ide.ts +8 -15
  427. package/src/plugins/pi-agent-ide-ast/package.json +15 -15
  428. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  429. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  430. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  431. package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
  432. package/src/plugins/pi-agent-ide-changes/package.json +10 -10
  433. package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  434. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  435. package/src/plugins/pi-agent-ide-debugger/index.ts +17 -4
  436. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
  437. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  438. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  439. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  440. package/src/plugins/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  441. package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
  442. package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
  443. package/src/plugins/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  444. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  445. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  446. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  447. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  448. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  449. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  450. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  451. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  452. package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
  453. package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
  454. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +10 -7
  455. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
  456. package/src/standalone/resource-host.ts +147 -0
  457. package/src/standalone/scoped-api.ts +457 -0
  458. package/dist/chunk-2RTCSZB3.js +0 -1
  459. package/dist/chunk-4DIUPEDF.js +0 -2
  460. package/dist/chunk-6EDOLYOV.js +0 -1
  461. package/dist/chunk-6FGLAVPJ.js +0 -1
  462. package/dist/chunk-6H32W35W.js +0 -1
  463. package/dist/chunk-6OJ565FL.js +0 -2
  464. package/dist/chunk-6R3Y4AD3.js +0 -1
  465. package/dist/chunk-6TJPMBUQ.js +0 -1
  466. package/dist/chunk-6XFUICD7.js +0 -1
  467. package/dist/chunk-BHSO2MDK.js +0 -6
  468. package/dist/chunk-GSOYVIQS.js +0 -1
  469. package/dist/chunk-HSRH76JN.js +0 -3
  470. package/dist/chunk-HSZ4AQ6L.js +0 -9
  471. package/dist/chunk-I6NPILT5.js +0 -1
  472. package/dist/chunk-K7SRNBIV.js +0 -1
  473. package/dist/chunk-LCWBVOII.js +0 -3
  474. package/dist/chunk-MKEC3U2M.js +0 -4
  475. package/dist/chunk-NUM3YQGK.js +0 -1
  476. package/dist/chunk-OM4LYD3S.js +0 -1
  477. package/dist/chunk-PLKYHUNT.js +0 -1
  478. package/dist/chunk-QIJMV2P2.js +0 -2
  479. package/dist/chunk-RVU73VKN.js +0 -2
  480. package/dist/chunk-SDAH3ECM.js +0 -5
  481. package/dist/chunk-SGQWRIRJ.js +0 -10
  482. package/dist/chunk-SWBJS3U4.js +0 -1
  483. package/dist/chunk-T7I2VX3J.js +0 -1
  484. package/dist/chunk-T7MWQQIF.js +0 -3
  485. package/dist/chunk-VDP5CQHM.js +0 -3
  486. package/dist/chunk-XG7QNAKW.js +0 -9
  487. package/dist/chunk-XLWCSJMR.js +0 -1
  488. package/dist/chunk-YFP4P2FV.js +0 -1
  489. package/dist/chunk-YIXP2ALP.js +0 -9
  490. package/dist/entry-22.js +0 -1
  491. package/docs/agent-guides/diagnostics.md +0 -5
  492. package/docs/agent-guides/json-reading.md +0 -57
  493. package/docs/agent-guides/read-resources.md +0 -17
  494. package/docs/agent-guides/search-code.md +0 -76
  495. package/docs/agent-guides/select-code.md +0 -119
  496. package/docs/agent-guides/vision.md +0 -11
  497. package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
  498. package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
  499. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  500. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  501. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  502. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  503. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  504. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  505. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  506. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
  507. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
  508. package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
  509. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
  510. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
  511. package/node_modules/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  512. package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  513. package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
  514. package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
  515. package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
  516. package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
  517. package/node_modules/pi-agent-search-text/runtime/entry-56.js +0 -1
  518. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  519. package/node_modules/pi-agent-text-editor/runtime/entry-66.js +0 -1
  520. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  521. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
  522. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
  523. package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
  524. package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
  525. package/src/backend/vision-capture-worker.py +0 -319
  526. package/src/backend/vision-capture.ts +0 -165
  527. package/src/backend/vision-registration.ts +0 -104
  528. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
  529. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  530. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
  531. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
  532. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
  533. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
  534. package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
  535. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  536. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
  537. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
  538. package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
  539. package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
  540. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  541. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +0 -1
  542. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  543. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
  544. package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
  545. package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
  546. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  547. package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
  548. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  549. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  550. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  551. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  552. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  553. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
  554. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
  555. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
  556. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
  557. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
  558. package/src/plugins/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  559. package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  560. package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
  561. package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
  562. package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
  563. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
  564. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
  565. /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
  566. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
  567. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-30.js +0 -0
  568. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  569. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  570. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-35.js +0 -0
  571. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  572. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  573. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  574. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  575. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
  576. /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-44.js +0 -0
  577. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-45.js +0 -0
  578. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-46.js +0 -0
  579. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
  580. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-52.js +0 -0
  581. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
  582. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-61.js +0 -0
  583. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  584. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  585. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  586. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-65.js +0 -0
  587. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-83.js +0 -0
  588. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-86.js +0 -0
  589. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-89.js +0 -0
  590. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  591. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  592. /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
  593. /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
  594. /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
  595. /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
  596. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  597. /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
  598. /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
  599. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  600. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  601. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  602. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  603. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
@@ -0,0 +1,457 @@
1
+ import type {
2
+ ExtensionAPI,
3
+ ExtensionContext,
4
+ ToolDefinition,
5
+ ToolCallEventResult,
6
+ } from "@earendil-works/pi-coding-agent";
7
+ import { Type } from "typebox";
8
+ import { toolCallHeader } from "pi-agent-tool-ui";
9
+ import { connectResultTargets } from "pi-agent-resource";
10
+ import type { ReadPluginApi } from "pi-agent-read/api/plugin-protocol";
11
+ import { getLastResolvedResource } from "#src/extensions/pi-agent-text-editor/src/api/last-resolved-resource.js";
12
+ import type { StandaloneResourceHostOptions, StandaloneResourceTool } from "./resource-host.js";
13
+
14
+ const verbs: readonly StandaloneResourceTool[] = [
15
+ "read",
16
+ "search",
17
+ "write",
18
+ "replace",
19
+ "insert",
20
+ "delete",
21
+ "copy",
22
+ "move",
23
+ "diff",
24
+ ];
25
+ const fields: Record<string, readonly string[]> = {
26
+ read: ["path"],
27
+ search: ["path"],
28
+ write: ["path"],
29
+ replace: ["path"],
30
+ insert: ["path"],
31
+ delete: ["path"],
32
+ copy: ["path", "target"],
33
+ move: ["path", "target"],
34
+ diff: ["before", "after"],
35
+ };
36
+ const readonly = new Set(["read", "search", "diff"]);
37
+ const reservationChannel = "pi-agent-ide/standalone-reservation/v1";
38
+ type Handler = (event: Record<string, unknown>, context: ExtensionContext) => unknown;
39
+ type Subscribe = (event: string, handler: Handler) => () => void;
40
+ type ToolContext = Parameters<ToolDefinition["execute"]>[4];
41
+ const record = (value: unknown): value is Record<string, unknown> =>
42
+ value !== null && typeof value === "object" && !Array.isArray(value);
43
+ const shared = (channel: string) =>
44
+ channel.startsWith("pi-agent-ide/operation-approval/") ||
45
+ channel.startsWith("pi-agent-ide/settings/");
46
+
47
+ /** A protocol island and name adapter. It exposes provider resources, never general IDE tools. */
48
+ export function createResourceHostApi(pi: ExtensionAPI, options: StandaloneResourceHostOptions) {
49
+ const prefix = options.namespace.name;
50
+ if (!/^[a-z][a-z0-9_]*$/u.test(prefix))
51
+ throw new Error("Resource host namespace must be a lowercase identifier.");
52
+ const selected = new Set(options.tools ?? verbs);
53
+ if ([...selected].some((name) => !verbs.includes(name)))
54
+ throw new Error("Unsupported resource host tool.");
55
+ const claim = { namespace: prefix, claimed: false };
56
+ pi.events.emit(reservationChannel, claim);
57
+ if (claim.claimed) throw new Error(`Resource host namespace already registered: ${prefix}`);
58
+ const releaseNamespace = pi.events.on(reservationChannel, (request) => {
59
+ if (record(request) && request.namespace === prefix) request.claimed = true;
60
+ });
61
+ const listeners = new Map<string, Set<(data: unknown) => void>>();
62
+ const shutdown = new Set<Handler>();
63
+ const unsubscribes: (() => void)[] = [releaseNamespace];
64
+ const active = new Map<AbortController, Promise<void>>();
65
+ const definitions = new Map<string, () => void>();
66
+ const parents = new Set<string>();
67
+ let closed = false;
68
+ let read: ReadPluginApi | undefined;
69
+ let api: ExtensionAPI;
70
+ const publicName = (name: string) => `${prefix}_${name}`;
71
+ const localName = (name: unknown) =>
72
+ typeof name === "string" &&
73
+ name.startsWith(prefix + "_") &&
74
+ selected.has(name.slice(prefix.length + 1) as StandaloneResourceTool)
75
+ ? name.slice(prefix.length + 1)
76
+ : undefined;
77
+ const words = (value: string) =>
78
+ value.replace(
79
+ /\b(?:read|search|select|write|replace|insert|delete|copy|move|diff)\b/gu,
80
+ (name, offset: number) => {
81
+ const before = value.slice(0, offset);
82
+ const after = value.slice(offset + name.length);
83
+ // Adapt tool references, not prose verbs, guide IDs or resource addresses.
84
+ const reference =
85
+ before.endsWith("tools.") ||
86
+ (before.endsWith("`") && /^[`.]/u.test(after)) ||
87
+ (/(?:\bUse|\band) $/u.test(before) && after.startsWith(" to "));
88
+ return reference ? publicName(name) : name;
89
+ },
90
+ );
91
+ function owns(source: string, mutation: boolean): boolean {
92
+ const value = source.startsWith("raw:") && !mutation ? source.slice(4) : source;
93
+ if (!mutation && (value.startsWith("docs:") || value.startsWith("temp:"))) return true;
94
+ return (
95
+ /^[a-z][a-z\d+.-]*:\/\//iu.test(value) &&
96
+ !/^(?:file:|[a-z]:[/\\])/iu.test(value) &&
97
+ options.ownsSource(value)
98
+ );
99
+ }
100
+ const targets = () => connectResultTargets(api);
101
+ async function checkSource(
102
+ value: unknown,
103
+ context: ExtensionContext,
104
+ mutation: boolean,
105
+ ): Promise<void> {
106
+ const source = targets().source(value, context.cwd, !mutation);
107
+ if (Array.isArray(source)) {
108
+ for (const item of source) await checkSource(item, context, mutation);
109
+ return;
110
+ }
111
+ if (record(source) && "path" in source) {
112
+ await checkSource(source.path, context, mutation);
113
+ return;
114
+ }
115
+ if (typeof source !== "string")
116
+ throw new Error("Use an owned resource URI or an issued source result.");
117
+ if (source.startsWith("RESULT#")) {
118
+ const resolved = targets().resolve(source, context.cwd);
119
+ if (resolved.targets.some((target) => !owns(target.source, mutation)))
120
+ throw new Error("Source selection belongs outside this resource host.");
121
+ await targets().verify(resolved, context.signal);
122
+ return;
123
+ }
124
+ if (source.startsWith("SEARCH#")) {
125
+ const resolved = await read?.read(
126
+ { path: source },
127
+ { cwd: context.cwd, signal: context.signal },
128
+ "script",
129
+ );
130
+ if (resolved?.isError || resolved?.script?.kind !== "text" || !resolved.script.target)
131
+ throw new Error("Unknown or expired resource search selection.");
132
+ await checkSource(resolved.script.target, context, mutation);
133
+ return;
134
+ }
135
+ if (!owns(source, mutation))
136
+ throw new Error(
137
+ "Use this host only for its provider-owned resource URIs; local paths are not supported.",
138
+ );
139
+ }
140
+ async function validate(name: string, value: unknown, context: ExtensionContext): Promise<void> {
141
+ if (closed) throw new Error("Standalone resource host is closed.");
142
+ if (!record(value)) throw new Error("Resource tool arguments must be an object.");
143
+ const mutation = !readonly.has(name);
144
+ const sources = fields[name] ?? [];
145
+ if (["read", "search"].includes(name) && value.path === undefined)
146
+ throw new Error("Supply an explicit owned resource or source result.");
147
+ if (mutation && value.path === undefined) {
148
+ const inherited = getLastResolvedResource(api)?.source;
149
+ if (!inherited) throw new Error("Supply an owned source before editing.");
150
+ await checkSource(inherited, context, true);
151
+ }
152
+ for (const field of sources)
153
+ if (value[field] !== undefined) await checkSource(value[field], context, mutation);
154
+ for (const field of ["start", "end", "anchor", "targetStart", "targetEnd"]) {
155
+ const anchor = value[field];
156
+ if (typeof anchor === "string" && /^(?:RESULT#|SEARCH#|<system-result)/u.test(anchor))
157
+ await checkSource(anchor, context, mutation);
158
+ }
159
+ if (name === "write" && typeof value.content !== "string")
160
+ throw new Error(
161
+ "Standalone resource Write accepts text/JSON content, not filesystem image writes.",
162
+ );
163
+ }
164
+ // Pi's overloads describe fixed event/result pairs; this private adapter forwards each pair unchanged.
165
+ const subscribe: Subscribe = (event, handler) =>
166
+ pi.on(
167
+ event as "tool_call",
168
+ async (value, context) =>
169
+ (await handler({ ...value }, context)) as ToolCallEventResult | undefined,
170
+ );
171
+ // Run before provider hooks: local fallbacks and foreign references never reach an executor.
172
+ unsubscribes.push(
173
+ subscribe("tool_call", async (event, context) => {
174
+ const name = localName(event.toolName);
175
+ if (!name) return;
176
+ try {
177
+ await validate(name, event.input, context);
178
+ } catch (error) {
179
+ return { block: true, reason: error instanceof Error ? error.message : String(error) };
180
+ }
181
+ }),
182
+ );
183
+ const on: ExtensionAPI["on"] = (event: string, original: unknown) => {
184
+ const handler = original as Handler;
185
+ if (event === "session_shutdown") {
186
+ shutdown.add(handler);
187
+ return () => {
188
+ shutdown.delete(handler);
189
+ };
190
+ }
191
+ const off = subscribe(event, async (raw, context) => {
192
+ if (closed) return;
193
+ let input = raw;
194
+ if (event.startsWith("tool_")) {
195
+ const name = localName(raw.toolName);
196
+ if (name) {
197
+ if (typeof raw.parentToolCallId === "string") parents.add(raw.parentToolCallId);
198
+ input = { ...raw, toolName: name };
199
+ } else if (typeof raw.toolCallId === "string" && parents.has(raw.toolCallId)) {
200
+ input = {
201
+ ...raw,
202
+ toolName: raw.toolName === "codemode" ? "codemode" : "__standalone_parent",
203
+ };
204
+ } else return;
205
+ }
206
+ if (event === "message_end") {
207
+ if (!record(raw.message) || raw.message.role !== "toolResult") return;
208
+ const name = localName(raw.message.toolName);
209
+ if (!name) return;
210
+ input = { ...raw, message: { ...raw.message, toolName: name } };
211
+ }
212
+ if (event === "context" && Array.isArray(raw.messages)) {
213
+ input = {
214
+ ...raw,
215
+ messages: raw.messages.map((message: unknown) =>
216
+ record(message) && typeof message.toolName === "string"
217
+ ? { ...message, toolName: localName(message.toolName) ?? "__outside_resource_host" }
218
+ : message,
219
+ ),
220
+ };
221
+ }
222
+ const result = await handler(input, context);
223
+ if (!record(result)) return result;
224
+ if (event === "message_end" && record(result.message) && record(raw.message))
225
+ return { ...result, message: { ...result.message, toolName: raw.message.toolName } };
226
+ if (event === "context" && Array.isArray(result.messages) && Array.isArray(raw.messages)) {
227
+ const originals = raw.messages;
228
+ if (result.messages.length !== originals.length)
229
+ throw new Error("Resource host context handlers must preserve message positions.");
230
+ return {
231
+ ...result,
232
+ messages: result.messages.map((message: unknown, index: number) => {
233
+ const original = originals[index] as unknown;
234
+ return record(message) && record(original) && typeof original.toolName === "string"
235
+ ? { ...message, toolName: original.toolName }
236
+ : message;
237
+ }),
238
+ };
239
+ }
240
+ return result;
241
+ });
242
+ unsubscribes.push(off);
243
+ return off;
244
+ };
245
+ const events: ExtensionAPI["events"] = {
246
+ emit(channel, data) {
247
+ if (closed) throw new Error("Standalone resource host is closed.");
248
+ if (shared(channel)) pi.events.emit(channel, data);
249
+ else for (const handler of listeners.get(channel) ?? []) handler(data);
250
+ },
251
+ on(channel, handler) {
252
+ if (shared(channel)) {
253
+ const off = pi.events.on(channel, handler);
254
+ unsubscribes.push(off);
255
+ return off;
256
+ }
257
+ let set = listeners.get(channel);
258
+ if (!set) listeners.set(channel, (set = new Set()));
259
+ set.add(handler);
260
+ return () => {
261
+ set.delete(handler);
262
+ };
263
+ },
264
+ };
265
+ function descriptions(value: unknown): unknown {
266
+ if (Array.isArray(value)) return value.map(descriptions);
267
+ if (!record(value)) return value;
268
+ return Object.fromEntries(
269
+ Object.entries(value).map(([key, item]) => [
270
+ key,
271
+ key === "description" && typeof item === "string" ? words(item) : descriptions(item),
272
+ ]),
273
+ );
274
+ }
275
+ function toolContext(context: ToolContext): ToolContext {
276
+ return {
277
+ ...context,
278
+ tools: context.tools.flatMap((tool) => {
279
+ const name = localName(tool.name);
280
+ return name ? [{ ...tool, name }] : [];
281
+ }),
282
+ executeTool(name, args, execution) {
283
+ if (!selected.has(name as StandaloneResourceTool))
284
+ throw new Error("Tool is not owned by this resource host.");
285
+ return context.executeTool(publicName(name), args, execution);
286
+ },
287
+ };
288
+ }
289
+ const registerTool: ExtensionAPI["registerTool"] = (definition) => {
290
+ const name = definition.name;
291
+ if (!selected.has(name as StandaloneResourceTool)) return;
292
+ const descriptors = Object.getOwnPropertyDescriptors(definition);
293
+ descriptors.name = { value: publicName(name), enumerable: true, configurable: true };
294
+ descriptors.label = { value: publicName(name), enumerable: true, configurable: true };
295
+ descriptors.namespace = { value: options.namespace, enumerable: true, configurable: true };
296
+ descriptors.exposure = { value: "deferred", enumerable: true, configurable: true };
297
+ descriptors.description = {
298
+ get: () =>
299
+ `Use ${publicName(name)} to ${name === "read" ? "inspect provider-owned resources and packaged guides" : name === "search" ? "find objects or text within an explicit provider-owned resource" : `${name} provider-owned text resources`}.`,
300
+ enumerable: true,
301
+ configurable: true,
302
+ };
303
+ descriptors.promptSnippet = {
304
+ get: () => words(definition.promptSnippet ?? ""),
305
+ enumerable: true,
306
+ configurable: true,
307
+ };
308
+ descriptors.promptGuidelines = {
309
+ get: () => [
310
+ ...(definition.promptGuidelines ?? []).map(words),
311
+ "Use only this namespace's owned resource URIs and issued results. Local filesystem paths are not supported.",
312
+ ],
313
+ enumerable: true,
314
+ configurable: true,
315
+ };
316
+ descriptors.parameters = {
317
+ get: () => {
318
+ const schema = descriptions(definition.parameters) as Record<string, unknown>;
319
+ const properties = record(schema.properties) ? { ...schema.properties } : {};
320
+ for (const field of fields[name] ?? [])
321
+ if (record(properties[field]))
322
+ properties[field] = {
323
+ ...properties[field],
324
+ description:
325
+ "Provider-owned resource URI, unchanged source result, or an issued reference.",
326
+ };
327
+ if (name === "write")
328
+ properties.content = Type.String({
329
+ description:
330
+ "Complete text/Markdown or JSON payload for the selected provider resource.",
331
+ });
332
+ return Object.assign({}, definition.parameters, schema, { properties });
333
+ },
334
+ enumerable: true,
335
+ configurable: true,
336
+ };
337
+ const execute: typeof definition.execute = async (id, args, signal, update, context) => {
338
+ if (closed) throw new Error("Standalone resource host is closed.");
339
+ const controller = new AbortController();
340
+ let finish: () => void = () => {};
341
+ const completion = new Promise<void>((resolve) => {
342
+ finish = resolve;
343
+ });
344
+ active.set(controller, completion);
345
+ const signals = [signal, context.signal, controller.signal].filter(
346
+ (value): value is AbortSignal => value !== undefined,
347
+ );
348
+ const combined = AbortSignal.any(signals);
349
+ try {
350
+ const scoped = { ...toolContext(context), signal: combined };
351
+ await validate(name, args, scoped);
352
+ combined.throwIfAborted();
353
+ return await definition.execute(id, args, combined, update, scoped);
354
+ } finally {
355
+ active.delete(controller);
356
+ finish();
357
+ }
358
+ };
359
+ descriptors.execute = { value: execute, enumerable: true, configurable: true };
360
+ const renderCall: NonNullable<typeof definition.renderCall> = (args, theme, context) => {
361
+ // Mutation renderers keep their preview/diff state in renderCall, shared with renderResult.
362
+ if (!readonly.has(name) && definition.renderCall)
363
+ return definition.renderCall(args, theme, context);
364
+ return toolCallHeader(
365
+ context.lastComponent,
366
+ {
367
+ tool: publicName(name),
368
+ primary: {
369
+ text: record(args)
370
+ ? String(args.path ?? args.query ?? "owned resource")
371
+ : "owned resource",
372
+ truncate: "end",
373
+ },
374
+ expanded: context.expanded,
375
+ },
376
+ theme,
377
+ );
378
+ };
379
+ descriptors.renderCall = { value: renderCall, enumerable: true, configurable: true };
380
+ const exposed = Object.defineProperties({}, descriptors) as typeof definition;
381
+ definitions.set(name, () => pi.registerTool({ ...exposed, exposure: "hidden" }));
382
+ pi.registerTool(exposed);
383
+ };
384
+ api = {
385
+ ...pi,
386
+ events,
387
+ on,
388
+ registerTool,
389
+ getActiveTools: () =>
390
+ pi.getActiveTools().flatMap((name) => {
391
+ const local = localName(name);
392
+ return local ? [local] : [];
393
+ }),
394
+ getAllTools: () =>
395
+ pi.getAllTools().flatMap((tool) => {
396
+ const name = localName(tool.name);
397
+ return name ? [{ ...tool, name }] : [];
398
+ }),
399
+ setActiveTools(names) {
400
+ const active = pi.getActiveTools().filter((name) => !localName(name));
401
+ pi.setActiveTools([
402
+ ...active,
403
+ ...names.filter((name) => selected.has(name as StandaloneResourceTool)).map(publicName),
404
+ ]);
405
+ },
406
+ };
407
+ unsubscribes.push(
408
+ subscribe("session_start", () => {
409
+ parents.clear();
410
+ if (
411
+ !(pi.getSettings().defaultTools ?? []).includes("-tool_search") &&
412
+ pi
413
+ .getAllTools()
414
+ .some((tool) => tool.name === "tool_search" && tool.exposure !== "hidden") &&
415
+ !pi.getActiveTools().includes("tool_search")
416
+ )
417
+ pi.setActiveTools([...pi.getActiveTools(), "tool_search"]);
418
+ }),
419
+ );
420
+ unsubscribes.push(
421
+ subscribe("agent_end", () => {
422
+ parents.clear();
423
+ }),
424
+ );
425
+ async function dispose(context?: ExtensionContext, hideTools = true): Promise<void> {
426
+ if (closed) return;
427
+ closed = true;
428
+ for (const controller of active.keys()) controller.abort();
429
+ await Promise.all(active.values());
430
+ const outcomes = await Promise.allSettled(
431
+ [...shutdown].map((handler) =>
432
+ handler({ type: "session_shutdown" }, context as ExtensionContext),
433
+ ),
434
+ );
435
+ for (const off of unsubscribes) off();
436
+ listeners.clear();
437
+ shutdown.clear();
438
+ parents.clear();
439
+ if (hideTools) for (const hide of definitions.values()) hide();
440
+ definitions.clear();
441
+ const failed = outcomes.find((outcome) => outcome.status === "rejected");
442
+ if (failed?.status === "rejected") throw failed.reason;
443
+ }
444
+ unsubscribes.push(subscribe("session_shutdown", (_event, context) => dispose(context, false)));
445
+ return {
446
+ api,
447
+ owns,
448
+ tools: [...selected].map(publicName),
449
+ dispose,
450
+ setApi(value: ExtensionAPI) {
451
+ api = value;
452
+ },
453
+ setRead(value: ReadPluginApi) {
454
+ read = value;
455
+ },
456
+ };
457
+ }
@@ -1 +0,0 @@
1
- import{a as r}from"./chunk-EI7MMDWY.js";function l(t,n){return typeof n=="string"&&n.length>0&&t.nonAnchorValues?.includes(n)!==!0}r(l,"isMutationAnchorValue");function u(t){if(typeof t.name!="string"||t.name.trim().length===0)throw new TypeError("Mutation tool name must be a non-empty string");if(typeof t.description!="string"||typeof t.mutate!="function")throw new TypeError(`Mutation tool ${t.name} has an invalid description or operation`);if(t.direct!==void 0&&(typeof t.direct.matches!="function"||typeof t.direct.execute!="function"))throw new TypeError(`Mutation tool ${t.name} has an invalid direct operation`);let n=t.intent;if(n!==void 0&&n!=="edit"&&n!=="restore")throw new TypeError(`Mutation tool ${t.name} has an invalid intent`);let o=d(t.parameters,t.name);c(o,t.source.field,`${t.name} primary source`);let a=new Set([t.source.field]);for(let e of t.source.targets??[]){if(c(o,e.field,`${t.name} target source`),!a.has(e.fallbackTo))throw new TypeError(`Mutation tool ${t.name} target ${e.field} has an unknown fallback ${e.fallbackTo}`);a.add(e.field)}let s=new Set;for(let e of t.anchors??[]){if(c(o,e.field,`${t.name} anchor`),!a.has(e.sourceField))throw new TypeError(`Mutation tool ${t.name} anchor ${e.field} has an unknown source ${e.sourceField}`);if(!Array.isArray(e.kinds)||e.kinds.length===0||e.kinds.some(i=>typeof i!="string"||i.trim().length===0))throw new TypeError(`Mutation tool ${t.name} anchor ${e.field} must accept non-empty kinds`);if(new Set(e.kinds).size!==e.kinds.length)throw new TypeError(`Mutation tool ${t.name} anchor ${e.field} declares duplicate kinds`);if(e.nonAnchorValues!==void 0&&(e.nonAnchorValues.length===0||e.nonAnchorValues.some(i=>typeof i!="string"||i.length===0)))throw new TypeError(`Mutation tool ${t.name} anchor ${e.field} must declare non-empty non-anchor values`);if(e.nonAnchorValues!==void 0&&new Set(e.nonAnchorValues).size!==e.nonAnchorValues.length)throw new TypeError(`Mutation tool ${t.name} anchor ${e.field} declares duplicate non-anchor values`);if(s.has(e.field))throw new TypeError(`Mutation tool ${t.name} declares anchor ${e.field} more than once`);s.add(e.field)}for(let e of t.pair??[])if(!s.has(e))throw new TypeError(`Mutation tool ${t.name} pair field ${e} is not an anchor`)}r(u,"assertTextMutationToolRegistration");function y(t,n){let o=n[t.source.field];return typeof o=="string"?o:""}r(y,"mutationSource");function d(t,n){let o=t.properties;if(typeof o!="object"||o===null)throw new TypeError(`Mutation tool ${n} parameters must be an object schema`);return o}r(d,"schemaProperties");function c(t,n,o){if(typeof n!="string"||n.length===0||!(n in t))throw new TypeError(`${o} field ${n} is not declared by its schema`)}r(c,"assertProperty");export{l as a,u as b,y as c};
@@ -1,2 +0,0 @@
1
- import{b as k,e as f}from"./chunk-I6NPILT5.js";import{a as v,b}from"./chunk-PS2B6THP.js";import{a as s}from"./chunk-EI7MMDWY.js";import h from"node:path";import{pathToFileURL as T}from"node:url";function P(e,n,r,o,i,a=[],l=[]){let c=a.map(t=>({kind:"note",text:t}));c.push(...b(e.flatMap(t=>{let p=h.isAbsolute(t.source),D=p&&i?h.relative(i,t.source)||h.basename(t.source):t.source,z=p?T(t.source).href:/^https?:/iu.test(t.source)?t.source:void 0,x=t.endLineNumber??t.lineNumber;return(x===t.lineNumber?[t.lineText]:[t.lineText,...t.matchedText.split(/\r\n|\n|\r/u).slice(1)]).slice(0,20).map((R,m)=>({source:t.source,label:D,...z===void 0?{}:{link:z},...p?{}:{badge:t.source.startsWith("docs:")?"DOC":/^https?:/iu.test(t.source)?"WEB":"SH"},lineNumber:t.lineNumber+m,text:R,ranges:[{from:m?0:t.startColumn,to:t.lineNumber+m===x?t.endColumn:R.length}]}))}))),e.length||c.push({kind:"note",text:"No matches found"}),e.some(t=>(t.endLineNumber??t.lineNumber)-t.lineNumber>=20)&&c.push({kind:"note",text:"\u2026 source preview shortened"}),c.push(...l.map(t=>({kind:"note",text:t,expandedOnly:!0})));let u=`${e.length}${n?"":"+"}`,y=new Set(e.map(t=>t.source)),F=e.length>0&&e.every(t=>h.isAbsolute(t.source));return new v({summary:`${u} ${e.length===1?"match":"matches"} in ${y.size} ${F?y.size===1?"file":"files":y.size===1?"source":"sources"}`,rows:c},r,o)}s(P,"renderSearchMatches");function $(e,n){return e.targets.some(r=>r.source===n.source&&r.ranges.some(o=>(o.start.lineNumber<n.lineNumber||o.start.lineNumber===n.lineNumber&&o.start.column<=n.startColumn)&&(o.end.lineNumber>(n.endLineNumber??n.lineNumber)||o.end.lineNumber===(n.endLineNumber??n.lineNumber)&&o.end.column>=n.endColumn)))}s($,"containsSearchMatch");import{Value as N}from"typebox/value";var d={candidates:5,previewMatches:3,identifiers:2e4,identifierLength:80,vocabularyBytes:8*1024*1024,matchesPerCandidate:200,verificationBytes:4*1024*1024,timeoutMs:2e3};function I(e){return N.Check(k,e)}s(I,"isFuzzyResultData");function g(e){return e.length>=5&&e.length<=d.identifierLength&&/^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(e)&&/[A-Za-z]/u.test(e)}s(g,"isFuzzyQuery");var S=class{static{s(this,"FuzzyVocabulary")}names=new Set;bytes=0;limited=!1;account(n){return this.bytes+=n,this.bytes>d.vocabularyBytes&&(this.limited=!0),!this.limited}add(n){if(!(this.limited||!g(n)||this.names.has(n))){if(this.names.size===d.identifiers){this.limited=!0;return}this.names.add(n)}}addText(n){if(this.account(Buffer.byteLength(n))){for(let r of n.matchAll(/[A-Za-z_$][A-Za-z0-9_$]*/gu))if(this.add(r[0]),this.limited)break}}};function w(e){return e.replace(/([A-Z]+)([A-Z][a-z])/gu,"$1 $2").replace(/([a-z0-9])([A-Z])/gu,"$1 $2").split(/[^A-Za-z0-9]+/u).filter(Boolean).map(n=>n.toLowerCase())}s(w,"splitName");function C(e,n){return e.length===n.length&&e.every((r,o)=>r===n[o])}s(C,"same");function L(e,n){if(e.length<5||n.length<5||Math.abs(e.length-n.length)>1||/\d/u.test(e+n))return!1;let r=0;for(;r<Math.min(e.length,n.length)&&e[r]===n[r];)r++;if(e.length===n.length)return e.slice(r+1)===n.slice(r+1)||e[r]===n[r+1]&&e[r+1]===n[r]&&e.slice(r+2)===n.slice(r+2);let o=e.length<n.length?e:n,i=e.length<n.length?n:e;return o.slice(r)===i.slice(r+1)}s(L,"oneTypo");function M(e,n){if(e.join("")===n.join(""))return{kind:"normalized",reason:"same spelling with different case or separators"};let r=e.length<n.length?e:n,o=e.length<n.length?n:e;if(o.length===r.length+1&&r.length>=2&&r.every(l=>l.length>=3)){let l=C(r,o.slice(1)),c=C(r,o.slice(0,-1));if(l||c)return{kind:"component",reason:`${e.length>n.length?"remove":"add"} ${l?"leading":"trailing"} component '${l?o[0]:o.at(-1)}'`}}if(e.length!==n.length)return;let i=e.flatMap((l,c)=>{let u=n[c];return u!==void 0&&l!==u?[{word:l,other:u}]:[]}),a=i[0];if(!(i.length!==1||!a||!L(a.word,a.other)))return{kind:"typo",reason:`one character edit: '${a.word}' \u2192 '${a.other}'`}}s(M,"relation");var A={normalized:0,component:1,typo:2};function E(e,n){if(!g(e))return[];let r=w(e);if(r.length===0)return[];let o=[];for(let i of new Set(n)){if(i===e||!g(i))continue;let a=M(r,w(i));a&&o.push({identifier:i,...a})}return o.sort((i,a)=>A[i.kind]-A[a.kind]||(i.identifier<a.identifier?-1:i.identifier>a.identifier?1:0)).slice(0,d.candidates)}s(E,"rankFuzzyIdentifiers");function _(e,n,r){return{identifier:e.identifier,kind:e.kind,reason:e.reason,matchCount:e.matches.length,fileCount:new Set(e.matches.map(o=>o.source)).size,selection:{...f(e.matches.slice(0,d.previewMatches),e.complete,n,r),truncated:e.matches.length>d.previewMatches}}}s(_,"fuzzyCandidateData");function O(e){let n=e.selection.complete?"":"+",r=e.selection.all?.line??e.selection.matches[0]?.references?.line,o=e.selection.matches[0],i=r??o?.source;return[`Possible name: ${e.identifier} (${e.reason})`,`${e.matchCount}${n} ${e.matchCount===1&&e.selection.complete?"match":"matches"} in ${e.fileCount}${n} ${e.fileCount===1&&e.selection.complete?"file":"files"}`,`Exact alternative: ${JSON.stringify(e.identifier)} (case-sensitive, whole identifier)`,...e.selection.complete?[]:["Capture limit reached; no complete all reference. Inspect the returned location; do not treat this candidate as a complete match set."],...i?[`Read: ${i}${r||!o?"":` \xB7 line ${o.range.startLine}`}`]:[]].join(`
2
- `)}s(O,"formatFuzzyCandidate");export{P as a,$ as b,d as c,I as d,g as e,S as f,E as g,_ as h,O as i};
@@ -1 +0,0 @@
1
- import{a as g,c as x,d as P}from"./chunk-TOYN4W4F.js";import{a as T}from"./chunk-YJ6T3PEP.js";import{b as E,c as F}from"./chunk-S72FVLUX.js";import{a as w}from"./chunk-ZAWRSA7N.js";import{a as y,b as h}from"./chunk-OFILFO6D.js";import{b,c as j,g as v,i as C,k,m as d,n as R}from"./chunk-IMGIDBCC.js";import{a as f}from"./chunk-EI7MMDWY.js";var A=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".html",".md",".yaml",".yml",".vue",".svelte"],z=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".less",".html",".htm",".md",".markdown",".mdx",".yaml",".yml",".toml"],p=[e("dart-format",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],[".dart"],["dart","format","{file}"],"https://dart.dev/tools/dart-format"),e("zig-format",["zig"],["zig"],["build.zig","build.zig.zon","zls.json"],[".zig",".zon"],["zig","fmt","{file}"],"https://ziglang.org/documentation/master/"),e("styler",["r"],["Rscript"],[".Rprofile","DESCRIPTION"],[".r"],["Rscript","-e","styler::style_file(commandArgs(TRUE)[1])","{file}"],"https://styler.r-lib.org/"),e("clang-format",["c","cpp"],["clang-format"],[".clang-format","_clang-format"],[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["clang-format","-i","{file}"],"https://clang.llvm.org/docs/ClangFormat.html"),e("prettier",["javascript","typescript","html","css","json","yaml","markdown","vue","svelte"],["prettier"],[".prettierrc",".prettierrc.json",".prettierrc.json5",".prettierrc.yaml",".prettierrc.yml",".prettierrc.toml",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs","prettier.config.js","prettier.config.cjs","prettier.config.mjs","prettier.config.ts","prettier.config.mts","prettier.config.cts"],A,["prettier","--write","{file}"],"https://prettier.io/docs/",["prettier"],{"package.json":["prettier"]}),e("biome",["javascript","typescript","json","css"],["biome"],["biome.json","biome.jsonc"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css"],["biome","format","--write","{file}"],"https://biomejs.dev/",["@biomejs/biome"]),e("oxfmt",["javascript","typescript","json","css","html","markdown","yaml","toml"],["oxfmt"],[".oxfmtrc.json",".oxfmtrc.jsonc","oxfmt.config.ts","oxfmt.config.mts"],z,["oxfmt","--write","{file}"],"https://oxc.rs/docs/guide/usage/formatter.html",["oxfmt"]),e("ruff-format",["python"],["ruff"],["ruff.toml",".ruff.toml"],[".py",".pyi"],["ruff","format","{file}"],"https://docs.astral.sh/ruff/formatter/",["ruff"],{"pyproject.toml":["tool.ruff"]}),e("black",["python"],["black"],[],[".py",".pyi"],["black","--quiet","{file}"],"https://black.readthedocs.io/",["black"],{"pyproject.toml":["tool.black"]}),e("gofmt",["go"],["gofmt"],["go.mod"],[".go"],["gofmt","-w","{file}"],"https://pkg.go.dev/cmd/gofmt"),e("goimports",["go"],["goimports"],["go.mod"],[".go"],["goimports","-w","{file}"],"https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),e("rustfmt",["rust"],["rustfmt"],["rustfmt.toml",".rustfmt.toml","Cargo.toml"],[".rs"],["rustfmt","{file}"],"https://github.com/rust-lang/rustfmt"),e("csharpier",["csharp"],["csharpier"],[".csharpierrc",".csharpierrc.json",".csharpierrc.yaml",".csharpierrc.yml"],[".cs"],["csharpier","format","{file}"],"https://csharpier.com/"),e("google-java-format",["java"],["google-java-format"],["pom.xml","build.gradle"],[".java"],["google-java-format","--replace","{file}"],"https://github.com/google/google-java-format"),e("ktlint-format",["kotlin"],["ktlint"],[".editorconfig","build.gradle.kts"],[".kt",".kts"],["ktlint","-F","{file}"],"https://pinterest.github.io/ktlint/"),e("rubocop-format",["ruby"],["rubocop"],[".rubocop.yml","Gemfile"],[".rb",".rake"],["rubocop","--fix-layout","{file}"],"https://docs.rubocop.org/"),e("pint",["php"],["pint"],["pint.json","composer.json"],[".php"],["pint","{file}"],"https://laravel.com/docs/pint"),e("swift-format",["swift"],["swift-format"],[".swift-format","Package.swift"],[".swift"],["swift-format","format","--in-place","{file}"],"https://github.com/swiftlang/swift-format"),e("stylua",["lua"],["stylua"],["stylua.toml",".stylua.toml"],[".lua"],["stylua","{file}"],"https://github.com/JohnnyMorganz/StyLua"),e("shfmt",["shell"],["shfmt"],[".editorconfig"],[".sh",".bash",".zsh"],["shfmt","-w","{file}"],"https://github.com/mvdan/sh"),e("taplo",["toml"],["taplo"],["taplo.toml"],[".toml"],["taplo","format","{file}"],"https://taplo.tamasfe.dev/"),e("sqlfluff-format",["sql"],["sqlfluff"],[".sqlfluff","pyproject.toml"],[".sql"],["sqlfluff","format","{file}"],"https://docs.sqlfluff.com/"),e("terraform-fmt",["terraform"],["terraform"],[".terraform.lock.hcl"],[".tf",".tfvars"],["terraform","fmt","{file}"],"https://developer.hashicorp.com/terraform/cli/commands/fmt"),e("cmake-format",["cmake"],["cmake-format"],[".cmake-format.py","CMakeLists.txt"],[".cmake"],["cmake-format","-i","{file}"],"https://cmake-format.readthedocs.io/",void 0,void 0,["CMakeLists.txt"]),e("xmlformat",["xml"],["xmlformat"],[".xmlformat.conf"],[".xml",".xsd",".xsl"],["xmlformat","--overwrite","{file}"],"https://github.com/pamoller/xmlformatter"),e("mix-format",["elixir"],["mix"],["mix.exs",".formatter.exs"],[".ex",".exs"],["mix","format","{file}"],"https://hexdocs.pm/mix/Mix.Tasks.Format.html"),e("scalafmt",["scala"],["scalafmt"],[".scalafmt.conf"],[".scala",".sc",".sbt"],["scalafmt","{file}"],"https://scalameta.org/scalafmt/"),e("julia-format",["julia"],["julia"],[".JuliaFormatter.toml","Project.toml"],[".jl"],["julia","--startup-file=no","--history-file=no","-e","using JuliaFormatter; format_file(ARGS[1])","{file}"],"https://github.com/domluna/JuliaFormatter.jl"),e("powershell-format",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],[".ps1",".psm1",".psd1"],["pwsh","-NoProfile","-NonInteractive","-CommandWithArgs",'$ErrorActionPreference="Stop";$p=$args[0];$options=@{};if(Test-Path -LiteralPath PSScriptAnalyzerSettings.psd1){$options.Settings="PSScriptAnalyzerSettings.psd1"};[IO.File]::WriteAllText($p,(Invoke-Formatter -ScriptDefinition ([IO.File]::ReadAllText($p)) @options))',"{file}"],"https://learn.microsoft.com/powershell/module/psscriptanalyzer/invoke-formatter"),e("dockfmt",["dockerfile"],["dockfmt"],["Dockerfile","Containerfile"],[".dockerfile"],["dockfmt","fmt","--write","{file}"],"https://github.com/jessfraz/dockfmt",void 0,void 0,["Dockerfile","Containerfile"])];function e(r,t,o,i,a,l,n,s,m,u){return{id:r,name:r,kind:"formatter",languages:t,executables:o,configFiles:i,documentation:n,...s&&{dependencies:s},...m&&{configSections:m},formatter:{extensions:a,...u&&{fileNames:u},run:{command:l},output:"in-place"}}}f(e,"recipe");var c=class r{constructor(t,o,i=new Map){this.formatters=t;this.availableBuiltIns=o;this.evidence=i}static{f(this,"FormatterCommandRegistry")}static async fromDirectory(t,o={}){let i=await v(t,"formatters",s=>R(s).formatters,o),{available:a,evidence:l}=await k(t,i.entries.filter(s=>s.layer==="built-in").map(s=>({id:s.id,config:s.config.run})),p,o),n=[...i.entries].sort((s,m)=>s.layer==="built-in"&&m.layer==="built-in"?(l.get(m.id)?.score??0)-(l.get(s.id)?.score??0):0);return new r(n,a,l)}static fromConfig(t){return new r(Object.entries(t.formatters).map(([o,i])=>({id:o,config:i,layer:"project",sourcePath:"<memory>"})),new Set)}resolve(t,o){return this.resolveEntry(t,o)?.config}resolveEntry(t,o){return C(this.formatters,this.availableBuiltIns,this.evidence,t,o)}get entries(){return this.formatters}};var I={protocol:E,apiVersion:F,id:"formatter",setup(r){for(let t of p)r.addToolRecipe(t);r.addSetupCheck({id:"effective-config",inspect:$}),r.addCheck({id:"config",title:"Formatter",async run(t){try{let o=await c.fromDirectory(t.cwd,g(t)),i=M(o,t.files,t.cwd);return i.length===0?[{status:"skip",message:"No formatter matches the inspected project files"}]:await Promise.all(i.map(async({entry:a,source:l})=>{let n=`${a.id} [${a.layer}] command ${JSON.stringify(a.config.run.command)}`;return P(t,l,async s=>{try{let m=t.workspace?await t.workspace.run(a.config.run,s,t.signal):await d(a.config,{projectRoot:t.cwd,filePath:s,env:t.env});return t.signal?.throwIfAborted(),m.ok?{status:"pass",message:`${n}: probe passed`,detail:a.sourcePath}:{status:"fail",message:`${n}: probe failed`,detail:a.sourcePath}}catch(m){return t.signal?.throwIfAborted(),{status:"fail",message:`${n}: ${m instanceof Error?m.message:String(m)}`,detail:a.sourcePath}}})}))}catch(o){return t.signal?.throwIfAborted(),[{status:"fail",message:o instanceof Error?o.message:String(o)}]}}})}};async function $(r){try{let t=await c.fromDirectory(r.cwd,g(r)),o=[],i=new Map;for(let[a,l]of r.detectedLanguages){let n=l.map(s=>t.resolveEntry(s,r.cwd)).find(s=>s!==void 0);n!==void 0&&(o.push({kind:"formatter",languageId:a,toolId:n.id}),await x(r,n.config.run)||i.set(n.id,{id:`formatter-${n.id}-unavailable`,message:`Configured formatter ${n.id} cannot run ${JSON.stringify(n.config.run.command)}`}))}return{selections:o,actions:[...i.values()]}}catch(t){return r.signal?.throwIfAborted(),{actions:[{id:"formatter-config-invalid",message:`Formatter configuration cannot load: ${t instanceof Error?t.message:String(t)}`}]}}}f($,"inspectFormatterSetup");function M(r,t,o){let i=new Map;for(let a of t){let l=r.resolveEntry(a,o);l!==void 0&&!i.has(l.id)&&i.set(l.id,{entry:l,source:a})}return[...i.values()]}f(M,"applicableFormatters");import _ from"node:path";var S=new Map;function D(r){return{kind:"formatter",name:"formatter",priority:100,extensions:["*"],detect:f(async t=>(r?await r.loadRegistry(t.cwd,!1):await O(t.cwd),!0),"detect"),async format({filePath:t},o){if(!r&&(t.includes("://")||o.cwd.includes("://")))throw Object.assign(new Error("Formatter requires its resource owner"),{code:"UNSUPPORTED_SOURCE"});let i=r?await r.resolveProject(t,o.cwd):await j(o.cwd,t,"formatters",p).then(m=>m===void 0?void 0:{cwd:m,external:m!==_.resolve(o.cwd)});if(i===void 0)return{ok:!0,edits:0,formatter:null};let a=i.cwd,n=(r?await r.loadRegistry(a,i.external):await O(a,i.external)).resolve(t,a);if(n===void 0)return{ok:!0,edits:0,formatter:null};let s=b(n.run.command);if(r){let m=await r.run(n,a,t);return{ok:m.ok,edits:m.changed?1:0,formatter:s}}try{let m=await d(n,{projectRoot:a,filePath:t});return{ok:m.ok,edits:m.changed?1:0,formatter:s}}catch{return{ok:!1,edits:0,formatter:s}}}}}f(D,"createFormatter");async function O(r,t=!1){let o=JSON.stringify([r,t]),i=S.get(o);return i===void 0&&(i=c.fromDirectory(r,{includeGlobal:!t,requireBuiltInEvidence:!0}),S.set(o,i)),i}f(O,"loadRegistry");async function q(r){await N(r)}f(q,"registerFormatter");async function N(r,t){let o=D(t),i={kind:"formatter",name:"pi-agent-ide-formatter",priority:200,extensions:["*"],detect:f(()=>Promise.resolve(!0),"detect"),async format(l,n){return o.format(l,n)}},a={protocol:y,apiVersion:5,id:"formatter",setup(l){l.addTool(i)}};await Promise.all([w(r,a),T(r,I)])}f(N,"registerFormatterWithOwner");export{p as a,c as b,q as c,N as d};
@@ -1 +0,0 @@
1
- import{a as I}from"./chunk-6XFUICD7.js";import{g as r}from"./chunk-PJL3UVMJ.js";import{a as l}from"./chunk-EI7MMDWY.js";import{readFile as S}from"node:fs/promises";async function m(h,t,o){o?.throwIfAborted(),w??=S(new URL("./vision-capture-worker.py",new URL("../src/backend/vision-capture.ts",import.meta.url).href),"utf8");let s=await I(h,"python3",["-c",await w,JSON.stringify({kind:"probe"})],t,{signal:o,timeoutMs:5e3,maxBytes:128*1024});if(o?.throwIfAborted(),s.exitCode!==0)throw new r("CAPABILITY_UNAVAILABLE",t,"not-applied");let e;try{e=JSON.parse(s.stdout.toString("utf8"))}catch{throw new r("INVALID_RESPONSE",t,"not-applied")}if(typeof e!="object"||e===null)throw new r("INVALID_RESPONSE",t,"not-applied");if("display"in e&&e.display===!0&&"window"in e&&typeof e.window=="boolean"&&(e.window||"error"in e&&e.error==="CAPABILITY_UNAVAILABLE"))return{display:{ok:!0,detail:"Target X11 connection opened without pixels; capture opt-in unchanged"},window:{ok:e.window,detail:e.window?"Target X-Resource 1.2 is available; individual window authorization is not checked":`CAPABILITY_UNAVAILABLE: ${t} (trusted X11 client identity unavailable)`}};let n="error"in e&&typeof e.error=="string"&&y.has(e.error)?e.error:"INVALID_RESPONSE";throw new r(n,t,"not-applied")}l(m,"probeSshCapture");var w,E=Buffer.from([137,80,78,71,13,10,26,10]),y=new Set(["DESKTOP_UNAVAILABLE","CAPABILITY_UNAVAILABLE","ENOENT","EACCES","STALE_PROCESS","AMBIGUOUS_WINDOW","WINDOW_OBSCURED","CONTENT_LIMIT","PIXEL_LIMIT","BYTE_LIMIT"]);async function g(h,t,o,s){s?.throwIfAborted();let e=o.kind==="window"?"window:":"display:";if(!t.startsWith(`${e}ssh://`))throw new r("INVALID_SOURCE",t,"not-applied");let n=new URL(t.slice(e.length)),p=o.kind==="window"?o.pid:o.index;if(n.username||n.password||n.port||n.search||!Number.isSafeInteger(p)||(o.kind==="window"?p<1||n.pathname!==`/${p}`||n.hash!=="":p<0||n.pathname!=="/"||n.hash!==`#${p}`&&!(p===0&&n.hash==="")))throw new r("INVALID_SOURCE",t,"not-applied");try{let a=h.resolve(`ssh://${n.hostname}/`);if(!a)throw new r("UNSUPPORTED_SOURCE",t,"not-applied");w??=S(new URL("./vision-capture-worker.py",new URL("../src/backend/vision-capture.ts",import.meta.url).href),"utf8");let i=await I(a.backend.target,"python3",["-c",await w,JSON.stringify(o)],t,{signal:s,timeoutMs:1e4,maxBytes:20*1024*1024});if(s?.throwIfAborted(),i.exitCode!==0)throw new r("CAPABILITY_UNAVAILABLE",t,"not-applied");if(i.stdout.subarray(0,8).equals(E)){if(i.stdout.length<33||i.stdout.length>20*1024*1024||i.stdout.toString("ascii",12,16)!=="IHDR")throw new r("INVALID_RESPONSE",t,"not-applied");let A=i.stdout.readUInt32BE(16),f=i.stdout.readUInt32BE(20);if(A<1||f<1||A*f>16*1024*1024)throw new r("PIXEL_LIMIT",t,"not-applied");return i.stdout}let d;try{d=JSON.parse(i.stdout.toString("utf8"))}catch{throw new r("INVALID_RESPONSE",t,"not-applied")}let c=typeof d=="object"&&d!==null&&"error"in d&&typeof d.error=="string"&&y.has(d.error)?d.error:"INVALID_RESPONSE";throw new r(c,t,"not-applied")}catch(a){throw a instanceof r?new r(a.code,t,a.effect):a}}l(g,"captureSshFrame");export{m as a,g as b};
@@ -1 +0,0 @@
1
- import{b as n}from"./chunk-NUM3YQGK.js";import{g as s}from"./chunk-PJL3UVMJ.js";import{a as o}from"./chunk-EI7MMDWY.js";async function h(r,c,d){try{await r.stop()}catch(t){if(!(t instanceof s)||t.code!=="TRANSPORT_FAILED"||!r.identity)throw t;let e;try{e=await n(c,d,r.pid)}catch(i){throw new AggregateError([t,i],"Owned SSH cleanup could not be reconciled",{cause:i})}if(e===void 0||e.identity!==r.identity)return;throw t}}o(h,"stopOwnedSshProcess");export{h as a};
@@ -1,2 +0,0 @@
1
- import{f as m,j as g,k as x,o as h}from"./chunk-LCWBVOII.js";import{a as i}from"./chunk-EI7MMDWY.js";import{Type as r}from"typebox";import{Value as y}from"typebox/value";import{Type as l}from"typebox";var u=l.Object({path:l.Optional(l.String({description:"What to read: a supported resource such as a file or directory path, URL, returned temp: reference, SEARCH# or RESULT# reference, or registered protocol source. Supply a path; an empty call cannot select a source."})),offset:l.Optional(l.Number({description:"For raw: sources, use a zero-based byte offset; negative offsets count from the file end. For other sources: first line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end. For path#anchor, SEARCH or RESULT# selections, count from its containing line instead: 0 or 1 starts there, 2 starts one line later, -1 one line earlier. For image and sequence views, offset is a zero-based row-major grid cell index and requires limit."})),limit:l.Optional(l.Number({description:"For raw: sources, use a non-negative byte count (0 reads no bytes). Otherwise, maximum lines from the selected starting position. Output is bounded; omit for the default read. For image and sequence views, limit is the square grid cell size in pixels; omit offset to select cell 0, or omit both for the bounded full image."})),views:l.Optional(l.Array(l.String(),{description:`Optional source-specific presentations. Combine views when both presentations are needed, for example ["anchors", "ast"]. Omit for the source's default presentation.`}))}),L={path:"Source to read: a resource path, unchanged source result or its UUID. Supply a source; an empty call cannot select one. temp:<id> reads saved output. raw:<local-file> reads original bytes from a regular file; relative, absolute and file:// paths are accepted.",offset:"For raw: sources, a zero-based integer byte offset; negative offsets count from the file end. For text sources, the first line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end.",limit:"For raw: sources, a non-negative integer byte count (0 reads no bytes). For text sources, the maximum lines from the selected starting position. Omit for the default read. For other non-text sources, use only a range form described for that source.",views:"Source-specific presentations. Omit for the source's default presentation. Supply settings after a colon using the syntax below. Combine views only when their contracts allow it. raw: sources do not accept views."};function _(e){let n=i((s,a)=>({...s,description:[L[a],e[a]].filter(R=>R!==void 0).join(`
2
- `)}),"describe");return{...u,properties:{path:n(u.properties.path,"path"),offset:n(u.properties.offset,"offset"),limit:n(u.properties.limit,"limit"),views:n(u.properties.views,"views")}}}i(_,"describeReadParameters");import{Type as t}from"typebox";var k=t.Object({value:t.String(),kind:t.String(),state:t.Optional(t.String())},{additionalProperties:!1}),w=t.Object({lineNumber:t.Integer(),content:t.String(),lineEnding:t.String(),anchors:t.Optional(t.Array(t.String()))},{additionalProperties:!1}),P=t.Object({path:t.String(),offset:t.Integer()},{additionalProperties:!1}),f={source:t.String(),truncated:t.Boolean(),continuation:t.Optional(P),fullResult:t.Optional(t.String())},b=t.Object({...f,kind:t.Literal("text"),target:t.Optional(t.String()),lines:t.Array(w),startLine:t.Integer(),endLine:t.Integer(),totalLines:t.Integer(),references:t.Optional(t.Array(k))},{additionalProperties:!1}),S=t.Object({...f,kind:t.Literal("bytes"),bytes:t.Array(t.Integer({minimum:0,maximum:255})),byteOffset:t.Integer(),byteLength:t.Integer(),totalBytes:t.Integer()},{additionalProperties:!1}),v=t.Union([t.Object({type:t.Literal("text"),text:t.String()},{additionalProperties:!1}),t.Object({type:t.Literal("image"),mimeType:t.String()},{additionalProperties:!1})]),T=t.Object({...f,kind:t.Literal("native"),blocks:t.Array(v)},{additionalProperties:!1}),p=t.Union([t.Object({kind:t.Literal("recovery"),source:t.String(),candidates:t.Array(t.Object({path:t.String()},{additionalProperties:!1}))},{additionalProperties:!1}),b,S,T,t.Object({kind:t.Literal("resources"),source:t.Optional(t.String()),resources:t.Array(t.Union([b,S,T])),truncated:t.Boolean(),fullResult:t.Optional(t.String())},{additionalProperties:!1})]),C=m(p);function E(e){return{lineNumber:e.lineNumber,content:e.content,lineEnding:e.lineEnding,...e.anchors===void 0?{}:{anchors:[...e.anchors]}}}i(E,"publicLine");function O(e){if(e.kind==="resources"){let o=e.resources.map(d=>O(d));return{kind:e.kind,...e.source===void 0?{}:{source:e.source},resources:o,truncated:o.some(d=>typeof d=="object"&&d!==null&&"truncated"in d&&d.truncated===!0)}}if(e.kind==="bytes"){let o=e.bytes.slice(0,32768),d=e.truncated===!0||o.length<e.bytes.length;return{kind:e.kind,source:e.source,bytes:o,byteOffset:e.byteOffset,byteLength:o.length,totalBytes:e.totalBytes,truncated:d,...e.byteOffset+o.length<e.totalBytes?{continuation:{path:e.source,offset:e.byteOffset+o.length}}:{}}}if(e.kind==="native")return{kind:e.kind,source:e.source,truncated:!1,blocks:e.blocks.map(o=>{if(o.type==="text")return{type:o.type,text:o.text};if(o.type==="image")return{type:o.type,mimeType:o.mimeType};throw new TypeError("Custom content requires a structured adapter")})};let n=[],s=0;for(let o of e.lines){let d=E(o);if(s+=Buffer.byteLength(JSON.stringify(d)),n.length>=2e3||s>512*1024)break;n.push(d)}if(n.length===0&&e.lines.length>0)throw new RangeError("Selected line exceeds the structured window; use a raw byte range or a source-specific view");let a=n.length<e.lines.length,R=n.at(-1)?.lineNumber??e.startLine-1;return{kind:e.kind,source:e.source,...e.target===void 0?{}:{target:e.target},lines:n,startLine:n[0]?.lineNumber??0,endLine:n.at(-1)?.lineNumber??0,totalLines:e.totalLines,truncated:a,...e.target===void 0?{}:{target:e.target},...e.references===void 0?{}:{references:e.references},...a||R<e.totalLines?{continuation:{path:e.source,offset:R+1}}:{}}}i(O,"publicData");function D(e){let n=e.details.failure,s=n?.cause instanceof x?n.cause:void 0;if(e.isError||n!==void 0)return g(e,p,{status:"error",...n?.candidates?.length&&n.source!==void 0?{data:{kind:"recovery",source:n.source,candidates:n.candidates}}:{},errors:[{code:s?.code??n?.code??"READ_FAILED",message:s===void 0?n?.message??"Read failed":`${s.code}: ${n?.source??s.source}`,...n?.source===void 0?{}:{source:n.source}}]});try{if(e.script===void 0)throw new TypeError("Read handler must return structured script data");let a=O(e.script);return g(e,p,{status:"success",data:e.details.temporarySource!==void 0&&typeof a=="object"&&a!==null?{...a,fullResult:e.details.temporarySource}:a,errors:[]})}catch(a){return g(e,p,{status:"error",errors:[{code:a instanceof RangeError?"STRUCTURED_RESULT_TOO_LARGE":"STRUCTURED_ADAPTER_REQUIRED",message:a instanceof Error?a.message:String(a)}]})}}i(D,"structuredRead");var c=r.Function([],r.Unknown()),A=r.Object({resolver:r.Unknown(),matchesCall:r.Optional(c),renderCall:r.Optional(c),priority:r.Optional(r.Number()),renderResult:r.Optional(c),preserveTruncatedOutput:r.Optional(r.Boolean())}),F=r.Object({resolver:r.Unknown(),priority:r.Optional(r.Number())}),N=r.Object({id:r.String({pattern:"\\S"}),priority:r.Optional(r.Number()),resolve:c}),U=r.Object({view:r.String({pattern:"\\S"}),contentKind:r.Optional(r.Union([r.Literal("text"),r.Literal("any")])),includes:r.Optional(r.Array(r.String({pattern:"\\S"}))),presenter:r.Object({id:r.String(),present:c}),priority:r.Optional(r.Number())}),j=r.Object({resolvedBy:r.String({pattern:"\\S"}),contentKind:r.Union([r.Literal("text"),r.Literal("any")])}),I=r.Union([r.Object({stage:r.Literal("pre-read"),handler:c}),r.Object({stage:r.Literal("read"),when:j,handler:c}),r.Object({stage:r.Literal("post-read"),handler:c})]);function J(e){if(!y.Check(F,e))return!1;let n=e,s=n.resolver;return typeof s.id=="string"&&s.id.length>0&&typeof s.tryResolve=="function"&&(!("priority"in n)||typeof n.priority=="number")}i(J,"isTextTargetResolverRegistration");function Y(e){if(!y.Check(A,e))return!1;let n=e;return h(n.resolver)?n.resolver.id!=="any"&&(!("priority"in n)||typeof n.priority=="number")&&(!("matchesCall"in n)||typeof n.matchesCall=="function")&&(!("renderCall"in n)||typeof n.renderCall=="function")&&"matchesCall"in n=="renderCall"in n&&(!("renderResult"in n)||typeof n.renderResult=="function"):!1}i(Y,"isResourceResolverRegistration");function X(e){return y.Check(I,e)}i(X,"isReadHandlerRegistration");function Z(e){return y.Check(U,e)}i(Z,"isReadViewRegistration");function ee(e){return y.Check(N,e)}i(ee,"isFragmentResolverRegistration");function te(e){return B(e)?e.kind==="not-handled"?!0:e.kind==="failed"?typeof e.message=="string"&&e.message.length>0:e.kind==="resolved"&&typeof e.originLine=="number":!1}i(te,"isReadFragmentResolution");function B(e){return typeof e=="object"&&e!==null}i(B,"isRecord");export{u as a,_ as b,p as c,C as d,D as e,J as f,Y as g,X as h,Z as i,ee as j,te as k};
@@ -1 +0,0 @@
1
- import{a as f,b as u}from"./chunk-6XFUICD7.js";import{g as o}from"./chunk-PJL3UVMJ.js";import{b as w}from"./chunk-VDP5CQHM.js";import{a as d}from"./chunk-EI7MMDWY.js";import{readFile as R}from"node:fs/promises";import{Type as i}from"typebox";import{Value as g}from"typebox/value";var y=i.Object({url:i.String(),status:i.Integer({minimum:200,maximum:599}),statusText:i.String(),headers:i.Array(i.Tuple([i.String(),i.String()])),body:i.String()}),b=new Set(["INVALID_SOURCE","BYTE_LIMIT","TIMEOUT","HTTP_FAILED"]),m;async function S(n,s,t,c){c?.throwIfAborted(),m??=R(new URL("./web-http-worker.py",new URL("../src/backend/web-http.ts",import.meta.url).href),"utf8");try{let e=await f(n,"python3",["-c",await m,JSON.stringify({url:s.href,timeoutSeconds:30})],t,{signal:c,timeoutMs:3e4,maxBytes:33554432});if(e.exitCode!==0)throw new o("HTTP_FAILED",t,"not-applied");let r;try{r=JSON.parse(e.stdout.toString("utf8"))}catch{throw new o("INVALID_RESPONSE",t,"not-applied")}if(typeof r=="object"&&r!==null&&"error"in r)throw new o(typeof r.error=="string"&&b.has(r.error)?r.error:"INVALID_RESPONSE",t,"not-applied");if(!g.Check(y,r))throw new o("INVALID_RESPONSE",t,"not-applied");let h=Buffer.from(r.body,"base64");if(h.toString("base64")!==r.body||h.length>16*1024*1024)throw new o("INVALID_RESPONSE",t,"not-applied");let a;try{let p=new URL(r.url);if(!["http:","https:"].includes(p.protocol)||p.username||p.password)throw new Error("Invalid native HTTP redirect");a=new Response([204,205,304].includes(r.status)?null:h,{status:r.status,statusText:r.statusText,headers:r.headers}),Object.defineProperty(a,"url",{value:p.href})}catch{throw new o("INVALID_RESPONSE",t,"not-applied")}return a}catch(e){throw e instanceof o?new o(e.code,t,e.effect):e}}d(S,"fetchSshWebResponse");function I(n){if(!/^web:/iu.test(n))return;let s=/^web:ssh:\/\/([a-z0-9._-]+)\/(https?:\/\/.+)$/iu.exec(n);if(!s?.[1]||!s[2])throw new o("INVALID_SOURCE",n,"not-applied");let t;try{t=new URL(s[2])}catch{throw new o("INVALID_SOURCE",n,"not-applied")}if(t.username||t.password)throw new o("INVALID_SOURCE",n,"not-applied");return{target:s[1],url:t,source:`web:ssh://${s[1]}/${t.href}`}}d(I,"parseSshWebSource");function D(n,s){return{id:"ssh-web",async tryResolve(t,c){try{let e=I(t);if(!e)return{kind:"not-handled"};c.signal?.throwIfAborted();let r=s.resolve(`ssh://${e.target}/`);if(!r)throw new o("UNSUPPORTED_SOURCE",e.source,"not-applied");let a=await w(n,{fetch:d(async(p,l)=>S(r.backend.target,e.url,e.source,l?.signal??void 0),"fetch"),browser:{load(p,l){return u(r.backend.target,p,e.source,l)}}}).tryResolve(e.url.href,c);return a.kind!=="resolved"?a:{kind:"resolved",resource:{...a.resource,source:e.source}}}catch(e){return{kind:"failed",error:e instanceof o?new o(e.code,t,e.effect):e}}}}}d(D,"createSshWebResolver");export{I as a,D as b};
@@ -1 +0,0 @@
1
- import{c as S,d as C}from"./chunk-4DIUPEDF.js";import{a as h}from"./chunk-EI7MMDWY.js";import z from"node:path";import{pathToFileURL as x}from"node:url";function b(e,n){let r=new Map;for(let t of e){let i=r.get(t.source)??[];i.push(t),r.set(t.source,i)}let a=new Set,u=e.length,s=[...r].sort(([t,i],[d,m])=>m.length-i.length||t.localeCompare(d));for(let[t,i]of s){if(u<=n)break;a.add(t),u-=i.length-1}let c=[],o=n,l=[...r].sort(([t],[i])=>Number(a.has(t))-Number(a.has(i))||t.localeCompare(i));for(let[t,i]of l){if(!a.has(t)){if(i.length>o)continue;c.push({kind:"detailed",source:t,matches:i}),o-=i.length;continue}if(o<1)continue;o--;let d=new Map;for(let g of i)d.set(g.lineText,(d.get(g.lineText)??0)+1);let m=r.size===1?[...d].sort(([g,p],[F,w])=>w-p||g.localeCompare(F)).slice(0,o).map(([g,p])=>({text:g,matchCount:p})):[];o-=m.length,c.push({kind:"compacted",source:t,matchCount:i.length,uniqueLineCount:d.size,groups:m})}return c.sort((t,i)=>t.source.localeCompare(i.source)),{files:c}}h(b,"planSearchPresentation");function N(e,n,r,a,u,s=50){let c=b(n,s),o=new Set(n.map(t=>t.source)).size,l=c.files.map(t=>t.kind==="detailed"?L(t.source,t.matches,a):{path:M(t.source,a),link:x(t.source).href,matchCount:t.matchCount,uniqueLineCount:t.uniqueLineCount,groups:t.groups,lines:[]});return{...u!==void 0&&{sessionId:u},query:e,matchCount:n.length,fileCount:o,...c.files.length<o?{omittedFileCount:o-l.length,omittedMatchCount:n.length-l.reduce((t,i)=>t+i.matchCount,0)}:{},complete:r,files:l}}h(N,"createSearchToolDetails");function $(e,n){return{fileCount:new Set(e.flatMap(r=>r.matches.map(a=>a.source))).size,groups:e.map(r=>{let u=N(r.identifier,r.matches.slice(0,S.previewMatches),r.complete,n).files.map(s=>{let c=s.lines.map(o=>{let l=Math.max(0,(o.ranges[0]?.from??0)-64),t=Math.min(o.text.length,(o.ranges[0]?.to??0)+64),i=l>0?"\u2026":"",d=o.ranges.filter(m=>m.from>=l&&m.to<=t).map(m=>({from:m.from-l+i.length,to:m.to-l+i.length}));return{...o,text:i+o.text.slice(l,t)+(t<o.text.length?"\u2026":""),ranges:d,matchCount:d.length}});return{...s,lines:c,matchCount:c.reduce((o,l)=>o+l.matchCount,0)}});return{identifier:r.identifier,files:u}})}}h($,"createFuzzyPresentation");function k(e){return f(e)&&y(e.fileCount)&&Array.isArray(e.groups)&&e.groups.every(n=>f(n)&&typeof n.identifier=="string"&&Array.isArray(n.files)&&n.files.every(R))}h(k,"isFuzzyPresentation");function E(e){if(!f(e)||typeof e.query!="string"||!y(e.matchCount)||!y(e.fileCount)||e.omittedFileCount!==void 0&&!y(e.omittedFileCount)||e.omittedMatchCount!==void 0&&!y(e.omittedMatchCount)||typeof e.complete!="boolean"||e.sessionId!==void 0&&typeof e.sessionId!="string"||e.fuzzy!==void 0&&!C(e.fuzzy)||e.fuzzyPresentation!==void 0&&!k(e.fuzzyPresentation)||!Array.isArray(e.files)||!e.files.every(R))return!1;let n=e.files;return e.fileCount===n.length+(e.omittedFileCount??0)&&e.matchCount===n.reduce((r,a)=>r+a.matchCount,0)+(e.omittedMatchCount??0)}h(E,"isSearchToolDetails");function L(e,n,r){let a=new Map;for(let s of n){let c=a.get(s.lineNumber);if(c!==void 0&&c.text!==s.lineText)throw new Error(`Search results disagree about line ${String(s.lineNumber)} in ${e}.`);let o=c??{lineNumber:s.lineNumber,text:s.lineText,ranges:[]};o.ranges.push({from:s.startColumn,to:s.endColumn}),a.set(s.lineNumber,o)}let u=[...a.values()].sort((s,c)=>s.lineNumber-c.lineNumber).map(s=>{let c=[...s.ranges].sort((o,l)=>o.from-l.from||o.to-l.to);return{lineNumber:s.lineNumber,text:s.text,matchCount:c.length,ranges:c}});return{path:M(e,r),link:x(e).href,matchCount:n.length,lines:u}}h(L,"createSearchResultFile");function R(e){if(!f(e)||typeof e.path!="string"||typeof e.link!="string"||!y(e.matchCount)||!Array.isArray(e.lines)||!e.lines.every(P))return!1;let n=e.lines,r=e.groups,a=new Set(n.flatMap(u=>u.logicalMatchIds??[]));return(r===void 0||Array.isArray(r)&&r.every(u=>f(u)&&typeof u.text=="string"&&y(u.matchCount)))&&(e.uniqueLineCount===void 0||y(e.uniqueLineCount))&&(n.length===0||(a.size>0?a.size===e.matchCount:e.matchCount===n.reduce((u,s)=>u+s.matchCount,0)))}h(R,"isSearchResultFile");function P(e){return f(e)&&Number.isSafeInteger(e.lineNumber)&&e.lineNumber>=1&&typeof e.text=="string"&&y(e.matchCount)&&Array.isArray(e.ranges)&&e.ranges.length===e.matchCount&&(e.logicalMatchIds===void 0||Array.isArray(e.logicalMatchIds)&&e.logicalMatchIds.every(n=>typeof n=="string"))&&e.ranges.every(n=>A(n,e.text))}h(P,"isSearchResultLine");function A(e,n){return f(e)&&Number.isSafeInteger(e.from)&&Number.isSafeInteger(e.to)&&e.from>=0&&e.to>e.from&&e.to<=n.length}h(A,"isSearchResultRange");function f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}h(f,"isRecord");function y(e){return Number.isSafeInteger(e)&&e>=0}h(y,"isCount");function M(e,n){if(e.includes("://"))return e;let r=z.relative(n,e);return r.length>0&&!r.startsWith("..")&&!z.isAbsolute(r)?r:e}h(M,"displaySource");export{b as a,N as b,$ as c,E as d};
@@ -1 +0,0 @@
1
- import{a as d}from"./chunk-VMTOFEXF.js";import{g as n}from"./chunk-PJL3UVMJ.js";import{a as p}from"./chunk-EI7MMDWY.js";import{readFile as h}from"node:fs/promises";import{Type as m}from"typebox";import{Value as g}from"typebox/value";async function f(s,a,e,o,t){return d(s,a,e,o,{...t,effect:"not-applied"})}p(f,"readOwnedSshCommand");var S=m.Object({html:m.String(),source:m.String()}),u=new Set(["CAPABILITY_UNAVAILABLE","INVALID_SOURCE","BYTE_LIMIT","TIMEOUT","HTTP_FAILED","BROWSER_FAILED","CANCELLED"]),l;async function B(s,a,e,o){let t=await w(s,a,e,o,"html");if(!g.Check(S,t)||Buffer.byteLength(t.html,"utf8")>16*1024*1024)throw new n("INVALID_RESPONSE",e,"not-applied");let r=new URL(t.source);if(!["http:","https:"].includes(r.protocol)||r.username||r.password)throw new n("INVALID_RESPONSE",e,"not-applied");return t}p(B,"readSshBrowserPage");async function N(s,a,e,o){let t=await w(s,a,e,{signal:o,timeoutMs:3e4},"image");if(typeof t!="object"||t===null||!("png"in t)||typeof t.png!="string")throw new n("INVALID_RESPONSE",e,"not-applied");let r=Buffer.from(t.png,"base64");if(r.toString("base64")!==t.png||r.length>20*1024*1024||!r.subarray(0,8).equals(Buffer.from("89504e470d0a1a0a","hex")))throw new n("INVALID_RESPONSE",e,"not-applied");return r}p(N,"captureSshBrowserImage");async function R(s,a,e){let o=await w(s,new URL("about:blank"),a,{signal:e,timeoutMs:3e4},"probe");if(!g.Check(m.Object({ready:m.Literal(!0)}),o))throw new n("INVALID_RESPONSE",a,"not-applied")}p(R,"probeSshBrowser");async function w(s,a,e,o,t){o.signal?.throwIfAborted(),l??=h(new URL("./web-browser-worker.mjs",new URL("../src/backend/web-browser.ts",import.meta.url).href),"utf8");try{let r=await f(s,"node",["--input-type=module","-e",await l,JSON.stringify({kind:t,url:a.href,timeoutMs:o.timeoutMs})],e,{signal:o.signal,timeoutMs:o.timeoutMs,maxBytes:33554432});if(r.exitCode!==0)throw new n("BROWSER_FAILED",e,"not-applied");let i;try{i=JSON.parse(r.stdout.toString("utf8"))}catch{throw new n("INVALID_RESPONSE",e,"not-applied")}if(typeof i=="object"&&i!==null&&"error"in i)throw new n(typeof i.error=="string"&&u.has(i.error)?i.error:"INVALID_RESPONSE",e,"not-applied");return i}catch(r){throw r instanceof n?new n(r.code==="ENOENT"?"CAPABILITY_UNAVAILABLE":r.code,e,r.effect):r}}p(w,"runBrowser");export{f as a,B as b,N as c,R as d};
@@ -1,6 +0,0 @@
1
- import{a as r}from"./chunk-EI7MMDWY.js";var c=new TextEncoder().encode("%PDF-"),b=1024;function w(){return{id:"pdf",description:"PDF paths and URLs return the document's readable content.",async tryConvert(e,t){let n=f(t.signal);if(n!==void 0)return{kind:"failed",error:n};if(!h(e.bytes))return T(e.mediaType)?{kind:"failed",error:new TypeError(`${e.source} is not a valid PDF document`)}:{kind:"not-handled"};try{return{kind:"converted",content:await y(e.bytes,t.signal)}}catch(o){return{kind:"failed",error:f(t.signal)??new TypeError(`Unable to read PDF document ${e.source}: ${A(o)}`,{cause:o})}}}}}r(w,"createPdfContentConverter");function h(e){let t=Math.min(e.length,b+c.length);for(let n=0;n+c.length<=t;n+=1)if(c.every((o,s)=>e[n+s]===o))return!0;return!1}r(h,"isPdf");async function y(e,t){i(t);let{getDocument:n}=await import("pdfjs-dist/legacy/build/pdf.mjs");i(t);let o=n({data:new Uint8Array(e),useSystemFonts:!0}),s,u=r(()=>s??=o.destroy(),"destroy"),l=r(()=>{u()},"abort");t?.addEventListener("abort",l,{once:!0});try{let d=await o.promise;i(t);let g=[];for(let a=1;a<=d.numPages;a+=1){i(t);let m=await d.getPage(a),P=await m.getTextContent();i(t);let p=x(P.items);g.push([`## Page ${a} of ${d.numPages}`,"",p.length===0?"[No extractable text on this page.]":p].join(`
2
- `)),m.cleanup()}return[{type:"text",text:["# PDF document",...g].join(`
3
-
4
- `)}]}finally{t?.removeEventListener("abort",l),await u().catch(()=>{})}}r(y,"createPdfContent");function x(e){let t="";for(let n of e)!C(n)||n.str.length===0||(t.length>0&&!E(t)&&!v(n.str)&&(t+=" "),t+=n.str,n.hasEOL===!0&&!t.endsWith(`
5
- `)&&(t+=`
6
- `));return t.trim()}r(x,"extractPageText");function C(e){return typeof e=="object"&&e!==null&&"str"in e&&typeof e.str=="string"}r(C,"isPdfTextItem");function v(e){return/^\s/u.test(e)}r(v,"startsWithWhitespace");function E(e){return/\s$/u.test(e)}r(E,"endsWithWhitespace");function T(e){return e?.split(";",1)[0]?.trim().toLowerCase()==="application/pdf"}r(T,"isPdfMediaType");function A(e){return e instanceof Error?e.message:String(e)}r(A,"errorMessage");function i(e){let t=f(e);if(t!==void 0)throw t}r(i,"throwIfAborted");function f(e){if(e?.aborted!==!0)return;if(e.reason instanceof Error)return e.reason;let t=new Error("The operation was aborted");return t.name="AbortError",t}r(f,"cancellationError");export{w as a,h as b,y as c};
@@ -1 +0,0 @@
1
- import{a as y}from"./chunk-NJ7C4KMA.js";import"./chunk-6H32W35W.js";import"./chunk-NUM3YQGK.js";import{a as b}from"./chunk-QT3EAHOG.js";import{a as k,b as E}from"./chunk-VXP5BMW7.js";import{b as S}from"./chunk-RW2GTYQI.js";import{a as u,b as w,c as v}from"./chunk-RIJMXO43.js";import{g as c}from"./chunk-PJL3UVMJ.js";import{a as p,b as h,d as P}from"./chunk-XG7QNAKW.js";import"./chunk-47SPPIXK.js";import"./chunk-4DIUPEDF.js";import"./chunk-VAXLSPPU.js";import"./chunk-I6NPILT5.js";import{c as f}from"./chunk-W7CASEO3.js";import"./chunk-TOYN4W4F.js";import"./chunk-YJ6T3PEP.js";import"./chunk-S72FVLUX.js";import"./chunk-XXLLY66B.js";import"./chunk-235QMMVA.js";import"./chunk-NNCZYO4Q.js";import"./chunk-IICJXZBU.js";import"./chunk-PS2B6THP.js";import"./chunk-BU7IZLKB.js";import"./chunk-S5PL5DFQ.js";import"./chunk-LCWBVOII.js";import"./chunk-DUUOCBS3.js";import"./chunk-T4FTT3U4.js";import"./chunk-ZPT5D4VP.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import{c as m}from"./chunk-IMGIDBCC.js";import"./chunk-BXGMMZT3.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import{a as i}from"./chunk-EI7MMDWY.js";import R from"node:path";function g(d){let n=i(o=>{let e=d.resolve(o);if(!e)throw new c("UNSUPPORTED_SOURCE",o,"not-applied");return e},"resolve");return{transport:i(o=>y(d,o),"transport"),async readText(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes.toString("utf8")},async readSnapshot(o,e){let r=n(o),t=await r.backend.read(r.location.path,{signal:e});return{content:t.bytes.toString("utf8"),version:t.version}},async readBytes(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes},async exists(o,e){let r=n(o);try{return await r.backend.stat(r.location.path,{signal:e}),!0}catch(t){if(t instanceof c&&t.code==="ENOENT")return!1;throw t}},async isFile(o,e){let r=n(o);return(await r.backend.stat(r.location.path,{signal:e})).kind==="file"},async entries(o,e){let r=n(o);return(await r.backend.list(r.location.path,{signal:e})).map(t=>({name:t.name,kind:t.kind==="symlink"?"other":t.kind}))}}}i(g,"createSshLspWorkspaceOwner");async function O(d){let n=new v(await w(u(f()))),o=g(n);await P(d,{workspace:i(e=>e.startsWith("ssh://")?o:void 0,"workspace"),async loadRegistry(e,r,t){t?.throwIfAborted();let s=n.resolve(e);if(s)return h.fromPackageDir(e,{signal:t,layerAccess:k(n,t),includeGlobal:!r,requireBuiltInEvidence:r,recipes:p,recipeEvidence:i(a=>E(s.backend,s.location.path,a,t),"recipeEvidence"),executableAvailability:i(a=>S(s.backend,s.location.path,a,t),"executableAvailability")});if(e.includes("://"))throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return h.fromPackageDir(r?e:process.env.PI_AGENT_IDE_CONFIG_DIR??e,{signal:t,includeGlobal:!r,requireBuiltInEvidence:r,recipes:p})},async resolveProject(e,r,t){if(t?.throwIfAborted(),e.startsWith("ssh://")||r.startsWith("ssh://")){let a=n.resolve(e,r);if(!a)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");let l=n.resolve(r);if(l&&l.location.target!==a.location.target)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return b(a.backend,a.location.path,l?.location.path,"lsp-servers",p,t)}let s=await m(r,e,"lsp-servers",p,t);return s===void 0?void 0:{cwd:s,external:s!==R.resolve(r)}}})}i(O,"registerOwnedLsp");export{O as default};
@@ -1,3 +0,0 @@
1
- import{a as N,b as B}from"./chunk-VDP5CQHM.js";import{a as O}from"./chunk-47SPPIXK.js";import{a as $,c as b,e as D,f as _,g as L,h as y,i as H}from"./chunk-4DIUPEDF.js";import{a as A,b as k}from"./chunk-VAXLSPPU.js";import{e as I}from"./chunk-I6NPILT5.js";import{a as z}from"./chunk-YJ6T3PEP.js";import{b as S,c as v}from"./chunk-S72FVLUX.js";import{d as T}from"./chunk-IICJXZBU.js";import{a as C}from"./chunk-BU7IZLKB.js";import{a as P,b as x}from"./chunk-S5PL5DFQ.js";import{F as E,l as W}from"./chunk-LCWBVOII.js";import{e as R}from"./chunk-756K3LJY.js";import{a as i}from"./chunk-EI7MMDWY.js";var M={protocol:S,apiVersion:v,id:"web-browser",setup(r){r.addCheck({id:"system-browser",title:"Browser web reads",async run(e){try{e.signal?.throwIfAborted();let t=e.workspace?await V(e.workspace,e.signal):await R(await N(e.env.PI_AGENT_IDE_BROWSER_PATH,e.env),["--version"],e.cwd,e.env,e.signal);return e.signal?.throwIfAborted(),[t.ok?{status:"pass",message:"Chrome/Chromium is available",detail:t.detail}:{status:"warn",message:"Chrome/Chromium cannot start",detail:t.detail}]}catch(t){return e.signal?.throwIfAborted(),[{status:"warn",message:"Browser reads are unavailable",detail:t instanceof Error?t.message:String(t)}]}}})}};async function V(r,e){if(!r.probeBrowser)throw new Error("Project owner does not provide a browser probe");return r.probeBrowser(e)}i(V,"probeOwnerBrowser");function F(r){return{id:"web",readResources:i(e=>e.path!==void 0&&/^https?:/iu.test(e.path)?[e.path]:[],"readResources"),async tryResolve(e,t){let o=e.path;if(o===void 0||!/^(?:https?:|web:)/iu.test(o))return{kind:"not-handled"};if(e.include!==void 0||e.exclude!==void 0)return{kind:"failed",error:new Error("File include/exclude globs do not apply to a web page.")};let s=q(e),a=await r.tryResolve(o,t);if(a.kind!=="resolved")return a;if(a.resource.read===void 0)return{kind:"failed",error:new Error(`Cannot read ${o}`)};let n=await a.resource.read({signal:t.signal});if(n.some(l=>l.type!=="text"))return{kind:"failed",error:new Error(`Web search requires text content: ${o}`)};let u=n.map(l=>l.type==="text"?l.text:"").join(`
2
- `),d=[],h=e.limit??50;for(let[l,m]of u.split(/\r\n|\n|\r/u).entries()){t.signal?.throwIfAborted();for(let c of m.matchAll(s)){if(c[0].length===0)continue;let p=c.index,f=p+c[0].length;if(!(e.wholeWord===!0&&(new RegExp("\\p{L}|\\p{N}|_","u").test(m[p-1]??"")||new RegExp("\\p{L}|\\p{N}|_","u").test(m[f]??"")))){if(d.length===h)return{kind:"resolved",payload:{source:o,matches:d,complete:!1}};d.push({source:o,lineNumber:l+1,startColumn:p,endColumn:f,matchedText:c[0],lineText:m})}}}let g=d.length===0&&D(e.query)?U(u,o,e.query,t.signal):void 0;return{kind:"resolved",payload:{source:o,matches:d,complete:!0,...g===void 0?{}:{fuzzy:g}}}},toScriptData(e){let t=e;return{...I(t.matches,t.complete),...t.fuzzy===void 0?{}:{fuzzy:{...t.fuzzy,candidates:t.fuzzy.candidates.map(o=>y(o))}}}},renderResult(e,t,o){let s=e.details;return $(s.matches,s.complete,o,t.expanded,void 0,["Web page \xB7 read-only",...s.complete?[]:["Limit reached \xB7 incomplete results"]])},format(e){let t=e,o=t.matches.length===0?`No matches in ${t.source}`:`${t.matches.length}${t.complete?"":"+"} matches in ${t.source}${t.complete?"":" (limit reached)"}`,s=[o];t.fuzzy?.status==="skipped"&&s.push(`Possible-name fallback skipped: ${t.fuzzy.message}`),t.fuzzy?.candidates.length&&s.push("Possible names \u2014 spelling suggestions, not equivalent behavior.",...t.fuzzy.candidates.map(n=>H(y(n))));let a=Buffer.byteLength(o);for(let n of t.matches){let u=`${t.source}:${n.lineNumber}:${n.startColumn+1} ${j(n)}`;if(a+=Buffer.byteLength(u)+1,a>48*1024){s.push("Output shortened. Narrow the query or lower the limit.");break}s.push(u)}return{content:[{type:"text",text:s.join(`
3
- `)}],details:t}}}}i(F,"createWebSearchResolver");function U(r,e,t,o){o?.throwIfAborted();let s=performance.now(),a=new _;if(a.addText(r),a.limited)return{status:"skipped",message:"name collection reached its byte or unique-name budget",candidates:[]};let n=[];for(let u of L(t,a.names)){if(o?.throwIfAborted(),performance.now()-s>b.timeoutMs)return{status:"skipped",message:"extra search reached its time budget",candidates:[]};let d=new RegExp(u.identifier.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),"gu"),h=[],g=!0,l=0;e:for(let[m,c]of r.split(/\r\n|\n|\r/u).entries()){if(performance.now()-s>b.timeoutMs)return{status:"skipped",message:"extra search reached its time budget",candidates:[]};o?.throwIfAborted();for(let p of c.matchAll(d)){let f=p.index,w=f+p[0].length;if(!(/[\p{L}\p{N}_$]/u.test(c[f-1]??"")||/[\p{L}\p{N}_$]/u.test(c[w]??""))){if(l+=Buffer.byteLength(c),h.length===b.matchesPerCandidate||l>b.verificationBytes){g=!1;break e}h.push({source:e,lineNumber:m+1,startColumn:f,endColumn:w,matchedText:p[0],lineText:c})}}}h.length>0&&n.push({...u,matches:h,complete:g})}return n.length===0?void 0:{status:"ready",candidates:n}}i(U,"searchFuzzyText");function j(r){let e=Math.max(0,r.startColumn-64),t=Math.min(r.lineText.length,r.startColumn+192);return`${e>0?"\u2026":""}${r.lineText.slice(e,t)}${t<r.lineText.length?"\u2026":""}`}i(j,"previewMatch");function q(r){let e=r.query,t=e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e,o=e.startsWith("regex:")?e.slice(6):t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(o,r.caseSensitive===!0?"gu":"giu")}i(q,"searchPattern");var G={provider:"web",capability:"read"},J=T({kind:"markdown",label:"WEB"});async function Q(r){await K(r)}i(Q,"registerWeb");async function K(r,e){let t=E(r,G),o=B(t,{owner:e?.(t)}),s={protocol:P,apiVersion:x,id:"web",setup(n){n.addResolver({resolver:o,renderResult:J,preserveTruncatedOutput:!0}),n.describe({path:i(()=>W(e?"HTTP(S) URLs use local HTTP/browser execution; web:ssh://target/https://\u2026 explicitly uses the configured target. Web content is read-only. Target browser fallback requires target-installed Node, playwright-core and Chrome/Chromium. Browser reads enable page JavaScript and disable the Chromium sandbox, using a fresh temporary profile.":"HTTP(S) URL \u2014 remote content.",t.listDescriptions()),"path")})}},a={protocol:A,apiVersion:k,id:"web",setup(n){n.addResolver({resolver:F(o),priority:-100}),n.describe("HTTP(S) Search reuses converted page text for zero-result identifier spelling suggestions. Candidate groups carry the URL and line ranges, never editable SEARCH references."),n.addPromptGuideline(e?"Use search with an HTTP(S) path for local web execution or web:ssh://target/https://\u2026 for explicit target execution; no prior read is required.":"Use search with an HTTP(S) path to find text on a web page; no prior read is required.")}};await Promise.all([C(r,s),O(r,a),Promise.resolve(z(r,M))])}i(K,"registerWebWithOwner");export{Q as a,K as b};