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
@@ -1,214 +0,0 @@
1
- import type { ResolvedResultTargets } from "pi-agent-resource";
2
- import {
3
- publicRange,
4
- retainRegion,
5
- SelectionError,
6
- type SelectedRegion,
7
- } from "./selection-region.js";
8
- import { SourceText } from "./source-text.js";
9
- import type { TextSelectOperation } from "./select-schema.js";
10
-
11
- interface Interval {
12
- readonly from: number;
13
- readonly to: number;
14
- }
15
-
16
- /** Derive source-backed text boundaries from independently retained input regions. */
17
- export function selectTextRegions(
18
- input: ResolvedResultTargets,
19
- operation: TextSelectOperation,
20
- signal?: AbortSignal,
21
- ): { readonly regions: readonly SelectedRegion[]; readonly missingInputs: number } {
22
- signal?.throwIfAborted();
23
- const absolute = operation.kind === "range" || operation.kind === "lines";
24
- if (absolute && new Set(input.targets.map((target) => target.source)).size > 1)
25
- throw new SelectionError("MULTIPLE_SOURCES", "Absolute text bounds require one source.");
26
- const selected = new Map<string, SelectedRegion>();
27
- let missingInputs = 0;
28
- for (const target of input.targets) {
29
- signal?.throwIfAborted();
30
- const source = new SourceText(target.expectedContent);
31
- const requested = absolute ? absoluteInterval(source, operation) : undefined;
32
- let contained = false;
33
- for (const seed of target.ranges) {
34
- signal?.throwIfAborted();
35
- const from = source.offset(seed.start);
36
- const to = source.offset(seed.end);
37
- source.range(from, to);
38
- const intervals = requested
39
- ? requested.from >= from && requested.to <= to
40
- ? [requested]
41
- : []
42
- : transform(source, { from, to }, operation, signal);
43
- if (!intervals.length) missingInputs++;
44
- else contained = true;
45
- for (const interval of intervals) {
46
- signal?.throwIfAborted();
47
- const range = source.range(interval.from, interval.to);
48
- const expanded = interval.from < from || interval.to > to;
49
- if (
50
- expanded &&
51
- operation.kind !== "linesOf" &&
52
- !(operation.kind === "between" && operation.extent === "lines")
53
- )
54
- throw new SelectionError("OUTSIDE_SCOPE", "Text selection exceeds its input scope.");
55
- retainRegion(selected, {
56
- target,
57
- range,
58
- text: source.content.slice(interval.from, interval.to),
59
- origins: [{ source: target.source, range: publicRange(seed), expanded }],
60
- });
61
- }
62
- }
63
- if (requested && !contained)
64
- throw new SelectionError(
65
- "OUTSIDE_SCOPE",
66
- "Requested text bounds are outside every input scope.",
67
- );
68
- }
69
- return { regions: [...selected.values()], missingInputs };
70
- }
71
-
72
- function absoluteInterval(
73
- source: SourceText,
74
- operation: Extract<TextSelectOperation, { kind: "range" | "lines" }>,
75
- ): Interval {
76
- if (operation.kind === "range") {
77
- const from = source.offset({ lineNumber: operation.startLine, column: operation.startColumn });
78
- const to = source.offset({ lineNumber: operation.endLine, column: operation.endColumn });
79
- source.range(from, to);
80
- return { from, to };
81
- }
82
- const first = source.lines[operation.first - 1];
83
- const last = source.lines[operation.last - 1];
84
- if (
85
- !Number.isSafeInteger(operation.first) ||
86
- !Number.isSafeInteger(operation.last) ||
87
- !first ||
88
- !last ||
89
- operation.last < operation.first
90
- )
91
- throw new SelectionError(
92
- "INVALID_RANGE",
93
- "Line bounds are outside the retained snapshot or reversed.",
94
- );
95
- return { from: first.start, to: last.end };
96
- }
97
-
98
- function transform(
99
- source: SourceText,
100
- seed: Interval,
101
- operation: TextSelectOperation,
102
- signal?: AbortSignal,
103
- ): readonly Interval[] {
104
- const text = source.content.slice(seed.from, seed.to);
105
- switch (operation.kind) {
106
- case "between": {
107
- nonEmpty(operation.start);
108
- nonEmpty(operation.end);
109
- const ranges: Interval[] = [];
110
- let cursor = 0;
111
- while (cursor <= text.length) {
112
- signal?.throwIfAborted();
113
- const left = text.indexOf(operation.start, cursor);
114
- if (left < 0) break;
115
- const right = text.indexOf(operation.end, left + operation.start.length);
116
- if (right < 0)
117
- throw new SelectionError(
118
- "UNMATCHED_MARKER",
119
- "Opening marker has no following closing marker in its input scope.",
120
- );
121
- const markerStart = seed.from + left;
122
- const markerEnd = seed.from + right + operation.end.length;
123
- // Even an omitted marker must not cut a source character or line-ending pair.
124
- source.boundary(markerStart);
125
- source.boundary(markerStart + operation.start.length);
126
- source.boundary(seed.from + right);
127
- source.boundary(markerEnd);
128
- ranges.push(
129
- operation.extent === "lines"
130
- ? source.fullLines(markerStart, markerEnd)
131
- : {
132
- from:
133
- operation.extent === "inside"
134
- ? markerStart + operation.start.length
135
- : markerStart,
136
- to: operation.extent === "inside" ? seed.from + right : markerEnd,
137
- },
138
- );
139
- cursor = right + operation.end.length;
140
- }
141
- return ranges;
142
- }
143
- case "sliceText": {
144
- const to = operation.to ?? text.length;
145
- orderedBounds(operation.from, to, text.length);
146
- return [{ from: seed.from + operation.from, to: seed.from + to }];
147
- }
148
- case "trim": {
149
- if (!text.trim().length) return [{ from: seed.to, to: seed.to }];
150
- const from = operation.side === "end" ? 0 : text.length - text.trimStart().length;
151
- const to = operation.side === "start" ? text.length : text.trimEnd().length;
152
- return [{ from: seed.from + from, to: seed.from + to }];
153
- }
154
- case "split": {
155
- nonEmpty(operation.delimiter);
156
- const ranges: Interval[] = [];
157
- let cursor = 0;
158
- while (cursor <= text.length) {
159
- signal?.throwIfAborted();
160
- const separator = text.indexOf(operation.delimiter, cursor);
161
- ranges.push({
162
- from: seed.from + cursor,
163
- to: separator < 0 ? seed.to : seed.from + separator,
164
- });
165
- if (separator < 0) break;
166
- cursor = separator + operation.delimiter.length;
167
- }
168
- return ranges;
169
- }
170
- case "linesOf": {
171
- return [source.fullLines(seed.from, seed.to)];
172
- }
173
- case "position": {
174
- const point = operation.edge === "before" ? seed.from : seed.to;
175
- return [{ from: point, to: point }];
176
- }
177
- case "columns": {
178
- const ranges: Interval[] = [];
179
- const first = source.lineIndex(seed.from);
180
- const last = source.lineIndex(seed.to > seed.from ? seed.to - 1 : seed.from);
181
- for (let index = first; index <= last; index++) {
182
- signal?.throwIfAborted();
183
- const line = source.lines[index];
184
- if (!line) throw new SelectionError("INVALID_RANGE", "Source line bounds are unavailable.");
185
- orderedBounds(operation.from, operation.to, line.length);
186
- const range = { from: line.start + operation.from, to: line.start + operation.to };
187
- if (range.from < seed.from || range.to > seed.to)
188
- throw new SelectionError("OUTSIDE_SCOPE", "Requested columns exceed their input scope.");
189
- ranges.push(range);
190
- }
191
- return ranges;
192
- }
193
- case "range":
194
- case "lines": {
195
- throw new SelectionError("INVALID_RANGE", "Absolute bounds must resolve against one source.");
196
- }
197
- }
198
- }
199
-
200
- function nonEmpty(marker: string): void {
201
- if (!marker.length)
202
- throw new SelectionError("INVALID_MARKER", "Use a non-empty literal marker or delimiter.");
203
- }
204
-
205
- function orderedBounds(from: number, to: number, length: number): void {
206
- if (
207
- !Number.isSafeInteger(from) ||
208
- !Number.isSafeInteger(to) ||
209
- from < 0 ||
210
- to < from ||
211
- to > length
212
- )
213
- throw new SelectionError("INVALID_RANGE", "Text bounds are outside their region or reversed.");
214
- }
@@ -1,277 +0,0 @@
1
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { Text } from "@earendil-works/pi-tui";
3
- import { connectAgentDocumentation, loadPackagedAgentGuide } from "pi-agent-documentation";
4
- import type { ReadPluginApi } from "pi-agent-read/api/plugin-protocol";
5
- import { connectResultTargets, resultError, withStructuredResult } from "pi-agent-resource";
6
- import { ResultPanel, toolCallHeader, type ResultPanelModel } from "pi-agent-tool-ui";
7
- import {
8
- ToolCallInterceptionRenderStore,
9
- withToolCallInterceptionRendering,
10
- } from "pi-agent-tool-call-interception";
11
- import { selectPresentation } from "./select-presentation.js";
12
-
13
- import { selectStructuralRegions } from "./ast/selection.js";
14
- import { publicRange } from "./selection-region.js";
15
- import { selectTextRegions } from "./text-selection.js";
16
- import { selectGeometryRegions } from "./geometry-selection.js";
17
- import {
18
- selectSchema,
19
- selectOutputSchema,
20
- selectionDataSchema,
21
- type SelectionData,
22
- type SelectParameters,
23
- type GeometrySelectOperation,
24
- } from "./select-schema.js";
25
- /** Show selected text and opaque item references, never the internal selection record. */
26
- function selectionText(data: SelectionData): string {
27
- const rows = [`${data.totalItems} selection(s)${data.complete ? "" : " · incomplete input"}`];
28
- if (!data.complete)
29
- rows.push("Obtain complete source selections before checking absence or editing.");
30
- if (data.missingInputs) rows.push(`${data.missingInputs} input range(s) produced no selection`);
31
- for (const item of data.items) {
32
- const range = item.range;
33
- rows.push(
34
- `${item.target} ${item.source}:${range.startLine}:${range.startColumn}–${range.endLine}:${range.endColumn}${item.syntax ? ` ${item.syntax.object}${item.syntax.part ? `/${item.syntax.part}` : ""}` : ""}`,
35
- item.preview,
36
- );
37
- if (range.startLine === range.endLine && range.startColumn === range.endColumn)
38
- rows.push("Zero-width position; no text selected.");
39
- if (item.textTruncated)
40
- rows.push("… preview shortened; pass this item reference to consume the full selection");
41
- }
42
- if (data.truncated)
43
- rows.push("… more selections retained; pass the whole result to consume all selections");
44
- return rows.join("\n");
45
- }
46
-
47
- function operationLabel(operation: SelectParameters["operation"]): string {
48
- switch (operation.kind) {
49
- case "object": {
50
- return `enclosing ${operation.object} · level ${operation.level ?? 1}`;
51
- }
52
- case "part": {
53
- return `part ${operation.part}`;
54
- }
55
- case "elementExtent": {
56
- return `list element · ${operation.extent}`;
57
- }
58
- case "navigate": {
59
- return `${operation.relation}${operation.relation === "siblings" ? ` ${operation.direction ?? "all"}` : ""}${operation.object ? ` · ${operation.object}` : ""}`;
60
- }
61
- case "between": {
62
- return `between ${JSON.stringify(operation.start)} … ${JSON.stringify(operation.end)} · ${operation.extent}`;
63
- }
64
- case "range": {
65
- return `range ${operation.startLine}:${operation.startColumn}–${operation.endLine}:${operation.endColumn}`;
66
- }
67
- case "lines": {
68
- return `lines ${operation.first}–${operation.last}`;
69
- }
70
- case "sliceText": {
71
- return `text slice ${operation.from}–${operation.to ?? "end"}`;
72
- }
73
- case "trim": {
74
- return `trim ${operation.side}`;
75
- }
76
- case "split": {
77
- return `split ${JSON.stringify(operation.delimiter)}`;
78
- }
79
- case "linesOf": {
80
- return "containing lines";
81
- }
82
- case "position": {
83
- return `position ${operation.edge}`;
84
- }
85
- case "columns": {
86
- return `columns ${operation.from}–${operation.to}`;
87
- }
88
- case "within":
89
- case "intersection":
90
- case "difference": {
91
- return operation.kind;
92
- }
93
- case "merge": {
94
- return operation.adjacent ? "merge overlaps and adjacent ranges" : "merge overlaps";
95
- }
96
- }
97
- }
98
- function isGeometryOperation(
99
- operation: SelectParameters["operation"],
100
- ): operation is GeometrySelectOperation {
101
- return (
102
- operation.kind === "within" ||
103
- operation.kind === "intersection" ||
104
- operation.kind === "difference" ||
105
- operation.kind === "merge"
106
- );
107
- }
108
- /** Register read-only text and AST selection using the existing Read and source-target backends. */
109
- export async function registerSelect(pi: ExtensionAPI, read: ReadPluginApi): Promise<void> {
110
- const targets = connectResultTargets(pi);
111
- connectAgentDocumentation(pi, [
112
- await loadPackagedAgentGuide({
113
- id: "select-code",
114
- description:
115
- "Derive text and AST boundaries, navigate constructs and combine source-range sets",
116
- triggers: [{ tool: "select" }],
117
- }),
118
- ]);
119
- pi.registerTool(
120
- withToolCallInterceptionRendering(
121
- {
122
- name: "select",
123
- label: "select",
124
- exposure: "direct",
125
- namespace: {
126
- name: "ide_select",
127
- description: "Derive exact source boundaries from existing targets.",
128
- },
129
- annotations: {
130
- readOnlyHint: true,
131
- destructiveHint: false,
132
- idempotentHint: false,
133
- openWorldHint: false,
134
- },
135
- description:
136
- "Use select to derive text ranges or positions, navigate JavaScript/TypeScript constructs and their parts (without JSX/TSX), and combine source-local selections. Pass the returned result or an item reference to Read, Search or an edit tool. Select does not change files.",
137
- promptSnippet:
138
- "Derive text and AST boundaries, navigate constructs and combine source-range sets",
139
- promptGuidelines: [
140
- "Use Search for predicate matches and existing captures; use Select when a target needs new text or structural boundaries.",
141
- "Compare the enclosing owner of each inner match with the original function when checking a condition in that function's own body.",
142
- ],
143
- parameters: selectSchema,
144
- outputSchema: selectOutputSchema,
145
- renderCall(parameters, theme, context) {
146
- return toolCallHeader(
147
- context.lastComponent,
148
- {
149
- tool: "select",
150
- primary: {
151
- text: operationLabel(parameters.operation),
152
- color: "accent",
153
- },
154
- qualifiers: [
155
- {
156
- text:
157
- typeof parameters.path === "string" && !parameters.path.startsWith("RESULT#")
158
- ? parameters.path
159
- : "in result scope",
160
- },
161
- ],
162
- expanded: context.expanded,
163
- },
164
- theme,
165
- );
166
- },
167
- renderResult(result, options, theme) {
168
- const presentation = result.details as ResultPanelModel | undefined;
169
- if (typeof presentation?.summary === "string" && Array.isArray(presentation.rows))
170
- return new ResultPanel(presentation, theme, options.expanded);
171
- return new Text(
172
- result.content
173
- .flatMap((block) => (block.type === "text" ? [block.text] : []))
174
- .join("\n"),
175
- 0,
176
- 0,
177
- );
178
- },
179
- async execute(_id, parameters: SelectParameters, signal, _onUpdate, context) {
180
- try {
181
- signal?.throwIfAborted();
182
- const resolve = async (source: unknown) => {
183
- if (typeof source === "string" && !source.startsWith("RESULT#")) {
184
- const resolved = await read.read(
185
- { path: source },
186
- { cwd: context.cwd, ...(signal !== undefined && { signal }) },
187
- "script",
188
- );
189
- if (resolved.isError) throw new Error("Select could not read this source.");
190
- source = resolved.script;
191
- }
192
- return targets.resolve(source, context.cwd);
193
- };
194
- const input = await resolve(parameters.path);
195
- const operation = parameters.operation;
196
- const scopes =
197
- isGeometryOperation(operation) && "scopes" in operation
198
- ? await resolve(operation.scopes)
199
- : { targets: [], complete: true };
200
- const verified = {
201
- targets: [...input.targets, ...scopes.targets],
202
- complete: input.complete && scopes.complete,
203
- };
204
- await targets.verify(verified, signal);
205
- const selected = isGeometryOperation(operation)
206
- ? selectGeometryRegions(input, operation, scopes, signal)
207
- : operation.kind === "object" ||
208
- operation.kind === "part" ||
209
- operation.kind === "navigate" ||
210
- operation.kind === "elementExtent"
211
- ? await selectStructuralRegions(input, operation, context.cwd, signal)
212
- : selectTextRegions(input, operation, signal);
213
- await targets.verify(verified, signal);
214
- signal?.throwIfAborted();
215
- const sourceTargets = selected.regions.map((region) => ({
216
- ...region.target,
217
- ranges: [region.range],
218
- }));
219
- const data: SelectionData = {
220
- kind: "selection",
221
- target: targets.register(sourceTargets, context.cwd, verified.complete),
222
- complete: verified.complete,
223
- totalItems: selected.regions.length,
224
- missingInputs: selected.missingInputs,
225
- truncated: selected.regions.length > 100,
226
- items: selected.regions.slice(0, 100).map((region) => {
227
- const preview = region.text.slice(0, 1000).replace(/[\uD800-\uDBFF]$/u, "");
228
- return {
229
- target: targets.register(
230
- [{ ...region.target, ranges: [region.range] }],
231
- context.cwd,
232
- verified.complete,
233
- ),
234
- source: region.target.source,
235
- range: publicRange(region.range),
236
- origins: region.origins,
237
- ...(region.syntax ? { syntax: region.syntax } : {}),
238
- preview,
239
- textTruncated: preview.length < region.text.length,
240
- };
241
- }),
242
- };
243
- return withStructuredResult(
244
- {
245
- content: [{ type: "text", text: selectionText(data) }],
246
- details: selectPresentation(
247
- selected.regions,
248
- verified.complete,
249
- selected.missingInputs,
250
- context.cwd,
251
- ),
252
- },
253
- selectionDataSchema,
254
- { status: "success", data, errors: [] },
255
- );
256
- } catch (error) {
257
- if (signal?.aborted) throw error;
258
- return withStructuredResult<ResultPanelModel | undefined, never>(
259
- {
260
- content: [
261
- {
262
- type: "text",
263
- text: `${error instanceof Error ? error.message : String(error)}\nResolve the reported error before retrying. Do not treat a failed selection as an empty result.`,
264
- },
265
- ],
266
- details: undefined,
267
- },
268
- selectionDataSchema,
269
- { status: "error", errors: [resultError(error, "SELECT_FAILED")] },
270
- );
271
- }
272
- },
273
- },
274
- new ToolCallInterceptionRenderStore(),
275
- ),
276
- );
277
- }
@@ -1,2 +0,0 @@
1
- export * from "../../../../dist/entry-38.js";
2
- export { default } from "../../../../dist/entry-38.js";
@@ -1,136 +0,0 @@
1
- import { requiredValue } from "pi-agent-invariant";
2
- import {
3
- type CodeViewScheme,
4
- formatCodeViewReference,
5
- parseCodeViewReference,
6
- resolveCodeViewPath,
7
- type SourceMappedTextContent,
8
- } from "pi-agent-ide/api/code-view";
9
-
10
- import {
11
- type LspManager,
12
- readLspFileGraph,
13
- readLspSymbolBody,
14
- readLspSymbolGraph,
15
- } from "./lsp/index.js";
16
-
17
- import type {
18
- ResourceResolutionAttempt,
19
- ResourceResolver,
20
- ResourceResolverContext,
21
- } from "pi-agent-resource";
22
-
23
- export type LspManagerProvider = (
24
- cwd: string,
25
- filePath?: string,
26
- signal?: AbortSignal,
27
- ) => Promise<LspManager>;
28
-
29
- export function createLspSymbolResolver(getManager: LspManagerProvider): ResourceResolver {
30
- return createCodeViewResolver("symbol", "lsp-symbol", getManager, async (request) => {
31
- return await readLspSymbolBody(
32
- request.manager,
33
- request.filePath,
34
- requiredValue(request.selector),
35
- request.cwd,
36
- request.signal,
37
- );
38
- });
39
- }
40
-
41
- export function createLspGraphResolver(getManager: LspManagerProvider): ResourceResolver {
42
- return createCodeViewResolver("graph", "lsp-graph", getManager, async (request) => {
43
- if (request.selector === undefined) {
44
- return await readLspFileGraph(request.manager, request.filePath, request.cwd, request.signal);
45
- }
46
-
47
- return await readLspSymbolGraph(
48
- request.manager,
49
- request.filePath,
50
- request.selector,
51
- request.cwd,
52
- request.signal,
53
- );
54
- });
55
- }
56
-
57
- interface CodeViewReadRequest {
58
- readonly manager: LspManager;
59
- readonly filePath: string;
60
- readonly selector?: readonly string[];
61
- readonly cwd: string;
62
- readonly signal?: AbortSignal;
63
- }
64
-
65
- type CodeViewRead = (request: CodeViewReadRequest) => Promise<string | SourceMappedTextContent>;
66
-
67
- function createCodeViewResolver(
68
- scheme: Extract<CodeViewScheme, "symbol" | "graph">,
69
- id: string,
70
- getManager: LspManagerProvider,
71
- read: CodeViewRead,
72
- ): ResourceResolver {
73
- return {
74
- id,
75
- tryResolve(source, context) {
76
- return Promise.resolve(resolveCodeViewSource(source, context, scheme, getManager, read));
77
- },
78
- };
79
- }
80
-
81
- function resolveCodeViewSource(
82
- source: string,
83
- context: ResourceResolverContext,
84
- scheme: Extract<CodeViewScheme, "symbol" | "graph">,
85
- getManager: LspManagerProvider,
86
- read: CodeViewRead,
87
- ): ResourceResolutionAttempt {
88
- let reference;
89
-
90
- try {
91
- reference = parseCodeViewReference(source, scheme);
92
- } catch (error) {
93
- return { kind: "failed", error };
94
- }
95
-
96
- if (reference === undefined) {
97
- return { kind: "not-handled" };
98
- }
99
-
100
- let filePath: string;
101
-
102
- try {
103
- filePath = resolveCodeViewPath(reference.path, context.cwd);
104
- } catch (error) {
105
- return { kind: "failed", error };
106
- }
107
-
108
- const canonicalSource = formatCodeViewReference(scheme, filePath, reference.selector);
109
- return {
110
- kind: "resolved",
111
- resource: {
112
- source: canonicalSource,
113
- async read(operationContext) {
114
- const manager = await getManager(context.cwd, filePath, operationContext.signal);
115
- const content = await read({
116
- manager,
117
- filePath,
118
- cwd: context.cwd,
119
- ...optionalSelector(reference.selector),
120
- ...optionalSignal(operationContext.signal),
121
- });
122
- return [typeof content === "string" ? { type: "text", text: content } : content];
123
- },
124
- },
125
- };
126
- }
127
-
128
- function optionalSelector(
129
- selector: readonly string[] | undefined,
130
- ): Pick<CodeViewReadRequest, "selector"> {
131
- return selector === undefined ? {} : { selector };
132
- }
133
-
134
- function optionalSignal(signal: AbortSignal | undefined): { readonly signal?: AbortSignal } {
135
- return signal === undefined ? {} : { signal };
136
- }