pi-agent-ide 0.2.2 → 0.4.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 +46 -0
- package/README.md +13 -8
- package/dist/chunk-3SE372WC.js +3 -0
- package/dist/chunk-5MSNYFDE.js +1 -0
- package/dist/chunk-5VSE5X5R.js +2 -0
- package/dist/chunk-6DZA4CLO.js +4 -0
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/{chunk-ORAPGW7W.js → chunk-72EEL2DW.js} +1 -1
- package/dist/chunk-7JYQMAEL.js +14 -0
- package/dist/{chunk-T2RPMEM2.js → chunk-7UGNGK7Y.js} +1 -1
- package/dist/{chunk-STUZZM5B.js → chunk-AADJ2KIB.js} +1 -1
- package/dist/{chunk-XF5PVZOS.js → chunk-B5KB2I7J.js} +1 -1
- package/dist/chunk-DQF5QMJ2.js +1 -0
- package/dist/chunk-EJ5OACQM.js +1 -0
- package/dist/chunk-GFW5QPQV.js +2 -0
- package/dist/{chunk-LQYZG62K.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-J34VKQGJ.js +1 -0
- package/dist/chunk-KAB3AYA2.js +1 -0
- package/dist/{chunk-76WHES5H.js → chunk-M5L42DWE.js} +5 -5
- package/dist/chunk-M5MJP7Z2.js +1 -0
- package/dist/chunk-NMFQGKPE.js +2 -0
- package/dist/chunk-NTYXZ3EL.js +3 -0
- package/dist/{chunk-P6T3Q7LB.js → chunk-QDST6VIU.js} +1 -1
- package/dist/chunk-ROXXK6TW.js +0 -0
- package/dist/{chunk-WNMGUALD.js → chunk-TI5GMJ7Q.js} +1 -1
- package/dist/{chunk-4ZTEPMJO.js → chunk-TPIHQYK2.js} +1 -1
- package/dist/chunk-XSTHESNR.js +25 -0
- package/dist/{chunk-THSCUT2L.js → chunk-Y7ZMR4LT.js} +1 -1
- package/dist/chunk-YHADTHQM.js +1 -0
- package/dist/{chunk-KZBAJFCV.js → chunk-Z3VC3S2T.js} +1 -1
- package/dist/{chunk-ZXN3TWWW.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-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 +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +10 -5
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-31.js +3 -3
- package/dist/entry-32.js +6 -5
- 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 +12 -8
- 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 +4 -4
- package/dist/entry-46.js +10 -10
- 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 -59
- package/dist/entry-70.js +123 -4
- package/dist/entry-71.js +30 -1
- package/dist/entry-72.js +2 -29
- package/dist/entry-73.js +1 -2
- 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 -3
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/pi-agent-ide.js +3 -2
- package/docs/configuration.md +32 -11
- package/docs/tools.md +17 -0
- package/node_modules/pi-agent-doctor/package.json +1 -1
- 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/extension.ts +4 -3
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +68 -45
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/node_modules/pi-agent-ide-changes/index.ts +21 -5
- 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 +4 -2
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +26 -8
- 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 +46 -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 +126 -8
- 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 +18 -3
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +4 -0
- 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-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- 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/tools/read.ts +73 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +26 -2
- 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 +64 -14
- 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 +73 -44
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
- package/node_modules/pi-agent-resource/src/resource.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 +2 -23
- package/node_modules/pi-agent-search/src/core/search-core.ts +28 -3
- package/node_modules/pi-agent-search-text/index.ts +44 -4
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/search-session.ts +65 -25
- package/node_modules/pi-agent-text/package.json +2 -2
- 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/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/plugin-protocol.ts +15 -1
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
- 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/diff-tool.ts +205 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +6 -0
- 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 +1 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +6 -1
- 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-change-engine.ts +10 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +17 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +212 -51
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +273 -11
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/index.ts +88 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +42 -25
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +20 -12
- 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-ui/package.json +2 -2
- 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-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 +41 -38
- package/src/api/plugin-protocol.ts +10 -2
- package/src/api/tool-config.ts +73 -2
- package/src/code-view/diagnostic-view.ts +22 -3
- package/src/composite/builtin-extensions.ts +10 -15
- package/src/composite/extensions-config.ts +59 -0
- package/src/composite/feature-flags.ts +32 -0
- package/src/composite/module-labels.ts +59 -0
- package/src/composite/module-settings-store.ts +60 -0
- package/src/composite/module-settings.ts +162 -0
- package/src/composite/preferences.ts +26 -0
- package/src/composite/selection.ts +4 -4
- package/src/composite/settings-panel.ts +103 -0
- package/src/core/diagnostic-delivery.ts +29 -0
- package/src/core/diagnostic-entry.ts +51 -3
- package/src/core/diagnostic-store.ts +56 -5
- package/src/core/extension.ts +34 -33
- 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/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-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/tools/read.ts +73 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +26 -2
- 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 +64 -14
- 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 +73 -44
- package/src/extensions/pi-agent-search/package.json +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +44 -4
- 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/search-session.ts +65 -25
- 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 +2 -23
- package/src/extensions/pi-agent-search/src/core/search-core.ts +28 -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/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 +88 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +42 -25
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +20 -12
- 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/plugin-protocol.ts +15 -1
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
- 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/diff-tool.ts +205 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +6 -0
- 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 +1 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +6 -1
- 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-change-engine.ts +10 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +17 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +212 -51
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +273 -11
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +1 -1
- package/src/pi-agent-ide.ts +43 -8
- package/src/plugins/pi-agent-ide-ast/package.json +9 -9
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +4 -3
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +68 -45
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/src/plugins/pi-agent-ide-changes/index.ts +21 -5
- 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 +4 -2
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +62 -11
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +26 -8
- 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 +46 -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 +126 -8
- 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 +18 -3
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +4 -0
- 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/plugins/pi-agent-ide-terminal/index.ts +34 -0
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +238 -0
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +461 -0
- package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +127 -0
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +159 -0
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +529 -0
- package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +56 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +157 -0
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +66 -0
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +336 -0
- package/src/post-edit/gate.ts +15 -2
- package/dist/chunk-4U6KGABH.js +0 -1
- package/dist/chunk-6ACQQBUY.js +0 -7
- package/dist/chunk-GFWDXTOB.js +0 -4
- package/dist/chunk-JASLOB2X.js +0 -1
- package/dist/chunk-JJVXUL5U.js +0 -2
- package/dist/chunk-KCEOTU5Z.js +0 -3
- package/dist/chunk-KVGQG43U.js +0 -1
- package/dist/chunk-QJFRAMK7.js +0 -2
- package/dist/chunk-RAZOACDD.js +0 -2
- package/dist/chunk-RIGRP3FD.js +0 -1
- package/dist/chunk-VCCMVQXU.js +0 -1
- package/dist/chunk-X6MPU7UO.js +0 -3
- package/dist/chunk-YPHXLAQF.js +0 -1
- package/dist/entry-80.js +0 -1
- 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-text-editor/plugins/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +0 -16
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-70.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +0 -17
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- /package/dist/{chunk-3H2EU7VQ.js → chunk-4U2GUKNJ.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-argument-order → pi-agent-text-editor}/runtime/entry-70.js +0 -0
- /package/node_modules/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
type TextTargetResolutionAttempt,
|
|
18
18
|
} from "pi-agent-text";
|
|
19
19
|
import { withBlockedToolResult } from "pi-agent-tool-call-interception";
|
|
20
|
-
import { Type } from "typebox";
|
|
21
20
|
|
|
22
21
|
import {
|
|
23
22
|
isFragmentResolverRegistration,
|
|
@@ -53,32 +52,8 @@ import {
|
|
|
53
52
|
} from "#src/core/tools/read/read-result.js";
|
|
54
53
|
import { TempResourceStore } from "#src/core/tools/read/temp-resource-store.js";
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Type.String({
|
|
59
|
-
description:
|
|
60
|
-
"What to read: a file or directory path, URL, returned temp: or SEARCH# reference, or one of the source forms listed in the description. Supply a path; an empty call cannot select a source.",
|
|
61
|
-
}),
|
|
62
|
-
),
|
|
63
|
-
offset: Type.Optional(
|
|
64
|
-
Type.Number({
|
|
65
|
-
description:
|
|
66
|
-
"First line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end. For path#anchor or a SEARCH selection, count from its containing line instead: 0 or 1 starts there, 2 starts one line later, -1 one line earlier.",
|
|
67
|
-
}),
|
|
68
|
-
),
|
|
69
|
-
limit: Type.Optional(
|
|
70
|
-
Type.Number({
|
|
71
|
-
description:
|
|
72
|
-
"Maximum lines to read from the selected starting position, subject to the output budget. Omit for the default bounded read.",
|
|
73
|
-
}),
|
|
74
|
-
),
|
|
75
|
-
views: Type.Optional(
|
|
76
|
-
Type.Array(Type.String(), {
|
|
77
|
-
description:
|
|
78
|
-
'Optional additions to the returned text. Use the views listed in the tool description. Combine views when needed, for example ["anchors", "ast"] for source text with editable line references and scope boundaries. Omit for the source\'s default presentation.',
|
|
79
|
-
}),
|
|
80
|
-
),
|
|
81
|
-
});
|
|
55
|
+
import { readParameters } from "#src/api/read-parameters.js";
|
|
56
|
+
import { readRaw } from "#src/core/tools/read/raw-read.js";
|
|
82
57
|
|
|
83
58
|
const fallbackReadRenderer = createReadResultRenderer({ kind: "source" });
|
|
84
59
|
|
|
@@ -121,10 +96,13 @@ export interface ReadToolContributions {
|
|
|
121
96
|
}
|
|
122
97
|
|
|
123
98
|
export interface ReadTool {
|
|
99
|
+
/** Shares the read runtime's temporary resource store with composed operations. */
|
|
100
|
+
saveTemporary(text: string): Promise<string>;
|
|
124
101
|
readonly tool: ToolDefinition<typeof readParameters, ReadResultDetails>;
|
|
125
102
|
execute(
|
|
126
103
|
request: ReadPipelineContext["request"],
|
|
127
104
|
context: ResourceResolverContext,
|
|
105
|
+
audience?: "agent" | "script",
|
|
128
106
|
): Promise<ReadToolResult>;
|
|
129
107
|
registerContributions(pluginId: string, contributions: ReadToolContributions): void;
|
|
130
108
|
dispose(): Promise<void>;
|
|
@@ -155,15 +133,17 @@ export function createReadTool(
|
|
|
155
133
|
const toolId = "read";
|
|
156
134
|
|
|
157
135
|
return {
|
|
136
|
+
saveTemporary: (text) => temporaryResources.save(text),
|
|
158
137
|
tool: {
|
|
159
138
|
name: toolId,
|
|
160
139
|
label: toolId,
|
|
161
140
|
|
|
162
141
|
promptSnippet:
|
|
163
|
-
"Read files, URLs, temporary resources, search selections, and protocol sources, with optional views projected onto text content",
|
|
142
|
+
"Read files, original bytes with raw:, URLs, temporary resources, search selections, and protocol sources, with optional views projected onto text content",
|
|
164
143
|
get description(): string {
|
|
165
144
|
return [
|
|
166
|
-
`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.`,
|
|
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.",
|
|
167
147
|
pluginDescription?.() ?? "",
|
|
168
148
|
]
|
|
169
149
|
.filter(Boolean)
|
|
@@ -172,6 +152,7 @@ export function createReadTool(
|
|
|
172
152
|
get promptGuidelines(): string[] {
|
|
173
153
|
return [
|
|
174
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.",
|
|
175
156
|
...(pluginPromptGuidelines?.() ?? []),
|
|
176
157
|
];
|
|
177
158
|
},
|
|
@@ -202,7 +183,7 @@ export function createReadTool(
|
|
|
202
183
|
);
|
|
203
184
|
},
|
|
204
185
|
},
|
|
205
|
-
execute(request, context): Promise<ReadToolResult> {
|
|
186
|
+
execute(request, context, audience = "agent"): Promise<ReadToolResult> {
|
|
206
187
|
return executeRead(
|
|
207
188
|
request,
|
|
208
189
|
context,
|
|
@@ -212,6 +193,7 @@ export function createReadTool(
|
|
|
212
193
|
temporaryResources,
|
|
213
194
|
fragments,
|
|
214
195
|
targetResolvers,
|
|
196
|
+
audience,
|
|
215
197
|
);
|
|
216
198
|
},
|
|
217
199
|
registerContributions(pluginId, contributions): void {
|
|
@@ -309,7 +291,12 @@ async function executeRead(
|
|
|
309
291
|
readonly priority: number;
|
|
310
292
|
readonly order: number;
|
|
311
293
|
}[],
|
|
294
|
+
audience: "agent" | "script" = "agent",
|
|
312
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;
|
|
313
300
|
const resolverSnapshot = [...resolvers].sort(
|
|
314
301
|
(left, right) => left.priority - right.priority || left.order - right.order,
|
|
315
302
|
);
|
|
@@ -325,7 +312,10 @@ async function executeRead(
|
|
|
325
312
|
const targetSnapshot = [...targetResolvers].sort(
|
|
326
313
|
(left, right) => left.priority - right.priority || left.order - right.order,
|
|
327
314
|
);
|
|
328
|
-
const requestedViews = new Set(
|
|
315
|
+
const requestedViews = new Set([
|
|
316
|
+
...(request.views ?? []),
|
|
317
|
+
...(audience === "script" ? viewSnapshot.map(({ registration }) => registration.view) : []),
|
|
318
|
+
]);
|
|
329
319
|
const knownViews = new Set([...viewSnapshot.map(({ registration }) => registration.view)]);
|
|
330
320
|
const ignoredViews = [...requestedViews].filter((view) => !knownViews.has(view));
|
|
331
321
|
if (request.path !== undefined && targetSnapshot.length > 0) {
|
|
@@ -338,19 +328,17 @@ async function executeRead(
|
|
|
338
328
|
viewSnapshot,
|
|
339
329
|
requestedViews,
|
|
340
330
|
ignoredViews,
|
|
331
|
+
audience,
|
|
341
332
|
);
|
|
342
333
|
if (targeted !== undefined) return targeted;
|
|
343
334
|
}
|
|
344
|
-
let pipeline: ReadPipelineContext = { request: { ...request }, resolverContext };
|
|
335
|
+
let pipeline: ReadPipelineContext = { request: { ...request }, resolverContext, audience };
|
|
345
336
|
|
|
346
337
|
if (!pipeline.request.path?.startsWith("temp:")) {
|
|
347
338
|
const preRead = await runPreReadHandlers(pipeline, handlerSnapshot);
|
|
348
339
|
|
|
349
340
|
if (preRead.kind === "return") {
|
|
350
|
-
return withIgnoredViews(
|
|
351
|
-
await limitReadOutput(preRead.result, pipeline.request),
|
|
352
|
-
ignoredViews,
|
|
353
|
-
);
|
|
341
|
+
return withIgnoredViews(await limitOutput(preRead.result, pipeline.request), ignoredViews);
|
|
354
342
|
}
|
|
355
343
|
|
|
356
344
|
pipeline = preRead.context;
|
|
@@ -392,7 +380,7 @@ async function executeRead(
|
|
|
392
380
|
}
|
|
393
381
|
}
|
|
394
382
|
if (resolved.kind === "return") {
|
|
395
|
-
return
|
|
383
|
+
return limitOutput(resolved.result, pipeline.request);
|
|
396
384
|
}
|
|
397
385
|
|
|
398
386
|
pipeline = resolved.context;
|
|
@@ -411,8 +399,8 @@ async function executeRead(
|
|
|
411
399
|
|
|
412
400
|
if (pipeline.state?.textMode === "final") {
|
|
413
401
|
return withIgnoredViews(
|
|
414
|
-
await
|
|
415
|
-
projectReadState(pipeline.state, pipeline.request, { originLine: origin }),
|
|
402
|
+
await limitOutput(
|
|
403
|
+
projectReadState(pipeline.state, pipeline.request, { originLine: origin, audience }),
|
|
416
404
|
pipeline.request,
|
|
417
405
|
undefined,
|
|
418
406
|
{ originLine: origin },
|
|
@@ -425,7 +413,7 @@ async function executeRead(
|
|
|
425
413
|
|
|
426
414
|
if (processed.kind === "return") {
|
|
427
415
|
return withIgnoredViews(
|
|
428
|
-
await
|
|
416
|
+
await limitOutput(processed.result, pipeline.request, undefined, { originLine: origin }),
|
|
429
417
|
ignoredViews,
|
|
430
418
|
);
|
|
431
419
|
}
|
|
@@ -433,6 +421,7 @@ async function executeRead(
|
|
|
433
421
|
pipeline = processed.context;
|
|
434
422
|
pipeline = await runTextPresenters(pipeline, viewSnapshot, requestedViews);
|
|
435
423
|
const projected = projectReadState(requiredValue(pipeline.state), pipeline.request, {
|
|
424
|
+
audience,
|
|
436
425
|
originLine: origin,
|
|
437
426
|
});
|
|
438
427
|
pipeline = { ...pipeline, result: projected };
|
|
@@ -444,7 +433,7 @@ async function executeRead(
|
|
|
444
433
|
? (text: string): Promise<string> => temporaryResources.save(text)
|
|
445
434
|
: undefined;
|
|
446
435
|
return withIgnoredViews(
|
|
447
|
-
await
|
|
436
|
+
await limitOutput(result, pipeline.request, saveFullOutput, { originLine: origin }),
|
|
448
437
|
ignoredViews,
|
|
449
438
|
);
|
|
450
439
|
}
|
|
@@ -480,7 +469,10 @@ async function resolveTextTargets(
|
|
|
480
469
|
views: readonly RegisteredView[],
|
|
481
470
|
requestedViews: ReadonlySet<string>,
|
|
482
471
|
ignoredViews: readonly string[],
|
|
472
|
+
audience: "agent" | "script",
|
|
483
473
|
): Promise<ReadToolResult | undefined> {
|
|
474
|
+
const limitOutput: typeof limitReadOutput =
|
|
475
|
+
audience === "script" ? async (result) => result : limitReadOutput;
|
|
484
476
|
for (const { resolver } of targetResolvers) {
|
|
485
477
|
let rawAttempt: unknown;
|
|
486
478
|
try {
|
|
@@ -522,6 +514,7 @@ async function resolveTextTargets(
|
|
|
522
514
|
message: "Text target resolver returned no targets",
|
|
523
515
|
});
|
|
524
516
|
const chunks: string[] = [];
|
|
517
|
+
const resources: ReadToolResult[] = [];
|
|
525
518
|
let firstDetails: ReadResultDetails | undefined;
|
|
526
519
|
for (const target of attempt.targets) {
|
|
527
520
|
const ranges = target.ranges ?? [
|
|
@@ -536,6 +529,7 @@ async function resolveTextTargets(
|
|
|
536
529
|
limit: request.limit ?? rangeLimit,
|
|
537
530
|
},
|
|
538
531
|
resolverContext,
|
|
532
|
+
audience,
|
|
539
533
|
};
|
|
540
534
|
if (!target.source.startsWith("temp:")) {
|
|
541
535
|
const preRead = await runPreReadHandlers(rangePipeline, handlers);
|
|
@@ -545,6 +539,7 @@ async function resolveTextTargets(
|
|
|
545
539
|
for (const block of preRead.result.content) {
|
|
546
540
|
if (block.type === "text") chunks.push(block.text);
|
|
547
541
|
}
|
|
542
|
+
resources.push(preRead.result);
|
|
548
543
|
firstDetails ??= preRead.result.details;
|
|
549
544
|
continue;
|
|
550
545
|
}
|
|
@@ -561,11 +556,13 @@ async function resolveTextTargets(
|
|
|
561
556
|
for (const block of processed.result.content) {
|
|
562
557
|
if (block.type === "text") chunks.push(block.text);
|
|
563
558
|
}
|
|
559
|
+
resources.push(processed.result);
|
|
564
560
|
firstDetails ??= processed.result.details;
|
|
565
561
|
continue;
|
|
566
562
|
}
|
|
567
563
|
const presented = await runTextPresenters(processed.context, views, requestedViews);
|
|
568
564
|
const projected = projectReadState(requiredValue(presented.state), presented.request, {
|
|
565
|
+
audience,
|
|
569
566
|
originLine: range.start.lineNumber,
|
|
570
567
|
});
|
|
571
568
|
const postRead = await runPostReadHandlers({ ...presented, result: projected }, handlers);
|
|
@@ -576,15 +573,36 @@ async function resolveTextTargets(
|
|
|
576
573
|
for (const block of result.content) {
|
|
577
574
|
if (block.type === "text") chunks.push(block.text);
|
|
578
575
|
}
|
|
576
|
+
resources.push(result);
|
|
579
577
|
firstDetails ??= result.details;
|
|
580
578
|
}
|
|
581
579
|
}
|
|
582
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
|
+
}),
|
|
583
598
|
content: [{ type: "text", text: chunks.join("\n") }],
|
|
584
|
-
details:
|
|
599
|
+
details:
|
|
600
|
+
audience === "script"
|
|
601
|
+
? { source: request.path, resources }
|
|
602
|
+
: (firstDetails ?? { source: request.path }),
|
|
585
603
|
} satisfies ReadToolResult;
|
|
586
604
|
return withIgnoredViews(
|
|
587
|
-
await
|
|
605
|
+
await limitOutput(aggregate, { path: request.path, views: request.views }),
|
|
588
606
|
ignoredViews,
|
|
589
607
|
);
|
|
590
608
|
}
|
|
@@ -908,6 +926,8 @@ async function runTextPresenters(
|
|
|
908
926
|
const document = state.text;
|
|
909
927
|
const presentationContext: TextPresentationContext = {
|
|
910
928
|
purpose: "read",
|
|
929
|
+
audience: context.resolverContext.audience,
|
|
930
|
+
requestedViews: context.request.views,
|
|
911
931
|
source: state.source,
|
|
912
932
|
cwd: context.resolverContext.cwd,
|
|
913
933
|
resolvedBy: state.resolvedBy,
|
|
@@ -1003,7 +1023,15 @@ function mergePresentedLine(base: TextLine, current: TextLine, contribution: Tex
|
|
|
1003
1023
|
);
|
|
1004
1024
|
const metadata = mergeLineMetadata(base.metadata, current.metadata, contribution.metadata);
|
|
1005
1025
|
|
|
1006
|
-
|
|
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
|
+
) {
|
|
1007
1035
|
return current;
|
|
1008
1036
|
}
|
|
1009
1037
|
|
|
@@ -1011,6 +1039,7 @@ function mergePresentedLine(base: TextLine, current: TextLine, contribution: Tex
|
|
|
1011
1039
|
...current,
|
|
1012
1040
|
...(presentation !== undefined && { presentation }),
|
|
1013
1041
|
...(metadata !== undefined && { metadata }),
|
|
1042
|
+
...(anchors !== undefined && { anchors }),
|
|
1014
1043
|
};
|
|
1015
1044
|
}
|
|
1016
1045
|
|
|
@@ -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 =
|
|
@@ -14,6 +14,8 @@ export type ResourceWrite = (
|
|
|
14
14
|
export interface ResourceBase {
|
|
15
15
|
readonly source: string;
|
|
16
16
|
readonly link?: string;
|
|
17
|
+
/** Skip document post-edit processing for stateful resources such as terminals. */
|
|
18
|
+
readonly skipPostEdit?: boolean;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export interface ReadableResource extends ResourceBase {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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.4.0",
|
|
24
|
+
"pi-agent-tool-ui": "0.4.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
|
+
);
|
|
@@ -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
|
-
"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.",
|
|
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>;
|
|
@@ -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,
|
|
@@ -41,6 +44,7 @@ export interface SearchCore {
|
|
|
41
44
|
|
|
42
45
|
export function createSearchCore(): SearchCore {
|
|
43
46
|
const resolvers: RegisteredResolver[] = [];
|
|
47
|
+
let selectionProvider: SearchSelectionProvider | undefined;
|
|
44
48
|
const actions = new Map<string, SearchActionRegistration>();
|
|
45
49
|
const promptGuidelines = new Map<string, SearchDescriptionSource[]>();
|
|
46
50
|
const descriptions = new Map<string, SearchDescriptionSource>();
|
|
@@ -62,9 +66,22 @@ export function createSearchCore(): SearchCore {
|
|
|
62
66
|
const ready = queue.then(async () => {
|
|
63
67
|
const draftResolvers: SearchResolverRegistration[] = [];
|
|
64
68
|
const draftActions: SearchActionRegistration[] = [];
|
|
69
|
+
let draftSelectionProvider: SearchSelectionProvider | undefined;
|
|
65
70
|
let draftDescription: SearchDescriptionSource | undefined;
|
|
66
71
|
const draftPromptGuidelines: SearchDescriptionSource[] = [];
|
|
67
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
|
+
},
|
|
68
85
|
addResolver(registration): void {
|
|
69
86
|
assertResolver(registration);
|
|
70
87
|
draftResolvers.push(registration);
|
|
@@ -83,7 +100,7 @@ export function createSearchCore(): SearchCore {
|
|
|
83
100
|
addPromptGuideline(guideline): void {
|
|
84
101
|
draftPromptGuidelines.push(normalizeDescriptionSource(guideline));
|
|
85
102
|
},
|
|
86
|
-
search: (request, context) => core.execute(request, context),
|
|
103
|
+
search: (request, context, audience) => core.execute(request, context, audience),
|
|
87
104
|
runAction(request, context): Promise<unknown> {
|
|
88
105
|
return core.runAction(
|
|
89
106
|
request.reference,
|
|
@@ -123,6 +140,7 @@ export function createSearchCore(): SearchCore {
|
|
|
123
140
|
for (const registration of draftResolvers) {
|
|
124
141
|
resolvers.push({ pluginId: plugin.id, registration, order: resolvers.length });
|
|
125
142
|
}
|
|
143
|
+
if (draftSelectionProvider !== undefined) selectionProvider = draftSelectionProvider;
|
|
126
144
|
|
|
127
145
|
for (const action of draftActions) {
|
|
128
146
|
actions.set(actionKey(action.resolverId, action.capability), action);
|
|
@@ -145,7 +163,7 @@ export function createSearchCore(): SearchCore {
|
|
|
145
163
|
async waitForPendingPlugins(): Promise<void> {
|
|
146
164
|
await Promise.all(plugins.values());
|
|
147
165
|
},
|
|
148
|
-
async execute(request, context): Promise<
|
|
166
|
+
async execute(request, context, audience = "agent"): Promise<SearchToolResult> {
|
|
149
167
|
if (request.query.trim().length === 0) {
|
|
150
168
|
return failure("INVALID_REQUEST", "Search query must not be empty");
|
|
151
169
|
}
|
|
@@ -223,6 +241,13 @@ export function createSearchCore(): SearchCore {
|
|
|
223
241
|
]
|
|
224
242
|
: formatted.content,
|
|
225
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
|
+
}),
|
|
226
251
|
...(formatted.usage !== undefined && { usage: formatted.usage }),
|
|
227
252
|
};
|
|
228
253
|
} catch (error) {
|
|
@@ -28,10 +28,17 @@ export default async function registerTextSearch(pi: ExtensionAPI): Promise<void
|
|
|
28
28
|
event.details === null
|
|
29
29
|
)
|
|
30
30
|
return;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
);
|
|
35
42
|
if (observations.length === 0) return;
|
|
36
43
|
return {
|
|
37
44
|
content: [
|
|
@@ -80,6 +87,17 @@ export default async function registerTextSearch(pi: ExtensionAPI): Promise<void
|
|
|
80
87
|
apiVersion: SEARCH_API_VERSION,
|
|
81
88
|
id: "local",
|
|
82
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
|
+
);
|
|
83
101
|
api.addResolver({ resolver: createRegexResolver(sessions), priority: -10 });
|
|
84
102
|
api.addResolver({ resolver: createFileResolver(), priority: -10 });
|
|
85
103
|
api.addResolver({ resolver: createTextResolver(sessions), fallback: true });
|
|
@@ -98,6 +116,28 @@ export default async function registerTextSearch(pi: ExtensionAPI): Promise<void
|
|
|
98
116
|
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
99
117
|
id: "search-anchors",
|
|
100
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
|
+
});
|
|
101
141
|
api.addAnchorResolver({
|
|
102
142
|
resolver: sessions.anchorResolver(),
|
|
103
143
|
resources: sessions.resourceResolver(),
|