pi-agent-ide 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +65 -17
- package/dist/{chunk-KOVPDKSJ.js → chunk-2K65BSXS.js} +1 -1
- package/dist/chunk-3G54ZL2L.js +1 -0
- package/dist/chunk-3ZGDMTMD.js +25 -0
- package/dist/{chunk-ZIWPKIBZ.js → chunk-4OYVLXWD.js} +1 -1
- package/dist/chunk-4W7GH3T7.js +10 -0
- package/dist/chunk-4XPUN4QN.js +2 -0
- package/dist/chunk-5KFVDYCI.js +1 -0
- package/dist/chunk-6EDOLYOV.js +1 -0
- package/dist/chunk-756K3LJY.js +1 -0
- package/dist/chunk-75SWXD2Z.js +9 -0
- package/dist/chunk-7HDK3NRQ.js +1 -0
- package/dist/chunk-7JV4VN73.js +1 -0
- package/dist/chunk-7NS3QUIE.js +9 -0
- package/dist/chunk-7TJ6DWW3.js +2 -0
- package/dist/chunk-ABFCAOU5.js +1 -0
- package/dist/chunk-BIG45IPN.js +2 -0
- package/dist/chunk-BQ67M4NC.js +3 -0
- package/dist/chunk-BXGMMZT3.js +1 -0
- package/dist/chunk-CPZJPGLG.js +1 -0
- package/dist/chunk-CSXHCSTH.js +9 -0
- package/dist/chunk-CTJV77FR.js +1 -0
- package/dist/chunk-DUUOCBS3.js +3 -0
- package/dist/chunk-E4HPRLRB.js +1 -0
- package/dist/chunk-EY65TFHJ.js +1 -0
- package/dist/chunk-GW6NZQTQ.js +1 -0
- package/dist/chunk-HCN5W76B.js +1 -0
- package/dist/chunk-ICDI27GZ.js +1 -0
- package/dist/{chunk-SNF7PDDX.js → chunk-IH5NW5JX.js} +1 -1
- package/dist/chunk-IMGIDBCC.js +1 -0
- package/dist/chunk-IUSLSROY.js +1 -0
- package/dist/chunk-KL776TGR.js +1 -0
- package/dist/chunk-L2B4DTVS.js +1 -0
- package/dist/chunk-LEKC4GQK.js +5 -0
- package/dist/chunk-MKEC3U2M.js +4 -0
- package/dist/chunk-MOJ5RR35.js +1 -0
- package/dist/{chunk-H445SHSJ.js → chunk-MZXX353D.js} +1 -1
- package/dist/{chunk-ZTYWHL2F.js → chunk-N7LMRL64.js} +1 -1
- package/dist/chunk-NULNW6GK.js +1 -0
- package/dist/chunk-O36UC74T.js +1 -0
- package/dist/chunk-OFILFO6D.js +1 -0
- package/dist/chunk-OJX3RJ5A.js +1 -0
- package/dist/chunk-OLI3JPHJ.js +28 -0
- package/dist/{chunk-S6QRG3TQ.js → chunk-OM4LYD3S.js} +1 -1
- package/dist/chunk-PNP2KNGP.js +5 -0
- package/dist/chunk-QP2QSQ4U.js +2 -0
- package/dist/chunk-R2U5WXYR.js +1 -0
- package/dist/chunk-R5XJSEOE.js +3 -0
- package/dist/{chunk-7UGNGK7Y.js → chunk-RAZP42IQ.js} +1 -1
- package/dist/chunk-S72FVLUX.js +1 -0
- package/dist/chunk-SBLKPTL3.js +1 -0
- package/dist/chunk-SBNR4WZF.js +1 -0
- package/dist/chunk-SSWUUBIR.js +1 -0
- package/dist/chunk-T4FTT3U4.js +1 -0
- package/dist/chunk-TOYN4W4F.js +1 -0
- package/dist/chunk-TWWND6NI.js +1 -0
- package/dist/chunk-UBH6X3D3.js +1 -0
- package/dist/{chunk-QFTBY67N.js → chunk-UEVGZUII.js} +3 -3
- package/dist/chunk-UUJJRXHG.js +29 -0
- package/dist/chunk-VDP5CQHM.js +3 -0
- package/dist/chunk-WE42GBGU.js +4 -0
- package/dist/chunk-XZDOVPRC.js +1 -0
- package/dist/chunk-YJ6T3PEP.js +1 -0
- package/dist/chunk-Z3PGADVA.js +3 -0
- package/dist/{chunk-QDLTO5PH.js → chunk-ZAWRSA7N.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-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.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 -2
- package/dist/entry-26.js +2 -1
- package/dist/entry-27.js +1 -2
- package/dist/entry-28.js +4 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +1 -17
- package/dist/entry-32.js +18 -1
- package/dist/entry-33.js +1 -2
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -4
- package/dist/entry-37.js +1 -9
- 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 -25
- package/dist/entry-46.js +25 -1
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -3
- package/dist/entry-51.js +3 -13
- package/dist/entry-52.js +13 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-55.js +1 -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-60.js +1 -1
- package/dist/entry-61.js +1 -0
- package/dist/entry-62.js +0 -1
- package/dist/entry-63.js +1 -0
- package/dist/entry-64.js +0 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +1 -1
- package/dist/entry-71.js +1 -0
- package/dist/entry-72.js +0 -1
- package/dist/entry-73.js +1 -0
- package/dist/entry-74.js +0 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +1 -75
- package/dist/entry-78.js +76 -14
- package/dist/entry-79.js +21 -2
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +2 -1
- package/dist/entry-81.js +1 -1
- package/dist/entry-82.js +1 -5
- package/dist/entry-83.js +1 -3
- package/dist/entry-84.js +3 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -0
- package/dist/pi-agent-ide.js +21 -21
- package/docs/agent-guides/debugger.md +2 -0
- package/docs/agent-guides/editing.md +10 -3
- package/docs/agent-guides/search-code.md +4 -1
- package/docs/agent-guides/ssh.md +58 -0
- package/docs/agent-guides/vision.md +6 -0
- package/docs/configuration.md +55 -0
- package/docs/development.md +4 -0
- package/docs/directory-operations.md +45 -0
- package/docs/releases.md +8 -0
- package/docs/research/codemode-write-context.md +56 -0
- package/docs/tools.md +21 -14
- package/docs/user-hooks.md +29 -1
- package/node_modules/pi-agent-doctor/package.json +6 -2
- package/node_modules/pi-agent-doctor/src/evidence.ts +49 -4
- package/node_modules/pi-agent-doctor/src/executable.ts +46 -16
- package/node_modules/pi-agent-doctor/src/fixtures/executable-probe.ts +78 -0
- package/node_modules/pi-agent-doctor/src/fixtures/probe-executable-wait.mjs +10 -0
- package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +6 -0
- package/node_modules/pi-agent-doctor/src/project-probes.ts +73 -0
- package/node_modules/pi-agent-doctor/src/workspace.ts +106 -0
- package/node_modules/pi-agent-documentation/package.json +2 -2
- package/node_modules/pi-agent-documentation/runtime/entry-25.js +1 -0
- package/node_modules/pi-agent-filesystem/package.json +8 -8
- package/node_modules/pi-agent-filesystem/src/resolver.ts +23 -7
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-jq/index.ts +33 -6
- package/node_modules/pi-agent-filesystem-jq/package.json +6 -6
- package/node_modules/pi-agent-filesystem-jq/src/jq.ts +67 -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-30.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +15 -15
- package/node_modules/pi-agent-ide-ast/runtime/entry-31.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-32.js +2 -0
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +2 -1
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +10 -3
- package/node_modules/pi-agent-ide-ast/src/ast/read-text.ts +4 -1
- package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +3 -3
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +13 -10
- package/node_modules/pi-agent-ide-ast/src/extension.ts +20 -2
- package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +32 -4
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +9 -4
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/search-presentation.ts +4 -3
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +100 -42
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +3 -2
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +2 -1
- package/node_modules/pi-agent-ide-changes/index.ts +10 -2
- package/node_modules/pi-agent-ide-changes/package.json +11 -10
- package/node_modules/pi-agent-ide-changes/runtime/entry-33.js +0 -1
- package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +7 -2
- package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +18 -1
- package/node_modules/pi-agent-ide-changes/src/changes/change-types.ts +3 -0
- package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +59 -7
- package/node_modules/pi-agent-ide-changes/src/changes/git-paths.ts +49 -0
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +10 -2
- package/node_modules/pi-agent-ide-changes/src/doctor-plugin.ts +13 -14
- package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +2 -1
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +63 -11
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -1
- package/node_modules/pi-agent-ide-formatter/index.ts +14 -2
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +47 -35
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +41 -11
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -28
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/index.ts +35 -4
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +14 -10
- package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +47 -39
- package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -25
- package/node_modules/pi-agent-ide-lsp/index.ts +108 -26
- package/node_modules/pi-agent-ide-lsp/package.json +10 -10
- package/node_modules/pi-agent-ide-lsp/runtime/entry-38.js +2 -0
- package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +6 -2
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +7 -2
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +5 -3
- package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +27 -11
- package/node_modules/pi-agent-ide-lsp/src/lsp/abort.ts +62 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +245 -103
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +26 -45
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/document-uri.ts +40 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/file-watchers.ts +8 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +24 -17
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +255 -56
- package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +51 -11
- package/node_modules/pi-agent-ide-lsp/src/lsp/owner-transport.ts +67 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +149 -18
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +79 -31
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +15 -12
- package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +16 -0
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +67 -46
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +50 -19
- 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 -3
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-45.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-46.js +2 -0
- package/node_modules/pi-agent-read/src/api/tools/read.ts +4 -2
- package/node_modules/pi-agent-read/src/core/extension.ts +4 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +143 -69
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +25 -1
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +67 -44
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +8 -3
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +20 -5
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +75 -16
- package/node_modules/pi-agent-resource/src/index.ts +3 -0
- package/node_modules/pi-agent-resource/src/resource-error.ts +17 -0
- package/node_modules/pi-agent-resource/src/resource.ts +23 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +16 -2
- package/node_modules/pi-agent-resource/src/validation.ts +2 -1
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-50.js +0 -1
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +6 -2
- package/node_modules/pi-agent-search/src/api/search.ts +44 -2
- package/node_modules/pi-agent-search/src/core/extension.ts +2 -3
- package/node_modules/pi-agent-search/src/core/search-core.ts +78 -8
- package/node_modules/pi-agent-search-text/index.ts +35 -1
- package/node_modules/pi-agent-search-text/package.json +14 -12
- package/node_modules/pi-agent-search-text/runtime/entry-52.js +1 -0
- package/node_modules/pi-agent-search-text/src/doctor-plugin.ts +10 -5
- package/node_modules/pi-agent-search-text/src/file-search.ts +26 -3
- package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +54 -3
- package/node_modules/pi-agent-search-text/src/resolvers.ts +22 -5
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +4 -5
- package/node_modules/pi-agent-search-text/src/search-backend.ts +110 -12
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +5 -1
- package/node_modules/pi-agent-search-text/src/search-result.ts +1 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +100 -24
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-56.js +1 -0
- package/node_modules/pi-agent-text/src/text-document.ts +2 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-57.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-58.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-59.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-60.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-61.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +3 -1
- package/node_modules/pi-agent-text-editor/package.json +26 -26
- package/node_modules/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +51 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/file-operations.ts +55 -0
- package/node_modules/pi-agent-text-editor/src/api/file-transfers.ts +41 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/native-files.ts +127 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +23 -1
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +298 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +14 -2
- package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +81 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +51 -5
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +143 -57
- package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +31 -2
- package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +206 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +1 -6
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +9 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +91 -14
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +125 -17
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +39 -9
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +7 -1
- package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +116 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +7 -3
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +350 -25
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +132 -31
- package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +69 -0
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +6 -4
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +128 -23
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +1 -0
- package/node_modules/pi-agent-web/index.ts +28 -4
- package/node_modules/pi-agent-web/package.json +8 -8
- package/node_modules/pi-agent-web/src/doctor-plugin.ts +21 -6
- package/node_modules/pi-agent-web/src/resolver.ts +12 -2
- package/node_modules/pi-agent-web/src/search.ts +2 -1
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-87.js +2 -0
- package/package.json +36 -35
- package/src/api/doctor-runtime.ts +80 -0
- package/src/api/doctor.ts +6 -0
- package/src/api/hooks.ts +27 -0
- package/src/api/plugin-protocol.ts +11 -1
- package/src/api/tool-config.ts +143 -24
- package/src/backend/config.ts +85 -0
- package/src/backend/configured-process.ts +59 -0
- package/src/backend/dap-java-transport.ts +112 -0
- package/src/backend/dap-java-worker.py +218 -0
- package/src/backend/dap-node-transport.ts +112 -0
- package/src/backend/dap-powershell-worker.py +44 -0
- package/src/backend/dap-r-worker.py +210 -0
- package/src/backend/dap-tcp-transport.ts +42 -0
- package/src/backend/dap-tcp-worker.py +125 -0
- package/src/backend/dap-transport.ts +69 -0
- package/src/backend/dap-unix-worker.py +63 -0
- package/src/backend/debugger-registration.ts +62 -0
- package/src/backend/debugger-workspace-owner.ts +413 -0
- package/src/backend/doctor-inventory-worker.py +54 -0
- package/src/backend/doctor-probe-worker.py +140 -0
- package/src/backend/doctor-registration.ts +18 -0
- package/src/backend/doctor-workspace.ts +381 -0
- package/src/backend/file-operation-resolver.ts +58 -0
- package/src/backend/file-revision.ts +13 -0
- package/src/backend/file-transfer.ts +302 -0
- package/src/backend/file-watch-worker.py +119 -0
- package/src/backend/formatter-registration.ts +114 -0
- package/src/backend/git-registration.ts +60 -0
- package/src/backend/identity.ts +47 -0
- package/src/backend/index.ts +12 -0
- package/src/backend/lint-registration.ts +102 -0
- package/src/backend/lsp-file-watchers.ts +220 -0
- package/src/backend/lsp-registration.ts +83 -0
- package/src/backend/lsp-transport.ts +87 -0
- package/src/backend/lsp-workspace-owner.ts +50 -0
- package/src/backend/object-transfer.ts +299 -0
- package/src/backend/owned-command.ts +105 -0
- package/src/backend/owned-process-stop.ts +36 -0
- package/src/backend/owned-read-command.ts +20 -0
- package/src/backend/process-environment.ts +77 -0
- package/src/backend/process-metadata-worker.py +98 -0
- package/src/backend/process-metadata.ts +99 -0
- package/src/backend/recipe-evidence-worker.py +26 -0
- package/src/backend/recipe-evidence.ts +77 -0
- package/src/backend/registration.ts +124 -0
- package/src/backend/registry.ts +29 -0
- package/src/backend/resource-resolver.ts +147 -0
- package/src/backend/search-environment.ts +100 -0
- package/src/backend/ssh-channel-worker.py +306 -0
- package/src/backend/ssh-channel.ts +376 -0
- package/src/backend/ssh-transfer-worker.py +99 -0
- package/src/backend/ssh-transport.ts +54 -0
- package/src/backend/ssh-worker.py +730 -0
- package/src/backend/ssh.ts +610 -0
- package/src/backend/tool-config-access.ts +63 -0
- package/src/backend/tool-project.ts +71 -0
- package/src/backend/vision-capture-worker.py +319 -0
- package/src/backend/vision-capture.ts +165 -0
- package/src/backend/vision-registration.ts +104 -0
- package/src/backend/web-browser-worker.mjs +182 -0
- package/src/backend/web-browser.ts +128 -0
- package/src/backend/web-http-worker.py +62 -0
- package/src/backend/web-http.ts +79 -0
- package/src/backend/web-owner.ts +68 -0
- package/src/backend/web-registration.ts +14 -0
- package/src/code-view/diagnostic-view.ts +2 -2
- package/src/code-view/reference.ts +9 -0
- package/src/composite/builtin-extensions.ts +9 -14
- package/src/composite/module-labels.ts +1 -0
- package/src/composite/nested-tool-rendering.ts +130 -72
- package/src/core/diagnostic-store.ts +32 -10
- package/src/core/ide-core.ts +22 -2
- package/src/doctor/arguments.ts +19 -0
- package/src/doctor/config-writer.ts +72 -29
- package/src/doctor/discovery.ts +53 -15
- package/src/doctor/extension.ts +27 -10
- package/src/doctor/run.ts +42 -7
- 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/index.ts +33 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +6 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +67 -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-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-30.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-26.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +23 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- 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-pdf/package.json +4 -4
- 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-87.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/doctor-plugin.ts +21 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +12 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +2 -1
- package/src/extensions/pi-agent-read/package.json +12 -12
- package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-46.js +2 -0
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +4 -2
- package/src/extensions/pi-agent-read/src/core/extension.ts +4 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +143 -69
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +25 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +67 -44
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +8 -3
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +20 -5
- package/src/extensions/pi-agent-search/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +35 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-52.js +1 -0
- 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/src/doctor-plugin.ts +10 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +26 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +54 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +22 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +4 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +110 -12
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +5 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +100 -24
- package/src/extensions/pi-agent-search/runtime/entry-50.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-51.js +2 -0
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +6 -2
- package/src/extensions/pi-agent-search/src/api/search.ts +44 -2
- package/src/extensions/pi-agent-search/src/core/extension.ts +2 -3
- package/src/extensions/pi-agent-search/src/core/search-core.ts +78 -8
- package/src/extensions/pi-agent-text-editor/package.json +26 -26
- 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-57.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-58.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-59.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-60.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-61.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +3 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +128 -23
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +51 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/file-operations.ts +55 -0
- package/src/extensions/pi-agent-text-editor/src/api/file-transfers.ts +41 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/native-files.ts +127 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +23 -1
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +298 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +14 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +81 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +51 -5
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +143 -57
- package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +31 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +206 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +1 -6
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +9 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +91 -14
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +125 -17
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +39 -9
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +7 -1
- package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +116 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +7 -3
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +350 -25
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +132 -31
- package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +69 -0
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +6 -4
- package/src/plugins/pi-agent-ide-ast/package.json +15 -15
- package/src/plugins/pi-agent-ide-ast/runtime/entry-31.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-32.js +2 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +2 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +10 -3
- package/src/plugins/pi-agent-ide-ast/src/ast/read-text.ts +4 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +3 -3
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +13 -10
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +20 -2
- package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +32 -4
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +9 -4
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/search-presentation.ts +4 -3
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +100 -42
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +3 -2
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +2 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +10 -2
- package/src/plugins/pi-agent-ide-changes/package.json +11 -10
- package/src/plugins/pi-agent-ide-changes/runtime/entry-33.js +0 -1
- package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +7 -2
- package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +18 -1
- package/src/plugins/pi-agent-ide-changes/src/changes/change-types.ts +3 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +59 -7
- package/src/plugins/pi-agent-ide-changes/src/changes/git-paths.ts +49 -0
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +10 -2
- package/src/plugins/pi-agent-ide-changes/src/doctor-plugin.ts +13 -14
- package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +2 -1
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +63 -11
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -1
- package/src/plugins/pi-agent-ide-debugger/index.ts +65 -26
- package/src/plugins/pi-agent-ide-debugger/src/adapter-executables.ts +3 -1
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +33 -0
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +150 -171
- package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +2 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +152 -58
- package/src/plugins/pi-agent-ide-debugger/src/workspace-owner.ts +28 -0
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +4 -1
- package/src/plugins/pi-agent-ide-formatter/index.ts +14 -2
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +47 -35
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +41 -11
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -28
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/index.ts +35 -4
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +14 -10
- package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +47 -39
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -25
- package/src/plugins/pi-agent-ide-lsp/index.ts +108 -26
- package/src/plugins/pi-agent-ide-lsp/package.json +10 -10
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-38.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +6 -2
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +7 -2
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +5 -3
- package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +27 -11
- package/src/plugins/pi-agent-ide-lsp/src/lsp/abort.ts +62 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +245 -103
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +26 -45
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/document-uri.ts +40 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/file-watchers.ts +8 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +24 -17
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +255 -56
- package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +51 -11
- package/src/plugins/pi-agent-ide-lsp/src/lsp/owner-transport.ts +67 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +149 -18
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +79 -31
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +15 -12
- package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +16 -0
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +67 -46
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +50 -19
- package/src/plugins/pi-agent-ide-processes/src/registry.ts +8 -1
- package/src/plugins/pi-agent-ide-terminal/index.ts +7 -0
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +5 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +161 -42
- package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +7 -0
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +11 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +33 -8
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +5 -0
- package/src/plugins/pi-agent-ide-vision/index.ts +170 -9
- package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +47 -0
- package/src/plugins/pi-agent-ide-vision/src/vision.ts +42 -1
- package/src/post-edit/gate.ts +4 -1
- package/src/toolchain/types.ts +2 -0
- package/dist/chunk-3YK4XMWB.js +0 -0
- package/dist/chunk-5JELU6RV.js +0 -7
- package/dist/chunk-6U5OU77O.js +0 -3
- package/dist/chunk-7LD2OQH3.js +0 -14
- package/dist/chunk-EURHXLN3.js +0 -2
- package/dist/chunk-F6IWZKOG.js +0 -25
- package/dist/chunk-IG56UGSO.js +0 -2
- package/dist/chunk-KVHDMIZS.js +0 -3
- package/dist/chunk-M5IVSCR2.js +0 -1
- package/dist/chunk-M5MJP7Z2.js +0 -1
- package/dist/chunk-MGCHOGQD.js +0 -1
- package/dist/chunk-N34ATN52.js +0 -1
- package/dist/chunk-OB46OPMZ.js +0 -1
- package/dist/chunk-PKSQT6TC.js +0 -1
- package/dist/chunk-Q6CZ6GBR.js +0 -3
- package/dist/chunk-QIK2E64R.js +0 -1
- package/dist/chunk-SBP3ABH4.js +0 -5
- package/dist/chunk-SJ4UZ4GU.js +0 -1
- package/dist/chunk-STBJO3Z3.js +0 -2
- package/dist/chunk-T6LX2RX5.js +0 -1
- package/dist/chunk-TQGE7RH6.js +0 -28
- package/dist/chunk-WZI4YC2O.js +0 -1
- package/dist/chunk-XDG7EQRN.js +0 -28
- package/dist/chunk-YWQS33DF.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-25.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-30.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-32.js +0 -1
- package/node_modules/pi-agent-image/runtime/entry-38.js +0 -1
- package/node_modules/pi-agent-resource/runtime/entry-46.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-56.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-57.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-59.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-61.js +0 -1
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-26.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-25.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-41.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-51.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-47.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-56.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-57.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-59.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-61.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-30.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-32.js +0 -1
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-24.js +0 -0
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-26.js +0 -0
- /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-27.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-jq}/runtime/entry-28.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-34.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-36.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-37.js +0 -0
- /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-39.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-47.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-51.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-55.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-81.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-27.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-jq}/runtime/entry-28.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-29.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-84.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-85.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-79.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-34.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-35.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-36.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-37.js +0 -0
|
@@ -32,49 +32,108 @@ import {
|
|
|
32
32
|
|
|
33
33
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
34
34
|
|
|
35
|
+
/** Backend-neutral language server transport for root registration bridges. */
|
|
36
|
+
import type { LspWorkspaceOwner } from "./src/lsp/workspace-owner.js";
|
|
37
|
+
import { SharedStartup, waitWithSignal } from "./src/lsp/abort.js";
|
|
38
|
+
export type { LspWorkspaceOwner } from "./src/lsp/workspace-owner.js";
|
|
39
|
+
export type {
|
|
40
|
+
LspFileWatcherSubscriptions,
|
|
41
|
+
WatchPattern,
|
|
42
|
+
WatchedFileChange,
|
|
43
|
+
} from "./src/lsp/file-watchers.js";
|
|
44
|
+
export type { LspOwnerTransport, LspOwnedProcess } from "./src/lsp/owner-transport.js";
|
|
45
|
+
export { LspServerRegistry } from "./src/lsp/registry.js";
|
|
46
|
+
export { LSP_RECIPES } from "./src/catalog.js";
|
|
35
47
|
const renderReadResult = createReadResultRenderer({ kind: "code-view", label: "LSP" });
|
|
36
48
|
|
|
49
|
+
/** Resource-owner hooks for root registration without backend imports in the LSP package. */
|
|
50
|
+
export interface LspRegistrationOwner {
|
|
51
|
+
loadRegistry(cwd: string, external: boolean, signal?: AbortSignal): Promise<LspServerRegistry>;
|
|
52
|
+
workspace(cwd: string): LspWorkspaceOwner | undefined;
|
|
53
|
+
resolveProject(
|
|
54
|
+
filePath: string,
|
|
55
|
+
cwd: string,
|
|
56
|
+
signal?: AbortSignal,
|
|
57
|
+
): Promise<{ cwd: string; external: boolean } | undefined>;
|
|
58
|
+
}
|
|
59
|
+
|
|
37
60
|
export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
38
|
-
|
|
61
|
+
await registerLspWithOwner(pi);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Register ordinary LSP tools, optionally using explicit workspace-owner hooks. */
|
|
65
|
+
export async function registerLspWithOwner(
|
|
66
|
+
pi: ExtensionAPI,
|
|
67
|
+
owner?: LspRegistrationOwner,
|
|
68
|
+
): Promise<void> {
|
|
69
|
+
const managers = new Map<string, SharedStartup<LspManager>>();
|
|
39
70
|
let disposed = false;
|
|
40
|
-
const managerFor = (
|
|
41
|
-
|
|
71
|
+
const managerFor = async (
|
|
72
|
+
cwd: string,
|
|
73
|
+
external = false,
|
|
74
|
+
signal?: AbortSignal,
|
|
75
|
+
): Promise<LspManager> => {
|
|
76
|
+
signal?.throwIfAborted();
|
|
77
|
+
if (disposed) throw new Error("LSP session has ended");
|
|
42
78
|
const key = JSON.stringify([cwd, external]);
|
|
43
79
|
let ready = managers.get(key);
|
|
80
|
+
if (ready?.controller.signal.aborted) {
|
|
81
|
+
await waitWithSignal(
|
|
82
|
+
ready.promise.catch(() => undefined),
|
|
83
|
+
signal,
|
|
84
|
+
);
|
|
85
|
+
if (managers.get(key) === ready) managers.delete(key);
|
|
86
|
+
return managerFor(cwd, external, signal);
|
|
87
|
+
}
|
|
44
88
|
if (!ready) {
|
|
45
|
-
ready =
|
|
89
|
+
ready = new SharedStartup(async (startupSignal) => {
|
|
90
|
+
const registry = owner
|
|
91
|
+
? await owner.loadRegistry(cwd, external, startupSignal)
|
|
92
|
+
: await loadRegistry(cwd, external, startupSignal);
|
|
93
|
+
startupSignal.throwIfAborted();
|
|
46
94
|
if (disposed) throw new Error("LSP session has ended");
|
|
47
|
-
return LspManager.init(registry);
|
|
95
|
+
return LspManager.init(registry, owner?.workspace(cwd));
|
|
96
|
+
});
|
|
97
|
+
const pending = ready;
|
|
98
|
+
managers.set(key, pending);
|
|
99
|
+
void pending.promise.catch(() => {
|
|
100
|
+
if (managers.get(key) === pending) managers.delete(key);
|
|
48
101
|
});
|
|
49
|
-
managers.set(key, ready);
|
|
50
102
|
}
|
|
51
|
-
return ready;
|
|
103
|
+
return ready.wait(signal);
|
|
52
104
|
};
|
|
53
|
-
const resolveLspProject = async (filePath: string, cwd: string) => {
|
|
105
|
+
const resolveLspProject = async (filePath: string, cwd: string, signal?: AbortSignal) => {
|
|
106
|
+
signal?.throwIfAborted();
|
|
107
|
+
if (owner) return owner.resolveProject(filePath, cwd, signal);
|
|
54
108
|
const projectRoot = await resolveExternalToolProjectRoot(
|
|
55
109
|
cwd,
|
|
56
110
|
filePath,
|
|
57
111
|
"lsp-servers",
|
|
58
112
|
LSP_RECIPES,
|
|
113
|
+
signal,
|
|
59
114
|
);
|
|
115
|
+
signal?.throwIfAborted();
|
|
60
116
|
return projectRoot === undefined
|
|
61
117
|
? undefined
|
|
62
118
|
: { cwd: projectRoot, external: projectRoot !== path.resolve(cwd) };
|
|
63
119
|
};
|
|
64
120
|
|
|
121
|
+
const managerForFile = async (
|
|
122
|
+
cwd: string,
|
|
123
|
+
filePath?: string,
|
|
124
|
+
signal?: AbortSignal,
|
|
125
|
+
): Promise<LspManager> => {
|
|
126
|
+
signal?.throwIfAborted();
|
|
127
|
+
if (!filePath) return managerFor(cwd, false, signal);
|
|
128
|
+
const project = await resolveLspProject(filePath, cwd, signal);
|
|
129
|
+
signal?.throwIfAborted();
|
|
130
|
+
if (!project) throw new Error("No language server project for this source");
|
|
131
|
+
return managerFor(project.cwd, project.external, signal);
|
|
132
|
+
};
|
|
65
133
|
const compiler = {
|
|
66
|
-
|
|
134
|
+
...createLspCompiler(managerForFile),
|
|
67
135
|
name: "pi-agent-ide-lsp",
|
|
68
136
|
priority: 200,
|
|
69
|
-
extensions: ["*"],
|
|
70
|
-
detect: async (context) => {
|
|
71
|
-
await managerFor(context.cwd);
|
|
72
|
-
return true;
|
|
73
|
-
},
|
|
74
|
-
async compile(input, context) {
|
|
75
|
-
const manager = await managerFor(context.cwd);
|
|
76
|
-
return createLspCompiler(manager).compile(input, context);
|
|
77
|
-
},
|
|
78
137
|
} satisfies IdeTool;
|
|
79
138
|
const idePlugin = {
|
|
80
139
|
protocol: IDE_PROTOCOL,
|
|
@@ -89,7 +148,10 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
89
148
|
pi.on("session_shutdown", async () => {
|
|
90
149
|
disposed = true;
|
|
91
150
|
await Promise.allSettled(
|
|
92
|
-
[...managers.values()].map(async (ready) =>
|
|
151
|
+
[...managers.values()].map(async (ready) => {
|
|
152
|
+
if (!ready.settled) ready.controller.abort(new Error("LSP session has ended"));
|
|
153
|
+
await (await ready.promise).shutdownAll();
|
|
154
|
+
}),
|
|
93
155
|
);
|
|
94
156
|
managers.clear();
|
|
95
157
|
});
|
|
@@ -100,11 +162,11 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
100
162
|
id: "lsp",
|
|
101
163
|
setup(api) {
|
|
102
164
|
api.addResolver({
|
|
103
|
-
resolver: createLspSymbolResolver(
|
|
165
|
+
resolver: createLspSymbolResolver(managerForFile),
|
|
104
166
|
renderResult: renderReadResult,
|
|
105
167
|
});
|
|
106
168
|
api.addResolver({
|
|
107
|
-
resolver: createLspGraphResolver(
|
|
169
|
+
resolver: createLspGraphResolver(managerForFile),
|
|
108
170
|
renderResult: renderReadResult,
|
|
109
171
|
});
|
|
110
172
|
api.addHandler({
|
|
@@ -125,6 +187,19 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
125
187
|
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
126
188
|
id: "lsp-declarations",
|
|
127
189
|
setup(api) {
|
|
190
|
+
api.onDidEdit(async (completion) => {
|
|
191
|
+
await Promise.all(
|
|
192
|
+
[...managers.values()]
|
|
193
|
+
.filter((ready) => ready.settled)
|
|
194
|
+
.map((ready) =>
|
|
195
|
+
ready.promise.then(
|
|
196
|
+
(manager) =>
|
|
197
|
+
manager.syncEditedSource(completion.source, completion.after.content),
|
|
198
|
+
() => undefined,
|
|
199
|
+
),
|
|
200
|
+
),
|
|
201
|
+
);
|
|
202
|
+
});
|
|
128
203
|
api.addAnchorResolver({
|
|
129
204
|
kind: TEXT_SEARCH_ANCHOR_KIND,
|
|
130
205
|
type: "auxiliary",
|
|
@@ -136,14 +211,14 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
136
211
|
renderCompact: (value) => value,
|
|
137
212
|
tryResolve: () => Promise.resolve({ kind: "not-handled" }),
|
|
138
213
|
},
|
|
139
|
-
resources: createDeclarationTargets(
|
|
214
|
+
resources: createDeclarationTargets(managerForFile),
|
|
140
215
|
describeInPrompt: false,
|
|
141
216
|
});
|
|
142
217
|
for (const operation of ["copy", "move", "delete", "replace"]) {
|
|
143
218
|
api
|
|
144
219
|
.tool(operation)
|
|
145
220
|
.describe(
|
|
146
|
-
"Use symbol:<file>#<selector> as path to select one exact declaration without start/end. Use parent/child for ambiguous names. Copy/
|
|
221
|
+
"Use symbol:<file>#<selector> as path to select one exact declaration without start/end. Use parent/child for ambiguous names. For declaration-text Copy/Move, supply an explicit target and destination anchor. This text fallback leaves imports and references unchanged; it is not semantic rename." +
|
|
147
222
|
(operation === "replace"
|
|
148
223
|
? " Use symbol:<file>#<selector>#name with text containing the new name for native LSP rename across references. Omit start/end. A failed server rename never falls back to identifier text replacement."
|
|
149
224
|
: ""),
|
|
@@ -152,7 +227,7 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
152
227
|
stage: "text-pre-edit",
|
|
153
228
|
async handler(state) {
|
|
154
229
|
if (operation === "replace") {
|
|
155
|
-
const renamed = await prepareSymbolRename(state,
|
|
230
|
+
const renamed = await prepareSymbolRename(state, managerForFile);
|
|
156
231
|
if (renamed !== undefined) return renamed;
|
|
157
232
|
}
|
|
158
233
|
const input = state.input as Record<string, unknown>;
|
|
@@ -218,7 +293,9 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
218
293
|
apiVersion: SEARCH_API_VERSION,
|
|
219
294
|
id: "symbols",
|
|
220
295
|
setup(api): void {
|
|
221
|
-
api.addResolver({
|
|
296
|
+
api.addResolver({
|
|
297
|
+
resolver: createLspSearchResolver(managerForFile, api.registerSelection),
|
|
298
|
+
});
|
|
222
299
|
api.describe(
|
|
223
300
|
'Use `symbols:<query>` to locate named workspace declarations and references through configured language servers when the file is unknown. Results contain exact source targets, roles, and originating symbols. Default search stays within path. Use navigation: "references" explicitly to follow symbols represented inside path to references outside it, within the workspace.',
|
|
224
301
|
);
|
|
@@ -227,9 +304,14 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
|
|
|
227
304
|
]);
|
|
228
305
|
}
|
|
229
306
|
|
|
230
|
-
async function loadRegistry(
|
|
307
|
+
async function loadRegistry(
|
|
308
|
+
cwd: string,
|
|
309
|
+
external: boolean,
|
|
310
|
+
signal?: AbortSignal,
|
|
311
|
+
): Promise<LspServerRegistry> {
|
|
231
312
|
const configDirectory = external ? cwd : (process.env.PI_AGENT_IDE_CONFIG_DIR ?? cwd);
|
|
232
313
|
return LspServerRegistry.fromPackageDir(configDirectory, {
|
|
314
|
+
signal,
|
|
233
315
|
includeGlobal: !external,
|
|
234
316
|
requireBuiltInEvidence: external,
|
|
235
317
|
recipes: LSP_RECIPES,
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lsp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"cross-spawn": "^7.0.6",
|
|
7
|
-
"pi-agent-doctor": "0.
|
|
8
|
-
"pi-agent-invariant": "0.
|
|
9
|
-
"pi-agent-read": "0.
|
|
10
|
-
"pi-agent-resource": "0.
|
|
11
|
-
"pi-agent-search": "0.
|
|
12
|
-
"pi-agent-text": "0.
|
|
13
|
-
"pi-agent-text-editor": "0.
|
|
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
14
|
"vscode-jsonrpc": "^9.0.0",
|
|
15
15
|
"vscode-uri": "^3.1.0"
|
|
16
16
|
},
|
|
17
17
|
"pi": {
|
|
18
18
|
"extensions": [
|
|
19
|
-
"./runtime/entry-
|
|
19
|
+
"./runtime/entry-38.js"
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@earendil-works/pi-coding-agent": "*",
|
|
24
|
-
"pi-agent-ide": "0.
|
|
24
|
+
"pi-agent-ide": "0.8.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependenciesMeta": {
|
|
27
27
|
"pi-agent-ide": {
|
|
@@ -20,7 +20,11 @@ import type {
|
|
|
20
20
|
ResourceResolverContext,
|
|
21
21
|
} from "pi-agent-resource";
|
|
22
22
|
|
|
23
|
-
export type LspManagerProvider = (
|
|
23
|
+
export type LspManagerProvider = (
|
|
24
|
+
cwd: string,
|
|
25
|
+
filePath?: string,
|
|
26
|
+
signal?: AbortSignal,
|
|
27
|
+
) => Promise<LspManager>;
|
|
24
28
|
|
|
25
29
|
export function createLspSymbolResolver(getManager: LspManagerProvider): ResourceResolver {
|
|
26
30
|
return createCodeViewResolver("symbol", "lsp-symbol", getManager, async (request) => {
|
|
@@ -107,7 +111,7 @@ function resolveCodeViewSource(
|
|
|
107
111
|
resource: {
|
|
108
112
|
source: canonicalSource,
|
|
109
113
|
async read(operationContext) {
|
|
110
|
-
const manager = await getManager(context.cwd);
|
|
114
|
+
const manager = await getManager(context.cwd, filePath, operationContext.signal);
|
|
111
115
|
const content = await read({
|
|
112
116
|
manager,
|
|
113
117
|
filePath,
|
|
@@ -9,7 +9,8 @@ export function createDeclarationTargets(managerFor: LspManagerProvider): TextTa
|
|
|
9
9
|
id: "lsp-declaration-target",
|
|
10
10
|
async tryResolve(value, context) {
|
|
11
11
|
const reference = parseCodeViewReference(value, "symbol");
|
|
12
|
-
|
|
12
|
+
// #name belongs to the rename pre-edit handler, not declaration-text fallback.
|
|
13
|
+
if (reference === undefined || value.endsWith("#name")) return { kind: "not-handled" };
|
|
13
14
|
if (reference.selector === undefined)
|
|
14
15
|
return {
|
|
15
16
|
kind: "rejected",
|
|
@@ -20,7 +21,11 @@ export function createDeclarationTargets(managerFor: LspManagerProvider): TextTa
|
|
|
20
21
|
};
|
|
21
22
|
try {
|
|
22
23
|
const declaration = await resolveLspDeclaration(
|
|
23
|
-
await managerFor(
|
|
24
|
+
await managerFor(
|
|
25
|
+
context.cwd,
|
|
26
|
+
resolveCodeViewPath(reference.path, context.cwd),
|
|
27
|
+
context.signal,
|
|
28
|
+
),
|
|
24
29
|
resolveCodeViewPath(reference.path, context.cwd),
|
|
25
30
|
reference.selector,
|
|
26
31
|
context.cwd,
|
|
@@ -8,10 +8,12 @@ export function createLspDiagnosticSource(
|
|
|
8
8
|
managerFor: (
|
|
9
9
|
cwd: string,
|
|
10
10
|
external?: boolean,
|
|
11
|
+
signal?: AbortSignal,
|
|
11
12
|
) => Promise<Pick<LspManager, "getOrStart" | "languageId" | "onPushDiagnostics">>,
|
|
12
13
|
resolveProject: (
|
|
13
14
|
filePath: string,
|
|
14
15
|
cwd: string,
|
|
16
|
+
signal?: AbortSignal,
|
|
15
17
|
) => Promise<{ readonly cwd: string; readonly external: boolean } | undefined> = (
|
|
16
18
|
filePath,
|
|
17
19
|
cwd,
|
|
@@ -20,16 +22,16 @@ export function createLspDiagnosticSource(
|
|
|
20
22
|
return {
|
|
21
23
|
id: "lsp",
|
|
22
24
|
async diagnose(filePath, context) {
|
|
23
|
-
const project = await resolveProject(filePath, context.cwd);
|
|
25
|
+
const project = await resolveProject(filePath, context.cwd, context.signal);
|
|
24
26
|
if (project === undefined)
|
|
25
27
|
return {
|
|
26
28
|
status: "unavailable",
|
|
27
29
|
diagnostics: [],
|
|
28
30
|
reason: "No local language-server project found for this file",
|
|
29
31
|
};
|
|
30
|
-
const manager = await managerFor(project.cwd, project.external);
|
|
32
|
+
const manager = await managerFor(project.cwd, project.external, context.signal);
|
|
31
33
|
context.signal.throwIfAborted();
|
|
32
|
-
const client = await manager.getOrStart(filePath, project.cwd, "diagnostics");
|
|
34
|
+
const client = await manager.getOrStart(filePath, project.cwd, "diagnostics", context.signal);
|
|
33
35
|
context.signal.throwIfAborted();
|
|
34
36
|
if (!client)
|
|
35
37
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DOCTOR_API_VERSION, DOCTOR_PROTOCOL } from "pi-agent-doctor/api/plugin-protocol";
|
|
2
2
|
import { URI } from "vscode-uri";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { doctorRuntimeOptions, doctorExecutableAvailable } from "pi-agent-ide/api/doctor";
|
|
5
5
|
|
|
6
6
|
import { LSP_RECIPES } from "./catalog.js";
|
|
7
7
|
import { LspClient } from "./lsp/client.js";
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
DoctorSetupInspection,
|
|
15
15
|
} from "pi-agent-doctor/api/plugin-protocol";
|
|
16
16
|
import type { ResolvedServer } from "./lsp/types.js";
|
|
17
|
+
import type { ToolRecipe } from "pi-agent-doctor/api/catalog";
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
Doctor contribution owned by the LSP plugin.
|
|
@@ -37,9 +38,7 @@ export const lspDoctorPlugin: DoctorPlugin = {
|
|
|
37
38
|
title: "LSP",
|
|
38
39
|
async run(context) {
|
|
39
40
|
try {
|
|
40
|
-
const registry = await LspServerRegistry.fromPackageDir(context.cwd,
|
|
41
|
-
environment: context.env,
|
|
42
|
-
});
|
|
41
|
+
const registry = await LspServerRegistry.fromPackageDir(context.cwd, lspOptions(context));
|
|
43
42
|
const applicable = applicableServers(registry, context.files);
|
|
44
43
|
|
|
45
44
|
if (applicable.length === 0) {
|
|
@@ -51,9 +50,17 @@ export const lspDoctorPlugin: DoctorPlugin = {
|
|
|
51
50
|
return await Promise.all(
|
|
52
51
|
applicable.map(async (server): Promise<DoctorFinding> => {
|
|
53
52
|
const label = `${server.serverId} [${server.layer}] command ${JSON.stringify(server.config.command)}`;
|
|
53
|
+
const workspace = context.workspace;
|
|
54
54
|
const client = new LspClient({
|
|
55
55
|
serverId: server.serverId,
|
|
56
|
-
rootUri: URI.file(context.cwd).toString(),
|
|
56
|
+
rootUri: workspace ? context.cwd : URI.file(context.cwd).toString(),
|
|
57
|
+
...(workspace && {
|
|
58
|
+
ownerTransport: {
|
|
59
|
+
start: (input) => workspace.start(input.command, input.env, input.signal),
|
|
60
|
+
toServerUri: (uri) => workspace.toNativeUri(uri),
|
|
61
|
+
fromServerUri: (uri) => workspace.fromNativeUri(uri),
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
57
64
|
command: server.config.command,
|
|
58
65
|
env: definedEnvironment(context.env, server.config.env),
|
|
59
66
|
...(server.config.initializationOptions && {
|
|
@@ -64,7 +71,7 @@ export const lspDoctorPlugin: DoctorPlugin = {
|
|
|
64
71
|
});
|
|
65
72
|
|
|
66
73
|
try {
|
|
67
|
-
await client.start();
|
|
74
|
+
await client.start(context.signal);
|
|
68
75
|
return {
|
|
69
76
|
status: "pass",
|
|
70
77
|
message: `${label}: initialized`,
|
|
@@ -77,11 +84,12 @@ export const lspDoctorPlugin: DoctorPlugin = {
|
|
|
77
84
|
detail: server.sourcePath,
|
|
78
85
|
};
|
|
79
86
|
} finally {
|
|
80
|
-
await client.shutdown()
|
|
87
|
+
await client.shutdown();
|
|
81
88
|
}
|
|
82
89
|
}),
|
|
83
90
|
);
|
|
84
91
|
} catch (error) {
|
|
92
|
+
context.signal?.throwIfAborted();
|
|
85
93
|
return [
|
|
86
94
|
{
|
|
87
95
|
status: "fail",
|
|
@@ -96,9 +104,7 @@ export const lspDoctorPlugin: DoctorPlugin = {
|
|
|
96
104
|
|
|
97
105
|
async function inspectLspSetup(context: DoctorContext): Promise<DoctorSetupInspection> {
|
|
98
106
|
try {
|
|
99
|
-
const registry = await LspServerRegistry.fromPackageDir(context.cwd,
|
|
100
|
-
environment: context.env,
|
|
101
|
-
});
|
|
107
|
+
const registry = await LspServerRegistry.fromPackageDir(context.cwd, lspOptions(context));
|
|
102
108
|
const selections = [];
|
|
103
109
|
const actions = new Map<string, { readonly id: string; readonly message: string }>();
|
|
104
110
|
|
|
@@ -111,7 +117,7 @@ async function inspectLspSetup(context: DoctorContext): Promise<DoctorSetupInspe
|
|
|
111
117
|
}
|
|
112
118
|
|
|
113
119
|
selections.push({ kind: "lsp" as const, languageId, toolId: selected.serverId });
|
|
114
|
-
if (!(await
|
|
120
|
+
if (!(await doctorExecutableAvailable(context, selected.config))) {
|
|
115
121
|
actions.set(selected.serverId, {
|
|
116
122
|
id: `lsp-${selected.serverId}-unavailable`,
|
|
117
123
|
message: `Configured language server ${selected.serverId} cannot run ${JSON.stringify(selected.config.command)}`,
|
|
@@ -121,6 +127,7 @@ async function inspectLspSetup(context: DoctorContext): Promise<DoctorSetupInspe
|
|
|
121
127
|
|
|
122
128
|
return { selections, actions: [...actions.values()] };
|
|
123
129
|
} catch (error) {
|
|
130
|
+
context.signal?.throwIfAborted();
|
|
124
131
|
return {
|
|
125
132
|
actions: [
|
|
126
133
|
{
|
|
@@ -132,6 +139,15 @@ async function inspectLspSetup(context: DoctorContext): Promise<DoctorSetupInspe
|
|
|
132
139
|
}
|
|
133
140
|
}
|
|
134
141
|
|
|
142
|
+
function lspOptions(context: DoctorContext) {
|
|
143
|
+
const workspace = context.workspace;
|
|
144
|
+
return {
|
|
145
|
+
...doctorRuntimeOptions(context),
|
|
146
|
+
recipeEvidence: workspace
|
|
147
|
+
? (recipes: readonly ToolRecipe[]) => workspace.evidence(recipes, context.signal)
|
|
148
|
+
: undefined,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
135
151
|
function applicableServers(
|
|
136
152
|
registry: LspServerRegistry,
|
|
137
153
|
files: readonly string[],
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Cancel one wait without cancelling work shared by other callers. */
|
|
2
|
+
export async function waitWithSignal<T>(request: Promise<T>, signal?: AbortSignal): Promise<T> {
|
|
3
|
+
if (signal?.aborted) {
|
|
4
|
+
// The request already exists; disposing its connection can still reject it later.
|
|
5
|
+
void request.catch(() => undefined);
|
|
6
|
+
throw signal.reason;
|
|
7
|
+
}
|
|
8
|
+
if (!signal) return request;
|
|
9
|
+
let onAbort: (() => void) | undefined;
|
|
10
|
+
try {
|
|
11
|
+
return await Promise.race([
|
|
12
|
+
request,
|
|
13
|
+
new Promise<never>((_resolve, reject) => {
|
|
14
|
+
onAbort = () => reject(signal.reason);
|
|
15
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
} finally {
|
|
19
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** One owned startup shared by callers. The last cancelled wait awaits physical cleanup. */
|
|
24
|
+
export class SharedStartup<T> {
|
|
25
|
+
readonly controller = new AbortController();
|
|
26
|
+
readonly promise: Promise<T>;
|
|
27
|
+
settled = false;
|
|
28
|
+
private waiters = 0;
|
|
29
|
+
|
|
30
|
+
constructor(start: (signal: AbortSignal) => Promise<T>) {
|
|
31
|
+
this.promise = start(this.controller.signal);
|
|
32
|
+
const settled = () => {
|
|
33
|
+
this.settled = true;
|
|
34
|
+
};
|
|
35
|
+
void this.promise.then(settled, settled);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async wait(signal?: AbortSignal): Promise<T> {
|
|
39
|
+
this.waiters += 1;
|
|
40
|
+
const outcome = await waitWithSignal(this.promise, signal).then(
|
|
41
|
+
(value) => ({ value }),
|
|
42
|
+
(error: unknown) => ({ error }),
|
|
43
|
+
);
|
|
44
|
+
this.waiters -= 1;
|
|
45
|
+
if (!this.settled && this.waiters === 0) {
|
|
46
|
+
this.controller.abort(signal?.reason);
|
|
47
|
+
try {
|
|
48
|
+
await this.promise;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (error !== this.controller.signal.reason) {
|
|
51
|
+
throw new AggregateError(
|
|
52
|
+
[this.controller.signal.reason, error],
|
|
53
|
+
"Startup cancellation and cleanup failed",
|
|
54
|
+
{ cause: error },
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if ("error" in outcome) throw outcome.error;
|
|
60
|
+
return outcome.value;
|
|
61
|
+
}
|
|
62
|
+
}
|