pi-agent-ide 0.8.0 → 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 (508) hide show
  1. package/CHANGELOG.md +70 -40
  2. package/README.md +15 -8
  3. package/dist/{chunk-ICDI27GZ.js → chunk-235QMMVA.js} +1 -1
  4. package/dist/{chunk-N7LMRL64.js → chunk-47SPPIXK.js} +1 -1
  5. package/dist/chunk-4DIUPEDF.js +2 -0
  6. package/dist/{chunk-JMVDFOTQ.js → chunk-57F5GTHO.js} +1 -1
  7. package/dist/{chunk-NULNW6GK.js → chunk-6FGLAVPJ.js} +1 -1
  8. package/dist/{chunk-KL776TGR.js → chunk-6H32W35W.js} +1 -1
  9. package/dist/{chunk-QP2QSQ4U.js → chunk-6OJ565FL.js} +1 -1
  10. package/dist/{chunk-TWWND6NI.js → chunk-6R3Y4AD3.js} +1 -1
  11. package/dist/{chunk-CPZJPGLG.js → chunk-6T7PSDQW.js} +1 -1
  12. package/dist/{chunk-4OYVLXWD.js → chunk-6TJPMBUQ.js} +1 -1
  13. package/dist/{chunk-SBLKPTL3.js → chunk-6XFUICD7.js} +1 -1
  14. package/dist/chunk-7VSVJRRF.js +28 -0
  15. package/dist/{chunk-7JV4VN73.js → chunk-AAC77UD4.js} +1 -1
  16. package/dist/chunk-ANM3Y5FO.js +11 -0
  17. package/dist/chunk-BB4A5UI3.js +5 -0
  18. package/dist/{chunk-7TJ6DWW3.js → chunk-CPELC6JE.js} +1 -1
  19. package/dist/chunk-FTPC44FP.js +33 -0
  20. package/dist/{chunk-SBNR4WZF.js → chunk-GSOYVIQS.js} +1 -1
  21. package/dist/{chunk-Z3PGADVA.js → chunk-HSRH76JN.js} +1 -1
  22. package/dist/{chunk-CSXHCSTH.js → chunk-HSZ4AQ6L.js} +1 -1
  23. package/dist/chunk-I6NPILT5.js +1 -0
  24. package/dist/chunk-K7SRNBIV.js +1 -0
  25. package/dist/{chunk-R5XJSEOE.js → chunk-LCWBVOII.js} +3 -3
  26. package/dist/{chunk-MZXX353D.js → chunk-LEJKDYCK.js} +1 -1
  27. package/dist/{chunk-3G54ZL2L.js → chunk-NJ7C4KMA.js} +1 -1
  28. package/dist/{chunk-CTJV77FR.js → chunk-NUM3YQGK.js} +1 -1
  29. package/dist/chunk-OJEIX7OZ.js +1 -0
  30. package/dist/{chunk-EY65TFHJ.js → chunk-PJL3UVMJ.js} +1 -1
  31. package/dist/{chunk-E4HPRLRB.js → chunk-QT3EAHOG.js} +1 -1
  32. package/dist/{chunk-HCN5W76B.js → chunk-RIJMXO43.js} +1 -1
  33. package/dist/chunk-RMI3NMQY.js +23 -0
  34. package/dist/chunk-RQ7JJ7GV.js +4 -0
  35. package/dist/{chunk-4XPUN4QN.js → chunk-RVU73VKN.js} +1 -1
  36. package/dist/{chunk-OJX3RJ5A.js → chunk-RW2GTYQI.js} +1 -1
  37. package/dist/{chunk-PNP2KNGP.js → chunk-SDAH3ECM.js} +1 -1
  38. package/dist/chunk-SGQWRIRJ.js +10 -0
  39. package/dist/{chunk-IUSLSROY.js → chunk-SMIFCAAX.js} +1 -1
  40. package/dist/chunk-SWBJS3U4.js +1 -0
  41. package/dist/chunk-T7MWQQIF.js +3 -0
  42. package/dist/{chunk-RAZP42IQ.js → chunk-VAXLSPPU.js} +1 -1
  43. package/dist/{chunk-XZDOVPRC.js → chunk-VMTOFEXF.js} +1 -1
  44. package/dist/{chunk-7HDK3NRQ.js → chunk-VXP5BMW7.js} +1 -1
  45. package/dist/{chunk-WE42GBGU.js → chunk-XAHU42FP.js} +3 -3
  46. package/dist/{chunk-UBH6X3D3.js → chunk-XBQR74IK.js} +1 -1
  47. package/dist/{chunk-7NS3QUIE.js → chunk-XG7QNAKW.js} +1 -1
  48. package/dist/{chunk-GW6NZQTQ.js → chunk-XLWCSJMR.js} +1 -1
  49. package/dist/{chunk-2K65BSXS.js → chunk-XXLLY66B.js} +1 -1
  50. package/dist/chunk-YFP4P2FV.js +1 -0
  51. package/dist/{chunk-75SWXD2Z.js → chunk-YIXP2ALP.js} +1 -1
  52. package/dist/{chunk-MOJ5RR35.js → chunk-ZJQRLVVV.js} +1 -1
  53. package/dist/entry-0.js +1 -1
  54. package/dist/entry-1.js +1 -1
  55. package/dist/entry-10.js +1 -1
  56. package/dist/entry-11.js +1 -1
  57. package/dist/entry-12.js +1 -1
  58. package/dist/entry-13.js +1 -1
  59. package/dist/entry-14.js +1 -1
  60. package/dist/entry-15.js +1 -1
  61. package/dist/entry-16.js +1 -1
  62. package/dist/entry-17.js +1 -1
  63. package/dist/entry-18.js +1 -0
  64. package/dist/entry-19.js +1 -1
  65. package/dist/entry-2.js +1 -1
  66. package/dist/entry-20.js +1 -1
  67. package/dist/entry-22.js +1 -1
  68. package/dist/entry-23.js +1 -1
  69. package/dist/entry-24.js +1 -1
  70. package/dist/entry-25.js +1 -1
  71. package/dist/entry-26.js +1 -2
  72. package/dist/entry-27.js +1 -1
  73. package/dist/entry-28.js +1 -4
  74. package/dist/entry-29.js +2 -1
  75. package/dist/entry-3.js +1 -1
  76. package/dist/entry-30.js +1 -1
  77. package/dist/entry-31.js +4 -1
  78. package/dist/entry-32.js +1 -18
  79. package/dist/entry-33.js +1 -1
  80. package/dist/entry-34.js +1 -1
  81. package/dist/entry-35.js +18 -1
  82. package/dist/entry-36.js +1 -1
  83. package/dist/entry-37.js +1 -1
  84. package/dist/entry-38.js +1 -1
  85. package/dist/entry-39.js +1 -1
  86. package/dist/entry-4.js +1 -1
  87. package/dist/entry-40.js +1 -1
  88. package/dist/entry-41.js +1 -1
  89. package/dist/entry-42.js +1 -1
  90. package/dist/entry-43.js +1 -1
  91. package/dist/entry-44.js +1 -1
  92. package/dist/entry-45.js +1 -1
  93. package/dist/entry-46.js +1 -25
  94. package/dist/entry-47.js +1 -1
  95. package/dist/entry-48.js +1 -1
  96. package/dist/entry-49.js +25 -1
  97. package/dist/entry-5.js +1 -1
  98. package/dist/entry-50.js +1 -1
  99. package/dist/entry-51.js +1 -3
  100. package/dist/entry-52.js +1 -13
  101. package/dist/entry-53.js +1 -1
  102. package/dist/entry-54.js +3 -1
  103. package/dist/entry-55.js +13 -1
  104. package/dist/entry-56.js +1 -1
  105. package/dist/entry-57.js +1 -1
  106. package/dist/entry-58.js +1 -1
  107. package/dist/entry-59.js +1 -1
  108. package/dist/entry-6.js +1 -1
  109. package/dist/entry-60.js +1 -1
  110. package/dist/entry-61.js +1 -1
  111. package/dist/entry-62.js +1 -0
  112. package/dist/entry-63.js +1 -1
  113. package/dist/entry-64.js +1 -0
  114. package/dist/entry-65.js +0 -1
  115. package/dist/entry-66.js +1 -1
  116. package/dist/entry-67.js +0 -1
  117. package/dist/entry-68.js +1 -1
  118. package/dist/entry-69.js +1 -1
  119. package/dist/entry-7.js +1 -1
  120. package/dist/entry-70.js +1 -1
  121. package/dist/entry-71.js +1 -1
  122. package/dist/entry-72.js +1 -0
  123. package/dist/entry-73.js +1 -1
  124. package/dist/entry-74.js +1 -0
  125. package/dist/entry-75.js +0 -1
  126. package/dist/entry-76.js +1 -1
  127. package/dist/entry-77.js +0 -1
  128. package/dist/entry-78.js +1 -80
  129. package/dist/entry-79.js +1 -21
  130. package/dist/entry-8.js +1 -1
  131. package/dist/entry-80.js +1 -2
  132. package/dist/entry-81.js +80 -1
  133. package/dist/entry-82.js +22 -1
  134. package/dist/entry-83.js +2 -1
  135. package/dist/entry-84.js +1 -3
  136. package/dist/entry-85.js +1 -1
  137. package/dist/entry-86.js +1 -1
  138. package/dist/entry-87.js +1 -1
  139. package/dist/entry-88.js +3 -0
  140. package/dist/entry-89.js +1 -0
  141. package/dist/entry-9.js +1 -1
  142. package/dist/entry-90.js +1 -0
  143. package/dist/entry-91.js +1 -0
  144. package/dist/pi-agent-ide.js +53 -31
  145. package/docs/agent-guides/debugger.md +2 -0
  146. package/docs/agent-guides/editing.md +3 -3
  147. package/docs/agent-guides/search-code.md +5 -3
  148. package/docs/agent-guides/select-code.md +9 -6
  149. package/docs/agent-guides/ssh.md +1 -1
  150. package/docs/code-review.md +5 -0
  151. package/docs/configuration.md +52 -8
  152. package/docs/development.md +9 -13
  153. package/docs/directory-operations.md +1 -1
  154. package/docs/extensions.md +99 -2
  155. package/docs/releases.md +1 -1
  156. package/docs/settings-help.md +39 -0
  157. package/docs/structured-results.md +11 -6
  158. package/docs/tools.md +1 -0
  159. package/docs/user-hooks.md +4 -2
  160. package/node_modules/pi-agent-doctor/package.json +7 -10
  161. package/node_modules/pi-agent-doctor/runtime/entry-26.js +1 -0
  162. package/node_modules/pi-agent-doctor/runtime/entry-27.js +1 -0
  163. package/node_modules/pi-agent-documentation/package.json +2 -2
  164. package/node_modules/pi-agent-documentation/runtime/entry-28.js +1 -0
  165. package/node_modules/pi-agent-filesystem/package.json +8 -8
  166. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  167. package/node_modules/pi-agent-filesystem-jq/package.json +6 -7
  168. package/node_modules/pi-agent-filesystem-jq/runtime/entry-31.js +2 -0
  169. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  170. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  171. package/node_modules/pi-agent-filesystem-text/runtime/entry-33.js +2 -0
  172. package/node_modules/pi-agent-ide-ast/package.json +15 -41
  173. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +1 -0
  174. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +6 -5
  175. package/node_modules/pi-agent-ide-changes/package.json +10 -11
  176. package/node_modules/pi-agent-ide-changes/runtime/entry-36.js +1 -0
  177. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
  178. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  179. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  180. package/node_modules/pi-agent-ide-languages/runtime/entry-39.js +2 -0
  181. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  182. package/node_modules/pi-agent-ide-lint/runtime/entry-40.js +2 -0
  183. package/node_modules/pi-agent-ide-lsp/package.json +10 -13
  184. package/node_modules/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
  185. package/node_modules/pi-agent-image/package.json +3 -3
  186. package/node_modules/pi-agent-invariant/package.json +2 -2
  187. package/node_modules/pi-agent-pdf/package.json +3 -4
  188. package/node_modules/pi-agent-read/package.json +12 -12
  189. package/node_modules/pi-agent-read/runtime/entry-46.js +0 -1
  190. package/node_modules/pi-agent-read/runtime/entry-49.js +2 -0
  191. package/node_modules/pi-agent-resource/package.json +2 -2
  192. package/node_modules/pi-agent-resource/src/resource-error.ts +11 -0
  193. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -0
  194. package/node_modules/pi-agent-search/package.json +9 -9
  195. package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
  196. package/node_modules/pi-agent-search/runtime/entry-52.js +1 -0
  197. package/node_modules/pi-agent-search/runtime/entry-54.js +2 -0
  198. package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  199. package/node_modules/pi-agent-search/src/api/presentation.ts +10 -2
  200. package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
  201. package/node_modules/pi-agent-search/src/api/search.ts +7 -0
  202. package/node_modules/pi-agent-search/src/core/search-core.ts +23 -3
  203. package/node_modules/pi-agent-search-text/index.ts +2 -0
  204. package/node_modules/pi-agent-search-text/package.json +14 -14
  205. package/node_modules/pi-agent-search-text/runtime/entry-55.js +1 -0
  206. package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
  207. package/node_modules/pi-agent-search-text/src/search-backend.ts +18 -10
  208. package/node_modules/pi-agent-search-text/src/search-session.ts +68 -9
  209. package/node_modules/pi-agent-text/package.json +3 -3
  210. package/node_modules/pi-agent-text/runtime/entry-59.js +1 -0
  211. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  212. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +2 -0
  213. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -6
  214. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-61.js +1 -0
  215. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-62.js +2 -0
  216. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  217. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
  218. package/node_modules/pi-agent-text-editor/index.ts +2 -0
  219. package/node_modules/pi-agent-text-editor/package.json +26 -34
  220. package/node_modules/pi-agent-text-editor/runtime/entry-78.js +0 -1
  221. package/node_modules/pi-agent-text-editor/runtime/entry-79.js +1 -0
  222. package/node_modules/pi-agent-text-editor/runtime/entry-80.js +1 -0
  223. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +2 -0
  224. package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
  225. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
  226. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
  227. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
  228. package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
  229. package/node_modules/pi-agent-text-editor/src/core/extension.ts +4 -1
  230. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +40 -11
  231. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  232. package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
  233. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +29 -20
  234. package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
  235. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
  236. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
  237. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
  238. package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
  239. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
  240. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +35 -14
  241. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
  242. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
  243. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
  244. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
  245. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
  246. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -8
  247. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
  248. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +35 -2
  249. package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +17 -0
  250. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -5
  251. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  252. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +1 -0
  253. package/node_modules/pi-agent-tool-ui/package.json +6 -2
  254. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +1 -0
  255. package/node_modules/pi-agent-tool-ui/runtime/entry-86.js +1 -0
  256. package/node_modules/pi-agent-tool-ui/src/operation-approval.ts +271 -0
  257. package/node_modules/pi-agent-web/package.json +8 -11
  258. package/node_modules/pi-agent-web-html/package.json +3 -5
  259. package/node_modules/pi-agent-web-html/runtime/entry-88.js +2 -0
  260. package/node_modules/pi-agent-web-image/package.json +4 -4
  261. package/node_modules/pi-agent-web-image/runtime/entry-89.js +2 -0
  262. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  263. package/node_modules/pi-agent-web-pdf/runtime/entry-90.js +2 -0
  264. package/node_modules/pi-agent-web-text/package.json +4 -4
  265. package/node_modules/pi-agent-web-text/runtime/entry-91.js +2 -0
  266. package/package.json +65 -53
  267. package/skills/configure-agent-ide/SKILL.md +38 -0
  268. package/src/api/approval.ts +5 -0
  269. package/src/api/content.ts +6 -0
  270. package/src/api/settings.ts +198 -0
  271. package/src/api/tips.ts +3 -0
  272. package/src/backend/debugger-registration.ts +5 -1
  273. package/src/code-review/extension.ts +10 -4
  274. package/src/code-review/reviewer.ts +8 -0
  275. package/src/composite/host-version.ts +29 -5
  276. package/src/composite/ide-alias-rendering.ts +97 -0
  277. package/src/composite/nested-tool-rendering.ts +90 -9
  278. package/src/composite/preferences.ts +13 -0
  279. package/src/composite/search-facts.ts +45 -0
  280. package/src/composite/settings-documentation.ts +68 -0
  281. package/src/composite/settings-help.ts +106 -0
  282. package/src/composite/settings-registry.ts +94 -0
  283. package/src/composite/text-results.ts +170 -30
  284. package/src/composite/tool-availability.ts +11 -2
  285. package/src/core/diagnostic-entry.ts +31 -8
  286. package/src/core/diagnostic-store.ts +19 -3
  287. package/src/core/extension.ts +7 -2
  288. package/src/documentation/extension.ts +12 -0
  289. package/src/documentation/registry.ts +10 -2
  290. package/src/documentation/search.ts +166 -0
  291. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  292. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  293. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +6 -7
  294. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-31.js +2 -0
  295. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  296. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +2 -0
  297. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  298. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-33.js +2 -0
  299. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +2 -0
  300. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -11
  301. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -5
  302. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +2 -0
  303. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  304. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +2 -0
  305. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  306. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-90.js +2 -0
  307. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  308. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-91.js +2 -0
  309. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +2 -0
  310. package/src/extensions/pi-agent-read/package.json +12 -12
  311. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  312. package/src/extensions/pi-agent-read/runtime/entry-47.js +1 -0
  313. package/src/extensions/pi-agent-read/runtime/entry-49.js +2 -0
  314. package/src/extensions/pi-agent-search/package.json +9 -9
  315. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +2 -0
  316. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -14
  317. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +1 -0
  318. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +1 -0
  319. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  320. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +18 -10
  321. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +68 -9
  322. package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
  323. package/src/extensions/pi-agent-search/runtime/entry-52.js +1 -0
  324. package/src/extensions/pi-agent-search/runtime/entry-53.js +1 -0
  325. package/src/extensions/pi-agent-search/runtime/entry-54.js +2 -0
  326. package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  327. package/src/extensions/pi-agent-search/src/api/presentation.ts +10 -2
  328. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
  329. package/src/extensions/pi-agent-search/src/api/search.ts +7 -0
  330. package/src/extensions/pi-agent-search/src/core/search-core.ts +23 -3
  331. package/src/extensions/pi-agent-text-editor/index.ts +2 -0
  332. package/src/extensions/pi-agent-text-editor/package.json +26 -34
  333. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  334. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +2 -0
  335. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -6
  336. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +1 -0
  337. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-62.js +2 -0
  338. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  339. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-63.js +1 -0
  340. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
  341. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -8
  342. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
  343. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +35 -2
  344. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +17 -0
  345. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -5
  346. package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +0 -1
  347. package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +1 -0
  348. package/src/extensions/pi-agent-text-editor/runtime/entry-80.js +1 -0
  349. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +2 -0
  350. package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
  351. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
  352. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
  353. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
  354. package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
  355. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +4 -1
  356. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +40 -11
  357. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  358. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
  359. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +29 -20
  360. package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
  361. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
  362. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
  363. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
  364. package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
  365. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
  366. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +35 -14
  367. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
  368. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
  369. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
  370. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
  371. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
  372. package/src/pi-agent-ide.ts +74 -15
  373. package/src/plugins/pi-agent-ide-ast/package.json +15 -41
  374. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +1 -0
  375. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +6 -5
  376. package/src/plugins/pi-agent-ide-changes/package.json +10 -11
  377. package/src/plugins/pi-agent-ide-changes/runtime/entry-36.js +1 -0
  378. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
  379. package/src/plugins/pi-agent-ide-debugger/index.ts +158 -55
  380. package/src/plugins/pi-agent-ide-debugger/src/debugmcp-client.ts +118 -0
  381. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +47 -0
  382. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +2 -0
  383. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +146 -1
  384. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +12 -0
  385. package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +497 -0
  386. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  387. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  388. package/src/plugins/pi-agent-ide-languages/runtime/entry-39.js +2 -0
  389. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  390. package/src/plugins/pi-agent-ide-lint/runtime/entry-40.js +2 -0
  391. package/src/plugins/pi-agent-ide-lsp/package.json +10 -13
  392. package/src/plugins/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
  393. package/src/plugins/pi-agent-ide-terminal/index.ts +2 -0
  394. package/src/plugins/pi-agent-ide-terminal/src/origin.ts +30 -0
  395. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +34 -0
  396. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +11 -2
  397. package/src/plugins/pi-agent-ide-terminal/src/types.ts +9 -0
  398. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +72 -26
  399. package/src/tips/core.ts +5 -2
  400. package/src/tips/extension.ts +30 -2
  401. package/src/tips/persistence.ts +29 -27
  402. package/src/tips/setup-hint.ts +19 -0
  403. package/dist/chunk-3ZGDMTMD.js +0 -25
  404. package/dist/chunk-5KFVDYCI.js +0 -1
  405. package/dist/chunk-ABFCAOU5.js +0 -1
  406. package/dist/chunk-BIG45IPN.js +0 -2
  407. package/dist/chunk-BMOJTJJJ.js +0 -3
  408. package/dist/chunk-BQ67M4NC.js +0 -3
  409. package/dist/chunk-IH5NW5JX.js +0 -11
  410. package/dist/chunk-NRZO5KJT.js +0 -9
  411. package/dist/chunk-O36UC74T.js +0 -1
  412. package/dist/chunk-OLI3JPHJ.js +0 -28
  413. package/dist/chunk-SSWUUBIR.js +0 -1
  414. package/dist/chunk-UUJJRXHG.js +0 -29
  415. package/dist/entry-21.js +0 -1
  416. package/docs/research/apply-native-capability-matrix.md +0 -174
  417. package/docs/research/apply-read-latency.md +0 -221
  418. package/docs/research/codemode-write-context.md +0 -56
  419. package/docs/research/lpt-393-fuzzy-results/file.json +0 -152
  420. package/docs/research/lpt-393-fuzzy-results/repo.json +0 -122
  421. package/docs/research/lpt-393-search-fuzzy-fallback.md +0 -97
  422. package/docs/research/native-codemode-batch-decision.md +0 -31
  423. package/docs/research/native-codemode-batching.md +0 -65
  424. package/node_modules/pi-agent-doctor/runtime/entry-19.js +0 -1
  425. package/node_modules/pi-agent-doctor/runtime/entry-20.js +0 -1
  426. package/node_modules/pi-agent-doctor/runtime/entry-21.js +0 -1
  427. package/node_modules/pi-agent-filesystem/runtime/entry-26.js +0 -2
  428. package/node_modules/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
  429. package/node_modules/pi-agent-filesystem-jq/runtime/entry-28.js +0 -2
  430. package/node_modules/pi-agent-ide-ast/runtime/entry-31.js +0 -1
  431. package/node_modules/pi-agent-ide-changes/runtime/entry-33.js +0 -1
  432. package/node_modules/pi-agent-ide-changes/runtime/entry-34.js +0 -2
  433. package/node_modules/pi-agent-ide-languages/runtime/entry-36.js +0 -2
  434. package/node_modules/pi-agent-image/runtime/entry-39.js +0 -1
  435. package/node_modules/pi-agent-invariant/runtime/entry-40.js +0 -1
  436. package/node_modules/pi-agent-pdf/runtime/entry-41.js +0 -1
  437. package/node_modules/pi-agent-search/runtime/entry-49.js +0 -1
  438. package/node_modules/pi-agent-search-text/runtime/entry-52.js +0 -2
  439. package/node_modules/pi-agent-search-text/runtime/entry-54.js +0 -1
  440. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-57.js +0 -2
  441. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -2
  442. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
  443. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-61.js +0 -2
  444. package/node_modules/pi-agent-text-editor/runtime/entry-62.js +0 -1
  445. package/node_modules/pi-agent-text-editor/runtime/entry-64.js +0 -1
  446. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
  447. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
  448. package/node_modules/pi-agent-tool-call-interception/runtime/entry-81.js +0 -1
  449. package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +0 -1
  450. package/node_modules/pi-agent-web-html/runtime/entry-84.js +0 -2
  451. package/node_modules/pi-agent-web-image/runtime/entry-85.js +0 -2
  452. package/node_modules/pi-agent-web-pdf/runtime/entry-86.js +0 -2
  453. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
  454. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-28.js +0 -2
  455. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-29.js +0 -2
  456. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-26.js +0 -2
  457. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-84.js +0 -2
  458. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-85.js +0 -2
  459. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-86.js +0 -2
  460. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +0 -2
  461. package/src/extensions/pi-agent-read/runtime/entry-42.js +0 -1
  462. package/src/extensions/pi-agent-read/runtime/entry-43.js +0 -1
  463. package/src/extensions/pi-agent-read/runtime/entry-44.js +0 -1
  464. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-52.js +0 -2
  465. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +0 -1
  466. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-54.js +0 -1
  467. package/src/extensions/pi-agent-search/runtime/entry-49.js +0 -1
  468. package/src/extensions/pi-agent-search/runtime/entry-50.js +0 -1
  469. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-57.js +0 -2
  470. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -2
  471. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
  472. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-61.js +0 -2
  473. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
  474. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
  475. package/src/extensions/pi-agent-text-editor/runtime/entry-62.js +0 -1
  476. package/src/extensions/pi-agent-text-editor/runtime/entry-63.js +0 -1
  477. package/src/extensions/pi-agent-text-editor/runtime/entry-64.js +0 -1
  478. package/src/plugins/pi-agent-ide-ast/runtime/entry-31.js +0 -1
  479. package/src/plugins/pi-agent-ide-ast/runtime/entry-32.js +0 -2
  480. package/src/plugins/pi-agent-ide-changes/runtime/entry-33.js +0 -1
  481. package/src/plugins/pi-agent-ide-changes/runtime/entry-34.js +0 -2
  482. package/src/plugins/pi-agent-ide-languages/runtime/entry-36.js +0 -2
  483. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-25.js +0 -0
  484. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem}/runtime/entry-29.js +0 -0
  485. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
  486. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-pdf}/runtime/entry-32.js +0 -0
  487. /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
  488. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
  489. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
  490. /package/node_modules/{pi-agent-read → pi-agent-image}/runtime/entry-42.js +0 -0
  491. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-43.js +0 -0
  492. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-44.js +0 -0
  493. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-47.js +0 -0
  494. /package/node_modules/{pi-agent-search → pi-agent-read}/runtime/entry-48.js +0 -0
  495. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-50.js +0 -0
  496. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-53.js +0 -0
  497. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-56.js +0 -0
  498. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-search-text}/runtime/entry-58.js +0 -0
  499. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-63.js +0 -0
  500. /package/node_modules/{pi-agent-web → pi-agent-text-editor-stale-anchor}/runtime/entry-83.js +0 -0
  501. /package/node_modules/{pi-agent-web-text → pi-agent-web}/runtime/entry-87.js +0 -0
  502. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
  503. /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-48.js +0 -0
  504. /package/src/extensions/{pi-agent-text-editor/plugins/pi-agent-text-anchor-exact → pi-agent-search/plugins/pi-agent-search-text}/runtime/entry-58.js +0 -0
  505. /package/src/extensions/{pi-agent-read/extensions/pi-agent-web → pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor}/runtime/entry-83.js +0 -0
  506. /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
  507. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
  508. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
