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
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { readdir, stat } from "node:fs/promises";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
|
|
4
5
|
import { URI } from "vscode-uri";
|
|
5
6
|
|
|
6
7
|
import { LspClient } from "./client.js";
|
|
8
|
+
import { SharedStartup, waitWithSignal } from "./abort.js";
|
|
9
|
+
import { documentUri } from "./document-uri.js";
|
|
10
|
+
import type { LspWorkspaceOwner } from "./workspace-owner.js";
|
|
7
11
|
import { prepareProjectQuery } from "./project.js";
|
|
8
12
|
|
|
9
13
|
import { resolveInitializationOptions } from "./initialization-options.js";
|
|
@@ -35,7 +39,7 @@ export class LspManager {
|
|
|
35
39
|
Active clients keyed by serverId.
|
|
36
40
|
*/
|
|
37
41
|
private readonly _clients = new Map<string, LspClient>();
|
|
38
|
-
private readonly _clientStarts = new Map<string,
|
|
42
|
+
private readonly _clientStarts = new Map<string, SharedStartup<LspClient>>();
|
|
39
43
|
/**
|
|
40
44
|
Track already-opened URIs to avoid duplicate didOpen in formatter.
|
|
41
45
|
*/
|
|
@@ -47,7 +51,10 @@ export class LspManager {
|
|
|
47
51
|
|
|
48
52
|
private static _instance: LspManager | null = null;
|
|
49
53
|
|
|
50
|
-
private constructor(
|
|
54
|
+
private constructor(
|
|
55
|
+
private _registry: LspServerRegistry,
|
|
56
|
+
private _owner?: LspWorkspaceOwner,
|
|
57
|
+
) {}
|
|
51
58
|
|
|
52
59
|
static getInstance(): LspManager {
|
|
53
60
|
if (!LspManager._instance) {
|
|
@@ -61,16 +68,17 @@ export class LspManager {
|
|
|
61
68
|
return LspManager._instance;
|
|
62
69
|
}
|
|
63
70
|
|
|
64
|
-
static init(registry: LspServerRegistry): LspManager {
|
|
71
|
+
static init(registry: LspServerRegistry, owner?: LspWorkspaceOwner): LspManager {
|
|
65
72
|
const current = LspManager._instance;
|
|
66
73
|
|
|
67
74
|
if (current?._disposed) {
|
|
68
75
|
current._registry = registry;
|
|
76
|
+
current._owner = owner;
|
|
69
77
|
current._disposed = false;
|
|
70
78
|
return current;
|
|
71
79
|
}
|
|
72
80
|
|
|
73
|
-
LspManager._instance = new LspManager(registry);
|
|
81
|
+
LspManager._instance = new LspManager(registry, owner);
|
|
74
82
|
return LspManager._instance;
|
|
75
83
|
}
|
|
76
84
|
|
|
@@ -83,8 +91,19 @@ export class LspManager {
|
|
|
83
91
|
LspManager._instance = null;
|
|
84
92
|
}
|
|
85
93
|
|
|
94
|
+
private requireOwner(): LspWorkspaceOwner {
|
|
95
|
+
if (!this._owner)
|
|
96
|
+
throw Object.assign(new Error("No language server workspace owner"), {
|
|
97
|
+
code: "UNSUPPORTED_SOURCE",
|
|
98
|
+
});
|
|
99
|
+
return this._owner;
|
|
100
|
+
}
|
|
86
101
|
// ── lifecycle ──────────────────────────────────────────────────────
|
|
87
102
|
|
|
103
|
+
/** Configured workspace identity used for owner-scoped navigation. */
|
|
104
|
+
get workspaceRoot(): string {
|
|
105
|
+
return this._registry.projectRoot;
|
|
106
|
+
}
|
|
88
107
|
get clientCount(): number {
|
|
89
108
|
return this._clients.size;
|
|
90
109
|
}
|
|
@@ -107,45 +126,48 @@ export class LspManager {
|
|
|
107
126
|
extension: string,
|
|
108
127
|
cwd: string,
|
|
109
128
|
capability: "diagnostics" | "symbols",
|
|
129
|
+
signal?: AbortSignal,
|
|
110
130
|
): Promise<LspClient | null> {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const resolved =
|
|
131
|
+
signal?.throwIfAborted();
|
|
132
|
+
if (this._disposed) return null;
|
|
133
|
+
const remote = cwd.startsWith("ssh://");
|
|
134
|
+
const owner = remote ? this.requireOwner() : undefined;
|
|
135
|
+
const resolved = owner
|
|
136
|
+
? await this._registry.resolveOwned(extension, (source) => owner.exists(source, signal))
|
|
137
|
+
: this._registry.resolve(extension);
|
|
138
|
+
signal?.throwIfAborted();
|
|
139
|
+
// Marker I/O can finish after shutdown has started.
|
|
140
|
+
// eslint-disable-next-line typescript/no-unnecessary-condition
|
|
141
|
+
if (this._disposed) return null;
|
|
116
142
|
const match =
|
|
117
143
|
capability === "symbols"
|
|
118
144
|
? resolved[0]
|
|
119
145
|
: resolved.find((s) => s.config.capabilities.includes(capability));
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const rootUri = URI.file(cwd).toString();
|
|
146
|
+
if (!match) return null;
|
|
147
|
+
const rootUri = remote ? cwd : URI.file(cwd).toString();
|
|
126
148
|
const clientKey = `${match.serverId}:${rootUri}`;
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (client?.ready) {
|
|
136
|
-
return client;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const clientStart = this._startClient(clientKey, rootUri, match, client);
|
|
140
|
-
this._clientStarts.set(clientKey, clientStart);
|
|
141
|
-
|
|
142
|
-
try {
|
|
143
|
-
return await clientStart;
|
|
144
|
-
} finally {
|
|
145
|
-
if (this._clientStarts.get(clientKey) === clientStart) {
|
|
146
|
-
this._clientStarts.delete(clientKey);
|
|
149
|
+
const pending = this._clientStarts.get(clientKey);
|
|
150
|
+
if (pending) {
|
|
151
|
+
if (pending.controller.signal.aborted) {
|
|
152
|
+
await waitWithSignal(
|
|
153
|
+
pending.promise.catch(() => undefined),
|
|
154
|
+
signal,
|
|
155
|
+
);
|
|
156
|
+
return this.getOrStart(extension, cwd, capability, signal);
|
|
147
157
|
}
|
|
158
|
+
return pending.wait(signal);
|
|
148
159
|
}
|
|
160
|
+
const client = this._clients.get(clientKey);
|
|
161
|
+
if (client?.ready) return client;
|
|
162
|
+
const startup = new SharedStartup((startupSignal) =>
|
|
163
|
+
this._startClient(clientKey, rootUri, match, client, startupSignal),
|
|
164
|
+
);
|
|
165
|
+
this._clientStarts.set(clientKey, startup);
|
|
166
|
+
const settled = () => {
|
|
167
|
+
if (this._clientStarts.get(clientKey) === startup) this._clientStarts.delete(clientKey);
|
|
168
|
+
};
|
|
169
|
+
void startup.promise.then(settled, settled);
|
|
170
|
+
return startup.wait(signal);
|
|
149
171
|
}
|
|
150
172
|
|
|
151
173
|
private async _startClient(
|
|
@@ -153,6 +175,7 @@ export class LspManager {
|
|
|
153
175
|
rootUri: string,
|
|
154
176
|
match: ResolvedServer,
|
|
155
177
|
client: LspClient | undefined,
|
|
178
|
+
signal: AbortSignal,
|
|
156
179
|
): Promise<LspClient> {
|
|
157
180
|
const startingClient =
|
|
158
181
|
client ??
|
|
@@ -160,11 +183,17 @@ export class LspManager {
|
|
|
160
183
|
serverId: match.serverId,
|
|
161
184
|
rootUri,
|
|
162
185
|
command: match.config.command,
|
|
186
|
+
...(rootUri.startsWith("ssh://") &&
|
|
187
|
+
this._owner && {
|
|
188
|
+
ownerTransport: this._owner.transport(rootUri),
|
|
189
|
+
}),
|
|
163
190
|
...(match.config.env && { env: match.config.env }),
|
|
164
191
|
...(match.config.initializationOptions && {
|
|
165
192
|
initOptions: resolveInitializationOptions(
|
|
166
193
|
match.config.initializationOptions,
|
|
167
|
-
|
|
194
|
+
rootUri.startsWith("ssh://")
|
|
195
|
+
? decodeURIComponent(new URL(rootUri).pathname)
|
|
196
|
+
: URI.parse(rootUri).fsPath,
|
|
168
197
|
),
|
|
169
198
|
}),
|
|
170
199
|
...(match.config.settings && { settings: match.config.settings }),
|
|
@@ -173,12 +202,25 @@ export class LspManager {
|
|
|
173
202
|
|
|
174
203
|
try {
|
|
175
204
|
if (client) {
|
|
176
|
-
await client.restart();
|
|
205
|
+
await client.restart(signal);
|
|
177
206
|
} else {
|
|
178
|
-
await startingClient.start();
|
|
207
|
+
await startingClient.start(signal);
|
|
179
208
|
}
|
|
209
|
+
signal.throwIfAborted();
|
|
180
210
|
} catch (error) {
|
|
181
|
-
|
|
211
|
+
try {
|
|
212
|
+
await startingClient.shutdown();
|
|
213
|
+
} catch (cleanupError) {
|
|
214
|
+
if (cleanupError !== error) {
|
|
215
|
+
throw new AggregateError(
|
|
216
|
+
[error, cleanupError],
|
|
217
|
+
"Language server startup and cleanup failed",
|
|
218
|
+
{
|
|
219
|
+
cause: cleanupError,
|
|
220
|
+
},
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
182
224
|
throw error;
|
|
183
225
|
}
|
|
184
226
|
|
|
@@ -192,17 +234,70 @@ export class LspManager {
|
|
|
192
234
|
return startingClient;
|
|
193
235
|
}
|
|
194
236
|
|
|
237
|
+
/** Inspect source kind through its workspace owner without reading content or starting a server. */
|
|
238
|
+
async isSourceFile(source: string, cwd: string, signal?: AbortSignal): Promise<boolean> {
|
|
239
|
+
signal?.throwIfAborted();
|
|
240
|
+
if (cwd.startsWith("ssh://")) {
|
|
241
|
+
if (this._owner === undefined) throw new Error("No language server workspace owner");
|
|
242
|
+
return this._owner.isFile(documentUri(source, cwd), signal);
|
|
243
|
+
}
|
|
244
|
+
const file = await stat(path.resolve(cwd, source));
|
|
245
|
+
signal?.throwIfAborted();
|
|
246
|
+
return file.isFile();
|
|
247
|
+
}
|
|
248
|
+
|
|
195
249
|
/** Start symbol servers only for language families with files in this workspace. */
|
|
196
250
|
async getWorkspaceClients(
|
|
197
251
|
cwd: string,
|
|
198
252
|
capability: "symbols" = "symbols",
|
|
199
253
|
scope = cwd,
|
|
254
|
+
acceptsFile: (source: string) => boolean = () => true,
|
|
255
|
+
signal?: AbortSignal,
|
|
200
256
|
): Promise<LspClient[]> {
|
|
257
|
+
signal?.throwIfAborted();
|
|
258
|
+
if (cwd.startsWith("ssh://")) {
|
|
259
|
+
const owner = this._owner;
|
|
260
|
+
if (!owner)
|
|
261
|
+
throw Object.assign(new Error("No language server workspace owner"), {
|
|
262
|
+
code: "UNSUPPORTED_SOURCE",
|
|
263
|
+
});
|
|
264
|
+
const clients = new Set<LspClient>();
|
|
265
|
+
const remaining = new Set(this._registry.knownExtensions);
|
|
266
|
+
const ignored = new Set([".git", ".cache", "node_modules", "dist", "build"]);
|
|
267
|
+
const visit = async (source: string): Promise<void> => {
|
|
268
|
+
signal?.throwIfAborted();
|
|
269
|
+
if (remaining.size === 0) return;
|
|
270
|
+
for (const entry of await owner.entries(source, signal)) {
|
|
271
|
+
signal?.throwIfAborted();
|
|
272
|
+
const uri = documentUri(entry.name, `${source}/`);
|
|
273
|
+
if (entry.kind === "directory") {
|
|
274
|
+
if (!ignored.has(entry.name)) await visit(uri);
|
|
275
|
+
} else if (entry.kind === "file") {
|
|
276
|
+
const extension = path.posix.extname(entry.name).toLowerCase();
|
|
277
|
+
if (!remaining.has(extension) || !acceptsFile(uri)) continue;
|
|
278
|
+
const opened = await this.openFile(uri, cwd, capability, signal);
|
|
279
|
+
if (opened) {
|
|
280
|
+
clients.add(opened.client);
|
|
281
|
+
remaining.delete(extension);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
const selected = documentUri(scope, cwd);
|
|
287
|
+
if (await owner.isFile(selected, signal)) {
|
|
288
|
+
if (!acceptsFile(selected)) return [];
|
|
289
|
+
const opened = await this.openFile(selected, cwd, capability, signal);
|
|
290
|
+
return opened ? [opened.client] : [];
|
|
291
|
+
}
|
|
292
|
+
await visit(selected);
|
|
293
|
+
return [...clients];
|
|
294
|
+
}
|
|
201
295
|
const clients = new Set<LspClient>();
|
|
202
296
|
const remainingExtensions = new Set(this._registry.knownExtensions);
|
|
203
297
|
const ignoredDirectories = new Set([".git", ".cache", "node_modules", "dist", "build"]);
|
|
204
298
|
|
|
205
299
|
const visit = async (directory: string): Promise<void> => {
|
|
300
|
+
signal?.throwIfAborted();
|
|
206
301
|
if (remainingExtensions.size === 0) {
|
|
207
302
|
return;
|
|
208
303
|
}
|
|
@@ -216,6 +311,7 @@ export class LspManager {
|
|
|
216
311
|
}
|
|
217
312
|
|
|
218
313
|
for (const entry of entries) {
|
|
314
|
+
signal?.throwIfAborted();
|
|
219
315
|
if (remainingExtensions.size === 0) {
|
|
220
316
|
return;
|
|
221
317
|
}
|
|
@@ -239,7 +335,8 @@ export class LspManager {
|
|
|
239
335
|
}
|
|
240
336
|
|
|
241
337
|
const filePath = path.join(directory, entry.name);
|
|
242
|
-
|
|
338
|
+
if (!acceptsFile(filePath)) continue;
|
|
339
|
+
const opened = await this.openFile(filePath, cwd, capability, signal);
|
|
243
340
|
|
|
244
341
|
if (opened) {
|
|
245
342
|
remainingExtensions.delete(extension);
|
|
@@ -253,18 +350,25 @@ export class LspManager {
|
|
|
253
350
|
|
|
254
351
|
const selected = path.resolve(cwd, scope);
|
|
255
352
|
if ((await stat(selected)).isFile()) {
|
|
256
|
-
|
|
353
|
+
if (!acceptsFile(selected)) return [];
|
|
354
|
+
const opened = await this.openFile(selected, cwd, capability, signal);
|
|
257
355
|
if (opened === null || !opened.client.hasWorkspaceSymbolCapability) return [];
|
|
258
356
|
await prepareProjectQuery(opened.client, selected);
|
|
259
357
|
return [opened.client];
|
|
260
358
|
}
|
|
261
359
|
await visit(selected);
|
|
360
|
+
signal?.throwIfAborted();
|
|
262
361
|
return [...clients];
|
|
263
362
|
}
|
|
264
363
|
|
|
265
|
-
/** Open
|
|
266
|
-
async prepareWorkspaceSymbols(
|
|
267
|
-
|
|
364
|
+
/** Open matching source files before querying workspace symbols; excluded files start no server. */
|
|
365
|
+
async prepareWorkspaceSymbols(
|
|
366
|
+
cwd: string,
|
|
367
|
+
scope = cwd,
|
|
368
|
+
acceptsFile?: (source: string) => boolean,
|
|
369
|
+
signal?: AbortSignal,
|
|
370
|
+
): Promise<LspClient[]> {
|
|
371
|
+
return this.getWorkspaceClients(cwd, "symbols", scope, acceptsFile, signal);
|
|
268
372
|
}
|
|
269
373
|
|
|
270
374
|
/**
|
|
@@ -288,6 +392,58 @@ export class LspManager {
|
|
|
288
392
|
return this._openDocs.has(uri);
|
|
289
393
|
}
|
|
290
394
|
|
|
395
|
+
/** Publish saved text only to already-open documents; never start a server or probe a file. */
|
|
396
|
+
syncEditedSource(source: string, content: string): void {
|
|
397
|
+
for (const client of this._clients.values()) {
|
|
398
|
+
if (!client.ready) continue;
|
|
399
|
+
const uri = client.toUri(source);
|
|
400
|
+
if (client.documentContent(uri) === undefined) continue;
|
|
401
|
+
const languageId = this.languageId(path.extname(decodeURIComponent(new URL(uri).pathname)));
|
|
402
|
+
client.syncDocument(uri, content, languageId, true);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
/** Capture a rename participant revision without comparing clocks across machines. */
|
|
406
|
+
async readSourceSnapshot(
|
|
407
|
+
source: string,
|
|
408
|
+
signal?: AbortSignal,
|
|
409
|
+
): Promise<{ content: string; version: string }> {
|
|
410
|
+
signal?.throwIfAborted();
|
|
411
|
+
if (source.startsWith("ssh://")) return this.requireOwner().readSnapshot(source, signal);
|
|
412
|
+
if (source.includes("://"))
|
|
413
|
+
throw Object.assign(new Error("Unsupported rename source"), { code: "UNSUPPORTED_SOURCE" });
|
|
414
|
+
const identity = (info: Awaited<ReturnType<typeof stat>>) =>
|
|
415
|
+
`${info.dev}:${info.ino}:${info.mode}:${info.size}:${info.mtimeMs}:${info.ctimeMs}`;
|
|
416
|
+
const before = identity(await stat(source));
|
|
417
|
+
const content = await this.readSourceText(source, signal);
|
|
418
|
+
if (before !== identity(await stat(source)))
|
|
419
|
+
throw new Error("A rename source changed while reading it. No edits applied.");
|
|
420
|
+
return {
|
|
421
|
+
content,
|
|
422
|
+
version: createHash("sha256").update(before).update("\0").update(content).digest("hex"),
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
/** Preserve original bytes for code-view size and binary checks. */
|
|
426
|
+
async readSourceBytes(source: string, signal?: AbortSignal): Promise<Uint8Array> {
|
|
427
|
+
signal?.throwIfAborted();
|
|
428
|
+
if (source.startsWith("ssh://")) return this.requireOwner().readBytes(source, signal);
|
|
429
|
+
if (source.includes("://"))
|
|
430
|
+
throw Object.assign(new Error("Unsupported declaration source"), {
|
|
431
|
+
code: "UNSUPPORTED_SOURCE",
|
|
432
|
+
});
|
|
433
|
+
const { readFile } = await import("node:fs/promises");
|
|
434
|
+
return readFile(source, { signal });
|
|
435
|
+
}
|
|
436
|
+
/** Read declaration text from its owner, without routing a remote URI to local fs. */
|
|
437
|
+
async readSourceText(source: string, signal?: AbortSignal): Promise<string> {
|
|
438
|
+
signal?.throwIfAborted();
|
|
439
|
+
if (source.startsWith("ssh://")) return this.requireOwner().readText(source, signal);
|
|
440
|
+
if (source.includes("://"))
|
|
441
|
+
throw Object.assign(new Error("Unsupported declaration source"), {
|
|
442
|
+
code: "UNSUPPORTED_SOURCE",
|
|
443
|
+
});
|
|
444
|
+
const { readFile } = await import("node:fs/promises");
|
|
445
|
+
return readFile(source, { encoding: "utf8", signal });
|
|
446
|
+
}
|
|
291
447
|
// ── document helpers ───────────────────────────────────────────────
|
|
292
448
|
|
|
293
449
|
/**
|
|
@@ -298,27 +454,50 @@ export class LspManager {
|
|
|
298
454
|
filePath: string,
|
|
299
455
|
cwd: string,
|
|
300
456
|
capability: "diagnostics" | "symbols" = "diagnostics",
|
|
457
|
+
signal?: AbortSignal,
|
|
301
458
|
): Promise<{ client: LspClient; uri: string; languageId: string } | null> {
|
|
302
|
-
|
|
303
|
-
|
|
459
|
+
signal?.throwIfAborted();
|
|
460
|
+
if (filePath.startsWith("ssh://") && !cwd.startsWith("ssh://")) {
|
|
461
|
+
if (!this._registry.projectRoot.startsWith("ssh://"))
|
|
462
|
+
throw Object.assign(new Error("Remote document has no workspace owner"), {
|
|
463
|
+
code: "UNSUPPORTED_SOURCE",
|
|
464
|
+
});
|
|
465
|
+
cwd = this._registry.projectRoot;
|
|
466
|
+
}
|
|
467
|
+
const remote = cwd.startsWith("ssh://");
|
|
468
|
+
const absolutePath = remote ? documentUri(filePath, cwd) : path.resolve(cwd, filePath);
|
|
469
|
+
const client = await this.getOrStart(absolutePath, cwd, capability, signal);
|
|
304
470
|
|
|
305
471
|
if (!client) {
|
|
306
472
|
return null;
|
|
307
473
|
}
|
|
308
474
|
|
|
309
475
|
const uri = client.toUri(absolutePath);
|
|
310
|
-
const
|
|
476
|
+
const owner = remote ? this.requireOwner() : undefined;
|
|
477
|
+
const resolved = owner
|
|
478
|
+
? await this._registry.resolveOwned(absolutePath, (source) => owner.exists(source, signal))
|
|
479
|
+
: this._registry.resolve(absolutePath);
|
|
311
480
|
const languageId = resolved[0]?.languageId ?? "plaintext";
|
|
312
481
|
|
|
482
|
+
if (owner) {
|
|
483
|
+
const text = await owner.readText(uri, signal);
|
|
484
|
+
signal?.throwIfAborted();
|
|
485
|
+
client.syncDocument(uri, text, languageId);
|
|
486
|
+
this._openDocs.add(uri);
|
|
487
|
+
return { client, uri, languageId };
|
|
488
|
+
}
|
|
313
489
|
// Read file content for didOpen
|
|
314
490
|
// We use a minimal open — the server gets the text from disk next request
|
|
315
491
|
try {
|
|
316
492
|
const { readFile } = await import("node:fs/promises");
|
|
317
|
-
const text = await readFile(absolutePath, "utf8");
|
|
318
|
-
|
|
493
|
+
const text = await readFile(absolutePath, { encoding: "utf8", signal });
|
|
494
|
+
signal?.throwIfAborted();
|
|
495
|
+
client.syncDocument(uri, text, languageId);
|
|
319
496
|
this._openDocs.add(uri);
|
|
320
|
-
} catch {
|
|
321
|
-
|
|
497
|
+
} catch (error) {
|
|
498
|
+
signal?.throwIfAborted();
|
|
499
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
|
|
500
|
+
// Files created later will be synchronized by the next change.
|
|
322
501
|
}
|
|
323
502
|
|
|
324
503
|
return { client, uri, languageId };
|
|
@@ -356,7 +535,9 @@ export class LspManager {
|
|
|
356
535
|
|
|
357
536
|
this._pushFingerprints.set(key, fingerprint);
|
|
358
537
|
const event: LspPushDiagnosticsEvent = {
|
|
359
|
-
cwd:
|
|
538
|
+
cwd: client.rootUri.startsWith("ssh://")
|
|
539
|
+
? client.rootUri
|
|
540
|
+
: URI.parse(client.rootUri).fsPath,
|
|
360
541
|
serverId: client.serverId,
|
|
361
542
|
uri: notification.uri,
|
|
362
543
|
diagnostics,
|
|
@@ -373,10 +554,22 @@ export class LspManager {
|
|
|
373
554
|
|
|
374
555
|
async shutdownAll(): Promise<void> {
|
|
375
556
|
this._disposed = true;
|
|
376
|
-
|
|
557
|
+
const pending = [...this._clientStarts.values()];
|
|
558
|
+
for (const startup of pending)
|
|
559
|
+
startup.controller.abort(new Error("Language server manager stopped"));
|
|
560
|
+
const starts = await Promise.allSettled(pending.map((startup) => startup.promise));
|
|
561
|
+
const failures: unknown[] = [];
|
|
562
|
+
for (const [index, result] of starts.entries()) {
|
|
563
|
+
if (
|
|
564
|
+
result.status === "rejected" &&
|
|
565
|
+
result.reason !== pending[index]?.controller.signal.reason
|
|
566
|
+
) {
|
|
567
|
+
failures.push(result.reason);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
377
570
|
|
|
378
571
|
const clients = [...this._clients.values()];
|
|
379
|
-
await Promise.
|
|
572
|
+
const results = await Promise.allSettled(clients.map((client) => client.shutdown()));
|
|
380
573
|
|
|
381
574
|
for (const unsubscribe of this._pushUnsubscribers.values()) {
|
|
382
575
|
unsubscribe();
|
|
@@ -387,10 +580,16 @@ export class LspManager {
|
|
|
387
580
|
this._pushFingerprints.clear();
|
|
388
581
|
this._pushHandlers.clear();
|
|
389
582
|
this._clients.clear();
|
|
583
|
+
|
|
584
|
+
for (const result of results) {
|
|
585
|
+
if (result.status === "rejected") failures.push(result.reason);
|
|
586
|
+
}
|
|
587
|
+
if (failures.length > 0) throw new AggregateError(failures, "Language server cleanup failed");
|
|
390
588
|
}
|
|
391
589
|
|
|
392
|
-
|
|
393
|
-
|
|
590
|
+
/** Await all workspace cleanup and report failed owned stops. */
|
|
591
|
+
dispose(): Promise<void> {
|
|
592
|
+
return this.shutdownAll();
|
|
394
593
|
}
|
|
395
594
|
}
|
|
396
595
|
|
|
@@ -31,16 +31,46 @@ export interface LspCallHierarchyResult {
|
|
|
31
31
|
outgoing: LspOutgoingCall[];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** Load unopened TypeScript project files before a workspace-wide query when the server advertises support. */
|
|
35
|
+
export async function loadQueryProject(
|
|
36
|
+
client: LspClient,
|
|
37
|
+
uri: string,
|
|
38
|
+
signal?: AbortSignal,
|
|
39
|
+
): Promise<void> {
|
|
40
|
+
signal?.throwIfAborted();
|
|
41
|
+
if (!client.supportsCommand("typescript.tsserverRequest")) return;
|
|
42
|
+
const project = await client.sendRequest<{ success?: boolean } | null>(
|
|
43
|
+
"workspace/executeCommand",
|
|
44
|
+
{
|
|
45
|
+
command: "typescript.tsserverRequest",
|
|
46
|
+
arguments: [
|
|
47
|
+
"projectInfo",
|
|
48
|
+
{ file: client.serverDocumentPath(uri), needFileNameList: true },
|
|
49
|
+
{ isAsync: false, expectsResult: true },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
signal,
|
|
53
|
+
);
|
|
54
|
+
signal?.throwIfAborted();
|
|
55
|
+
if (project?.success !== true)
|
|
56
|
+
throw new Error("TypeScript could not load the project for the workspace query.");
|
|
57
|
+
}
|
|
34
58
|
export async function requestReferences(
|
|
35
59
|
client: LspClient,
|
|
36
60
|
uri: string,
|
|
37
61
|
position: LspPosition,
|
|
62
|
+
signal?: AbortSignal,
|
|
38
63
|
): Promise<LspLocation[]> {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
64
|
+
await loadQueryProject(client, uri, signal);
|
|
65
|
+
const result = await client.sendRequest<LspLocation[] | null>(
|
|
66
|
+
"textDocument/references",
|
|
67
|
+
{
|
|
68
|
+
textDocument: { uri },
|
|
69
|
+
position,
|
|
70
|
+
context: { includeDeclaration: true },
|
|
71
|
+
},
|
|
72
|
+
signal,
|
|
73
|
+
);
|
|
44
74
|
return result ?? [];
|
|
45
75
|
}
|
|
46
76
|
|
|
@@ -48,6 +78,7 @@ export async function requestCallHierarchy(
|
|
|
48
78
|
client: LspClient,
|
|
49
79
|
uri: string,
|
|
50
80
|
position: LspPosition,
|
|
81
|
+
signal?: AbortSignal,
|
|
51
82
|
): Promise<LspCallHierarchyResult> {
|
|
52
83
|
const items = await client.sendRequest<LspCallHierarchyItem[] | null>(
|
|
53
84
|
"textDocument/prepareCallHierarchy",
|
|
@@ -55,6 +86,7 @@ export async function requestCallHierarchy(
|
|
|
55
86
|
textDocument: { uri },
|
|
56
87
|
position,
|
|
57
88
|
},
|
|
89
|
+
signal,
|
|
58
90
|
);
|
|
59
91
|
|
|
60
92
|
const firstItem = items?.[0];
|
|
@@ -64,12 +96,20 @@ export async function requestCallHierarchy(
|
|
|
64
96
|
}
|
|
65
97
|
|
|
66
98
|
const [incoming, outgoing] = await Promise.all([
|
|
67
|
-
client
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
99
|
+
client.sendRequest<LspIncomingCall[] | null>(
|
|
100
|
+
"callHierarchy/incomingCalls",
|
|
101
|
+
{
|
|
102
|
+
item: firstItem,
|
|
103
|
+
},
|
|
104
|
+
signal,
|
|
105
|
+
),
|
|
106
|
+
client.sendRequest<LspOutgoingCall[] | null>(
|
|
107
|
+
"callHierarchy/outgoingCalls",
|
|
108
|
+
{
|
|
109
|
+
item: firstItem,
|
|
110
|
+
},
|
|
111
|
+
signal,
|
|
112
|
+
),
|
|
73
113
|
]);
|
|
74
114
|
|
|
75
115
|
return {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Readable, Writable } from "node:stream";
|
|
2
|
+
import type { LspFileWatcherSubscriptions, WatchedFileChange } from "./file-watchers.js";
|
|
3
|
+
|
|
4
|
+
/** A language server process on one owner; its PID is never a local process identifier. */
|
|
5
|
+
export interface LspOwnedProcess {
|
|
6
|
+
readonly stdin: Writable;
|
|
7
|
+
readonly stdout: Readable;
|
|
8
|
+
readonly stderr: Readable;
|
|
9
|
+
readonly completion: Promise<{ readonly exitCode: number | null }>;
|
|
10
|
+
readonly remote: { readonly target: string; readonly pid: number };
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Owner-supplied stdio and URI mapping. Creation is lazy and must not fall back locally. */
|
|
15
|
+
export interface LspOwnerTransport {
|
|
16
|
+
start(input: {
|
|
17
|
+
readonly rootUri: string;
|
|
18
|
+
readonly command: readonly string[];
|
|
19
|
+
readonly env: Readonly<Record<string, string>>;
|
|
20
|
+
/** Cancels startup before ownership is transferred to the ready client. */
|
|
21
|
+
readonly signal?: AbortSignal;
|
|
22
|
+
}): Promise<LspOwnedProcess>;
|
|
23
|
+
toServerUri(uri: string): string;
|
|
24
|
+
fromServerUri(uri: string): string;
|
|
25
|
+
/** Create lazy native subscriptions on this owner, never on the controller filesystem. */
|
|
26
|
+
fileWatchers?(
|
|
27
|
+
rootUri: string,
|
|
28
|
+
changed: (change: WatchedFileChange) => void,
|
|
29
|
+
failed: (error: Error) => void,
|
|
30
|
+
): LspFileWatcherSubscriptions;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const uriFields = new Set([
|
|
34
|
+
"uri",
|
|
35
|
+
"targetUri",
|
|
36
|
+
"target",
|
|
37
|
+
"oldUri",
|
|
38
|
+
"newUri",
|
|
39
|
+
"rootUri",
|
|
40
|
+
"documentUri",
|
|
41
|
+
"scopeUri",
|
|
42
|
+
"baseUri",
|
|
43
|
+
]);
|
|
44
|
+
const uriMaps = new Set(["changes", "relatedDocuments"]);
|
|
45
|
+
|
|
46
|
+
/** Map protocol URI fields and URI-keyed edit/diagnostic maps, never source text or labels. */
|
|
47
|
+
export function mapLspUris(value: unknown, mapUri: (uri: string) => string): unknown {
|
|
48
|
+
if (Array.isArray(value)) return value.map((item) => mapLspUris(item, mapUri));
|
|
49
|
+
if (typeof value !== "object" || value === null) return value;
|
|
50
|
+
return Object.fromEntries(
|
|
51
|
+
Object.entries(value).map(([key, item]) => {
|
|
52
|
+
if (uriFields.has(key) && typeof item === "string") return [key, mapUri(item)];
|
|
53
|
+
if (uriMaps.has(key) && typeof item === "object" && item !== null && !Array.isArray(item)) {
|
|
54
|
+
return [
|
|
55
|
+
key,
|
|
56
|
+
Object.fromEntries(
|
|
57
|
+
Object.entries(item as Record<string, unknown>).map(([uri, edits]) => [
|
|
58
|
+
mapUri(uri),
|
|
59
|
+
mapLspUris(edits, mapUri),
|
|
60
|
+
]),
|
|
61
|
+
),
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
return [key, mapLspUris(item, mapUri)];
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
}
|