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
|
@@ -73,7 +73,13 @@ export function createFileResolver(): SearchResolver {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const query = request.query.slice("files:".length).trim();
|
|
76
|
-
const result = await searchFiles(
|
|
76
|
+
const result = await searchFiles(
|
|
77
|
+
query,
|
|
78
|
+
request,
|
|
79
|
+
context.cwd,
|
|
80
|
+
context.signal,
|
|
81
|
+
context.environment,
|
|
82
|
+
);
|
|
77
83
|
return { kind: "resolved", payload: { query, ...result } satisfies FilePayload };
|
|
78
84
|
},
|
|
79
85
|
renderResult(result, options, theme) {
|
|
@@ -85,7 +91,9 @@ export function createFileResolver(): SearchResolver {
|
|
|
85
91
|
? data.files.map((file) => ({
|
|
86
92
|
kind: "source",
|
|
87
93
|
label: file,
|
|
88
|
-
link:
|
|
94
|
+
link: file.startsWith("ssh://")
|
|
95
|
+
? file
|
|
96
|
+
: pathToFileURL(path.resolve(data.cwd, file)).href,
|
|
89
97
|
}))
|
|
90
98
|
: [{ kind: "note", text: "No files found" }],
|
|
91
99
|
},
|
|
@@ -141,7 +149,7 @@ function createMatchResolver(
|
|
|
141
149
|
if (recipe === undefined) return { kind: "not-handled" };
|
|
142
150
|
const result =
|
|
143
151
|
context.scope === undefined
|
|
144
|
-
? await runSearchRecipe(recipe, context.cwd, context.signal)
|
|
152
|
+
? await runSearchRecipe(recipe, context.cwd, context.signal, context.environment)
|
|
145
153
|
: await runScopedSearch(recipe, context.scope, context.cwd, context.signal);
|
|
146
154
|
const fuzzy =
|
|
147
155
|
context.scope === undefined &&
|
|
@@ -149,7 +157,12 @@ function createMatchResolver(
|
|
|
149
157
|
result.complete &&
|
|
150
158
|
result.matches.length === 0 &&
|
|
151
159
|
isFuzzyQuery(request.query)
|
|
152
|
-
? await searchFuzzy(
|
|
160
|
+
? await searchFuzzy(
|
|
161
|
+
{ ...request, query: request.query },
|
|
162
|
+
context.cwd,
|
|
163
|
+
context.signal,
|
|
164
|
+
context.environment,
|
|
165
|
+
)
|
|
153
166
|
: undefined;
|
|
154
167
|
return {
|
|
155
168
|
kind: "resolved",
|
|
@@ -175,6 +188,8 @@ function createMatchResolver(
|
|
|
175
188
|
scope === undefined
|
|
176
189
|
? undefined
|
|
177
190
|
: (signal) => runScopedSearch(result.recipe, scope, context.cwd, signal),
|
|
191
|
+
undefined,
|
|
192
|
+
context.environment,
|
|
178
193
|
);
|
|
179
194
|
if (result.fuzzy !== undefined) {
|
|
180
195
|
const details = createSearchToolDetails(
|
|
@@ -205,8 +220,9 @@ function createMatchResolver(
|
|
|
205
220
|
context.cwd,
|
|
206
221
|
registrationSignal,
|
|
207
222
|
recipe,
|
|
208
|
-
(signal) => searchFuzzyAlternative(recipe, context.cwd, signal),
|
|
223
|
+
(signal) => searchFuzzyAlternative(recipe, context.cwd, signal, context.environment),
|
|
209
224
|
fuzzyLimits.vocabularyBytes,
|
|
225
|
+
context.environment,
|
|
210
226
|
);
|
|
211
227
|
} catch {
|
|
212
228
|
context.signal?.throwIfAborted();
|
|
@@ -368,6 +384,7 @@ function previewLine(text: string): string {
|
|
|
368
384
|
return `${text.slice(0, context)}${text.length > context ? "…" : ""}`;
|
|
369
385
|
}
|
|
370
386
|
function displaySource(source: string, cwd: string): string {
|
|
387
|
+
if (source.includes("://")) return source;
|
|
371
388
|
const relative = path.relative(cwd, source);
|
|
372
389
|
// oxlint-disable-next-line repo/no-parent-paths -- defensive check against traversal, not a traversal
|
|
373
390
|
return relative.length > 0 && !relative.startsWith("..") && !path.isAbsolute(relative)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ResolvedResultTargets } from "pi-agent-resource";
|
|
1
|
+
import { verifyResultTargets, type ResolvedResultTargets } from "pi-agent-resource";
|
|
3
2
|
import { createTextDocument } from "pi-agent-text";
|
|
4
3
|
import { searchTextContent } from "#src/search-backend.js";
|
|
5
4
|
import type { TextSearchBackendResult } from "#src/search-backend.js";
|
|
@@ -27,8 +26,7 @@ export async function runScopedSearch(
|
|
|
27
26
|
const seen = new Set<string>();
|
|
28
27
|
for (const target of scope.targets) {
|
|
29
28
|
signal?.throwIfAborted();
|
|
30
|
-
|
|
31
|
-
throw new Error("Result target is stale; repeat Read/Search.");
|
|
29
|
+
await verifyResultTargets({ targets: [target], complete: scope.complete }, signal);
|
|
32
30
|
const document = createTextDocument(target.source, target.expectedContent);
|
|
33
31
|
const starts = [0];
|
|
34
32
|
for (const line of document.lines)
|
|
@@ -40,7 +38,7 @@ export async function runScopedSearch(
|
|
|
40
38
|
const result = await searchTextContent(
|
|
41
39
|
{ ...recipe, query, condition },
|
|
42
40
|
document.content.slice(from, to),
|
|
43
|
-
cwd,
|
|
41
|
+
cwd.includes("://") ? process.cwd() : cwd,
|
|
44
42
|
signal,
|
|
45
43
|
);
|
|
46
44
|
for (const match of result.matches) {
|
|
@@ -99,5 +97,6 @@ export async function runScopedSearch(
|
|
|
99
97
|
notices.push("Search fallback: invalid regex skipped; literal search found no matches.");
|
|
100
98
|
}
|
|
101
99
|
}
|
|
100
|
+
await verifyResultTargets(scope, signal);
|
|
102
101
|
return { ...result, query, notices };
|
|
103
102
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { stat } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import type { SearchEnvironment } from "pi-agent-search/api/search";
|
|
4
5
|
import { createInterface } from "node:readline";
|
|
5
6
|
|
|
6
7
|
import { resolveRipgrepExecutable } from "#src/ripgrep.js";
|
|
@@ -44,6 +45,7 @@ export async function searchText(
|
|
|
44
45
|
cwd: string,
|
|
45
46
|
signal?: AbortSignal,
|
|
46
47
|
budget?: SearchCaptureBudget,
|
|
48
|
+
environment?: SearchEnvironment,
|
|
47
49
|
): Promise<TextSearchBackendResult> {
|
|
48
50
|
if (request.query.length === 0) {
|
|
49
51
|
throw new Error("Search query must not be empty.");
|
|
@@ -53,17 +55,29 @@ export async function searchText(
|
|
|
53
55
|
throw new Error("Search supports one-line patterns only.");
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
if (request.condition !== undefined) return searchBoolean(request, cwd, signal);
|
|
57
|
-
return searchPattern(request, cwd, signal, undefined, budget);
|
|
58
|
+
if (request.condition !== undefined) return searchBoolean(request, cwd, signal, environment);
|
|
59
|
+
return searchPattern(request, cwd, signal, undefined, budget, environment);
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
/** Reuse ordinary text-search scope, ignores, and glob parsing for the extra scan. */
|
|
61
|
-
export async function ripgrepScope(
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
export async function ripgrepScope(
|
|
64
|
+
request: TextSearchRequest,
|
|
65
|
+
cwd: string,
|
|
66
|
+
environment?: SearchEnvironment,
|
|
67
|
+
signal?: AbortSignal,
|
|
68
|
+
) {
|
|
69
|
+
if (environment === undefined && (request.path?.includes("://") || cwd.includes("://")))
|
|
70
|
+
throw new Error("No search environment owns this scope.");
|
|
71
|
+
const target =
|
|
72
|
+
environment?.resolve(cwd, stripFilePrefix(request.path ?? ".")) ??
|
|
73
|
+
path.resolve(cwd, stripFilePrefix(request.path ?? "."));
|
|
74
|
+
const directory =
|
|
75
|
+
environment === undefined
|
|
76
|
+
? (await stat(target)).isDirectory()
|
|
77
|
+
: await environment.isDirectory(target, signal);
|
|
64
78
|
return {
|
|
65
|
-
cwd: directory ? target : path.dirname(target),
|
|
66
|
-
target: directory ? "." : path.basename(target)
|
|
79
|
+
cwd: directory ? target : (environment?.dirname(target) ?? path.dirname(target)),
|
|
80
|
+
target: directory ? "." : `./${environment?.basename(target) ?? path.basename(target)}`,
|
|
67
81
|
arguments: [
|
|
68
82
|
"--no-config",
|
|
69
83
|
"--no-ignore-parent",
|
|
@@ -127,8 +141,9 @@ async function searchPattern(
|
|
|
127
141
|
signal?: AbortSignal,
|
|
128
142
|
onLine?: MatchingLine,
|
|
129
143
|
budget?: SearchCaptureBudget,
|
|
144
|
+
environment?: SearchEnvironment,
|
|
130
145
|
): Promise<TextSearchBackendResult> {
|
|
131
|
-
const scope = await ripgrepScope(request, cwd);
|
|
146
|
+
const scope = await ripgrepScope(request, cwd, environment, signal);
|
|
132
147
|
const searchCwd = scope.cwd;
|
|
133
148
|
const commonArguments = [
|
|
134
149
|
"--json",
|
|
@@ -143,7 +158,15 @@ async function searchPattern(
|
|
|
143
158
|
];
|
|
144
159
|
|
|
145
160
|
if (request.regex !== true) {
|
|
146
|
-
return runRipgrep(
|
|
161
|
+
return runRipgrep(
|
|
162
|
+
["--fixed-strings", ...commonArguments],
|
|
163
|
+
searchCwd,
|
|
164
|
+
signal,
|
|
165
|
+
onLine,
|
|
166
|
+
budget,
|
|
167
|
+
undefined,
|
|
168
|
+
environment,
|
|
169
|
+
);
|
|
147
170
|
}
|
|
148
171
|
|
|
149
172
|
try {
|
|
@@ -153,6 +176,8 @@ async function searchPattern(
|
|
|
153
176
|
signal,
|
|
154
177
|
onLine,
|
|
155
178
|
budget,
|
|
179
|
+
undefined,
|
|
180
|
+
environment,
|
|
156
181
|
);
|
|
157
182
|
} catch (error) {
|
|
158
183
|
if (!isPcre2MatchLimitError(error)) {
|
|
@@ -174,6 +199,8 @@ async function searchPattern(
|
|
|
174
199
|
signal,
|
|
175
200
|
onLine,
|
|
176
201
|
budget,
|
|
202
|
+
undefined,
|
|
203
|
+
environment,
|
|
177
204
|
);
|
|
178
205
|
} catch (fallbackError) {
|
|
179
206
|
if (signal?.aborted) throw fallbackError;
|
|
@@ -190,6 +217,7 @@ async function searchBoolean(
|
|
|
190
217
|
request: TextSearchRequest,
|
|
191
218
|
cwd: string,
|
|
192
219
|
signal?: AbortSignal,
|
|
220
|
+
environment?: SearchEnvironment,
|
|
193
221
|
): Promise<TextSearchBackendResult> {
|
|
194
222
|
const condition = request.condition;
|
|
195
223
|
if (condition === undefined) throw new Error("Boolean search requires a line condition.");
|
|
@@ -215,10 +243,12 @@ async function searchBoolean(
|
|
|
215
243
|
cwd,
|
|
216
244
|
signal,
|
|
217
245
|
(source, lineNumber) => lines.add(JSON.stringify([source, lineNumber])),
|
|
246
|
+
undefined,
|
|
247
|
+
environment,
|
|
218
248
|
);
|
|
219
249
|
present.set(pattern, lines);
|
|
220
250
|
}
|
|
221
|
-
const result = await searchText(scope, cwd, signal);
|
|
251
|
+
const result = await searchText(scope, cwd, signal, undefined, environment);
|
|
222
252
|
const selected = new Set<string>();
|
|
223
253
|
const matches = result.matches.filter((match) => {
|
|
224
254
|
const key = lineKey(match);
|
|
@@ -239,7 +269,10 @@ function runRipgrep(
|
|
|
239
269
|
onLine?: MatchingLine,
|
|
240
270
|
budget?: SearchCaptureBudget,
|
|
241
271
|
input?: string,
|
|
272
|
+
environment?: SearchEnvironment,
|
|
242
273
|
): Promise<TextSearchBackendResult> {
|
|
274
|
+
if (environment !== undefined)
|
|
275
|
+
return runOwnedRipgrep(arguments_, cwd, environment, signal, onLine, budget);
|
|
243
276
|
return new Promise((resolve, reject) => {
|
|
244
277
|
const child = spawn(resolveRipgrepExecutable(), arguments_, {
|
|
245
278
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -344,13 +377,78 @@ function runRipgrep(
|
|
|
344
377
|
});
|
|
345
378
|
}
|
|
346
379
|
|
|
380
|
+
async function runOwnedRipgrep(
|
|
381
|
+
arguments_: readonly string[],
|
|
382
|
+
cwd: string,
|
|
383
|
+
environment: SearchEnvironment,
|
|
384
|
+
signal?: AbortSignal,
|
|
385
|
+
onLine?: MatchingLine,
|
|
386
|
+
budget?: SearchCaptureBudget,
|
|
387
|
+
): Promise<TextSearchBackendResult> {
|
|
388
|
+
const matches: TextSearchMatch[] = [];
|
|
389
|
+
const controller = new AbortController();
|
|
390
|
+
const abort = () => controller.abort(signal?.reason);
|
|
391
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
392
|
+
if (signal?.aborted) abort();
|
|
393
|
+
let bytes = 0;
|
|
394
|
+
const state = { limited: false };
|
|
395
|
+
try {
|
|
396
|
+
const result = await environment.runLines(
|
|
397
|
+
arguments_,
|
|
398
|
+
cwd,
|
|
399
|
+
(line) => {
|
|
400
|
+
if (state.limited || !line.length) return;
|
|
401
|
+
bytes += Buffer.byteLength(line) + 1;
|
|
402
|
+
if (budget !== undefined && bytes > budget.bytes) {
|
|
403
|
+
state.limited = true;
|
|
404
|
+
controller.abort();
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
const event = JSON.parse(line) as
|
|
408
|
+
| RipgrepMatchEvent
|
|
409
|
+
| { type: "begin" | "end" | "summary"; data: never };
|
|
410
|
+
if (event.type !== "match") return;
|
|
411
|
+
if (onLine !== undefined) {
|
|
412
|
+
const source = event.data.path.text;
|
|
413
|
+
if (source !== undefined && Number.isSafeInteger(event.data.line_number))
|
|
414
|
+
onLine(environment.resolve(cwd, source), event.data.line_number);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
for (const match of matchesFromEvent(event, cwd, environment)) {
|
|
418
|
+
if (budget !== undefined && matches.length >= budget.matches) {
|
|
419
|
+
state.limited = true;
|
|
420
|
+
controller.abort();
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
matches.push(match);
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
controller.signal,
|
|
427
|
+
);
|
|
428
|
+
if (result.code !== 0 && result.code !== 1)
|
|
429
|
+
throw new Error(result.stderr.trim() || "Ripgrep failed.");
|
|
430
|
+
} catch (error) {
|
|
431
|
+
signal?.throwIfAborted();
|
|
432
|
+
if (!state.limited) throw error;
|
|
433
|
+
} finally {
|
|
434
|
+
signal?.removeEventListener("abort", abort);
|
|
435
|
+
}
|
|
436
|
+
signal?.throwIfAborted();
|
|
437
|
+
matches.sort(compareMatches);
|
|
438
|
+
return { matches, complete: !state.limited };
|
|
439
|
+
}
|
|
440
|
+
|
|
347
441
|
function isPcre2MatchLimitError(error: unknown): boolean {
|
|
348
442
|
return (
|
|
349
443
|
error instanceof Error && /PCRE2: error matching: match limit exceeded/iu.test(error.message)
|
|
350
444
|
);
|
|
351
445
|
}
|
|
352
446
|
|
|
353
|
-
function matchesFromEvent(
|
|
447
|
+
function matchesFromEvent(
|
|
448
|
+
event: RipgrepMatchEvent,
|
|
449
|
+
cwd: string,
|
|
450
|
+
environment?: SearchEnvironment,
|
|
451
|
+
): TextSearchMatch[] {
|
|
354
452
|
const source = event.data.path.text;
|
|
355
453
|
const rawLine = event.data.lines.text;
|
|
356
454
|
|
|
@@ -374,7 +472,7 @@ function matchesFromEvent(event: RipgrepMatchEvent, cwd: string): TextSearchMatc
|
|
|
374
472
|
const startColumn = lineBuffer.subarray(0, submatch.start).toString("utf8").length;
|
|
375
473
|
const endColumn = lineBuffer.subarray(0, submatch.end).toString("utf8").length;
|
|
376
474
|
matches.push({
|
|
377
|
-
source: path.resolve(cwd, source),
|
|
475
|
+
source: environment?.resolve(cwd, source) ?? path.resolve(cwd, source),
|
|
378
476
|
lineNumber: event.data.line_number,
|
|
379
477
|
startColumn,
|
|
380
478
|
endColumn,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SearchEnvironment } from "pi-agent-search/api/search";
|
|
1
2
|
import {
|
|
2
3
|
searchText,
|
|
3
4
|
type TextSearchRequest,
|
|
@@ -46,11 +47,12 @@ export async function runSearchRecipe(
|
|
|
46
47
|
recipe: SearchRecipe,
|
|
47
48
|
cwd: string,
|
|
48
49
|
signal?: AbortSignal,
|
|
50
|
+
environment?: SearchEnvironment,
|
|
49
51
|
): Promise<
|
|
50
52
|
TextSearchBackendResult & { readonly query: string; readonly notices: readonly string[] }
|
|
51
53
|
> {
|
|
52
54
|
let query = recipe.query;
|
|
53
|
-
let result = await searchText(recipe, cwd, signal);
|
|
55
|
+
let result = await searchText(recipe, cwd, signal, undefined, environment);
|
|
54
56
|
const notices: string[] = [];
|
|
55
57
|
for (const fallback of recipe.fallbacks ?? []) {
|
|
56
58
|
if (result.matches.length > 0 || !result.complete) break;
|
|
@@ -60,6 +62,8 @@ export async function runSearchRecipe(
|
|
|
60
62
|
{ ...recipe, query: fallback.query, regex: true, condition: fallback.condition },
|
|
61
63
|
cwd,
|
|
62
64
|
signal,
|
|
65
|
+
undefined,
|
|
66
|
+
environment,
|
|
63
67
|
);
|
|
64
68
|
result = next;
|
|
65
69
|
query = fallback.query;
|
|
@@ -298,6 +298,7 @@ function isCount(value: unknown): value is number {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
function displaySource(source: string, cwd: string): string {
|
|
301
|
+
if (source.includes("://")) return source;
|
|
301
302
|
const relative = path.relative(cwd, source);
|
|
302
303
|
// oxlint-disable-next-line repo/no-parent-paths -- defensive check against traversal, not a traversal
|
|
303
304
|
return relative.length > 0 && !relative.startsWith("..") && !path.isAbsolute(relative)
|
|
@@ -4,6 +4,7 @@ import type { SearchSelectionMatch, SearchSelectionRegistration } from "pi-agent
|
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { open, readFile } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
|
+
import type { SearchEnvironment } from "pi-agent-search/api/search";
|
|
7
8
|
|
|
8
9
|
import {
|
|
9
10
|
createTextDocument,
|
|
@@ -27,11 +28,12 @@ export type TextSearchMatch = SearchSelectionMatch;
|
|
|
27
28
|
|
|
28
29
|
export interface TextSearchSession {
|
|
29
30
|
readonly id: string;
|
|
30
|
-
readonly target?: string;
|
|
31
|
-
readonly matchTargets?: readonly string[];
|
|
32
31
|
readonly query: string;
|
|
33
32
|
readonly matches: readonly TextSearchMatch[];
|
|
34
33
|
readonly complete: boolean;
|
|
34
|
+
/** Strict source handles stay separate from legacy refreshing SEARCH references. */
|
|
35
|
+
readonly target?: string;
|
|
36
|
+
readonly matchTargets?: readonly string[];
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
interface SearchSnapshot {
|
|
@@ -40,7 +42,11 @@ interface SearchSnapshot {
|
|
|
40
42
|
readonly contentBySource: ReadonlyMap<string, string>;
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
type SnapshotReader = (source: string, signal?: AbortSignal) => Promise<string>;
|
|
46
|
+
|
|
43
47
|
interface StoredSearchSession extends TextSearchSession, SearchSnapshot {
|
|
48
|
+
readonly read?: SnapshotReader;
|
|
49
|
+
readonly environment?: SearchEnvironment;
|
|
44
50
|
readonly refresh?: SearchSelectionRegistration["refresh"];
|
|
45
51
|
readonly recipe: SearchRecipe;
|
|
46
52
|
readonly snapshotByteBudget?: number;
|
|
@@ -77,11 +83,13 @@ export function createSearchSessionIdentity(
|
|
|
77
83
|
const root =
|
|
78
84
|
cwd === undefined
|
|
79
85
|
? commonSourceDirectory(matches.map((match) => match.source))
|
|
80
|
-
:
|
|
86
|
+
: canonicalSource(cwd);
|
|
81
87
|
const identity = matches
|
|
82
88
|
.map((match) => ({
|
|
83
89
|
match,
|
|
84
|
-
source:
|
|
90
|
+
source: match.source.includes("://")
|
|
91
|
+
? canonicalSource(match.source)
|
|
92
|
+
: path.relative(root, path.resolve(match.source)),
|
|
85
93
|
}))
|
|
86
94
|
.sort(
|
|
87
95
|
(left, right) =>
|
|
@@ -126,7 +134,7 @@ export function allocateSearchSessionId(
|
|
|
126
134
|
function normalizeRecipe(recipe: SearchRecipe, cwd: string): Record<string, unknown> {
|
|
127
135
|
return {
|
|
128
136
|
query: recipe.query,
|
|
129
|
-
path:
|
|
137
|
+
path: resolveScope(cwd, recipe.path ?? "."),
|
|
130
138
|
include: recipe.include ?? "",
|
|
131
139
|
exclude: recipe.exclude ?? "",
|
|
132
140
|
caseSensitive: recipe.caseSensitive === true,
|
|
@@ -154,6 +162,11 @@ export class SearchSessionStore {
|
|
|
154
162
|
public constructor(
|
|
155
163
|
private readonly createIdentity: typeof createSearchSessionIdentity = createSearchSessionIdentity,
|
|
156
164
|
private readonly resultTargets?: ResultTargetStore,
|
|
165
|
+
private readonly readSource?: (
|
|
166
|
+
source: string,
|
|
167
|
+
cwd: string,
|
|
168
|
+
signal?: AbortSignal,
|
|
169
|
+
) => Promise<string>,
|
|
157
170
|
) {}
|
|
158
171
|
|
|
159
172
|
/** Capture current files; an optional byte budget also bounds reads if a file grows during capture. */
|
|
@@ -169,11 +182,21 @@ export class SearchSessionStore {
|
|
|
169
182
|
},
|
|
170
183
|
refresh?: SearchSelectionRegistration["refresh"],
|
|
171
184
|
snapshotByteBudget?: number,
|
|
185
|
+
environment?: SearchEnvironment,
|
|
172
186
|
): Promise<TextSearchSession> {
|
|
173
187
|
const matches = sourceMatches
|
|
174
|
-
.map((match) => ({ ...match, source:
|
|
188
|
+
.map((match) => ({ ...match, source: canonicalSource(match.source) }))
|
|
175
189
|
.sort(compareMatches);
|
|
176
|
-
const
|
|
190
|
+
const readSource = this.readSource;
|
|
191
|
+
const read: SnapshotReader | undefined =
|
|
192
|
+
readSource === undefined ? undefined : (source, abort) => readSource(source, cwd, abort);
|
|
193
|
+
const contentBySource = await snapshotContents(
|
|
194
|
+
matches,
|
|
195
|
+
signal,
|
|
196
|
+
snapshotByteBudget,
|
|
197
|
+
environment,
|
|
198
|
+
read,
|
|
199
|
+
);
|
|
177
200
|
const identity = this.createIdentity(query, matches, cwd, recipe);
|
|
178
201
|
const knownId = this.#idsByIdentity.get(identity);
|
|
179
202
|
const id = knownId ?? allocateSearchSessionId(identity, new Set<string>(this.#sessions.keys()));
|
|
@@ -183,11 +206,20 @@ export class SearchSessionStore {
|
|
|
183
206
|
matches,
|
|
184
207
|
complete,
|
|
185
208
|
contentBySource,
|
|
186
|
-
|
|
209
|
+
read,
|
|
210
|
+
...registerResultReferences(
|
|
211
|
+
this.resultTargets,
|
|
212
|
+
matches,
|
|
213
|
+
contentBySource,
|
|
214
|
+
cwd,
|
|
215
|
+
complete,
|
|
216
|
+
(source, abort) => readOwnedText(source, abort, environment, read),
|
|
217
|
+
),
|
|
187
218
|
...(snapshotByteBudget === undefined ? {} : { snapshotByteBudget }),
|
|
188
219
|
recipe,
|
|
220
|
+
environment,
|
|
189
221
|
...(refresh !== undefined && { refresh }),
|
|
190
|
-
cwd:
|
|
222
|
+
cwd: canonicalSource(cwd),
|
|
191
223
|
};
|
|
192
224
|
this.#idsByIdentity.set(identity, id);
|
|
193
225
|
this.#sessions.set(id, session);
|
|
@@ -204,6 +236,7 @@ export class SearchSessionStore {
|
|
|
204
236
|
recipe?: SearchRecipe,
|
|
205
237
|
refresh?: SearchSelectionRegistration["refresh"],
|
|
206
238
|
snapshotByteBudget?: number,
|
|
239
|
+
environment?: SearchEnvironment,
|
|
207
240
|
): Promise<TextSearchSession | undefined> {
|
|
208
241
|
try {
|
|
209
242
|
return await this.register(
|
|
@@ -215,6 +248,7 @@ export class SearchSessionStore {
|
|
|
215
248
|
recipe,
|
|
216
249
|
refresh,
|
|
217
250
|
snapshotByteBudget,
|
|
251
|
+
environment,
|
|
218
252
|
);
|
|
219
253
|
} catch (error) {
|
|
220
254
|
if (error instanceof SearchSnapshotChangedError) return undefined;
|
|
@@ -255,7 +289,7 @@ export class SearchSessionStore {
|
|
|
255
289
|
try {
|
|
256
290
|
const result =
|
|
257
291
|
session.refresh === undefined
|
|
258
|
-
? await runSearchRecipe(session.recipe, session.cwd, signal)
|
|
292
|
+
? await runSearchRecipe(session.recipe, session.cwd, signal, session.environment)
|
|
259
293
|
: await session.refresh(signal);
|
|
260
294
|
observations.push({
|
|
261
295
|
...base,
|
|
@@ -317,7 +351,7 @@ export class SearchSessionStore {
|
|
|
317
351
|
let session = this.#sessions.get(parsed.id);
|
|
318
352
|
if (session === undefined) return staleAnchor();
|
|
319
353
|
if (parsed.selector === "all" && !session.complete) return missingCompleteAnchor();
|
|
320
|
-
const source =
|
|
354
|
+
const source = canonicalSource(contextSource);
|
|
321
355
|
let snapshot: SearchSnapshot = session;
|
|
322
356
|
if (parsed.selector === "all") {
|
|
323
357
|
if (session.refreshedComplete?.complete === true) {
|
|
@@ -335,7 +369,7 @@ export class SearchSessionStore {
|
|
|
335
369
|
rejection: { code: "missing", reason: "search anchor does not select this resource" },
|
|
336
370
|
};
|
|
337
371
|
}
|
|
338
|
-
const current = await readCurrent(source, signal);
|
|
372
|
+
const current = await readCurrent(source, signal, session.environment, session.read);
|
|
339
373
|
if (current === undefined) return staleAnchor(requiredValue(sourceMatches[0]).lineNumber);
|
|
340
374
|
if (parsed.selector === "all" && current !== snapshot.contentBySource.get(source)) {
|
|
341
375
|
snapshot = await this.#refresh(session, signal);
|
|
@@ -380,7 +414,7 @@ export class SearchSessionStore {
|
|
|
380
414
|
selectMatches(snapshot, parsed.selector, parsed.mode).map((match) => match.source),
|
|
381
415
|
);
|
|
382
416
|
for (const source of sources) {
|
|
383
|
-
const current = await readCurrent(source);
|
|
417
|
+
const current = await readCurrent(source, undefined, session.environment, session.read);
|
|
384
418
|
if (current !== snapshot.contentBySource.get(source)) {
|
|
385
419
|
snapshot = await this.#refresh(session);
|
|
386
420
|
if (!snapshot.complete) return missingCompleteAnchor();
|
|
@@ -393,7 +427,8 @@ export class SearchSessionStore {
|
|
|
393
427
|
const source = selected[0]?.source;
|
|
394
428
|
if (
|
|
395
429
|
source !== undefined &&
|
|
396
|
-
(await readCurrent(source
|
|
430
|
+
(await readCurrent(source, undefined, session.environment, session.read)) !==
|
|
431
|
+
snapshot.contentBySource.get(source)
|
|
397
432
|
) {
|
|
398
433
|
return staleAnchor(selected[0]?.lineNumber);
|
|
399
434
|
}
|
|
@@ -426,15 +461,21 @@ export class SearchSessionStore {
|
|
|
426
461
|
async #refresh(session: StoredSearchSession, signal?: AbortSignal): Promise<SearchSnapshot> {
|
|
427
462
|
const result =
|
|
428
463
|
session.refresh === undefined
|
|
429
|
-
? await runSearchRecipe(session.recipe, session.cwd, signal)
|
|
464
|
+
? await runSearchRecipe(session.recipe, session.cwd, signal, session.environment)
|
|
430
465
|
: await session.refresh(signal);
|
|
431
466
|
const matches = result.matches
|
|
432
|
-
.map((match) => ({ ...match, source:
|
|
467
|
+
.map((match) => ({ ...match, source: canonicalSource(match.source) }))
|
|
433
468
|
.sort(compareMatches);
|
|
434
469
|
const refreshed: SearchSnapshot = {
|
|
435
470
|
matches,
|
|
436
471
|
complete: result.complete,
|
|
437
|
-
contentBySource: await snapshotContents(
|
|
472
|
+
contentBySource: await snapshotContents(
|
|
473
|
+
matches,
|
|
474
|
+
signal,
|
|
475
|
+
session.snapshotByteBudget,
|
|
476
|
+
session.environment,
|
|
477
|
+
session.read,
|
|
478
|
+
),
|
|
438
479
|
};
|
|
439
480
|
this.#sessions.set(session.id, { ...session, refreshedComplete: refreshed });
|
|
440
481
|
return refreshed;
|
|
@@ -447,6 +488,7 @@ function registerResultReferences(
|
|
|
447
488
|
contents: ReadonlyMap<string, string>,
|
|
448
489
|
cwd: string,
|
|
449
490
|
complete: boolean,
|
|
491
|
+
read: SnapshotReader,
|
|
450
492
|
): Pick<TextSearchSession, "target" | "matchTargets"> {
|
|
451
493
|
if (store === undefined) return {};
|
|
452
494
|
const documents = new Map(
|
|
@@ -456,6 +498,7 @@ function registerResultReferences(
|
|
|
456
498
|
source: match.source,
|
|
457
499
|
expectedContent: requiredValue(contents.get(match.source)),
|
|
458
500
|
ranges: [selectionRange(requiredValue(documents.get(match.source)), match, "match")],
|
|
501
|
+
readCurrent: (signal?: AbortSignal) => read(match.source, signal),
|
|
459
502
|
}));
|
|
460
503
|
return {
|
|
461
504
|
target: store.register(targets, cwd, complete),
|
|
@@ -563,13 +606,15 @@ async function snapshotContents(
|
|
|
563
606
|
matches: readonly TextSearchMatch[],
|
|
564
607
|
signal?: AbortSignal,
|
|
565
608
|
byteBudget?: number,
|
|
609
|
+
environment?: SearchEnvironment,
|
|
610
|
+
read?: SnapshotReader,
|
|
566
611
|
): Promise<ReadonlyMap<string, string>> {
|
|
567
612
|
const sources = [...new Set(matches.map((match) => match.source))];
|
|
568
613
|
if (byteBudget !== undefined) {
|
|
569
614
|
const contents = new Map<string, string>();
|
|
570
615
|
let remaining = byteBudget;
|
|
571
616
|
for (const source of sources) {
|
|
572
|
-
const content = await readBoundedSnapshot(source, remaining, signal);
|
|
617
|
+
const content = await readBoundedSnapshot(source, remaining, signal, environment, read);
|
|
573
618
|
remaining -= Buffer.byteLength(content);
|
|
574
619
|
validateSnapshot(source, content, matches);
|
|
575
620
|
contents.set(source, content);
|
|
@@ -578,10 +623,7 @@ async function snapshotContents(
|
|
|
578
623
|
}
|
|
579
624
|
const snapshots = await Promise.allSettled(
|
|
580
625
|
sources.map(async (source) => {
|
|
581
|
-
const content = await
|
|
582
|
-
encoding: "utf8",
|
|
583
|
-
...(signal !== undefined && { signal }),
|
|
584
|
-
});
|
|
626
|
+
const content = await readOwnedText(source, signal, environment, read);
|
|
585
627
|
validateSnapshot(source, content, matches);
|
|
586
628
|
return [source, content] as const;
|
|
587
629
|
}),
|
|
@@ -610,8 +652,16 @@ async function readBoundedSnapshot(
|
|
|
610
652
|
source: string,
|
|
611
653
|
budget: number,
|
|
612
654
|
signal?: AbortSignal,
|
|
655
|
+
environment?: SearchEnvironment,
|
|
656
|
+
read?: SnapshotReader,
|
|
613
657
|
): Promise<string> {
|
|
614
658
|
signal?.throwIfAborted();
|
|
659
|
+
if (source.includes("://")) {
|
|
660
|
+
const content = await readOwnedText(source, signal, environment, read);
|
|
661
|
+
if (Buffer.byteLength(content) > budget)
|
|
662
|
+
throw new Error("Candidate snapshot byte budget reached.");
|
|
663
|
+
return content;
|
|
664
|
+
}
|
|
615
665
|
const file = await open(source, "r");
|
|
616
666
|
try {
|
|
617
667
|
const info = await file.stat();
|
|
@@ -633,14 +683,40 @@ async function readBoundedSnapshot(
|
|
|
633
683
|
await file.close();
|
|
634
684
|
}
|
|
635
685
|
}
|
|
636
|
-
async function readCurrent(
|
|
686
|
+
async function readCurrent(
|
|
687
|
+
source: string,
|
|
688
|
+
signal?: AbortSignal,
|
|
689
|
+
environment?: SearchEnvironment,
|
|
690
|
+
read?: SnapshotReader,
|
|
691
|
+
): Promise<string | undefined> {
|
|
637
692
|
try {
|
|
638
|
-
return await
|
|
693
|
+
return await readOwnedText(source, signal, environment, read);
|
|
639
694
|
} catch {
|
|
640
695
|
return undefined;
|
|
641
696
|
}
|
|
642
697
|
}
|
|
643
698
|
|
|
699
|
+
function canonicalSource(source: string): string {
|
|
700
|
+
return source.includes("://") ? source : path.resolve(source);
|
|
701
|
+
}
|
|
702
|
+
function resolveScope(cwd: string, source: string): string {
|
|
703
|
+
if (source.includes("://")) return source;
|
|
704
|
+
return cwd.includes("://")
|
|
705
|
+
? new URL(source, cwd.endsWith("/") ? cwd : cwd + "/").href
|
|
706
|
+
: path.resolve(cwd, source);
|
|
707
|
+
}
|
|
708
|
+
async function readOwnedText(
|
|
709
|
+
source: string,
|
|
710
|
+
signal?: AbortSignal,
|
|
711
|
+
environment?: SearchEnvironment,
|
|
712
|
+
read?: SnapshotReader,
|
|
713
|
+
): Promise<string> {
|
|
714
|
+
signal?.throwIfAborted();
|
|
715
|
+
if (read !== undefined) return read(source, signal);
|
|
716
|
+
if (environment !== undefined) return environment.readText(source, signal);
|
|
717
|
+
if (source.includes("://")) throw new Error("No search snapshot owner for this source.");
|
|
718
|
+
return readFile(source, { encoding: "utf8", ...(signal !== undefined && { signal }) });
|
|
719
|
+
}
|
|
644
720
|
function staleAnchor(
|
|
645
721
|
lineNumber = 1,
|
|
646
722
|
): Extract<TextAnchorResolutionAttempt, { readonly kind: "rejected" }> {
|
|
@@ -5,7 +5,7 @@ import type { SearchPluginApi } from "#src/api/search.js";
|
|
|
5
5
|
|
|
6
6
|
export const SEARCH_PROTOCOL = "pi-agent-search" as const;
|
|
7
7
|
|
|
8
|
-
export const SEARCH_API_VERSION =
|
|
8
|
+
export const SEARCH_API_VERSION = 5 as const;
|
|
9
9
|
|
|
10
10
|
export const SEARCH_CORE_READY_EVENT = "pi-agent-search/core/ready" as const;
|
|
11
11
|
|