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,10 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
|
|
3
3
|
import { DOCTOR_API_VERSION, DOCTOR_PROTOCOL } from "pi-agent-doctor/api/plugin-protocol";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import {
|
|
5
|
+
projectExecutableAvailable,
|
|
6
|
+
probeProjectExecutable,
|
|
7
|
+
} from "pi-agent-doctor/api/project-probes";
|
|
7
8
|
|
|
8
9
|
import { parseDocument } from "./ast/manager.js";
|
|
9
10
|
|
|
@@ -64,11 +65,7 @@ export const astDoctorPlugin: DoctorPlugin = {
|
|
|
64
65
|
if (![...context.detectedLanguageIds].some((language) => supported.has(language))) {
|
|
65
66
|
return {};
|
|
66
67
|
}
|
|
67
|
-
const available = await
|
|
68
|
-
{ command: ["ast-grep"] },
|
|
69
|
-
context.cwd,
|
|
70
|
-
context.env,
|
|
71
|
-
);
|
|
68
|
+
const available = await projectExecutableAvailable(context, "ast-grep");
|
|
72
69
|
return available
|
|
73
70
|
? {}
|
|
74
71
|
: {
|
|
@@ -105,7 +102,12 @@ export const astDoctorPlugin: DoctorPlugin = {
|
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
try {
|
|
108
|
-
|
|
105
|
+
context.signal?.throwIfAborted();
|
|
106
|
+
const source = context.workspace
|
|
107
|
+
? await context.workspace.readText(file, context.signal)
|
|
108
|
+
: await readFile(file, { encoding: "utf8", signal: context.signal });
|
|
109
|
+
if (source === undefined) throw new Error(`Source disappeared: ${file}`);
|
|
110
|
+
context.signal?.throwIfAborted();
|
|
109
111
|
const tree = await parseDocument(
|
|
110
112
|
file,
|
|
111
113
|
context.cwd,
|
|
@@ -117,6 +119,7 @@ export const astDoctorPlugin: DoctorPlugin = {
|
|
|
117
119
|
: { status: "pass" as const, message: `${language} parser loaded`, detail: file },
|
|
118
120
|
);
|
|
119
121
|
} catch (error) {
|
|
122
|
+
context.signal?.throwIfAborted();
|
|
120
123
|
findings.push({
|
|
121
124
|
status: "fail" as const,
|
|
122
125
|
message: `${language}: ${error instanceof Error ? error.message : String(error)}`,
|
|
@@ -137,7 +140,7 @@ export const astDoctorPlugin: DoctorPlugin = {
|
|
|
137
140
|
return [{ status: "skip", message: "No supported structural-search files found" }];
|
|
138
141
|
}
|
|
139
142
|
|
|
140
|
-
const result = await
|
|
143
|
+
const result = await probeProjectExecutable(context, "ast-grep", ["--version"]);
|
|
141
144
|
return [
|
|
142
145
|
result.ok
|
|
143
146
|
? { status: "pass", message: "ast-grep is available", detail: result.detail }
|
|
@@ -38,7 +38,23 @@ export default async function registerAst(pi: ExtensionAPI): Promise<void> {
|
|
|
38
38
|
apiVersion: READ_API_VERSION,
|
|
39
39
|
id: "ast",
|
|
40
40
|
async setup(api) {
|
|
41
|
-
api.addResolver({
|
|
41
|
+
api.addResolver({
|
|
42
|
+
resolver: createAstOutlineResolver(undefined, async (source, context) => {
|
|
43
|
+
const result = await api.read({ path: source }, context, "script");
|
|
44
|
+
if (result.isError === true)
|
|
45
|
+
throw new Error(
|
|
46
|
+
result.details.failure?.message ??
|
|
47
|
+
"Could not acquire an owned text snapshot for the AST outline.",
|
|
48
|
+
);
|
|
49
|
+
if (result.script?.kind !== "text")
|
|
50
|
+
throw new Error("AST outlines require an owned text snapshot.");
|
|
51
|
+
return {
|
|
52
|
+
source: result.script.source,
|
|
53
|
+
lines: result.script.lines.map((line) => line.content),
|
|
54
|
+
};
|
|
55
|
+
}),
|
|
56
|
+
renderResult: renderReadResult,
|
|
57
|
+
});
|
|
42
58
|
api.addHandler({
|
|
43
59
|
stage: "read",
|
|
44
60
|
when: { resolvedBy: "ast", contentKind: "text" },
|
|
@@ -52,7 +68,9 @@ export default async function registerAst(pi: ExtensionAPI): Promise<void> {
|
|
|
52
68
|
stage: "post-read",
|
|
53
69
|
async handler(context) {
|
|
54
70
|
const result = await overflow(context);
|
|
55
|
-
return result.kind === "return"
|
|
71
|
+
return result.kind === "return" || result.transform !== undefined
|
|
72
|
+
? result
|
|
73
|
+
: scopes(result.context);
|
|
56
74
|
},
|
|
57
75
|
});
|
|
58
76
|
api.describe({
|
|
@@ -5,20 +5,30 @@ import {
|
|
|
5
5
|
} from "pi-agent-ide/api/code-view";
|
|
6
6
|
|
|
7
7
|
import type * as AstOutline from "./ast/outline.js";
|
|
8
|
+
import { MAX_SOURCE_BYTES } from "./ast/read-text.js";
|
|
8
9
|
import type {
|
|
9
10
|
ResourceResolutionAttempt,
|
|
10
11
|
ResourceResolver,
|
|
11
12
|
ResourceResolverContext,
|
|
12
13
|
} from "pi-agent-resource";
|
|
13
14
|
|
|
15
|
+
/** Acquire original text through its resource owner; never reinterpret a URI as a local path. */
|
|
16
|
+
export type AstOutlineSourceReader = (
|
|
17
|
+
source: string,
|
|
18
|
+
context: ResourceResolverContext,
|
|
19
|
+
) => Promise<{ source: string; lines: readonly string[] }>;
|
|
20
|
+
|
|
14
21
|
let defaultManager: AstOutline.AstOutlineManager | undefined;
|
|
15
22
|
let astOutlineModule: Promise<typeof AstOutline> | undefined;
|
|
16
23
|
|
|
17
|
-
export function createAstOutlineResolver(
|
|
24
|
+
export function createAstOutlineResolver(
|
|
25
|
+
manager?: AstOutline.AstOutlineManager,
|
|
26
|
+
readSource?: AstOutlineSourceReader,
|
|
27
|
+
): ResourceResolver {
|
|
18
28
|
return {
|
|
19
29
|
id: "ast",
|
|
20
30
|
tryResolve(source, context) {
|
|
21
|
-
return Promise.resolve(resolveAstOutlineSource(source, context, manager));
|
|
31
|
+
return Promise.resolve(resolveAstOutlineSource(source, context, manager, readSource));
|
|
22
32
|
},
|
|
23
33
|
};
|
|
24
34
|
}
|
|
@@ -27,6 +37,7 @@ function resolveAstOutlineSource(
|
|
|
27
37
|
source: string,
|
|
28
38
|
context: ResourceResolverContext,
|
|
29
39
|
manager: AstOutline.AstOutlineManager | undefined,
|
|
40
|
+
readSource: AstOutlineSourceReader | undefined,
|
|
30
41
|
): ResourceResolutionAttempt {
|
|
31
42
|
let reference;
|
|
32
43
|
|
|
@@ -52,12 +63,29 @@ function resolveAstOutlineSource(
|
|
|
52
63
|
return {
|
|
53
64
|
kind: "resolved",
|
|
54
65
|
resource: {
|
|
55
|
-
|
|
66
|
+
// Reserve the physical owner; the AST presentation remains read-only.
|
|
67
|
+
source: filePath,
|
|
68
|
+
link: canonicalSource,
|
|
56
69
|
async read({ signal }) {
|
|
57
70
|
signal?.throwIfAborted();
|
|
58
71
|
const astOutline = await (astOutlineModule ??= import("./ast/outline.js"));
|
|
59
72
|
const outlineManager = manager ?? (defaultManager ??= new astOutline.AstOutlineManager());
|
|
60
|
-
|
|
73
|
+
let outline;
|
|
74
|
+
if (filePath.startsWith("ssh://")) {
|
|
75
|
+
if (readSource === undefined) throw new Error("No AST snapshot owner for this resource.");
|
|
76
|
+
const snapshot = await readSource(filePath, { ...context, signal });
|
|
77
|
+
if (Buffer.byteLength(snapshot.lines.join("\n")) > MAX_SOURCE_BYTES)
|
|
78
|
+
throw new Error("File exceeds the 262144-byte AST outline limit.");
|
|
79
|
+
if (snapshot.lines.some((line) => line.includes("\0")))
|
|
80
|
+
throw new Error("Binary resources cannot be read as AST outlines.");
|
|
81
|
+
outline = await outlineManager.readDocumentOutline(
|
|
82
|
+
snapshot.source,
|
|
83
|
+
context.cwd,
|
|
84
|
+
snapshot.lines,
|
|
85
|
+
);
|
|
86
|
+
} else {
|
|
87
|
+
outline = await outlineManager.readFileOutline(filePath, context.cwd);
|
|
88
|
+
}
|
|
61
89
|
signal?.throwIfAborted();
|
|
62
90
|
return [astOutline.formatAstOutline(outline)];
|
|
63
91
|
},
|
|
@@ -11,7 +11,7 @@ export const reduceAstReadOutput: ReadOutputReducer = async (result, context, bu
|
|
|
11
11
|
const { source, resolvedBy, lines, totalLines, startLine } = result.details;
|
|
12
12
|
if (
|
|
13
13
|
source === undefined ||
|
|
14
|
-
resolvedBy !== "filesystem" ||
|
|
14
|
+
(resolvedBy !== "filesystem" && !source.startsWith("ssh://")) ||
|
|
15
15
|
lines === undefined ||
|
|
16
16
|
lines.length !== totalLines ||
|
|
17
17
|
(startLine !== undefined && startLine !== 1)
|
|
@@ -52,7 +52,7 @@ export const reduceAstReadOutput: ReadOutputReducer = async (result, context, bu
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
/**
|
|
55
|
+
/** Present an overflowing read window as an outline without losing its source data. */
|
|
56
56
|
export function createAstOverflowHandler(): ReadPostReadHandler {
|
|
57
57
|
return async (context) => {
|
|
58
58
|
const { state, result } = context;
|
|
@@ -61,7 +61,7 @@ export function createAstOverflowHandler(): ReadPostReadHandler {
|
|
|
61
61
|
context.audience === "script" ||
|
|
62
62
|
result === undefined ||
|
|
63
63
|
state?.contentKind !== "text" ||
|
|
64
|
-
state.resolvedBy !== "filesystem" ||
|
|
64
|
+
(state.resolvedBy !== "filesystem" && !state.source.startsWith("ssh://")) ||
|
|
65
65
|
block?.type !== "text" ||
|
|
66
66
|
!truncateHead(block.text).truncated
|
|
67
67
|
)
|
|
@@ -83,6 +83,11 @@ export function createAstOverflowHandler(): ReadPostReadHandler {
|
|
|
83
83
|
);
|
|
84
84
|
return reduced === undefined
|
|
85
85
|
? { kind: "continue", context }
|
|
86
|
-
: {
|
|
86
|
+
: {
|
|
87
|
+
kind: "continue",
|
|
88
|
+
context,
|
|
89
|
+
// Keep canonical data added by other post-read transforms, including source targets.
|
|
90
|
+
transform: (result) => ({ ...reduced, script: result.script }),
|
|
91
|
+
};
|
|
87
92
|
};
|
|
88
93
|
}
|
|
@@ -22,7 +22,7 @@ export function createAstScopePresenter(manager: AstScopeManager): TextLinePrese
|
|
|
22
22
|
return {
|
|
23
23
|
id: "ast-scopes",
|
|
24
24
|
async present(document, context) {
|
|
25
|
-
if (context.resolvedBy !== "filesystem") {
|
|
25
|
+
if (context.resolvedBy !== "filesystem" && !document.source.startsWith("ssh://")) {
|
|
26
26
|
return document;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -79,10 +79,11 @@ function createFilePresentation(
|
|
|
79
79
|
logicalMatchIds: [...new Set(line.logicalMatchIds)],
|
|
80
80
|
};
|
|
81
81
|
});
|
|
82
|
-
const
|
|
82
|
+
const remote = file.includes("://");
|
|
83
|
+
const source = remote ? file : path.resolve(cwd, file);
|
|
83
84
|
return {
|
|
84
|
-
path: path.relative(cwd, source),
|
|
85
|
-
link: pathToFileURL(source).href,
|
|
85
|
+
path: remote ? source : path.relative(cwd, source),
|
|
86
|
+
link: remote ? source : pathToFileURL(source).href,
|
|
86
87
|
matchCount: matches.length,
|
|
87
88
|
lines: resultLines,
|
|
88
89
|
};
|
|
@@ -5,7 +5,7 @@ import path from "node:path";
|
|
|
5
5
|
import { requiredValue } from "pi-agent-invariant";
|
|
6
6
|
import type { SearchPluginApi, SearchSelectionMatch } from "pi-agent-search/api/search";
|
|
7
7
|
|
|
8
|
-
import type { SearchRequest, SearchResolver } from "pi-agent-search/api/search";
|
|
8
|
+
import type { SearchEnvironment, SearchRequest, SearchResolver } from "pi-agent-search/api/search";
|
|
9
9
|
import { selectionData, containsSearchMatch } from "pi-agent-search/api/search";
|
|
10
10
|
import { verifyResultTargets } from "pi-agent-resource";
|
|
11
11
|
import { renderSearchResult } from "pi-agent-search-text/rendering";
|
|
@@ -56,44 +56,62 @@ export function createAstSearchResolver(
|
|
|
56
56
|
return { kind: "failed", error: new Error("ast: pattern must not be empty") };
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
const owner = (source: string): SearchEnvironment | undefined =>
|
|
60
|
+
context.environmentForSource?.(source) ?? context.environment;
|
|
59
61
|
const collect = async (signal?: AbortSignal) => {
|
|
60
62
|
if (context.scope !== undefined) await verifyResultTargets(context.scope, signal);
|
|
61
|
-
const found =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
const found: AstGrepMatch[] = [];
|
|
64
|
+
if (context.scope === undefined) {
|
|
65
|
+
found.push(
|
|
66
|
+
...(await runAstGrep(pattern, request, context.cwd, signal, context.environment)),
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
for (const source of new Set(context.scope.targets.map((target) => target.source))) {
|
|
70
|
+
signal?.throwIfAborted();
|
|
71
|
+
found.push(
|
|
72
|
+
...(await runAstGrep(
|
|
73
|
+
pattern,
|
|
74
|
+
{ ...request, path: source },
|
|
75
|
+
context.cwd,
|
|
76
|
+
signal,
|
|
77
|
+
owner(source),
|
|
78
|
+
)),
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const mapped = found.map((match) => ({
|
|
83
|
+
...match,
|
|
84
|
+
file: resolveSource(context.cwd, match.file, owner(match.file)),
|
|
85
|
+
}));
|
|
86
|
+
mapped.sort(
|
|
69
87
|
(a, b) =>
|
|
70
|
-
|
|
88
|
+
a.file.localeCompare(b.file) ||
|
|
71
89
|
a.range.byteOffset.start - b.range.byteOffset.start ||
|
|
72
90
|
a.range.byteOffset.end - b.range.byteOffset.end,
|
|
73
91
|
);
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
const eligible: { raw: AstGrepMatch; selection: SearchSelectionMatch }[] = [];
|
|
93
|
+
for (const match of mapped) {
|
|
94
|
+
const selection = (
|
|
95
|
+
await selectionMatches([match], context.cwd, signal, owner(match.file))
|
|
96
|
+
)[0];
|
|
97
|
+
if (selection === undefined) throw new Error("Missing AST selection snapshot");
|
|
98
|
+
if (context.scope !== undefined && !containsSearchMatch(context.scope, selection))
|
|
99
|
+
continue;
|
|
100
|
+
eligible.push({
|
|
101
|
+
selection,
|
|
102
|
+
raw: {
|
|
103
|
+
...match,
|
|
104
|
+
range: {
|
|
105
|
+
...match.range,
|
|
106
|
+
start: { line: selection.lineNumber - 1, column: selection.startColumn },
|
|
107
|
+
end: {
|
|
108
|
+
line: (selection.endLineNumber ?? selection.lineNumber) - 1,
|
|
109
|
+
column: selection.endColumn,
|
|
89
110
|
},
|
|
90
111
|
},
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
({ selection }) =>
|
|
95
|
-
context.scope === undefined || containsSearchMatch(context.scope, selection),
|
|
96
|
-
);
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
97
115
|
const kept = eligible.slice(0, request.limit ?? 100);
|
|
98
116
|
if (context.scope !== undefined) await verifyResultTargets(context.scope, signal);
|
|
99
117
|
return {
|
|
@@ -131,6 +149,7 @@ export function createAstSearchResolver(
|
|
|
131
149
|
nodes.map((node) => ({ ...raw, ...node })),
|
|
132
150
|
context.cwd,
|
|
133
151
|
context.signal,
|
|
152
|
+
owner(raw.file),
|
|
134
153
|
);
|
|
135
154
|
const group = await registerSelection(
|
|
136
155
|
{
|
|
@@ -246,20 +265,25 @@ async function selectionMatches(
|
|
|
246
265
|
matches: readonly AstGrepMatch[],
|
|
247
266
|
cwd: string,
|
|
248
267
|
signal?: AbortSignal,
|
|
268
|
+
environment?: SearchEnvironment,
|
|
249
269
|
): Promise<SearchSelectionMatch[]> {
|
|
250
270
|
const sources = new Map<string, Buffer>();
|
|
251
271
|
for (const match of matches) {
|
|
252
|
-
const source =
|
|
272
|
+
const source = resolveSource(cwd, match.file, environment);
|
|
253
273
|
if (sources.has(source)) continue;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
274
|
+
if (environment !== undefined) {
|
|
275
|
+
sources.set(source, Buffer.from(await environment.readText(source, signal)));
|
|
276
|
+
} else {
|
|
277
|
+
const before = await stat(source);
|
|
278
|
+
const bytes = await readFile(source, { signal });
|
|
279
|
+
const after = await stat(source);
|
|
280
|
+
if (before.mtimeMs !== after.mtimeMs || before.size !== after.size)
|
|
281
|
+
throw new Error("AST source changed during search. Run the structural query again.");
|
|
282
|
+
sources.set(source, bytes);
|
|
283
|
+
}
|
|
260
284
|
}
|
|
261
285
|
return matches.map((match) => {
|
|
262
|
-
const source =
|
|
286
|
+
const source = resolveSource(cwd, match.file, environment);
|
|
263
287
|
const bytes = sources.get(source);
|
|
264
288
|
if (bytes === undefined) throw new Error("Missing AST source snapshot");
|
|
265
289
|
const { start, end } = match.range.byteOffset;
|
|
@@ -291,10 +315,9 @@ function runAstGrep(
|
|
|
291
315
|
request: SearchRequest,
|
|
292
316
|
cwd: string,
|
|
293
317
|
signal?: AbortSignal,
|
|
294
|
-
|
|
318
|
+
environment?: SearchEnvironment,
|
|
295
319
|
): Promise<AstGrepMatch[]> {
|
|
296
320
|
signal?.throwIfAborted();
|
|
297
|
-
if (sources?.length === 0) return Promise.resolve([]);
|
|
298
321
|
const arguments_ = ["run", "--pattern", pattern, "--json=compact", "--no-ignore", "parent"];
|
|
299
322
|
|
|
300
323
|
for (const include of splitGlobs(request.include)) {
|
|
@@ -305,7 +328,11 @@ function runAstGrep(
|
|
|
305
328
|
arguments_.push("--globs", `!${exclude}`);
|
|
306
329
|
}
|
|
307
330
|
|
|
308
|
-
|
|
331
|
+
if (environment !== undefined) {
|
|
332
|
+
return runOwnedAstGrep(environment, arguments_, request, cwd, signal);
|
|
333
|
+
}
|
|
334
|
+
resolveSource(cwd, request.path ?? ".");
|
|
335
|
+
arguments_.push(request.path ?? ".");
|
|
309
336
|
return new Promise((resolve, reject) => {
|
|
310
337
|
const child = spawn("ast-grep", arguments_, {
|
|
311
338
|
cwd,
|
|
@@ -350,6 +377,37 @@ function runAstGrep(
|
|
|
350
377
|
});
|
|
351
378
|
}
|
|
352
379
|
|
|
380
|
+
function resolveSource(cwd: string, source: string, environment?: SearchEnvironment): string {
|
|
381
|
+
if (environment !== undefined) return environment.resolve(cwd, source);
|
|
382
|
+
if (source.includes("://") || cwd.includes("://"))
|
|
383
|
+
throw new Error("No structural search owner for this resource.");
|
|
384
|
+
return path.resolve(cwd, source);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
async function runOwnedAstGrep(
|
|
388
|
+
environment: SearchEnvironment,
|
|
389
|
+
arguments_: string[],
|
|
390
|
+
request: SearchRequest,
|
|
391
|
+
cwd: string,
|
|
392
|
+
signal?: AbortSignal,
|
|
393
|
+
): Promise<AstGrepMatch[]> {
|
|
394
|
+
if (environment.execute === undefined)
|
|
395
|
+
throw new Error("This resource owner does not support structural search execution.");
|
|
396
|
+
const scope = environment.resolve(cwd, request.path ?? ".");
|
|
397
|
+
const directory = await environment.isDirectory(scope, signal);
|
|
398
|
+
const executionCwd = directory ? scope : environment.dirname(scope);
|
|
399
|
+
arguments_.push(directory ? "." : `./${environment.basename(scope)}`);
|
|
400
|
+
const result = await environment.execute("ast-grep", arguments_, executionCwd, signal);
|
|
401
|
+
signal?.throwIfAborted();
|
|
402
|
+
if (result.code !== 0 && result.code !== 1)
|
|
403
|
+
throw new Error(`Structural search failed with exit ${String(result.code)}.`);
|
|
404
|
+
const value: unknown = JSON.parse(result.stdout.length === 0 ? "[]" : result.stdout);
|
|
405
|
+
if (!Array.isArray(value)) throw new TypeError("ast-grep returned non-array JSON");
|
|
406
|
+
return (value as AstGrepMatch[]).map((match) => ({
|
|
407
|
+
...match,
|
|
408
|
+
file: environment.resolve(executionCwd, match.file),
|
|
409
|
+
}));
|
|
410
|
+
}
|
|
353
411
|
function splitGlobs(value: string | undefined): string[] {
|
|
354
412
|
return (
|
|
355
413
|
value
|
|
@@ -31,7 +31,8 @@ export function selectPresentation(
|
|
|
31
31
|
if (!remaining) break;
|
|
32
32
|
const shown = selected.slice(0, remaining);
|
|
33
33
|
remaining -= shown.length;
|
|
34
|
-
const
|
|
34
|
+
const remote = source.startsWith("ssh://");
|
|
35
|
+
const label = remote ? source : path.relative(cwd, source) || path.basename(source);
|
|
35
36
|
const previews: SourcePreview[] = [];
|
|
36
37
|
let shortened = false;
|
|
37
38
|
const content = selected[0]?.target.expectedContent.split(/\r\n|\n|\r/u) ?? [];
|
|
@@ -46,7 +47,7 @@ export function selectPresentation(
|
|
|
46
47
|
previews.push({
|
|
47
48
|
source,
|
|
48
49
|
label,
|
|
49
|
-
link: pathToFileURL(source).href,
|
|
50
|
+
link: remote ? source : pathToFileURL(source).href,
|
|
50
51
|
lineNumber: number,
|
|
51
52
|
text,
|
|
52
53
|
ranges: [
|
|
@@ -166,7 +166,8 @@ export async function registerSelect(pi: ExtensionAPI, read: ReadPluginApi): Pro
|
|
|
166
166
|
},
|
|
167
167
|
renderResult(result, options, theme) {
|
|
168
168
|
const presentation = result.details as ResultPanelModel | undefined;
|
|
169
|
-
if (presentation
|
|
169
|
+
if (typeof presentation?.summary === "string" && Array.isArray(presentation.rows))
|
|
170
|
+
return new ResultPanel(presentation, theme, options.expanded);
|
|
170
171
|
return new Text(
|
|
171
172
|
result.content
|
|
172
173
|
.flatMap((block) => (block.type === "text" ? [block.text] : []))
|
|
@@ -17,13 +17,22 @@ import {
|
|
|
17
17
|
import { changesDoctorPlugin } from "#src/doctor-plugin.js";
|
|
18
18
|
import { CHANGE_ANCHOR_KIND, createChangeAnchorRegistration } from "#src/change-anchor.js";
|
|
19
19
|
import { extensionGitExecutor } from "#src/changes/git-changes-backend.js";
|
|
20
|
+
export type { GitCommandExecutor } from "#src/changes/git-changes-backend.js";
|
|
20
21
|
import { createCurrentChangePresenter } from "#src/current-change-presenter.js";
|
|
21
22
|
import { IndexMutationQueue } from "#src/index-mutation-queue.js";
|
|
22
23
|
import { LastTextTransactionStore } from "#src/last-text-transaction-store.js";
|
|
23
24
|
import { registerIndexChangeTools } from "#src/tool-index-change.js";
|
|
24
25
|
import { createUndoMutationTool } from "#src/tool-text-undo.js";
|
|
25
26
|
|
|
26
|
-
export default
|
|
27
|
+
export default function registerGitChanges(pi: ExtensionAPI): Promise<void> {
|
|
28
|
+
return registerGitChangesWithExecutor(pi, extensionGitExecutor(pi));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Register Git views and mutations using the supplied owner-aware executor. */
|
|
32
|
+
export async function registerGitChangesWithExecutor(
|
|
33
|
+
pi: ExtensionAPI,
|
|
34
|
+
executor: ReturnType<typeof extensionGitExecutor>,
|
|
35
|
+
): Promise<void> {
|
|
27
36
|
connectAgentDocumentation(pi, [
|
|
28
37
|
await loadPackagedAgentGuide({
|
|
29
38
|
id: "git-changes",
|
|
@@ -31,7 +40,6 @@ export default async function registerGitChanges(pi: ExtensionAPI): Promise<void
|
|
|
31
40
|
triggers: ["stage", "unstage", "undo"].map((tool) => ({ tool })),
|
|
32
41
|
}),
|
|
33
42
|
]);
|
|
34
|
-
const executor = extensionGitExecutor(pi);
|
|
35
43
|
const transactions = new LastTextTransactionStore();
|
|
36
44
|
const indexQueue = new IndexMutationQueue();
|
|
37
45
|
const presenter = createCurrentChangePresenter(executor);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-changes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,26 +8,27 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./changes/change-groups": {
|
|
10
10
|
"types": "./src/changes/change-groups.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-33.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"diff": "^9.0.0",
|
|
16
|
-
"pi-agent-doctor": "0.
|
|
17
|
-
"pi-agent-documentation": "0.
|
|
18
|
-
"pi-agent-invariant": "0.
|
|
19
|
-
"pi-agent-read": "0.
|
|
20
|
-
"pi-agent-resource": "0.
|
|
21
|
-
"pi-agent-text": "0.
|
|
22
|
-
"pi-agent-text-editor": "0.
|
|
16
|
+
"pi-agent-doctor": "0.8.0",
|
|
17
|
+
"pi-agent-documentation": "0.8.0",
|
|
18
|
+
"pi-agent-invariant": "0.8.0",
|
|
19
|
+
"pi-agent-read": "0.8.0",
|
|
20
|
+
"pi-agent-resource": "0.8.0",
|
|
21
|
+
"pi-agent-text": "0.8.0",
|
|
22
|
+
"pi-agent-text-editor": "0.8.0"
|
|
23
23
|
},
|
|
24
24
|
"pi": {
|
|
25
25
|
"extensions": [
|
|
26
|
-
"./runtime/entry-
|
|
26
|
+
"./runtime/entry-34.js"
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@earendil-works/pi-coding-agent": "*",
|
|
31
|
+
"@earendil-works/pi-tui": "*",
|
|
31
32
|
"typebox": "*"
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TextAnchor, type TextAnchorResolver, type TextAnchorResolverContext } from "pi-agent-text";
|
|
2
2
|
|
|
3
3
|
import { ChangeService } from "#src/changes/change-service.js";
|
|
4
|
+
import { gitSourceDirectory } from "#src/changes/git-paths.js";
|
|
4
5
|
|
|
5
6
|
import type { ChangeGroup, ChangeInspection } from "#src/changes/change-types.js";
|
|
6
7
|
import type { GitCommandExecutor } from "#src/changes/git-changes-backend.js";
|
|
@@ -26,11 +27,15 @@ export function createChangeAnchorRegistration(
|
|
|
26
27
|
const inspect = async (
|
|
27
28
|
context: TextAnchorResolverContext,
|
|
28
29
|
): Promise<ChangeInspection | undefined> => {
|
|
29
|
-
if (resourceSchemePattern.test(context.source)) {
|
|
30
|
+
if (resourceSchemePattern.test(context.source) && !context.source.startsWith("ssh://")) {
|
|
30
31
|
return undefined;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
const creation = await ChangeService.create(
|
|
34
|
+
const creation = await ChangeService.create(
|
|
35
|
+
executor,
|
|
36
|
+
gitSourceDirectory(context.source, context.cwd),
|
|
37
|
+
context.signal,
|
|
38
|
+
);
|
|
34
39
|
|
|
35
40
|
if (creation.status !== "ready") {
|
|
36
41
|
throw new Error(creation.message);
|
|
@@ -110,6 +110,7 @@ export class ChangeService {
|
|
|
110
110
|
|
|
111
111
|
const segment = requiredValue(group.segments[0]);
|
|
112
112
|
const update: GitIndexUpdate = {
|
|
113
|
+
expectedWorktreeText: input.worktreeText,
|
|
113
114
|
head: inspection.head,
|
|
114
115
|
repositoryPath: inspection.repositoryPath,
|
|
115
116
|
headStart: segment.headStart,
|
|
@@ -124,6 +125,7 @@ export class ChangeService {
|
|
|
124
125
|
status: "unavailable",
|
|
125
126
|
reason: "index-write-failed",
|
|
126
127
|
message: errorMessage(error),
|
|
128
|
+
failure: error instanceof Error ? error : new Error(errorMessage(error)),
|
|
127
129
|
};
|
|
128
130
|
}
|
|
129
131
|
|
|
@@ -165,6 +167,7 @@ export class ChangeService {
|
|
|
165
167
|
headStart: segment.headStart,
|
|
166
168
|
headEnd: segment.headEnd,
|
|
167
169
|
replacementText: segment.headText,
|
|
170
|
+
expectedWorktreeText: worktreeText,
|
|
168
171
|
} satisfies GitIndexUpdate);
|
|
169
172
|
|
|
170
173
|
return {
|
|
@@ -202,7 +205,21 @@ export class ChangeService {
|
|
|
202
205
|
return;
|
|
203
206
|
}
|
|
204
207
|
|
|
205
|
-
await this.git.writeIndexFile(
|
|
208
|
+
await this.git.writeIndexFile(
|
|
209
|
+
update.repositoryPath,
|
|
210
|
+
versions.indexMode,
|
|
211
|
+
nextIndexText,
|
|
212
|
+
signal,
|
|
213
|
+
{
|
|
214
|
+
expectedHead: versions.head,
|
|
215
|
+
expectedIndexText: versions.indexText,
|
|
216
|
+
expectedIndexMode: versions.indexMode,
|
|
217
|
+
expectedIndexExists: versions.indexExists,
|
|
218
|
+
...(update.expectedWorktreeText !== undefined && {
|
|
219
|
+
expectedWorktreeText: update.expectedWorktreeText,
|
|
220
|
+
}),
|
|
221
|
+
},
|
|
222
|
+
);
|
|
206
223
|
}
|
|
207
224
|
}
|
|
208
225
|
|
|
@@ -52,6 +52,8 @@ export type ChangeInspection =
|
|
|
52
52
|
readonly status: "unavailable";
|
|
53
53
|
readonly reason: ChangeUnavailableReason;
|
|
54
54
|
readonly message: string;
|
|
55
|
+
/** Original publication failure, including its acknowledged effect. */
|
|
56
|
+
readonly failure?: Error;
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
export interface ChangeInspectionInput {
|
|
@@ -64,6 +66,7 @@ export interface ChangeInspectionInput {
|
|
|
64
66
|
export type ChangeIndexAction = "stage" | "unstage";
|
|
65
67
|
|
|
66
68
|
export interface GitIndexUpdate {
|
|
69
|
+
readonly expectedWorktreeText?: string;
|
|
67
70
|
readonly head: string;
|
|
68
71
|
readonly repositoryPath: string;
|
|
69
72
|
readonly headStart: number;
|