@@ -0,0 +1,497 @@
1
+ import { readdir, readFile } from "node:fs/promises";
2
+ import { homedir } from "node:os";
3
+ import path from "node:path";
4
+
5
+ import { DebugMcpClient } from "./debugmcp-client.js";
6
+
7
+ /** Marketplace identity of the DebugMCP VS Code extension. */
8
+ export const DEBUGMCP_EXTENSION_ID = "ozzafar.debugmcpextension";
9
+ /** DebugMCP port: `PI_DEBUGMCP_PORT` when VS Code changed `debugmcp.serverPort`, else its default. */
10
+ export function debugMcpPort(env: NodeJS.ProcessEnv = process.env): number {
11
+ return Number(env.PI_DEBUGMCP_PORT ?? 3001);
12
+ }
13
+ /** DebugMCP treats window registrations older than this as stale. */
14
+ const STALE_REGISTRATION_MS = 60_000;
15
+ /** Wait for the next stop as long as the native backend does. */
16
+ const STOP_WAIT_SECONDS = 30;
17
+ /** Bound a launch that VS Code never starts; DebugMCP itself waits 180 s. */
18
+ const START_TIMEOUT_MS = 60_000;
19
+ /** Binaries that DebugMCP cannot map to a debugger from their extension. */
20
+ const EXECUTABLE_EXTENSIONS = new Set([".exe", ".out", ".bin", ".elf", ".so", ".dll", ".dylib"]);
21
+
22
+ /**
23
+ * Spell a Windows path as VS Code reports it. DebugMCP removes a breakpoint only when the path
24
+ * equals VS Code's `fsPath`, which always has a lower-case drive letter.
25
+ */
26
+ export function vscodePath(file: string, platform: NodeJS.Platform = process.platform): string {
27
+ return platform === "win32" ? file.replace(/^[A-Z](?=:)/u, (drive) => drive.toLowerCase()) : file;
28
+ }
29
+
30
+ function isExecutable(program: string): boolean {
31
+ return EXECUTABLE_EXTENSIONS.has(path.extname(program).toLowerCase());
32
+ }
33
+
34
+ /** A running VS Code window that advertises DebugMCP for its workspace folders. */
35
+ export interface VscodeWindow {
36
+ readonly pid: number;
37
+ readonly name: string;
38
+ readonly workspaceFolders: readonly string[];
39
+ }
40
+
41
+ /** Active debug session state of the routed VS Code window. */
42
+ export interface VscodeDebugState {
43
+ readonly status: "no-session" | "running" | "paused";
44
+ readonly configurationName?: string;
45
+ readonly frame?: {
46
+ readonly id: number;
47
+ readonly threadId: number;
48
+ readonly name: string;
49
+ /** Absent when DebugMCP cannot resolve the frame's source, as in remote VS Code windows. */
50
+ readonly file?: string;
51
+ readonly line: number;
52
+ };
53
+ }
54
+
55
+ /** Local value of one variable in the paused VS Code frame. */
56
+ export interface VscodeVariable {
57
+ readonly name: string;
58
+ readonly value: string;
59
+ readonly type?: string;
60
+ }
61
+
62
+ /** Launch choices DebugMCP resolves inside VS Code. */
63
+ export interface VscodeLaunch {
64
+ readonly program: string;
65
+ readonly cwd: string;
66
+ /** Name of a `.vscode/launch.json` configuration. */
67
+ readonly configuration?: string;
68
+ /** Test name launched through the VS Code Testing API. */
69
+ readonly test?: string;
70
+ }
71
+
72
+ type VscodeCommand = "continue" | "next" | "stepIn" | "stepOut";
73
+
74
+ const COMMAND_TOOLS: Readonly<Record<VscodeCommand, string>> = {
75
+ continue: "continue_execution",
76
+ next: "step_over",
77
+ stepIn: "step_into",
78
+ stepOut: "step_out",
79
+ };
80
+
81
+ /** Find a live DebugMCP window whose workspace folders contain every path. */
82
+ export async function findVscodeWindow(
83
+ paths: readonly string[],
84
+ ): Promise<VscodeWindow | undefined> {
85
+ for (const directory of registryDirectories()) {
86
+ const files = await readdir(directory).catch(() => []);
87
+ for (const file of files) {
88
+ if (!/^window-\d+\.json$/u.test(file)) continue;
89
+ const window = await readRegistration(path.join(directory, file));
90
+ if (
91
+ window !== undefined &&
92
+ paths.every((target) => window.workspaceFolders.some((folder) => isInside(target, folder)))
93
+ ) {
94
+ return window;
95
+ }
96
+ }
97
+ }
98
+ return undefined;
99
+ }
100
+
101
+ /** Report whether the DebugMCP extension is installed in a local or WSL VS Code. */
102
+ export async function debugMcpInstalled(): Promise<boolean> {
103
+ for (const directory of [
104
+ path.join(homedir(), ".vscode-server", "extensions"),
105
+ path.join(homedir(), ".vscode", "extensions"),
106
+ ]) {
107
+ const entries = await readdir(directory).catch(() => []);
108
+ if (entries.some((entry) => entry.startsWith(`${DEBUGMCP_EXTENSION_ID}-`))) return true;
109
+ }
110
+ return false;
111
+ }
112
+
113
+ /** Check that DebugMCP accepts MCP sessions on its port. */
114
+ export async function debugMcpResponds(signal?: AbortSignal): Promise<boolean> {
115
+ try {
116
+ await (await DebugMcpClient.connect(debugMcpPort(), signal)).close();
117
+ return true;
118
+ } catch {
119
+ return false;
120
+ }
121
+ }
122
+
123
+ /** One Pi debug session driven through a DebugMCP-routed VS Code window. */
124
+ export class VscodeDebugSession {
125
+ readonly window: VscodeWindow;
126
+ readonly #client: DebugMcpClient;
127
+ readonly #program: string;
128
+ /** Pi breakpoint count per VS Code location created by this session. */
129
+ readonly #ownedBreakpoints = new Map<string, number>();
130
+ #configurationName: string | undefined;
131
+
132
+ private constructor(window: VscodeWindow, client: DebugMcpClient, program: string) {
133
+ this.window = window;
134
+ this.#client = client;
135
+ this.#program = program;
136
+ }
137
+
138
+ /** Connect when VS Code can debug these paths, or throw the unmet condition. */
139
+ static async open(
140
+ paths: { readonly cwd: string; readonly program: string; readonly sourceFile: string },
141
+ signal?: AbortSignal,
142
+ ): Promise<VscodeDebugSession> {
143
+ const window = await findVscodeWindow([paths.cwd, paths.program, paths.sourceFile]);
144
+ if (window === undefined) {
145
+ throw new Error(`No running VS Code window with DebugMCP has ${paths.cwd} open`);
146
+ }
147
+ const port = debugMcpPort();
148
+ let client: DebugMcpClient;
149
+ try {
150
+ client = await DebugMcpClient.connect(port, signal);
151
+ } catch (error) {
152
+ signal?.throwIfAborted();
153
+ throw new Error(`DebugMCP did not respond on port ${port}: ${message(error)}`, {
154
+ cause: error,
155
+ });
156
+ }
157
+ const session = new VscodeDebugSession(window, client, paths.program);
158
+ try {
159
+ await session.#route(signal);
160
+ if ((await session.status(0, signal)).status !== "no-session") {
161
+ throw new Error(`VS Code window "${window.name}" already has an active debug session`);
162
+ }
163
+ } catch (error) {
164
+ await client.close();
165
+ throw error;
166
+ }
167
+ return session;
168
+ }
169
+
170
+ /** Add a VS Code breakpoint unless one already exists at that location. */
171
+ async addBreakpoint(file: string, line: number, signal?: AbortSignal): Promise<void> {
172
+ const key = `${file}:${line}`;
173
+ const owned = this.#ownedBreakpoints.get(key);
174
+ if (owned !== undefined) {
175
+ this.#ownedBreakpoints.set(key, owned + 1);
176
+ return;
177
+ }
178
+ // DebugMCP removes every breakpoint at a location, so reuse a user's breakpoint instead.
179
+ const listed = await this.#call("list_breakpoints", {}, signal);
180
+ if (listedBreakpoints(listed).has(`${path.basename(file)}:${line}`)) return;
181
+ await this.#call("add_breakpoint", { fileFullPath: vscodePath(file), line }, signal);
182
+ this.#ownedBreakpoints.set(key, 1);
183
+ }
184
+
185
+ /** Remove a breakpoint only after the last Pi breakpoint that created it is gone. */
186
+ async removeBreakpoint(file: string, line: number, signal?: AbortSignal): Promise<void> {
187
+ const key = `${file}:${line}`;
188
+ const owned = this.#ownedBreakpoints.get(key);
189
+ if (owned === undefined) return;
190
+ if (owned > 1) {
191
+ this.#ownedBreakpoints.set(key, owned - 1);
192
+ return;
193
+ }
194
+ this.#ownedBreakpoints.delete(key);
195
+ await this.#call("remove_breakpoint", { fileFullPath: vscodePath(file), line }, signal);
196
+ }
197
+
198
+ /** Launch the program in VS Code and return the state it reached. */
199
+ async start(launch: VscodeLaunch, signal?: AbortSignal): Promise<VscodeDebugState> {
200
+ if (
201
+ launch.configuration === undefined &&
202
+ launch.test === undefined &&
203
+ isExecutable(launch.program)
204
+ ) {
205
+ // DebugMCP derives the debugger from a source extension and launches unknown files as Python.
206
+ throw new Error(
207
+ `VS Code cannot choose a debugger for the executable ${path.basename(launch.program)}. Add a .vscode/launch.json configuration for it (for example "cppvsdbg" or "cppdbg") and pass its name as configuration.`,
208
+ );
209
+ }
210
+ const startup = AbortSignal.timeout(START_TIMEOUT_MS);
211
+ try {
212
+ await this.#call(
213
+ "start_debugging",
214
+ {
215
+ fileFullPath: launch.program,
216
+ workingDirectory: launch.cwd,
217
+ ...(launch.configuration === undefined
218
+ ? {}
219
+ : { configurationName: launch.configuration }),
220
+ ...(launch.test === undefined ? {} : { testName: launch.test }),
221
+ },
222
+ signal === undefined ? startup : AbortSignal.any([signal, startup]),
223
+ );
224
+ } catch (error) {
225
+ if (!startup.aborted || signal?.aborted === true) throw error;
226
+ // Stop a session VS Code may still bring up, so a retry finds the window idle.
227
+ await this.#call("stop_debugging", {}).catch(() => {});
228
+ throw new Error(
229
+ `VS Code did not start the debug session within ${START_TIMEOUT_MS / 1_000} s. Check that the VS Code window has the debugger extension for this configuration and that no prompt is waiting in VS Code.`,
230
+ { cause: error },
231
+ );
232
+ }
233
+ const state = await this.status(0, signal);
234
+ this.#configurationName = state.configurationName;
235
+ return state;
236
+ }
237
+
238
+ /** Continue or step, then wait for the next stop or termination. */
239
+ async command(command: VscodeCommand, signal?: AbortSignal): Promise<VscodeDebugState> {
240
+ await this.#call(COMMAND_TOOLS[command], {}, signal);
241
+ return this.status(STOP_WAIT_SECONDS, signal);
242
+ }
243
+
244
+ /** Read the routed window's debug state, optionally waiting for a pause. */
245
+ async status(waitSeconds: number, signal?: AbortSignal): Promise<VscodeDebugState> {
246
+ const read = async (wait: number) =>
247
+ debugState(
248
+ JSON.parse(
249
+ await this.#call(
250
+ "get_debug_status",
251
+ wait === 0 ? {} : { waitForPauseSeconds: wait },
252
+ signal,
253
+ ),
254
+ ) as Readonly<Record<string, unknown>>,
255
+ );
256
+ let state = await read(waitSeconds);
257
+ // DebugMCP can report a pause before VS Code selects the stopped frame.
258
+ for (
259
+ let attempt = 0;
260
+ state.status === "paused" && state.frame === undefined && attempt < 20;
261
+ attempt++
262
+ ) {
263
+ await new Promise<void>((resolve) => setTimeout(resolve, 100));
264
+ state = await read(0);
265
+ }
266
+ return state;
267
+ }
268
+
269
+ /** Read local variables of the paused frame. */
270
+ async locals(signal?: AbortSignal): Promise<readonly VscodeVariable[]> {
271
+ const names = variableNames(
272
+ await this.#call("list_variable_names", { scope: "local" }, signal),
273
+ ).slice(0, 50);
274
+ if (names.length === 0) return [];
275
+ const values = await this.#call(
276
+ "get_variables_values",
277
+ { variableNames: names.map(({ name }) => name), scope: "local" },
278
+ signal,
279
+ );
280
+ return variableValues(values, names);
281
+ }
282
+
283
+ /** Evaluate an expression in the paused frame. */
284
+ async evaluate(
285
+ expression: string,
286
+ signal?: AbortSignal,
287
+ ): Promise<{ readonly result: string; readonly type?: string }> {
288
+ return evaluation(await this.#call("evaluate_expression", { expression }, signal));
289
+ }
290
+
291
+ /** Route this MCP session to the window that owns the program with a path-bearing no-op. */
292
+ async #route(signal?: AbortSignal): Promise<void> {
293
+ await this.#client.call("remove_breakpoint", { fileFullPath: this.#program, line: 0 }, signal);
294
+ }
295
+
296
+ /** Call DebugMCP and restore routing, which DebugMCP drops after any failed call. */
297
+ async #call(
298
+ tool: string,
299
+ arguments_: Readonly<Record<string, unknown>>,
300
+ signal?: AbortSignal,
301
+ ): Promise<string> {
302
+ try {
303
+ return await this.#client.call(tool, arguments_, signal);
304
+ } catch (error) {
305
+ await this.#route().catch(() => {});
306
+ throw error;
307
+ }
308
+ }
309
+
310
+ /** Remove Pi breakpoints, stop the session Pi started, and end the MCP session. */
311
+ async close(signal?: AbortSignal): Promise<void> {
312
+ try {
313
+ for (const key of this.#ownedBreakpoints.keys()) {
314
+ const separator = key.lastIndexOf(":");
315
+ await this.#call(
316
+ "remove_breakpoint",
317
+ {
318
+ fileFullPath: vscodePath(key.slice(0, separator)),
319
+ line: Number(key.slice(separator + 1)),
320
+ },
321
+ signal,
322
+ );
323
+ }
324
+ this.#ownedBreakpoints.clear();
325
+ const state = await this.status(0, signal);
326
+ // Never stop a session that the user started after Pi's session ended.
327
+ if (state.status !== "no-session" && state.configurationName === this.#configurationName) {
328
+ await this.#call("stop_debugging", {}, signal);
329
+ }
330
+ } finally {
331
+ await this.#client.close();
332
+ }
333
+ }
334
+ }
335
+
336
+ function registryDirectories(): string[] {
337
+ const home = homedir();
338
+ return [
339
+ path.join(home, ".vscode-server", "data", "User"),
340
+ path.join(home, ".config", "Code", "User"),
341
+ path.join(home, "Library", "Application Support", "Code", "User"),
342
+ ...(process.env.APPDATA === undefined ? [] : [path.join(process.env.APPDATA, "Code", "User")]),
343
+ ].map((root) => path.join(root, "globalStorage", DEBUGMCP_EXTENSION_ID, "window-registry"));
344
+ }
345
+
346
+ async function readRegistration(file: string): Promise<VscodeWindow | undefined> {
347
+ try {
348
+ const entry = JSON.parse(await readFile(file, "utf8")) as Readonly<Record<string, unknown>>;
349
+ if (
350
+ typeof entry.pid !== "number" ||
351
+ typeof entry.updatedAt !== "number" ||
352
+ !Array.isArray(entry.workspaceFolders) ||
353
+ Date.now() - entry.updatedAt > STALE_REGISTRATION_MS ||
354
+ !processAlive(entry.pid)
355
+ ) {
356
+ return undefined;
357
+ }
358
+ return {
359
+ pid: entry.pid,
360
+ name: typeof entry.name === "string" ? entry.name : "",
361
+ workspaceFolders: entry.workspaceFolders.filter(
362
+ (folder): folder is string => typeof folder === "string",
363
+ ),
364
+ };
365
+ } catch {
366
+ return undefined;
367
+ }
368
+ }
369
+
370
+ function processAlive(pid: number): boolean {
371
+ try {
372
+ process.kill(pid, 0);
373
+ return true;
374
+ } catch (error) {
375
+ return (error as NodeJS.ErrnoException).code === "EPERM";
376
+ }
377
+ }
378
+
379
+ /** Compare paths with the host's case rules: VS Code registers `c:\…` while callers pass `C:\…`. */
380
+ export function isInside(
381
+ target: string,
382
+ folder: string,
383
+ platform: NodeJS.Platform = process.platform,
384
+ ): boolean {
385
+ const paths = platform === "win32" ? path.win32 : path.posix;
386
+ const fold = (value: string) =>
387
+ platform === "win32" ? paths.resolve(value).toLowerCase() : paths.resolve(value);
388
+ const base = fold(folder);
389
+ const resolved = fold(target);
390
+ return (
391
+ resolved === base || resolved.startsWith(base.endsWith(paths.sep) ? base : base + paths.sep)
392
+ );
393
+ }
394
+
395
+ function debugState(raw: Readonly<Record<string, unknown>>): VscodeDebugState {
396
+ const status =
397
+ raw.status === "paused" || raw.status === "running" ? raw.status : ("no-session" as const);
398
+ const configurationName =
399
+ typeof raw.configurationName === "string" ? raw.configurationName : undefined;
400
+ const state =
401
+ typeof raw.state === "object" && raw.state !== null
402
+ ? (raw.state as Readonly<Record<string, unknown>>)
403
+ : {};
404
+ // Remote VS Code windows lose frame paths in DebugMCP; its `name:line` stack entry still holds.
405
+ const top =
406
+ Array.isArray(state.stackTrace) && typeof state.stackTrace[0] === "string"
407
+ ? /^(.*):(\d+)$/u.exec(state.stackTrace[0])
408
+ : null;
409
+ const line =
410
+ typeof state.currentLine === "number"
411
+ ? state.currentLine
412
+ : top === null
413
+ ? undefined
414
+ : Number(top[2]);
415
+ const frame =
416
+ line === undefined
417
+ ? undefined
418
+ : {
419
+ id: typeof state.frameId === "number" ? state.frameId : 0,
420
+ threadId: typeof state.threadId === "number" ? state.threadId : 0,
421
+ name: typeof state.frameName === "string" ? state.frameName : (top?.[1] ?? ""),
422
+ ...(typeof state.fileFullPath === "string" ? { file: state.fileFullPath } : {}),
423
+ line,
424
+ };
425
+ return {
426
+ status,
427
+ ...(configurationName === undefined ? {} : { configurationName }),
428
+ ...(status === "paused" && frame !== undefined ? { frame } : {}),
429
+ };
430
+ }
431
+
432
+ /** Parse `N. Breakpoint name:line` entries of `list_breakpoints`. */
433
+ function listedBreakpoints(text: string): ReadonlySet<string> {
434
+ return new Set(
435
+ text.split(/\r?\n/u).flatMap((line) => {
436
+ const match = /^\d+\. (?:Breakpoint|Logpoint) (.+?):(\d+)(?: \(|$)/u.exec(line);
437
+ return match === null ? [] : [`${match[1]}:${match[2]}`];
438
+ }),
439
+ );
440
+ }
441
+
442
+ /** Parse two-space-indented `name (type)` entries of `list_variable_names`. */
443
+ function variableNames(text: string): { readonly name: string; readonly type?: string }[] {
444
+ return text.split(/\r?\n/u).flatMap((line) => {
445
+ const match = /^ {2}(\S.*?)(?: \(([^()]*)\))?$/u.exec(line);
446
+ if (
447
+ match === null ||
448
+ /^(?:No variables in this scope|Error retrieving variables:)/u.test(line.trim())
449
+ )
450
+ return [];
451
+ const name = match[1];
452
+ const type = match[2];
453
+ if (name === undefined) return [];
454
+ return [{ name, ...(type === undefined ? {} : { type }) }];
455
+ });
456
+ }
457
+
458
+ /** Match `get_variables_values` top-level lines to the listed names; aggregates have no value. */
459
+ function variableValues(
460
+ text: string,
461
+ names: readonly { readonly name: string; readonly type?: string }[],
462
+ ): VscodeVariable[] {
463
+ const lines = text.split(/\r?\n/u);
464
+ return names.flatMap(({ name, type }) => {
465
+ const prefix = ` ${name}`;
466
+ const line = lines.find(
467
+ (candidate) =>
468
+ candidate === prefix ||
469
+ candidate.startsWith(`${prefix}: `) ||
470
+ candidate.startsWith(`${prefix} (`),
471
+ );
472
+ if (line === undefined) return [];
473
+ const rest = line.slice(prefix.length);
474
+ const typeSuffix = type === undefined ? undefined : ` (${type})`;
475
+ let value = rest.startsWith(": ") ? rest.slice(2) : "<complex value>";
476
+ if (typeSuffix !== undefined && value.endsWith(typeSuffix))
477
+ value = value.slice(0, -typeSuffix.length);
478
+ return [{ name, value, ...(type === undefined ? {} : { type }) }];
479
+ });
480
+ }
481
+
482
+ /** Parse `Result: value (type)` and the first level of an aggregate's child names and types. */
483
+ function evaluation(text: string): { readonly result: string; readonly type?: string } {
484
+ const lines = text.split(/\r?\n/u);
485
+ const index = lines.findIndex((line) => line.startsWith("Result: "));
486
+ const match = /^Result: (.*?)(?: \(([^()]*)\))?$/u.exec(lines[index] ?? "");
487
+ if (match === null) throw new Error(`DebugMCP returned no evaluation result: ${text}`);
488
+ const children = lines.slice(index + 1).filter((line) => /^ {2}\S/u.test(line));
489
+ return {
490
+ result: [match[1] as string, ...children].join("\n"),
491
+ ...(match[2] === undefined ? {} : { type: match[2] }),
492
+ };
493
+ }
494
+
495
+ function message(error: unknown): string {
496
+ return error instanceof Error ? error.message : String(error);
497
+ }
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "pi-agent-ide-formatter",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.8.0"
6
+ "pi-agent-doctor": "0.8.2"
7
7
  },
