pi-agent-ide 0.3.0 → 0.5.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 (413) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +7 -6
  3. package/dist/chunk-25CZ5ZIU.js +3 -0
  4. package/dist/chunk-526E364R.js +3 -0
  5. package/dist/chunk-5PLV4HLG.js +1 -0
  6. package/dist/chunk-5QQABP47.js +14 -0
  7. package/dist/{chunk-72EEL2DW.js → chunk-6CZO43OH.js} +1 -1
  8. package/dist/chunk-AWXVJ5AC.js +1 -0
  9. package/dist/chunk-BGUSBUUD.js +26 -0
  10. package/dist/{chunk-CW53ZTU3.js → chunk-DQXPQOF7.js} +1 -1
  11. package/dist/chunk-EJ5OACQM.js +1 -0
  12. package/dist/chunk-ESPNEJHK.js +1 -0
  13. package/dist/chunk-G725MARR.js +16 -0
  14. package/dist/{chunk-M5L42DWE.js → chunk-HKXDP2FD.js} +2 -2
  15. package/dist/chunk-IQD6PON5.js +0 -0
  16. package/dist/chunk-J34VKQGJ.js +1 -0
  17. package/dist/chunk-J4RTW44E.js +1 -0
  18. package/dist/{chunk-HGPUI7F3.js → chunk-KII2JQC5.js} +1 -1
  19. package/dist/{chunk-CEKXBS55.js → chunk-L7JMDDSD.js} +1 -1
  20. package/dist/{chunk-EWNWKDMP.js → chunk-LY6U5EAD.js} +1 -1
  21. package/dist/{chunk-ERVMDQGX.js → chunk-MGCHOGQD.js} +1 -1
  22. package/dist/{chunk-LRYE2WCN.js → chunk-O6LE42GK.js} +1 -1
  23. package/dist/{chunk-KAB3AYA2.js → chunk-OBNING2A.js} +1 -1
  24. package/dist/chunk-QH4ZUDOD.js +1 -0
  25. package/dist/{chunk-VFBLX4TG.js → chunk-T6LX2RX5.js} +1 -1
  26. package/dist/{chunk-AADJ2KIB.js → chunk-U22JNO6N.js} +1 -1
  27. package/dist/chunk-U2JKHKLK.js +0 -0
  28. package/dist/{chunk-SSHZEWWV.js → chunk-WGGIQ7IJ.js} +1 -1
  29. package/dist/chunk-ZG2MWXCR.js +2 -0
  30. package/dist/chunk-ZUMN6U77.js +27 -0
  31. package/dist/entry-10.js +1 -1
  32. package/dist/entry-11.js +1 -1
  33. package/dist/entry-12.js +1 -1
  34. package/dist/entry-13.js +1 -1
  35. package/dist/entry-14.js +1 -1
  36. package/dist/entry-15.js +1 -0
  37. package/dist/entry-17.js +1 -1
  38. package/dist/entry-18.js +1 -1
  39. package/dist/entry-19.js +1 -1
  40. package/dist/entry-20.js +1 -1
  41. package/dist/entry-21.js +1 -2
  42. package/dist/entry-22.js +2 -1
  43. package/dist/entry-23.js +1 -1
  44. package/dist/entry-24.js +1 -1
  45. package/dist/entry-25.js +1 -1
  46. package/dist/entry-26.js +1 -12
  47. package/dist/entry-27.js +12 -1
  48. package/dist/entry-28.js +1 -1
  49. package/dist/entry-29.js +1 -1
  50. package/dist/entry-30.js +1 -1
  51. package/dist/entry-31.js +1 -4
  52. package/dist/entry-32.js +3 -8
  53. package/dist/entry-33.js +9 -1
  54. package/dist/entry-34.js +1 -1
  55. package/dist/entry-35.js +1 -1
  56. package/dist/entry-36.js +1 -1
  57. package/dist/entry-37.js +1 -1
  58. package/dist/entry-38.js +1 -1
  59. package/dist/entry-39.js +1 -1
  60. package/dist/entry-40.js +1 -18
  61. package/dist/entry-41.js +18 -1
  62. package/dist/entry-42.js +1 -1
  63. package/dist/entry-43.js +1 -1
  64. package/dist/entry-44.js +1 -1
  65. package/dist/entry-45.js +1 -7
  66. package/dist/entry-46.js +7 -11
  67. package/dist/entry-47.js +11 -1
  68. package/dist/entry-48.js +1 -1
  69. package/dist/entry-49.js +1 -1
  70. package/dist/entry-50.js +1 -1
  71. package/dist/entry-51.js +1 -1
  72. package/dist/entry-52.js +1 -1
  73. package/dist/entry-53.js +1 -1
  74. package/dist/entry-54.js +1 -1
  75. package/dist/entry-55.js +1 -0
  76. package/dist/entry-56.js +0 -1
  77. package/dist/entry-57.js +1 -0
  78. package/dist/entry-58.js +0 -1
  79. package/dist/entry-59.js +1 -1
  80. package/dist/entry-60.js +1 -1
  81. package/dist/entry-61.js +1 -1
  82. package/dist/entry-62.js +1 -1
  83. package/dist/entry-63.js +1 -1
  84. package/dist/entry-64.js +1 -0
  85. package/dist/entry-65.js +0 -1
  86. package/dist/entry-66.js +1 -0
  87. package/dist/entry-67.js +0 -1
  88. package/dist/entry-68.js +1 -1
  89. package/dist/entry-69.js +1 -1
  90. package/dist/entry-70.js +1 -123
  91. package/dist/entry-71.js +198 -25
  92. package/dist/entry-72.js +30 -2
  93. package/dist/entry-73.js +2 -1
  94. package/dist/entry-74.js +1 -1
  95. package/dist/entry-75.js +1 -1
  96. package/dist/entry-76.js +1 -3
  97. package/dist/entry-77.js +3 -1
  98. package/dist/entry-78.js +1 -1
  99. package/dist/entry-79.js +1 -1
  100. package/dist/entry-8.js +1 -1
  101. package/dist/entry-80.js +1 -0
  102. package/dist/entry-9.js +1 -1
  103. package/dist/pi-agent-ide.js +3 -3
  104. package/docs/configuration.md +1 -1
  105. package/docs/tools.md +11 -0
  106. package/docs/user-hooks.md +68 -0
  107. package/node_modules/pi-agent-doctor/package.json +6 -6
  108. package/node_modules/pi-agent-doctor/runtime/entry-21.js +1 -0
  109. package/node_modules/pi-agent-doctor/src/catalog.ts +9 -1
  110. package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +5 -0
  111. package/node_modules/pi-agent-filesystem/package.json +7 -7
  112. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  113. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  114. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  115. package/node_modules/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
  116. package/node_modules/pi-agent-ide-ast/package.json +32 -11
  117. package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  118. package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +2 -0
  119. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +16 -8
  120. package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
  121. package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +22 -17
  122. package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
  123. package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
  124. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +4 -1
  125. package/node_modules/pi-agent-ide-changes/index.ts +3 -1
  126. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  127. package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  128. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
  129. package/node_modules/pi-agent-ide-formatter/package.json +9 -4
  130. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  131. package/node_modules/pi-agent-ide-lint/package.json +13 -8
  132. package/node_modules/pi-agent-ide-lsp/index.ts +4 -1
  133. package/node_modules/pi-agent-ide-lsp/package.json +15 -10
  134. package/node_modules/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
  135. package/node_modules/pi-agent-image/package.json +3 -3
  136. package/node_modules/pi-agent-invariant/package.json +2 -2
  137. package/node_modules/pi-agent-pdf/package.json +3 -3
  138. package/node_modules/pi-agent-read/package.json +11 -11
  139. package/node_modules/pi-agent-read/runtime/entry-40.js +0 -1
  140. package/node_modules/pi-agent-read/runtime/entry-41.js +2 -0
  141. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  142. package/node_modules/pi-agent-read/src/api/rendering.ts +1 -1
  143. package/node_modules/pi-agent-read/src/api/tools/read.ts +32 -0
  144. package/node_modules/pi-agent-read/src/core/read-core.ts +8 -0
  145. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
  146. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +66 -4
  147. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +105 -5
  148. package/node_modules/pi-agent-resource/package.json +2 -2
  149. package/node_modules/pi-agent-resource/src/resource.ts +2 -0
  150. package/node_modules/pi-agent-search/package.json +7 -7
  151. package/node_modules/pi-agent-search/runtime/entry-45.js +0 -1
  152. package/node_modules/pi-agent-search/src/api/search-parameters.ts +5 -1
  153. package/node_modules/pi-agent-search-text/index.ts +1 -1
  154. package/node_modules/pi-agent-search-text/package.json +9 -9
  155. package/node_modules/pi-agent-search-text/runtime/entry-47.js +1 -0
  156. package/node_modules/pi-agent-search-text/src/resolvers.ts +47 -19
  157. package/node_modules/pi-agent-search-text/src/search-backend.ts +6 -15
  158. package/node_modules/pi-agent-search-text/src/search-presentation.ts +80 -0
  159. package/node_modules/pi-agent-search-text/src/search-renderer.ts +17 -1
  160. package/node_modules/pi-agent-search-text/src/search-result.ts +32 -12
  161. package/node_modules/pi-agent-search-text/src/search-session.ts +6 -3
  162. package/node_modules/pi-agent-text/package.json +3 -3
  163. package/node_modules/pi-agent-text/runtime/entry-49.js +1 -0
  164. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  165. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
  166. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  167. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  168. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
  169. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  170. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  171. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
  172. package/node_modules/pi-agent-text-editor/package.json +25 -25
  173. package/node_modules/pi-agent-text-editor/runtime/entry-70.js +0 -1
  174. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
  175. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
  176. package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  177. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
  178. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
  179. package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  180. package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
  181. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
  182. package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
  183. package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
  184. package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +37 -8
  185. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
  186. package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
  187. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
  188. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
  189. package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
  190. package/node_modules/pi-agent-text-editor/src/core/extension.ts +3 -2
  191. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
  192. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +4 -4
  193. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
  194. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  195. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +182 -10
  196. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +135 -6
  197. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
  198. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
  199. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
  200. package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -0
  201. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  202. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +60 -2
  203. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  204. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
  205. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  206. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  207. package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +1 -0
  208. package/node_modules/pi-agent-web/package.json +7 -7
  209. package/node_modules/pi-agent-web-html/package.json +3 -3
  210. package/node_modules/pi-agent-web-image/package.json +4 -4
  211. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  212. package/node_modules/pi-agent-web-text/package.json +4 -4
  213. package/node_modules/pi-agent-web-text/runtime/entry-80.js +2 -0
  214. package/package.json +61 -38
  215. package/src/api/hooks.ts +168 -0
  216. package/src/api/text-editor.ts +2 -0
  217. package/src/composite/builtin-extensions.ts +13 -0
  218. package/src/composite/extensions-config.ts +18 -0
  219. package/src/composite/module-labels.ts +12 -0
  220. package/src/composite/module-settings-store.ts +17 -1
  221. package/src/composite/module-settings.ts +34 -4
  222. package/src/composite/preferences.ts +26 -0
  223. package/src/composite/settings-panel.ts +62 -30
  224. package/src/core/reload-resource-store.ts +34 -0
  225. package/src/doctor/tip-provider.ts +1 -0
  226. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  227. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  228. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  229. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  230. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
  231. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +2 -0
  232. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  233. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  234. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  235. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  236. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  237. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +2 -0
  238. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +2 -0
  239. package/src/extensions/pi-agent-read/package.json +11 -11
  240. package/src/extensions/pi-agent-read/runtime/entry-40.js +0 -1
  241. package/src/extensions/pi-agent-read/runtime/entry-41.js +2 -0
  242. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  243. package/src/extensions/pi-agent-read/src/api/rendering.ts +1 -1
  244. package/src/extensions/pi-agent-read/src/api/tools/read.ts +32 -0
  245. package/src/extensions/pi-agent-read/src/core/read-core.ts +8 -0
  246. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
  247. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +66 -4
  248. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +105 -5
  249. package/src/extensions/pi-agent-search/package.json +7 -7
  250. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
  251. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
  252. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +1 -0
  253. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +1 -0
  254. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +47 -19
  255. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +6 -15
  256. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +80 -0
  257. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +17 -1
  258. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +32 -12
  259. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +6 -3
  260. package/src/extensions/pi-agent-search/runtime/entry-45.js +0 -1
  261. package/src/extensions/pi-agent-search/runtime/entry-46.js +2 -0
  262. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +5 -1
  263. package/src/extensions/pi-agent-text-editor/package.json +25 -25
  264. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  265. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
  266. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  267. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  268. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
  269. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  270. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  271. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
  272. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -0
  273. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  274. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +60 -2
  275. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  276. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
  277. package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +0 -1
  278. package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +2 -0
  279. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
  280. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
  281. package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  282. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
  283. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
  284. package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  285. package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
  286. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
  287. package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
  288. package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
  289. package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +37 -8
  290. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
  291. package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
  292. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
  293. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
  294. package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
  295. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +3 -2
  296. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
  297. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +4 -4
  298. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
  299. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  300. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +182 -10
  301. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +135 -6
  302. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
  303. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
  304. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
  305. package/src/pi-agent-ide.ts +2 -1
  306. package/src/plugins/pi-agent-ide-ast/package.json +32 -11
  307. package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  308. package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +2 -0
  309. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +16 -8
  310. package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
  311. package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +22 -17
  312. package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
  313. package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
  314. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +4 -1
  315. package/src/plugins/pi-agent-ide-changes/index.ts +3 -1
  316. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  317. package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  318. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
  319. package/src/plugins/pi-agent-ide-debugger/index.ts +573 -0
  320. package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +73 -0
  321. package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +306 -0
  322. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +338 -0
  323. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +349 -0
  324. package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +39 -0
  325. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +152 -0
  326. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +1344 -0
  327. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +14 -0
  328. package/src/plugins/pi-agent-ide-formatter/package.json +9 -4
  329. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  330. package/src/plugins/pi-agent-ide-lint/package.json +13 -8
  331. package/src/plugins/pi-agent-ide-lsp/index.ts +4 -1
  332. package/src/plugins/pi-agent-ide-lsp/package.json +15 -10
  333. package/src/plugins/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
  334. package/src/plugins/pi-agent-ide-processes/index.ts +28 -0
  335. package/src/plugins/pi-agent-ide-processes/src/registry.ts +81 -0
  336. package/src/plugins/pi-agent-ide-processes/src/ui.ts +252 -0
  337. package/src/plugins/pi-agent-ide-terminal/index.ts +40 -0
  338. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +52 -0
  339. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +30 -0
  340. package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +204 -0
  341. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +452 -0
  342. package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +127 -0
  343. package/src/plugins/pi-agent-ide-terminal/src/search.ts +159 -0
  344. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +642 -0
  345. package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +56 -0
  346. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +151 -0
  347. package/src/plugins/pi-agent-ide-terminal/src/types.ts +78 -0
  348. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +212 -0
  349. package/dist/chunk-5MSNYFDE.js +0 -1
  350. package/dist/chunk-B5KB2I7J.js +0 -3
  351. package/dist/chunk-NMFQGKPE.js +0 -2
  352. package/dist/chunk-OVUYPHDE.js +0 -1
  353. package/dist/chunk-RHV5STR3.js +0 -3
  354. package/dist/chunk-TPIHQYK2.js +0 -14
  355. package/dist/chunk-VCCMVQXU.js +0 -1
  356. package/dist/chunk-VZJIZXSH.js +0 -14
  357. package/dist/entry-16.js +0 -1
  358. package/node_modules/pi-agent-doctor/runtime/entry-16.js +0 -1
  359. package/node_modules/pi-agent-filesystem/runtime/entry-21.js +0 -2
  360. package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +0 -1
  361. package/node_modules/pi-agent-ide-changes/runtime/entry-27.js +0 -1
  362. package/node_modules/pi-agent-image/runtime/entry-33.js +0 -1
  363. package/node_modules/pi-agent-resource/runtime/entry-41.js +0 -1
  364. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
  365. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
  366. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
  367. package/node_modules/pi-agent-text-editor/runtime/entry-54.js +0 -1
  368. package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +0 -1
  369. package/node_modules/pi-agent-web/runtime/entry-75.js +0 -2
  370. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-22.js +0 -2
  371. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-21.js +0 -2
  372. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +0 -2
  373. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +0 -2
  374. package/src/extensions/pi-agent-read/runtime/entry-36.js +0 -1
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-46.js +0 -2
  376. package/src/extensions/pi-agent-search/runtime/entry-42.js +0 -1
  377. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
  378. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
  379. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
  380. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-71.js +0 -2
  381. package/src/extensions/pi-agent-text-editor/runtime/entry-54.js +0 -1
  382. package/src/plugins/pi-agent-ide-ast/runtime/entry-25.js +0 -1
  383. package/src/plugins/pi-agent-ide-changes/runtime/entry-27.js +0 -1
  384. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-22.js +0 -0
  385. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
  386. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
  387. /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
  388. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
  389. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
  390. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
  391. /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-34.js +0 -0
  392. /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-35.js +0 -0
  393. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-36.js +0 -0
  394. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-42.js +0 -0
  395. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-46.js +0 -0
  396. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-48.js +0 -0
  397. /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-71.js +0 -0
  398. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
  399. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-74.js +0 -0
  400. /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-76.js +0 -0
  401. /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
  402. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
  403. /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.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-23.js +0 -0
  405. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
  406. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
  407. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
  408. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
  409. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
  410. /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
  411. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
  412. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
  413. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
