pi-agent-ide 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +12 -8
- package/dist/{chunk-XNXQYPVT.js → chunk-4LUW26BX.js} +1 -1
- package/dist/chunk-5MSNYFDE.js +1 -0
- package/dist/chunk-5VSE5X5R.js +2 -0
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/{chunk-ORAPGW7W.js → chunk-72EEL2DW.js} +1 -1
- package/dist/{chunk-T2RPMEM2.js → chunk-7UGNGK7Y.js} +1 -1
- package/dist/{chunk-STUZZM5B.js → chunk-AADJ2KIB.js} +1 -1
- package/dist/{chunk-SMSIT3CE.js → chunk-B5KB2I7J.js} +1 -1
- package/dist/chunk-BHSO2MDK.js +6 -0
- package/dist/chunk-BMOJTJJJ.js +3 -0
- package/dist/{chunk-EEH4WYI7.js → chunk-CEKXBS55.js} +1 -1
- package/dist/chunk-CW53ZTU3.js +2 -0
- package/dist/chunk-EWNWKDMP.js +4 -0
- package/dist/{chunk-VSP2QQPQ.js → chunk-GIRAEVUJ.js} +1 -1
- package/dist/{chunk-MTTKFJV6.js → chunk-GUTQ3PWL.js} +1 -1
- package/dist/chunk-HGPUI7F3.js +1 -0
- package/dist/{chunk-OBWZ5RYN.js → chunk-HKMBQLEK.js} +1 -1
- package/dist/chunk-ITSNK5YG.js +7 -0
- package/dist/chunk-KAB3AYA2.js +1 -0
- package/dist/{chunk-266RH77Z.js → chunk-LRYE2WCN.js} +1 -1
- package/dist/chunk-M5L42DWE.js +7 -0
- package/dist/chunk-M5MJP7Z2.js +1 -0
- package/dist/chunk-NMFQGKPE.js +2 -0
- package/dist/chunk-NTYXZ3EL.js +3 -0
- package/dist/{chunk-PETQCA7G.js → chunk-QDST6VIU.js} +1 -1
- package/dist/chunk-QIJMV2P2.js +2 -0
- package/dist/chunk-RHV5STR3.js +3 -0
- package/dist/chunk-ROXXK6TW.js +0 -0
- package/dist/chunk-S3ZPXWX7.js +2 -0
- package/dist/chunk-SSHZEWWV.js +1 -0
- package/dist/chunk-TPIHQYK2.js +14 -0
- package/dist/chunk-VZJIZXSH.js +14 -0
- package/dist/chunk-YHADTHQM.js +1 -0
- package/dist/{chunk-KZBAJFCV.js → chunk-Z3VC3S2T.js} +1 -1
- package/dist/{chunk-SJYDLHEF.js → chunk-ZM4L5AGN.js} +1 -1
- package/dist/{chunk-E2RESHYR.js → chunk-ZTYWHL2F.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-1.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-21.js +2 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +12 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +4 -1
- package/dist/entry-32.js +9 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +18 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +7 -1
- package/dist/entry-46.js +11 -1
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -0
- package/dist/entry-55.js +0 -1
- package/dist/entry-56.js +1 -0
- package/dist/entry-57.js +0 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -0
- package/dist/entry-64.js +0 -1
- package/dist/entry-65.js +1 -0
- package/dist/entry-66.js +0 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +123 -1
- package/dist/entry-71.js +30 -1
- package/dist/entry-72.js +2 -1
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +3 -1
- package/dist/entry-77.js +1 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/pi-agent-ide.js +3 -13
- package/docs/configuration.md +57 -11
- package/docs/extensions.md +4 -2
- package/docs/tools.md +7 -1
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +2 -2
- package/node_modules/pi-agent-filesystem/package.json +6 -6
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +9 -9
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/node_modules/pi-agent-ide-ast/src/extension.ts +11 -15
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +83 -0
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/node_modules/pi-agent-ide-changes/index.ts +22 -10
- package/node_modules/pi-agent-ide-changes/package.json +6 -6
- package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -9
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +36 -13
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/index.ts +49 -17
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-lsp/index.ts +127 -20
- package/node_modules/pi-agent-ide-lsp/package.json +9 -8
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +25 -7
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +12 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-image/src/image-converter.ts +1 -1
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +1 -1
- package/node_modules/pi-agent-read/package.json +6 -6
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/node_modules/pi-agent-read/src/api/rendering.ts +3 -0
- package/node_modules/pi-agent-read/src/api/tools/read.ts +73 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +32 -28
- package/node_modules/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +87 -19
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/node_modules/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +87 -53
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -8
- package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
- package/node_modules/pi-agent-search/package.json +3 -3
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/node_modules/pi-agent-search/src/api/search.ts +55 -1
- package/node_modules/pi-agent-search/src/core/extension.ts +8 -27
- package/node_modules/pi-agent-search/src/core/search-core.ts +38 -3
- package/node_modules/pi-agent-search-text/index.ts +82 -33
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/file-search.ts +9 -1
- package/node_modules/pi-agent-search-text/src/resolvers.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +112 -24
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
- package/node_modules/pi-agent-text/src/text-document.ts +5 -0
- package/node_modules/pi-agent-text/src/text-target.ts +4 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
- package/node_modules/pi-agent-text-editor/index.ts +1 -3
- package/node_modules/pi-agent-text-editor/package.json +34 -24
- package/node_modules/pi-agent-text-editor/runtime/entry-69.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/node_modules/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +74 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -9
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +28 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +43 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +40 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +178 -58
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +313 -21
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/node_modules/pi-agent-text-editor-renderer/index.ts +93 -2
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +69 -4
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +24 -13
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +1 -0
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-web/index.ts +1 -6
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/runtime/entry-75.js +2 -0
- package/node_modules/pi-agent-web/src/browser-loader.ts +1 -0
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/package.json +38 -38
- package/src/api/plugin-protocol.ts +12 -2
- package/src/api/text-editor.ts +7 -0
- package/src/api/tool-config.ts +77 -2
- package/src/code-view/diagnostic-view.ts +22 -3
- package/src/composite/builtin-extensions.ts +138 -67
- package/src/composite/extensions-config.ts +59 -0
- package/src/composite/feature-flags.ts +32 -0
- package/src/composite/module-labels.ts +55 -0
- package/src/composite/module-settings-store.ts +44 -0
- package/src/composite/module-settings.ts +132 -0
- package/src/composite/selection.ts +4 -4
- package/src/composite/settings-panel.ts +71 -0
- package/src/core/diagnostic-delivery.ts +29 -0
- package/src/core/diagnostic-entry.ts +142 -0
- package/src/core/diagnostic-store.ts +96 -23
- package/src/core/extension.ts +45 -22
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +1 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/browser-loader.ts +1 -0
- package/src/extensions/pi-agent-read/package.json +6 -6
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/src/extensions/pi-agent-read/src/api/rendering.ts +3 -0
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +73 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +32 -28
- package/src/extensions/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +87 -19
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +87 -53
- package/src/extensions/pi-agent-search/package.json +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +82 -33
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +9 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +112 -24
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +55 -1
- package/src/extensions/pi-agent-search/src/core/extension.ts +8 -27
- package/src/extensions/pi-agent-search/src/core/search-core.ts +38 -3
- package/src/extensions/pi-agent-text-editor/index.ts +1 -3
- package/src/extensions/pi-agent-text-editor/package.json +34 -24
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +93 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +69 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +24 -13
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/runtime/entry-69.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/src/extensions/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +74 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -9
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +28 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +43 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +40 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +178 -58
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +313 -21
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/src/pi-agent-ide.ts +45 -0
- package/src/plugins/pi-agent-ide-ast/package.json +9 -9
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +11 -15
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +83 -0
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/src/plugins/pi-agent-ide-changes/index.ts +22 -10
- package/src/plugins/pi-agent-ide-changes/package.json +6 -6
- package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -9
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +62 -26
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +36 -13
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/index.ts +49 -17
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-lsp/index.ts +127 -20
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -8
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +25 -7
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +12 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/src/post-edit/gate.ts +57 -15
- package/src/toolchain/types.ts +2 -0
- package/dist/chunk-2SKAED2I.js +0 -2
- package/dist/chunk-2XYXV5HS.js +0 -4
- package/dist/chunk-2ZMYT6ZC.js +0 -1
- package/dist/chunk-34ZQTTU2.js +0 -2
- package/dist/chunk-4SQQKEVD.js +0 -16
- package/dist/chunk-5BWUVAR4.js +0 -1
- package/dist/chunk-6DN7NO7L.js +0 -1
- package/dist/chunk-6SMFVLTY.js +0 -1
- package/dist/chunk-6XQQBKPE.js +0 -58
- package/dist/chunk-BYWAG6X3.js +0 -6
- package/dist/chunk-EW2KVKCN.js +0 -2
- package/dist/chunk-F6SESI3P.js +0 -4
- package/dist/chunk-GTK5AREE.js +0 -2
- package/dist/chunk-HOBTFFQR.js +0 -1
- package/dist/chunk-IMVCVPMP.js +0 -3
- package/dist/chunk-IOCABSRL.js +0 -1
- package/dist/chunk-JASLOB2X.js +0 -1
- package/dist/chunk-KH5KPBCR.js +0 -10
- package/dist/chunk-KNMWCDDK.js +0 -7
- package/dist/chunk-KYVOMBO5.js +0 -1
- package/dist/chunk-L4FA6OD4.js +0 -1
- package/dist/chunk-LFV6G5Z3.js +0 -1
- package/dist/chunk-LGN7EJYR.js +0 -13
- package/dist/chunk-MB6VVVAF.js +0 -2
- package/dist/chunk-MTQSGWZJ.js +0 -1
- package/dist/chunk-NI2NK4JU.js +0 -1
- package/dist/chunk-NXHPO7ER.js +0 -6
- package/dist/chunk-OFHVDY4Q.js +0 -2
- package/dist/chunk-OIL6BB2S.js +0 -33
- package/dist/chunk-ONWUJXUR.js +0 -1
- package/dist/chunk-PODWLGNO.js +0 -6
- package/dist/chunk-QZANC2IG.js +0 -1
- package/dist/chunk-SSZB66C3.js +0 -3
- package/dist/chunk-TG6H6EOI.js +0 -1
- package/dist/chunk-UTTW55S2.js +0 -1
- package/dist/chunk-VEJGSURY.js +0 -8
- package/dist/chunk-W3XYKJ5H.js +0 -1
- package/dist/chunk-XGUAL3CA.js +0 -1
- package/dist/chunk-YPHXLAQF.js +0 -1
- package/dist/chunk-ZIHEF6K3.js +0 -3
- package/dist/entry-80.js +0 -1
- package/node_modules/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/node_modules/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- package/node_modules/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/node_modules/pi-agent-text-editor-argument-order/package.json +0 -16
- package/node_modules/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/node_modules/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/node_modules/pi-agent-text-editor-overwrite/package.json +0 -17
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +0 -1
- package/node_modules/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +0 -16
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-70.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +0 -17
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- /package/dist/{chunk-3H2EU7VQ.js → chunk-4U2GUKNJ.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-argument-order → pi-agent-text-editor}/runtime/entry-70.js +0 -0
- /package/node_modules/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { TextEditorCore } from "#src/core/text-editor-core.js";
|
|
2
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
4
|
+
import {
|
|
5
|
+
deleteFileParameters,
|
|
6
|
+
transferFileParameters,
|
|
7
|
+
executeFileOperation,
|
|
8
|
+
} from "#src/core/file-operations.js";
|
|
9
|
+
|
|
10
|
+
/** Register whole-file tools using the same execution service as Apply. */
|
|
11
|
+
export function registerFileOperationTools(pi: ExtensionAPI, core: TextEditorCore): void {
|
|
12
|
+
for (const [name, description] of [
|
|
13
|
+
[
|
|
14
|
+
"delete_file",
|
|
15
|
+
"Use delete_file to permanently delete one regular file. Reject directories and symlinks. This deletes the file, unlike delete which removes selected text.",
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"move_file",
|
|
19
|
+
"Use move_file to move or rename one regular file. Reject directories and symlinks. Existing targets require overwrite: true. Works across devices. Configured post-processing can format UTF-8 text targets; binary contents remain unchanged.",
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"copy_file",
|
|
23
|
+
"Use copy_file to copy one regular file. Reject directories and symlinks. Existing targets require overwrite: true. Configured post-processing can format UTF-8 text targets; binary contents remain unchanged.",
|
|
24
|
+
],
|
|
25
|
+
] as const) {
|
|
26
|
+
pi.registerTool({
|
|
27
|
+
name,
|
|
28
|
+
label: name.replaceAll("_", " "),
|
|
29
|
+
renderCall(_args, theme) {
|
|
30
|
+
return new Text(theme.fg("toolTitle", theme.bold(name.replaceAll("_", " "))), 0, 0);
|
|
31
|
+
},
|
|
32
|
+
description,
|
|
33
|
+
promptSnippet: description,
|
|
34
|
+
parameters: name === "delete_file" ? deleteFileParameters : transferFileParameters,
|
|
35
|
+
async execute(_id, args, signal, _update, context) {
|
|
36
|
+
const outcome = await core.enqueueFileOperation(
|
|
37
|
+
() => executeFileOperation(name, args, context.cwd, signal),
|
|
38
|
+
signal,
|
|
39
|
+
);
|
|
40
|
+
let postProcessingError: string | undefined;
|
|
41
|
+
if (outcome.ok && outcome.target !== undefined) {
|
|
42
|
+
try {
|
|
43
|
+
await core.postProcessFile(outcome.target, { cwd: context.cwd, signal });
|
|
44
|
+
} catch (error) {
|
|
45
|
+
postProcessingError = error instanceof Error ? error.message : String(error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: "text" as const,
|
|
52
|
+
text: [
|
|
53
|
+
`${name.replaceAll("_", " ")}: ${outcome.effect}`,
|
|
54
|
+
outcome.path,
|
|
55
|
+
postProcessingError === undefined
|
|
56
|
+
? undefined
|
|
57
|
+
: `Post-processing failed: ${postProcessingError}`,
|
|
58
|
+
outcome.target === undefined ? undefined : `Target: ${outcome.target}`,
|
|
59
|
+
outcome.error === undefined
|
|
60
|
+
? undefined
|
|
61
|
+
: `${outcome.error.code}: ${outcome.error.message}`,
|
|
62
|
+
]
|
|
63
|
+
.filter((line) => line !== undefined)
|
|
64
|
+
.join("\n"),
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
details: {
|
|
68
|
+
...outcome,
|
|
69
|
+
...(postProcessingError === undefined ? {} : { postProcessingError }),
|
|
70
|
+
},
|
|
71
|
+
isError: !outcome.ok,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { lstat, unlink } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
import { Type } from "typebox";
|
|
5
|
+
import { Value } from "typebox/value";
|
|
6
|
+
|
|
7
|
+
/** Whole-file operations, distinct from text-selection copy/move/remove. */
|
|
8
|
+
export const fileOperations = ["delete_file", "move_file", "copy_file"] as const;
|
|
9
|
+
export type FileOperation = (typeof fileOperations)[number];
|
|
10
|
+
const filePath = Type.String({
|
|
11
|
+
minLength: 1,
|
|
12
|
+
description: "Local regular file path, relative to cwd or absolute.",
|
|
13
|
+
});
|
|
14
|
+
export const deleteFileParameters = Type.Object(
|
|
15
|
+
{ path: filePath },
|
|
16
|
+
{ additionalProperties: false },
|
|
17
|
+
);
|
|
18
|
+
export const transferFileParameters = Type.Object(
|
|
19
|
+
{
|
|
20
|
+
path: filePath,
|
|
21
|
+
target: filePath,
|
|
22
|
+
overwrite: Type.Optional(
|
|
23
|
+
Type.Boolean({
|
|
24
|
+
description: "Allow replacing an existing regular target file. Defaults to false.",
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
},
|
|
28
|
+
{ additionalProperties: false },
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
/** Plain receipt; unknown means the filesystem call failed after execution began. */
|
|
32
|
+
export interface FileOperationResult {
|
|
33
|
+
readonly kind: "file-operation";
|
|
34
|
+
readonly operation: FileOperation;
|
|
35
|
+
readonly ok: boolean;
|
|
36
|
+
readonly effect: "applied" | "not-applied" | "unknown";
|
|
37
|
+
readonly path?: string;
|
|
38
|
+
readonly target?: string;
|
|
39
|
+
readonly error?: { readonly code: string; readonly message: string };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Recognize a host-owned whole-file receipt for shared output rendering. */
|
|
43
|
+
export function isFileOperationResult(value: unknown): value is FileOperationResult {
|
|
44
|
+
return (
|
|
45
|
+
value !== null &&
|
|
46
|
+
typeof value === "object" &&
|
|
47
|
+
"kind" in value &&
|
|
48
|
+
value.kind === "file-operation"
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Compact operation summary shared by standalone and Apply output. */
|
|
53
|
+
export function formatFileOperation(value: FileOperationResult): string {
|
|
54
|
+
return [
|
|
55
|
+
`${value.operation}: ${value.effect}`,
|
|
56
|
+
value.path,
|
|
57
|
+
value.target === undefined ? undefined : `Target: ${value.target}`,
|
|
58
|
+
value.error === undefined ? undefined : `${value.error.code}: ${value.error.message}`,
|
|
59
|
+
]
|
|
60
|
+
.filter((line) => line !== undefined)
|
|
61
|
+
.join("\n");
|
|
62
|
+
}
|
|
63
|
+
/** Uses maintained filesystem primitives; never decodes file contents or recursively deletes. */
|
|
64
|
+
export async function executeFileOperation(
|
|
65
|
+
operation: FileOperation,
|
|
66
|
+
input: unknown,
|
|
67
|
+
cwd: string,
|
|
68
|
+
signal?: AbortSignal,
|
|
69
|
+
): Promise<FileOperationResult> {
|
|
70
|
+
let started = false;
|
|
71
|
+
let source: string | undefined;
|
|
72
|
+
let target: string | undefined;
|
|
73
|
+
try {
|
|
74
|
+
const schema = operation === "delete_file" ? deleteFileParameters : transferFileParameters;
|
|
75
|
+
if (!Value.Check(schema, input))
|
|
76
|
+
throw Object.assign(new Error("Invalid file operation arguments"), {
|
|
77
|
+
code: "INVALID_ARGUMENTS",
|
|
78
|
+
});
|
|
79
|
+
const args = input as { path: string; target?: string; overwrite?: boolean };
|
|
80
|
+
source = path.resolve(cwd, args.path);
|
|
81
|
+
target = args.target === undefined ? undefined : path.resolve(cwd, args.target);
|
|
82
|
+
signal?.throwIfAborted();
|
|
83
|
+
const sourceStat = await regularFile(source);
|
|
84
|
+
if (target !== undefined) {
|
|
85
|
+
const targetStat = await optionalStat(target);
|
|
86
|
+
if (targetStat !== undefined) {
|
|
87
|
+
if (!targetStat.isFile() || targetStat.isSymbolicLink())
|
|
88
|
+
throw Object.assign(new Error("Target must be a regular file"), {
|
|
89
|
+
code: "INVALID_FILE_TYPE",
|
|
90
|
+
});
|
|
91
|
+
if (
|
|
92
|
+
source === target ||
|
|
93
|
+
(sourceStat.ino === targetStat.ino && sourceStat.dev === targetStat.dev)
|
|
94
|
+
)
|
|
95
|
+
throw Object.assign(new Error("Source and target are the same file"), {
|
|
96
|
+
code: "SAME_FILE",
|
|
97
|
+
});
|
|
98
|
+
if (args.overwrite !== true)
|
|
99
|
+
throw Object.assign(new Error("Target exists; use overwrite: true to replace it"), {
|
|
100
|
+
code: "EEXIST",
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
signal?.throwIfAborted();
|
|
105
|
+
started = true;
|
|
106
|
+
if (operation === "delete_file") await unlink(source);
|
|
107
|
+
else if (target !== undefined) {
|
|
108
|
+
if (operation === "copy_file")
|
|
109
|
+
await fs.copy(source, target, { overwrite: args.overwrite === true, errorOnExist: true });
|
|
110
|
+
else await fs.move(source, target, { overwrite: args.overwrite === true });
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
kind: "file-operation",
|
|
114
|
+
operation,
|
|
115
|
+
ok: true,
|
|
116
|
+
effect: "applied",
|
|
117
|
+
path: source,
|
|
118
|
+
...(target === undefined ? {} : { target }),
|
|
119
|
+
};
|
|
120
|
+
} catch (error) {
|
|
121
|
+
return {
|
|
122
|
+
kind: "file-operation",
|
|
123
|
+
operation,
|
|
124
|
+
ok: false,
|
|
125
|
+
effect: started ? "unknown" : "not-applied",
|
|
126
|
+
...(source === undefined ? {} : { path: source }),
|
|
127
|
+
...(target === undefined ? {} : { target }),
|
|
128
|
+
error: {
|
|
129
|
+
code:
|
|
130
|
+
error !== null && typeof error === "object" && "code" in error
|
|
131
|
+
? String(error.code)
|
|
132
|
+
: "FILE_OPERATION_FAILED",
|
|
133
|
+
message: error instanceof Error ? error.message : String(error),
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async function regularFile(file: string) {
|
|
140
|
+
const stat = await lstat(file);
|
|
141
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
142
|
+
throw Object.assign(new Error("Source must be a regular file"), { code: "INVALID_FILE_TYPE" });
|
|
143
|
+
return stat;
|
|
144
|
+
}
|
|
145
|
+
async function optionalStat(file: string) {
|
|
146
|
+
try {
|
|
147
|
+
return await lstat(file);
|
|
148
|
+
} catch (error) {
|
|
149
|
+
if (error !== null && typeof error === "object" && "code" in error && error.code === "ENOENT")
|
|
150
|
+
return undefined;
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -15,9 +15,12 @@ export function createUnifiedDiff(
|
|
|
15
15
|
path: string,
|
|
16
16
|
beforeContent: string,
|
|
17
17
|
afterContent: string,
|
|
18
|
+
afterPath = path,
|
|
18
19
|
): UnifiedDiffResult {
|
|
19
|
-
const diff = createTwoFilesPatch(path,
|
|
20
|
-
|
|
20
|
+
const diff = createTwoFilesPatch(path, afterPath, beforeContent, afterContent, "", "", {
|
|
21
|
+
context: 3,
|
|
22
|
+
})
|
|
23
|
+
.replace(/^(?:Index: .*\n)?={3,}\n?/m, "")
|
|
21
24
|
.trimEnd();
|
|
22
25
|
|
|
23
26
|
return { diff, stats: computeStats(beforeContent, afterContent) };
|
package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { renderAgentDiff } from "./agent-diff.js";
|
|
2
|
+
import { groupReplacements, renderGroupedReplacements } from "./grouped-replacements.js";
|
|
2
3
|
import { renderFinalStateFragment } from "./final-state-fragment.js";
|
|
3
4
|
import { type FileMutationResult } from "./file-mutation-result.js";
|
|
4
5
|
|
|
@@ -23,6 +24,8 @@ export class FileMutationAgentResult {
|
|
|
23
24
|
* Returned string is suitable for content[0].text in a tool response.
|
|
24
25
|
*/
|
|
25
26
|
public toText(): string {
|
|
27
|
+
const grouped = groupReplacements(this.results);
|
|
28
|
+
if (grouped !== undefined) return renderGroupedReplacements(grouped);
|
|
26
29
|
const parts: string[] = Array.from(this.results, (fmr) => this.formatSingle(fmr));
|
|
27
30
|
|
|
28
31
|
return parts.join("\n\n");
|
|
@@ -285,14 +288,37 @@ export class FileMutationAgentResult {
|
|
|
285
288
|
// ── Success formatting ────────────────────────────────────────────────
|
|
286
289
|
|
|
287
290
|
private formatSuccess(fmr: FileMutationResult): string {
|
|
288
|
-
const
|
|
291
|
+
const operations = fmr.data.operations ?? [];
|
|
292
|
+
const verbs: Record<string, string> = {
|
|
293
|
+
replace: "Replaced selected text",
|
|
294
|
+
insert: "Inserted new text",
|
|
295
|
+
delete: "Deleted selected text",
|
|
296
|
+
copy: "Copied selected text",
|
|
297
|
+
move: "Moved selected text",
|
|
298
|
+
write: "Wrote file content",
|
|
299
|
+
undo: "Restored file content",
|
|
300
|
+
stage: "Staged selected changes",
|
|
301
|
+
unstage: "Unstaged selected changes",
|
|
302
|
+
};
|
|
303
|
+
const blocks: string[] = [
|
|
304
|
+
operations.length === 0
|
|
305
|
+
? "Changes applied."
|
|
306
|
+
: operations
|
|
307
|
+
.map(
|
|
308
|
+
({ operation, changes }) =>
|
|
309
|
+
`${verbs[operation] ?? `Applied ${operation}`}: ${changes} text change(s) in this file.`,
|
|
310
|
+
)
|
|
311
|
+
.join("\n"),
|
|
312
|
+
`Formatting: ${fmr.data.formatting?.status ?? "not-reported"}${fmr.data.formatting?.formatter === undefined ? "" : ` (${fmr.data.formatting.formatter})`}.`,
|
|
313
|
+
];
|
|
289
314
|
|
|
315
|
+
for (const status of fmr.data.diffStatuses ?? []) blocks.push(status.text);
|
|
290
316
|
for (const diff of fmr.diffs) {
|
|
291
317
|
const path = /^--- (.+)$/m.exec(diff)?.[1] ?? fmr.path ?? "<unknown file>";
|
|
292
318
|
blocks.push(renderFinalStateFragment(fmr, path).join("\n"));
|
|
293
319
|
}
|
|
294
320
|
|
|
295
|
-
if (
|
|
321
|
+
if (fmr.diffs.length === 0) {
|
|
296
322
|
for (const file of fmr.files) {
|
|
297
323
|
blocks.push(file.path);
|
|
298
324
|
}
|
package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts
CHANGED
|
@@ -11,6 +11,34 @@ export interface MutationAnchor {
|
|
|
11
11
|
/** Successful mutation output style selected from the anchors used by the edit. */
|
|
12
12
|
export type MutationResultPresentation = "plain" | "major-anchor";
|
|
13
13
|
|
|
14
|
+
/** Observed formatter outcome; it does not imply diagnostics or tests passed. */
|
|
15
|
+
export interface MutationFormatting {
|
|
16
|
+
readonly status:
|
|
17
|
+
| "disabled"
|
|
18
|
+
| "unavailable"
|
|
19
|
+
| "skipped-syntax"
|
|
20
|
+
| "unchanged"
|
|
21
|
+
| "changed"
|
|
22
|
+
| "failed"
|
|
23
|
+
| "not-reported"
|
|
24
|
+
| "deferred";
|
|
25
|
+
readonly formatter?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Plain-text, per-file status shown beside diff counts and retained in history. */
|
|
29
|
+
export interface MutationDiffStatus {
|
|
30
|
+
/** Formatter identity allows multi-file summaries without parsing display text. */
|
|
31
|
+
readonly formatter?: string;
|
|
32
|
+
readonly text: string;
|
|
33
|
+
readonly tone?: "muted" | "success" | "warning" | "error";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** One successful operation contributing changes to this file. */
|
|
37
|
+
export interface MutationOperationReceipt {
|
|
38
|
+
readonly operation: string;
|
|
39
|
+
readonly changes: number;
|
|
40
|
+
}
|
|
41
|
+
|
|
14
42
|
export interface MutationSnapshot {
|
|
15
43
|
readonly content: string;
|
|
16
44
|
}
|
|
@@ -164,6 +192,19 @@ export interface FileMutationData {
|
|
|
164
192
|
isPartial?: boolean | undefined;
|
|
165
193
|
|
|
166
194
|
// ── Result fields ──
|
|
195
|
+
|
|
196
|
+
/** Successful operations represented by this result, including batched calls. */
|
|
197
|
+
operations?: readonly MutationOperationReceipt[] | undefined;
|
|
198
|
+
/** Formatter outcome reported by the post-edit integration. */
|
|
199
|
+
formatting?: MutationFormatting | undefined;
|
|
200
|
+
|
|
201
|
+
/** Display-only status contributions from post-edit handlers, in registration order. */
|
|
202
|
+
diffStatuses?: readonly MutationDiffStatus[] | undefined;
|
|
203
|
+
|
|
204
|
+
/** Original character spans owned by other calls in the same batch; display only. */
|
|
205
|
+
diffPeerRanges?:
|
|
206
|
+
| readonly { readonly from: number; readonly to: number; readonly insert: string }[]
|
|
207
|
+
| undefined;
|
|
167
208
|
diffs?: string[] | undefined;
|
|
168
209
|
files?: FileChange[] | undefined;
|
|
169
210
|
warnings?: Warning[] | undefined;
|
|
@@ -226,6 +267,8 @@ export interface FileMutationData {
|
|
|
226
267
|
* Phases are batch-wide (gate runs once for all files), not per-FMR.
|
|
227
268
|
*/
|
|
228
269
|
export interface FileMutationBatchResult {
|
|
270
|
+
/** Structured contributions from configured IDE mutation handlers. */
|
|
271
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
229
272
|
/**
|
|
230
273
|
Per-file mutation results (undefined when tool aborted).
|
|
231
274
|
*/
|
package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts
CHANGED
|
@@ -48,6 +48,8 @@ export function renderFinalStateFragment(fmr: FileMutationResult, path: string):
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const range = requiredValue(ranges[rangeIndex]);
|
|
51
|
+
|
|
52
|
+
result.push(`Final text, lines ${range.start}–${range.end}:`);
|
|
51
53
|
for (let lineNumber = range.start; lineNumber <= range.end; lineNumber += 1) {
|
|
52
54
|
const content = lines[lineNumber - 1] ?? "";
|
|
53
55
|
const metadata = metadataForLine(lineNumber, fmr.hints, visibleRanges, allowedSyntaxHints);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { FileMutationResult } from "./file-mutation-result.js";
|
|
2
|
+
|
|
3
|
+
/** Exact applied replacement pairs and complete per-file counts, before formatting. */
|
|
4
|
+
export interface GroupedReplacements {
|
|
5
|
+
readonly groups: readonly { removedText: string; insertedText: string; count: number }[];
|
|
6
|
+
readonly files: readonly { path: string; groups: readonly number[]; formatting: string }[];
|
|
7
|
+
readonly changes: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Groups successful replacements only when every result has complete applied-change evidence. */
|
|
11
|
+
export function groupReplacements(
|
|
12
|
+
results: readonly FileMutationResult[],
|
|
13
|
+
): GroupedReplacements | undefined {
|
|
14
|
+
if (results.length === 0) return;
|
|
15
|
+
const groups: { removedText: string; insertedText: string; count: number }[] = [];
|
|
16
|
+
const indexes = new Map<string, number>();
|
|
17
|
+
const files: { path: string; groups: number[]; formatting: string }[] = [];
|
|
18
|
+
let changes = 0;
|
|
19
|
+
for (const result of results) {
|
|
20
|
+
const operations = result.data.operations;
|
|
21
|
+
const raw = result.data.rawChanges;
|
|
22
|
+
if (
|
|
23
|
+
!result.ok ||
|
|
24
|
+
result.isPartial ||
|
|
25
|
+
result.warnings.length > 0 ||
|
|
26
|
+
result.errors.length > 0 ||
|
|
27
|
+
(result.data.hints?.length ?? 0) > 0 ||
|
|
28
|
+
(result.data.diffStatuses?.length ?? 0) > 0 ||
|
|
29
|
+
!result.path ||
|
|
30
|
+
!operations?.length ||
|
|
31
|
+
operations.some((operation) => operation.operation !== "replace") ||
|
|
32
|
+
!raw?.length ||
|
|
33
|
+
operations.reduce((sum, operation) => sum + operation.changes, 0) !== raw.length
|
|
34
|
+
)
|
|
35
|
+
return;
|
|
36
|
+
const counts: number[] = [];
|
|
37
|
+
for (const change of raw) {
|
|
38
|
+
const key = JSON.stringify([change.removedText, change.insertedText]);
|
|
39
|
+
let index = indexes.get(key);
|
|
40
|
+
if (index === undefined) {
|
|
41
|
+
index = groups.length;
|
|
42
|
+
indexes.set(key, index);
|
|
43
|
+
groups.push({
|
|
44
|
+
removedText: change.removedText,
|
|
45
|
+
insertedText: change.insertedText,
|
|
46
|
+
count: 0,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const group = groups[index];
|
|
50
|
+
if (group === undefined) throw new Error("Missing replacement group");
|
|
51
|
+
group.count++;
|
|
52
|
+
counts[index] = (counts[index] ?? 0) + 1;
|
|
53
|
+
changes++;
|
|
54
|
+
}
|
|
55
|
+
files.push({
|
|
56
|
+
path: result.path,
|
|
57
|
+
groups: counts,
|
|
58
|
+
formatting: result.data.formatting?.status ?? "not-reported",
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Keep ordinary final-state output when there is nothing repeated to compress.
|
|
62
|
+
if (groups.length === changes) return;
|
|
63
|
+
return { groups, files, changes };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Renders all unique pairs and every affected file without repeating surrounding source text. */
|
|
67
|
+
export function renderGroupedReplacements(receipt: GroupedReplacements): string {
|
|
68
|
+
return [
|
|
69
|
+
`Applied ${receipt.changes} replacements in ${receipt.files.length} files.`,
|
|
70
|
+
"Exact applied replacements (before any additional formatting; not a full final-file view):",
|
|
71
|
+
...receipt.groups.map(
|
|
72
|
+
(group, index) =>
|
|
73
|
+
`G${index + 1}: ${JSON.stringify(group.removedText)} -> ${JSON.stringify(group.insertedText)} (${group.count} replacements)`,
|
|
74
|
+
),
|
|
75
|
+
"Files (complete):",
|
|
76
|
+
...receipt.files.map(
|
|
77
|
+
(file) =>
|
|
78
|
+
`${file.path}: ${file.groups.flatMap((count, index) => (count ? [`G${index + 1} x ${count}`] : [])).join(", ")}; formatting: ${file.formatting}`,
|
|
79
|
+
),
|
|
80
|
+
].join("\n");
|
|
81
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import type { TextResourceEditOutcome } from "./text-editor-core.js";
|
|
3
|
+
|
|
4
|
+
type Completed = Exclude<TextResourceEditOutcome<unknown>, { readonly kind: "failed" }>;
|
|
5
|
+
type Finalize = () => Promise<Completed>;
|
|
6
|
+
const active = new AsyncLocalStorage<Map<string, Finalize>>();
|
|
7
|
+
const notifications = new AsyncLocalStorage<Array<() => void>>();
|
|
8
|
+
|
|
9
|
+
/** Schedule observers only after every file in the current finalization has settled. */
|
|
10
|
+
export function afterPostEditScope(notify: () => void): void {
|
|
11
|
+
const pending = notifications.getStore();
|
|
12
|
+
if (pending) pending.push(notify);
|
|
13
|
+
else notify();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Keep post-edit notifications behind the final processing of all files. */
|
|
17
|
+
export async function collectPostEditNotifications<T>(work: () => Promise<T>): Promise<T> {
|
|
18
|
+
if (notifications.getStore()) return work();
|
|
19
|
+
const pending: Array<() => void> = [];
|
|
20
|
+
try {
|
|
21
|
+
return await notifications.run(pending, work);
|
|
22
|
+
} finally {
|
|
23
|
+
for (const notify of pending) notify();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Replace intermediate post-processing with the latest written state of this resource. */
|
|
28
|
+
export function deferPostEdit(source: string, finalize: Finalize): boolean {
|
|
29
|
+
const pending = active.getStore();
|
|
30
|
+
if (!pending) return false;
|
|
31
|
+
pending.set(source, finalize);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Optional read enrichment must not start checks on an intermediate edited snapshot. */
|
|
36
|
+
export function hasDeferredPostEdit(source: string): boolean {
|
|
37
|
+
return active.getStore()?.has(source) ?? false;
|
|
38
|
+
}
|
|
39
|
+
/** Writes stay immediate; finishing drains each surviving final resource once. */
|
|
40
|
+
export function createPostEditScope() {
|
|
41
|
+
const pending = new Map<string, Finalize>();
|
|
42
|
+
return {
|
|
43
|
+
run<T>(operation: () => T): T {
|
|
44
|
+
return active.run(pending, operation);
|
|
45
|
+
},
|
|
46
|
+
forget(source: string): void {
|
|
47
|
+
pending.delete(source);
|
|
48
|
+
},
|
|
49
|
+
async finish(onCompleted?: (outcome: Completed) => void): Promise<Completed[]> {
|
|
50
|
+
const work = [...pending.values()];
|
|
51
|
+
pending.clear();
|
|
52
|
+
const completed: Completed[] = [];
|
|
53
|
+
const errors: unknown[] = [];
|
|
54
|
+
await collectPostEditNotifications(async () => {
|
|
55
|
+
for (const finalize of work) {
|
|
56
|
+
try {
|
|
57
|
+
const outcome = await finalize();
|
|
58
|
+
completed.push(outcome);
|
|
59
|
+
onCompleted?.(outcome);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
errors.push(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (errors.length > 0)
|
|
66
|
+
throw new AggregateError(
|
|
67
|
+
errors,
|
|
68
|
+
`Some final post-processing failed; completed edits remain applied. ${errors.map((error) => (error instanceof Error ? error.message : String(error))).join("; ")}`,
|
|
69
|
+
);
|
|
70
|
+
return completed;
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -124,9 +124,12 @@ export class TextAnchorRegistry {
|
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
public renderPromptSection(): string | undefined {
|
|
127
|
+
public renderPromptSection(kinds?: ReadonlySet<string>): string | undefined {
|
|
128
128
|
const entries = this.#resolvers
|
|
129
|
-
.filter(
|
|
129
|
+
.filter(
|
|
130
|
+
({ describeInPrompt, kind }) =>
|
|
131
|
+
describeInPrompt && (kinds === undefined || kinds.has(kind)),
|
|
132
|
+
)
|
|
130
133
|
.map(({ resolver }) => renderResolverDescription(resolver))
|
|
131
134
|
.filter((entry): entry is string => entry !== undefined);
|
|
132
135
|
|
|
@@ -162,13 +162,21 @@ export class TextChangeDocument {
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
/** Apply validated ranges; creation may have empty text but still creates a resource. */
|
|
166
|
+
export function applyTextChanges(
|
|
167
|
+
source: string,
|
|
168
|
+
changes: readonly TextChange[],
|
|
169
|
+
creating = false,
|
|
170
|
+
): TextChangeResult {
|
|
166
171
|
const ordered = changes
|
|
167
172
|
.map((change, index) => ({ change, index }))
|
|
168
173
|
.sort((left, right) => left.change.from - right.change.from || left.index - right.index)
|
|
169
174
|
.map(({ change }) => change);
|
|
170
175
|
validateChanges(source.length, ordered);
|
|
171
|
-
if (
|
|
176
|
+
if (
|
|
177
|
+
!(creating && source.length === 0) &&
|
|
178
|
+
ordered.some((change) => source.slice(change.from, change.to) === change.insert)
|
|
179
|
+
) {
|
|
172
180
|
throw new Error("Text changes must change the document.");
|
|
173
181
|
}
|
|
174
182
|
const document = Text.of([source]);
|
|
@@ -57,6 +57,7 @@ interface TextBatchState {
|
|
|
57
57
|
readonly registration: AnyTextMutationToolRegistration;
|
|
58
58
|
}
|
|
59
59
|
interface PlannedTextMutation extends TextMutation {
|
|
60
|
+
readonly operation: string;
|
|
60
61
|
readonly resultPresentations: ReadonlyMap<string, MutationResultPresentation>;
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -100,6 +101,23 @@ export function registerTextEditBatching(pi: ExtensionAPI, core: TextEditorCore)
|
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
|
|
104
|
+
// Derived protocol targets need their owning execution pipeline, not snapshot batching.
|
|
105
|
+
const selectorFields = [
|
|
106
|
+
registration.source.field,
|
|
107
|
+
...(registration.source.targets ?? []).map((target) => target.field),
|
|
108
|
+
...(registration.anchors ?? []).map((anchor) => anchor.field),
|
|
109
|
+
];
|
|
110
|
+
if (
|
|
111
|
+
selectorFields.some((field) => {
|
|
112
|
+
const value = call.arguments[field];
|
|
113
|
+
return (
|
|
114
|
+
typeof value === "string" &&
|
|
115
|
+
/^[a-z][a-z\d+.-]+:/iu.test(value) &&
|
|
116
|
+
!value.startsWith("file://")
|
|
117
|
+
);
|
|
118
|
+
})
|
|
119
|
+
)
|
|
120
|
+
return;
|
|
103
121
|
const explicit = call.arguments[registration.source.field];
|
|
104
122
|
const inheritedSource =
|
|
105
123
|
!(typeof explicit === "string" && explicit.length > 0) && registration.source.inherited
|
|
@@ -303,6 +321,8 @@ export async function executeRegisteredTextBatch(
|
|
|
303
321
|
callId: item.callId,
|
|
304
322
|
mutation: {
|
|
305
323
|
...mutation,
|
|
324
|
+
|
|
325
|
+
operation: item.registration.name,
|
|
306
326
|
resultPresentations: new Map(
|
|
307
327
|
[...mutation.edits.keys()].map((source) => [
|
|
308
328
|
source,
|
|
@@ -390,6 +410,19 @@ export async function executeRegisteredTextBatch(
|
|
|
390
410
|
edit,
|
|
391
411
|
ownAfter,
|
|
392
412
|
mutation.resultPresentations.get(source) ?? "plain",
|
|
413
|
+
|
|
414
|
+
1,
|
|
415
|
+
[{ operation: mutation.operation, changes: edit.changes.length }],
|
|
416
|
+
|
|
417
|
+
completedMutations.flatMap((peer) =>
|
|
418
|
+
peer.callId === callId
|
|
419
|
+
? []
|
|
420
|
+
: (peer.mutation.edits.get(source)?.changes ?? []).map(({ from, to, insert }) => ({
|
|
421
|
+
from,
|
|
422
|
+
to,
|
|
423
|
+
insert,
|
|
424
|
+
})),
|
|
425
|
+
),
|
|
393
426
|
),
|
|
394
427
|
];
|
|
395
428
|
});
|
|
@@ -424,6 +457,13 @@ export async function executeRegisteredTextBatch(
|
|
|
424
457
|
resource.after.content,
|
|
425
458
|
finalPresentationBySource.get(source) ?? "plain",
|
|
426
459
|
edits.length,
|
|
460
|
+
|
|
461
|
+
completedMutations.flatMap(({ mutation }) => {
|
|
462
|
+
const edit = mutation.edits.get(source);
|
|
463
|
+
return edit === undefined
|
|
464
|
+
? []
|
|
465
|
+
: [{ operation: mutation.operation, changes: edit.changes.length }];
|
|
466
|
+
}),
|
|
427
467
|
);
|
|
428
468
|
resultsByCallId.get(finalCallId)?.push(result);
|
|
429
469
|
results.push(result);
|