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
|
@@ -62,13 +62,65 @@ export interface SearchActionRegistration {
|
|
|
62
62
|
execute(reference: string, input: unknown, context: SearchContext): Promise<unknown>;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/** Full resolver data plus registered selection details, separate from rendered output. */
|
|
66
|
+
export interface SearchScriptData {
|
|
67
|
+
readonly resolverId: string;
|
|
68
|
+
readonly data: unknown;
|
|
69
|
+
readonly details: unknown;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A search execution with optional data for script callers. */
|
|
73
|
+
export interface SearchToolResult extends AgentToolResult<SearchToolDetails> {
|
|
74
|
+
readonly script?: SearchScriptData;
|
|
75
|
+
}
|
|
76
|
+
/** Exact text ranges discovered by any search backend. Columns are zero-based UTF-16 offsets. */
|
|
77
|
+
export interface SearchSelectionMatch {
|
|
78
|
+
readonly source: string;
|
|
79
|
+
readonly lineNumber: number;
|
|
80
|
+
readonly endLineNumber?: number;
|
|
81
|
+
readonly startColumn: number;
|
|
82
|
+
readonly endColumn: number;
|
|
83
|
+
readonly matchedText: string;
|
|
84
|
+
readonly lineText: string;
|
|
85
|
+
}
|
|
86
|
+
export interface SearchSelectionSnapshot {
|
|
87
|
+
readonly matches: readonly SearchSelectionMatch[];
|
|
88
|
+
readonly complete: boolean;
|
|
89
|
+
readonly notices?: readonly string[];
|
|
90
|
+
}
|
|
91
|
+
/** Keep the original backend when refreshing an all-selection or observing an edit. */
|
|
92
|
+
export interface SearchSelectionRegistration extends SearchSelectionSnapshot {
|
|
93
|
+
readonly request: SearchRequest;
|
|
94
|
+
readonly refresh: (signal?: AbortSignal) => Promise<SearchSelectionSnapshot>;
|
|
95
|
+
}
|
|
96
|
+
export interface RegisteredSearchSelection {
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly matches: readonly SearchSelectionMatch[];
|
|
99
|
+
readonly complete: boolean;
|
|
100
|
+
}
|
|
101
|
+
export type SearchSelectionProvider = (
|
|
102
|
+
selection: SearchSelectionRegistration,
|
|
103
|
+
context: SearchContext,
|
|
104
|
+
) => Promise<RegisteredSearchSelection>;
|
|
65
105
|
export interface SearchPluginApi {
|
|
66
106
|
addResolver(registration: SearchResolverRegistration): void;
|
|
107
|
+
/** Register the one shared SEARCH reference store. */
|
|
108
|
+
addSelectionProvider(provider: SearchSelectionProvider): void;
|
|
109
|
+
/** Register exact ranges with the shared store, retaining backend refresh behavior. */
|
|
110
|
+
registerSelection(
|
|
111
|
+
selection: SearchSelectionRegistration,
|
|
112
|
+
context: SearchContext,
|
|
113
|
+
): Promise<RegisteredSearchSelection>;
|
|
67
114
|
addAction(registration: SearchActionRegistration): void;
|
|
68
115
|
describe(description: SearchDescriptionSource): void;
|
|
69
116
|
/** Add an operational guideline while this search plugin is active. */
|
|
70
117
|
addPromptGuideline(guideline: SearchDescriptionSource): void;
|
|
71
|
-
|
|
118
|
+
/** Execute configured resolvers and register references before returning script data. */
|
|
119
|
+
search(
|
|
120
|
+
request: SearchRequest,
|
|
121
|
+
context: SearchContext,
|
|
122
|
+
audience?: "agent" | "script",
|
|
123
|
+
): Promise<SearchToolResult>;
|
|
72
124
|
runAction(request: SearchActionRequest, context: SearchContext): Promise<unknown>;
|
|
73
125
|
}
|
|
74
126
|
|
|
@@ -87,3 +139,5 @@ export interface SearchToolDetails {
|
|
|
87
139
|
readonly cause?: unknown;
|
|
88
140
|
};
|
|
89
141
|
}
|
|
142
|
+
|
|
143
|
+
export { searchSchema } from "#src/api/search-parameters.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ToolCallInterceptionRenderStore,
|
|
18
18
|
withToolCallInterceptionRendering,
|
|
19
19
|
} from "pi-agent-tool-call-interception";
|
|
20
|
-
import {
|
|
20
|
+
import type { Static } from "typebox";
|
|
21
21
|
|
|
22
22
|
import {
|
|
23
23
|
isSearchPluginRegistrationRequest,
|
|
@@ -33,28 +33,7 @@ import { runWithSearchTimeout } from "#src/core/search-timeout.js";
|
|
|
33
33
|
|
|
34
34
|
import type { SearchToolDetails } from "#src/api/search.js";
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
query: Type.String({
|
|
39
|
-
minLength: 1,
|
|
40
|
-
description:
|
|
41
|
-
"Search query. Local text tries literal terms, then regex, then eligible word fallback. Quotes keep terms literal and Boolean conditions stay intact. Empty or unhandled prefixes are text; nonempty installed prefixes select specialized search protocols.",
|
|
42
|
-
}),
|
|
43
|
-
path: Type.Optional(
|
|
44
|
-
Type.String({ description: "Optional file or directory scope for local search" }),
|
|
45
|
-
),
|
|
46
|
-
include: Type.Optional(Type.String({ description: "Optional include glob for local search" })),
|
|
47
|
-
exclude: Type.Optional(Type.String({ description: "Optional exclude glob for local search" })),
|
|
48
|
-
caseSensitive: Type.Optional(
|
|
49
|
-
Type.Boolean({ description: "Match letter case in local search" }),
|
|
50
|
-
),
|
|
51
|
-
wholeWord: Type.Optional(Type.Boolean({ description: "Match complete words in local search" })),
|
|
52
|
-
limit: Type.Optional(
|
|
53
|
-
Type.Integer({ minimum: 1, maximum: 1000, description: "Maximum results (default 100)" }),
|
|
54
|
-
),
|
|
55
|
-
},
|
|
56
|
-
{ additionalProperties: false },
|
|
57
|
-
);
|
|
36
|
+
import { searchSchema } from "#src/api/search-parameters.js";
|
|
58
37
|
|
|
59
38
|
/** Arguments accepted by the search tool. */
|
|
60
39
|
export type SearchParameters = Static<typeof searchSchema>;
|
|
@@ -110,15 +89,17 @@ export default async function registerSearchCore(pi: ExtensionAPI): Promise<void
|
|
|
110
89
|
{
|
|
111
90
|
name: "search",
|
|
112
91
|
label: "search",
|
|
113
|
-
description:
|
|
114
|
-
|
|
92
|
+
get description(): string {
|
|
93
|
+
return [
|
|
94
|
+
"Use search to locate text, file paths and code structures in the workspace.",
|
|
95
|
+
...core.renderDescriptions(),
|
|
96
|
+
].join("\n");
|
|
97
|
+
},
|
|
115
98
|
promptSnippet:
|
|
116
99
|
"Search files and text with literals or regular expressions, plus syntax trees and language symbols",
|
|
117
100
|
get promptGuidelines(): string[] {
|
|
118
101
|
return [
|
|
119
|
-
"Use search instead of grep, rg, or find to search workspace text and paths.",
|
|
120
102
|
"Use the narrowest useful search query and scope; broaden when needed.",
|
|
121
|
-
"Do not use search merely to rediscover a file path already named in the request; use that path directly. Search within it only when you need to locate content.",
|
|
122
103
|
...core.renderPromptGuidelines(),
|
|
123
104
|
];
|
|
124
105
|
},
|
|
@@ -3,6 +3,7 @@ import { withBlockedToolResult } from "pi-agent-tool-call-interception";
|
|
|
3
3
|
import type { SearchPlugin } from "#src/api/plugin-protocol.js";
|
|
4
4
|
import type {
|
|
5
5
|
SearchActionRegistration,
|
|
6
|
+
SearchSelectionProvider,
|
|
6
7
|
SearchContext,
|
|
7
8
|
SearchDescriptionSource,
|
|
8
9
|
SearchPluginApi,
|
|
@@ -10,6 +11,7 @@ import type {
|
|
|
10
11
|
SearchResolutionAttempt,
|
|
11
12
|
SearchResolverRegistration,
|
|
12
13
|
SearchToolDetails,
|
|
14
|
+
SearchToolResult,
|
|
13
15
|
} from "#src/api/search.js";
|
|
14
16
|
import type { AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
15
17
|
|
|
@@ -25,7 +27,8 @@ export interface SearchCore {
|
|
|
25
27
|
execute(
|
|
26
28
|
request: SearchRequest,
|
|
27
29
|
context: SearchContext,
|
|
28
|
-
|
|
30
|
+
audience?: "agent" | "script",
|
|
31
|
+
): Promise<SearchToolResult>;
|
|
29
32
|
runAction(
|
|
30
33
|
reference: string,
|
|
31
34
|
capability: string,
|
|
@@ -34,13 +37,17 @@ export interface SearchCore {
|
|
|
34
37
|
context: SearchContext,
|
|
35
38
|
): Promise<unknown>;
|
|
36
39
|
renderPromptGuidelines(): readonly string[];
|
|
40
|
+
/** Describes capabilities contributed by successfully registered plugins. */
|
|
41
|
+
renderDescriptions(): readonly string[];
|
|
37
42
|
renderer(resolverId: string): SearchResolverRegistration["resolver"]["renderResult"];
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export function createSearchCore(): SearchCore {
|
|
41
46
|
const resolvers: RegisteredResolver[] = [];
|
|
47
|
+
let selectionProvider: SearchSelectionProvider | undefined;
|
|
42
48
|
const actions = new Map<string, SearchActionRegistration>();
|
|
43
49
|
const promptGuidelines = new Map<string, SearchDescriptionSource[]>();
|
|
50
|
+
const descriptions = new Map<string, SearchDescriptionSource>();
|
|
44
51
|
const plugins = new Map<string, Promise<void>>();
|
|
45
52
|
let queue = Promise.resolve();
|
|
46
53
|
|
|
@@ -59,9 +66,22 @@ export function createSearchCore(): SearchCore {
|
|
|
59
66
|
const ready = queue.then(async () => {
|
|
60
67
|
const draftResolvers: SearchResolverRegistration[] = [];
|
|
61
68
|
const draftActions: SearchActionRegistration[] = [];
|
|
69
|
+
let draftSelectionProvider: SearchSelectionProvider | undefined;
|
|
62
70
|
let draftDescription: SearchDescriptionSource | undefined;
|
|
63
71
|
const draftPromptGuidelines: SearchDescriptionSource[] = [];
|
|
64
72
|
const api: SearchPluginApi = {
|
|
73
|
+
addSelectionProvider(provider) {
|
|
74
|
+
if (draftSelectionProvider !== undefined || selectionProvider !== undefined)
|
|
75
|
+
throw new Error("Search selection provider is already registered");
|
|
76
|
+
draftSelectionProvider = provider;
|
|
77
|
+
},
|
|
78
|
+
registerSelection(selection, context) {
|
|
79
|
+
if (selectionProvider === undefined)
|
|
80
|
+
throw new Error(
|
|
81
|
+
"Search selections are unavailable. Enable the shared search selection plugin.",
|
|
82
|
+
);
|
|
83
|
+
return selectionProvider(selection, context);
|
|
84
|
+
},
|
|
65
85
|
addResolver(registration): void {
|
|
66
86
|
assertResolver(registration);
|
|
67
87
|
draftResolvers.push(registration);
|
|
@@ -80,7 +100,7 @@ export function createSearchCore(): SearchCore {
|
|
|
80
100
|
addPromptGuideline(guideline): void {
|
|
81
101
|
draftPromptGuidelines.push(normalizeDescriptionSource(guideline));
|
|
82
102
|
},
|
|
83
|
-
search: (request, context) => core.execute(request, context),
|
|
103
|
+
search: (request, context, audience) => core.execute(request, context, audience),
|
|
84
104
|
runAction(request, context): Promise<unknown> {
|
|
85
105
|
return core.runAction(
|
|
86
106
|
request.reference,
|
|
@@ -120,11 +140,13 @@ export function createSearchCore(): SearchCore {
|
|
|
120
140
|
for (const registration of draftResolvers) {
|
|
121
141
|
resolvers.push({ pluginId: plugin.id, registration, order: resolvers.length });
|
|
122
142
|
}
|
|
143
|
+
if (draftSelectionProvider !== undefined) selectionProvider = draftSelectionProvider;
|
|
123
144
|
|
|
124
145
|
for (const action of draftActions) {
|
|
125
146
|
actions.set(actionKey(action.resolverId, action.capability), action);
|
|
126
147
|
}
|
|
127
148
|
|
|
149
|
+
if (draftDescription !== undefined) descriptions.set(plugin.id, draftDescription);
|
|
128
150
|
if (draftPromptGuidelines.length > 0) {
|
|
129
151
|
promptGuidelines.set(plugin.id, draftPromptGuidelines);
|
|
130
152
|
}
|
|
@@ -141,7 +163,7 @@ export function createSearchCore(): SearchCore {
|
|
|
141
163
|
async waitForPendingPlugins(): Promise<void> {
|
|
142
164
|
await Promise.all(plugins.values());
|
|
143
165
|
},
|
|
144
|
-
async execute(request, context): Promise<
|
|
166
|
+
async execute(request, context, audience = "agent"): Promise<SearchToolResult> {
|
|
145
167
|
if (request.query.trim().length === 0) {
|
|
146
168
|
return failure("INVALID_REQUEST", "Search query must not be empty");
|
|
147
169
|
}
|
|
@@ -219,6 +241,13 @@ export function createSearchCore(): SearchCore {
|
|
|
219
241
|
]
|
|
220
242
|
: formatted.content,
|
|
221
243
|
details: { resolverId: resolver.id, payload: formatted.details },
|
|
244
|
+
...(audience === "script" && {
|
|
245
|
+
script: {
|
|
246
|
+
resolverId: resolver.id,
|
|
247
|
+
data: attempt.payload,
|
|
248
|
+
details: formatted.details,
|
|
249
|
+
},
|
|
250
|
+
}),
|
|
222
251
|
...(formatted.usage !== undefined && { usage: formatted.usage }),
|
|
223
252
|
};
|
|
224
253
|
} catch (error) {
|
|
@@ -243,6 +272,12 @@ export function createSearchCore(): SearchCore {
|
|
|
243
272
|
|
|
244
273
|
return action.execute(reference, input, context);
|
|
245
274
|
},
|
|
275
|
+
renderDescriptions(): readonly string[] {
|
|
276
|
+
return [...descriptions.values()].flatMap((source) => {
|
|
277
|
+
const description = renderDescription(source);
|
|
278
|
+
return description === undefined ? [] : [description];
|
|
279
|
+
});
|
|
280
|
+
},
|
|
246
281
|
renderPromptGuidelines(): readonly string[] {
|
|
247
282
|
return [...promptGuidelines.values()].flat().flatMap((source) => {
|
|
248
283
|
const guideline = renderDescription(source);
|
|
@@ -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
|
|