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
|
@@ -1,73 +1,68 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { mkdir, mkdtemp, readFile, rm,
|
|
2
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
6
|
import type { AgentContent, ResourceResolutionAttempt, ResourceResolver } from "pi-agent-resource";
|
|
7
7
|
|
|
8
|
-
export const TEMP_RESOURCE_TTL_MS = 5 * 60_000;
|
|
9
|
-
|
|
10
|
-
interface TemporaryResource {
|
|
11
|
-
activeReads: number;
|
|
12
|
-
lastUsedAt: number;
|
|
13
|
-
readonly filePath: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
8
|
export interface TempResourceStoreOptions {
|
|
9
|
+
/** Parent folder for this store's private temporary directory. */
|
|
17
10
|
readonly parentDirectory?: string;
|
|
18
|
-
readonly ttlMs?: number;
|
|
19
11
|
}
|
|
20
12
|
|
|
13
|
+
/** Keeps temporary text resources isolated and readable until the owning runtime disposes it. */
|
|
21
14
|
export class TempResourceStore {
|
|
22
15
|
readonly resolver: ResourceResolver;
|
|
23
|
-
readonly #entries = new Map<string,
|
|
16
|
+
readonly #entries = new Map<string, string>();
|
|
17
|
+
readonly #pendingSaves = new Set<Promise<string>>();
|
|
24
18
|
readonly #parentDirectory: string;
|
|
25
|
-
readonly #ttlMs: number;
|
|
26
19
|
#directoryReady: Promise<string> | undefined;
|
|
27
|
-
#
|
|
28
|
-
#timer: ReturnType<typeof setTimeout> | undefined;
|
|
20
|
+
#disposal: Promise<void> | undefined;
|
|
29
21
|
|
|
30
22
|
constructor(options: TempResourceStoreOptions = {}) {
|
|
31
23
|
this.#parentDirectory = options.parentDirectory ?? tmpdir();
|
|
32
|
-
this.#ttlMs = options.ttlMs ?? TEMP_RESOURCE_TTL_MS;
|
|
33
|
-
|
|
34
|
-
if (!Number.isFinite(this.#ttlMs) || this.#ttlMs <= 0) {
|
|
35
|
-
throw new TypeError("Temporary resource TTL must be a positive finite number");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
24
|
this.resolver = {
|
|
39
25
|
id: "temp",
|
|
40
26
|
tryResolve: (source) => Promise.resolve(this.#resolve(source)),
|
|
41
27
|
};
|
|
42
28
|
}
|
|
43
29
|
|
|
30
|
+
/** Saves text and returns a reference owned by this store. Rejects after disposal starts. */
|
|
44
31
|
async save(text: string): Promise<string> {
|
|
45
|
-
if (this.#
|
|
32
|
+
if (this.#disposal !== undefined) {
|
|
46
33
|
throw new Error("Temporary resource store is closed");
|
|
47
34
|
}
|
|
48
35
|
|
|
36
|
+
const saving = this.#save(text);
|
|
37
|
+
this.#pendingSaves.add(saving);
|
|
38
|
+
try {
|
|
39
|
+
return await saving;
|
|
40
|
+
} finally {
|
|
41
|
+
this.#pendingSaves.delete(saving);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Closes the store, waits for pending saves, and removes its private directory. */
|
|
46
|
+
dispose(): Promise<void> {
|
|
47
|
+
this.#disposal ??= this.#dispose();
|
|
48
|
+
return this.#disposal;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async #save(text: string): Promise<string> {
|
|
49
52
|
const directory = await this.#getDirectory();
|
|
50
53
|
const id = randomUUID();
|
|
51
54
|
const source = `temp:${id}`;
|
|
52
55
|
const filePath = path.join(directory, `${id}.txt`);
|
|
53
56
|
await writeFile(filePath, text, { encoding: "utf8", flag: "wx" });
|
|
54
|
-
this.#entries.set(source,
|
|
55
|
-
this.#scheduleCleanup();
|
|
57
|
+
this.#entries.set(source, filePath);
|
|
56
58
|
return source;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
async dispose(): Promise<void> {
|
|
60
|
-
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
this.#disposed = true;
|
|
65
|
-
this.#clearTimer();
|
|
61
|
+
async #dispose(): Promise<void> {
|
|
62
|
+
await Promise.allSettled(this.#pendingSaves);
|
|
66
63
|
this.#entries.clear();
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (directoryReady !== undefined) {
|
|
70
|
-
await rm(await directoryReady, { recursive: true, force: true });
|
|
64
|
+
if (this.#directoryReady !== undefined) {
|
|
65
|
+
await rm(await this.#directoryReady, { recursive: true, force: true });
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
68
|
|
|
@@ -76,22 +71,10 @@ export class TempResourceStore {
|
|
|
76
71
|
return { kind: "not-handled" };
|
|
77
72
|
}
|
|
78
73
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (entry === undefined) {
|
|
82
|
-
return {
|
|
83
|
-
kind: "failed",
|
|
84
|
-
error: new Error(`Temporary resource ${source} expired or does not exist`),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (entry.activeReads === 0 && entry.lastUsedAt + this.#ttlMs <= Date.now()) {
|
|
89
|
-
this.#entries.delete(source);
|
|
90
|
-
void unlink(entry.filePath).catch(() => {});
|
|
91
|
-
this.#scheduleCleanup();
|
|
74
|
+
if (this.#disposal !== undefined || !this.#entries.has(source)) {
|
|
92
75
|
return {
|
|
93
76
|
kind: "failed",
|
|
94
|
-
error: new Error(`Temporary resource ${source}
|
|
77
|
+
error: new Error(`Temporary resource ${source} does not exist in this runtime`),
|
|
95
78
|
};
|
|
96
79
|
}
|
|
97
80
|
|
|
@@ -105,22 +88,11 @@ export class TempResourceStore {
|
|
|
105
88
|
}
|
|
106
89
|
|
|
107
90
|
async #read(source: string): Promise<AgentContent> {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
throw new Error(`Temporary resource ${source} expired or does not exist`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
entry.activeReads += 1;
|
|
115
|
-
this.#scheduleCleanup();
|
|
116
|
-
|
|
117
|
-
try {
|
|
118
|
-
return [{ type: "text" as const, text: await readFile(entry.filePath, "utf8") }];
|
|
119
|
-
} finally {
|
|
120
|
-
entry.activeReads -= 1;
|
|
121
|
-
entry.lastUsedAt = Date.now();
|
|
122
|
-
this.#scheduleCleanup();
|
|
91
|
+
const filePath = this.#entries.get(source);
|
|
92
|
+
if (this.#disposal !== undefined || filePath === undefined) {
|
|
93
|
+
throw new Error(`Temporary resource ${source} does not exist in this runtime`);
|
|
123
94
|
}
|
|
95
|
+
return [{ type: "text", text: await readFile(filePath, "utf8") }];
|
|
124
96
|
}
|
|
125
97
|
|
|
126
98
|
async #getDirectory(): Promise<string> {
|
|
@@ -130,67 +102,4 @@ export class TempResourceStore {
|
|
|
130
102
|
})();
|
|
131
103
|
return this.#directoryReady;
|
|
132
104
|
}
|
|
133
|
-
|
|
134
|
-
#scheduleCleanup(): void {
|
|
135
|
-
this.#clearTimer();
|
|
136
|
-
|
|
137
|
-
if (this.#disposed) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const now = Date.now();
|
|
142
|
-
let nextDeadline: number | undefined;
|
|
143
|
-
|
|
144
|
-
for (const entry of this.#entries.values()) {
|
|
145
|
-
if (entry.activeReads > 0) {
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const deadline = entry.lastUsedAt + this.#ttlMs;
|
|
150
|
-
nextDeadline = nextDeadline === undefined ? deadline : Math.min(nextDeadline, deadline);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (nextDeadline === undefined) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
this.#timer = setTimeout(
|
|
158
|
-
() => {
|
|
159
|
-
this.#timer = undefined;
|
|
160
|
-
void this.#removeExpired().catch(() => {
|
|
161
|
-
this.#scheduleCleanup();
|
|
162
|
-
});
|
|
163
|
-
},
|
|
164
|
-
Math.max(0, nextDeadline - now),
|
|
165
|
-
);
|
|
166
|
-
this.#timer.unref();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
async #removeExpired(): Promise<void> {
|
|
170
|
-
const now = Date.now();
|
|
171
|
-
const expired = [...this.#entries].filter(
|
|
172
|
-
([, entry]) => entry.activeReads === 0 && entry.lastUsedAt + this.#ttlMs <= now,
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
await Promise.all(
|
|
176
|
-
expired.map(async ([source, entry]) => {
|
|
177
|
-
await unlink(entry.filePath).catch((error: unknown) => {
|
|
178
|
-
if (!(error instanceof Error) || !("code" in error) || error.code !== "ENOENT") {
|
|
179
|
-
throw error;
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
this.#entries.delete(source);
|
|
183
|
-
}),
|
|
184
|
-
);
|
|
185
|
-
this.#scheduleCleanup();
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
#clearTimer(): void {
|
|
189
|
-
if (this.#timer === undefined) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
clearTimeout(this.#timer);
|
|
194
|
-
this.#timer = undefined;
|
|
195
|
-
}
|
|
196
105
|
}
|
|
@@ -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
|
|
|
@@ -14,12 +14,5 @@ export function renderContentDescription(
|
|
|
14
14
|
throw new TypeError("Content provider summary must be one non-empty line");
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
return [
|
|
18
|
-
normalizedSummary,
|
|
19
|
-
...descriptions.map(({ id, description }) => `- \`${escapeInlineCode(id)}\` — ${description}`),
|
|
20
|
-
].join("\n");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function escapeInlineCode(value: string): string {
|
|
24
|
-
return value.replaceAll("`", "\\`");
|
|
17
|
+
return [normalizedSummary, ...descriptions.map(({ description }) => description)].join("\n");
|
|
25
18
|
}
|
|
@@ -3,6 +3,8 @@ import type { Resource } from "./resource.js";
|
|
|
3
3
|
export interface ResourceResolverContext {
|
|
4
4
|
readonly cwd: string;
|
|
5
5
|
readonly signal?: AbortSignal;
|
|
6
|
+
/** Caller surface; script reads can request different data readiness. */
|
|
7
|
+
readonly audience?: "agent" | "script";
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export type ResourceResolutionAttempt =
|
|
@@ -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": [
|
|
@@ -5,7 +5,7 @@ import type { SearchPluginApi } from "#src/api/search.js";
|
|
|
5
5
|
|
|
6
6
|
export const SEARCH_PROTOCOL = "pi-agent-search" as const;
|
|
7
7
|
|
|
8
|
-
export const SEARCH_API_VERSION =
|
|
8
|
+
export const SEARCH_API_VERSION = 3 as const;
|
|
9
9
|
|
|
10
10
|
export const SEARCH_CORE_READY_EVENT = "pi-agent-search/core/ready" as const;
|
|
11
11
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
|
|
3
|
+
/** Canonical arguments shared by standalone and composed operations. */
|
|
4
|
+
export const searchSchema = Type.Object(
|
|
5
|
+
{
|
|
6
|
+
query: Type.String({
|
|
7
|
+
minLength: 1,
|
|
8
|
+
description:
|
|
9
|
+
"Text to find, a Boolean expression, or a prefixed query described below, such as files:*.ts. Quote text to keep it literal, or use regex:<pattern> for regular-expression matching.",
|
|
10
|
+
}),
|
|
11
|
+
path: Type.Optional(
|
|
12
|
+
Type.String({ description: "Optional file or directory scope for local search" }),
|
|
13
|
+
),
|
|
14
|
+
include: Type.Optional(Type.String({ description: "Optional include glob for local search" })),
|
|
15
|
+
exclude: Type.Optional(Type.String({ description: "Optional exclude glob for local search" })),
|
|
16
|
+
caseSensitive: Type.Optional(
|
|
17
|
+
Type.Boolean({ description: "Match letter case in local search" }),
|
|
18
|
+
),
|
|
19
|
+
wholeWord: Type.Optional(Type.Boolean({ description: "Match complete words in local search" })),
|
|
20
|
+
limit: Type.Optional(
|
|
21
|
+
Type.Integer({ minimum: 1, maximum: 1000, description: "Maximum results (default 100)" }),
|
|
22
|
+
),
|
|
23
|
+
},
|
|
24
|
+
{ additionalProperties: false },
|
|
25
|
+
);
|