pi-agent-ide 0.8.1 → 0.8.2

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 (414) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +5 -3
  3. package/dist/{chunk-TGC2ZACO.js → chunk-235QMMVA.js} +1 -1
  4. package/dist/{chunk-OI3HBIPK.js → chunk-4DIUPEDF.js} +1 -1
  5. package/dist/{chunk-2ITKAXHO.js → chunk-6FGLAVPJ.js} +1 -1
  6. package/dist/{chunk-7LOVUWNI.js → chunk-6H32W35W.js} +1 -1
  7. package/dist/{chunk-YHREORHH.js → chunk-6OJ565FL.js} +1 -1
  8. package/dist/{chunk-E2PHA4SQ.js → chunk-6R3Y4AD3.js} +1 -1
  9. package/dist/{chunk-VNTY7BKC.js → chunk-6T7PSDQW.js} +1 -1
  10. package/dist/{chunk-D4IA2MTA.js → chunk-6TJPMBUQ.js} +1 -1
  11. package/dist/{chunk-JKMXND6V.js → chunk-6XFUICD7.js} +1 -1
  12. package/dist/chunk-7VSVJRRF.js +28 -0
  13. package/dist/{chunk-A64JRDZK.js → chunk-AAC77UD4.js} +1 -1
  14. package/dist/{chunk-HFJGCYFO.js → chunk-ANM3Y5FO.js} +5 -5
  15. package/dist/{chunk-Q5X6OXNS.js → chunk-CPELC6JE.js} +1 -1
  16. package/dist/chunk-FTPC44FP.js +33 -0
  17. package/dist/{chunk-3WO2NOEQ.js → chunk-GSOYVIQS.js} +1 -1
  18. package/dist/{chunk-AIT3YWR5.js → chunk-HSRH76JN.js} +1 -1
  19. package/dist/{chunk-ID4RJIVZ.js → chunk-HSZ4AQ6L.js} +1 -1
  20. package/dist/chunk-I6NPILT5.js +1 -0
  21. package/dist/chunk-K7SRNBIV.js +1 -0
  22. package/dist/{chunk-DXONCYWF.js → chunk-LCWBVOII.js} +3 -3
  23. package/dist/{chunk-EMRJP6EM.js → chunk-LEJKDYCK.js} +1 -1
  24. package/dist/{chunk-HCK7OIQ3.js → chunk-NJ7C4KMA.js} +1 -1
  25. package/dist/{chunk-BQAKA3FU.js → chunk-NUM3YQGK.js} +1 -1
  26. package/dist/chunk-OJEIX7OZ.js +1 -0
  27. package/dist/{chunk-4HWKBCBH.js → chunk-PJL3UVMJ.js} +1 -1
  28. package/dist/{chunk-AKNHSDGV.js → chunk-QT3EAHOG.js} +1 -1
  29. package/dist/{chunk-LLRUJD62.js → chunk-RIJMXO43.js} +1 -1
  30. package/dist/chunk-RMI3NMQY.js +23 -0
  31. package/dist/chunk-RQ7JJ7GV.js +4 -0
  32. package/dist/{chunk-AUL5FGGK.js → chunk-RVU73VKN.js} +1 -1
  33. package/dist/{chunk-WPBQ45ZL.js → chunk-RW2GTYQI.js} +1 -1
  34. package/dist/{chunk-BR7GRH4A.js → chunk-SDAH3ECM.js} +1 -1
  35. package/dist/chunk-SGQWRIRJ.js +10 -0
  36. package/dist/{chunk-N56WAVYA.js → chunk-SMIFCAAX.js} +1 -1
  37. package/dist/chunk-SWBJS3U4.js +1 -0
  38. package/dist/{chunk-WXGTU2M6.js → chunk-VMTOFEXF.js} +1 -1
  39. package/dist/{chunk-GEMDU6XW.js → chunk-VXP5BMW7.js} +1 -1
  40. package/dist/{chunk-LAJQSHEI.js → chunk-XAHU42FP.js} +3 -3
  41. package/dist/{chunk-ZV5ETNLQ.js → chunk-XBQR74IK.js} +1 -1
  42. package/dist/{chunk-TXG2H7YQ.js → chunk-XG7QNAKW.js} +1 -1
  43. package/dist/{chunk-PRLIHLCS.js → chunk-XLWCSJMR.js} +1 -1
  44. package/dist/{chunk-M4TVRCMZ.js → chunk-XXLLY66B.js} +1 -1
  45. package/dist/chunk-YFP4P2FV.js +1 -0
  46. package/dist/{chunk-SWA5B5B2.js → chunk-YIXP2ALP.js} +1 -1
  47. package/dist/{chunk-246NTPOS.js → chunk-ZJQRLVVV.js} +1 -1
  48. package/dist/entry-0.js +1 -1
  49. package/dist/entry-1.js +1 -1
  50. package/dist/entry-10.js +1 -1
  51. package/dist/entry-11.js +1 -1
  52. package/dist/entry-12.js +1 -1
  53. package/dist/entry-13.js +1 -1
  54. package/dist/entry-14.js +1 -1
  55. package/dist/entry-15.js +1 -1
  56. package/dist/entry-16.js +1 -1
  57. package/dist/entry-17.js +1 -1
  58. package/dist/entry-18.js +1 -1
  59. package/dist/entry-19.js +1 -0
  60. package/dist/entry-2.js +1 -1
  61. package/dist/entry-20.js +1 -1
  62. package/dist/entry-22.js +1 -1
  63. package/dist/entry-23.js +1 -1
  64. package/dist/entry-24.js +1 -1
  65. package/dist/entry-25.js +1 -1
  66. package/dist/entry-26.js +1 -1
  67. package/dist/entry-27.js +1 -2
  68. package/dist/entry-28.js +1 -1
  69. package/dist/entry-29.js +2 -4
  70. package/dist/entry-3.js +1 -1
  71. package/dist/entry-30.js +1 -1
  72. package/dist/entry-31.js +4 -1
  73. package/dist/entry-32.js +1 -1
  74. package/dist/entry-33.js +1 -18
  75. package/dist/entry-34.js +1 -1
  76. package/dist/entry-35.js +18 -1
  77. package/dist/entry-36.js +1 -1
  78. package/dist/entry-37.js +1 -1
  79. package/dist/entry-38.js +1 -1
  80. package/dist/entry-39.js +1 -1
  81. package/dist/entry-4.js +1 -1
  82. package/dist/entry-40.js +1 -1
  83. package/dist/entry-41.js +1 -1
  84. package/dist/entry-42.js +1 -1
  85. package/dist/entry-43.js +1 -1
  86. package/dist/entry-44.js +1 -1
  87. package/dist/entry-45.js +1 -1
  88. package/dist/entry-46.js +1 -1
  89. package/dist/entry-47.js +1 -25
  90. package/dist/entry-48.js +1 -1
  91. package/dist/entry-49.js +25 -1
  92. package/dist/entry-5.js +1 -1
  93. package/dist/entry-50.js +1 -1
  94. package/dist/entry-51.js +1 -1
  95. package/dist/entry-52.js +1 -3
  96. package/dist/entry-53.js +1 -13
  97. package/dist/entry-54.js +3 -1
  98. package/dist/entry-55.js +13 -1
  99. package/dist/entry-56.js +1 -1
  100. package/dist/entry-57.js +1 -1
  101. package/dist/entry-58.js +1 -1
  102. package/dist/entry-59.js +1 -1
  103. package/dist/entry-6.js +1 -1
  104. package/dist/entry-60.js +1 -1
  105. package/dist/entry-61.js +1 -1
  106. package/dist/entry-62.js +1 -1
  107. package/dist/entry-63.js +1 -0
  108. package/dist/entry-64.js +1 -1
  109. package/dist/entry-66.js +1 -1
  110. package/dist/entry-67.js +0 -1
  111. package/dist/entry-68.js +1 -1
  112. package/dist/entry-69.js +1 -1
  113. package/dist/entry-7.js +1 -1
  114. package/dist/entry-70.js +1 -1
  115. package/dist/entry-71.js +1 -1
  116. package/dist/entry-72.js +1 -1
  117. package/dist/entry-73.js +1 -0
  118. package/dist/entry-74.js +1 -1
  119. package/dist/entry-76.js +1 -1
  120. package/dist/entry-77.js +0 -1
  121. package/dist/entry-78.js +1 -1
  122. package/dist/entry-79.js +1 -80
  123. package/dist/entry-8.js +1 -1
  124. package/dist/entry-80.js +1 -22
  125. package/dist/entry-81.js +80 -2
  126. package/dist/entry-82.js +22 -1
  127. package/dist/entry-83.js +2 -1
  128. package/dist/entry-84.js +1 -1
  129. package/dist/entry-85.js +1 -3
  130. package/dist/entry-86.js +1 -1
  131. package/dist/entry-87.js +1 -1
  132. package/dist/entry-88.js +3 -1
  133. package/dist/entry-89.js +1 -0
  134. package/dist/entry-9.js +1 -1
  135. package/dist/entry-90.js +1 -0
  136. package/dist/entry-91.js +1 -0
  137. package/dist/pi-agent-ide.js +29 -36
  138. package/docs/agent-guides/debugger.md +2 -0
  139. package/docs/agent-guides/editing.md +3 -3
  140. package/docs/agent-guides/search-code.md +2 -2
  141. package/docs/agent-guides/select-code.md +9 -6
  142. package/docs/code-review.md +5 -0
  143. package/docs/configuration.md +36 -4
  144. package/docs/development.md +8 -0
  145. package/docs/directory-operations.md +1 -1
  146. package/docs/extensions.md +98 -1
  147. package/docs/structured-results.md +11 -6
  148. package/docs/user-hooks.md +2 -2
  149. package/node_modules/pi-agent-doctor/package.json +7 -7
  150. package/node_modules/pi-agent-doctor/runtime/entry-27.js +1 -0
  151. package/node_modules/pi-agent-documentation/package.json +2 -2
  152. package/node_modules/pi-agent-documentation/runtime/entry-28.js +1 -0
  153. package/node_modules/pi-agent-filesystem/package.json +8 -8
  154. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  155. package/node_modules/pi-agent-filesystem-jq/package.json +6 -6
  156. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  157. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +2 -0
  158. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  159. package/node_modules/pi-agent-ide-ast/package.json +15 -15
  160. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +6 -5
  161. package/node_modules/pi-agent-ide-changes/package.json +10 -10
  162. package/node_modules/pi-agent-ide-changes/runtime/entry-36.js +1 -0
  163. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
  164. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  165. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  166. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  167. package/node_modules/pi-agent-ide-lint/runtime/entry-40.js +2 -0
  168. package/node_modules/pi-agent-ide-lsp/package.json +10 -10
  169. package/node_modules/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
  170. package/node_modules/pi-agent-image/package.json +3 -3
  171. package/node_modules/pi-agent-invariant/package.json +2 -2
  172. package/node_modules/pi-agent-pdf/package.json +3 -3
  173. package/node_modules/pi-agent-read/package.json +12 -12
  174. package/node_modules/pi-agent-read/runtime/entry-47.js +0 -1
  175. package/node_modules/pi-agent-read/runtime/entry-49.js +2 -0
  176. package/node_modules/pi-agent-resource/package.json +2 -2
  177. package/node_modules/pi-agent-resource/src/resource-error.ts +11 -0
  178. package/node_modules/pi-agent-search/package.json +9 -9
  179. package/node_modules/pi-agent-search/runtime/entry-52.js +0 -1
  180. package/node_modules/pi-agent-search/runtime/entry-53.js +1 -0
  181. package/node_modules/pi-agent-search/runtime/entry-54.js +2 -0
  182. package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
  183. package/node_modules/pi-agent-search-text/package.json +14 -14
  184. package/node_modules/pi-agent-search-text/runtime/entry-55.js +1 -0
  185. package/node_modules/pi-agent-search-text/runtime/entry-58.js +1 -0
  186. package/node_modules/pi-agent-text/package.json +3 -3
  187. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  188. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  189. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  190. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
  191. package/node_modules/pi-agent-text-editor/index.ts +2 -0
  192. package/node_modules/pi-agent-text-editor/package.json +26 -26
  193. package/node_modules/pi-agent-text-editor/runtime/entry-79.js +0 -1
  194. package/node_modules/pi-agent-text-editor/runtime/entry-80.js +1 -0
  195. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
  196. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
  197. package/node_modules/pi-agent-text-editor/src/core/extension.ts +3 -1
  198. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +45 -44
  199. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  200. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +27 -18
  201. package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
  202. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
  203. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +29 -6
  204. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
  205. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
  206. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
  207. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
  208. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  209. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
  210. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +14 -3
  211. package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +17 -0
  212. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -5
  213. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +2 -0
  214. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  215. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +1 -0
  216. package/node_modules/pi-agent-tool-ui/package.json +6 -2
  217. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +1 -0
  218. package/node_modules/pi-agent-tool-ui/runtime/entry-86.js +1 -0
  219. package/node_modules/pi-agent-tool-ui/src/operation-approval.ts +271 -0
  220. package/node_modules/pi-agent-web/package.json +8 -8
  221. package/node_modules/pi-agent-web-html/package.json +3 -3
  222. package/node_modules/pi-agent-web-image/package.json +4 -4
  223. package/node_modules/pi-agent-web-image/runtime/entry-89.js +2 -0
  224. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  225. package/node_modules/pi-agent-web-pdf/runtime/entry-90.js +2 -0
  226. package/node_modules/pi-agent-web-text/package.json +4 -4
  227. package/node_modules/pi-agent-web-text/runtime/entry-91.js +2 -0
  228. package/package.json +62 -54
  229. package/src/api/approval.ts +5 -0
  230. package/src/api/settings.ts +198 -0
  231. package/src/backend/debugger-registration.ts +5 -1
  232. package/src/code-review/extension.ts +10 -4
  233. package/src/code-review/reviewer.ts +8 -0
  234. package/src/composite/host-version.ts +29 -5
  235. package/src/composite/ide-alias-rendering.ts +97 -0
  236. package/src/composite/nested-tool-rendering.ts +74 -4
  237. package/src/composite/search-facts.ts +45 -0
  238. package/src/composite/settings-documentation.ts +32 -23
  239. package/src/composite/settings-registry.ts +94 -0
  240. package/src/composite/text-results.ts +120 -8
  241. package/src/composite/tool-availability.ts +11 -2
  242. package/src/core/diagnostic-entry.ts +31 -8
  243. package/src/core/diagnostic-store.ts +19 -3
  244. package/src/core/extension.ts +7 -2
  245. package/src/documentation/registry.ts +10 -2
  246. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  247. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  248. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +6 -6
  249. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  250. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +2 -0
  251. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  252. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-33.js +2 -0
  253. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +2 -0
  254. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  255. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  256. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  257. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +2 -0
  258. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  259. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-90.js +2 -0
  260. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  261. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-91.js +2 -0
  262. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +2 -0
  263. package/src/extensions/pi-agent-read/package.json +12 -12
  264. package/src/extensions/pi-agent-read/runtime/entry-47.js +0 -1
  265. package/src/extensions/pi-agent-read/runtime/entry-48.js +1 -0
  266. package/src/extensions/pi-agent-read/runtime/entry-49.js +2 -0
  267. package/src/extensions/pi-agent-search/package.json +9 -9
  268. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -14
  269. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +1 -0
  270. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  271. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-58.js +1 -0
  272. package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
  273. package/src/extensions/pi-agent-search/runtime/entry-53.js +1 -0
  274. package/src/extensions/pi-agent-search/runtime/entry-54.js +2 -0
  275. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
  276. package/src/extensions/pi-agent-text-editor/index.ts +2 -0
  277. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  278. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  279. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  280. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  281. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-63.js +1 -0
  282. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
  283. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  284. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
  285. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +14 -3
  286. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +17 -0
  287. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -5
  288. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +2 -0
  289. package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +0 -1
  290. package/src/extensions/pi-agent-text-editor/runtime/entry-80.js +1 -0
  291. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +2 -0
  292. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
  293. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
  294. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +3 -1
  295. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +45 -44
  296. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  297. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +27 -18
  298. package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
  299. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
  300. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +29 -6
  301. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
  302. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
  303. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
  304. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
  305. package/src/pi-agent-ide.ts +61 -14
  306. package/src/plugins/pi-agent-ide-ast/package.json +15 -15
  307. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +6 -5
  308. package/src/plugins/pi-agent-ide-changes/package.json +10 -10
  309. package/src/plugins/pi-agent-ide-changes/runtime/entry-36.js +1 -0
  310. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
  311. package/src/plugins/pi-agent-ide-debugger/index.ts +158 -55
  312. package/src/plugins/pi-agent-ide-debugger/src/debugmcp-client.ts +118 -0
  313. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +47 -0
  314. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +2 -0
  315. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +146 -1
  316. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +12 -0
  317. package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +497 -0
  318. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  319. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  320. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  321. package/src/plugins/pi-agent-ide-lint/runtime/entry-40.js +2 -0
  322. package/src/plugins/pi-agent-ide-lsp/package.json +10 -10
  323. package/src/plugins/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
  324. package/src/plugins/pi-agent-ide-terminal/index.ts +2 -0
  325. package/src/plugins/pi-agent-ide-terminal/src/origin.ts +30 -0
  326. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +34 -0
  327. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +11 -2
  328. package/src/plugins/pi-agent-ide-terminal/src/types.ts +9 -0
  329. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +72 -26
  330. package/dist/chunk-GNACBJM3.js +0 -1
  331. package/dist/chunk-VMGZMXEM.js +0 -10
  332. package/dist/chunk-W3YFF6OO.js +0 -1
  333. package/dist/chunk-W7M3V7FR.js +0 -28
  334. package/dist/chunk-WMHSVEIT.js +0 -29
  335. package/dist/chunk-XSIKDVAR.js +0 -25
  336. package/dist/chunk-YTYLS2UM.js +0 -1
  337. package/dist/chunk-Z2QGNTGQ.js +0 -1
  338. package/dist/entry-21.js +0 -1
  339. package/node_modules/pi-agent-doctor/runtime/entry-20.js +0 -1
  340. package/node_modules/pi-agent-doctor/runtime/entry-21.js +0 -1
  341. package/node_modules/pi-agent-filesystem/runtime/entry-27.js +0 -2
  342. package/node_modules/pi-agent-filesystem-image/runtime/entry-28.js +0 -2
  343. package/node_modules/pi-agent-ide-ast/runtime/entry-32.js +0 -1
  344. package/node_modules/pi-agent-ide-formatter/runtime/entry-36.js +0 -2
  345. package/node_modules/pi-agent-image/runtime/entry-40.js +0 -1
  346. package/node_modules/pi-agent-invariant/runtime/entry-41.js +0 -1
  347. package/node_modules/pi-agent-search/runtime/entry-49.js +0 -1
  348. package/node_modules/pi-agent-search-text/runtime/entry-53.js +0 -2
  349. package/node_modules/pi-agent-search-text/runtime/entry-54.js +0 -1
  350. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-58.js +0 -2
  351. package/node_modules/pi-agent-text-editor/runtime/entry-64.js +0 -1
  352. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-80.js +0 -2
  353. package/node_modules/pi-agent-tool-call-interception/runtime/entry-82.js +0 -1
  354. package/node_modules/pi-agent-tool-ui/runtime/entry-83.js +0 -1
  355. package/node_modules/pi-agent-web/runtime/entry-84.js +0 -2
  356. package/node_modules/pi-agent-web-html/runtime/entry-85.js +0 -2
  357. package/node_modules/pi-agent-web-image/runtime/entry-86.js +0 -2
  358. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-28.js +0 -2
  359. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-29.js +0 -2
  360. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-27.js +0 -2
  361. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-85.js +0 -2
  362. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-86.js +0 -2
  363. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-87.js +0 -2
  364. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-84.js +0 -2
  365. package/src/extensions/pi-agent-read/runtime/entry-43.js +0 -1
  366. package/src/extensions/pi-agent-read/runtime/entry-44.js +0 -1
  367. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +0 -2
  368. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-54.js +0 -1
  369. package/src/extensions/pi-agent-search/runtime/entry-49.js +0 -1
  370. package/src/extensions/pi-agent-search/runtime/entry-50.js +0 -1
  371. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-58.js +0 -2
  372. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -1
  373. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-80.js +0 -2
  374. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-81.js +0 -2
  375. package/src/extensions/pi-agent-text-editor/runtime/entry-63.js +0 -1
  376. package/src/extensions/pi-agent-text-editor/runtime/entry-64.js +0 -1
  377. package/src/plugins/pi-agent-ide-ast/runtime/entry-32.js +0 -1
  378. package/src/plugins/pi-agent-ide-ast/runtime/entry-33.js +0 -2
  379. package/src/plugins/pi-agent-ide-formatter/runtime/entry-36.js +0 -2
  380. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-26.js +0 -0
  381. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem}/runtime/entry-29.js +0 -0
  382. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
  383. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-31.js +0 -0
  384. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-33.js +0 -0
  385. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-34.js +0 -0
  386. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
  387. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
  388. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
  389. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-39.js +0 -0
  390. /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-42.js +0 -0
  391. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-43.js +0 -0
  392. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-44.js +0 -0
  393. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-48.js +0 -0
  394. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-50.js +0 -0
  395. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-57.js +0 -0
  396. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-59.js +0 -0
  397. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-60.js +0 -0
  398. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-61.js +0 -0
  399. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-62.js +0 -0
  400. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-63.js +0 -0
  401. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-81.js +0 -0
  402. /package/node_modules/{pi-agent-web-pdf → pi-agent-web}/runtime/entry-87.js +0 -0
  403. /package/node_modules/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-88.js +0 -0
  404. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
  405. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-31.js +0 -0
  406. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-html}/runtime/entry-88.js +0 -0
  407. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-60.js +0 -0
  408. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-61.js +0 -0
  409. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-62.js +0 -0
  410. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-34.js +0 -0
  411. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
  412. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
  413. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
  414. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-39.js +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-ide-ast",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,31 +8,31 @@