@@ -0,0 +1,349 @@
1
+ import { access } from "node:fs/promises";
2
+
3
+ import { isExecutableAvailable, probeExecutable } from "pi-agent-doctor/api/executable";
4
+ import {
5
+ DOCTOR_API_VERSION,
6
+ DOCTOR_PROTOCOL,
7
+ type DoctorContext,
8
+ type DoctorFinding,
9
+ type DoctorPlugin,
10
+ type DoctorSetupAction,
11
+ type DoctorSetupInspection,
12
+ } from "pi-agent-doctor/api/plugin-protocol";
13
+
14
+ import {
15
+ DEBUGGER_LANGUAGE_MATRIX,
16
+ DEBUGGER_RECIPES,
17
+ debuggerRecipeForLanguage,
18
+ } from "./catalog.js";
19
+
20
+ const DEFAULT_JS_DEBUG_PATH = "/opt/pi-debug-adapters/js-debug/src/dapDebugServer.js";
21
+ const DEFAULT_ELIXIR_LS_DEBUG_PATH = "/opt/pi-debug-adapters/elixir-ls/debug_adapter.sh";
22
+
23
+ /** Doctor contribution for debugger dependencies supported by the debug tool. */
24
+ export const debuggerDoctorPlugin: DoctorPlugin = {
25
+ protocol: DOCTOR_PROTOCOL,
26
+ apiVersion: DOCTOR_API_VERSION,
27
+ id: "debugger",
28
+ setup(api): void {
29
+ for (const recipe of DEBUGGER_RECIPES) api.addToolRecipe(recipe);
30
+ api.addSetupCheck({ id: "effective-config", inspect: inspectDebuggerSetup });
31
+ api.addCheck({
32
+ id: "adapters",
33
+ title: "Debug adapters",
34
+ run: checkDebuggerAdapters,
35
+ });
36
+ },
37
+ };
38
+
39
+ /** Inspect debugger selection and classify missing Linux prerequisites. */
40
+ export async function inspectDebuggerSetup(context: DoctorContext): Promise<DoctorSetupInspection> {
41
+ const recipes = new Map(
42
+ [...context.detectedLanguageIds]
43
+ .map(debuggerRecipeForLanguage)
44
+ .filter((recipe) => recipe !== undefined)
45
+ .map((recipe) => [recipe.id, recipe]),
46
+ );
47
+ const selections = [...context.detectedLanguageIds].flatMap((languageId) => {
48
+ const recipe = debuggerRecipeForLanguage(languageId);
49
+ return recipe === undefined
50
+ ? []
51
+ : [{ kind: "debugger" as const, languageId, toolId: recipe.id }];
52
+ });
53
+ const actions: DoctorSetupAction[] = [];
54
+ for (const entry of DEBUGGER_LANGUAGE_MATRIX) {
55
+ if (entry.status === "planned" && context.detectedLanguageIds.has(entry.language)) {
56
+ actions.push({
57
+ id: `debugger-${entry.language}-not-verified`,
58
+ message: `${entry.backend} is selected for ${entry.language}, but its Linux debugger integration is not verified yet`,
59
+ });
60
+ }
61
+ }
62
+ for (const recipe of recipes.values()) {
63
+ const debuggerRecipe = recipe.debugger;
64
+ if (debuggerRecipe === undefined) continue;
65
+ if (process.platform !== "linux" || !debuggerRecipe.platforms.includes("linux")) {
66
+ actions.push({
67
+ id: `debugger-${recipe.id}-platform`,
68
+ category: "unsupported-platform",
69
+ message: `${recipe.name} does not support the Linux debugger recipe`,
70
+ });
71
+ continue;
72
+ }
73
+ const missingRuntime = await firstMissingExecutable(
74
+ debuggerRecipe.runtimeExecutables,
75
+ context.cwd,
76
+ context.env,
77
+ );
78
+ if (missingRuntime !== undefined) {
79
+ actions.push({
80
+ id: `debugger-${recipe.id}-runtime`,
81
+ category: "missing-runtime",
82
+ message: `Runtime ${missingRuntime} is unavailable. ${debuggerRecipe.install}`,
83
+ });
84
+ continue;
85
+ }
86
+ if (!(await adapterInstalled(recipe.id, context.cwd, context.env))) {
87
+ actions.push({
88
+ id: `debugger-${recipe.id}-adapter`,
89
+ category: "missing-adapter",
90
+ message: `${recipe.name} is not installed. ${debuggerRecipe.install}`,
91
+ });
92
+ continue;
93
+ }
94
+ if (!(await adapterAvailable(recipe.id, context.cwd, context.env))) {
95
+ actions.push({
96
+ id: `debugger-${recipe.id}-startup`,
97
+ category: "adapter-startup",
98
+ message: `${recipe.name} is installed but cannot start. ${debuggerRecipe.install}`,
99
+ });
100
+ }
101
+ }
102
+ return { selections, actions };
103
+ }
104
+
105
+ async function checkDebuggerAdapters(context: DoctorContext): Promise<readonly DoctorFinding[]> {
106
+ const recipes = [
107
+ ...new Map(
108
+ [...context.detectedLanguageIds]
109
+ .map(debuggerRecipeForLanguage)
110
+ .filter((recipe) => recipe !== undefined)
111
+ .map((recipe) => [recipe.id, recipe]),
112
+ ).values(),
113
+ ];
114
+ if (recipes.length === 0) {
115
+ return [{ status: "skip", message: "No supported executable language was detected" }];
116
+ }
117
+ return Promise.all(
118
+ recipes.map(async (recipe): Promise<DoctorFinding> => {
119
+ const result = await probeAdapter(recipe.id, context.cwd, context.env);
120
+ return {
121
+ status: result.ok ? "pass" : "fail",
122
+ message: `${recipe.name}: ${result.ok ? "available" : "unavailable"}`,
123
+ detail: result.detail,
124
+ };
125
+ }),
126
+ );
127
+ }
128
+
129
+ async function firstMissingExecutable(
130
+ executables: readonly string[],
131
+ cwd: string,
132
+ env: NodeJS.ProcessEnv,
133
+ ): Promise<string | undefined> {
134
+ for (const executable of executables) {
135
+ if (!(await isExecutableAvailable(executable, cwd, env))) return executable;
136
+ }
137
+ return undefined;
138
+ }
139
+ async function adapterInstalled(id: string, cwd: string, env: NodeJS.ProcessEnv): Promise<boolean> {
140
+ if (id === "elixir-ls-debug-adapter") {
141
+ try {
142
+ await access(env.PI_ELIXIR_LS_DEBUG_PATH ?? DEFAULT_ELIXIR_LS_DEBUG_PATH);
143
+ return true;
144
+ } catch {
145
+ return false;
146
+ }
147
+ }
148
+ if (id === "vsc-debugger") {
149
+ return (
150
+ await probeExecutable(
151
+ env.PI_R_PATH ?? "R",
152
+ [
153
+ "--vanilla",
154
+ "--quiet",
155
+ "-e",
156
+ "quit(status=if (requireNamespace('vscDebugger', quietly=TRUE)) 0 else 1)",
157
+ ],
158
+ cwd,
159
+ env,
160
+ )
161
+ ).ok;
162
+ }
163
+ if (id === "vscode-js-debug") {
164
+ try {
165
+ await access(env.PI_JS_DEBUG_PATH ?? DEFAULT_JS_DEBUG_PATH);
166
+ return true;
167
+ } catch {
168
+ return false;
169
+ }
170
+ }
171
+ if (id.startsWith("lldb-dap")) {
172
+ return (
173
+ (await isExecutableAvailable(env.PI_LLDB_DAP_PATH ?? "lldb-dap-18", cwd, env)) ||
174
+ (await isExecutableAvailable("lldb-dap", cwd, env))
175
+ );
176
+ }
177
+ if (id === "delve") return isExecutableAvailable(env.PI_DELVE_PATH ?? "dlv", cwd, env);
178
+ if (id === "kotlin-debug-adapter")
179
+ return isExecutableAvailable(
180
+ env.PI_KOTLIN_DEBUG_ADAPTER_PATH ?? "kotlin-debug-adapter",
181
+ cwd,
182
+ env,
183
+ );
184
+ if (id === "julia-debug-adapter") {
185
+ try {
186
+ await access(`${env.PI_JULIA_DEBUG_PROJECT ?? "/opt/pi-debug-adapters/julia"}/Project.toml`);
187
+ return true;
188
+ } catch {
189
+ return false;
190
+ }
191
+ }
192
+ if (id === "dart-debug-adapter")
193
+ return isExecutableAvailable(env.PI_DART_PATH ?? "dart", cwd, env);
194
+ const probe = await probeExecutable(
195
+ "python3",
196
+ ["-c", "import importlib.util; raise SystemExit(importlib.util.find_spec('debugpy') is None)"],
197
+ cwd,
198
+ env,
199
+ );
200
+ return probe.ok;
201
+ }
202
+ async function adapterAvailable(id: string, cwd: string, env: NodeJS.ProcessEnv): Promise<boolean> {
203
+ return (await probeAdapter(id, cwd, env)).ok;
204
+ }
205
+
206
+ async function probeAdapter(id: string, cwd: string, env: NodeJS.ProcessEnv) {
207
+ if (id === "elixir-ls-debug-adapter") {
208
+ return probeAdapterFile(env.PI_ELIXIR_LS_DEBUG_PATH ?? DEFAULT_ELIXIR_LS_DEBUG_PATH, cwd, env);
209
+ }
210
+ if (id === "vsc-debugger") {
211
+ return probeExecutable(
212
+ env.PI_R_PATH ?? "R",
213
+ [
214
+ "--vanilla",
215
+ "--quiet",
216
+ "-e",
217
+ "library(vscDebugger); cat(as.character(packageVersion('vscDebugger')))",
218
+ ],
219
+ cwd,
220
+ env,
221
+ );
222
+ }
223
+ if (id === "dart-debug-adapter") {
224
+ return probeExecutable(env.PI_DART_PATH ?? "dart", ["--version"], cwd, env);
225
+ }
226
+ if (id === "debugpy") {
227
+ return probeExecutable(
228
+ "python3",
229
+ ["-c", "import debugpy; print(debugpy.__version__)"],
230
+ cwd,
231
+ env,
232
+ );
233
+ }
234
+ if (id === "delve") {
235
+ return probeExecutable(env.PI_DELVE_PATH ?? "dlv", ["version"], cwd, env);
236
+ }
237
+ if (id === "julia-debug-adapter") {
238
+ const project = env.PI_JULIA_DEBUG_PROJECT ?? "/opt/pi-debug-adapters/julia";
239
+ return probeExecutable(
240
+ env.PI_JULIA_PATH ?? "julia",
241
+ [`--project=${project}`, "--startup-file=no", "-e", "using DebugAdapter"],
242
+ cwd,
243
+ env,
244
+ );
245
+ }
246
+ if (id === "kotlin-debug-adapter") {
247
+ const adapter = await probeExecutable(
248
+ env.PI_KOTLIN_DEBUG_ADAPTER_PATH ?? "kotlin-debug-adapter",
249
+ ["--help"],
250
+ cwd,
251
+ env,
252
+ );
253
+ if (!adapter.ok) return adapter;
254
+ return probeExecutable("java", ["-version"], cwd, env);
255
+ }
256
+ if (id === "netcoredbg") {
257
+ const adapter = await probeExecutable(
258
+ env.PI_NETCOREDBG_PATH ?? "netcoredbg",
259
+ ["--version"],
260
+ cwd,
261
+ env,
262
+ );
263
+ if (!adapter.ok) return adapter;
264
+ return probeExecutable("dotnet", ["--version"], cwd, env);
265
+ }
266
+ if (id.startsWith("lldb-dap")) {
267
+ const command =
268
+ env.PI_LLDB_DAP_PATH ??
269
+ ((await isExecutableAvailable("lldb-dap-18", cwd, env)) ? "lldb-dap-18" : "lldb-dap");
270
+ return probeExecutable(command, ["--version"], cwd, env);
271
+ }
272
+ if (id === "rdbg") {
273
+ return probeExecutable(env.PI_RUBY_DEBUG_PATH ?? "rdbg", ["--version"], cwd, env);
274
+ }
275
+ if (id === "vscode-php-debug") {
276
+ const runtime = await probeExecutable(
277
+ env.PI_PHP_PATH ?? "php",
278
+ ["-r", "exit(extension_loaded('xdebug') ? 0 : 1);"],
279
+ cwd,
280
+ env,
281
+ );
282
+ return runtime.ok
283
+ ? probeAdapterFile(
284
+ env.PI_PHP_DEBUG_PATH ?? "/opt/pi-debug-adapters/php-debug/extension/out/phpDebug.js",
285
+ cwd,
286
+ env,
287
+ )
288
+ : runtime;
289
+ }
290
+ if (id === "local-lua-debugger") {
291
+ const runtime = await probeExecutable(env.PI_LUA_PATH ?? "lua", ["-v"], cwd, env);
292
+ return runtime.ok
293
+ ? probeAdapterFile(
294
+ env.PI_LUA_DEBUG_PATH ??
295
+ "/opt/pi-debug-adapters/lua-debug/extension/extension/debugAdapter.js",
296
+ cwd,
297
+ env,
298
+ )
299
+ : runtime;
300
+ }
301
+ if (id === "vscode-bash-debug") {
302
+ const runtime = await probeExecutable(env.PI_BASH_PATH ?? "bash", ["--version"], cwd, env);
303
+ return runtime.ok
304
+ ? probeAdapterFile(
305
+ env.PI_BASH_DEBUG_PATH ?? "/opt/pi-debug-adapters/bash-debug/extension/out/bashDebug.js",
306
+ cwd,
307
+ env,
308
+ )
309
+ : runtime;
310
+ }
311
+ if (id === "powershell-editor-services-debug") {
312
+ const runtime = await probeExecutable(env.PI_PWSH_PATH ?? "pwsh", ["--version"], cwd, env);
313
+ const bundle =
314
+ env.PI_POWERSHELL_EDITOR_SERVICES_PATH ?? "/opt/pi-debug-adapters/powershell-editor-services";
315
+ return runtime.ok
316
+ ? probeAdapterFile(`${bundle}/PowerShellEditorServices/Start-EditorServices.ps1`, cwd, env)
317
+ : runtime;
318
+ }
319
+ const server = env.PI_JS_DEBUG_PATH ?? DEFAULT_JS_DEBUG_PATH;
320
+ try {
321
+ await access(server);
322
+ } catch {
323
+ return { ok: false as const, detail: `${server} does not exist` };
324
+ }
325
+ return probeExecutable(
326
+ process.execPath,
327
+ [
328
+ "-e",
329
+ "const fs=require('node:fs'); fs.accessSync(process.argv[1]); console.log(process.version)",
330
+ server,
331
+ ],
332
+ cwd,
333
+ env,
334
+ );
335
+ }
336
+
337
+ async function probeAdapterFile(file: string, cwd: string, env: NodeJS.ProcessEnv) {
338
+ try {
339
+ await access(file);
340
+ } catch {
341
+ return { ok: false as const, detail: `${file} does not exist` };
342
+ }
343
+ return probeExecutable(
344
+ process.execPath,
345
+ ["-e", "const fs=require('node:fs'); fs.accessSync(process.argv[1])", file],
346
+ cwd,
347
+ env,
348
+ );
349
+ }
@@ -0,0 +1,39 @@
1
+ import type { AgentIdeProcessProvider } from "#src/plugins/pi-agent-ide-processes/src/registry.js";
2
+ import {
3
+ renderActiveDebugger,
4
+ renderDebugResult,
5
+ } from "#src/plugins/pi-agent-ide-debugger/src/renderer.js";
6
+ import type { DebugSessionManager } from "#src/plugins/pi-agent-ide-debugger/src/session-manager.js";
7
+
8
+ /** Expose active DAP sessions through the shared Agent IDE process registry. */
9
+ export function debuggerProcessProvider(manager: DebugSessionManager): AgentIdeProcessProvider {
10
+ return {
11
+ id: "debugger",
12
+ onDidChange: (listener) => manager.onDidChange(listener),
13
+ list: () =>
14
+ manager
15
+ .list()
16
+ .map((session) => manager.snapshot(session))
17
+ .filter(
18
+ (snapshot) =>
19
+ snapshot.status === "configured" ||
20
+ snapshot.status === "running" ||
21
+ snapshot.status === "stopped",
22
+ )
23
+ .map((snapshot) => ({
24
+ source: snapshot.source,
25
+ kind: "debugger",
26
+ title: snapshot.options.adapter,
27
+ description: snapshot.options.program,
28
+ status:
29
+ snapshot.status === "configured"
30
+ ? ("configured" as const)
31
+ : snapshot.status === "stopped"
32
+ ? ("paused" as const)
33
+ : ("running" as const),
34
+ renderSummary: (theme) => renderActiveDebugger(snapshot, theme),
35
+ renderDetail: (theme) => renderDebugResult(snapshot, true, theme),
36
+ stop: () => manager.delete(snapshot.source),
37
+ })),
38
+ };
39
+ }
@@ -0,0 +1,152 @@
1
+ import path from "node:path";
2
+
3
+ import type { Theme, ThemeColor } from "@earendil-works/pi-coding-agent";
4
+ import { Text, type Component } from "@earendil-works/pi-tui";
5
+
6
+ import type {
7
+ DebugSessionSnapshot,
8
+ DebugSessionStatus,
9
+ DebugStop,
10
+ } from "#src/plugins/pi-agent-ide-debugger/src/session-manager.js";
11
+
12
+ type DebugTheme = Pick<Theme, "fg">;
13
+
14
+ /** Render debugger creation without exposing its implementation tool syntax. */
15
+ export function renderDebugCall(
16
+ adapter: string,
17
+ program: string,
18
+ cwd: string,
19
+ theme: DebugTheme,
20
+ ): Component {
21
+ return new Text(
22
+ `${theme.fg("toolTitle", adapter)} ${theme.fg("muted", `· ${shortPath(program, cwd)}`)}\n${theme.fg("accent", "◆ configure debugger")}`,
23
+ 0,
24
+ 0,
25
+ );
26
+ }
27
+
28
+ /** Render a debugger action under one stable session identity. */
29
+ export function renderDebugActionCall(
30
+ snapshot: DebugSessionSnapshot,
31
+ action: string,
32
+ theme: DebugTheme,
33
+ ): Component {
34
+ return new Text(
35
+ `${debugIdentity(snapshot, theme)}\n${theme.fg("accent", actionLabel(action))}`,
36
+ 0,
37
+ 0,
38
+ );
39
+ }
40
+
41
+ /** Render the state reached by a debugger action. */
42
+ export function renderDebugResult(
43
+ snapshot: DebugSessionSnapshot,
44
+ expanded: boolean,
45
+ theme: DebugTheme,
46
+ ): Component {
47
+ return new Text(debugResultLines(snapshot, expanded, theme).join("\n"), 0, 0);
48
+ }
49
+
50
+ /** Render one compact live session for the below-editor activity widget. */
51
+ export function renderActiveDebugger(
52
+ snapshot: DebugSessionSnapshot,
53
+ theme: DebugTheme,
54
+ ): readonly string[] {
55
+ const lines = [debugIdentity(snapshot, theme), statusLine(snapshot.status, theme)];
56
+ if (snapshot.stop?.frame !== undefined) {
57
+ lines.push(
58
+ ` ${theme.fg("warning", "●")} ${snapshot.stop.frame.name} ${theme.fg("muted", `· ${shortFrame(snapshot.stop)}`)}`,
59
+ );
60
+ }
61
+ return lines;
62
+ }
63
+
64
+ function debugResultLines(
65
+ snapshot: DebugSessionSnapshot,
66
+ expanded: boolean,
67
+ theme: DebugTheme,
68
+ ): string[] {
69
+ const lines: string[] = [];
70
+ if (snapshot.status === "stopped" && snapshot.stop !== undefined) {
71
+ lines.push(
72
+ theme.fg("warning", `● stopped · ${snapshot.stop.reason}`),
73
+ theme.fg(
74
+ "text",
75
+ `${snapshot.stop.frame?.name ?? "unknown frame"} ${theme.fg("muted", `· ${shortFrame(snapshot.stop)}`)}`,
76
+ ),
77
+ );
78
+ for (const sourceLine of snapshot.stop.sourceLines) {
79
+ const marker = sourceLine.current ? theme.fg("warning", ">") : theme.fg("dim", "│");
80
+ const tone: ThemeColor = sourceLine.current ? "text" : "dim";
81
+ lines.push(
82
+ `${marker} ${String(sourceLine.lineNumber).padStart(4)} ${theme.fg(tone, sourceLine.content)}`,
83
+ );
84
+ }
85
+ const variables = expanded ? snapshot.stop.variables : snapshot.stop.variables.slice(0, 6);
86
+ if (variables.length > 0) {
87
+ lines.push(theme.fg("muted", "Locals"));
88
+ for (const variable of variables) {
89
+ lines.push(
90
+ ` ${theme.fg("accent", variable.name.padEnd(16))} ${theme.fg("toolOutput", variable.value)}${variable.type === undefined ? "" : theme.fg("dim", ` ${variable.type}`)}`,
91
+ );
92
+ }
93
+ if (variables.length < snapshot.stop.variables.length) {
94
+ lines.push(
95
+ theme.fg("muted", ` … ${snapshot.stop.variables.length - variables.length} more`),
96
+ );
97
+ }
98
+ }
99
+ return lines;
100
+ }
101
+ lines.push(statusLine(snapshot.status, theme));
102
+ if (snapshot.breakpoints.length > 0) {
103
+ const verified = snapshot.breakpoints.filter((breakpoint) => breakpoint.verified).length;
104
+ lines.push(
105
+ theme.fg(
106
+ "muted",
107
+ `${snapshot.breakpoints.length} breakpoint${snapshot.breakpoints.length === 1 ? "" : "s"} · ${verified} verified`,
108
+ ),
109
+ );
110
+ }
111
+ return lines;
112
+ }
113
+
114
+ function debugIdentity(snapshot: DebugSessionSnapshot, theme: DebugTheme): string {
115
+ return `${theme.fg("toolTitle", snapshot.options.adapter)} ${theme.fg("muted", `· ${shortPath(snapshot.options.program, snapshot.options.cwd)}`)}`;
116
+ }
117
+
118
+ function actionLabel(action: string): string {
119
+ const normalized = action.trim().toLowerCase();
120
+ if (normalized === "start") return "▶ start debugging";
121
+ if (normalized === "continue") return "▶ continue";
122
+ if (normalized === "step over") return "↷ step over";
123
+ if (normalized === "step into") return "↓ step into";
124
+ if (normalized === "step out") return "↑ step out";
125
+ if (normalized.startsWith("breakpoint ")) return `● add ${normalized}`;
126
+ if (normalized.startsWith("delete-breakpoint ")) {
127
+ return `○ remove breakpoint · ${normalized.slice("delete-breakpoint ".length)}`;
128
+ }
129
+ if (normalized === "breakpoint") return "● add breakpoint";
130
+ if (normalized === "delete-breakpoint") return "○ remove breakpoint";
131
+ if (normalized === "delete-session") return "■ stop debugging";
132
+ return normalized;
133
+ }
134
+
135
+ function statusLine(status: DebugSessionStatus, theme: DebugTheme): string {
136
+ if (status === "configured") return theme.fg("muted", "◇ ready");
137
+ if (status === "running") return theme.fg("accent", "● running");
138
+ if (status === "stopped") return theme.fg("warning", "● stopped");
139
+ return theme.fg("success", "■ stopped debugging");
140
+ }
141
+
142
+ function shortFrame(stop: DebugStop): string {
143
+ const source = stop.frame?.source?.path ?? stop.frame?.source?.name ?? "unknown";
144
+ return `${path.basename(source)}:${stop.frame?.line ?? "?"}`;
145
+ }
146
+
147
+ function shortPath(program: string, cwd: string): string {
148
+ const relative = path.relative(cwd, program);
149
+ const parent = ".".repeat(2);
150
+ const outside = relative === parent || relative.startsWith(`${parent}${path.sep}`);
151
+ return relative.length > 0 && !outside ? relative : path.basename(program);
152
+ }