pi-agent-ide 0.2.1 → 0.3.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 +12 -8
- package/dist/{chunk-XNXQYPVT.js → chunk-4LUW26BX.js} +1 -1
- package/dist/chunk-5MSNYFDE.js +1 -0
- package/dist/chunk-5VSE5X5R.js +2 -0
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/{chunk-ORAPGW7W.js → chunk-72EEL2DW.js} +1 -1
- package/dist/{chunk-T2RPMEM2.js → chunk-7UGNGK7Y.js} +1 -1
- package/dist/{chunk-STUZZM5B.js → chunk-AADJ2KIB.js} +1 -1
- package/dist/{chunk-SMSIT3CE.js → chunk-B5KB2I7J.js} +1 -1
- package/dist/chunk-BHSO2MDK.js +6 -0
- package/dist/chunk-BMOJTJJJ.js +3 -0
- package/dist/{chunk-EEH4WYI7.js → chunk-CEKXBS55.js} +1 -1
- package/dist/chunk-CW53ZTU3.js +2 -0
- package/dist/chunk-EWNWKDMP.js +4 -0
- package/dist/{chunk-VSP2QQPQ.js → chunk-GIRAEVUJ.js} +1 -1
- package/dist/{chunk-MTTKFJV6.js → chunk-GUTQ3PWL.js} +1 -1
- package/dist/chunk-HGPUI7F3.js +1 -0
- package/dist/{chunk-OBWZ5RYN.js → chunk-HKMBQLEK.js} +1 -1
- package/dist/chunk-ITSNK5YG.js +7 -0
- package/dist/chunk-KAB3AYA2.js +1 -0
- package/dist/{chunk-266RH77Z.js → chunk-LRYE2WCN.js} +1 -1
- package/dist/chunk-M5L42DWE.js +7 -0
- package/dist/chunk-M5MJP7Z2.js +1 -0
- package/dist/chunk-NMFQGKPE.js +2 -0
- package/dist/chunk-NTYXZ3EL.js +3 -0
- package/dist/{chunk-PETQCA7G.js → chunk-QDST6VIU.js} +1 -1
- package/dist/chunk-QIJMV2P2.js +2 -0
- package/dist/chunk-RHV5STR3.js +3 -0
- package/dist/chunk-ROXXK6TW.js +0 -0
- package/dist/chunk-S3ZPXWX7.js +2 -0
- package/dist/chunk-SSHZEWWV.js +1 -0
- package/dist/chunk-TPIHQYK2.js +14 -0
- package/dist/chunk-VZJIZXSH.js +14 -0
- package/dist/chunk-YHADTHQM.js +1 -0
- package/dist/{chunk-KZBAJFCV.js → chunk-Z3VC3S2T.js} +1 -1
- package/dist/{chunk-SJYDLHEF.js → chunk-ZM4L5AGN.js} +1 -1
- package/dist/{chunk-E2RESHYR.js → chunk-ZTYWHL2F.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-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-21.js +2 -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 -1
- package/dist/entry-26.js +12 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +4 -1
- package/dist/entry-32.js +9 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- 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 +18 -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 +7 -1
- package/dist/entry-46.js +11 -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 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -0
- package/dist/entry-55.js +0 -1
- package/dist/entry-56.js +1 -0
- package/dist/entry-57.js +0 -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 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -0
- package/dist/entry-64.js +0 -1
- package/dist/entry-65.js +1 -0
- package/dist/entry-66.js +0 -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 +123 -1
- package/dist/entry-71.js +30 -1
- package/dist/entry-72.js +2 -1
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +3 -1
- package/dist/entry-77.js +1 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/pi-agent-ide.js +3 -13
- package/docs/configuration.md +57 -11
- package/docs/extensions.md +4 -2
- package/docs/tools.md +7 -1
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +2 -2
- package/node_modules/pi-agent-filesystem/package.json +6 -6
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +9 -9
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/node_modules/pi-agent-ide-ast/src/extension.ts +11 -15
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +83 -0
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/node_modules/pi-agent-ide-changes/index.ts +22 -10
- package/node_modules/pi-agent-ide-changes/package.json +6 -6
- package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -9
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +36 -13
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/index.ts +49 -17
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-lsp/index.ts +127 -20
- package/node_modules/pi-agent-ide-lsp/package.json +9 -8
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +25 -7
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +12 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-image/src/image-converter.ts +1 -1
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +1 -1
- package/node_modules/pi-agent-read/package.json +6 -6
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/node_modules/pi-agent-read/src/api/rendering.ts +3 -0
- package/node_modules/pi-agent-read/src/api/tools/read.ts +73 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +32 -28
- package/node_modules/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +87 -19
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/node_modules/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +87 -53
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -8
- package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
- package/node_modules/pi-agent-search/package.json +3 -3
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/node_modules/pi-agent-search/src/api/search.ts +55 -1
- package/node_modules/pi-agent-search/src/core/extension.ts +8 -27
- package/node_modules/pi-agent-search/src/core/search-core.ts +38 -3
- package/node_modules/pi-agent-search-text/index.ts +82 -33
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/file-search.ts +9 -1
- package/node_modules/pi-agent-search-text/src/resolvers.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +112 -24
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
- package/node_modules/pi-agent-text/src/text-document.ts +5 -0
- package/node_modules/pi-agent-text/src/text-target.ts +4 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
- package/node_modules/pi-agent-text-editor/index.ts +1 -3
- package/node_modules/pi-agent-text-editor/package.json +34 -24
- package/node_modules/pi-agent-text-editor/runtime/entry-69.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/node_modules/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +74 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -9
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +28 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +43 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +40 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +178 -58
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +313 -21
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/node_modules/pi-agent-text-editor-renderer/index.ts +93 -2
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +69 -4
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +24 -13
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +1 -0
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-web/index.ts +1 -6
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/runtime/entry-75.js +2 -0
- package/node_modules/pi-agent-web/src/browser-loader.ts +1 -0
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- 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/package.json +38 -38
- package/src/api/plugin-protocol.ts +12 -2
- package/src/api/text-editor.ts +7 -0
- package/src/api/tool-config.ts +77 -2
- package/src/code-view/diagnostic-view.ts +22 -3
- package/src/composite/builtin-extensions.ts +138 -67
- package/src/composite/extensions-config.ts +59 -0
- package/src/composite/feature-flags.ts +32 -0
- package/src/composite/module-labels.ts +55 -0
- package/src/composite/module-settings-store.ts +44 -0
- package/src/composite/module-settings.ts +132 -0
- package/src/composite/selection.ts +4 -4
- package/src/composite/settings-panel.ts +71 -0
- package/src/core/diagnostic-delivery.ts +29 -0
- package/src/core/diagnostic-entry.ts +142 -0
- package/src/core/diagnostic-store.ts +96 -23
- package/src/core/extension.ts +45 -22
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +1 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- 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-html/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
- 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/runtime/entry-75.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/browser-loader.ts +1 -0
- package/src/extensions/pi-agent-read/package.json +6 -6
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/src/extensions/pi-agent-read/src/api/rendering.ts +3 -0
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +73 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +32 -28
- package/src/extensions/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +87 -19
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +87 -53
- package/src/extensions/pi-agent-search/package.json +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +82 -33
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +9 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +112 -24
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +55 -1
- package/src/extensions/pi-agent-search/src/core/extension.ts +8 -27
- package/src/extensions/pi-agent-search/src/core/search-core.ts +38 -3
- package/src/extensions/pi-agent-text-editor/index.ts +1 -3
- package/src/extensions/pi-agent-text-editor/package.json +34 -24
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +93 -2
- 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/diff-model.ts +7 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +69 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +24 -13
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- 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/runtime/entry-69.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/src/extensions/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +74 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -9
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +28 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +43 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +40 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +178 -58
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +313 -21
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/src/pi-agent-ide.ts +45 -0
- package/src/plugins/pi-agent-ide-ast/package.json +9 -9
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +11 -15
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +83 -0
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/src/plugins/pi-agent-ide-changes/index.ts +22 -10
- package/src/plugins/pi-agent-ide-changes/package.json +6 -6
- package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -9
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +62 -26
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +36 -13
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/index.ts +49 -17
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-lsp/index.ts +127 -20
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -8
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +25 -7
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +12 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/src/post-edit/gate.ts +57 -15
- package/src/toolchain/types.ts +2 -0
- package/dist/chunk-2SKAED2I.js +0 -2
- package/dist/chunk-2XYXV5HS.js +0 -4
- package/dist/chunk-2ZMYT6ZC.js +0 -1
- package/dist/chunk-34ZQTTU2.js +0 -2
- package/dist/chunk-4SQQKEVD.js +0 -16
- package/dist/chunk-5BWUVAR4.js +0 -1
- package/dist/chunk-6DN7NO7L.js +0 -1
- package/dist/chunk-6SMFVLTY.js +0 -1
- package/dist/chunk-6XQQBKPE.js +0 -58
- package/dist/chunk-BYWAG6X3.js +0 -6
- package/dist/chunk-EW2KVKCN.js +0 -2
- package/dist/chunk-F6SESI3P.js +0 -4
- package/dist/chunk-GTK5AREE.js +0 -2
- package/dist/chunk-HOBTFFQR.js +0 -1
- package/dist/chunk-IMVCVPMP.js +0 -3
- package/dist/chunk-IOCABSRL.js +0 -1
- package/dist/chunk-JASLOB2X.js +0 -1
- package/dist/chunk-KH5KPBCR.js +0 -10
- package/dist/chunk-KNMWCDDK.js +0 -7
- package/dist/chunk-KYVOMBO5.js +0 -1
- package/dist/chunk-L4FA6OD4.js +0 -1
- package/dist/chunk-LFV6G5Z3.js +0 -1
- package/dist/chunk-LGN7EJYR.js +0 -13
- package/dist/chunk-MB6VVVAF.js +0 -2
- package/dist/chunk-MTQSGWZJ.js +0 -1
- package/dist/chunk-NI2NK4JU.js +0 -1
- package/dist/chunk-NXHPO7ER.js +0 -6
- package/dist/chunk-OFHVDY4Q.js +0 -2
- package/dist/chunk-OIL6BB2S.js +0 -33
- package/dist/chunk-ONWUJXUR.js +0 -1
- package/dist/chunk-PODWLGNO.js +0 -6
- package/dist/chunk-QZANC2IG.js +0 -1
- package/dist/chunk-SSZB66C3.js +0 -3
- package/dist/chunk-TG6H6EOI.js +0 -1
- package/dist/chunk-UTTW55S2.js +0 -1
- package/dist/chunk-VEJGSURY.js +0 -8
- package/dist/chunk-W3XYKJ5H.js +0 -1
- package/dist/chunk-XGUAL3CA.js +0 -1
- package/dist/chunk-YPHXLAQF.js +0 -1
- package/dist/chunk-ZIHEF6K3.js +0 -3
- package/dist/entry-80.js +0 -1
- package/node_modules/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/node_modules/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- package/node_modules/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/node_modules/pi-agent-text-editor-argument-order/package.json +0 -16
- package/node_modules/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/node_modules/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/node_modules/pi-agent-text-editor-overwrite/package.json +0 -17
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +0 -1
- package/node_modules/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +0 -16
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-70.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +0 -17
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- /package/dist/{chunk-3H2EU7VQ.js → chunk-4U2GUKNJ.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-argument-order → pi-agent-text-editor}/runtime/entry-70.js +0 -0
- /package/node_modules/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
type TextTargetResolutionAttempt,
|
|
18
18
|
} from "pi-agent-text";
|
|
19
19
|
import { withBlockedToolResult } from "pi-agent-tool-call-interception";
|
|
20
|
-
import { Type } from "typebox";
|
|
21
20
|
|
|
22
21
|
import {
|
|
23
22
|
isFragmentResolverRegistration,
|
|
@@ -46,7 +45,6 @@ import {
|
|
|
46
45
|
READ_OUTPUT_MAX_LINES,
|
|
47
46
|
} from "#src/core/tools/read/output-truncation.js";
|
|
48
47
|
import { createReadResultRenderer, renderReadCall } from "#src/core/tools/read/read-renderer.js";
|
|
49
|
-
import { createLineNumberPresenter } from "#src/core/tools/read/views.js";
|
|
50
48
|
import {
|
|
51
49
|
createReadState,
|
|
52
50
|
failureResult,
|
|
@@ -54,17 +52,8 @@ import {
|
|
|
54
52
|
} from "#src/core/tools/read/read-result.js";
|
|
55
53
|
import { TempResourceStore } from "#src/core/tools/read/temp-resource-store.js";
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Type.String({
|
|
60
|
-
description:
|
|
61
|
-
"Complete source resource reference: a filesystem path, URL, protocol source, temporary resource, or typed SEARCH#... selection.",
|
|
62
|
-
}),
|
|
63
|
-
),
|
|
64
|
-
offset: Type.Optional(Type.Number()),
|
|
65
|
-
limit: Type.Optional(Type.Number()),
|
|
66
|
-
views: Type.Optional(Type.Array(Type.String())),
|
|
67
|
-
});
|
|
55
|
+
import { readParameters } from "#src/api/read-parameters.js";
|
|
56
|
+
import { readRaw } from "#src/core/tools/read/raw-read.js";
|
|
68
57
|
|
|
69
58
|
const fallbackReadRenderer = createReadResultRenderer({ kind: "source" });
|
|
70
59
|
|
|
@@ -98,13 +87,6 @@ interface ViewContribution {
|
|
|
98
87
|
readonly document: TextDocument;
|
|
99
88
|
}
|
|
100
89
|
|
|
101
|
-
/** Built-in view names that exist without any plugin registration. */
|
|
102
|
-
const BUILTIN_VIEWS = ["lines"] as const;
|
|
103
|
-
|
|
104
|
-
function createBuiltinViewRegistrations(): ReadViewRegistration[] {
|
|
105
|
-
return [{ view: "lines", presenter: createLineNumberPresenter() }];
|
|
106
|
-
}
|
|
107
|
-
|
|
108
90
|
export interface ReadToolContributions {
|
|
109
91
|
readonly resolvers?: readonly ResourceResolverRegistration[];
|
|
110
92
|
readonly targetResolvers?: readonly TextTargetResolverRegistration[];
|
|
@@ -114,16 +96,23 @@ export interface ReadToolContributions {
|
|
|
114
96
|
}
|
|
115
97
|
|
|
116
98
|
export interface ReadTool {
|
|
99
|
+
/** Shares the read runtime's temporary resource store with composed operations. */
|
|
100
|
+
saveTemporary(text: string): Promise<string>;
|
|
117
101
|
readonly tool: ToolDefinition<typeof readParameters, ReadResultDetails>;
|
|
118
102
|
execute(
|
|
119
103
|
request: ReadPipelineContext["request"],
|
|
120
104
|
context: ResourceResolverContext,
|
|
105
|
+
audience?: "agent" | "script",
|
|
121
106
|
): Promise<ReadToolResult>;
|
|
122
107
|
registerContributions(pluginId: string, contributions: ReadToolContributions): void;
|
|
123
108
|
dispose(): Promise<void>;
|
|
124
109
|
}
|
|
125
110
|
|
|
126
|
-
|
|
111
|
+
/** Creates a read pipeline whose prompt contributions reflect the currently installed plugins. */
|
|
112
|
+
export function createReadTool(
|
|
113
|
+
pluginPromptGuidelines?: () => readonly string[],
|
|
114
|
+
pluginDescription?: () => string | undefined,
|
|
115
|
+
): ReadTool {
|
|
127
116
|
const temporaryResources = new TempResourceStore();
|
|
128
117
|
const resolvers: RegisteredResolver[] = [
|
|
129
118
|
{
|
|
@@ -134,11 +123,7 @@ export function createReadTool(pluginPromptGuidelines?: () => readonly string[])
|
|
|
134
123
|
},
|
|
135
124
|
];
|
|
136
125
|
const handlers: RegisteredHandler[] = [];
|
|
137
|
-
const views: RegisteredView[] =
|
|
138
|
-
pluginId: "core",
|
|
139
|
-
registration,
|
|
140
|
-
order,
|
|
141
|
-
}));
|
|
126
|
+
const views: RegisteredView[] = [];
|
|
142
127
|
const fragments: RegisteredFragment[] = [];
|
|
143
128
|
const targetResolvers: {
|
|
144
129
|
readonly resolver: TextTargetResolver;
|
|
@@ -148,22 +133,26 @@ export function createReadTool(pluginPromptGuidelines?: () => readonly string[])
|
|
|
148
133
|
const toolId = "read";
|
|
149
134
|
|
|
150
135
|
return {
|
|
136
|
+
saveTemporary: (text) => temporaryResources.save(text),
|
|
151
137
|
tool: {
|
|
152
138
|
name: toolId,
|
|
153
139
|
label: toolId,
|
|
154
140
|
|
|
155
141
|
promptSnippet:
|
|
156
|
-
"Read files, URLs, temporary resources, search selections, and protocol sources, with optional views projected onto text content",
|
|
157
|
-
description
|
|
158
|
-
|
|
159
|
-
|
|
142
|
+
"Read files, original bytes with raw:, URLs, temporary resources, search selections, and protocol sources, with optional views projected onto text content",
|
|
143
|
+
get description(): string {
|
|
144
|
+
return [
|
|
145
|
+
`Use read to inspect files, directories, URLs and supported sources without changing them. path selects the source; offset/limit select a text window; views add annotations. Text limit: ${READ_OUTPUT_MAX_LINES} lines or ${READ_OUTPUT_MAX_BYTES / 1024}KB. Continuation: returned offset, or returned temp: reference as path. Temporary references remain available until their owning runtime is disposed.`,
|
|
146
|
+
"Use raw:<local-file> to inspect original bytes without decoding or conversion, including PDFs and images. In raw: mode offset is a zero-based byte position (negative from EOF), limit is a non-negative byte count, and 0 reads no bytes. Output uses hexadecimal offsets, hex bytes and printable ASCII; dots stand for nonprintable bytes. Follow the returned byte offset to continue. Raw sources do not accept views or text anchors.",
|
|
147
|
+
pluginDescription?.() ?? "",
|
|
148
|
+
]
|
|
149
|
+
.filter(Boolean)
|
|
150
|
+
.join("\n");
|
|
151
|
+
},
|
|
160
152
|
get promptGuidelines(): string[] {
|
|
161
153
|
return [
|
|
162
|
-
"Use read to examine
|
|
163
|
-
|
|
164
|
-
"You can use read with `offset` and `limit` to inspect a line range or continue a large source, and with a negative `offset` to read from the end.",
|
|
165
|
-
"You can combine compatible read views in one request.",
|
|
166
|
-
"When a read result is truncated and provides a `temp:` source, you can use read with that source to continue reading the saved full output.",
|
|
154
|
+
"Use read to examine supported sources instead of cat, sed, head or tail. Use search to locate workspace text and paths instead of grep, rg or find.",
|
|
155
|
+
"Use read with raw:<local-file> instead of xxd, od or hexdump to inspect original bytes. In raw: mode offset/limit count bytes, not lines; omit text views.",
|
|
167
156
|
...(pluginPromptGuidelines?.() ?? []),
|
|
168
157
|
];
|
|
169
158
|
},
|
|
@@ -194,7 +183,7 @@ export function createReadTool(pluginPromptGuidelines?: () => readonly string[])
|
|
|
194
183
|
);
|
|
195
184
|
},
|
|
196
185
|
},
|
|
197
|
-
execute(request, context): Promise<ReadToolResult> {
|
|
186
|
+
execute(request, context, audience = "agent"): Promise<ReadToolResult> {
|
|
198
187
|
return executeRead(
|
|
199
188
|
request,
|
|
200
189
|
context,
|
|
@@ -204,6 +193,7 @@ export function createReadTool(pluginPromptGuidelines?: () => readonly string[])
|
|
|
204
193
|
temporaryResources,
|
|
205
194
|
fragments,
|
|
206
195
|
targetResolvers,
|
|
196
|
+
audience,
|
|
207
197
|
);
|
|
208
198
|
},
|
|
209
199
|
registerContributions(pluginId, contributions): void {
|
|
@@ -301,7 +291,12 @@ async function executeRead(
|
|
|
301
291
|
readonly priority: number;
|
|
302
292
|
readonly order: number;
|
|
303
293
|
}[],
|
|
294
|
+
audience: "agent" | "script" = "agent",
|
|
304
295
|
): Promise<ReadToolResult> {
|
|
296
|
+
if (request.path?.startsWith("raw:")) return readRaw(request, resolverContext, audience);
|
|
297
|
+
resolverContext = { ...resolverContext, audience };
|
|
298
|
+
const limitOutput: typeof limitReadOutput =
|
|
299
|
+
audience === "script" ? async (result) => result : limitReadOutput;
|
|
305
300
|
const resolverSnapshot = [...resolvers].sort(
|
|
306
301
|
(left, right) => left.priority - right.priority || left.order - right.order,
|
|
307
302
|
);
|
|
@@ -317,11 +312,11 @@ async function executeRead(
|
|
|
317
312
|
const targetSnapshot = [...targetResolvers].sort(
|
|
318
313
|
(left, right) => left.priority - right.priority || left.order - right.order,
|
|
319
314
|
);
|
|
320
|
-
const requestedViews = new Set(
|
|
321
|
-
|
|
322
|
-
...
|
|
323
|
-
...viewSnapshot.map(({ registration }) => registration.view),
|
|
315
|
+
const requestedViews = new Set([
|
|
316
|
+
...(request.views ?? []),
|
|
317
|
+
...(audience === "script" ? viewSnapshot.map(({ registration }) => registration.view) : []),
|
|
324
318
|
]);
|
|
319
|
+
const knownViews = new Set([...viewSnapshot.map(({ registration }) => registration.view)]);
|
|
325
320
|
const ignoredViews = [...requestedViews].filter((view) => !knownViews.has(view));
|
|
326
321
|
if (request.path !== undefined && targetSnapshot.length > 0) {
|
|
327
322
|
const targeted = await resolveTextTargets(
|
|
@@ -333,19 +328,17 @@ async function executeRead(
|
|
|
333
328
|
viewSnapshot,
|
|
334
329
|
requestedViews,
|
|
335
330
|
ignoredViews,
|
|
331
|
+
audience,
|
|
336
332
|
);
|
|
337
333
|
if (targeted !== undefined) return targeted;
|
|
338
334
|
}
|
|
339
|
-
let pipeline: ReadPipelineContext = { request: { ...request }, resolverContext };
|
|
335
|
+
let pipeline: ReadPipelineContext = { request: { ...request }, resolverContext, audience };
|
|
340
336
|
|
|
341
337
|
if (!pipeline.request.path?.startsWith("temp:")) {
|
|
342
338
|
const preRead = await runPreReadHandlers(pipeline, handlerSnapshot);
|
|
343
339
|
|
|
344
340
|
if (preRead.kind === "return") {
|
|
345
|
-
return withIgnoredViews(
|
|
346
|
-
await limitReadOutput(preRead.result, pipeline.request),
|
|
347
|
-
ignoredViews,
|
|
348
|
-
);
|
|
341
|
+
return withIgnoredViews(await limitOutput(preRead.result, pipeline.request), ignoredViews);
|
|
349
342
|
}
|
|
350
343
|
|
|
351
344
|
pipeline = preRead.context;
|
|
@@ -387,7 +380,7 @@ async function executeRead(
|
|
|
387
380
|
}
|
|
388
381
|
}
|
|
389
382
|
if (resolved.kind === "return") {
|
|
390
|
-
return
|
|
383
|
+
return limitOutput(resolved.result, pipeline.request);
|
|
391
384
|
}
|
|
392
385
|
|
|
393
386
|
pipeline = resolved.context;
|
|
@@ -406,8 +399,8 @@ async function executeRead(
|
|
|
406
399
|
|
|
407
400
|
if (pipeline.state?.textMode === "final") {
|
|
408
401
|
return withIgnoredViews(
|
|
409
|
-
await
|
|
410
|
-
projectReadState(pipeline.state, pipeline.request, { originLine: origin }),
|
|
402
|
+
await limitOutput(
|
|
403
|
+
projectReadState(pipeline.state, pipeline.request, { originLine: origin, audience }),
|
|
411
404
|
pipeline.request,
|
|
412
405
|
undefined,
|
|
413
406
|
{ originLine: origin },
|
|
@@ -420,7 +413,7 @@ async function executeRead(
|
|
|
420
413
|
|
|
421
414
|
if (processed.kind === "return") {
|
|
422
415
|
return withIgnoredViews(
|
|
423
|
-
await
|
|
416
|
+
await limitOutput(processed.result, pipeline.request, undefined, { originLine: origin }),
|
|
424
417
|
ignoredViews,
|
|
425
418
|
);
|
|
426
419
|
}
|
|
@@ -428,6 +421,7 @@ async function executeRead(
|
|
|
428
421
|
pipeline = processed.context;
|
|
429
422
|
pipeline = await runTextPresenters(pipeline, viewSnapshot, requestedViews);
|
|
430
423
|
const projected = projectReadState(requiredValue(pipeline.state), pipeline.request, {
|
|
424
|
+
audience,
|
|
431
425
|
originLine: origin,
|
|
432
426
|
});
|
|
433
427
|
pipeline = { ...pipeline, result: projected };
|
|
@@ -439,7 +433,7 @@ async function executeRead(
|
|
|
439
433
|
? (text: string): Promise<string> => temporaryResources.save(text)
|
|
440
434
|
: undefined;
|
|
441
435
|
return withIgnoredViews(
|
|
442
|
-
await
|
|
436
|
+
await limitOutput(result, pipeline.request, saveFullOutput, { originLine: origin }),
|
|
443
437
|
ignoredViews,
|
|
444
438
|
);
|
|
445
439
|
}
|
|
@@ -475,7 +469,10 @@ async function resolveTextTargets(
|
|
|
475
469
|
views: readonly RegisteredView[],
|
|
476
470
|
requestedViews: ReadonlySet<string>,
|
|
477
471
|
ignoredViews: readonly string[],
|
|
472
|
+
audience: "agent" | "script",
|
|
478
473
|
): Promise<ReadToolResult | undefined> {
|
|
474
|
+
const limitOutput: typeof limitReadOutput =
|
|
475
|
+
audience === "script" ? async (result) => result : limitReadOutput;
|
|
479
476
|
for (const { resolver } of targetResolvers) {
|
|
480
477
|
let rawAttempt: unknown;
|
|
481
478
|
try {
|
|
@@ -517,6 +514,7 @@ async function resolveTextTargets(
|
|
|
517
514
|
message: "Text target resolver returned no targets",
|
|
518
515
|
});
|
|
519
516
|
const chunks: string[] = [];
|
|
517
|
+
const resources: ReadToolResult[] = [];
|
|
520
518
|
let firstDetails: ReadResultDetails | undefined;
|
|
521
519
|
for (const target of attempt.targets) {
|
|
522
520
|
const ranges = target.ranges ?? [
|
|
@@ -531,6 +529,7 @@ async function resolveTextTargets(
|
|
|
531
529
|
limit: request.limit ?? rangeLimit,
|
|
532
530
|
},
|
|
533
531
|
resolverContext,
|
|
532
|
+
audience,
|
|
534
533
|
};
|
|
535
534
|
if (!target.source.startsWith("temp:")) {
|
|
536
535
|
const preRead = await runPreReadHandlers(rangePipeline, handlers);
|
|
@@ -540,6 +539,7 @@ async function resolveTextTargets(
|
|
|
540
539
|
for (const block of preRead.result.content) {
|
|
541
540
|
if (block.type === "text") chunks.push(block.text);
|
|
542
541
|
}
|
|
542
|
+
resources.push(preRead.result);
|
|
543
543
|
firstDetails ??= preRead.result.details;
|
|
544
544
|
continue;
|
|
545
545
|
}
|
|
@@ -556,11 +556,13 @@ async function resolveTextTargets(
|
|
|
556
556
|
for (const block of processed.result.content) {
|
|
557
557
|
if (block.type === "text") chunks.push(block.text);
|
|
558
558
|
}
|
|
559
|
+
resources.push(processed.result);
|
|
559
560
|
firstDetails ??= processed.result.details;
|
|
560
561
|
continue;
|
|
561
562
|
}
|
|
562
563
|
const presented = await runTextPresenters(processed.context, views, requestedViews);
|
|
563
564
|
const projected = projectReadState(requiredValue(presented.state), presented.request, {
|
|
565
|
+
audience,
|
|
564
566
|
originLine: range.start.lineNumber,
|
|
565
567
|
});
|
|
566
568
|
const postRead = await runPostReadHandlers({ ...presented, result: projected }, handlers);
|
|
@@ -571,15 +573,36 @@ async function resolveTextTargets(
|
|
|
571
573
|
for (const block of result.content) {
|
|
572
574
|
if (block.type === "text") chunks.push(block.text);
|
|
573
575
|
}
|
|
576
|
+
resources.push(result);
|
|
574
577
|
firstDetails ??= result.details;
|
|
575
578
|
}
|
|
576
579
|
}
|
|
577
580
|
const aggregate = {
|
|
581
|
+
...(audience === "script" && {
|
|
582
|
+
script:
|
|
583
|
+
resources.length === 1 && resources[0]?.script !== undefined
|
|
584
|
+
? resources[0].script
|
|
585
|
+
: {
|
|
586
|
+
kind: "resources" as const,
|
|
587
|
+
source: request.path,
|
|
588
|
+
resources: resources.map(
|
|
589
|
+
(result) =>
|
|
590
|
+
result.script ?? {
|
|
591
|
+
kind: "native" as const,
|
|
592
|
+
source: result.details.source ?? request.path ?? "",
|
|
593
|
+
blocks: result.content,
|
|
594
|
+
},
|
|
595
|
+
),
|
|
596
|
+
},
|
|
597
|
+
}),
|
|
578
598
|
content: [{ type: "text", text: chunks.join("\n") }],
|
|
579
|
-
details:
|
|
599
|
+
details:
|
|
600
|
+
audience === "script"
|
|
601
|
+
? { source: request.path, resources }
|
|
602
|
+
: (firstDetails ?? { source: request.path }),
|
|
580
603
|
} satisfies ReadToolResult;
|
|
581
604
|
return withIgnoredViews(
|
|
582
|
-
await
|
|
605
|
+
await limitOutput(aggregate, { path: request.path, views: request.views }),
|
|
583
606
|
ignoredViews,
|
|
584
607
|
);
|
|
585
608
|
}
|
|
@@ -903,6 +926,8 @@ async function runTextPresenters(
|
|
|
903
926
|
const document = state.text;
|
|
904
927
|
const presentationContext: TextPresentationContext = {
|
|
905
928
|
purpose: "read",
|
|
929
|
+
audience: context.resolverContext.audience,
|
|
930
|
+
requestedViews: context.request.views,
|
|
906
931
|
source: state.source,
|
|
907
932
|
cwd: context.resolverContext.cwd,
|
|
908
933
|
resolvedBy: state.resolvedBy,
|
|
@@ -998,7 +1023,15 @@ function mergePresentedLine(base: TextLine, current: TextLine, contribution: Tex
|
|
|
998
1023
|
);
|
|
999
1024
|
const metadata = mergeLineMetadata(base.metadata, current.metadata, contribution.metadata);
|
|
1000
1025
|
|
|
1001
|
-
|
|
1026
|
+
const anchors =
|
|
1027
|
+
contribution.anchors === undefined
|
|
1028
|
+
? current.anchors
|
|
1029
|
+
: [...new Set([...(current.anchors ?? []), ...contribution.anchors])];
|
|
1030
|
+
if (
|
|
1031
|
+
presentation === current.presentation &&
|
|
1032
|
+
metadata === current.metadata &&
|
|
1033
|
+
anchors === current.anchors
|
|
1034
|
+
) {
|
|
1002
1035
|
return current;
|
|
1003
1036
|
}
|
|
1004
1037
|
|
|
@@ -1006,6 +1039,7 @@ function mergePresentedLine(base: TextLine, current: TextLine, contribution: Tex
|
|
|
1006
1039
|
...current,
|
|
1007
1040
|
...(presentation !== undefined && { presentation }),
|
|
1008
1041
|
...(metadata !== undefined && { metadata }),
|
|
1042
|
+
...(anchors !== undefined && { anchors }),
|
|
1009
1043
|
};
|
|
1010
1044
|
}
|
|
1011
1045
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"pi-agent-tool-call-interception": "0.
|
|
24
|
-
"pi-agent-tool-ui": "0.
|
|
23
|
+
"pi-agent-tool-call-interception": "0.3.0",
|
|
24
|
+
"pi-agent-tool-ui": "0.3.0"
|
|
25
25
|
},
|
|
26
26
|
"pi": {
|
|
27
27
|
"extensions": [
|
|
@@ -20,6 +20,51 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
|
20
20
|
export default async function registerTextSearch(pi: ExtensionAPI): Promise<void> {
|
|
21
21
|
const sessions = new SearchSessionStore();
|
|
22
22
|
|
|
23
|
+
pi.on("tool_result", async (event, ctx) => {
|
|
24
|
+
if (
|
|
25
|
+
event.toolName !== "replace" ||
|
|
26
|
+
event.isError ||
|
|
27
|
+
typeof event.details !== "object" ||
|
|
28
|
+
event.details === null
|
|
29
|
+
)
|
|
30
|
+
return;
|
|
31
|
+
const metadata = "metadata" in event.details ? event.details.metadata : undefined;
|
|
32
|
+
const recorded =
|
|
33
|
+
metadata && typeof metadata === "object" && "searchObservations" in metadata
|
|
34
|
+
? metadata.searchObservations
|
|
35
|
+
: undefined;
|
|
36
|
+
const observations = Array.isArray(recorded)
|
|
37
|
+
? (recorded as Awaited<ReturnType<SearchSessionStore["observeAfterEdit"]>>)
|
|
38
|
+
: await sessions.observeAfterEdit(
|
|
39
|
+
[event.input.path, event.input.start, event.input.end],
|
|
40
|
+
ctx.signal,
|
|
41
|
+
);
|
|
42
|
+
if (observations.length === 0) return;
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
...event.content,
|
|
46
|
+
{
|
|
47
|
+
type: "text" as const,
|
|
48
|
+
text: [
|
|
49
|
+
"Original search observed after editing (not task validation):",
|
|
50
|
+
...observations.map((observation) => {
|
|
51
|
+
const { query: _compiledQuery, fallbacks: _fallbacks, ...scope } = observation.scope;
|
|
52
|
+
return [
|
|
53
|
+
`SEARCH#${observation.sessionId}: ${JSON.stringify(observation.query)}`,
|
|
54
|
+
`Scope and options: ${JSON.stringify(scope)}`,
|
|
55
|
+
observation.error === undefined
|
|
56
|
+
? `Matches: ${observation.matches}${observation.complete === true ? "; complete search." : "+; incomplete search, lower bound only."}`
|
|
57
|
+
: `Search failed: ${observation.error}. Applied edits remain applied.`,
|
|
58
|
+
...(observation.notices ?? []),
|
|
59
|
+
].join("\n");
|
|
60
|
+
}),
|
|
61
|
+
].join("\n"),
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
details: { ...event.details, searchObservations: observations },
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
|
|
23
68
|
pi.on("tool_result", (event) => {
|
|
24
69
|
if (event.toolName !== "search" || typeof event.details !== "object" || event.details === null)
|
|
25
70
|
return;
|
|
@@ -42,46 +87,28 @@ export default async function registerTextSearch(pi: ExtensionAPI): Promise<void
|
|
|
42
87
|
apiVersion: SEARCH_API_VERSION,
|
|
43
88
|
id: "local",
|
|
44
89
|
setup(api): void {
|
|
90
|
+
api.addSelectionProvider((selection, context) =>
|
|
91
|
+
sessions.register(
|
|
92
|
+
selection.request.query,
|
|
93
|
+
selection.matches,
|
|
94
|
+
selection.complete,
|
|
95
|
+
context.cwd,
|
|
96
|
+
context.signal,
|
|
97
|
+
{ ...selection.request, regex: false },
|
|
98
|
+
selection.refresh,
|
|
99
|
+
),
|
|
100
|
+
);
|
|
45
101
|
api.addResolver({ resolver: createRegexResolver(sessions), priority: -10 });
|
|
46
102
|
api.addResolver({ resolver: createFileResolver(), priority: -10 });
|
|
47
103
|
api.addResolver({ resolver: createTextResolver(sessions), fallback: true });
|
|
48
104
|
api.describe(
|
|
49
105
|
[
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
106
|
+
"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.",
|
|
107
|
+
"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.",
|
|
108
|
+
"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.",
|
|
109
|
+
"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. Limited or incomplete searches do not provide :all selections.",
|
|
53
110
|
].join("\n"),
|
|
54
111
|
);
|
|
55
|
-
|
|
56
|
-
api.addPromptGuideline(
|
|
57
|
-
"Local search tries literal terms first, then unquoted terms as regex if no matches exist, then separate words for ordinary multi-word queries. Search reports each fallback; invalid optional regex is skipped. Quoted and Boolean queries never fall back to separate words.",
|
|
58
|
-
);
|
|
59
|
-
api.addPromptGuideline(
|
|
60
|
-
'You can combine search terms with uppercase `AND`/`OR`, infix `NOT`, `||`, or space-separated `|`. Parentheses containing Boolean operators group conditions. Regex groups, classes, and escapes stay inside terms: `(?:foo|bar)\\d+ AND "keep.me" NOT ignored`. Quoted terms stay literal, including during regex fallback; `foo|bar` first searches that exact text, then regex alternatives.',
|
|
61
|
-
);
|
|
62
|
-
api.addPromptGuideline(
|
|
63
|
-
"You can use `regex:<pattern>` to force regex-only search and `files:<pattern>` for file paths. Empty or unhandled protocol queries fall back to searching the original text, including the prefix. Resolver errors, timeouts, and successful empty protocol results do not trigger text fallback.",
|
|
64
|
-
);
|
|
65
|
-
api.addPromptGuideline(
|
|
66
|
-
"You can narrow local search with `path`, `include`, `exclude`, `caseSensitive`, `wholeWord`, and `limit`.",
|
|
67
|
-
);
|
|
68
|
-
api.addPromptGuideline(
|
|
69
|
-
[
|
|
70
|
-
"You can reuse complete text and regex search results through these `SEARCH#...` values:",
|
|
71
|
-
" - `SEARCH#HASH:N:line` selects one result's full line.",
|
|
72
|
-
" - `SEARCH#HASH:N:match` selects one exact match.",
|
|
73
|
-
" - `SEARCH#HASH:all:line` selects every unique containing line.",
|
|
74
|
-
" - `SEARCH#HASH:all:match` selects every exact match.",
|
|
75
|
-
" Read shows the containing lines for both modes; `:line` and `:match` control the edit range, not partial-line read rendering.",
|
|
76
|
-
" Limited or incomplete searches omit the `all` values.",
|
|
77
|
-
].join("\n"),
|
|
78
|
-
);
|
|
79
|
-
api.addPromptGuideline(
|
|
80
|
-
"You can pass a returned `SEARCH#...` value directly to read or a compatible mutation tool as its path or anchor. Omit the file path when an `all` value spans files.",
|
|
81
|
-
);
|
|
82
|
-
api.addPromptGuideline(
|
|
83
|
-
"You can replace every exact search match by passing `SEARCH#HASH:all:match` as the replace path, or replace whole matched lines with `SEARCH#HASH:all:line`.",
|
|
84
|
-
);
|
|
85
112
|
},
|
|
86
113
|
}),
|
|
87
114
|
connectTextEditorPlugin(pi, {
|
|
@@ -89,6 +116,28 @@ export default async function registerTextSearch(pi: ExtensionAPI): Promise<void
|
|
|
89
116
|
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
90
117
|
id: "search-anchors",
|
|
91
118
|
setup(api): void {
|
|
119
|
+
api.tool("replace").addHandler({
|
|
120
|
+
stage: "text-post-edit",
|
|
121
|
+
async handler(state) {
|
|
122
|
+
if (
|
|
123
|
+
!state.result ||
|
|
124
|
+
typeof state.result !== "object" ||
|
|
125
|
+
!("kind" in state.result) ||
|
|
126
|
+
state.result.kind !== "completed" ||
|
|
127
|
+
!state.input ||
|
|
128
|
+
typeof state.input !== "object"
|
|
129
|
+
)
|
|
130
|
+
return state;
|
|
131
|
+
const input = state.input as Record<string, unknown>;
|
|
132
|
+
const observations = await sessions.observeAfterEdit(
|
|
133
|
+
[input.path, input.start, input.end],
|
|
134
|
+
state.signal,
|
|
135
|
+
);
|
|
136
|
+
return observations.length === 0
|
|
137
|
+
? state
|
|
138
|
+
: { ...state, metadata: { ...state.metadata, searchObservations: observations } };
|
|
139
|
+
},
|
|
140
|
+
});
|
|
92
141
|
api.addAnchorResolver({
|
|
93
142
|
resolver: sessions.anchorResolver(),
|
|
94
143
|
resources: sessions.resourceResolver(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"pi-agent-doctor": "0.
|
|
20
|
-
"pi-agent-invariant": "0.
|
|
21
|
-
"pi-agent-search": "0.
|
|
22
|
-
"pi-agent-text": "0.
|
|
23
|
-
"pi-agent-text-editor": "0.
|
|
19
|
+
"pi-agent-doctor": "0.3.0",
|
|
20
|
+
"pi-agent-invariant": "0.3.0",
|
|
21
|
+
"pi-agent-search": "0.3.0",
|
|
22
|
+
"pi-agent-text": "0.3.0",
|
|
23
|
+
"pi-agent-text-editor": "0.3.0"
|
|
24
24
|
},
|
|
25
25
|
"pi": {
|
|
26
26
|
"extensions": [
|
|
@@ -71,7 +71,7 @@ export function searchFiles(
|
|
|
71
71
|
.split("\n")
|
|
72
72
|
.filter(Boolean)
|
|
73
73
|
.map((file) => path.relative(cwd, path.resolve(cwd, file)))
|
|
74
|
-
.filter((file) =>
|
|
74
|
+
.filter((file) => matchFile(file, query))
|
|
75
75
|
.sort((left, right) => left.localeCompare(right));
|
|
76
76
|
resolve({ files: matches.slice(0, limit), complete: matches.length <= limit });
|
|
77
77
|
});
|
|
@@ -87,6 +87,14 @@ function splitGlobs(value: string | undefined): string[] {
|
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
function matchFile(file: string, query: string): boolean {
|
|
91
|
+
if (/[*?[\]{}]/u.test(query)) {
|
|
92
|
+
const pattern = query.replace(/^\.\//u, "");
|
|
93
|
+
return path.matchesGlob(pattern.includes("/") ? file : path.basename(file), pattern);
|
|
94
|
+
}
|
|
95
|
+
return fuzzyMatch(file, query);
|
|
96
|
+
}
|
|
97
|
+
|
|
90
98
|
function fuzzyMatch(file: string, query: string): boolean {
|
|
91
99
|
if (query.length === 0) {
|
|
92
100
|
return true;
|
|
@@ -13,6 +13,8 @@ export interface SearchFallback {
|
|
|
13
13
|
|
|
14
14
|
/** Replayable search inputs, including the same ordered fallbacks used by the original call. */
|
|
15
15
|
export interface SearchRecipe extends TextSearchRequest {
|
|
16
|
+
/** User-facing query retained separately from the compiled matching expression. */
|
|
17
|
+
readonly originalQuery?: string;
|
|
16
18
|
readonly fallbacks?: readonly SearchFallback[];
|
|
17
19
|
}
|
|
18
20
|
|