8
8
  "exports": {
9
9
  "./api/scope": {
10
10
  "types": "./src/api/scope.ts",
11
- "default": "./runtime/entry-32.js"
11
+ "default": "./runtime/entry-34.js"
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "pi-agent-doctor": "0.8.1",
16
- "pi-agent-documentation": "0.8.1",
17
- "pi-agent-invariant": "0.8.1",
18
- "pi-agent-read": "0.8.1",
19
- "pi-agent-resource": "0.8.1",
20
- "pi-agent-search": "0.8.1",
21
- "pi-agent-search-text": "0.8.1",
22
- "pi-agent-text": "0.8.1",
23
- "pi-agent-text-editor": "0.8.1",
24
- "pi-agent-tool-call-interception": "0.8.1",
25
- "pi-agent-tool-ui": "0.8.1"
15
+ "pi-agent-doctor": "0.8.2",
16
+ "pi-agent-documentation": "0.8.2",
17
+ "pi-agent-invariant": "0.8.2",
18
+ "pi-agent-read": "0.8.2",
19
+ "pi-agent-resource": "0.8.2",
20
+ "pi-agent-search": "0.8.2",
21
+ "pi-agent-search-text": "0.8.2",
22
+ "pi-agent-text": "0.8.2",
23
+ "pi-agent-text-editor": "0.8.2",
24
+ "pi-agent-tool-call-interception": "0.8.2",
25
+ "pi-agent-tool-ui": "0.8.2"
26
26
  },
27
27
  "pi": {
28
28
  "extensions": [
29
- "./runtime/entry-33.js"
29
+ "./runtime/entry-35.js"
30
30
  ]
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@earendil-works/pi-coding-agent": "*",
34
34
  "@earendil-works/pi-tui": "*",
35
- "pi-agent-ide": "0.8.1",
35
+ "pi-agent-ide": "0.8.2",
36
36
  "typebox": "*"
37
37
  },
38
38
  "peerDependenciesMeta": {
@@ -197,11 +197,12 @@ const astPartSchema = Type.Union([
197
197
  Type.Literal("finalizer"),
198
198
  Type.Literal("parameter"),
199
199
  ]);
200
- const objectFilter = Type.Optional({
201
- ...astObjectSchema,
202
- description:
203
- "Filter results by construct category after navigation. The filter does not change parent/child/sibling relationships.",
204
- });
200
+ const objectFilter = Type.Optional(
201
+ Type.Union(astObjectSchema.anyOf, {
202
+ description:
203
+ "Filter results by construct category after navigation. The filter does not change parent/child/sibling relationships.",
204
+ }),
205
+ );
205
206
  const structuralOperationSchema = Type.Union([
206
207
  Type.Object(
207
208
  {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-ide-changes",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,21 +8,21 @@
8
8
  "exports": {
9
9
  "./changes/change-groups": {
10
10
  "types": "./src/changes/change-groups.ts",
11
- "default": "./runtime/entry-34.js"
11
+ "default": "./runtime/entry-36.js"
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "pi-agent-doctor": "0.8.1",
16
- "pi-agent-documentation": "0.8.1",
17
- "pi-agent-invariant": "0.8.1",
18
- "pi-agent-read": "0.8.1",
19
- "pi-agent-resource": "0.8.1",
20
- "pi-agent-text": "0.8.1",
21
- "pi-agent-text-editor": "0.8.1"
15
+ "pi-agent-doctor": "0.8.2",
16
+ "pi-agent-documentation": "0.8.2",
17
+ "pi-agent-invariant": "0.8.2",
18
+ "pi-agent-read": "0.8.2",
19
+ "pi-agent-resource": "0.8.2",
20
+ "pi-agent-text": "0.8.2",
21
+ "pi-agent-text-editor": "0.8.2"
22
22
  },
23
23
  "pi": {
24
24
  "extensions": [
25
- "./runtime/entry-35.js"
25
+ "./runtime/entry-37.js"
26
26
  ]
27
27
  },
28
28
  "peerDependencies": {
@@ -0,0 +1 @@
1
+ export * from "../../../../dist/entry-36.js";
@@ -13,11 +13,12 @@ import type { TextMutationToolRegistration } from "pi-agent-text-editor/api/muta
13
13
 
14
14
  export const undoSchema = Type.Object(
15
15
  {
16
- file: Type.Optional({
17
- ...resultInputSchema,
18
- description:
19
- "File path or one whole-file source result. Partial and multi-file selections are rejected. Omit file to use the supplied CHANGE anchor's file or the last resolved source.",
20
- }),
16
+ file: Type.Optional(
17
+ Type.Union(resultInputSchema.anyOf, {
18
+ description:
19
+ "File path or one whole-file source result. Partial and multi-file selections are rejected. Omit file to use the supplied CHANGE anchor's file or the last resolved source.",
20
+ }),
21
+ ),
21
22
  change: Type.String({
22
23
  description:
23
24
  'Use a complete current CHANGE#HASH anchor from read with views: ["changes"] to restore that change to HEAD in both worktree and index. Use last to restore the file\'s latest saved text-editor transaction.',
@@ -60,33 +60,20 @@ import {
60
60
  } from "#src/plugins/pi-agent-ide-debugger/src/renderer.js";
61
61
  import {
62
62
  debuggerEvaluationFromResult,
63
+ debuggerFailureFromResult,
63
64
  debuggerSnapshotFromResult,
64
65
  } from "#src/plugins/pi-agent-ide-debugger/src/ui.js";
65
66
  import { debuggerProcessProvider } from "#src/plugins/pi-agent-ide-debugger/src/process-provider.js";
66
67
  import { agentIdeProcessRegistry } from "#src/plugins/pi-agent-ide-processes/src/registry.js";
67
68
  import type { DebugWorkspaceOwnerResolver } from "./src/workspace-owner.js";
69
+ import { VscodeDebugSession } from "./src/vscode-backend.js";
68
70
 
69
71
  interface DebugToolDetails {
70
72
  readonly source?: string;
71
73
  readonly sourceResource?: string;
72
74
  readonly breakpointsResource?: string;
73
- readonly adapter:
74
- | "dart"
75
- | "debugpy"
76
- | "delve"
77
- | "java"
78
- | "elixir"
79
- | "julia"
80
- | "kotlin"
81
- | "lldb-dap"
82
- | "lua"
83
- | "netcoredbg"
84
- | "node"
85
- | "php"
86
- | "powershell"
87
- | "r"
88
- | "ruby"
89
- | "shell";
75
+ /** Native adapter, `vscode`, or the requested backend when creation failed. */
76
+ readonly adapter: string;
90
77
  readonly program: string;
91
78
  readonly sourceFile?: string;
92
79
  readonly cwd: string;
@@ -106,29 +93,37 @@ import {
106
93
 
107
94
  const debugParameters = Type.Object(
108
95
  {
109
- adapter: StringEnum(
110
- [
111
- "dart",
112
- "debugpy",
113
- "delve",
114
- "java",
115
- "elixir",
116
- "julia",
117
- "kotlin",
118
- "lldb-dap",
119
- "lua",
120
- "netcoredbg",
121
- "node",
122
- "php",
123
- "powershell",
124
- "r",
125
- "ruby",
126
- "shell",
127
- ] as const,
128
- {
96
+ backend: Type.Optional(
97
+ StringEnum(["auto", "vscode", "native"] as const, {
129
98
  description:
130
- "Select an installed DAP adapter for Dart, Python, Go, Java, Elixir, Julia, Kotlin, C, C++, Rust, Swift, Zig, Lua, C#, JavaScript, TypeScript, PHP, PowerShell, R, Ruby, or shell scripts.",
131
- },
99
+ "Select the debugger backend. auto (default) debugs through VS Code when the local program is inside a workspace open in VS Code with the DebugMCP extension, that window has no active debug session, and args and mainClass are omitted; otherwise it uses the native adapter. vscode fails with the unmet condition instead of falling back. native always launches the selected adapter.",
100
+ }),
101
+ ),
102
+ adapter: Type.Optional(
103
+ StringEnum(
104
+ [
105
+ "dart",
106
+ "debugpy",
107
+ "delve",
108
+ "java",
109
+ "elixir",
110
+ "julia",
111
+ "kotlin",
112
+ "lldb-dap",
113
+ "lua",
114
+ "netcoredbg",
115
+ "node",
116
+ "php",
117
+ "powershell",
118
+ "r",
119
+ "ruby",
120
+ "shell",
121
+ ] as const,
122
+ {
123
+ description:
124
+ "Select an installed native DAP adapter for Dart, Python, Go, Java, Elixir, Julia, Kotlin, C, C++, Rust, Swift, Zig, Lua, C#, JavaScript, TypeScript, PHP, PowerShell, R, Ruby, or shell scripts. Required for the native backend; VS Code chooses its debugger from launch.json or the file type.",
125
+ },
126
+ ),
132
127
  ),
133
128
  program: Type.String({
134
129
  minLength: 1,
@@ -141,7 +136,10 @@ const debugParameters = Type.Object(
141
136
  }),
142
137
  ),
143
138
  args: Type.Optional(
144
- Type.Array(Type.String(), { description: "Arguments passed to the debugged program." }),
139
+ Type.Array(Type.String(), {
140
+ description:
141
+ "Arguments passed to the debugged program by the native backend. For VS Code, put them in a launch.json configuration.",
142
+ }),
145
143
  ),
146
144
  mainClass: Type.Optional(
147
145
  Type.String({
@@ -149,6 +147,20 @@ const debugParameters = Type.Object(
149
147
  description: "Fully qualified JVM main class. Required by Java and Kotlin adapters.",
150
148
  }),
151
149
  ),
150
+ configuration: Type.Optional(
151
+ Type.String({
152
+ minLength: 1,
153
+ description:
154
+ "Name of a .vscode/launch.json configuration to launch in VS Code. Use it for program arguments or environment. VS Code backend only.",
155
+ }),
156
+ ),
157
+ test: Type.Optional(
158
+ Type.String({
159
+ minLength: 1,
160
+ description:
161
+ "Name of one test to debug through the VS Code Testing API; set program to its test file. VS Code backend only.",
162
+ }),
163
+ ),
152
164
  cwd: Type.Optional(
153
165
  Type.String({
154
166
  description:
@@ -295,12 +307,29 @@ export async function registerDebuggerWithOwner(
295
307
  if (parameters.path !== session.source || parameters.anchor !== undefined) {
296
308
  throw new Error("Debug commands target the session resource without an anchor");
297
309
  }
298
- const evaluation = await executeSessionCommand(
299
- manager,
300
- session,
301
- parameters.text,
302
- context.signal,
303
- );
310
+ let evaluation: DebugEvaluation | undefined;
311
+ try {
312
+ evaluation = await executeSessionCommand(
313
+ manager,
314
+ session,
315
+ parameters.text,
316
+ context.signal,
317
+ );
318
+ } catch (error) {
319
+ // Return the debugger's own reason with the session state instead of a generic edit failure.
320
+ if (context.signal?.aborted === true) throw error;
321
+ const message = error instanceof Error ? error.message : String(error);
322
+ return {
323
+ source: session.source,
324
+ summary: `${parameters.text.trim()} failed: ${message}\n\n${renderDebugSession(session)}`,
325
+ data: {
326
+ ...debugActionData(manager, session, parameters.text),
327
+ ok: false,
328
+ effect: "not-applied",
329
+ error: { code: "DEBUG_ACTION_FAILED", message },
330
+ },
331
+ };
332
+ }
304
333
  return {
305
334
  source: session.source,
306
335
  summary:
@@ -389,7 +418,13 @@ export async function registerDebuggerWithOwner(
389
418
  const snapshot = debuggerSnapshotFromResult(result.details);
390
419
  if (snapshot === undefined) throw new Error("Debugger result is missing its session");
391
420
  const evaluation = debuggerEvaluationFromResult(result.details);
392
- return renderDebugResult(snapshot, options.expanded, theme, evaluation);
421
+ return renderDebugResult(
422
+ snapshot,
423
+ options.expanded,
424
+ theme,
425
+ evaluation,
426
+ debuggerFailureFromResult(result.details),
427
+ );
393
428
  },
394
429
  });
395
430
  }
@@ -419,14 +454,21 @@ export async function registerDebuggerWithOwner(
419
454
  label: "Debug session",
420
455
  promptSnippet: "Configure a local debugger session",
421
456
  description:
422
- "Use debug to create a configured debugger session on a local or supported SSH workspace. This does not launch the program yet. The returned debug: resource survives extension reloads.",
457
+ "Use debug to create a configured debugger session on a local or supported SSH workspace, through VS Code or a native adapter. This does not launch the program yet. The returned debug: resource survives extension reloads.",
423
458
  parameters: debugParameters,
424
459
  outputSchema: debugOutputSchema,
425
460
  async execute(_toolCallId, input, signal, _onUpdate, context) {
461
+ const backend = input.backend ?? "auto";
426
462
  let cwd = input.cwd ?? context.cwd;
427
463
  let program = input.program;
428
464
  try {
429
465
  signal?.throwIfAborted();
466
+ if (
467
+ backend === "vscode" &&
468
+ [input.cwd, input.program, input.source].some((source) => source?.includes("://"))
469
+ ) {
470
+ throw new Error("The VS Code backend debugs only local workspaces");
471
+ }
430
472
  const owned = await ownerAccess?.resolveOptions(input, context.cwd, signal);
431
473
  if (
432
474
  owned === undefined &&
@@ -438,16 +480,45 @@ export async function registerDebuggerWithOwner(
438
480
  program = owned?.program ?? path.resolve(cwd, input.program);
439
481
  if (owned === undefined) await access(program);
440
482
  signal?.throwIfAborted();
441
- const session = manager.create(
442
- owned ?? {
483
+ const sourceFile = path.resolve(cwd, input.source ?? input.program);
484
+ const selection =
485
+ owned === undefined && backend !== "native"
486
+ ? await openVscodeBackend(backend, input, { cwd, program, sourceFile }, signal)
487
+ : { unavailable: "native backend requested" };
488
+ let session: DebugSession;
489
+ if ("vscode" in selection) {
490
+ session = manager.create(
491
+ {
492
+ adapter: "vscode",
493
+ program,
494
+ sourceFile,
495
+ args: [],
496
+ cwd,
497
+ ...(input.configuration === undefined
498
+ ? {}
499
+ : { configuration: input.configuration }),
500
+ ...(input.test === undefined ? {} : { test: input.test }),
501
+ },
502
+ selection.vscode,
503
+ );
504
+ } else if (input.configuration !== undefined || input.test !== undefined) {
505
+ throw new Error("configuration and test need the VS Code backend");
506
+ } else if (owned !== undefined) {
507
+ session = manager.create(owned);
508
+ } else if (input.adapter === undefined) {
509
+ throw new Error(
510
+ `Select an adapter for the native debugger backend. VS Code is not used: ${selection.unavailable}`,
511
+ );
512
+ } else {
513
+ session = manager.create({
443
514
  adapter: input.adapter,
444
515
  program,
445
- sourceFile: path.resolve(cwd, input.source ?? input.program),
516
+ sourceFile,
446
517
  args: input.args ?? [],
447
518
  cwd,
448
519
  ...(input.mainClass === undefined ? {} : { mainClass: input.mainClass }),
449
- },
450
- );
520
+ });
521
+ }
451
522
  const details = debugDetails(manager, session);
452
523
  const { snapshot: _snapshot, stop: _stop, ...data } = details;
453
524
  return withStructuredResult(
@@ -469,7 +540,7 @@ export async function registerDebuggerWithOwner(
469
540
  content: [
470
541
  { type: "text", text: error instanceof Error ? error.message : String(error) },
471
542
  ],
472
- details: { adapter: input.adapter, program, cwd, status: "failed" },
543
+ details: { adapter: input.adapter ?? backend, program, cwd, status: "failed" },
473
544
  isError: true,
474
545
  },
475
546
  debugDataSchema,
@@ -486,7 +557,11 @@ export async function registerDebuggerWithOwner(
486
557
  ? rawProgram
487
558
  : path.resolve(cwd, rawProgram);
488
559
  return renderDebugCall(
489
- typeof input.adapter === "string" ? input.adapter : "debugger",
560
+ typeof input.adapter === "string"
561
+ ? input.adapter
562
+ : input.backend === "vscode"
563
+ ? "vscode"
564
+ : "debugger",
490
565
  program,
491
566
  cwd,
492
567
  theme,
@@ -518,6 +593,34 @@ export async function registerDebuggerWithOwner(
518
593
  });
519
594
  }
520
595
 
596
+ /** Open the VS Code backend, or report why auto mode falls back to the native adapter. */
597
+ async function openVscodeBackend(
598
+ backend: "auto" | "vscode",
599
+ input: Static<typeof debugParameters>,
600
+ paths: { readonly cwd: string; readonly program: string; readonly sourceFile: string },
601
+ signal?: AbortSignal,
602
+ ): Promise<{ readonly vscode: VscodeDebugSession } | { readonly unavailable: string }> {
603
+ try {
604
+ const unsupported =
605
+ (input.args?.length ?? 0) > 0
606
+ ? "args"
607
+ : input.mainClass === undefined
608
+ ? undefined
609
+ : "mainClass";
610
+ if (unsupported !== undefined) {
611
+ throw new Error(`it does not accept ${unsupported}; use a launch.json configuration`);
612
+ }
613
+ return { vscode: await VscodeDebugSession.open(paths, signal) };
614
+ } catch (error) {
615
+ signal?.throwIfAborted();
616
+ const reason = error instanceof Error ? error.message : String(error);
617
+ if (backend === "vscode" || input.configuration !== undefined || input.test !== undefined) {
618
+ throw new Error(`VS Code backend unavailable: ${reason}`, { cause: error });
619
+ }
620
+ return { unavailable: reason };
621
+ }
622
+ }
623
+
521
624
  function createDebugResourceResolver(manager: DebugSessionManager, id: string): ResourceResolver {
522
625
  return {
523
626
  id,
@@ -0,0 +1,118 @@
1
+ const PROTOCOL_VERSION = "2025-06-18";
2
+
3
+ interface JsonRpcMessage {
4
+ readonly id?: number;
5
+ readonly result?: unknown;
6
+ readonly error?: { readonly message?: string };
7
+ }
8
+
9
+ interface ToolCallResult {
10
+ readonly content?: readonly { readonly type: string; readonly text?: string }[];
11
+ readonly isError?: boolean;
12
+ }
13
+
14
+ /** Minimal MCP Streamable HTTP client for the tools of one DebugMCP session. */
15
+ export class DebugMcpClient {
16
+ readonly #url: string;
17
+ #sessionId: string | undefined;
18
+ #nextId = 1;
19
+
20
+ private constructor(url: string) {
21
+ this.#url = url;
22
+ }
23
+
24
+ /** Open one MCP session; DebugMCP keeps its routed VS Code window per session. */
25
+ static async connect(port: number, signal?: AbortSignal): Promise<DebugMcpClient> {
26
+ const client = new DebugMcpClient(`http://127.0.0.1:${port}/mcp`);
27
+ await client.#request(
28
+ "initialize",
29
+ {
30
+ protocolVersion: PROTOCOL_VERSION,
31
+ capabilities: {},
32
+ clientInfo: { name: "pi-agent-ide", version: "1" },
33
+ },
34
+ signal,
35
+ );
36
+ await client.#post({ jsonrpc: "2.0", method: "notifications/initialized" }, signal);
37
+ return client;
38
+ }
39
+
40
+ /** Call one DebugMCP tool and return its text, rejecting tool-level errors. */
41
+ async call(
42
+ tool: string,
43
+ arguments_: Readonly<Record<string, unknown>>,
44
+ signal?: AbortSignal,
45
+ ): Promise<string> {
46
+ const result = (await this.#request(
47
+ "tools/call",
48
+ { name: tool, arguments: arguments_ },
49
+ signal,
50
+ )) as ToolCallResult;
51
+ const text = (result.content ?? [])
52
+ .flatMap((item) => (item.type === "text" && item.text !== undefined ? [item.text] : []))
53
+ .join("\n");
54
+ if (result.isError === true) throw new Error(text || `DebugMCP ${tool} failed`);
55
+ return text;
56
+ }
57
+
58
+ /** End the MCP session; the server may already be gone. */
59
+ async close(): Promise<void> {
60
+ if (this.#sessionId === undefined) return;
61
+ await fetch(this.#url, {
62
+ method: "DELETE",
63
+ headers: this.#headers(),
64
+ signal: AbortSignal.timeout(1_000),
65
+ }).catch(() => {});
66
+ this.#sessionId = undefined;
67
+ }
68
+
69
+ async #request(method: string, params: unknown, signal?: AbortSignal): Promise<unknown> {
70
+ const id = this.#nextId++;
71
+ const response = await this.#post({ jsonrpc: "2.0", id, method, params }, signal);
72
+ const message = await responseMessage(response, id);
73
+ if (message.error !== undefined) {
74
+ throw new Error(`DebugMCP ${method} failed: ${message.error.message ?? "unknown error"}`);
75
+ }
76
+ return message.result;
77
+ }
78
+
79
+ async #post(body: unknown, signal?: AbortSignal): Promise<Response> {
80
+ const response = await fetch(this.#url, {
81
+ method: "POST",
82
+ headers: {
83
+ ...this.#headers(),
84
+ "content-type": "application/json",
85
+ accept: "application/json, text/event-stream",
86
+ },
87
+ body: JSON.stringify(body),
88
+ ...(signal === undefined ? {} : { signal }),
89
+ });
90
+ if (!response.ok) {
91
+ throw new Error(`DebugMCP returned HTTP ${response.status}: ${await response.text()}`);
92
+ }
93
+ this.#sessionId = response.headers.get("mcp-session-id") ?? this.#sessionId;
94
+ return response;
95
+ }
96
+
97
+ #headers(): Record<string, string> {
98
+ return this.#sessionId === undefined
99
+ ? {}
100
+ : { "mcp-session-id": this.#sessionId, "mcp-protocol-version": PROTOCOL_VERSION };
101
+ }
102
+ }
103
+
104
+ async function responseMessage(response: Response, id: number): Promise<JsonRpcMessage> {
105
+ const text = await response.text();
106
+ const payloads = (response.headers.get("content-type") ?? "").includes("text/event-stream")
107
+ ? text
108
+ .split(/\r?\n/u)
109
+ .filter((line) => line.startsWith("data:"))
110
+ .map((line) => line.slice(5).trim())
111
+ : [text];
112
+ for (const payload of payloads) {
113
+ if (payload.length === 0) continue;
114
+ const message = JSON.parse(payload) as JsonRpcMessage;
115
+ if (message.id === id) return message;
116
+ }
117
+ throw new Error("DebugMCP returned no response");
118
+ }
@@ -20,6 +20,13 @@ import {
20
20
  DEBUGGER_RECIPES,
21
21
  debuggerRecipeForLanguage,
22
22
  } from "./catalog.js";
23
+ import {
24
+ DEBUGMCP_EXTENSION_ID,
25
+ debugMcpInstalled,
26
+ debugMcpPort,
27
+ debugMcpResponds,
28
+ findVscodeWindow,
29
+ } from "./vscode-backend.js";
23
30
 
24
31
  const DEFAULT_JS_DEBUG_PATH = "/opt/pi-debug-adapters/js-debug/src/dapDebugServer.js";
25
32
  const DEFAULT_ELIXIR_LS_DEBUG_PATH = "/opt/pi-debug-adapters/elixir-ls/debug_adapter.sh";
@@ -37,6 +44,7 @@ export const debuggerDoctorPlugin: DoctorPlugin = {
37
44
  title: "Debug adapters",
38
45
  run: checkDebuggerAdapters,
39
46
  });
47
+ api.addCheck({ id: "vscode", title: "VS Code debugger backend", run: checkVscodeBackend });
40
48
  },
41
49
  };
42
50
 
@@ -150,6 +158,45 @@ async function checkDebuggerAdapters(context: DoctorContext): Promise<readonly D
150
158
  );
151
159
  }
152
160
 
161
+ /** Report whether `debug` can use VS Code through DebugMCP for this local workspace. */
162
+ async function checkVscodeBackend(context: DoctorContext): Promise<readonly DoctorFinding[]> {
163
+ if (context.workspace !== undefined) {
164
+ return [{ status: "skip", message: "The VS Code backend debugs only local workspaces" }];
165
+ }
166
+ const window = await findVscodeWindow([context.cwd]);
167
+ if (window !== undefined) {
168
+ return (await debugMcpResponds(context.signal))
169
+ ? [{ status: "pass", message: `VS Code backend: available in "${window.name}"` }]
170
+ : [
171
+ {
172
+ status: "fail",
173
+ message: "VS Code backend: DebugMCP does not respond",
174
+ detail: `"${window.name}" has this workspace open, but DebugMCP does not accept connections on port ${debugMcpPort(context.env)}. Set PI_DEBUGMCP_PORT when debugmcp.serverPort differs.`,
175
+ },
176
+ ];
177
+ }
178
+ if (await debugMcpInstalled()) {
179
+ return [
180
+ {
181
+ status: "skip",
182
+ message: "VS Code backend: no VS Code window with DebugMCP has this workspace open",
183
+ detail:
184
+ "Open the workspace in VS Code to debug through it; debug uses native adapters meanwhile.",
185
+ },
186
+ ];
187
+ }
188
+ if (await projectExecutableAvailable(context, "code")) {
189
+ return [
190
+ {
191
+ status: "warn",
192
+ message: "VS Code backend: DebugMCP is not installed",
193
+ detail: `Install it with: code --install-extension ${DEBUGMCP_EXTENSION_ID}`,
194
+ },
195
+ ];
196
+ }
197
+ return [{ status: "skip", message: "VS Code backend: VS Code is not installed" }];
198
+ }
199
+
153
200
  async function probeJavaFiles(
154
201
  context: DoctorContext,
155
202
  platform: NodeJS.Platform,
@@ -45,8 +45,10 @@ export function renderDebugResult(
45
45
  expanded: boolean,
46
46
  theme: DebugTheme,
47
47
  evaluation?: DebugEvaluation,
48
+ failure?: string,
48
49
  ): Component {
49
50
  const lines = debugResultLines(snapshot, expanded, theme);
51
+ if (failure !== undefined) lines.unshift(theme.fg("error", `✗ ${failure}`));
50
52
  if (evaluation !== undefined) {
51
53
  lines.unshift(
52
54
  `${theme.fg("accent", evaluation.expression)} ${theme.fg("muted", "=")} ${theme.fg("toolOutput", evaluation.result)}${evaluation.type === undefined ? "" : theme.fg("dim", ` ${evaluation.type}`)}`,