8
8
  "pi": {
9
9
  "extensions": [
10
- "./runtime/entry-35.js"
10
+ "./runtime/entry-38.js"
11
11
  ]
12
12
  },
13
13
  "peerDependencies": {
14
14
  "@earendil-works/pi-coding-agent": "*",
15
- "pi-agent-ide": "0.8.0"
15
+ "pi-agent-ide": "0.8.2"
16
16
  },
17
17
  "peerDependenciesMeta": {
18
18
  "pi-agent-ide": {
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-ide-languages",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.8.0"
6
+ "pi-agent-doctor": "0.8.2"
7
7
  },
8
8
  "pi": {
9
9
  "extensions": [
10
- "./runtime/entry-36.js"
10
+ "./runtime/entry-39.js"
11
11
  ]
12
12
  },
13
13
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../../dist/entry-39.js";
2
+ export { default } from "../../../../dist/entry-39.js";
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "pi-agent-ide-lint",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.8.0",
7
- "pi-agent-invariant": "0.8.0",
8
- "pi-agent-read": "0.8.0",
9
- "pi-agent-resource": "0.8.0",
10
- "pi-agent-text": "0.8.0"
6
+ "pi-agent-doctor": "0.8.2",
7
+ "pi-agent-invariant": "0.8.2",
8
+ "pi-agent-read": "0.8.2",
9
+ "pi-agent-resource": "0.8.2",
10
+ "pi-agent-text": "0.8.2"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
14
- "./runtime/entry-37.js"
14
+ "./runtime/entry-40.js"
15
15
  ]
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@earendil-works/pi-coding-agent": "*",
19
- "pi-agent-ide": "0.8.0"
19
+ "pi-agent-ide": "0.8.2"
20
20
  },
