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
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { lstat, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { deferPostEdit, collectPostEditNotifications } from "#src/core/post-edit-scope.js";
|
|
1
4
|
import { requiredValue } from "pi-agent-invariant";
|
|
2
5
|
import {
|
|
3
6
|
isAgentContent,
|
|
@@ -39,6 +42,7 @@ import {
|
|
|
39
42
|
isTextAnchorResolverRegistration,
|
|
40
43
|
isTextEditorToolId,
|
|
41
44
|
type PromptDescriptionSource,
|
|
45
|
+
type ScriptIndexOperation,
|
|
42
46
|
type ResourceResolverRegistration,
|
|
43
47
|
TEXT_EDITOR_API_VERSION,
|
|
44
48
|
TEXT_EDITOR_PROTOCOL,
|
|
@@ -156,6 +160,7 @@ interface PluginContributionDraft {
|
|
|
156
160
|
readonly editCompletionListeners?: TextEditCompletionListener[];
|
|
157
161
|
readonly mutationGuards?: TextMutationGuardRegistration[];
|
|
158
162
|
readonly toolRenderers?: TextEditorToolRendererRegistration[];
|
|
163
|
+
readonly scriptIndexOperations?: ScriptIndexOperation[];
|
|
159
164
|
}
|
|
160
165
|
|
|
161
166
|
interface PluginContributionController {
|
|
@@ -261,6 +266,10 @@ export interface TextResourcesEditContext
|
|
|
261
266
|
extends ResourceResolverContext, TextMutationGuardContext {}
|
|
262
267
|
|
|
263
268
|
export interface TextEditorCore {
|
|
269
|
+
/** Finalize a surviving local text file after a whole-file operation; binary files are untouched. */
|
|
270
|
+
postProcessFile(source: string, context: ResourceResolverContext): Promise<void>;
|
|
271
|
+
/** Serialize whole-file effects with text edits; the action must not enqueue another edit. */
|
|
272
|
+
enqueueFileOperation<T>(action: () => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
264
273
|
inspectTextAnchors(request: TextAnchorInspectionRequest): Promise<TextAnchorInspectionOutcome>;
|
|
265
274
|
addAnchorResolver(registration: TextAnchorResolverRegistration): void;
|
|
266
275
|
resolveTextAnchorResources(
|
|
@@ -305,6 +314,8 @@ export interface TextEditorCore {
|
|
|
305
314
|
onMutationTool(listener: TextMutationToolListener): () => void;
|
|
306
315
|
onDidEdit(listener: TextEditCompletionListener): () => void;
|
|
307
316
|
getToolRenderer(tool: TextEditorToolId): TextEditorToolRendererRegistration | undefined;
|
|
317
|
+
/** Return a configured index operation for the Apply host. */
|
|
318
|
+
getScriptIndexOperation(name: string): ScriptIndexOperation | undefined;
|
|
308
319
|
registerPlugin(plugin: TextEditorPlugin): Promise<void>;
|
|
309
320
|
registerPostEditHandler(registration: TextPostEditHandlerRegistration): () => void;
|
|
310
321
|
registerTool(tool: TextEditorToolId): void;
|
|
@@ -337,7 +348,22 @@ export function createTextEditorCore(
|
|
|
337
348
|
const editCompletionListeners = new Set<TextEditCompletionListener>();
|
|
338
349
|
const mutationGuards: TextMutationGuardRegistration[] = [];
|
|
339
350
|
const toolRenderers = new Map<TextEditorToolId, TextEditorToolRendererRegistration>();
|
|
351
|
+
const scriptIndexOperations = new Map<string, ScriptIndexOperation>();
|
|
340
352
|
let registrationQueue = Promise.resolve();
|
|
353
|
+
// One core owns all IDE mutations, including ordinary tools and Apply. Queue the full
|
|
354
|
+
// read-modify-write window so aliases and multi-resource edits cannot lose updates.
|
|
355
|
+
let mutationTail: Promise<void> = Promise.resolve();
|
|
356
|
+
const enqueueMutation = <T>(action: () => Promise<T>, signal?: AbortSignal): Promise<T> => {
|
|
357
|
+
const pending = mutationTail.then(() => {
|
|
358
|
+
signal?.throwIfAborted();
|
|
359
|
+
return action();
|
|
360
|
+
});
|
|
361
|
+
mutationTail = pending.then(
|
|
362
|
+
() => undefined,
|
|
363
|
+
() => undefined,
|
|
364
|
+
);
|
|
365
|
+
return pending;
|
|
366
|
+
};
|
|
341
367
|
const registerContributions = (draft: PluginContributionDraft): void => {
|
|
342
368
|
validateContributionDraft(
|
|
343
369
|
draft,
|
|
@@ -348,6 +374,17 @@ export function createTextEditorCore(
|
|
|
348
374
|
);
|
|
349
375
|
|
|
350
376
|
const incomingMutationNames = new Set<string>();
|
|
377
|
+
const incomingIndexNames = new Set<string>();
|
|
378
|
+
for (const operation of draft.scriptIndexOperations ?? []) {
|
|
379
|
+
if (
|
|
380
|
+
!["stage", "unstage"].includes(operation.name) ||
|
|
381
|
+
typeof operation.execute !== "function" ||
|
|
382
|
+
scriptIndexOperations.has(operation.name) ||
|
|
383
|
+
incomingIndexNames.has(operation.name)
|
|
384
|
+
)
|
|
385
|
+
throw new Error(`Invalid or duplicate script index operation ${operation.name}`);
|
|
386
|
+
incomingIndexNames.add(operation.name);
|
|
387
|
+
}
|
|
351
388
|
|
|
352
389
|
for (const registration of draft.mutationTools ?? []) {
|
|
353
390
|
assertTextMutationToolRegistration(registration);
|
|
@@ -400,6 +437,8 @@ export function createTextEditorCore(
|
|
|
400
437
|
}
|
|
401
438
|
|
|
402
439
|
handlers.push(...draft.handlers);
|
|
440
|
+
for (const operation of draft.scriptIndexOperations ?? [])
|
|
441
|
+
scriptIndexOperations.set(operation.name, operation);
|
|
403
442
|
mutationGuards.push(...(draft.mutationGuards ?? []));
|
|
404
443
|
promptContributions.push(...draft.promptContributions);
|
|
405
444
|
writablePromptContributions.push(...draft.writablePromptContributions);
|
|
@@ -435,6 +474,36 @@ export function createTextEditorCore(
|
|
|
435
474
|
};
|
|
436
475
|
|
|
437
476
|
const core: TextEditorCore = {
|
|
477
|
+
async postProcessFile(source, context) {
|
|
478
|
+
await enqueueMutation(async () => {
|
|
479
|
+
const file = path.resolve(context.cwd, source);
|
|
480
|
+
const stat = await lstat(file).catch(() => undefined);
|
|
481
|
+
if (!stat?.isFile() || stat.isSymbolicLink()) return;
|
|
482
|
+
const bytes = await readFile(file);
|
|
483
|
+
const text = bytes.toString("utf8");
|
|
484
|
+
if (bytes.includes(0) || !Buffer.from(text).equals(bytes)) return;
|
|
485
|
+
await finalizeTextResource({
|
|
486
|
+
requestedSource: file,
|
|
487
|
+
outcomeSource: file,
|
|
488
|
+
resource: {
|
|
489
|
+
source: file,
|
|
490
|
+
async read() {
|
|
491
|
+
return [{ type: "text", text: await readFile(file, "utf8") }];
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
resolvedBy: "filesystem",
|
|
495
|
+
existed: true,
|
|
496
|
+
before: createTextDocument(file, text),
|
|
497
|
+
requestedText: text,
|
|
498
|
+
context,
|
|
499
|
+
presenters: [...presenters],
|
|
500
|
+
postEditHandlers: [...postEditHandlers.values()],
|
|
501
|
+
editCompletionListeners: [...editCompletionListeners],
|
|
502
|
+
result: undefined,
|
|
503
|
+
});
|
|
504
|
+
}, context.signal);
|
|
505
|
+
},
|
|
506
|
+
enqueueFileOperation: enqueueMutation,
|
|
438
507
|
addAnchorResolver(registration): void {
|
|
439
508
|
if (!isTextAnchorResolverRegistration(registration)) {
|
|
440
509
|
throw new TypeError("Invalid text anchor resolver");
|
|
@@ -464,6 +533,9 @@ export function createTextEditorCore(
|
|
|
464
533
|
editCompletionListeners.add(listener);
|
|
465
534
|
return () => editCompletionListeners.delete(listener);
|
|
466
535
|
},
|
|
536
|
+
getScriptIndexOperation(name) {
|
|
537
|
+
return scriptIndexOperations.get(name);
|
|
538
|
+
},
|
|
467
539
|
getToolRenderer(tool): TextEditorToolRendererRegistration | undefined {
|
|
468
540
|
return toolRenderers.get(tool);
|
|
469
541
|
},
|
|
@@ -509,15 +581,19 @@ export function createTextEditorCore(
|
|
|
509
581
|
(left.registration.priority ?? 0) - (right.registration.priority ?? 0) ||
|
|
510
582
|
left.order - right.order,
|
|
511
583
|
);
|
|
512
|
-
return
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
584
|
+
return enqueueMutation(
|
|
585
|
+
() =>
|
|
586
|
+
editTextResource(
|
|
587
|
+
source,
|
|
588
|
+
context,
|
|
589
|
+
resolverSnapshot,
|
|
590
|
+
anchorRegistry.snapshot(),
|
|
591
|
+
presenterSnapshot,
|
|
592
|
+
[...postEditHandlers.values()],
|
|
593
|
+
[...editCompletionListeners],
|
|
594
|
+
operation,
|
|
595
|
+
),
|
|
596
|
+
context.signal,
|
|
521
597
|
);
|
|
522
598
|
},
|
|
523
599
|
editTexts<Result>(
|
|
@@ -536,16 +612,20 @@ export function createTextEditorCore(
|
|
|
536
612
|
(left.registration.priority ?? 0) - (right.registration.priority ?? 0) ||
|
|
537
613
|
left.order - right.order,
|
|
538
614
|
);
|
|
539
|
-
return
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
615
|
+
return enqueueMutation(
|
|
616
|
+
() =>
|
|
617
|
+
editTextResources(
|
|
618
|
+
sources,
|
|
619
|
+
context,
|
|
620
|
+
resolverSnapshot,
|
|
621
|
+
anchorRegistry.snapshot(),
|
|
622
|
+
presenterSnapshot,
|
|
623
|
+
[...postEditHandlers.values()],
|
|
624
|
+
[...editCompletionListeners],
|
|
625
|
+
[...mutationGuards],
|
|
626
|
+
operation,
|
|
627
|
+
),
|
|
628
|
+
context.signal,
|
|
549
629
|
);
|
|
550
630
|
},
|
|
551
631
|
previewTexts(sources, context, operation): Promise<TextMutationPreviewOutcome> {
|
|
@@ -881,7 +961,7 @@ async function previewTextResources(
|
|
|
881
961
|
const applied =
|
|
882
962
|
changes === undefined
|
|
883
963
|
? { content: item.before.content, changes: [] }
|
|
884
|
-
: applyTextChanges(item.before.content, changes);
|
|
964
|
+
: applyTextChanges(item.before.content, changes, !item.existed);
|
|
885
965
|
return {
|
|
886
966
|
path: source,
|
|
887
967
|
existed: item.existed,
|
|
@@ -986,7 +1066,7 @@ async function editTextResources<Result>(
|
|
|
986
1066
|
|
|
987
1067
|
for (const [source, changes] of mutation.changes) {
|
|
988
1068
|
const item = requiredValue(prepared.get(source));
|
|
989
|
-
applied.set(source, applyTextChanges(item.before.content, changes));
|
|
1069
|
+
applied.set(source, applyTextChanges(item.before.content, changes, !item.existed));
|
|
990
1070
|
}
|
|
991
1071
|
|
|
992
1072
|
const plan: TextMutationPlan = {
|
|
@@ -994,7 +1074,7 @@ async function editTextResources<Result>(
|
|
|
994
1074
|
const item = requiredValue(prepared.get(source));
|
|
995
1075
|
const result = applied.get(source);
|
|
996
1076
|
|
|
997
|
-
return result === undefined || result.content === item.before.content
|
|
1077
|
+
return result === undefined || (item.existed && result.content === item.before.content)
|
|
998
1078
|
? []
|
|
999
1079
|
: [
|
|
1000
1080
|
{
|
|
@@ -1047,7 +1127,7 @@ async function editTextResources<Result>(
|
|
|
1047
1127
|
const text = applied.get(source)?.content;
|
|
1048
1128
|
const item = requiredValue(prepared.get(source));
|
|
1049
1129
|
|
|
1050
|
-
if (text === undefined || text === item.before.content) {
|
|
1130
|
+
if (text === undefined || (item.existed && text === item.before.content)) {
|
|
1051
1131
|
continue;
|
|
1052
1132
|
}
|
|
1053
1133
|
|
|
@@ -1103,27 +1183,28 @@ async function editTextResources<Result>(
|
|
|
1103
1183
|
completed.push(source);
|
|
1104
1184
|
}
|
|
1105
1185
|
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1186
|
+
await collectPostEditNotifications(async () => {
|
|
1187
|
+
for (const source of written) {
|
|
1188
|
+
const text = requiredValue(applied.get(source)).content;
|
|
1189
|
+
const item = requiredValue(prepared.get(source));
|
|
1190
|
+
outcomes.push(
|
|
1191
|
+
await finalizeTextResource({
|
|
1192
|
+
requestedSource: item.requestedSource,
|
|
1193
|
+
outcomeSource: item.requestedSource,
|
|
1194
|
+
resource: item.resource,
|
|
1195
|
+
resolvedBy: item.resolverId,
|
|
1196
|
+
existed: item.existed,
|
|
1197
|
+
before: item.before,
|
|
1198
|
+
requestedText: text,
|
|
1199
|
+
context,
|
|
1200
|
+
presenters,
|
|
1201
|
+
postEditHandlers,
|
|
1202
|
+
editCompletionListeners,
|
|
1203
|
+
result: mutation.result,
|
|
1204
|
+
}),
|
|
1205
|
+
);
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1127
1208
|
return { kind: "completed", resources: outcomes, result: mutation.result };
|
|
1128
1209
|
}
|
|
1129
1210
|
|
|
@@ -1253,6 +1334,7 @@ async function prepareTextResource(
|
|
|
1253
1334
|
}
|
|
1254
1335
|
|
|
1255
1336
|
interface FinalizeTextResourceRequest<Result> {
|
|
1337
|
+
readonly postProcessingFinal?: boolean;
|
|
1256
1338
|
readonly requestedSource: string;
|
|
1257
1339
|
readonly outcomeSource: string;
|
|
1258
1340
|
readonly resource: Resource;
|
|
@@ -1270,6 +1352,33 @@ interface FinalizeTextResourceRequest<Result> {
|
|
|
1270
1352
|
async function finalizeTextResource<Result>(
|
|
1271
1353
|
request: FinalizeTextResourceRequest<Result>,
|
|
1272
1354
|
): Promise<Exclude<TextResourceEditOutcome<Result>, { readonly kind: "failed" }>> {
|
|
1355
|
+
const skipPostEdit = request.resource.skipPostEdit === true;
|
|
1356
|
+
if (
|
|
1357
|
+
!skipPostEdit &&
|
|
1358
|
+
request.postProcessingFinal &&
|
|
1359
|
+
!request.context.signal?.aborted &&
|
|
1360
|
+
request.resource.read
|
|
1361
|
+
) {
|
|
1362
|
+
const current = await request.resource.read(
|
|
1363
|
+
request.context.signal ? { signal: request.context.signal } : {},
|
|
1364
|
+
);
|
|
1365
|
+
if (
|
|
1366
|
+
!isAgentContent(current) ||
|
|
1367
|
+
current.length !== 1 ||
|
|
1368
|
+
current[0].type !== "text" ||
|
|
1369
|
+
current[0].text !== request.requestedText
|
|
1370
|
+
)
|
|
1371
|
+
throw Object.assign(
|
|
1372
|
+
new Error(`Resource changed before final post-processing: ${request.resource.source}`),
|
|
1373
|
+
{ code: "POST_EDIT_STALE" },
|
|
1374
|
+
);
|
|
1375
|
+
}
|
|
1376
|
+
const deferred =
|
|
1377
|
+
!skipPostEdit &&
|
|
1378
|
+
!request.postProcessingFinal &&
|
|
1379
|
+
deferPostEdit(request.resource.source, () =>
|
|
1380
|
+
finalizeTextResource({ ...request, postProcessingFinal: true }),
|
|
1381
|
+
);
|
|
1273
1382
|
const requestedAfter = createTextDocument(request.resource.source, request.requestedText);
|
|
1274
1383
|
const transaction: TextPostEditTransaction = {
|
|
1275
1384
|
source: request.requestedSource,
|
|
@@ -1280,9 +1389,13 @@ async function finalizeTextResource<Result>(
|
|
|
1280
1389
|
requestedAfter,
|
|
1281
1390
|
...(request.context.signal !== undefined && { signal: request.context.signal }),
|
|
1282
1391
|
};
|
|
1283
|
-
const postEditContributions: TextPostEditContribution[] =
|
|
1392
|
+
const postEditContributions: TextPostEditContribution[] = deferred
|
|
1393
|
+
? [{ id: "post-edit-scope", data: { formatting: { status: "deferred" } } }]
|
|
1394
|
+
: [];
|
|
1284
1395
|
|
|
1285
|
-
for (const registration of request.
|
|
1396
|
+
for (const registration of skipPostEdit || deferred || request.context.signal?.aborted
|
|
1397
|
+
? []
|
|
1398
|
+
: request.postEditHandlers) {
|
|
1286
1399
|
try {
|
|
1287
1400
|
const data = await registration.handler(transaction);
|
|
1288
1401
|
|
|
@@ -1296,7 +1409,7 @@ async function finalizeTextResource<Result>(
|
|
|
1296
1409
|
|
|
1297
1410
|
let finalText = request.requestedText;
|
|
1298
1411
|
|
|
1299
|
-
if (request.resource.read !== undefined) {
|
|
1412
|
+
if (!skipPostEdit && request.resource.read !== undefined) {
|
|
1300
1413
|
try {
|
|
1301
1414
|
const reread = await request.resource.read(
|
|
1302
1415
|
request.context.signal === undefined ? {} : { signal: request.context.signal },
|
|
@@ -1317,9 +1430,10 @@ async function finalizeTextResource<Result>(
|
|
|
1317
1430
|
resolvedBy: request.resolvedBy,
|
|
1318
1431
|
cwd: request.context.cwd,
|
|
1319
1432
|
existed: request.existed,
|
|
1320
|
-
before: request.before,
|
|
1433
|
+
before: request.postProcessingFinal ? requestedAfter : request.before,
|
|
1321
1434
|
after: finalAfter,
|
|
1322
1435
|
intent: request.context.intent ?? "edit",
|
|
1436
|
+
postProcessing: deferred ? "deferred" : request.postProcessingFinal ? "final" : "complete",
|
|
1323
1437
|
};
|
|
1324
1438
|
|
|
1325
1439
|
for (const listener of request.editCompletionListeners) {
|
|
@@ -1339,7 +1453,7 @@ async function finalizeTextResource<Result>(
|
|
|
1339
1453
|
...(request.context.signal !== undefined && { signal: request.context.signal }),
|
|
1340
1454
|
};
|
|
1341
1455
|
|
|
1342
|
-
for (const { registration } of request.presenters) {
|
|
1456
|
+
for (const { registration } of request.context.signal?.aborted ? [] : request.presenters) {
|
|
1343
1457
|
after = await registration.presenter.present(after, presentationContext);
|
|
1344
1458
|
}
|
|
1345
1459
|
|
|
@@ -1621,7 +1735,7 @@ function pluginFailure(
|
|
|
1621
1735
|
pluginId,
|
|
1622
1736
|
tool,
|
|
1623
1737
|
stage,
|
|
1624
|
-
message: `Plugin ${pluginId} failed during ${stage}`,
|
|
1738
|
+
message: `Plugin ${pluginId} failed during ${stage}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
1625
1739
|
cause,
|
|
1626
1740
|
};
|
|
1627
1741
|
}
|
|
@@ -1670,6 +1784,7 @@ function createPluginContributionController(
|
|
|
1670
1784
|
editCompletionListeners: [],
|
|
1671
1785
|
mutationGuards: [],
|
|
1672
1786
|
toolRenderers: [],
|
|
1787
|
+
scriptIndexOperations: [],
|
|
1673
1788
|
};
|
|
1674
1789
|
let state: "active" | "closed" | "setup" = "setup";
|
|
1675
1790
|
const assertAvailable = (): void => {
|
|
@@ -1746,6 +1861,22 @@ function createPluginContributionController(
|
|
|
1746
1861
|
mutationTools: [registration],
|
|
1747
1862
|
});
|
|
1748
1863
|
},
|
|
1864
|
+
addScriptIndexOperation(operation): void {
|
|
1865
|
+
assertAvailable();
|
|
1866
|
+
if (state === "setup") {
|
|
1867
|
+
requiredValue(setupDraft.scriptIndexOperations).push(operation);
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
registerContributions({
|
|
1871
|
+
resolvers: [],
|
|
1872
|
+
anchorResolvers: [],
|
|
1873
|
+
handlers: [],
|
|
1874
|
+
promptContributions: [],
|
|
1875
|
+
writablePromptContributions: [],
|
|
1876
|
+
tools: [],
|
|
1877
|
+
scriptIndexOperations: [operation],
|
|
1878
|
+
});
|
|
1879
|
+
},
|
|
1749
1880
|
addToolRenderer(registration): void {
|
|
1750
1881
|
assertAvailable();
|
|
1751
1882
|
|
|
@@ -2172,11 +2303,41 @@ function mergeToolRenderer(
|
|
|
2172
2303
|
current: TextEditorToolRendererRegistration | undefined,
|
|
2173
2304
|
registration: TextEditorToolRendererRegistration,
|
|
2174
2305
|
): TextEditorToolRendererRegistration {
|
|
2306
|
+
if (registration.matches !== undefined) {
|
|
2307
|
+
const renderCall = registration.renderCall;
|
|
2308
|
+
const renderResult = registration.renderResult;
|
|
2309
|
+
const currentRenderCall = current?.renderCall;
|
|
2310
|
+
const currentRenderResult = current?.renderResult;
|
|
2311
|
+
return {
|
|
2312
|
+
...current,
|
|
2313
|
+
tool: registration.tool,
|
|
2314
|
+
...(renderCall === undefined
|
|
2315
|
+
? {}
|
|
2316
|
+
: currentRenderCall === undefined
|
|
2317
|
+
? { renderCall }
|
|
2318
|
+
: {
|
|
2319
|
+
renderCall: (...arguments_: Parameters<typeof renderCall>) =>
|
|
2320
|
+
registration.matches?.(arguments_[0], "call") === true
|
|
2321
|
+
? renderCall(...arguments_)
|
|
2322
|
+
: currentRenderCall(...arguments_),
|
|
2323
|
+
}),
|
|
2324
|
+
...(renderResult === undefined
|
|
2325
|
+
? {}
|
|
2326
|
+
: currentRenderResult === undefined
|
|
2327
|
+
? { renderResult }
|
|
2328
|
+
: {
|
|
2329
|
+
renderResult: (...arguments_: Parameters<typeof renderResult>) =>
|
|
2330
|
+
registration.matches?.(arguments_[0], "result") === true
|
|
2331
|
+
? renderResult(...arguments_)
|
|
2332
|
+
: currentRenderResult(...arguments_),
|
|
2333
|
+
}),
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2175
2336
|
const merged =
|
|
2176
2337
|
registration.fallback === true
|
|
2177
2338
|
? { ...registration, ...current, tool: registration.tool }
|
|
2178
2339
|
: { ...current, ...registration, tool: registration.tool };
|
|
2179
|
-
const { fallback: _fallback, ...renderer } = merged;
|
|
2340
|
+
const { fallback: _fallback, matches: _matches, ...renderer } = merged;
|
|
2180
2341
|
return renderer;
|
|
2181
2342
|
}
|
|
2182
2343
|
|