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.
- package/CHANGELOG.md +70 -40
- package/README.md +15 -8
- package/dist/{chunk-ICDI27GZ.js → chunk-235QMMVA.js} +1 -1
- package/dist/{chunk-N7LMRL64.js → chunk-47SPPIXK.js} +1 -1
- package/dist/chunk-4DIUPEDF.js +2 -0
- package/dist/{chunk-JMVDFOTQ.js → chunk-57F5GTHO.js} +1 -1
- package/dist/{chunk-NULNW6GK.js → chunk-6FGLAVPJ.js} +1 -1
- package/dist/{chunk-KL776TGR.js → chunk-6H32W35W.js} +1 -1
- package/dist/{chunk-QP2QSQ4U.js → chunk-6OJ565FL.js} +1 -1
- package/dist/{chunk-TWWND6NI.js → chunk-6R3Y4AD3.js} +1 -1
- package/dist/{chunk-CPZJPGLG.js → chunk-6T7PSDQW.js} +1 -1
- package/dist/{chunk-4OYVLXWD.js → chunk-6TJPMBUQ.js} +1 -1
- package/dist/{chunk-SBLKPTL3.js → chunk-6XFUICD7.js} +1 -1
- package/dist/chunk-7VSVJRRF.js +28 -0
- package/dist/{chunk-7JV4VN73.js → chunk-AAC77UD4.js} +1 -1
- package/dist/chunk-ANM3Y5FO.js +11 -0
- package/dist/chunk-BB4A5UI3.js +5 -0
- package/dist/{chunk-7TJ6DWW3.js → chunk-CPELC6JE.js} +1 -1
- package/dist/chunk-FTPC44FP.js +33 -0
- package/dist/{chunk-SBNR4WZF.js → chunk-GSOYVIQS.js} +1 -1
- package/dist/{chunk-Z3PGADVA.js → chunk-HSRH76JN.js} +1 -1
- package/dist/{chunk-CSXHCSTH.js → chunk-HSZ4AQ6L.js} +1 -1
- package/dist/chunk-I6NPILT5.js +1 -0
- package/dist/chunk-K7SRNBIV.js +1 -0
- package/dist/{chunk-R5XJSEOE.js → chunk-LCWBVOII.js} +3 -3
- package/dist/{chunk-MZXX353D.js → chunk-LEJKDYCK.js} +1 -1
- package/dist/{chunk-3G54ZL2L.js → chunk-NJ7C4KMA.js} +1 -1
- package/dist/{chunk-CTJV77FR.js → chunk-NUM3YQGK.js} +1 -1
- package/dist/chunk-OJEIX7OZ.js +1 -0
- package/dist/{chunk-EY65TFHJ.js → chunk-PJL3UVMJ.js} +1 -1
- package/dist/{chunk-E4HPRLRB.js → chunk-QT3EAHOG.js} +1 -1
- package/dist/{chunk-HCN5W76B.js → chunk-RIJMXO43.js} +1 -1
- package/dist/chunk-RMI3NMQY.js +23 -0
- package/dist/chunk-RQ7JJ7GV.js +4 -0
- package/dist/{chunk-4XPUN4QN.js → chunk-RVU73VKN.js} +1 -1
- package/dist/{chunk-OJX3RJ5A.js → chunk-RW2GTYQI.js} +1 -1
- package/dist/{chunk-PNP2KNGP.js → chunk-SDAH3ECM.js} +1 -1
- package/dist/chunk-SGQWRIRJ.js +10 -0
- package/dist/{chunk-IUSLSROY.js → chunk-SMIFCAAX.js} +1 -1
- package/dist/chunk-SWBJS3U4.js +1 -0
- package/dist/chunk-T7MWQQIF.js +3 -0
- package/dist/{chunk-RAZP42IQ.js → chunk-VAXLSPPU.js} +1 -1
- package/dist/{chunk-XZDOVPRC.js → chunk-VMTOFEXF.js} +1 -1
- package/dist/{chunk-7HDK3NRQ.js → chunk-VXP5BMW7.js} +1 -1
- package/dist/{chunk-WE42GBGU.js → chunk-XAHU42FP.js} +3 -3
- package/dist/{chunk-UBH6X3D3.js → chunk-XBQR74IK.js} +1 -1
- package/dist/{chunk-7NS3QUIE.js → chunk-XG7QNAKW.js} +1 -1
- package/dist/{chunk-GW6NZQTQ.js → chunk-XLWCSJMR.js} +1 -1
- package/dist/{chunk-2K65BSXS.js → chunk-XXLLY66B.js} +1 -1
- package/dist/chunk-YFP4P2FV.js +1 -0
- package/dist/{chunk-75SWXD2Z.js → chunk-YIXP2ALP.js} +1 -1
- package/dist/{chunk-MOJ5RR35.js → chunk-ZJQRLVVV.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-1.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-16.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -0
- package/dist/entry-19.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +1 -2
- package/dist/entry-27.js +1 -1
- package/dist/entry-28.js +1 -4
- package/dist/entry-29.js +2 -1
- package/dist/entry-3.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +4 -1
- package/dist/entry-32.js +1 -18
- package/dist/entry-33.js +1 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +18 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +1 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +1 -1
- package/dist/entry-46.js +1 -25
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +25 -1
- package/dist/entry-5.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -3
- package/dist/entry-52.js +1 -13
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +3 -1
- package/dist/entry-55.js +13 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-6.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -0
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +0 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +0 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +1 -0
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -0
- package/dist/entry-75.js +0 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +0 -1
- package/dist/entry-78.js +1 -80
- package/dist/entry-79.js +1 -21
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +1 -2
- package/dist/entry-81.js +80 -1
- package/dist/entry-82.js +22 -1
- package/dist/entry-83.js +2 -1
- package/dist/entry-84.js +1 -3
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-88.js +3 -0
- package/dist/entry-89.js +1 -0
- package/dist/entry-9.js +1 -1
- package/dist/entry-90.js +1 -0
- package/dist/entry-91.js +1 -0
- package/dist/pi-agent-ide.js +53 -31
- package/docs/agent-guides/debugger.md +2 -0
- package/docs/agent-guides/editing.md +3 -3
- package/docs/agent-guides/search-code.md +5 -3
- package/docs/agent-guides/select-code.md +9 -6
- package/docs/agent-guides/ssh.md +1 -1
- package/docs/code-review.md +5 -0
- package/docs/configuration.md +52 -8
- package/docs/development.md +9 -13
- package/docs/directory-operations.md +1 -1
- package/docs/extensions.md +99 -2
- package/docs/releases.md +1 -1
- package/docs/settings-help.md +39 -0
- package/docs/structured-results.md +11 -6
- package/docs/tools.md +1 -0
- package/docs/user-hooks.md +4 -2
- package/node_modules/pi-agent-doctor/package.json +7 -10
- package/node_modules/pi-agent-doctor/runtime/entry-26.js +1 -0
- package/node_modules/pi-agent-doctor/runtime/entry-27.js +1 -0
- package/node_modules/pi-agent-documentation/package.json +2 -2
- package/node_modules/pi-agent-documentation/runtime/entry-28.js +1 -0
- package/node_modules/pi-agent-filesystem/package.json +8 -8
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-jq/package.json +6 -7
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-31.js +2 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-33.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +15 -41
- package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +1 -0
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +6 -5
- package/node_modules/pi-agent-ide-changes/package.json +10 -11
- package/node_modules/pi-agent-ide-changes/runtime/entry-36.js +1 -0
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/runtime/entry-39.js +2 -0
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/runtime/entry-40.js +2 -0
- package/node_modules/pi-agent-ide-lsp/package.json +10 -13
- package/node_modules/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -4
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-46.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-49.js +2 -0
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/src/resource-error.ts +11 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +9 -0
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-52.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-54.js +2 -0
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/presentation.ts +10 -2
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/node_modules/pi-agent-search/src/api/search.ts +7 -0
- package/node_modules/pi-agent-search/src/core/search-core.ts +23 -3
- package/node_modules/pi-agent-search-text/index.ts +2 -0
- package/node_modules/pi-agent-search-text/package.json +14 -14
- package/node_modules/pi-agent-search-text/runtime/entry-55.js +1 -0
- package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +18 -10
- package/node_modules/pi-agent-search-text/src/search-session.ts +68 -9
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-59.js +1 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -6
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-61.js +1 -0
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-62.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
- package/node_modules/pi-agent-text-editor/index.ts +2 -0
- package/node_modules/pi-agent-text-editor/package.json +26 -34
- package/node_modules/pi-agent-text-editor/runtime/entry-78.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-79.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-80.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-81.js +2 -0
- package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +4 -1
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +40 -11
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +29 -20
- package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +35 -14
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
- package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -8
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +35 -2
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +17 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +6 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +1 -0
- package/node_modules/pi-agent-tool-ui/runtime/entry-86.js +1 -0
- package/node_modules/pi-agent-tool-ui/src/operation-approval.ts +271 -0
- package/node_modules/pi-agent-web/package.json +8 -11
- package/node_modules/pi-agent-web-html/package.json +3 -5
- package/node_modules/pi-agent-web-html/runtime/entry-88.js +2 -0
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-image/runtime/entry-89.js +2 -0
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-90.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-91.js +2 -0
- package/package.json +65 -53
- package/skills/configure-agent-ide/SKILL.md +38 -0
- package/src/api/approval.ts +5 -0
- package/src/api/content.ts +6 -0
- package/src/api/settings.ts +198 -0
- package/src/api/tips.ts +3 -0
- package/src/backend/debugger-registration.ts +5 -1
- package/src/code-review/extension.ts +10 -4
- package/src/code-review/reviewer.ts +8 -0
- package/src/composite/host-version.ts +29 -5
- package/src/composite/ide-alias-rendering.ts +97 -0
- package/src/composite/nested-tool-rendering.ts +90 -9
- package/src/composite/preferences.ts +13 -0
- package/src/composite/search-facts.ts +45 -0
- package/src/composite/settings-documentation.ts +68 -0
- package/src/composite/settings-help.ts +106 -0
- package/src/composite/settings-registry.ts +94 -0
- package/src/composite/text-results.ts +170 -30
- package/src/composite/tool-availability.ts +11 -2
- package/src/core/diagnostic-entry.ts +31 -8
- package/src/core/diagnostic-store.ts +19 -3
- package/src/core/extension.ts +7 -2
- package/src/documentation/extension.ts +12 -0
- package/src/documentation/registry.ts +10 -2
- package/src/documentation/search.ts +166 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +6 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-31.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-33.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -11
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-90.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-91.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +2 -0
- package/src/extensions/pi-agent-read/package.json +12 -12
- package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-47.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-49.js +2 -0
- package/src/extensions/pi-agent-search/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -14
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +18 -10
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +68 -9
- package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-52.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-53.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-54.js +2 -0
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/presentation.ts +10 -2
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -5
- package/src/extensions/pi-agent-search/src/api/search.ts +7 -0
- package/src/extensions/pi-agent-search/src/core/search-core.ts +23 -3
- package/src/extensions/pi-agent-text-editor/index.ts +2 -0
- package/src/extensions/pi-agent-text-editor/package.json +26 -34
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-62.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-63.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-64.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -8
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +35 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +17 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -5
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-80.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +6 -12
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +4 -1
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +40 -11
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +29 -20
- package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +13 -9
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +118 -36
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +38 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +106 -48
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +35 -14
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +39 -44
- package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -1
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +6 -5
- package/src/pi-agent-ide.ts +74 -15
- package/src/plugins/pi-agent-ide-ast/package.json +15 -41
- package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +1 -0
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +6 -5
- package/src/plugins/pi-agent-ide-changes/package.json +10 -11
- package/src/plugins/pi-agent-ide-changes/runtime/entry-36.js +1 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -5
- package/src/plugins/pi-agent-ide-debugger/index.ts +158 -55
- package/src/plugins/pi-agent-ide-debugger/src/debugmcp-client.ts +118 -0
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +47 -0
- package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +2 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +146 -1
- package/src/plugins/pi-agent-ide-debugger/src/ui.ts +12 -0
- package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +497 -0
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/runtime/entry-39.js +2 -0
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/runtime/entry-40.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/package.json +10 -13
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-41.js +2 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +2 -0
- package/src/plugins/pi-agent-ide-terminal/src/origin.ts +30 -0
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +34 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +11 -2
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +9 -0
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +72 -26
- package/src/tips/core.ts +5 -2
- package/src/tips/extension.ts +30 -2
- package/src/tips/persistence.ts +29 -27
- package/src/tips/setup-hint.ts +19 -0
- package/dist/chunk-3ZGDMTMD.js +0 -25
- package/dist/chunk-5KFVDYCI.js +0 -1
- package/dist/chunk-ABFCAOU5.js +0 -1
- package/dist/chunk-BIG45IPN.js +0 -2
- package/dist/chunk-BMOJTJJJ.js +0 -3
- package/dist/chunk-BQ67M4NC.js +0 -3
- package/dist/chunk-IH5NW5JX.js +0 -11
- package/dist/chunk-NRZO5KJT.js +0 -9
- package/dist/chunk-O36UC74T.js +0 -1
- package/dist/chunk-OLI3JPHJ.js +0 -28
- package/dist/chunk-SSWUUBIR.js +0 -1
- package/dist/chunk-UUJJRXHG.js +0 -29
- package/dist/entry-21.js +0 -1
- package/docs/research/apply-native-capability-matrix.md +0 -174
- package/docs/research/apply-read-latency.md +0 -221
- package/docs/research/codemode-write-context.md +0 -56
- package/docs/research/lpt-393-fuzzy-results/file.json +0 -152
- package/docs/research/lpt-393-fuzzy-results/repo.json +0 -122
- package/docs/research/lpt-393-search-fuzzy-fallback.md +0 -97
- package/docs/research/native-codemode-batch-decision.md +0 -31
- package/docs/research/native-codemode-batching.md +0 -65
- package/node_modules/pi-agent-doctor/runtime/entry-19.js +0 -1
- package/node_modules/pi-agent-doctor/runtime/entry-20.js +0 -1
- package/node_modules/pi-agent-doctor/runtime/entry-21.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-26.js +0 -2
- package/node_modules/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-28.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-31.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-33.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-34.js +0 -2
- package/node_modules/pi-agent-ide-languages/runtime/entry-36.js +0 -2
- package/node_modules/pi-agent-image/runtime/entry-39.js +0 -1
- package/node_modules/pi-agent-invariant/runtime/entry-40.js +0 -1
- package/node_modules/pi-agent-pdf/runtime/entry-41.js +0 -1
- package/node_modules/pi-agent-search/runtime/entry-49.js +0 -1
- package/node_modules/pi-agent-search-text/runtime/entry-52.js +0 -2
- package/node_modules/pi-agent-search-text/runtime/entry-54.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-57.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -2
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-61.js +0 -2
- package/node_modules/pi-agent-text-editor/runtime/entry-62.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-64.js +0 -1
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-81.js +0 -1
- package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +0 -1
- package/node_modules/pi-agent-web-html/runtime/entry-84.js +0 -2
- package/node_modules/pi-agent-web-image/runtime/entry-85.js +0 -2
- package/node_modules/pi-agent-web-pdf/runtime/entry-86.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-27.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-28.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-29.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-26.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-84.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-85.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-86.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-42.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-43.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-44.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-52.js +0 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-54.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-49.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-50.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-57.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-59.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-60.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-61.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-79.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-62.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-63.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-64.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-31.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-32.js +0 -2
- package/src/plugins/pi-agent-ide-changes/runtime/entry-33.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-34.js +0 -2
- package/src/plugins/pi-agent-ide-languages/runtime/entry-36.js +0 -2
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-25.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-image}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-pdf}/runtime/entry-32.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-image}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-43.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-44.js +0 -0
- /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-47.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-read}/runtime/entry-48.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-50.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-53.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-56.js +0 -0
- /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-search-text}/runtime/entry-58.js +0 -0
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-63.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-text-editor-stale-anchor}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web}/runtime/entry-87.js +0 -0
- /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
- /package/src/extensions/{pi-agent-search → pi-agent-read}/runtime/entry-48.js +0 -0
- /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
- /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
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-ast}/runtime/entry-35.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-changes}/runtime/entry-37.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-formatter}/runtime/entry-38.js +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const PROTOCOL_VERSION = "2025-06-18";
|
|
2
|
+
|
|
3
|
+
interface JsonRpcMessage {
|
|
4
|
+
readonly id?: number;
|
|
5
|
+
readonly result?: unknown;
|
|
6
|
+
readonly error?: { readonly message?: string };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface ToolCallResult {
|
|
10
|
+
readonly content?: readonly { readonly type: string; readonly text?: string }[];
|
|
11
|
+
readonly isError?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Minimal MCP Streamable HTTP client for the tools of one DebugMCP session. */
|
|
15
|
+
export class DebugMcpClient {
|
|
16
|
+
readonly #url: string;
|
|
17
|
+
#sessionId: string | undefined;
|
|
18
|
+
#nextId = 1;
|
|
19
|
+
|
|
20
|
+
private constructor(url: string) {
|
|
21
|
+
this.#url = url;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Open one MCP session; DebugMCP keeps its routed VS Code window per session. */
|
|
25
|
+
static async connect(port: number, signal?: AbortSignal): Promise<DebugMcpClient> {
|
|
26
|
+
const client = new DebugMcpClient(`http://127.0.0.1:${port}/mcp`);
|
|
27
|
+
await client.#request(
|
|
28
|
+
"initialize",
|
|
29
|
+
{
|
|
30
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
31
|
+
capabilities: {},
|
|
32
|
+
clientInfo: { name: "pi-agent-ide", version: "1" },
|
|
33
|
+
},
|
|
34
|
+
signal,
|
|
35
|
+
);
|
|
36
|
+
await client.#post({ jsonrpc: "2.0", method: "notifications/initialized" }, signal);
|
|
37
|
+
return client;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Call one DebugMCP tool and return its text, rejecting tool-level errors. */
|
|
41
|
+
async call(
|
|
42
|
+
tool: string,
|
|
43
|
+
arguments_: Readonly<Record<string, unknown>>,
|
|
44
|
+
signal?: AbortSignal,
|
|
45
|
+
): Promise<string> {
|
|
46
|
+
const result = (await this.#request(
|
|
47
|
+
"tools/call",
|
|
48
|
+
{ name: tool, arguments: arguments_ },
|
|
49
|
+
signal,
|
|
50
|
+
)) as ToolCallResult;
|
|
51
|
+
const text = (result.content ?? [])
|
|
52
|
+
.flatMap((item) => (item.type === "text" && item.text !== undefined ? [item.text] : []))
|
|
53
|
+
.join("\n");
|
|
54
|
+
if (result.isError === true) throw new Error(text || `DebugMCP ${tool} failed`);
|
|
55
|
+
return text;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** End the MCP session; the server may already be gone. */
|
|
59
|
+
async close(): Promise<void> {
|
|
60
|
+
if (this.#sessionId === undefined) return;
|
|
61
|
+
await fetch(this.#url, {
|
|
62
|
+
method: "DELETE",
|
|
63
|
+
headers: this.#headers(),
|
|
64
|
+
signal: AbortSignal.timeout(1_000),
|
|
65
|
+
}).catch(() => {});
|
|
66
|
+
this.#sessionId = undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async #request(method: string, params: unknown, signal?: AbortSignal): Promise<unknown> {
|
|
70
|
+
const id = this.#nextId++;
|
|
71
|
+
const response = await this.#post({ jsonrpc: "2.0", id, method, params }, signal);
|
|
72
|
+
const message = await responseMessage(response, id);
|
|
73
|
+
if (message.error !== undefined) {
|
|
74
|
+
throw new Error(`DebugMCP ${method} failed: ${message.error.message ?? "unknown error"}`);
|
|
75
|
+
}
|
|
76
|
+
return message.result;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async #post(body: unknown, signal?: AbortSignal): Promise<Response> {
|
|
80
|
+
const response = await fetch(this.#url, {
|
|
81
|
+
method: "POST",
|
|
82
|
+
headers: {
|
|
83
|
+
...this.#headers(),
|
|
84
|
+
"content-type": "application/json",
|
|
85
|
+
accept: "application/json, text/event-stream",
|
|
86
|
+
},
|
|
87
|
+
body: JSON.stringify(body),
|
|
88
|
+
...(signal === undefined ? {} : { signal }),
|
|
89
|
+
});
|
|
90
|
+
if (!response.ok) {
|
|
91
|
+
throw new Error(`DebugMCP returned HTTP ${response.status}: ${await response.text()}`);
|
|
92
|
+
}
|
|
93
|
+
this.#sessionId = response.headers.get("mcp-session-id") ?? this.#sessionId;
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#headers(): Record<string, string> {
|
|
98
|
+
return this.#sessionId === undefined
|
|
99
|
+
? {}
|
|
100
|
+
: { "mcp-session-id": this.#sessionId, "mcp-protocol-version": PROTOCOL_VERSION };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async function responseMessage(response: Response, id: number): Promise<JsonRpcMessage> {
|
|
105
|
+
const text = await response.text();
|
|
106
|
+
const payloads = (response.headers.get("content-type") ?? "").includes("text/event-stream")
|
|
107
|
+
? text
|
|
108
|
+
.split(/\r?\n/u)
|
|
109
|
+
.filter((line) => line.startsWith("data:"))
|
|
110
|
+
.map((line) => line.slice(5).trim())
|
|
111
|
+
: [text];
|
|
112
|
+
for (const payload of payloads) {
|
|
113
|
+
if (payload.length === 0) continue;
|
|
114
|
+
const message = JSON.parse(payload) as JsonRpcMessage;
|
|
115
|
+
if (message.id === id) return message;
|
|
116
|
+
}
|
|
117
|
+
throw new Error("DebugMCP returned no response");
|
|
118
|
+
}
|
|
@@ -20,6 +20,13 @@ import {
|
|
|
20
20
|
DEBUGGER_RECIPES,
|
|
21
21
|
debuggerRecipeForLanguage,
|
|
22
22
|
} from "./catalog.js";
|
|
23
|
+
import {
|
|
24
|
+
DEBUGMCP_EXTENSION_ID,
|
|
25
|
+
debugMcpInstalled,
|
|
26
|
+
debugMcpPort,
|
|
27
|
+
debugMcpResponds,
|
|
28
|
+
findVscodeWindow,
|
|
29
|
+
} from "./vscode-backend.js";
|
|
23
30
|
|
|
24
31
|
const DEFAULT_JS_DEBUG_PATH = "/opt/pi-debug-adapters/js-debug/src/dapDebugServer.js";
|
|
25
32
|
const DEFAULT_ELIXIR_LS_DEBUG_PATH = "/opt/pi-debug-adapters/elixir-ls/debug_adapter.sh";
|
|
@@ -37,6 +44,7 @@ export const debuggerDoctorPlugin: DoctorPlugin = {
|
|
|
37
44
|
title: "Debug adapters",
|
|
38
45
|
run: checkDebuggerAdapters,
|
|
39
46
|
});
|
|
47
|
+
api.addCheck({ id: "vscode", title: "VS Code debugger backend", run: checkVscodeBackend });
|
|
40
48
|
},
|
|
41
49
|
};
|
|
42
50
|
|
|
@@ -150,6 +158,45 @@ async function checkDebuggerAdapters(context: DoctorContext): Promise<readonly D
|
|
|
150
158
|
);
|
|
151
159
|
}
|
|
152
160
|
|
|
161
|
+
/** Report whether `debug` can use VS Code through DebugMCP for this local workspace. */
|
|
162
|
+
async function checkVscodeBackend(context: DoctorContext): Promise<readonly DoctorFinding[]> {
|
|
163
|
+
if (context.workspace !== undefined) {
|
|
164
|
+
return [{ status: "skip", message: "The VS Code backend debugs only local workspaces" }];
|
|
165
|
+
}
|
|
166
|
+
const window = await findVscodeWindow([context.cwd]);
|
|
167
|
+
if (window !== undefined) {
|
|
168
|
+
return (await debugMcpResponds(context.signal))
|
|
169
|
+
? [{ status: "pass", message: `VS Code backend: available in "${window.name}"` }]
|
|
170
|
+
: [
|
|
171
|
+
{
|
|
172
|
+
status: "fail",
|
|
173
|
+
message: "VS Code backend: DebugMCP does not respond",
|
|
174
|
+
detail: `"${window.name}" has this workspace open, but DebugMCP does not accept connections on port ${debugMcpPort(context.env)}. Set PI_DEBUGMCP_PORT when debugmcp.serverPort differs.`,
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
if (await debugMcpInstalled()) {
|
|
179
|
+
return [
|
|
180
|
+
{
|
|
181
|
+
status: "skip",
|
|
182
|
+
message: "VS Code backend: no VS Code window with DebugMCP has this workspace open",
|
|
183
|
+
detail:
|
|
184
|
+
"Open the workspace in VS Code to debug through it; debug uses native adapters meanwhile.",
|
|
185
|
+
},
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
if (await projectExecutableAvailable(context, "code")) {
|
|
189
|
+
return [
|
|
190
|
+
{
|
|
191
|
+
status: "warn",
|
|
192
|
+
message: "VS Code backend: DebugMCP is not installed",
|
|
193
|
+
detail: `Install it with: code --install-extension ${DEBUGMCP_EXTENSION_ID}`,
|
|
194
|
+
},
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
return [{ status: "skip", message: "VS Code backend: VS Code is not installed" }];
|
|
198
|
+
}
|
|
199
|
+
|
|
153
200
|
async function probeJavaFiles(
|
|
154
201
|
context: DoctorContext,
|
|
155
202
|
platform: NodeJS.Platform,
|
|
@@ -45,8 +45,10 @@ export function renderDebugResult(
|
|
|
45
45
|
expanded: boolean,
|
|
46
46
|
theme: DebugTheme,
|
|
47
47
|
evaluation?: DebugEvaluation,
|
|
48
|
+
failure?: string,
|
|
48
49
|
): Component {
|
|
49
50
|
const lines = debugResultLines(snapshot, expanded, theme);
|
|
51
|
+
if (failure !== undefined) lines.unshift(theme.fg("error", `✗ ${failure}`));
|
|
50
52
|
if (evaluation !== undefined) {
|
|
51
53
|
lines.unshift(
|
|
52
54
|
`${theme.fg("accent", evaluation.expression)} ${theme.fg("muted", "=")} ${theme.fg("toolOutput", evaluation.result)}${evaluation.type === undefined ? "" : theme.fg("dim", ` ${evaluation.type}`)}`,
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
OwnedDebugAdapter,
|
|
15
15
|
} from "./workspace-owner.js";
|
|
16
16
|
import { JavaDebugRuntime } from "./java-runtime.js";
|
|
17
|
+
import type { VscodeDebugSession, VscodeDebugState } from "./vscode-backend.js";
|
|
17
18
|
import { sameFilePath } from "pi-agent-ide/api/path-identity";
|
|
18
19
|
import {
|
|
19
20
|
DapClient,
|
|
@@ -43,12 +44,17 @@ export type DebugAdapter =
|
|
|
43
44
|
| "shell";
|
|
44
45
|
|
|
45
46
|
export interface DebugSessionOptions {
|
|
46
|
-
|
|
47
|
+
/** Native adapter, or `vscode` when VS Code chooses the debugger through DebugMCP. */
|
|
48
|
+
readonly adapter: DebugAdapter | "vscode";
|
|
47
49
|
readonly program: string;
|
|
48
50
|
readonly sourceFile: string;
|
|
49
51
|
readonly args: readonly string[];
|
|
50
52
|
readonly cwd: string;
|
|
51
53
|
readonly mainClass?: string;
|
|
54
|
+
/** VS Code `launch.json` configuration name; VS Code sessions only. */
|
|
55
|
+
readonly configuration?: string;
|
|
56
|
+
/** Test name launched through the VS Code Testing API; VS Code sessions only. */
|
|
57
|
+
readonly test?: string;
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
export interface DebugBreakpoint {
|
|
@@ -108,6 +114,8 @@ export interface DebugSession {
|
|
|
108
114
|
readonly ownerKey?: string;
|
|
109
115
|
remote?: { readonly target: string; readonly pid: number; readonly identity?: string };
|
|
110
116
|
status: DebugSessionStatus;
|
|
117
|
+
/** DebugMCP controller; native DAP fields stay unused for these sessions. */
|
|
118
|
+
vscode?: VscodeDebugSession;
|
|
111
119
|
client?: DapClient;
|
|
112
120
|
controlClient?: DapClient;
|
|
113
121
|
clients?: DapClient[];
|
|
@@ -189,6 +197,7 @@ export class DebugSessionManager {
|
|
|
189
197
|
/** Create a configured session without launching the debuggee. */
|
|
190
198
|
create(
|
|
191
199
|
options: Omit<DebugSessionOptions, "sourceFile"> & { readonly sourceFile?: string },
|
|
200
|
+
vscode?: VscodeDebugSession,
|
|
192
201
|
): DebugSession {
|
|
193
202
|
const owner = this.#ownerResolver?.(options.cwd);
|
|
194
203
|
if (
|
|
@@ -207,6 +216,7 @@ export class DebugSessionManager {
|
|
|
207
216
|
source: `debug:${id}`,
|
|
208
217
|
options: { ...options, sourceFile: options.sourceFile ?? options.program },
|
|
209
218
|
...(owner === undefined ? {} : { ownerKey: owner.key }),
|
|
219
|
+
...(vscode === undefined ? {} : { vscode }),
|
|
210
220
|
breakpoints: new Map(),
|
|
211
221
|
status: "configured",
|
|
212
222
|
stopGeneration: 0,
|
|
@@ -299,6 +309,7 @@ export class DebugSessionManager {
|
|
|
299
309
|
line,
|
|
300
310
|
verified: false,
|
|
301
311
|
};
|
|
312
|
+
if (session.vscode !== undefined) await session.vscode.addBreakpoint(file, line, signal);
|
|
302
313
|
session.breakpoints.set(id, breakpoint);
|
|
303
314
|
if (session.client !== undefined)
|
|
304
315
|
await this.#configureBreakpointFile(session, session.client, file, signal);
|
|
@@ -316,11 +327,88 @@ export class DebugSessionManager {
|
|
|
316
327
|
|
|
317
328
|
/** Launch the debuggee, configure breakpoints, and wait for a stop or termination. */
|
|
318
329
|
async start(session: DebugSession, signal?: AbortSignal): Promise<DebugSession> {
|
|
330
|
+
if (session.vscode !== undefined) return this.#startVscode(session, session.vscode, signal);
|
|
319
331
|
if (session.options.adapter === "java" && this.#owner(session) === undefined)
|
|
320
332
|
return this.#startJava(session, signal);
|
|
321
333
|
return this.#start(session, signal, 2);
|
|
322
334
|
}
|
|
323
335
|
|
|
336
|
+
async #startVscode(
|
|
337
|
+
session: DebugSession,
|
|
338
|
+
vscode: VscodeDebugSession,
|
|
339
|
+
signal?: AbortSignal,
|
|
340
|
+
): Promise<DebugSession> {
|
|
341
|
+
if (session.status !== "configured") throw new Error(`Session is already ${session.status}`);
|
|
342
|
+
session.status = "running";
|
|
343
|
+
this.#notify(session);
|
|
344
|
+
try {
|
|
345
|
+
const { program, cwd, configuration, test } = session.options;
|
|
346
|
+
const state = await vscode.start(
|
|
347
|
+
{
|
|
348
|
+
program,
|
|
349
|
+
cwd,
|
|
350
|
+
...(configuration === undefined ? {} : { configuration }),
|
|
351
|
+
...(test === undefined ? {} : { test }),
|
|
352
|
+
},
|
|
353
|
+
signal,
|
|
354
|
+
);
|
|
355
|
+
await this.#applyVscodeState(session, vscode, state);
|
|
356
|
+
} catch (error) {
|
|
357
|
+
session.status = "configured";
|
|
358
|
+
this.#notify(session);
|
|
359
|
+
throw error;
|
|
360
|
+
}
|
|
361
|
+
return session;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** Mirror one DebugMCP state into the session's stop snapshot. */
|
|
365
|
+
async #applyVscodeState(
|
|
366
|
+
session: DebugSession,
|
|
367
|
+
vscode: VscodeDebugSession,
|
|
368
|
+
state: VscodeDebugState,
|
|
369
|
+
previous?: DebugFrame,
|
|
370
|
+
): Promise<void> {
|
|
371
|
+
if (state.status !== "paused") {
|
|
372
|
+
session.status = state.status === "running" ? "running" : "terminated";
|
|
373
|
+
session.stop = undefined;
|
|
374
|
+
this.#notify(session);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const frame: DebugFrame | undefined =
|
|
378
|
+
state.frame === undefined
|
|
379
|
+
? undefined
|
|
380
|
+
: {
|
|
381
|
+
id: state.frame.id,
|
|
382
|
+
name: state.frame.name,
|
|
383
|
+
line: state.frame.line,
|
|
384
|
+
...withSourcePath(
|
|
385
|
+
state.frame.file ?? inferVscodeFrameFile(session, state.frame, previous),
|
|
386
|
+
),
|
|
387
|
+
};
|
|
388
|
+
let hitBreakpoint = false;
|
|
389
|
+
for (const breakpoint of session.breakpoints.values()) {
|
|
390
|
+
if (
|
|
391
|
+
frame?.source?.path !== undefined &&
|
|
392
|
+
sameFilePath(breakpoint.file, frame.source.path) &&
|
|
393
|
+
breakpoint.line === frame.line
|
|
394
|
+
) {
|
|
395
|
+
breakpoint.verified = true;
|
|
396
|
+
hitBreakpoint = true;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
session.stopGeneration++;
|
|
400
|
+
session.stop = {
|
|
401
|
+
generation: session.stopGeneration,
|
|
402
|
+
reason: hitBreakpoint ? "breakpoint" : "step",
|
|
403
|
+
threadId: state.frame?.threadId ?? 0,
|
|
404
|
+
...(frame === undefined ? {} : { frame }),
|
|
405
|
+
variables: frame === undefined ? [] : await vscodeVariables(vscode),
|
|
406
|
+
sourceLines: frame === undefined ? [] : await sourceWindow(frame),
|
|
407
|
+
};
|
|
408
|
+
session.status = "stopped";
|
|
409
|
+
this.#notify(session);
|
|
410
|
+
}
|
|
411
|
+
|
|
324
412
|
async #startJava(session: DebugSession, signal?: AbortSignal): Promise<DebugSession> {
|
|
325
413
|
if (session.status !== "configured") throw new Error(`Session is already ${session.status}`);
|
|
326
414
|
const runtime = new JavaDebugRuntime();
|
|
@@ -461,6 +549,11 @@ export class DebugSessionManager {
|
|
|
461
549
|
|
|
462
550
|
/** Refresh execution state from events that arrived after a control wait ended. */
|
|
463
551
|
async refresh(session: DebugSession): Promise<void> {
|
|
552
|
+
if (session.vscode !== undefined) {
|
|
553
|
+
if (session.status === "running")
|
|
554
|
+
await this.#applyVscodeState(session, session.vscode, await session.vscode.status(0));
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
464
557
|
if (session.client === undefined) return;
|
|
465
558
|
for (
|
|
466
559
|
let event = session.client.takeEvent(["breakpoint"]);
|
|
@@ -498,6 +591,20 @@ export class DebugSessionManager {
|
|
|
498
591
|
if (session.status !== "stopped" || session.stop === undefined) {
|
|
499
592
|
throw new Error(`Cannot ${command} while session is ${session.status}`);
|
|
500
593
|
}
|
|
594
|
+
if (session.vscode !== undefined) {
|
|
595
|
+
const vscode = session.vscode;
|
|
596
|
+
const previous = session.stop.frame;
|
|
597
|
+
session.stop = undefined;
|
|
598
|
+
session.status = "running";
|
|
599
|
+
this.#notify(session);
|
|
600
|
+
await this.#applyVscodeState(
|
|
601
|
+
session,
|
|
602
|
+
vscode,
|
|
603
|
+
await vscode.command(command, signal),
|
|
604
|
+
previous,
|
|
605
|
+
);
|
|
606
|
+
return session;
|
|
607
|
+
}
|
|
501
608
|
const client = requiredClient(session);
|
|
502
609
|
const threadId = session.stop.threadId;
|
|
503
610
|
await client.request(command, { threadId }, { signal });
|
|
@@ -524,6 +631,12 @@ export class DebugSessionManager {
|
|
|
524
631
|
const stop = session.stop;
|
|
525
632
|
const frameId = session.stop.frame.id;
|
|
526
633
|
if (trimmed.length === 0) throw new Error("Debug evaluation requires an expression");
|
|
634
|
+
if (session.vscode !== undefined) {
|
|
635
|
+
const evaluation = await session.vscode.evaluate(trimmed, signal);
|
|
636
|
+
session.stop = { ...stop, variables: await vscodeVariables(session.vscode, signal) };
|
|
637
|
+
this.#notify(session);
|
|
638
|
+
return { expression: trimmed, ...evaluation, variablesReference: 0 };
|
|
639
|
+
}
|
|
527
640
|
const response = await requiredClient(session).request<EvaluateBody>(
|
|
528
641
|
"evaluate",
|
|
529
642
|
{
|
|
@@ -555,6 +668,7 @@ export class DebugSessionManager {
|
|
|
555
668
|
const breakpoint = session.breakpoints.get(breakpointMatch[1] as string);
|
|
556
669
|
if (breakpoint === undefined) throw new Error(`Unknown debug breakpoint ${source}`);
|
|
557
670
|
session.breakpoints.delete(breakpoint.id);
|
|
671
|
+
await session.vscode?.removeBreakpoint(breakpoint.file, breakpoint.requestedLine, signal);
|
|
558
672
|
if (session.client !== undefined && session.status !== "terminated") {
|
|
559
673
|
await this.#configureBreakpointFile(session, session.client, breakpoint.file, signal);
|
|
560
674
|
}
|
|
@@ -562,6 +676,8 @@ export class DebugSessionManager {
|
|
|
562
676
|
return;
|
|
563
677
|
}
|
|
564
678
|
if (source !== session.source) throw new Error(`Cannot delete debug resource ${source}`);
|
|
679
|
+
// A closed VS Code window must not keep the Pi session alive.
|
|
680
|
+
await session.vscode?.close(signal).catch(() => {});
|
|
565
681
|
if (session.client !== undefined) {
|
|
566
682
|
await (session.controlClient ?? session.client)
|
|
567
683
|
.request("disconnect", { terminateDebuggee: true }, { signal, timeoutMs: 500 })
|
|
@@ -1085,6 +1201,35 @@ export class DebugSessionManager {
|
|
|
1085
1201
|
}
|
|
1086
1202
|
}
|
|
1087
1203
|
|
|
1204
|
+
/**
|
|
1205
|
+
* Infer a frame file that DebugMCP dropped, as it does in remote VS Code windows: use the only
|
|
1206
|
+
* Pi breakpoint file on that line, or the previous stop's file while the function is unchanged.
|
|
1207
|
+
*/
|
|
1208
|
+
function inferVscodeFrameFile(
|
|
1209
|
+
session: DebugSession,
|
|
1210
|
+
frame: { readonly name: string; readonly line: number },
|
|
1211
|
+
previous?: DebugFrame,
|
|
1212
|
+
): string | undefined {
|
|
1213
|
+
const files = new Set(
|
|
1214
|
+
[...session.breakpoints.values()]
|
|
1215
|
+
.filter((breakpoint) => breakpoint.line === frame.line)
|
|
1216
|
+
.map((breakpoint) => breakpoint.file),
|
|
1217
|
+
);
|
|
1218
|
+
if (files.size === 1) return [...files][0];
|
|
1219
|
+
return previous?.name === frame.name ? previous.source?.path : undefined;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
function withSourcePath(file: string | undefined): { readonly source?: { readonly path: string } } {
|
|
1223
|
+
return file === undefined ? {} : { source: { path: file } };
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
async function vscodeVariables(
|
|
1227
|
+
vscode: VscodeDebugSession,
|
|
1228
|
+
signal?: AbortSignal,
|
|
1229
|
+
): Promise<DebugVariable[]> {
|
|
1230
|
+
return (await vscode.locals(signal)).map((variable) => ({ ...variable, variablesReference: 0 }));
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1088
1233
|
async function sourceWindow(
|
|
1089
1234
|
frame: DebugFrame,
|
|
1090
1235
|
readText?: (source: string) => Promise<string>,
|
|
@@ -40,6 +40,18 @@ export function debuggerEvaluationFromResult(details: unknown): DebugEvaluation
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
/** Extract the reason of a failed debugger action, such as a refused start. */
|
|
44
|
+
export function debuggerFailureFromResult(details: unknown): string | undefined {
|
|
45
|
+
const semantic = semanticActionFromResult(details);
|
|
46
|
+
const error = semantic?.ok === false ? semantic.error : undefined;
|
|
47
|
+
return typeof error === "object" &&
|
|
48
|
+
error !== null &&
|
|
49
|
+
"message" in error &&
|
|
50
|
+
typeof error.message === "string"
|
|
51
|
+
? error.message
|
|
52
|
+
: undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
43
55
|
function semanticActionFromResult(details: unknown): Readonly<Record<string, unknown>> | undefined {
|
|
44
56
|
if (typeof details !== "object" || details === null) return undefined;
|
|
45
57
|
const metadata = (details as { readonly metadata?: unknown }).metadata;
|