21
21
  "peerDependenciesMeta": {
22
22
  "pi-agent-ide": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../../dist/entry-40.js";
2
+ export { default } from "../../../../dist/entry-40.js";
@@ -1,27 +1,24 @@
1
1
  {
2
2
  "name": "pi-agent-ide-lsp",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "cross-spawn": "^7.0.6",
7
- "pi-agent-doctor": "0.8.0",
8
- "pi-agent-invariant": "0.8.0",
9
- "pi-agent-read": "0.8.0",
10
- "pi-agent-resource": "0.8.0",
11
- "pi-agent-search": "0.8.0",
12
- "pi-agent-text": "0.8.0",
13
- "pi-agent-text-editor": "0.8.0",
14
- "vscode-jsonrpc": "^9.0.0",
15
- "vscode-uri": "^3.1.0"
6
+ "pi-agent-doctor": "0.8.2",
7
+ "pi-agent-invariant": "0.8.2",
8
+ "pi-agent-read": "0.8.2",
9
+ "pi-agent-resource": "0.8.2",
10
+ "pi-agent-search": "0.8.2",
11
+ "pi-agent-text": "0.8.2",
12
+ "pi-agent-text-editor": "0.8.2"
16
13
  },
17
14
  "pi": {
18
15
  "extensions": [
19
- "./runtime/entry-38.js"
16
+ "./runtime/entry-41.js"
20
17
  ]
21
18
  },
22
19
  "peerDependencies": {
23
20
  "@earendil-works/pi-coding-agent": "*",
24
- "pi-agent-ide": "0.8.0"
21
+ "pi-agent-ide": "0.8.2"
25
22
  },
26
23
  "peerDependenciesMeta": {
27
24
  "pi-agent-ide": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../../dist/entry-41.js";
2
+ export { default } from "../../../../dist/entry-41.js";
@@ -14,6 +14,7 @@ import { observeQueuedSteering } from "#src/plugins/pi-agent-ide-terminal/src/st
14
14
  import { resolveShellProfile } from "#src/plugins/pi-agent-ide-terminal/src/shell-profile.js";
15
15
  import { registerTerminalTools } from "#src/plugins/pi-agent-ide-terminal/src/tools.js";
16
16
  import { TerminalUi } from "#src/plugins/pi-agent-ide-terminal/src/ui.js";
17
+ import { registerTerminalOrigins } from "#src/plugins/pi-agent-ide-terminal/src/origin.js";
17
18
  import { toolPresentation } from "#src/composite/presentation.js";
18
19
  import type { BuiltinExtensionContext } from "#src/composite/selection.js";
19
20
  import { resolvePiAgentIdeExtensionsConfigPaths } from "#src/composite/extensions-config.js";
@@ -57,6 +58,7 @@ export default async function registerTerminal(
57
58
  ui,
58
59
  toolPresentation(context?.preferences["ui.terminal"]),
59
60
  targets,
61
+ registerTerminalOrigins(pi),
60
62
  );
61
63
 
62
64
  let removeSteeringObserver = (): void => {};
@@ -0,0 +1,30 @@
1
+ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import type { TerminalExecutionOrigin } from "#src/plugins/pi-agent-ide-terminal/src/types.js";
3
+
4
+ /** Capture native ancestry before a terminal defers work beyond its tool execution. */
5
+ export function registerTerminalOrigins(
6
+ pi: Pick<ExtensionAPI, "on">,
7
+ ): (toolCallId: string, context: ExtensionContext) => TerminalExecutionOrigin {
8
+ const roots = new Map<string, string>();
9
+ pi.on("tool_call", (event) => {
10
+ const parent = event.parentToolCallId;
11
+ roots.set(
12
+ event.toolCallId,
13
+ parent === undefined ? event.toolCallId : (roots.get(parent) ?? parent),
14
+ );
15
+ });
16
+ pi.on("tool_result", (event) => {
17
+ roots.delete(event.toolCallId);
18
+ });
19
+ pi.on("agent_end", () => {
20
+ roots.clear();
21
+ });
22
+ pi.on("session_shutdown", () => {
23
+ roots.clear();
24
+ });
25
+ return (toolCallId, context) => ({
26
+ toolCallId,
27
+ parentToolCallId: roots.get(toolCallId) ?? toolCallId,
28
+ sessionId: context.sessionManager.getSessionId(),
29
+ });
30
+ }