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
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type NativeEditBatchEvent,
|
|
11
11
|
} from "#src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.js";
|
|
12
12
|
import { compactMutationDetails } from "#src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.js";
|
|
13
|
+
import type { FileMutationBatchResult } from "pi-agent-text-editor/api/mutation-result";
|
|
13
14
|
|
|
14
15
|
const ENTRY_TYPE = "ide-nested-results";
|
|
15
16
|
const MAX_CALLS = 256;
|
|
@@ -22,6 +23,9 @@ interface ChildPanel {
|
|
|
22
23
|
name: string;
|
|
23
24
|
args: unknown;
|
|
24
25
|
renderArgs?: unknown;
|
|
26
|
+
argumentsTruncated?: boolean;
|
|
27
|
+
resultOmitted?: boolean;
|
|
28
|
+
// Older sessions only recorded whether a result display was omitted.
|
|
25
29
|
omitted?: boolean;
|
|
26
30
|
batched?: boolean;
|
|
27
31
|
rollback?: boolean;
|
|
@@ -37,7 +41,42 @@ interface PanelGroup {
|
|
|
37
41
|
parentToolCallId: string;
|
|
38
42
|
cwd: string;
|
|
39
43
|
calls: ChildPanel[];
|
|
40
|
-
|
|
44
|
+
retention: RetentionReasons;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface RetentionReasons {
|
|
48
|
+
argumentsTruncated: boolean;
|
|
49
|
+
resultsOmitted: boolean;
|
|
50
|
+
callsOmitted: boolean;
|
|
51
|
+
resultsUnavailable: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const retained = (): RetentionReasons => ({
|
|
55
|
+
argumentsTruncated: false,
|
|
56
|
+
resultsOmitted: false,
|
|
57
|
+
callsOmitted: false,
|
|
58
|
+
resultsUnavailable: false,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
interface SavedPanelGroup extends Omit<PanelGroup, "retention"> {
|
|
62
|
+
retention?: RetentionReasons;
|
|
63
|
+
// Older history did not record why it was incomplete.
|
|
64
|
+
complete?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function retentionWarning(group: SavedPanelGroup): string | undefined {
|
|
68
|
+
const reasons = group.retention;
|
|
69
|
+
const omissions = [
|
|
70
|
+
reasons?.argumentsTruncated && "arguments shortened",
|
|
71
|
+
reasons?.resultsOmitted && "result displays omitted",
|
|
72
|
+
reasons?.callsOmitted && "call panels omitted",
|
|
73
|
+
reasons?.resultsUnavailable && "results unavailable",
|
|
74
|
+
].filter(Boolean);
|
|
75
|
+
if (omissions.length > 0)
|
|
76
|
+
return `Nested IDE display: ${omissions.join("; ")}. Tool execution and parent output are unchanged.`;
|
|
77
|
+
if (!reasons && group.complete === false)
|
|
78
|
+
return "Nested IDE display is incomplete; omission details are unavailable.";
|
|
79
|
+
return undefined;
|
|
41
80
|
}
|
|
42
81
|
|
|
43
82
|
/** Keep bounded display data for nested IDE tools, separate from model context and usage. */
|
|
@@ -54,6 +93,7 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
54
93
|
) => {
|
|
55
94
|
// Bound in-memory display data as each call finishes, not only at persistence.
|
|
56
95
|
call.result = result;
|
|
96
|
+
call.resultOmitted = false;
|
|
57
97
|
try {
|
|
58
98
|
const serialized = JSON.stringify(group);
|
|
59
99
|
if (Buffer.byteLength(serialized) <= MAX_BYTES) {
|
|
@@ -85,8 +125,7 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
85
125
|
details: undefined,
|
|
86
126
|
isError: result.isError,
|
|
87
127
|
};
|
|
88
|
-
call.
|
|
89
|
-
group.complete = false;
|
|
128
|
+
call.resultOmitted = true;
|
|
90
129
|
};
|
|
91
130
|
const clear = () => {
|
|
92
131
|
parents.clear();
|
|
@@ -113,17 +152,19 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
113
152
|
if (!definitions.has(event.toolName)) return;
|
|
114
153
|
let group = groups.get(root);
|
|
115
154
|
if (!group) {
|
|
116
|
-
group = { parentToolCallId: root, cwd: context.cwd, calls: [],
|
|
155
|
+
group = { parentToolCallId: root, cwd: context.cwd, calls: [], retention: retained() };
|
|
117
156
|
groups.set(root, group);
|
|
118
157
|
}
|
|
119
158
|
if (group.calls.length >= MAX_CALLS) {
|
|
120
|
-
group.
|
|
159
|
+
group.retention.callsOmitted = true;
|
|
121
160
|
return;
|
|
122
161
|
}
|
|
123
162
|
const json = JSON.stringify(event.args);
|
|
124
163
|
const remaining =
|
|
125
164
|
MAX_ARGUMENT_TOTAL_BYTES -
|
|
126
|
-
group.calls.reduce((bytes, call) => bytes + Buffer.byteLength(JSON.stringify(call.args)), 0)
|
|
165
|
+
group.calls.reduce((bytes, call) => bytes + Buffer.byteLength(JSON.stringify(call.args)), 0) -
|
|
166
|
+
// Reserve an empty object for every remaining call, even after argument space runs out.
|
|
167
|
+
(MAX_CALLS - group.calls.length - 1) * 2;
|
|
127
168
|
const omitted = Buffer.byteLength(json) > Math.min(MAX_ARGUMENT_BYTES, remaining);
|
|
128
169
|
const args = omitted
|
|
129
170
|
? Object.fromEntries(
|
|
@@ -135,9 +176,16 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
135
176
|
]),
|
|
136
177
|
)
|
|
137
178
|
: (JSON.parse(json) as unknown);
|
|
138
|
-
const boundedArgs =
|
|
139
|
-
|
|
140
|
-
|
|
179
|
+
const boundedArgs =
|
|
180
|
+
Buffer.byteLength(JSON.stringify(args)) <= Math.min(MAX_ARGUMENT_BYTES, remaining)
|
|
181
|
+
? args
|
|
182
|
+
: {};
|
|
183
|
+
group.calls.push({
|
|
184
|
+
id: event.toolCallId,
|
|
185
|
+
name: event.toolName,
|
|
186
|
+
args: boundedArgs,
|
|
187
|
+
argumentsTruncated: omitted,
|
|
188
|
+
});
|
|
141
189
|
});
|
|
142
190
|
pi.on("tool_execution_end", (event) => {
|
|
143
191
|
const root = parents.get(event.toolCallId);
|
|
@@ -164,77 +212,79 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
164
212
|
groups.delete(event.message.toolCallId);
|
|
165
213
|
for (const [child, root] of parents) if (root === group.parentToolCallId) parents.delete(child);
|
|
166
214
|
// Serializing once strips runtime classes and prevents later hooks from mutating history.
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
215
|
+
const calls = group.calls.filter((call) => !call.batched);
|
|
216
|
+
const saved: PanelGroup = {
|
|
217
|
+
...group,
|
|
218
|
+
calls: [],
|
|
219
|
+
retention: {
|
|
220
|
+
...group.retention,
|
|
221
|
+
argumentsTruncated: calls.some((call) => call.argumentsTruncated === true),
|
|
222
|
+
resultsOmitted: calls.some((call) => call.resultOmitted === true),
|
|
223
|
+
resultsUnavailable: calls.some((call) => !call.result),
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
// Include group metadata and separators, not just call payloads, in the history budget.
|
|
227
|
+
let bytes = Buffer.byteLength(JSON.stringify(saved));
|
|
228
|
+
for (const call of calls) {
|
|
171
229
|
const json = JSON.stringify(call);
|
|
172
|
-
bytes += Buffer.byteLength(json);
|
|
230
|
+
bytes += Buffer.byteLength(json) + (saved.calls.length > 0 ? 1 : 0);
|
|
173
231
|
if (bytes > MAX_BYTES) {
|
|
174
|
-
saved.
|
|
232
|
+
saved.retention.callsOmitted = true;
|
|
175
233
|
break;
|
|
176
234
|
}
|
|
177
235
|
saved.calls.push(JSON.parse(json) as ChildPanel);
|
|
178
|
-
if (!call.result) saved.complete = false;
|
|
179
236
|
}
|
|
180
237
|
pi.appendEntry(ENTRY_TYPE, saved);
|
|
181
238
|
});
|
|
182
|
-
pi.registerEntryRenderer<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
239
|
+
pi.registerEntryRenderer<SavedPanelGroup>(
|
|
240
|
+
ENTRY_TYPE,
|
|
241
|
+
function renderEntry(entry, options, theme) {
|
|
242
|
+
if (!Array.isArray(entry.data?.calls)) return undefined;
|
|
243
|
+
// Pi rebuilds resumed history before session_start binds the public UI.
|
|
244
|
+
// Keep the entry mounted and resolve its tool components on the next render.
|
|
245
|
+
if (!tui)
|
|
246
|
+
return {
|
|
247
|
+
render: (width: number): string[] =>
|
|
248
|
+
tui ? (renderEntry(entry, options, theme)?.render(width) ?? []) : [],
|
|
249
|
+
invalidate: () => {
|
|
250
|
+
if (entry.data) components.get(entry.data)?.invalidate();
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
const warningText = retentionWarning(entry.data);
|
|
254
|
+
let panel = components.get(entry.data);
|
|
255
|
+
if (!panel) {
|
|
256
|
+
panel = new Container();
|
|
257
|
+
for (const call of entry.data.calls) {
|
|
258
|
+
const component = new ToolExecutionComponent(
|
|
259
|
+
call.name,
|
|
260
|
+
call.id,
|
|
261
|
+
call.renderArgs ?? call.args,
|
|
262
|
+
{ showImages: true },
|
|
263
|
+
call.resultOmitted || call.omitted || !call.result
|
|
264
|
+
? undefined
|
|
265
|
+
: definitions.get(call.name),
|
|
266
|
+
tui,
|
|
267
|
+
entry.data.cwd,
|
|
268
|
+
);
|
|
269
|
+
if (call.result) component.updateResult(call.result);
|
|
270
|
+
else
|
|
271
|
+
component.updateResult({
|
|
272
|
+
content: [{ type: "text", text: "Result unavailable in this saved display." }],
|
|
273
|
+
isError: true,
|
|
274
|
+
});
|
|
275
|
+
panel.addChild(new Spacer(1));
|
|
276
|
+
panel.addChild(component);
|
|
277
|
+
}
|
|
278
|
+
if (warningText) panel.addChild(new Text(theme.fg("warning", warningText), 0, 0));
|
|
279
|
+
components.set(entry.data, panel);
|
|
215
280
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
0,
|
|
224
|
-
0,
|
|
225
|
-
),
|
|
226
|
-
);
|
|
227
|
-
components.set(entry.data, panel);
|
|
228
|
-
}
|
|
229
|
-
const warning = panel.children.at(-1);
|
|
230
|
-
if (!entry.data.complete && warning instanceof Text)
|
|
231
|
-
warning.setText(
|
|
232
|
-
theme.fg("warning", "Incomplete nested IDE presentation; some results were not retained."),
|
|
233
|
-
);
|
|
234
|
-
for (const child of panel.children)
|
|
235
|
-
if (child instanceof ToolExecutionComponent) child.setExpanded(options.expanded);
|
|
236
|
-
return panel;
|
|
237
|
-
});
|
|
281
|
+
const warning = panel.children.at(-1);
|
|
282
|
+
if (warningText && warning instanceof Text) warning.setText(theme.fg("warning", warningText));
|
|
283
|
+
for (const child of panel.children)
|
|
284
|
+
if (child instanceof ToolExecutionComponent) child.setExpanded(options.expanded);
|
|
285
|
+
return panel;
|
|
286
|
+
},
|
|
287
|
+
);
|
|
238
288
|
const finalize = () => {
|
|
239
289
|
pi.events.on(NATIVE_EDIT_BATCH_EVENT, (value) => {
|
|
240
290
|
const batch = value as NativeEditBatchEvent;
|
|
@@ -302,9 +352,17 @@ export function createNestedIdeRendering(pi: ExtensionAPI) {
|
|
|
302
352
|
call.renderArgs = {};
|
|
303
353
|
call.rollback =
|
|
304
354
|
details.results?.some((result) => result.data.rollback !== undefined) === true;
|
|
355
|
+
const targetUnavailable = (call.result?.details as FileMutationBatchResult | undefined)
|
|
356
|
+
?.metadata?.targetUnavailable;
|
|
305
357
|
retainResult(group, call, {
|
|
306
358
|
content: batch.result.content,
|
|
307
|
-
details
|
|
359
|
+
details:
|
|
360
|
+
typeof targetUnavailable === "string"
|
|
361
|
+
? {
|
|
362
|
+
...details,
|
|
363
|
+
metadata: { ...details.metadata, targetUnavailable },
|
|
364
|
+
}
|
|
365
|
+
: details,
|
|
308
366
|
isError: batch.result.isError === true || call.rollback,
|
|
309
367
|
});
|
|
310
368
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { resolveCodeViewPath } from "#src/code-view/reference.js";
|
|
3
4
|
|
|
4
5
|
import type {
|
|
5
6
|
IdeDiagnosticReport,
|
|
@@ -7,6 +8,7 @@ import type {
|
|
|
7
8
|
IdeDiagnosticResult,
|
|
8
9
|
IdeDiagnosticSnapshot,
|
|
9
10
|
IdeDiagnosticSource,
|
|
11
|
+
IdeDiagnosticFileReader,
|
|
10
12
|
} from "#src/api/plugin-protocol.js";
|
|
11
13
|
import type { ToolContext } from "#src/toolchain/types.js";
|
|
12
14
|
|
|
@@ -49,6 +51,7 @@ export class DiagnosticStore {
|
|
|
49
51
|
readWaitMs?: number;
|
|
50
52
|
checkTimeoutMs?: number;
|
|
51
53
|
concurrency?: number;
|
|
54
|
+
readers?: readonly IdeDiagnosticFileReader[];
|
|
52
55
|
} = {},
|
|
53
56
|
) {}
|
|
54
57
|
|
|
@@ -64,8 +67,8 @@ export class DiagnosticStore {
|
|
|
64
67
|
): Promise<IdeDiagnosticSnapshot> {
|
|
65
68
|
signal?.throwIfAborted();
|
|
66
69
|
this.assertActive();
|
|
67
|
-
const absolute =
|
|
68
|
-
const content = await
|
|
70
|
+
const absolute = resolveCodeViewPath(filePath, cwd);
|
|
71
|
+
const content = await this.readText(absolute, cwd, signal);
|
|
69
72
|
this.assertActive();
|
|
70
73
|
const state = this.ensure(absolute, content, cwd);
|
|
71
74
|
if (mode === "complete") await this.waitComplete(state, signal);
|
|
@@ -73,7 +76,7 @@ export class DiagnosticStore {
|
|
|
73
76
|
await waitAtMost(Promise.all(state.jobs), this.options.readWaitMs ?? 5000);
|
|
74
77
|
signal?.throwIfAborted();
|
|
75
78
|
this.assertActive();
|
|
76
|
-
const currentText = await
|
|
79
|
+
const currentText = await this.readText(absolute, cwd, signal);
|
|
77
80
|
this.assertActive();
|
|
78
81
|
const current = this.ensure(absolute, currentText, cwd);
|
|
79
82
|
if (mode === "complete" && current !== state)
|
|
@@ -121,7 +124,7 @@ export class DiagnosticStore {
|
|
|
121
124
|
async takeNotifications(cwd: string): Promise<DiagnosticNotification[]> {
|
|
122
125
|
const notifications: DiagnosticNotification[] = [];
|
|
123
126
|
for (const state of [...this.dirty]) {
|
|
124
|
-
if (state.cwd !== path.resolve(cwd)) continue;
|
|
127
|
+
if (state.cwd !== (cwd.includes("://") ? cwd : path.resolve(cwd))) continue;
|
|
125
128
|
this.dirty.delete(state);
|
|
126
129
|
if (!(await this.isCurrent(state))) continue;
|
|
127
130
|
const results = [...state.results.values()].filter(
|
|
@@ -146,10 +149,13 @@ export class DiagnosticStore {
|
|
|
146
149
|
return `${result.source} ${counts.join(", ")}${result.status === "snapshot" ? " (snapshot; completion unknown)" : result.status === "unversioned" ? " (unversioned)" : ""}`;
|
|
147
150
|
})
|
|
148
151
|
.join("; ");
|
|
152
|
+
const source = state.filePath.includes("://")
|
|
153
|
+
? state.filePath
|
|
154
|
+
: path.relative(cwd, state.filePath);
|
|
149
155
|
notifications.push({
|
|
150
|
-
filePath:
|
|
156
|
+
filePath: source,
|
|
151
157
|
results,
|
|
152
|
-
text: `${JSON.stringify(
|
|
158
|
+
text: `${JSON.stringify(source)}: ${summary}.`,
|
|
153
159
|
});
|
|
154
160
|
}
|
|
155
161
|
return notifications;
|
|
@@ -167,8 +173,22 @@ export class DiagnosticStore {
|
|
|
167
173
|
this.pump();
|
|
168
174
|
}
|
|
169
175
|
|
|
176
|
+
private async readText(source: string, cwd: string, signal?: AbortSignal): Promise<string> {
|
|
177
|
+
for (const reader of this.options.readers ?? []) {
|
|
178
|
+
const content = await reader.readText(source, { cwd, signal });
|
|
179
|
+
if (content !== undefined) return content;
|
|
180
|
+
}
|
|
181
|
+
if (source.includes("://"))
|
|
182
|
+
throw Object.assign(new Error("No diagnostic reader for resource owner"), {
|
|
183
|
+
code: "UNSUPPORTED_SOURCE",
|
|
184
|
+
});
|
|
185
|
+
return readFile(source, { encoding: "utf8", signal });
|
|
186
|
+
}
|
|
170
187
|
private key(filePath: string, cwd: string): string {
|
|
171
|
-
return JSON.stringify([
|
|
188
|
+
return JSON.stringify([
|
|
189
|
+
cwd.includes("://") ? cwd : path.resolve(cwd),
|
|
190
|
+
resolveCodeViewPath(filePath, cwd),
|
|
191
|
+
]);
|
|
172
192
|
}
|
|
173
193
|
|
|
174
194
|
private ensure(filePath: string, content: string, cwd: string): FileState {
|
|
@@ -178,8 +198,8 @@ export class DiagnosticStore {
|
|
|
178
198
|
previous?.controller.abort();
|
|
179
199
|
if (previous) this.dirty.delete(previous);
|
|
180
200
|
const state: FileState = {
|
|
181
|
-
cwd: path.resolve(cwd),
|
|
182
|
-
filePath:
|
|
201
|
+
cwd: cwd.includes("://") ? cwd : path.resolve(cwd),
|
|
202
|
+
filePath: resolveCodeViewPath(filePath, cwd),
|
|
183
203
|
content,
|
|
184
204
|
controller: new AbortController(),
|
|
185
205
|
results: new Map(),
|
|
@@ -236,7 +256,9 @@ export class DiagnosticStore {
|
|
|
236
256
|
|
|
237
257
|
private async isCurrent(state: FileState): Promise<boolean> {
|
|
238
258
|
if (!this.active(state)) return false;
|
|
239
|
-
const content = await
|
|
259
|
+
const content = await this.readText(state.filePath, state.cwd, state.controller.signal).catch(
|
|
260
|
+
() => undefined,
|
|
261
|
+
);
|
|
240
262
|
return this.active(state) && content === state.content;
|
|
241
263
|
}
|
|
242
264
|
|
package/src/core/ide-core.ts
CHANGED
|
@@ -2,7 +2,12 @@ import { registerTools } from "#src/toolchain/registry.js";
|
|
|
2
2
|
|
|
3
3
|
import { DiagnosticStore } from "#src/core/diagnostic-store.js";
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
IdeDiagnosticSource,
|
|
7
|
+
IdeDiagnosticFileReader,
|
|
8
|
+
IdePlugin,
|
|
9
|
+
IdePluginApi,
|
|
10
|
+
} from "#src/api/plugin-protocol.js";
|
|
6
11
|
import type { IdeTool } from "#src/toolchain/types.js";
|
|
7
12
|
|
|
8
13
|
export interface IdeCore {
|
|
@@ -15,7 +20,8 @@ export function createIdeCore(): IdeCore {
|
|
|
15
20
|
const plugins = new Map<string, Promise<void>>();
|
|
16
21
|
const diagnosticSources: IdeDiagnosticSource[] = [];
|
|
17
22
|
|
|
18
|
-
const
|
|
23
|
+
const diagnosticReaders: IdeDiagnosticFileReader[] = [];
|
|
24
|
+
const diagnostics = new DiagnosticStore(diagnosticSources, { readers: diagnosticReaders });
|
|
19
25
|
let queue = Promise.resolve();
|
|
20
26
|
|
|
21
27
|
return {
|
|
@@ -34,6 +40,7 @@ export function createIdeCore(): IdeCore {
|
|
|
34
40
|
const ready = queue.then(async () => {
|
|
35
41
|
const tools: IdeTool[] = [];
|
|
36
42
|
const incomingDiagnosticSources: IdeDiagnosticSource[] = [];
|
|
43
|
+
const incomingReaders: IdeDiagnosticFileReader[] = [];
|
|
37
44
|
let isOpen = true;
|
|
38
45
|
const api: IdePluginApi = {
|
|
39
46
|
addTool(tool): void {
|
|
@@ -52,6 +59,12 @@ export function createIdeCore(): IdeCore {
|
|
|
52
59
|
assertDiagnosticSource(source);
|
|
53
60
|
incomingDiagnosticSources.push(source);
|
|
54
61
|
},
|
|
62
|
+
addDiagnosticFileReader(reader): void {
|
|
63
|
+
if (!isOpen) throw new Error(`Plugin ${plugin.id} setup is already complete`);
|
|
64
|
+
if (!reader.id.trim() || typeof reader.readText !== "function")
|
|
65
|
+
throw new TypeError("Invalid diagnostic file reader");
|
|
66
|
+
incomingReaders.push(reader);
|
|
67
|
+
},
|
|
55
68
|
readDiagnostics(filePath, context) {
|
|
56
69
|
return diagnostics.read(filePath, context);
|
|
57
70
|
},
|
|
@@ -66,8 +79,15 @@ export function createIdeCore(): IdeCore {
|
|
|
66
79
|
|
|
67
80
|
isOpen = false;
|
|
68
81
|
assertUniqueDiagnosticSources(diagnosticSources, incomingDiagnosticSources);
|
|
82
|
+
const readerIds = new Set(diagnosticReaders.map((reader) => reader.id));
|
|
83
|
+
for (const reader of incomingReaders) {
|
|
84
|
+
if (readerIds.has(reader.id))
|
|
85
|
+
throw new Error(`Diagnostic file reader ${reader.id} is already registered`);
|
|
86
|
+
readerIds.add(reader.id);
|
|
87
|
+
}
|
|
69
88
|
registerTools(tools);
|
|
70
89
|
diagnosticSources.push(...incomingDiagnosticSources);
|
|
90
|
+
diagnosticReaders.push(...incomingReaders);
|
|
71
91
|
});
|
|
72
92
|
plugins.set(plugin.id, ready);
|
|
73
93
|
queue = ready.catch(() => {});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Keep the existing flags and accept one explicit SSH project; no source keeps local cwd. */
|
|
2
|
+
export function parseDoctorArguments(
|
|
3
|
+
arguments_: string,
|
|
4
|
+
cwd: string,
|
|
5
|
+
): { cwd: string; flags: ReadonlySet<string> } {
|
|
6
|
+
const flags = new Set<string>();
|
|
7
|
+
let source: string | undefined;
|
|
8
|
+
for (const token of arguments_.trim().split(/\s+/u).filter(Boolean)) {
|
|
9
|
+
if (["--apply", "--no-apply", "--agent"].includes(token)) flags.add(token);
|
|
10
|
+
else if (token.startsWith("ssh://") && source === undefined) source = token;
|
|
11
|
+
else
|
|
12
|
+
throw new TypeError(
|
|
13
|
+
"Use /pi-agent-ide-doctor [ssh://target/path] [--apply | --no-apply] [--agent]",
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
if (flags.has("--apply") && flags.has("--no-apply"))
|
|
17
|
+
throw new TypeError("Choose --apply or --no-apply, not both");
|
|
18
|
+
return { cwd: source ?? cwd, flags };
|
|
19
|
+
}
|
|
@@ -2,53 +2,85 @@ import { requiredValue } from "pi-agent-invariant";
|
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
|
|
4
4
|
import { projectIdeConfigDirectory, projectIdeConfigPath } from "#src/api/tool-config.js";
|
|
5
|
+
import type { DoctorWorkspace } from "#src/api/doctor.js";
|
|
5
6
|
|
|
6
7
|
import type { RecipeCandidate } from "./discovery.js";
|
|
7
8
|
|
|
9
|
+
type ConfigAccess = Pick<DoctorWorkspace, "source" | "configPaths" | "readText" | "writeText">;
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
Merges selected plugin recipes into their project-local runtime configs.
|
|
10
13
|
*/
|
|
11
14
|
export async function writeSuggestedConfigs(
|
|
12
15
|
cwd: string,
|
|
13
16
|
candidates: readonly RecipeCandidate[],
|
|
17
|
+
workspace?: ConfigAccess,
|
|
18
|
+
signal?: AbortSignal,
|
|
14
19
|
): Promise<readonly string[]> {
|
|
15
|
-
|
|
20
|
+
signal?.throwIfAborted();
|
|
21
|
+
if ((cwd.includes("://") && !workspace) || (workspace && workspace.source !== cwd)) {
|
|
22
|
+
throw Object.assign(new Error("Doctor configuration needs its project owner"), {
|
|
23
|
+
code: "UNSUPPORTED_SOURCE",
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (!workspace) await mkdir(projectIdeConfigDirectory(cwd), { recursive: true });
|
|
16
27
|
const changed: string[] = [];
|
|
17
28
|
const formatters = candidates.filter((candidate) => candidate.recipe.formatter !== undefined);
|
|
18
29
|
const linters = candidates.filter((candidate) => candidate.recipe.linter !== undefined);
|
|
19
30
|
const servers = candidates.filter((candidate) => candidate.recipe.lsp !== undefined);
|
|
20
31
|
|
|
21
32
|
if (formatters.length > 0) {
|
|
22
|
-
const file =
|
|
23
|
-
|
|
33
|
+
const file = workspace
|
|
34
|
+
? (await workspace.configPaths("formatters", signal)).project
|
|
35
|
+
: projectIdeConfigPath(cwd, "formatters");
|
|
36
|
+
const { config, previous } = await readObject(
|
|
37
|
+
file,
|
|
38
|
+
{ version: 1, formatters: {} },
|
|
39
|
+
workspace,
|
|
40
|
+
signal,
|
|
41
|
+
);
|
|
24
42
|
const entries = objectMember(config, "formatters");
|
|
25
43
|
|
|
26
44
|
for (const candidate of formatters) {
|
|
27
45
|
entries[candidate.recipe.id] ??= candidate.recipe.formatter;
|
|
28
46
|
}
|
|
29
47
|
|
|
30
|
-
if (await writeJson(file, config)) {
|
|
48
|
+
if (await writeJson(file, config, previous, workspace, signal)) {
|
|
31
49
|
changed.push(file);
|
|
32
50
|
}
|
|
33
51
|
}
|
|
34
52
|
|
|
35
53
|
if (linters.length > 0) {
|
|
36
|
-
const file =
|
|
37
|
-
|
|
54
|
+
const file = workspace
|
|
55
|
+
? (await workspace.configPaths("linters", signal)).project
|
|
56
|
+
: projectIdeConfigPath(cwd, "linters");
|
|
57
|
+
const { config, previous } = await readObject(
|
|
58
|
+
file,
|
|
59
|
+
{ version: 1, linters: {} },
|
|
60
|
+
workspace,
|
|
61
|
+
signal,
|
|
62
|
+
);
|
|
38
63
|
const entries = objectMember(config, "linters");
|
|
39
64
|
|
|
40
65
|
for (const candidate of linters) {
|
|
41
66
|
entries[candidate.recipe.id] ??= candidate.recipe.linter;
|
|
42
67
|
}
|
|
43
68
|
|
|
44
|
-
if (await writeJson(file, config)) {
|
|
69
|
+
if (await writeJson(file, config, previous, workspace, signal)) {
|
|
45
70
|
changed.push(file);
|
|
46
71
|
}
|
|
47
72
|
}
|
|
48
73
|
|
|
49
74
|
if (servers.length > 0) {
|
|
50
|
-
const file =
|
|
51
|
-
|
|
75
|
+
const file = workspace
|
|
76
|
+
? (await workspace.configPaths("lsp-servers", signal)).project
|
|
77
|
+
: projectIdeConfigPath(cwd, "lsp-servers");
|
|
78
|
+
const { config, previous } = await readObject(
|
|
79
|
+
file,
|
|
80
|
+
{ version: 1, servers: {} },
|
|
81
|
+
workspace,
|
|
82
|
+
signal,
|
|
83
|
+
);
|
|
52
84
|
const entries = objectMember(config, "servers");
|
|
53
85
|
|
|
54
86
|
for (const candidate of servers) {
|
|
@@ -77,7 +109,7 @@ export async function writeSuggestedConfigs(
|
|
|
77
109
|
};
|
|
78
110
|
}
|
|
79
111
|
|
|
80
|
-
if (await writeJson(file, config)) {
|
|
112
|
+
if (await writeJson(file, config, previous, workspace, signal)) {
|
|
81
113
|
changed.push(file);
|
|
82
114
|
}
|
|
83
115
|
}
|
|
@@ -88,22 +120,29 @@ export async function writeSuggestedConfigs(
|
|
|
88
120
|
async function readObject(
|
|
89
121
|
file: string,
|
|
90
122
|
fallback: Record<string, unknown>,
|
|
91
|
-
|
|
123
|
+
workspace?: ConfigAccess,
|
|
124
|
+
signal?: AbortSignal,
|
|
125
|
+
): Promise<{ config: Record<string, unknown>; previous: string | undefined }> {
|
|
126
|
+
let previous: string | undefined;
|
|
92
127
|
try {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
throw new Error(`${file} must contain an object`);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return value as Record<string, unknown>;
|
|
128
|
+
previous = workspace
|
|
129
|
+
? await workspace.readText(file, signal)
|
|
130
|
+
: await readFile(file, { encoding: "utf8", signal });
|
|
100
131
|
} catch (error) {
|
|
101
|
-
|
|
102
|
-
|
|
132
|
+
signal?.throwIfAborted();
|
|
133
|
+
if (
|
|
134
|
+
!(typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
|
|
135
|
+
) {
|
|
136
|
+
throw error;
|
|
103
137
|
}
|
|
104
|
-
|
|
105
|
-
throw error;
|
|
106
138
|
}
|
|
139
|
+
signal?.throwIfAborted();
|
|
140
|
+
if (previous === undefined) return { config: fallback, previous };
|
|
141
|
+
const value: unknown = JSON.parse(previous);
|
|
142
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
143
|
+
throw new Error(`${file} must contain an object`);
|
|
144
|
+
}
|
|
145
|
+
return { config: value as Record<string, unknown>, previous };
|
|
107
146
|
}
|
|
108
147
|
|
|
109
148
|
function objectMember(record: Record<string, unknown>, key: string): Record<string, unknown> {
|
|
@@ -116,13 +155,17 @@ function objectMember(record: Record<string, unknown>, key: string): Record<stri
|
|
|
116
155
|
return value as Record<string, unknown>;
|
|
117
156
|
}
|
|
118
157
|
|
|
119
|
-
async function writeJson(
|
|
158
|
+
async function writeJson(
|
|
159
|
+
file: string,
|
|
160
|
+
value: unknown,
|
|
161
|
+
previous: string | undefined,
|
|
162
|
+
workspace?: ConfigAccess,
|
|
163
|
+
signal?: AbortSignal,
|
|
164
|
+
): Promise<boolean> {
|
|
165
|
+
signal?.throwIfAborted();
|
|
120
166
|
const content = `${JSON.stringify(value, null, 2)}\n`;
|
|
121
|
-
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
await writeFile(file, content, "utf8");
|
|
167
|
+
if (previous === content) return false;
|
|
168
|
+
if (workspace) await workspace.writeText(file, content, previous, signal);
|
|
169
|
+
else await writeFile(file, content, { encoding: "utf8", signal });
|
|
127
170
|
return true;
|
|
128
171
|
}
|