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
package/dist/entry-50.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{e as Q,f as K,g as B}from"./chunk-XH5WN5XA.js";import{e as O,f as N}from"./chunk-T7I2VX3J.js";import{a as _,c as x,d as z}from"./chunk-OB46OPMZ.js";import{a as G,b as q,c as U,d as W,g as J}from"./chunk-7UGNGK7Y.js";import{a as L,e as M}from"./chunk-PS2B6THP.js";import{J as V,b as j,c as F,i as H,j as A}from"./chunk-6U5OU77O.js";import{a as i}from"./chunk-EI7MMDWY.js";import{Text as se}from"@earendil-works/pi-tui";import Se from"node:os";function Z(){let e=[],r,a=new Map,s=new Map,d=new Map,y=new Map,b=Promise.resolve(),u={registerPlugin(t){if(t.id.trim().length===0)return Promise.reject(new Error("Plugin ID must not be empty"));let o=y.get(t.id);if(o!==void 0)return o;let p=b.then(async()=>{let S=[],l=[],f,w,h=[],E={addSelectionProvider(n){if(f!==void 0||r!==void 0)throw new Error("Search selection provider is already registered");f=n},registerSelection(n,R){if(r===void 0)throw new Error("Search selections are unavailable. Enable the shared search selection plugin.");return r(n,R)},addResolver(n){de(n),S.push(n)},addAction(n){le(n),l.push(n)},describe(n){if(w!==void 0)throw new Error(`Plugin ${t.id} provides more than one description`);w=Y(n)},addPromptGuideline(n){h.push(Y(n))},search:i((n,R,g)=>u.execute(n,R,g),"search"),runAction(n,R){return u.runAction(n.reference,n.capability,n.resolverId,n.input,R)}};await t.setup(E);let c=new Set(e.map(({registration:n})=>n.resolver.id));for(let n of S){if(c.has(n.resolver.id))throw new Error(`Search resolver ${n.resolver.id} is already registered`);c.add(n.resolver.id)}for(let n of l){let R=D(n.resolverId,n.capability);if(a.has(R)||l.some(g=>g!==n&&D(g.resolverId,g.capability)===R))throw new Error(`Search action ${R} is already registered`)}for(let n of S)e.push({pluginId:t.id,registration:n,order:e.length});f!==void 0&&(r=f);for(let n of l)a.set(D(n.resolverId,n.capability),n);w!==void 0&&d.set(t.id,w),h.length>0&&s.set(t.id,h)});return y.set(t.id,p),b=p.catch(()=>{}),p.catch(()=>{y.delete(t.id)}),p},async waitForPendingPlugins(){await Promise.all(y.values())},async execute(t,o,p="agent"){if(t.query.trim().length===0)return v("INVALID_REQUEST","Search query must not be empty");if(t.navigation!==void 0&&!t.query.startsWith("symbols:"))return v("INVALID_REQUEST","navigation is supported only for symbols: queries.");let S=[...e].sort((h,E)=>+(h.registration.fallback===!0)-+(E.registration.fallback===!0)||(h.registration.priority??0)-(E.registration.priority??0)||h.order-E.order),l=/^[a-z][\w-]*:\s*$/iu.test(t.query),f=/^[a-z][\w-]*:/iu.test(t.query);for(let h of S){if(o.scope!==void 0&&h.registration.resolver.supportsResultScope!==!0)continue;let E=/^(?:ast|symbols):/u.test(t.query);if(h.registration.fallback&&E&&o.scope!==void 0||l&&!h.registration.fallback&&o.scope===void 0)continue;let c=h.registration.resolver;try{let n=Promise.resolve().then(async()=>{let g=await c.readResources?.(t,o);return g===void 0?[{resource:"*",mode:"read"}]:(await Promise.all(g.map(m=>F(m,o.cwd,"read")))).flat()}),R=await j.run(n,async()=>{let g;try{o.signal?.throwIfAborted(),g=await c.tryResolve(t,o)}catch(m){return v("RESOLVE_FAILED",I(m,`Resolver ${c.id} failed`),c.id,m)}if(!ue(g))return v("INVALID_RESOLVER_RESULT",`Resolver ${c.id} returned an invalid result`,c.id);if(g.kind!=="not-handled"){if(g.kind==="failed")return v("RESOLVE_FAILED",I(g.error,`Resolver ${c.id} failed`),c.id,g.error);try{let m=await c.format(g.payload,o);if(!fe(m))return v("FORMAT_FAILED",`Resolver ${c.id} formatter returned an invalid result`,c.id);let T=c.toScriptData?.(g.payload,m.details),ce=T===void 0;return A({content:[...h.registration.fallback&&f?[{type:"text",text:l?"Search fallback: empty protocol query; searched the original text.":"Search fallback: unhandled protocol query; searched the original text."},...m.content]:m.content,...k(T)&&T.complete===!1?[{type:"text",text:"Search coverage is incomplete. Do not conclude absence or use this result as an edit scope."}]:[]],details:{resolverId:c.id,payload:m.details},...p==="script"&&{script:{resolverId:c.id,data:g.payload,details:m.details}},...m.usage!==void 0&&{usage:m.usage}},x,ce?{status:"error",errors:[{code:"STRUCTURED_ADAPTER_REQUIRED",message:`Search resolver ${c.id} must provide toScriptData`}]}:m.isError?{status:"error",data:T,errors:[{code:"RESOLVE_FAILED",message:`Search resolver ${c.id} returned an error`}]}:{status:"success",data:T,errors:[]})}catch(m){return v("FORMAT_FAILED",I(m,`Resolver ${c.id} formatter failed`),c.id,m)}}},o.signal);if(R!==void 0)return R}catch(n){return v("RESOLVE_FAILED",I(n,`Resolver ${c.id} failed`),c.id,n)}}let w=`No search resolver handled ${t.query}`;return Q(v("NO_RESOLVER",w),w)},runAction(t,o,p,S,l){let f=a.get(D(p,o));if(f===void 0)throw new Error(`Search reference does not support ${o}`);return f.execute(t,S,l)},renderDescriptions(){return[...d.values()].flatMap(t=>{let o=X(t);return o===void 0?[]:[o]})},renderPromptGuidelines(){return[...s.values()].flat().flatMap(t=>{let o=X(t);return o===void 0?[]:[o]})},renderer(t){return e.find(({registration:o})=>o.resolver.id===t)?.registration.resolver.renderResult}};return u}i(Z,"createSearchCore");function de(e){if(!k(e)||!k(e.resolver))throw new TypeError("Invalid search resolver registration");let r=e.resolver;if(typeof r.id!="string"||r.id.trim().length===0||typeof r.tryResolve!="function"||typeof r.format!="function")throw new TypeError("Invalid search resolver registration");if(e.priority!==void 0&&(typeof e.priority!="number"||!Number.isFinite(e.priority)))throw new TypeError("Invalid search resolver priority")}i(de,"assertResolver");function le(e){if(!k(e)||typeof e.resolverId!="string"||e.resolverId.trim().length===0||typeof e.capability!="string"||e.capability.trim().length===0||typeof e.execute!="function")throw new TypeError("Invalid search action registration")}i(le,"assertAction");function k(e){return typeof e=="object"&&e!==null}i(k,"isRecord");function ue(e){if(typeof e!="object"||e===null||!("kind"in e))return!1;let r=e.kind;return r==="not-handled"||r==="resolved"&&"payload"in e||r==="failed"&&"error"in e}i(ue,"isAttempt");function fe(e){return typeof e=="object"&&e!==null&&Array.isArray(e.content)}i(fe,"isAgentToolResult");function v(e,r,a,s){return A({isError:!0,content:[{type:"text",text:r}],details:{failure:{code:e,message:r,...a!==void 0&&{resolverId:a},...s!==void 0&&{cause:s}}}},x,{status:"error",errors:[{code:e,message:r}]})}i(v,"failure");function Y(e){if(typeof e=="function")return e;if(typeof e!="string"||e.trim().length===0)throw new TypeError("Search description must not be empty");return e.trim()}i(Y,"normalizeDescriptionSource");function X(e){let r=typeof e=="function"?e():e;if(r!==void 0){if(typeof r!="string"||r.trim().length===0)throw new TypeError("Search description must not be empty");return r.trim()}}i(X,"renderDescription");function D(e,r){return`${e}:${r}`}i(D,"actionKey");function I(e,r){return!(e instanceof Error)||e.message.trim().length===0?r:e instanceof SyntaxError?e.message:`${r}: ${e.message}`}i(I,"messageFor");import{readFile as pe}from"node:fs/promises";import he from"node:os";import C from"node:path";var ge=3e4;function re(e=process.env,r=he.homedir(),a=process.cwd()){let s=e.PI_CODING_AGENT_DIR?.trim(),d=s===void 0||s.length===0?C.join(r,".pi","agent"):C.resolve(s);return{globalPath:C.join(d,"pi-agent-ide","search.json"),projectPath:C.resolve(a,".pi","pi-agent-ide","search.json")}}i(re,"resolveSearchConfigPaths");async function te(e){let[r,a]=await Promise.all([ee(e.globalPath),ee(e.projectPath)]),s=a!==void 0?a:r;return{timeoutMs:s===void 0?ge:s}}i(te,"loadSearchConfig");async function ee(e){let r;try{r=await pe(e,"utf8")}catch(y){if(me(y))return;throw new Error(`Cannot read Pi Agent IDE search config at ${e}`,{cause:y})}let a;try{a=JSON.parse(r)}catch(y){throw new Error(`Invalid JSON in Pi Agent IDE search config at ${e}`,{cause:y})}if(!ne(a))throw new TypeError(`Pi Agent IDE search config at ${e} must be a JSON object`);let s=Object.keys(a).find(y=>y!=="timeoutMs");if(s!==void 0)throw new TypeError(`Pi Agent IDE search config at ${e} contains unknown key ${s}`);let d=a.timeoutMs;if(d==null)return d;if(typeof d!="number"||!Number.isSafeInteger(d)||d<=0)throw new TypeError(`timeoutMs must be a positive integer or null in Pi Agent IDE search config at ${e}`);return d}i(ee,"readTimeout");function me(e){return ne(e)&&e.code==="ENOENT"}i(me,"isMissingFile");function ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(ne,"isRecord");var oe=Symbol("search-timeout"),$=class extends Error{static{i(this,"SearchTimeoutError")}constructor(r){super(r),this.name="SearchTimeoutError"}};async function ie(e,r,a){if(e===null)return a(r);let s=new AbortController,d=r===void 0?s.signal:AbortSignal.any([r,s.signal]),y,b=new Promise(u=>{y=setTimeout(()=>{u(oe),s.abort()},e)});try{let u=await Promise.race([a(d),b]);if(u===oe)throw new $(`Search timed out after ${ye(e)}. Try a smaller path scope.`);return u}finally{clearTimeout(y)}}i(ie,"runWithSearchTimeout");function ye(e){if(e%1e3!==0)return`${String(e)}ms`;let r=e/1e3;return`${String(r)} ${r===1?"second":"seconds"}`}i(ye,"formatDuration");function we(e,r){let a=[...e.path===void 0?[]:[{text:typeof e.path=="string"?`in ${e.path}`:"in result scope",color:"accent",underline:!0,truncate:"start"}],...e.navigation===void 0?[]:[{text:"reference navigation",color:"warning"}],...e.include===void 0?[]:[{text:`include ${e.include}`}],...e.exclude===void 0?[]:[{text:`exclude ${e.exclude}`}],...e.caseSensitive===!0?[{text:"case sensitive"}]:[],...e.wholeWord===!0?[{text:"whole word"}]:[],...e.limit===void 0?[]:[{text:`limit ${String(e.limit)}`}]];return{tool:"search",primary:{text:JSON.stringify(e.query),color:"accent",truncate:"end"},qualifiers:a,details:ve(e),expanded:r}}i(we,"searchCallModel");function Re(e){return e==="full"||e==="disabled"?e:"compact"}i(Re,"parsePresentation");async function ae(e,r){let a=Re(r?.preferences["ui.search"]);N(e,[await O({id:"search-code",description:"Text search, AST patterns, symbols, graphs, and semantic rename",triggers:[{tool:"search"},{tool:"read",resourcePrefixes:["ast:","symbol:","symbols:","graph:"]}]})]);let s=Z(),d=V(e),y=new K,b=e.events.on(W,u=>{if(!J(u))throw new Error("Invalid pi-agent-search plugin registration request");u.accept(s.registerPlugin(u.plugin))});e.on("session_shutdown",b),e.registerTool(B({name:"search",exposure:"direct",namespace:{name:"ide_search",description:"Find workspace text, paths and code structures."},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},label:"search",description:"Use search to find text, file paths, syntax patterns, language symbols, web-page text, and running processes.",promptSnippet:"Search files and text with literals or regular expressions, plus syntax trees and language symbols",get promptGuidelines(){return["Use the narrowest useful search query and scope; broaden when needed.",...s.renderPromptGuidelines()]},parameters:_,outputSchema:z,renderCall(u,t,o){let p=o.expanded?"full":a;return p==="disabled"?new se(t.fg("toolTitle","search"),0,0):M(o.lastComponent,we(u,p==="full"),t)},renderResult(u,t,o,p){let S=t.expanded?"full":a;if(S==="disabled"&&!p.isError&&!t.isPartial)return new se(o.fg("success","\u2713 search"),0,0);t={...t,expanded:S==="full"};let l=u.details,f=l?.resolverId===void 0?void 0:s.renderer(l.resolverId);if(f!==void 0&&l?.payload!==void 0&&!p.isError&&!t.isPartial){let w={...u,details:l.payload};return f(w,t,o,p)}return Ee(u,t,o)},async execute(u,t,o,p,S){try{let l=await te(re(process.env,Se.homedir(),S.cwd));return await ie(l.timeoutMs,o,async f=>{await s.waitForPendingPlugins();let w=t.path!==void 0&&(typeof t.path!="string"||t.path.startsWith("RESULT#")),h=w?d.resolve(t.path,S.cwd):void 0;if(h!==void 0&&(await d.verify(h,f),/^(?:files|symbol|graph|process):/u.test(t.query)))throw new Error("This query provider does not support result scopes yet.");return s.execute({...t,path:typeof t.path=="string"&&!w?t.path:void 0},{cwd:S.cwd,...h===void 0?{}:{scope:h},...f!==void 0&&{signal:f},...p!==void 0&&{onUpdate:p}})})}catch(l){if(o?.aborted)throw l;let f=l instanceof Error?l.message:String(l);return A({content:[{type:"text",text:f}],details:{failure:{code:"RESOLVE_FAILED",message:f}}},x,{status:"error",errors:[H(l,"SEARCH_FAILED")]})}}},y)),e.events.emit(U,{protocol:G,apiVersion:q}),await s.waitForPendingPlugins()}i(ae,"registerSearchCore");function ve(e){return[{label:"query",value:JSON.stringify(e.query)},...P("path",e.path===void 0?void 0:typeof e.path=="string"?e.path:"result scope"),...P("navigation",e.navigation),...P("include",e.include),...P("exclude",e.exclude),...P("caseSensitive",e.caseSensitive===void 0?void 0:String(e.caseSensitive)),...P("wholeWord",e.wholeWord===void 0?void 0:String(e.wholeWord)),...P("limit",e.limit===void 0?void 0:String(e.limit))]}i(ve,"searchCallDetails");function P(e,r){return r===void 0?[]:[{label:e,value:r}]}i(P,"optionalDetail");function Ee(e,r,a){let s=e.content.flatMap(d=>d.type==="text"?[d.text]:[]).join(`
|
|
2
|
-
`);return new L({summary:e.details&&typeof e.details=="object"&&"failure"in e.details?"Search failed":"Search results",rows:s.split(`
|
|
3
|
-
`).map(d=>({kind:"note",text:d}))},a,r.expanded)}i(Ee,"fallbackResult");export{ae as default};
|
|
1
|
+
import{a as b,b as c,c as g,d as h,e as i,f as j,g as k,h as l,i as m}from"./chunk-BIG45IPN.js";import{a,c as d,d as e,e as f}from"./chunk-SSWUUBIR.js";import"./chunk-PS2B6THP.js";import"./chunk-R5XJSEOE.js";import"./chunk-EI7MMDWY.js";export{j as FuzzyVocabulary,c as containsSearchMatch,m as formatFuzzyCandidate,l as fuzzyCandidateData,g as fuzzyLimits,i as isFuzzyQuery,h as isFuzzyResultData,k as rankFuzzyIdentifiers,b as renderSearchMatches,d as searchDataSchema,e as searchOutputSchema,a as searchSchema,f as selectionData};
|
package/dist/entry-51.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import{a as v,b as ee,c as te,d as re,e as ne,f as se,g as Re,k as ue}from"./chunk-Q6CZ6GBR.js";import"./chunk-PLKYHUNT.js";import{a as ce,b as le}from"./chunk-H445SHSJ.js";import{a as oe,b as A,c as ae,d as ie}from"./chunk-ZIWPKIBZ.js";import{a as _}from"./chunk-MGCHOGQD.js";import{a as F,b as H}from"./chunk-T6LX2RX5.js";import{a as G}from"./chunk-KOVPDKSJ.js";import{a as M,b as j,d as B}from"./chunk-SJ4UZ4GU.js";import{c as b,e as U,f as X,g as Z,h as K,i as Y}from"./chunk-STBJO3Z3.js";import{e as Q}from"./chunk-OB46OPMZ.js";import{a as J}from"./chunk-ZTYWHL2F.js";import{a as V,b as W}from"./chunk-7UGNGK7Y.js";import{a as D}from"./chunk-PS2B6THP.js";import{J as L}from"./chunk-6U5OU77O.js";import{m as I}from"./chunk-ZPT5D4VP.js";import{d as N,e as O}from"./chunk-N34ATN52.js";import"./chunk-ZC65Z3CK.js";import{a as d}from"./chunk-EI7MMDWY.js";var de={protocol:F,apiVersion:1,id:"search-text",setup(t){t.addSetupCheck({id:"ripgrep",async inspect(s){let e=v(s.env.PI_CODING_AGENT_DIR);return await N(e,s.cwd,s.env)?{}:{actions:[{id:"ripgrep-unavailable",message:"Local search is unavailable because ripgrep was not found"}]}}}),t.addCheck({id:"ripgrep",title:"Local search",async run(s){let e=s.env.PI_CODING_AGENT_DIR,r=v(e),n=await O(r,["--version"],s.cwd,s.env);return[n.ok?{status:"pass",message:"ripgrep is available",detail:n.detail}:{status:"fail",message:"ripgrep is not available",detail:n.detail}]}})}};import k from"node:path";import{pathToFileURL as $e}from"node:url";import{readFile as we}from"node:fs/promises";async function $(t,s,e,r){if(t.include!==void 0||t.exclude!==void 0)throw new Error("Include/exclude globs are unsupported for result scopes; filter the target array instead.");let n=d(async(l,p=t.condition)=>{let f=[],g=new Set;for(let u of s.targets){if(r?.throwIfAborted(),await we(u.source,{encoding:"utf8",signal:r})!==u.expectedContent)throw new Error("Result target is stale; repeat Read/Search.");let c=I(u.source,u.expectedContent),m=[0];for(let h of c.lines)m.push((m.at(-1)??0)+h.content.length+h.lineEnding.length);for(let h of u.ranges){let y=(m[h.start.lineNumber-1]??c.content.length)+h.start.column,S=(m[h.end.lineNumber-1]??c.content.length)+h.end.column,x=await re({...t,query:l,condition:p},c.content.slice(y,S),e,r);for(let R of x.matches){let w=h.start.lineNumber+R.lineNumber-1,C=R.lineNumber===1?h.start.column:0,z={...R,source:u.source,lineNumber:w,startColumn:R.startColumn+C,endColumn:R.endColumn+C,lineText:c.lines[w-1]?.content??""},P=JSON.stringify([z.source,w,z.startColumn,z.endColumn]);g.has(P)||(g.add(P),f.push(z))}}}return f.sort((u,c)=>u.source.localeCompare(c.source)||u.lineNumber-c.lineNumber||u.startColumn-c.startColumn||u.endColumn-c.endColumn),{matches:f,complete:s.complete}},"search"),o=t.query,a=await n(o),i=[];for(let l of t.fallbacks??[]){if(a.matches.length>0||!a.complete)break;try{a=await n(l.query,l.condition),o=l.query,i.push(l.mode==="regex"?"Search fallback: no literal matches; tried unquoted terms as regex.":"Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.")}catch(p){if(r?.aborted||l.mode!=="regex"||!(p instanceof Error)||!/regex parse error:|PCRE2: error compiling pattern/iu.test(p.message))throw p;i.push("Search fallback: invalid regex skipped; literal search found no matches.")}}return{...a,query:o,notices:i}}d($,"runScopedSearch");import{spawn as ve}from"node:child_process";import T from"node:path";function pe(t,s,e,r){let n=s.limit??100,o=["--files","--hidden","--no-config","--no-ignore-parent","--glob","!.git/**"];for(let a of fe(s.include))o.push("--glob",a);for(let a of fe(s.exclude))o.push("--glob",`!${a}`);return s.path!==void 0&&o.push(s.path),new Promise((a,i)=>{let l=ve(v(),o,{cwd:e,stdio:["ignore","pipe","pipe"]}),p="",f="";l.stdout.setEncoding("utf8"),l.stderr.setEncoding("utf8"),l.stdout.on("data",u=>p+=u),l.stderr.on("data",u=>f+=u);let g=d(()=>{l.kill("SIGTERM")},"abort");r?.addEventListener("abort",g,{once:!0}),l.once("error",i),l.once("close",u=>{if(r?.removeEventListener("abort",g),r?.aborted===!0){i(r.reason instanceof Error?r.reason:new Error("File search aborted"));return}if(u!==0&&u!==1){i(new Error(f.trim()||`rg exited with code ${String(u)}`));return}let c=p.split(`
|
|
2
|
-
`)
|
|
3
|
-
`)
|
|
4
|
-
|
|
5
|
-
`)}],details:{...f,...i?.target===void 0?{}:{target:i.target,matchTargets:[]},fuzzyPresentation:ae(o.fuzzy.candidates,n.cwd),fuzzy:y}}}let l=o.request.limit??50;if(o.matches.length===0)return{content:[{type:"text",text:[...o.notices,"No matches found."].join(`
|
|
6
|
-
`)}],details:{...A(o.request.query,[],o.complete,n.cwd),...i?.target===void 0?{}:{target:i.target,matchTargets:[]}}};let p=i??{query:o.request.query,matches:o.matches,complete:o.complete};return{content:[{type:"text",text:[...o.notices,qe(p,n.cwd,l,i!==void 0)].join(`
|
|
7
|
-
`)}],details:{...A(p.query,p.matches,p.complete,n.cwd,i?.id,l),...i?.target===void 0?{}:{target:i.target,matchTargets:i.matchTargets}}}},renderResult:le}}d(xe,"createMatchResolver");function qe(t,s,e,r=!0){let n=new Set(t.matches.map(u=>u.source)).size,o=t.matches.length,a=`${String(o)}${t.complete?"":"+"} ${he(o,"match","matches")} in ${String(n)} ${he(n,"file","files")}`,i=r?t.complete?`SEARCH#${t.id}:all:line / SEARCH#${t.id}:all:match \u2014 ${a}`:`${a} (incomplete results; no all anchors were registered)`:`${a} (files changed during search; results shown without anchors)`,l=r?[ge,i]:[i],p=new Map(t.matches.map((u,c)=>[u,c+1])),f=oe(t.matches,e);for(let[u,c]of f.files.entries()){u>0&&l.push("");let m=Ie(c.source,s);if(c.kind==="compacted"){l.push(`${m}: ${String(c.matchCount)} matches across ${String(c.uniqueLineCount)} unique line texts (compacted)`);for(let h of c.groups)l.push(` \xD7${String(h.matchCount)} ${Pe(h.text)}`);c.groups.length<c.uniqueLineCount&&l.push(` \u2026 ${String(c.uniqueLineCount-c.groups.length)} more unique line texts`),l.push(` Search again with path: ${JSON.stringify(m)} and a narrower query to see individual matches.`);continue}for(let h of c.matches){let y=p.get(h);if(y===void 0)continue;let S=`${m}:${String(h.lineNumber)}:${String(h.startColumn+1)}-${String(h.endColumn+1)}`;l.push(r?`${S} SEARCH#${t.id}:${String(y)}:line SEARCH#${t.id}:${String(y)}:match`:S,` ${ke(h)}`)}}let g=n-f.files.length;if(g>0){let u=f.files.reduce((c,m)=>c+(m.kind==="detailed"?m.matches.length:m.matchCount),0);l.push(`
|
|
8
|
-
\u2026 ${g} more files (${o-u} matches) not displayed. Narrow path, include, or query to see them.`)}return l.join(`
|
|
9
|
-
`)}d(qe,"formatSearchSession");function ke(t){let e=Math.max(0,t.startColumn-64),r=Math.min(t.lineText.length,t.endColumn+64);return`${e>0?"\u2026":""}${t.lineText.slice(e,t.startColumn)}\u27E6${t.lineText.slice(t.startColumn,t.endColumn)}\u27E7${t.lineText.slice(t.endColumn,r)}${r<t.lineText.length?"\u2026":""}`}d(ke,"previewMatch");function Pe(t){return`${t.slice(0,129)}${t.length>129?"\u2026":""}`}d(Pe,"previewLine");function Ie(t,s){let e=k.relative(s,t);return e.length>0&&!e.startsWith("..")&&!k.isAbsolute(e)?e:t}d(Ie,"displaySource");function he(t,s,e){return t===1?s:e}d(he,"plural");async function Ne(t){let s=new ue(void 0,L(t));t.on("tool_result",async(e,r)=>{if(e.toolName!=="replace"||e.isError||typeof e.details!="object"||e.details===null)return;let n="metadata"in e.details?e.details.metadata:void 0,o=n&&typeof n=="object"&&"searchObservations"in n?n.searchObservations:void 0,a=Array.isArray(o)?o:await s.observeAfterEdit([e.input.path,e.input.start,e.input.end],r.signal);if(a.length!==0)return{content:[...e.content,{type:"text",text:["Original search observed after editing (not task validation):",...a.map(i=>{let{query:l,fallbacks:p,...f}=i.scope;return[`SEARCH#${i.sessionId}: ${JSON.stringify(i.query)}`,`Scope and options: ${JSON.stringify(f)}`,i.error===void 0?`Matches: ${i.matches}${i.complete===!0?"; complete search.":"+; incomplete search, lower bound only."}`:`Search failed: ${i.error}. Applied edits remain applied.`,...i.notices??[]].join(`
|
|
10
|
-
`)})].join(`
|
|
11
|
-
`)}],details:{...e.details,searchObservations:a},...e.structuredContent===void 0?{}:{structuredContent:e.structuredContent}}}),t.on("tool_result",e=>{if(e.toolName!=="search"||typeof e.details!="object"||e.details===null)return;let r=e.details;if(ie(r.payload))return{details:{...r,payload:ce(r.payload,e.content.flatMap(n=>n.type==="text"?[n.text]:[]).join(`
|
|
12
|
-
`))}}}),await Promise.all([_(t,de),J(t,{protocol:V,apiVersion:W,id:"local",setup(e){e.addSelectionProvider((r,n)=>s.register(r.request.query,r.matches,r.complete,n.cwd,n.signal,{...r.request,regex:!1},r.refresh)),e.addResolver({resolver:Se(s),priority:-10}),e.addResolver({resolver:be(),priority:-10}),e.addResolver({resolver:ye(s),fallback:!0}),e.describe(["Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching; files:<pattern> searches file paths: glob patterns use *, **, ?, character classes and braces; other queries use case-insensitive subsequence matching. Slash-containing globs match cwd-relative paths; basename globs match at any depth.","After a complete zero result, a single unquoted ASCII identifier may produce separate possible-name groups: naming-style changes, one leading/trailing component, then small typos. Each group reports a verified case-sensitive whole-identifier alternative in the same scope, its count/completeness, and Read references. Budget skips are explicit. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. Registered local candidate selections also expose strict snapshot targets. Result scopes stay exact and do not run this extra branch.","The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.","SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.","Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections."].join(`
|
|
13
|
-
`))}}),G(t,{protocol:M,apiVersion:j,id:"search-anchors",setup(e){e.tool("replace").addHandler({stage:"text-post-edit",async handler(r){if(!r.result||typeof r.result!="object"||!("kind"in r.result)||r.result.kind!=="completed"||!r.input||typeof r.input!="object")return r;let n=r.input,o=await s.observeAfterEdit([n.path,n.start,n.end],r.signal);return o.length===0?r:{...r,metadata:{...r.metadata,searchObservations:o}}}}),e.addAnchorResolver({resolver:s.anchorResolver(),resources:s.resourceResolver(),kind:B,type:"auxiliary",describeInPrompt:!1})}})])}d(Ne,"registerTextSearch");export{Re as createSearchSessionId,Ne as default};
|
|
1
|
+
import{e as X,f as Z,g as ee}from"./chunk-XH5WN5XA.js";import{e as F,f as j}from"./chunk-T7I2VX3J.js";import{a as _,b as J,c as z,d as Q,g as K}from"./chunk-RAZP42IQ.js";import{a as B,c as C,d as Y}from"./chunk-SSWUUBIR.js";import{a as q,e as H}from"./chunk-PS2B6THP.js";import{K as W,b as V,c as G,i as U,j as k}from"./chunk-R5XJSEOE.js";import{a as i}from"./chunk-EI7MMDWY.js";import{Text as le}from"@earendil-works/pi-tui";import Re from"node:os";function ne(e){let r=[],l=[],a,c=new Map,w=new Map,I=new Map,p=new Map,u=Promise.resolve(),R={registerPlugin(o){if(o.id.trim().length===0)return Promise.reject(new Error("Plugin ID must not be empty"));let t=p.get(o.id);if(t!==void 0)return t;let f=u.then(async()=>{let d=[],E=[],y=[],T,A,h=[],v={addEnvironmentProvider(n){E.push(n)},addSelectionProvider(n){if(T!==void 0||a!==void 0)throw new Error("Search selection provider is already registered");T=n},registerSelection(n,S){if(a===void 0)throw new Error("Search selections are unavailable. Enable the shared search selection plugin.");return a(n,S)},addResolver(n){fe(n),d.push(n)},addAction(n){pe(n),y.push(n)},describe(n){if(A!==void 0)throw new Error(`Plugin ${o.id} provides more than one description`);A=re(n)},addPromptGuideline(n){h.push(re(n))},search:i((n,S,m)=>R.execute(n,S,m),"search"),runAction(n,S){return R.runAction(n.reference,n.capability,n.resolverId,n.input,S)}};await o.setup(v);let s=new Set(r.map(({registration:n})=>n.resolver.id));for(let n of d){if(s.has(n.resolver.id))throw new Error(`Search resolver ${n.resolver.id} is already registered`);s.add(n.resolver.id)}for(let n of y){let S=$(n.resolverId,n.capability);if(c.has(S)||y.some(m=>m!==n&&$(m.resolverId,m.capability)===S))throw new Error(`Search action ${S} is already registered`)}for(let n of d)r.push({pluginId:o.id,registration:n,order:r.length});T!==void 0&&(a=T),l.push(...E);for(let n of y)c.set($(n.resolverId,n.capability),n);A!==void 0&&I.set(o.id,A),h.length>0&&w.set(o.id,h)});return p.set(o.id,f),u=f.catch(()=>{}),f.catch(()=>{p.delete(o.id)}),f},async waitForPendingPlugins(){await Promise.all(p.values())},async execute(o,t,f="agent"){let d={...o,path:typeof o.path=="string"?o.path:void 0};if(d.query.trim().length===0)return P("INVALID_REQUEST","Search query must not be empty");if(o.navigation!==void 0&&!o.query.startsWith("symbols:"))return P("INVALID_REQUEST","Reference navigation is supported only for symbols: queries.");try{if(o.path!==void 0&&(typeof o.path!="string"||o.path.startsWith("RESULT#"))){if(e===void 0)throw new Error("Result scopes are unavailable.");if(t.scope!==void 0)throw new Error("Pass one result scope, not two.");let v=e.resolve(o.path,t.cwd);await e.verify(v,t.signal),t={...t,scope:v},d={...d,path:void 0}}if(t.scope!==void 0){let v=t;t={...t,environmentForSource:i(s=>{for(let n of l){let S=n({...d,path:s},v);if(S!==void 0)return S}},"environmentForSource")}}for(let v of t.scope===void 0?l:[]){let s=v(d,t);if(s!==void 0){t={...t,environment:s};break}}}catch(h){return P("RESOLVE_FAILED",x(h,"Search scope is unavailable"),void 0,h)}let E=[...r].sort((h,v)=>+(h.registration.fallback===!0)-+(v.registration.fallback===!0)||(h.registration.priority??0)-(v.registration.priority??0)||h.order-v.order),y=/^[a-z][\w-]*:\s*$/iu.test(d.query),T=/^[a-z][\w-]*:/iu.test(d.query);for(let h of E){if(t.scope!==void 0&&h.registration.resolver.supportsResultScope!==!0)continue;let v=/^(?:ast|symbols):/u.test(d.query);if(h.registration.fallback&&v&&t.scope!==void 0||y&&!h.registration.fallback&&t.scope===void 0)continue;let s=h.registration.resolver;if(!(t.scope!==void 0&&s.supportsResultScope!==!0)&&!(t.scope!==void 0&&h.registration.fallback&&T))try{let n=Promise.resolve().then(async()=>{let m=await s.readResources?.(d,t);return m===void 0?[{resource:"*",mode:"read"}]:(await Promise.all(m.map(async g=>{let b=await G(g,t.cwd,"read");return t.environment!==void 0&&await t.environment.isDirectory(g,t.signal)?b.map(N=>({...N,recursive:!0})):b}))).flat()}),S=await V.run(n,async()=>{let m;try{t.signal?.throwIfAborted(),m=await s.tryResolve(d,t)}catch(g){return P("RESOLVE_FAILED",x(g,`Resolver ${s.id} failed`),s.id,g)}if(!he(m))return P("INVALID_RESOLVER_RESULT",`Resolver ${s.id} returned an invalid result`,s.id);if(m.kind!=="not-handled"){if(m.kind==="failed")return P("RESOLVE_FAILED",x(m.error,`Resolver ${s.id} failed`),s.id,m.error);try{let g=await s.format(m.payload,t);if(!me(g))return P("FORMAT_FAILED",`Resolver ${s.id} formatter returned an invalid result`,s.id);let b=s.toScriptData?.(m.payload,g.details),N=b===void 0;return k({content:[...h.registration.fallback&&T?[{type:"text",text:y?"Search fallback: empty protocol query; searched the original text.":"Search fallback: unhandled protocol query; searched the original text."},...g.content]:g.content,...O(b)&&b.complete===!1?[{type:"text",text:"Search coverage is incomplete. Do not conclude absence or use this result as an edit scope."}]:[]],details:{resolverId:s.id,payload:g.details},...f==="script"&&{script:{resolverId:s.id,data:m.payload,details:g.details}},...g.usage!==void 0&&{usage:g.usage}},C,N?{status:"error",errors:[{code:"STRUCTURED_ADAPTER_REQUIRED",message:`Search resolver ${s.id} must provide toScriptData`}]}:g.isError?{status:"error",data:b,errors:[{code:"RESOLVE_FAILED",message:`Search resolver ${s.id} returned an error`}]}:{status:"success",data:b,errors:[]})}catch(g){return P("FORMAT_FAILED",x(g,`Resolver ${s.id} formatter failed`),s.id,g)}}},t.signal);if(S!==void 0)return S}catch(n){return P("RESOLVE_FAILED",x(n,`Resolver ${s.id} failed`),s.id,n)}}let A=`No search resolver handled ${d.query}`;return X(P("NO_RESOLVER",A),A)},runAction(o,t,f,d,E){let y=c.get($(f,t));if(y===void 0)throw new Error(`Search reference does not support ${t}`);return y.execute(o,d,E)},renderDescriptions(){return[...I.values()].flatMap(o=>{let t=te(o);return t===void 0?[]:[t]})},renderPromptGuidelines(){return[...w.values()].flat().flatMap(o=>{let t=te(o);return t===void 0?[]:[t]})},renderer(o){return r.find(({registration:t})=>t.resolver.id===o)?.registration.resolver.renderResult}};return R}i(ne,"createSearchCore");function fe(e){if(!O(e)||!O(e.resolver))throw new TypeError("Invalid search resolver registration");let r=e.resolver;if(typeof r.id!="string"||r.id.trim().length===0||typeof r.tryResolve!="function"||typeof r.format!="function")throw new TypeError("Invalid search resolver registration");if(e.priority!==void 0&&(typeof e.priority!="number"||!Number.isFinite(e.priority)))throw new TypeError("Invalid search resolver priority")}i(fe,"assertResolver");function pe(e){if(!O(e)||typeof e.resolverId!="string"||e.resolverId.trim().length===0||typeof e.capability!="string"||e.capability.trim().length===0||typeof e.execute!="function")throw new TypeError("Invalid search action registration")}i(pe,"assertAction");function O(e){return typeof e=="object"&&e!==null}i(O,"isRecord");function he(e){if(typeof e!="object"||e===null||!("kind"in e))return!1;let r=e.kind;return r==="not-handled"||r==="resolved"&&"payload"in e||r==="failed"&&"error"in e}i(he,"isAttempt");function me(e){return typeof e=="object"&&e!==null&&Array.isArray(e.content)}i(me,"isAgentToolResult");function P(e,r,l,a){return k({isError:!0,content:[{type:"text",text:r}],details:{failure:{code:e,message:r,...l!==void 0&&{resolverId:l},...a!==void 0&&{cause:a}}}},C,{status:"error",errors:[{code:e,message:r}]})}i(P,"failure");function re(e){if(typeof e=="function")return e;if(typeof e!="string"||e.trim().length===0)throw new TypeError("Search description must not be empty");return e.trim()}i(re,"normalizeDescriptionSource");function te(e){let r=typeof e=="function"?e():e;if(r!==void 0){if(typeof r!="string"||r.trim().length===0)throw new TypeError("Search description must not be empty");return r.trim()}}i(te,"renderDescription");function $(e,r){return`${e}:${r}`}i($,"actionKey");function x(e,r){return!(e instanceof Error)||e.message.trim().length===0?r:e instanceof SyntaxError?e.message:`${r}: ${e.message}`}i(x,"messageFor");import{readFile as ge}from"node:fs/promises";import ye from"node:os";import L from"node:path";var Se=3e4;function ie(e=process.env,r=ye.homedir(),l=process.cwd()){let a=e.PI_CODING_AGENT_DIR?.trim(),c=a===void 0||a.length===0?L.join(r,".pi","agent"):L.resolve(a);return{globalPath:L.join(c,"pi-agent-ide","search.json"),projectPath:L.resolve(l,".pi","pi-agent-ide","search.json")}}i(ie,"resolveSearchConfigPaths");async function se(e){let[r,l]=await Promise.all([oe(e.globalPath),oe(e.projectPath)]),a=l!==void 0?l:r;return{timeoutMs:a===void 0?Se:a}}i(se,"loadSearchConfig");async function oe(e){let r;try{r=await ge(e,"utf8")}catch(w){if(we(w))return;throw new Error(`Cannot read Pi Agent IDE search config at ${e}`,{cause:w})}let l;try{l=JSON.parse(r)}catch(w){throw new Error(`Invalid JSON in Pi Agent IDE search config at ${e}`,{cause:w})}if(!ae(l))throw new TypeError(`Pi Agent IDE search config at ${e} must be a JSON object`);let a=Object.keys(l).find(w=>w!=="timeoutMs");if(a!==void 0)throw new TypeError(`Pi Agent IDE search config at ${e} contains unknown key ${a}`);let c=l.timeoutMs;if(c==null)return c;if(typeof c!="number"||!Number.isSafeInteger(c)||c<=0)throw new TypeError(`timeoutMs must be a positive integer or null in Pi Agent IDE search config at ${e}`);return c}i(oe,"readTimeout");function we(e){return ae(e)&&e.code==="ENOENT"}i(we,"isMissingFile");function ae(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(ae,"isRecord");var ce=Symbol("search-timeout"),M=class extends Error{static{i(this,"SearchTimeoutError")}constructor(r){super(r),this.name="SearchTimeoutError"}};async function de(e,r,l){if(e===null)return l(r);let a=new AbortController,c=r===void 0?a.signal:AbortSignal.any([r,a.signal]),w,I=new Promise(p=>{w=setTimeout(()=>{p(ce),a.abort()},e)});try{let p=await Promise.race([l(c),I]);if(p===ce)throw new M(`Search timed out after ${ve(e)}. Try a smaller path scope.`);return p}finally{clearTimeout(w)}}i(de,"runWithSearchTimeout");function ve(e){if(e%1e3!==0)return`${String(e)}ms`;let r=e/1e3;return`${String(r)} ${r===1?"second":"seconds"}`}i(ve,"formatDuration");function Ee(e,r){let l=[...e.path===void 0?[]:[{text:typeof e.path=="string"?`in ${e.path}`:"in result scope",color:"accent",underline:!0,truncate:"start"}],...e.navigation===void 0?[]:[{text:"reference navigation",color:"warning"}],...e.include===void 0?[]:[{text:`include ${e.include}`}],...e.exclude===void 0?[]:[{text:`exclude ${e.exclude}`}],...e.caseSensitive===!0?[{text:"case sensitive"}]:[],...e.wholeWord===!0?[{text:"whole word"}]:[],...e.limit===void 0?[]:[{text:`limit ${String(e.limit)}`}]];return{tool:"search",primary:{text:JSON.stringify(e.query),color:"accent",truncate:"end"},qualifiers:l,details:be(e),expanded:r}}i(Ee,"searchCallModel");function Pe(e){return e==="full"||e==="disabled"?e:"compact"}i(Pe,"parsePresentation");async function ue(e,r){let l=Pe(r?.preferences["ui.search"]);j(e,[await F({id:"search-code",description:"Text search, AST patterns, symbols, graphs, and semantic rename",triggers:[{tool:"search"},{tool:"read",resourcePrefixes:["ast:","symbol:","symbols:","graph:"]}]})]);let a=W(e),c=ne(a),w=new Z,I=e.events.on(Q,p=>{if(!K(p))throw new Error("Invalid pi-agent-search plugin registration request");p.accept(c.registerPlugin(p.plugin))});e.on("session_shutdown",I),e.registerTool(ee({name:"search",exposure:"direct",namespace:{name:"ide_search",description:"Find workspace text, paths and code structures."},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},label:"search",description:"Use search to find text, file paths, syntax patterns, language symbols, web-page text, and running processes.",promptSnippet:"Search files and text with literals or regular expressions, plus syntax trees and language symbols",get promptGuidelines(){return["Use the narrowest useful search query and scope; broaden when needed.",...c.renderPromptGuidelines()]},parameters:B,outputSchema:Y,renderCall(p,u,R){let o=R.expanded?"full":l;return o==="disabled"?new le(u.fg("toolTitle","search"),0,0):H(R.lastComponent,Ee(p,o==="full"),u)},renderResult(p,u,R,o){let t=u.expanded?"full":l;if(t==="disabled"&&!o.isError&&!u.isPartial)return new le(R.fg("success","\u2713 search"),0,0);u={...u,expanded:t==="full"};let f=p.details,d=f?.resolverId===void 0?void 0:c.renderer(f.resolverId);if(d!==void 0&&f?.payload!==void 0&&!o.isError&&!u.isPartial){let E={...p,details:f.payload};return d(E,u,R,o)}return Te(p,u,R)},async execute(p,u,R,o,t){try{let f=await se(ie(process.env,Re.homedir(),t.cwd));return await de(f.timeoutMs,R,async d=>{await c.waitForPendingPlugins();let E=u.path!==void 0&&(typeof u.path!="string"||u.path.startsWith("RESULT#")),y=E?a.resolve(u.path,t.cwd):void 0;if(y!==void 0&&(await a.verify(y,d),/^(?:files|symbol|graph|process):/u.test(u.query)))throw new Error("This query provider does not support result scopes yet.");return c.execute({...u,path:typeof u.path=="string"&&!E?u.path:void 0},{cwd:t.cwd,...y===void 0?{}:{scope:y},...d!==void 0&&{signal:d},...o!==void 0&&{onUpdate:o}})})}catch(f){if(R?.aborted)throw f;let d=f instanceof Error?f.message:String(f);return k({content:[{type:"text",text:d}],details:{failure:{code:"RESOLVE_FAILED",message:d}}},C,{status:"error",errors:[U(f,"SEARCH_FAILED")]})}}},w)),e.events.emit(z,{protocol:_,apiVersion:J}),await c.waitForPendingPlugins()}i(ue,"registerSearchCore");function be(e){return[{label:"query",value:JSON.stringify(e.query)},...D("path",e.path===void 0?void 0:typeof e.path=="string"?e.path:"result scope"),...D("navigation",e.navigation),...D("include",e.include),...D("exclude",e.exclude),...D("caseSensitive",e.caseSensitive===void 0?void 0:String(e.caseSensitive)),...D("wholeWord",e.wholeWord===void 0?void 0:String(e.wholeWord)),...D("limit",e.limit===void 0?void 0:String(e.limit))]}i(be,"searchCallDetails");function D(e,r){return r===void 0?[]:[{label:e,value:r}]}i(D,"optionalDetail");function Te(e,r,l){let a=e.content.flatMap(c=>c.type==="text"?[c.text]:[]).join(`
|
|
2
|
+
`);return new q({summary:e.details&&typeof e.details=="object"&&"failure"in e.details?"Search failed":"Search results",rows:a.split(`
|
|
3
|
+
`).map(c=>({kind:"note",text:c}))},l,r.expanded)}i(Te,"fallbackResult");export{ue as default};
|
package/dist/entry-52.js
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
import{g as a,
|
|
1
|
+
import{a as v,b as se,c as oe,d as ae,e as ie,f as ce,g as Ce,k as pe}from"./chunk-BQ67M4NC.js";import"./chunk-PLKYHUNT.js";import{a as fe,b as he}from"./chunk-MZXX353D.js";import{a as le,b as E,c as de,d as ue}from"./chunk-4OYVLXWD.js";import{b as re,c as ne}from"./chunk-R2U5WXYR.js";import{a as D}from"./chunk-YJ6T3PEP.js";import{b as F,c as _}from"./chunk-S72FVLUX.js";import{a as J}from"./chunk-2K65BSXS.js";import{c as V,d as G,f as W}from"./chunk-ICDI27GZ.js";import{a as M}from"./chunk-BU7IZLKB.js";import{a as H,b as L}from"./chunk-S5PL5DFQ.js";import{a as Z}from"./chunk-N7LMRL64.js";import{a as Q,b as U}from"./chunk-RAZP42IQ.js";import{c as b,e as K,f as P,g as Y,h as ee,i as te}from"./chunk-BIG45IPN.js";import{e as X}from"./chunk-SSWUUBIR.js";import{a as j}from"./chunk-PS2B6THP.js";import{J as $,K as B}from"./chunk-R5XJSEOE.js";import{m as O}from"./chunk-ZPT5D4VP.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import{a as f}from"./chunk-EI7MMDWY.js";import{readFile as De}from"node:fs/promises";var me={protocol:F,apiVersion:_,id:"search-text",setup(r){r.addSetupCheck({id:"ripgrep",async inspect(o){let s=o.workspace?"rg":v(o.env.PI_CODING_AGENT_DIR);return await ne(o,s)?{}:{actions:[{id:"ripgrep-unavailable",message:"Local search is unavailable because ripgrep was not found"}]}}}),r.addCheck({id:"ripgrep",title:"Local search",async run(o){let s=o.env.PI_CODING_AGENT_DIR,t=o.workspace?"rg":v(s),e=await re(o,t,["--version"]);return[e.ok?{status:"pass",message:"ripgrep is available",detail:e.detail}:{status:"fail",message:"ripgrep is not available",detail:e.detail}]}})}};import I from"node:path";import{pathToFileURL as Ie}from"node:url";async function k(r,o,s,t){if(r.include!==void 0||r.exclude!==void 0)throw new Error("Include/exclude globs are unsupported for result scopes; filter the target array instead.");let e=f(async(c,u=r.condition)=>{let m=[],p=new Set;for(let d of o.targets){t?.throwIfAborted(),await $({targets:[d],complete:o.complete},t);let l=O(d.source,d.expectedContent),g=[0];for(let h of l.lines)g.push((g.at(-1)??0)+h.content.length+h.lineEnding.length);for(let h of d.ranges){let y=(g[h.start.lineNumber-1]??l.content.length)+h.start.column,S=(g[h.end.lineNumber-1]??l.content.length)+h.end.column,w=await ae({...r,query:c,condition:u},l.content.slice(y,S),s.includes("://")?process.cwd():s,t);for(let R of w.matches){let x=h.start.lineNumber+R.lineNumber-1,z=R.lineNumber===1?h.start.column:0,C={...R,source:d.source,lineNumber:x,startColumn:R.startColumn+z,endColumn:R.endColumn+z,lineText:l.lines[x-1]?.content??""},N=JSON.stringify([C.source,x,C.startColumn,C.endColumn]);p.has(N)||(p.add(N),m.push(C))}}}return m.sort((d,l)=>d.source.localeCompare(l.source)||d.lineNumber-l.lineNumber||d.startColumn-l.startColumn||d.endColumn-l.endColumn),{matches:m,complete:o.complete}},"search"),n=r.query,a=await e(n),i=[];for(let c of r.fallbacks??[]){if(a.matches.length>0||!a.complete)break;try{a=await e(c.query,c.condition),n=c.query,i.push(c.mode==="regex"?"Search fallback: no literal matches; tried unquoted terms as regex.":"Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.")}catch(u){if(t?.aborted||c.mode!=="regex"||!(u instanceof Error)||!/regex parse error:|PCRE2: error compiling pattern/iu.test(u.message))throw u;i.push("Search fallback: invalid regex skipped; literal search found no matches.")}}return await $(o,t),{...a,query:n,notices:i}}f(k,"runScopedSearch");import{spawn as Ee}from"node:child_process";import T from"node:path";async function Se(r,o,s,t,e){let n=o.limit??100,a=["--files","--hidden","--no-config","--no-ignore-parent","--glob","!.git/**"];for(let i of ge(o.include))a.push("--glob",i);for(let i of ge(o.exclude))a.push("--glob",`!${i}`);if(e!==void 0){let i=e.resolve(s,o.path??"."),c=await e.isDirectory(i,t),u=c?i:e.dirname(i);a.push("--",c?".":`./${e.basename(i)}`);let m=[],p=await e.runLines(a,u,d=>{let l=d.replace(/^\.\//u,"");ye(l,r)&&m.push(e.resolve(u,d))},t);if(t?.throwIfAborted(),p.code!==0&&p.code!==1)throw new Error(p.stderr||"File search failed.");return m.sort((d,l)=>d.localeCompare(l)),{files:m.slice(0,n),complete:m.length<=n}}if(o.path?.includes("://")||s.includes("://"))throw new Error("No search environment owns this scope.");return o.path!==void 0&&a.push(o.path),new Promise((i,c)=>{let u=Ee(v(),a,{cwd:s,stdio:["ignore","pipe","pipe"]}),m="",p="";u.stdout.setEncoding("utf8"),u.stderr.setEncoding("utf8"),u.stdout.on("data",l=>m+=l),u.stderr.on("data",l=>p+=l);let d=f(()=>{u.kill("SIGTERM")},"abort");t?.addEventListener("abort",d,{once:!0}),u.once("error",c),u.once("close",l=>{if(t?.removeEventListener("abort",d),t?.aborted===!0){c(t.reason instanceof Error?t.reason:new Error("File search aborted"));return}if(l!==0&&l!==1){c(new Error(p.trim()||`rg exited with code ${String(l)}`));return}let g=m.split(`
|
|
2
|
+
`).filter(Boolean).map(h=>T.relative(s,T.resolve(s,h))).filter(h=>ye(h,r)).sort((h,y)=>h.localeCompare(y));i({files:g.slice(0,n),complete:g.length<=n})})})}f(Se,"searchFiles");function ge(r){return r?.split(",").map(o=>o.trim()).filter(Boolean)??[]}f(ge,"splitGlobs");function ye(r,o){if(/[*?[\]{}]/u.test(o)){let s=o.replace(/^\.\//u,"");return T.matchesGlob(s.includes("/")?r:T.basename(r),s)}return Te(r,o)}f(ye,"matchFile");function Te(r,o){if(o.length===0)return!0;let s=0,t=r.toLowerCase();for(let e of o.toLowerCase()){if(s=t.indexOf(e,s),s===-1)return!1;s+=1}return!0}f(Te,"fuzzyMatch");import{spawn as $e}from"node:child_process";import{stat as Pe}from"node:fs/promises";async function be(r,o,s,t){let e=AbortSignal.timeout(b.timeoutMs),n=s===void 0?e:AbortSignal.any([s,e]);try{if(n.throwIfAborted(),t!==void 0&&t.byteSize===void 0)return A("source owner cannot bound candidate snapshots");let a=await qe(r,o,n,t);if(a.limited)return A("name collection reached its byte or unique-name budget");let i=[],c=0,u=new Set;for(let m of Y(r.query,a.names)){n.throwIfAborted();let p=await q({...r,query:m.identifier},o,n,t);if(p.matches.length===0){if(!p.complete)return A("candidate verification reached its byte budget before capturing a match");continue}for(let d of p.matches)if(!u.has(d.source)&&(u.add(d.source),c+=t===void 0?(await Pe(d.source)).size:await ke(t,d.source,n),c>b.vocabularyBytes))return A("candidate source snapshots exceeded the byte budget");i.push({...m,...p})}return i.length===0?void 0:{status:"ready",candidates:i}}catch(a){return s?.throwIfAborted(),A(e.aborted?"extra search reached its time budget":`extra search failed: ${a instanceof Error?a.message:String(a)}`)}}f(be,"searchFuzzy");async function q(r,o,s,t){let e=AbortSignal.timeout(b.timeoutMs),n=s===void 0?e:AbortSignal.any([s,e]),a=await se({...r,regex:!1,caseSensitive:!0,wholeWord:!0},o,n,{matches:b.matchesPerCandidate,bytes:b.verificationBytes},t);return{...a,matches:a.matches.filter(i=>i.lineText[i.startColumn-1]!=="$"&&i.lineText[i.endColumn]!=="$")}}f(q,"searchFuzzyAlternative");async function ke(r,o,s){if(r.byteSize===void 0)throw new Error("Source owner cannot bound candidate snapshots");return r.byteSize(o,s)}f(ke,"ownedByteSize");function A(r){return{status:"skipped",message:r,candidates:[]}}f(A,"skipped");async function qe(r,o,s,t){let e=await oe(r,o,t,s);if(t!==void 0){let n=new P,a=new AbortController,i=AbortSignal.any([s,a.signal]);try{let c=await t.runLines(["--only-matching","--no-filename","--case-sensitive",...e.arguments,"--","[A-Za-z_$][A-Za-z0-9_$]*",e.target],e.cwd,u=>{a.signal.aborted||(n.account(Buffer.byteLength(u)+1)&&n.add(u),n.limited&&a.abort())},i);if(!n.limited&&c.code!==0&&c.code!==1)throw new Error(c.stderr.trim()||"Ripgrep failed.")}catch(c){if(s.throwIfAborted(),!n.limited)throw c}return n}return s.throwIfAborted(),new Promise((n,a)=>{let i=$e(v(),["--only-matching","--no-filename","--case-sensitive",...e.arguments,"--","[A-Za-z_$][A-Za-z0-9_$]*",e.target],{cwd:e.cwd,stdio:["ignore","pipe","pipe"]}),c=new P,u="",m=!1,p="",d=f(()=>{i.kill()},"abort"),l=f(()=>{s.removeEventListener("abort",d)},"cleanup");i.stdout.on("data",g=>{if(!c.account(g.length)){i.kill();return}for(let h of g)if(h===10){if(m||c.add(u),u="",m=!1,c.limited){i.kill();break}}else m||(u.length===b.identifierLength?(u="",m=!0):u+=String.fromCharCode(h))}),i.stderr.setEncoding("utf8"),i.stderr.on("data",g=>{p=(p+g).slice(0,4096)}),i.once("error",g=>{l(),a(g)}),i.once("close",g=>{if(l(),s.aborted){a(s.reason);return}if(!c.limited&&g!==0&&g!==1){a(new Error(p.trim()||`ripgrep exited with code ${String(g)}`));return}n(c)}),s.addEventListener("abort",d,{once:!0}),s.aborted&&d()})}f(qe,"collectNames");var Re="Anchors: SEARCH#HASH:N:line (line), SEARCH#HASH:N:match (exact match), SEARCH#HASH:all:line (each unique containing line), SEARCH#HASH:all:match (every exact match)";function xe(r){return ze("text",r,ie)}f(xe,"createTextResolver");function ve(r){return ze("regex",r,o=>o.query.startsWith("regex:")?{...o,query:o.query.slice(6),regex:!0}:void 0)}f(ve,"createRegexResolver");function Ae(){return{id:"files",readResources:f((r,o)=>r.query.startsWith("files:")?[r.path??o.cwd]:[],"readResources"),toScriptData(r){let o=r;return{kind:"files",files:[...o.files],complete:o.complete}},async tryResolve(r,o){if(!r.query.startsWith("files:"))return{kind:"not-handled"};let s=r.query.slice(6).trim(),t=await Se(s,r,o.cwd,o.signal,o.environment);return{kind:"resolved",payload:{query:s,...t}}},renderResult(r,o,s){let t=r.details;return new j({summary:`${t.files.length}${t.complete?"":"+"} ${t.files.length===1?"file":"files"}`,rows:t.files.length?t.files.map(e=>({kind:"source",label:e,link:e.startsWith("ssh://")?e:Ie(I.resolve(t.cwd,e)).href})):[{kind:"note",text:"No files found"}]},s,o.expanded)},format(r,o){let s=r;return{content:[{type:"text",text:[s.complete?`${String(s.files.length)} files`:`${String(s.files.length)}+ files (limit reached)`,...s.files].join(`
|
|
3
|
+
`)}],details:{query:s.query,files:s.files,complete:s.complete,cwd:o.cwd}}}}}f(Ae,"createFileResolver");function ze(r,o,s){return{readResources:f((t,e)=>s(t)===void 0?[]:e.scope?.targets.map(n=>n.source)??[t.path??e.cwd],"readResources"),id:r,supportsResultScope:!0,toScriptData(t,e){let n=t,a=e,i=a.sessionId;return{...X(n.matches,n.complete,i,a),notices:[...n.notices],...a.fuzzy===void 0?{}:{fuzzy:a.fuzzy}}},async tryResolve(t,e){let n=s(t);if(n===void 0)return{kind:"not-handled"};let a=e.scope===void 0?await ce(n,e.cwd,e.signal,e.environment):await k(n,e.scope,e.cwd,e.signal),i=e.scope===void 0&&r==="text"&&a.complete&&a.matches.length===0&&K(t.query)?await be({...t,query:t.query},e.cwd,e.signal,e.environment):void 0;return{kind:"resolved",payload:{request:{...t,query:a.query},...a,recipe:{...n,originalQuery:t.query},...i===void 0?{}:{fuzzy:i}}}},async format(t,e){let n=t,a=e.scope,i=await o.registerIfCurrent(n.request.query,n.matches,n.complete,e.cwd,e.signal,n.recipe,a===void 0?void 0:m=>k(n.recipe,a,e.cwd,m),void 0,e.environment);if(n.fuzzy!==void 0){let m=E(n.request.query,[],n.complete,e.cwd),p=[],d=!1,l=AbortSignal.timeout(b.timeoutMs),g=e.signal===void 0?l:AbortSignal.any([e.signal,l]);for(let w of n.fuzzy.candidates){let R={...n.request,query:w.identifier,regex:!1,caseSensitive:!0,wholeWord:!0},x;try{x=await o.registerIfCurrent(w.identifier,w.matches,w.complete,e.cwd,g,R,z=>q(R,e.cwd,z,e.environment),b.vocabularyBytes,e.environment)}catch{e.signal?.throwIfAborted()}x===void 0&&(d=!0),p.push(ee(w,x?.id,x))}let h=d?"Some candidate files changed or could not be registered; locations are shown without stable references.":n.fuzzy.message,y={status:n.fuzzy.status,...h===void 0?{}:{message:h},candidates:p},S=[...n.notices,"No matches found."];return p.some(w=>w.selection.matches[0]?.references!==void 0)&&S.push(Re),y.status==="ready"&&y.message!==void 0&&S.push(y.message),y.status==="skipped"&&S.push(`Possible-name fallback skipped: ${y.message}`),p.length>0&&S.push("Possible names \u2014 spelling suggestions, not equivalent behavior.",...p.map(te)),{content:[{type:"text",text:S.join(`
|
|
4
|
+
|
|
5
|
+
`)}],details:{...m,...i?.target===void 0?{}:{target:i.target,matchTargets:[]},fuzzyPresentation:de(n.fuzzy.candidates,e.cwd),fuzzy:y}}}let c=n.request.limit??50;if(n.matches.length===0)return{content:[{type:"text",text:[...n.notices,"No matches found."].join(`
|
|
6
|
+
`)}],details:{...E(n.request.query,[],n.complete,e.cwd),...i?.target===void 0?{}:{target:i.target,matchTargets:[]}}};let u=i??{query:n.request.query,matches:n.matches,complete:n.complete};return{content:[{type:"text",text:[...n.notices,Ne(u,e.cwd,c,i!==void 0)].join(`
|
|
7
|
+
`)}],details:{...E(u.query,u.matches,u.complete,e.cwd,i?.id,c),...i?.target===void 0?{}:{target:i.target,matchTargets:i.matchTargets}}}},renderResult:he}}f(ze,"createMatchResolver");function Ne(r,o,s,t=!0){let e=new Set(r.matches.map(d=>d.source)).size,n=r.matches.length,a=`${String(n)}${r.complete?"":"+"} ${we(n,"match","matches")} in ${String(e)} ${we(e,"file","files")}`,i=t?r.complete?`SEARCH#${r.id}:all:line / SEARCH#${r.id}:all:match \u2014 ${a}`:`${a} (incomplete results; no all anchors were registered)`:`${a} (files changed during search; results shown without anchors)`,c=t?[Re,i]:[i],u=new Map(r.matches.map((d,l)=>[d,l+1])),m=le(r.matches,s);for(let[d,l]of m.files.entries()){d>0&&c.push("");let g=_e(l.source,o);if(l.kind==="compacted"){c.push(`${g}: ${String(l.matchCount)} matches across ${String(l.uniqueLineCount)} unique line texts (compacted)`);for(let h of l.groups)c.push(` \xD7${String(h.matchCount)} ${Fe(h.text)}`);l.groups.length<l.uniqueLineCount&&c.push(` \u2026 ${String(l.uniqueLineCount-l.groups.length)} more unique line texts`),c.push(` Search again with path: ${JSON.stringify(g)} and a narrower query to see individual matches.`);continue}for(let h of l.matches){let y=u.get(h);if(y===void 0)continue;let S=`${g}:${String(h.lineNumber)}:${String(h.startColumn+1)}-${String(h.endColumn+1)}`;c.push(t?`${S} SEARCH#${r.id}:${String(y)}:line SEARCH#${r.id}:${String(y)}:match`:S,` ${Oe(h)}`)}}let p=e-m.files.length;if(p>0){let d=m.files.reduce((l,g)=>l+(g.kind==="detailed"?g.matches.length:g.matchCount),0);c.push(`
|
|
8
|
+
\u2026 ${p} more files (${n-d} matches) not displayed. Narrow path, include, or query to see them.`)}return c.join(`
|
|
9
|
+
`)}f(Ne,"formatSearchSession");function Oe(r){let s=Math.max(0,r.startColumn-64),t=Math.min(r.lineText.length,r.endColumn+64);return`${s>0?"\u2026":""}${r.lineText.slice(s,r.startColumn)}\u27E6${r.lineText.slice(r.startColumn,r.endColumn)}\u27E7${r.lineText.slice(r.endColumn,t)}${t<r.lineText.length?"\u2026":""}`}f(Oe,"previewMatch");function Fe(r){return`${r.slice(0,129)}${r.length>129?"\u2026":""}`}f(Fe,"previewLine");function _e(r,o){if(r.includes("://"))return r;let s=I.relative(o,r);return s.length>0&&!s.startsWith("..")&&!I.isAbsolute(s)?s:r}f(_e,"displaySource");function we(r,o,s){return r===1?o:s}f(we,"plural");async function He(r){let o,s=new pe(void 0,B(r),async(t,e,n)=>{if(o===void 0){if(t.includes("://"))throw new Error("No search snapshot owner for this source.");return De(t,{encoding:"utf8",signal:n})}let a=await o.read({path:t},{cwd:e,signal:n},"script");if(a.isError||a.script?.kind!=="text"||a.script.source!==t)throw new Error(a.details.failure?.message??"The source cannot provide an exact text snapshot.");return a.script.content});r.on("tool_result",async(t,e)=>{if(t.toolName!=="replace"||t.isError||typeof t.details!="object"||t.details===null)return;let n="metadata"in t.details?t.details.metadata:void 0,a=n&&typeof n=="object"&&"searchObservations"in n?n.searchObservations:void 0,i=Array.isArray(a)?a:await s.observeAfterEdit([t.input.path,t.input.start,t.input.end],e.signal);if(i.length!==0)return{content:[...t.content,{type:"text",text:["Original search observed after editing (not task validation):",...i.map(c=>{let{query:u,fallbacks:m,...p}=c.scope;return[`SEARCH#${c.sessionId}: ${JSON.stringify(c.query)}`,`Scope and options: ${JSON.stringify(p)}`,c.error===void 0?`Matches: ${c.matches}${c.complete===!0?"; complete search.":"+; incomplete search, lower bound only."}`:`Search failed: ${c.error}. Applied edits remain applied.`,...c.notices??[]].join(`
|
|
10
|
+
`)})].join(`
|
|
11
|
+
`)}],details:{...t.details,searchObservations:i},...t.structuredContent===void 0?{}:{structuredContent:t.structuredContent}}}),r.on("tool_result",t=>{if(t.toolName!=="search"||typeof t.details!="object"||t.details===null)return;let e=t.details;if(ue(e.payload))return{details:{...e,payload:fe(e.payload,t.content.flatMap(n=>n.type==="text"?[n.text]:[]).join(`
|
|
12
|
+
`))}}}),await Promise.all([M(r,{protocol:H,apiVersion:L,id:"search-snapshots",setup(t){o=t}}),D(r,me),Z(r,{protocol:Q,apiVersion:U,id:"local",setup(t){t.addSelectionProvider((e,n)=>s.register(e.request.query,e.matches,e.complete,n.cwd,n.signal,{...e.request,regex:!1},e.refresh,void 0,n.environment)),t.addResolver({resolver:ve(s),priority:-10}),t.addResolver({resolver:Ae(),priority:-10}),t.addResolver({resolver:xe(s),fallback:!0}),t.describe(["Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching; files:<pattern> searches file paths: glob patterns use *, **, ?, character classes and braces; other queries use case-insensitive subsequence matching. Slash-containing globs match cwd-relative paths; basename globs match at any depth.","After a complete zero result, a single unquoted ASCII identifier may produce separate possible-name groups: naming-style changes, one leading/trailing component, then small typos. Each group reports a verified case-sensitive whole-identifier alternative in the same scope, its count/completeness, and Read references. Budget skips are explicit. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. Registered local candidate selections also expose strict snapshot targets. Result scopes stay exact and do not run this extra branch.","The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.","SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.","Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections."].join(`
|
|
13
|
+
`))}}),J(r,{protocol:V,apiVersion:G,id:"search-anchors",setup(t){t.tool("replace").addHandler({stage:"text-post-edit",async handler(e){if(!e.result||typeof e.result!="object"||!("kind"in e.result)||e.result.kind!=="completed"||!e.input||typeof e.input!="object")return e;let n=e.input,a=await s.observeAfterEdit([n.path,n.start,n.end],e.signal);return a.length===0?e:{...e,metadata:{...e.metadata,searchObservations:a}}}}),t.addAnchorResolver({resolver:s.anchorResolver(),resources:s.resourceResolver(),kind:W,type:"auxiliary",describeInPrompt:!1})}})])}f(He,"registerTextSearch");export{Ce as createSearchSessionId,He as default};
|
package/dist/entry-53.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{g as a,h as b,i as c,j as d,k as e}from"./chunk-BQ67M4NC.js";import"./chunk-PLKYHUNT.js";import"./chunk-ZPT5D4VP.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{e as SearchSessionStore,d as SearchSnapshotChangedError,c as allocateSearchSessionId,a as createSearchSessionId,b as createSearchSessionIdentity};
|
package/dist/entry-54.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,c as b
|
|
1
|
+
import{b as a,c as b}from"./chunk-MZXX353D.js";import"./chunk-4OYVLXWD.js";import"./chunk-BIG45IPN.js";import"./chunk-SSWUUBIR.js";import"./chunk-PS2B6THP.js";import"./chunk-R5XJSEOE.js";import"./chunk-ZPT5D4VP.js";import"./chunk-EI7MMDWY.js";export{b as SearchResultPanel,a as renderSearchResult};
|
package/dist/entry-55.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c
|
|
1
|
+
import{b as a,c as b,d as c}from"./chunk-4OYVLXWD.js";import"./chunk-BIG45IPN.js";import"./chunk-SSWUUBIR.js";import"./chunk-PS2B6THP.js";import"./chunk-R5XJSEOE.js";import"./chunk-EI7MMDWY.js";export{b as createFuzzyPresentation,a as createSearchToolDetails,c as isSearchToolDetails};
|
package/dist/entry-56.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-ZPT5D4VP.js";import"./chunk-EI7MMDWY.js";export{a as TextAnchor,b as attachTextAnchorRenderer,p as createTextContentConverter,m as createTextDocument,c as getTextAnchorRenderer,i as getTextSourceLine,g as isTextAnchorRecoveryOutcome,f as isTextAnchorResolutionAttempt,e as isTextAnchorResolver,k as isTextLinePresenter,l as isTextPresenterRegistration,s as isTextTargetResolutionAttempt,q as isTextualMediaType,o as renderPresentedTextDocument,h as renderPresentedTextRows,d as renderTextAnchor,n as renderTextDocument,u as restoreText,t as storeText,r as textFromAgentContent,j as withTextSourceLine};
|
package/dist/entry-57.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a as d}from"./chunk-2K65BSXS.js";import{c as s,d as l,e as c}from"./chunk-ICDI27GZ.js";import"./chunk-R5XJSEOE.js";import{a as i}from"./chunk-ZPT5D4VP.js";import{a as t}from"./chunk-EI7MMDWY.js";var o=class extends i{static{t(this,"ConstantTextAnchor")}constructor(n,r){super(n,r)}};function p(){return{id:"file-position",description:"`begin` and `end` select the first and last existing lines.",renderFull(e){return e},renderCompact(e){return e==="begin"?"file start":"file end"},tryResolve(e,n){return Promise.resolve(a(e,n))}}}t(p,"createConstantTextAnchorResolver");function a(e,n){return e!=="begin"&&e!=="end"?{kind:"not-handled"}:n.lines.length===0?{kind:"failed",error:new Error(`${e} cannot resolve in an empty file`)}:{kind:"resolved",anchor:new o(e,e==="begin"?1:n.lines.length)}}t(a,"resolveConstantAnchor");async function T(e){await d(e,{protocol:s,apiVersion:l,id:"text-anchor-constant",setup(r){r.addAnchorResolver({resolver:p(),kind:c,type:"constant"})}})}t(T,"registerConstantTextAnchors");export{T as default};
|
package/dist/entry-58.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a,b,c}from"./chunk-QRJLIV6P.js";import"./chunk-PLKYHUNT.js";import"./chunk-ZPT5D4VP.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as createExactTextAnchorResolver,c as findExactTextMatches,b as resolveExactTextAnchor};
|
package/dist/entry-59.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a as b}from"./chunk-QRJLIV6P.js";import"./chunk-PLKYHUNT.js";import{a as g}from"./chunk-2K65BSXS.js";import{c as m,d as y,f as x}from"./chunk-ICDI27GZ.js";import"./chunk-R5XJSEOE.js";import"./chunk-ZPT5D4VP.js";import"./chunk-ZC65Z3CK.js";import{a as r}from"./chunk-EI7MMDWY.js";import z from"node:path";import{readFileSync as C}from"node:fs";import v from"node:path";function p(e){let t=w(e.settings,"recovery.exactText");t!==void 0&&T(t,["fuzzyEnabled","threshold","exactCandidateLimit","fuzzyCandidateLimit","maxFileSizeMiB","maxQuerySizeKiB","seedLimit","blockLineVariance"],"recovery.exactText");let n=r(i=>t===void 0?void 0:t[i],"value");return{fuzzyEnabled:h(n("fuzzyEnabled"),"fuzzyEnabled")??!0,threshold:f(n("threshold"),"threshold",0,1)??.8,exactCandidateLimit:u(n("exactCandidateLimit"),"exactCandidateLimit",1,100)??20,fuzzyCandidateLimit:u(n("fuzzyCandidateLimit"),"fuzzyCandidateLimit",1,20)??5,maxFileSizeMiB:f(n("maxFileSizeMiB"),"maxFileSizeMiB",.01,100)??20,maxQuerySizeKiB:f(n("maxQuerySizeKiB"),"maxQuerySizeKiB",.01,4096)??1024,seedLimit:u(n("seedLimit"),"seedLimit",1,10)??3,blockLineVariance:u(n("blockLineVariance"),"blockLineVariance",0,10)??2,contextLines:e.contextLines,timeoutMs:e.timeoutMs}}r(p,"parseExactTextRecoveryConfig");function E(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError(`${t} must be an object`);return Object.fromEntries(Object.entries(e))}r(E,"objectRecord");function w(e,t){return e===void 0?void 0:E(e,t)}r(w,"optionalObject");function T(e,t,n){let i=new Set(t),o=Object.keys(e).find(l=>!i.has(l));if(o!==void 0)throw new TypeError(`${n} contains unknown key ${o}`)}r(T,"assertKeys");function h(e,t){if(e===void 0||typeof e=="boolean")return e;throw new TypeError(`${t} must be a boolean`)}r(h,"optionalBoolean");function f(e,t,n,i){if(e!==void 0){if(typeof e!="number"||!Number.isFinite(e)||e<n||e>i)throw new RangeError(`${t} must be between ${n} and ${i}`);return e}}r(f,"optionalNumber");function u(e,t,n,i){let o=f(e,t,n,i);if(o!==void 0&&!Number.isInteger(o))throw new TypeError(`${t} must be an integer`);return o}r(u,"optionalInteger");function L(e){return["path","file","target","start","end","anchor","targetStart","targetEnd","change"].some(t=>{let n=e[t];return(Array.isArray(n)?n:[n]).some(o=>typeof o=="string"&&/^(?:RESULT#|SEARCH#|CHANGE#|scope-(?:begin|end)-|\d+#[a-f\d]+$|begin$|end$|<system-result)/iu.test(o))})}r(L,"usesRegisteredSelector");async function R(e){let t=new Set,n=new Set,i=r((d,a)=>z.resolve(a,d),"key"),o=r(()=>{t.clear(),n.clear()},"clear");e.on("session_start",o),e.on("session_shutdown",o),e.on("agent_end",()=>n.clear()),e.on("tool_result",(d,a)=>{let s=d.details;for(let c of s?.metadata?.exactTextFailures??[])t.add(i(c,a.cwd)),n.delete(i(c,a.cwd));if(!(d.isError||!L(d.input))){if(s?.nativeEditBatch?.state==="accepted"&&s.source){let c=i(s.source,a.cwd);t.has(c)&&n.add(c);return}for(let c of s?.results??[])c.data?.ok&&c.data.path&&t.delete(i(c.data.path,a.cwd))}}),await g(e,{protocol:m,apiVersion:y,id:"text-anchor-exact",setup(d){d.onDidEdit(a=>{let s=i(a.resourceSource,a.cwd);n.delete(s)&&t.delete(s)}),d.addAnchorResolver({resolver:b(p(d.recoveryConfig("exactText")),(a,s)=>t.has(i(a,s))),kind:x,type:"auxiliary",describeInPrompt:!1,priority:1e4})}})}r(R,"registerExactTextAnchor");export{R as default};
|
package/dist/entry-60.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-KZC7TI5M.js";import"./chunk-ZPT5D4VP.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{b as createLineHashAnchor,e as createLineHashAnchorResolver,c as formatLineHashAnchor,a as hashLine,d as renderLineHashLines};
|
package/dist/entry-61.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as T,e as x}from"./chunk-KZC7TI5M.js";import{a as P}from"./chunk-2K65BSXS.js";import{c as m,d as u,e as f}from"./chunk-ICDI27GZ.js";import{a as l}from"./chunk-BU7IZLKB.js";import{a as p,b as h}from"./chunk-S5PL5DFQ.js";import"./chunk-R5XJSEOE.js";import{i as d}from"./chunk-ZPT5D4VP.js";import"./chunk-ZC65Z3CK.js";import{a}from"./chunk-EI7MMDWY.js";function g(){return{id:"line-hash",present(r,n){let o=r.lines.map(e=>{let i=(n.resolvedBy==="filesystem"||n.resolvedBy==="ssh")&&(n.purpose==="edit-diff"&&n.sourceText===void 0||n.sourceText===r.content)?{lineNumber:e.lineNumber,content:e.content}:d(e);return i===void 0?void 0:{anchor:T(i.lineNumber,i.content),lineNumber:i.lineNumber}}),c=Math.max(0,...o.map(e=>e?.anchor.value.length??0)),t=Math.max(0,...o.map(e=>String(e?.lineNumber??"").length)),E=r.lines.map((e,i)=>{let s=o[i];return s===void 0?e:{...e,anchors:[...new Set([...e.anchors??[],s.anchor.value])],presentation:{...e.presentation,prefix:`${s.anchor.value.padStart(c)}|${e.presentation?.prefix??""}`,compactPrefix:e.presentation?.compactPrefix??`${String(s.lineNumber).padStart(t)} \u2502 `}}});return{...r,lines:E}}}}a(g,"createLineHashPresenter");async function R(r){let n=g(),o={protocol:p,apiVersion:h,id:"text-anchor-line-hash",setup(t){t.addView({view:"anchors",presenter:n}),t.describe({views:"anchors \u2014 annotate text with returned line references in the form LINE#HASH, e.g. 12#A4F0 (line number 12 and its content hash). These references select source lines in edits or path#anchor reads; display annotations are not file content."})}},c={protocol:m,apiVersion:u,id:"text-anchor-line-hash",setup(t){t.addAnchorResolver({resolver:x(),kind:f,type:"major"}),t.addTextPresenter({presenter:n})}};await Promise.all([l(r,o),P(r,c)])}a(R,"registerLineHashTextAnchor");export{R as default};
|
package/dist/entry-62.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-KOVPDKSJ.js";import"./chunk-SJ4UZ4GU.js";import"./chunk-6U5OU77O.js";import"./chunk-ZPT5D4VP.js";import"./chunk-EI7MMDWY.js";export{a as connectTextEditorPlugin};
|
package/dist/entry-63.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-2K65BSXS.js";import"./chunk-ICDI27GZ.js";import"./chunk-R5XJSEOE.js";import"./chunk-ZPT5D4VP.js";import"./chunk-EI7MMDWY.js";export{a as connectTextEditorPlugin};
|
package/dist/entry-64.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-U22JNO6N.js";import"./chunk-EI7MMDWY.js";export{a as isTextEditHandlerRegistration};
|
package/dist/entry-65.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a}from"./chunk-U22JNO6N.js";import"./chunk-EI7MMDWY.js";export{a as isTextEditHandlerRegistration};
|
package/dist/entry-66.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-ICDI27GZ.js";import"./chunk-R5XJSEOE.js";import"./chunk-ZPT5D4VP.js";import"./chunk-EI7MMDWY.js";export{d as TEXT_EDITOR_API_VERSION,g as TEXT_EDITOR_CORE_READY_EVENT,h as TEXT_EDITOR_PLUGIN_REGISTER_EVENT,c as TEXT_EDITOR_PROTOCOL,e as TEXT_POSITION_ANCHOR_KIND,f as TEXT_SEARCH_ANCHOR_KIND,j as isResourceResolverRegistration,k as isTextAnchorResolverRegistration,l as isTextAnchorResourceResolutionAttempt,m as isTextEditorCoreReady,n as isTextEditorPlugin,o as isTextEditorPluginRegistrationRequest,i as isTextEditorToolId,b as localFileTransferAccess,a as snapshotLocalObjects};
|
package/dist/entry-67.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-MXLSGMRZ.js";import"./chunk-EI7MMDWY.js";export{a as formatStaleAnchorMessage};
|
package/dist/entry-68.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a}from"./chunk-PLKYHUNT.js";import"./chunk-ZPT5D4VP.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as TextSelectionAnchor};
|
package/dist/entry-69.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a,d as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i}from"./chunk-7JV4VN73.js";import"./chunk-ICDI27GZ.js";import"./chunk-R5XJSEOE.js";import"./chunk-ZPT5D4VP.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{c as TEXT_EDITOR_POST_EDIT_REGISTER_EVENT,a as afterPostEditScope,i as connectTextEditorPostEditHandler,b as hasDeferredPostEdit,e as isDiffStatusContribution,d as isFormattingContribution,h as isTextMutationResultContributionData,f as isTextPostEditHandlerRegistration,g as isTextPostEditHandlerRegistrationRequest};
|
package/dist/entry-70.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a}from"./chunk-YGGKGZO2.js";import"./chunk-EI7MMDWY.js";export{a as NATIVE_EDIT_BATCH_EVENT};
|
package/dist/entry-71.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,d as c}from"./chunk-QUYXINGZ.js";import{a as d,b as e,d as f}from"./chunk-GW6NZQTQ.js";import"./chunk-R5XJSEOE.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{b as FileMutationResult,a as FileRange,c as computeChangedRanges,d as mutationDataSchema,e as mutationResultSchema,f as structuredMutation};
|
package/dist/entry-72.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-2RTCSZB3.js";import"./chunk-EI7MMDWY.js";export{b as assertTextMutationToolRegistration,a as isMutationAnchorValue,c as mutationSource};
|
package/dist/entry-73.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk-2RTCSZB3.js";import"./chunk-EI7MMDWY.js";export{b as assertTextMutationToolRegistration,a as isMutationAnchorValue,c as mutationSource};
|
package/dist/entry-74.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-YHADTHQM.js";import"./chunk-EI7MMDWY.js";export{c as clearLastResolvedResource,b as getLastResolvedResource,a as rememberLastResolvedResource};
|
package/dist/entry-75.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a,b,c}from"./chunk-YHADTHQM.js";import"./chunk-EI7MMDWY.js";export{c as clearLastResolvedResource,b as getLastResolvedResource,a as rememberLastResolvedResource};
|
package/dist/entry-76.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as b,b as c}from"./chunk-IH5NW5JX.js";import{c as a}from"./chunk-XH5WN5XA.js";import"./chunk-GW6NZQTQ.js";import"./chunk-PS2B6THP.js";import"./chunk-R5XJSEOE.js";import"./chunk-EI7MMDWY.js";export{a as getToolCallInterception,c as registerToolCallAnnotationSink,b as registerToolCallInterceptor};
|