pi-agent-ide 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +12 -8
- package/dist/{chunk-XNXQYPVT.js → chunk-4LUW26BX.js} +1 -1
- package/dist/chunk-5MSNYFDE.js +1 -0
- package/dist/chunk-5VSE5X5R.js +2 -0
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/{chunk-ORAPGW7W.js → chunk-72EEL2DW.js} +1 -1
- package/dist/{chunk-T2RPMEM2.js → chunk-7UGNGK7Y.js} +1 -1
- package/dist/{chunk-STUZZM5B.js → chunk-AADJ2KIB.js} +1 -1
- package/dist/{chunk-SMSIT3CE.js → chunk-B5KB2I7J.js} +1 -1
- package/dist/chunk-BHSO2MDK.js +6 -0
- package/dist/chunk-BMOJTJJJ.js +3 -0
- package/dist/{chunk-EEH4WYI7.js → chunk-CEKXBS55.js} +1 -1
- package/dist/chunk-CW53ZTU3.js +2 -0
- package/dist/chunk-EWNWKDMP.js +4 -0
- package/dist/{chunk-VSP2QQPQ.js → chunk-GIRAEVUJ.js} +1 -1
- package/dist/{chunk-MTTKFJV6.js → chunk-GUTQ3PWL.js} +1 -1
- package/dist/chunk-HGPUI7F3.js +1 -0
- package/dist/{chunk-OBWZ5RYN.js → chunk-HKMBQLEK.js} +1 -1
- package/dist/chunk-ITSNK5YG.js +7 -0
- package/dist/chunk-KAB3AYA2.js +1 -0
- package/dist/{chunk-266RH77Z.js → chunk-LRYE2WCN.js} +1 -1
- package/dist/chunk-M5L42DWE.js +7 -0
- package/dist/chunk-M5MJP7Z2.js +1 -0
- package/dist/chunk-NMFQGKPE.js +2 -0
- package/dist/chunk-NTYXZ3EL.js +3 -0
- package/dist/{chunk-PETQCA7G.js → chunk-QDST6VIU.js} +1 -1
- package/dist/chunk-QIJMV2P2.js +2 -0
- package/dist/chunk-RHV5STR3.js +3 -0
- package/dist/chunk-ROXXK6TW.js +0 -0
- package/dist/chunk-S3ZPXWX7.js +2 -0
- package/dist/chunk-SSHZEWWV.js +1 -0
- package/dist/chunk-TPIHQYK2.js +14 -0
- package/dist/chunk-VZJIZXSH.js +14 -0
- package/dist/chunk-YHADTHQM.js +1 -0
- package/dist/{chunk-KZBAJFCV.js → chunk-Z3VC3S2T.js} +1 -1
- package/dist/{chunk-SJYDLHEF.js → chunk-ZM4L5AGN.js} +1 -1
- package/dist/{chunk-E2RESHYR.js → chunk-ZTYWHL2F.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-1.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-21.js +2 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +12 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +4 -1
- package/dist/entry-32.js +9 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +18 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +7 -1
- package/dist/entry-46.js +11 -1
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -0
- package/dist/entry-55.js +0 -1
- package/dist/entry-56.js +1 -0
- package/dist/entry-57.js +0 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -0
- package/dist/entry-64.js +0 -1
- package/dist/entry-65.js +1 -0
- package/dist/entry-66.js +0 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-70.js +123 -1
- package/dist/entry-71.js +30 -1
- package/dist/entry-72.js +2 -1
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +3 -1
- package/dist/entry-77.js +1 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/pi-agent-ide.js +3 -13
- package/docs/configuration.md +57 -11
- package/docs/extensions.md +4 -2
- package/docs/tools.md +7 -1
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +2 -2
- package/node_modules/pi-agent-filesystem/package.json +6 -6
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +9 -9
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/node_modules/pi-agent-ide-ast/src/extension.ts +11 -15
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +83 -0
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/node_modules/pi-agent-ide-changes/index.ts +22 -10
- package/node_modules/pi-agent-ide-changes/package.json +6 -6
- package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -9
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +36 -13
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/index.ts +49 -17
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -1
- package/node_modules/pi-agent-ide-lsp/index.ts +127 -20
- package/node_modules/pi-agent-ide-lsp/package.json +9 -8
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +25 -7
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +12 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-image/src/image-converter.ts +1 -1
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +1 -1
- package/node_modules/pi-agent-read/package.json +6 -6
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/node_modules/pi-agent-read/src/api/rendering.ts +3 -0
- package/node_modules/pi-agent-read/src/api/tools/read.ts +73 -1
- package/node_modules/pi-agent-read/src/core/read-core.ts +32 -28
- package/node_modules/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +87 -19
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/node_modules/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +87 -53
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -8
- package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
- package/node_modules/pi-agent-search/package.json +3 -3
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/node_modules/pi-agent-search/src/api/search.ts +55 -1
- package/node_modules/pi-agent-search/src/core/extension.ts +8 -27
- package/node_modules/pi-agent-search/src/core/search-core.ts +38 -3
- package/node_modules/pi-agent-search-text/index.ts +82 -33
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/file-search.ts +9 -1
- package/node_modules/pi-agent-search-text/src/resolvers.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +112 -24
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
- package/node_modules/pi-agent-text/src/text-document.ts +5 -0
- package/node_modules/pi-agent-text/src/text-target.ts +4 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
- package/node_modules/pi-agent-text-editor/index.ts +1 -3
- package/node_modules/pi-agent-text-editor/package.json +34 -24
- package/node_modules/pi-agent-text-editor/runtime/entry-69.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/node_modules/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +74 -1
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -9
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +28 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +43 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +40 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +178 -58
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +313 -21
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/node_modules/pi-agent-text-editor-renderer/index.ts +93 -2
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +69 -4
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +24 -13
- package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +1 -0
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-web/index.ts +1 -6
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/runtime/entry-75.js +2 -0
- package/node_modules/pi-agent-web/src/browser-loader.ts +1 -0
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/package.json +38 -38
- package/src/api/plugin-protocol.ts +12 -2
- package/src/api/text-editor.ts +7 -0
- package/src/api/tool-config.ts +77 -2
- package/src/code-view/diagnostic-view.ts +22 -3
- package/src/composite/builtin-extensions.ts +138 -67
- package/src/composite/extensions-config.ts +59 -0
- package/src/composite/feature-flags.ts +32 -0
- package/src/composite/module-labels.ts +55 -0
- package/src/composite/module-settings-store.ts +44 -0
- package/src/composite/module-settings.ts +132 -0
- package/src/composite/selection.ts +4 -4
- package/src/composite/settings-panel.ts +71 -0
- package/src/core/diagnostic-delivery.ts +29 -0
- package/src/core/diagnostic-entry.ts +142 -0
- package/src/core/diagnostic-store.ts +96 -23
- package/src/core/extension.ts +45 -22
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +1 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/browser-loader.ts +1 -0
- package/src/extensions/pi-agent-read/package.json +6 -6
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +29 -0
- package/src/extensions/pi-agent-read/src/api/rendering.ts +3 -0
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +73 -1
- package/src/extensions/pi-agent-read/src/core/read-core.ts +32 -28
- package/src/extensions/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +113 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +87 -19
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +15 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +35 -126
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +87 -53
- package/src/extensions/pi-agent-search/package.json +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +82 -33
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +9 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +112 -24
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +25 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +55 -1
- package/src/extensions/pi-agent-search/src/core/extension.ts +8 -27
- package/src/extensions/pi-agent-search/src/core/search-core.ts +38 -3
- package/src/extensions/pi-agent-text-editor/index.ts +1 -3
- package/src/extensions/pi-agent-text-editor/package.json +34 -24
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +93 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +69 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +24 -13
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +33 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/runtime/entry-69.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +15 -0
- package/src/extensions/pi-agent-text-editor/src/api/last-resolved-resource.ts +5 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +15 -1
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +74 -1
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +237 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +50 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +11 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +208 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +39 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +216 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +45 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +25 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +324 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +133 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +112 -0
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +132 -0
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +205 -0
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -9
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +76 -0
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +153 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +28 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +43 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +73 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +10 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +40 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +178 -58
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +313 -21
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/src/pi-agent-ide.ts +45 -0
- package/src/plugins/pi-agent-ide-ast/package.json +9 -9
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +11 -15
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +83 -0
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +8 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +83 -5
- package/src/plugins/pi-agent-ide-changes/index.ts +22 -10
- package/src/plugins/pi-agent-ide-changes/package.json +6 -6
- package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +10 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -9
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +62 -26
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +36 -13
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/index.ts +49 -17
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -1
- package/src/plugins/pi-agent-ide-lsp/index.ts +127 -20
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -8
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +61 -0
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +25 -7
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +12 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +40 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +21 -32
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +15 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +32 -5
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +138 -0
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +9 -2
- package/src/post-edit/gate.ts +57 -15
- package/src/toolchain/types.ts +2 -0
- package/dist/chunk-2SKAED2I.js +0 -2
- package/dist/chunk-2XYXV5HS.js +0 -4
- package/dist/chunk-2ZMYT6ZC.js +0 -1
- package/dist/chunk-34ZQTTU2.js +0 -2
- package/dist/chunk-4SQQKEVD.js +0 -16
- package/dist/chunk-5BWUVAR4.js +0 -1
- package/dist/chunk-6DN7NO7L.js +0 -1
- package/dist/chunk-6SMFVLTY.js +0 -1
- package/dist/chunk-6XQQBKPE.js +0 -58
- package/dist/chunk-BYWAG6X3.js +0 -6
- package/dist/chunk-EW2KVKCN.js +0 -2
- package/dist/chunk-F6SESI3P.js +0 -4
- package/dist/chunk-GTK5AREE.js +0 -2
- package/dist/chunk-HOBTFFQR.js +0 -1
- package/dist/chunk-IMVCVPMP.js +0 -3
- package/dist/chunk-IOCABSRL.js +0 -1
- package/dist/chunk-JASLOB2X.js +0 -1
- package/dist/chunk-KH5KPBCR.js +0 -10
- package/dist/chunk-KNMWCDDK.js +0 -7
- package/dist/chunk-KYVOMBO5.js +0 -1
- package/dist/chunk-L4FA6OD4.js +0 -1
- package/dist/chunk-LFV6G5Z3.js +0 -1
- package/dist/chunk-LGN7EJYR.js +0 -13
- package/dist/chunk-MB6VVVAF.js +0 -2
- package/dist/chunk-MTQSGWZJ.js +0 -1
- package/dist/chunk-NI2NK4JU.js +0 -1
- package/dist/chunk-NXHPO7ER.js +0 -6
- package/dist/chunk-OFHVDY4Q.js +0 -2
- package/dist/chunk-OIL6BB2S.js +0 -33
- package/dist/chunk-ONWUJXUR.js +0 -1
- package/dist/chunk-PODWLGNO.js +0 -6
- package/dist/chunk-QZANC2IG.js +0 -1
- package/dist/chunk-SSZB66C3.js +0 -3
- package/dist/chunk-TG6H6EOI.js +0 -1
- package/dist/chunk-UTTW55S2.js +0 -1
- package/dist/chunk-VEJGSURY.js +0 -8
- package/dist/chunk-W3XYKJ5H.js +0 -1
- package/dist/chunk-XGUAL3CA.js +0 -1
- package/dist/chunk-YPHXLAQF.js +0 -1
- package/dist/chunk-ZIHEF6K3.js +0 -3
- package/dist/entry-80.js +0 -1
- package/node_modules/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/node_modules/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- package/node_modules/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/node_modules/pi-agent-text-editor-argument-order/package.json +0 -16
- package/node_modules/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/node_modules/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/node_modules/pi-agent-text-editor-overwrite/package.json +0 -17
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +0 -1
- package/node_modules/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/index.ts +0 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +0 -16
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-70.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/src/argument-order-guard.ts +0 -100
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +0 -365
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +0 -17
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/core/tool-description.ts +0 -14
- /package/dist/{chunk-3H2EU7VQ.js → chunk-4U2GUKNJ.js} +0 -0
- /package/node_modules/{pi-agent-text-editor-argument-order → pi-agent-text-editor}/runtime/entry-70.js +0 -0
- /package/node_modules/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-overwrite → pi-agent-text-editor-renderer}/runtime/entry-71.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-72.js +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { hasDeferredPostEdit, afterPostEditScope } from "#src/core/post-edit-scope.js";
|
|
1
2
|
import { Type } from "typebox";
|
|
2
3
|
import { Value } from "typebox/value";
|
|
3
4
|
|
|
@@ -7,12 +8,19 @@ import {
|
|
|
7
8
|
TEXT_EDITOR_PROTOCOL,
|
|
8
9
|
} from "#src/api/plugin-protocol.js";
|
|
9
10
|
|
|
10
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
DiagnosticHint,
|
|
13
|
+
MutationFormatting,
|
|
14
|
+
MutationDiffStatus,
|
|
15
|
+
SyntaxErrorSummary,
|
|
16
|
+
Warning,
|
|
17
|
+
} from "#src/api/mutation-result.js";
|
|
11
18
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
12
19
|
import type { TextDocument } from "pi-agent-text";
|
|
13
20
|
|
|
14
21
|
export const TEXT_EDITOR_POST_EDIT_REGISTER_EVENT = `${TEXT_EDITOR_PROTOCOL}/post-edit/register`;
|
|
15
22
|
|
|
23
|
+
/** The saved edit before post-processing; handlers run inside the file's mutation queue. */
|
|
16
24
|
export interface TextPostEditTransaction {
|
|
17
25
|
readonly source: string;
|
|
18
26
|
readonly resourceSource: string;
|
|
@@ -35,6 +43,65 @@ export interface TextMutationResultContributionData {
|
|
|
35
43
|
readonly syntaxErrorSummary?: SyntaxErrorSummary;
|
|
36
44
|
}
|
|
37
45
|
|
|
46
|
+
/** Validates formatter metadata supplied by a post-edit integration. */
|
|
47
|
+
export function isFormattingContribution(
|
|
48
|
+
value: unknown,
|
|
49
|
+
): value is { formatting: MutationFormatting } {
|
|
50
|
+
return Value.Check(
|
|
51
|
+
Type.Object({
|
|
52
|
+
formatting: Type.Object({
|
|
53
|
+
status: Type.Union(
|
|
54
|
+
[
|
|
55
|
+
"disabled",
|
|
56
|
+
"unavailable",
|
|
57
|
+
"skipped-syntax",
|
|
58
|
+
"unchanged",
|
|
59
|
+
"changed",
|
|
60
|
+
"failed",
|
|
61
|
+
"not-reported",
|
|
62
|
+
"deferred",
|
|
63
|
+
].map((status) => Type.Literal(status)),
|
|
64
|
+
),
|
|
65
|
+
formatter: Type.Optional(Type.String()),
|
|
66
|
+
}),
|
|
67
|
+
}),
|
|
68
|
+
value,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Return this data from a post-edit handler to add statuses to that file's diff.
|
|
74
|
+
* All handlers contribute in registration order. Use plain text, not ANSI or Markdown.
|
|
75
|
+
* Statuses are display-only and persist with the completed result, including on resume.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* connectTextEditorPostEditHandler(pi, {
|
|
79
|
+
* id: "my-check",
|
|
80
|
+
* handler: () => ({ diffStatuses: [{ text: "Checked", tone: "success" }] }),
|
|
81
|
+
* });
|
|
82
|
+
*/
|
|
83
|
+
export interface TextPostEditStatusContribution {
|
|
84
|
+
readonly diffStatuses: readonly MutationDiffStatus[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Validate display data before it enters the diff result. */
|
|
88
|
+
export function isDiffStatusContribution(value: unknown): value is TextPostEditStatusContribution {
|
|
89
|
+
return Value.Check(
|
|
90
|
+
Type.Object({
|
|
91
|
+
diffStatuses: Type.Array(
|
|
92
|
+
Type.Object({
|
|
93
|
+
text: Type.String({ minLength: 1 }),
|
|
94
|
+
formatter: Type.Optional(Type.String()),
|
|
95
|
+
tone: Type.Optional(
|
|
96
|
+
Type.Union(["muted", "success", "warning", "error"].map((tone) => Type.Literal(tone))),
|
|
97
|
+
),
|
|
98
|
+
}),
|
|
99
|
+
),
|
|
100
|
+
}),
|
|
101
|
+
value,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
38
105
|
export type TextPostEditHandler = (transaction: TextPostEditTransaction) => unknown;
|
|
39
106
|
|
|
40
107
|
export interface TextPostEditHandlerRegistration {
|
|
@@ -86,6 +153,12 @@ export function isTextMutationResultContributionData(
|
|
|
86
153
|
);
|
|
87
154
|
}
|
|
88
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Register a session-owned post-edit handler, regardless of extension load order.
|
|
158
|
+
* Pi awaits handlers in registration order before finalizing the file result.
|
|
159
|
+
* Return a TextPostEditStatusContribution to add diff statuses; keep slow analysis
|
|
160
|
+
* in background diagnostic sources instead. Registration is removed on shutdown.
|
|
161
|
+
*/
|
|
89
162
|
export function connectTextEditorPostEditHandler(
|
|
90
163
|
pi: ExtensionAPI,
|
|
91
164
|
registration: TextPostEditHandlerRegistration,
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { createPostEditScope } from "#src/core/post-edit-scope.js";
|
|
2
|
+
import { FileMutationResult } from "#src/core/mutation-result/file-mutation-result.js";
|
|
3
|
+
import { isFormattingContribution, isDiffStatusContribution } from "#src/api/post-edit.js";
|
|
4
|
+
import { executeDiff, diffReadResult } from "#src/core/diff-tool.js";
|
|
5
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
import type { ReadPluginApi } from "pi-agent-read/api/plugin-protocol";
|
|
7
|
+
import { readParameters, type ReadToolResult } from "pi-agent-read/api/tools/read";
|
|
8
|
+
import { searchSchema, type SearchPluginApi, type SearchRequest } from "pi-agent-search/api/search";
|
|
9
|
+
import { Value } from "typebox/value";
|
|
10
|
+
import type { TextEditorCore } from "#src/core/text-editor-core.js";
|
|
11
|
+
import { executeScriptMutation } from "#src/core/text-mutation.js";
|
|
12
|
+
import { ApplyResults } from "#src/core/apply/results.js";
|
|
13
|
+
import {
|
|
14
|
+
executeFileOperation,
|
|
15
|
+
fileOperations,
|
|
16
|
+
type FileOperation,
|
|
17
|
+
} from "#src/core/file-operations.js";
|
|
18
|
+
import { serializeApplyError, type ApplyRuntimeHost } from "#src/core/apply/runtime.js";
|
|
19
|
+
|
|
20
|
+
/** Configured IDE services and ordinary tool schemas, shared with the standalone tools. */
|
|
21
|
+
export interface ApplyServices {
|
|
22
|
+
readonly editor: TextEditorCore;
|
|
23
|
+
readonly read: ReadPluginApi;
|
|
24
|
+
readonly search: SearchPluginApi;
|
|
25
|
+
readonly lastResolvedSource?: string;
|
|
26
|
+
readonly rememberRead?: (outcome: ReadToolResult) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** One invocation's host-owned receipts, with guest errors independent of output selection. */
|
|
30
|
+
export function createApplyExecution(
|
|
31
|
+
services: ApplyServices,
|
|
32
|
+
context: ExtensionContext,
|
|
33
|
+
): {
|
|
34
|
+
readonly host: ApplyRuntimeHost;
|
|
35
|
+
readonly results: ApplyResults;
|
|
36
|
+
finish(): Promise<void>;
|
|
37
|
+
} {
|
|
38
|
+
const results = new ApplyResults();
|
|
39
|
+
const scope = createPostEditScope();
|
|
40
|
+
let lastSource = services.lastResolvedSource;
|
|
41
|
+
const host: ApplyRuntimeHost = {
|
|
42
|
+
async execute(operation, arguments_, signal, id) {
|
|
43
|
+
const tool = operation === "remove" ? "delete" : operation;
|
|
44
|
+
const kind = tool === "read" || tool === "search" || tool === "diff" ? "read" : "mutation";
|
|
45
|
+
let recorded = false;
|
|
46
|
+
try {
|
|
47
|
+
if (tool === "stage" || tool === "unstage") {
|
|
48
|
+
const operation = services.editor.getScriptIndexOperation(tool);
|
|
49
|
+
if (!operation)
|
|
50
|
+
throw failure("OPERATION_UNAVAILABLE", `${tool} requires the Git changes module`);
|
|
51
|
+
if (!Value.Check(operation.parameters, arguments_))
|
|
52
|
+
throw failure("INVALID_ARGUMENTS", `Invalid ${tool} arguments`);
|
|
53
|
+
const outcome = await operation.execute(arguments_, signal, context);
|
|
54
|
+
const value = {
|
|
55
|
+
operation: tool,
|
|
56
|
+
ok: true,
|
|
57
|
+
effect: "index-only",
|
|
58
|
+
kind: "index-operation",
|
|
59
|
+
...(outcome.details as object),
|
|
60
|
+
};
|
|
61
|
+
results.record(id, "mutation", value, { content: outcome.content, details: {} });
|
|
62
|
+
recorded = true;
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
if (tool === "diff") {
|
|
66
|
+
const value = await executeDiff(services.read, arguments_, { cwd: context.cwd, signal });
|
|
67
|
+
results.record(id, "read", value, diffReadResult(value));
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
if ((fileOperations as readonly string[]).includes(operation)) {
|
|
71
|
+
const value = await services.editor.enqueueFileOperation(
|
|
72
|
+
() => executeFileOperation(operation as FileOperation, arguments_, context.cwd, signal),
|
|
73
|
+
signal,
|
|
74
|
+
);
|
|
75
|
+
results.record(id, "mutation", value);
|
|
76
|
+
recorded = true;
|
|
77
|
+
if (value.effect !== "not-applied") {
|
|
78
|
+
if (value.path !== undefined && operation !== "copy_file") {
|
|
79
|
+
results.forgetFile(value.path);
|
|
80
|
+
scope.forget(value.path);
|
|
81
|
+
}
|
|
82
|
+
if (value.target !== undefined) {
|
|
83
|
+
results.forgetFile(value.target);
|
|
84
|
+
scope.forget(value.target);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (value.ok && value.target !== undefined)
|
|
88
|
+
await services.editor.postProcessFile(value.target, { cwd: context.cwd, signal });
|
|
89
|
+
if (!value.ok)
|
|
90
|
+
throw failure(
|
|
91
|
+
value.error?.code ?? "FILE_OPERATION_FAILED",
|
|
92
|
+
value.error?.message ?? "File operation failed",
|
|
93
|
+
value,
|
|
94
|
+
);
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
if (kind === "mutation") {
|
|
98
|
+
const definition = services.editor
|
|
99
|
+
.getMutationTools()
|
|
100
|
+
.find((candidate) => candidate.name === tool);
|
|
101
|
+
if (definition === undefined)
|
|
102
|
+
throw failure("UNAVAILABLE_OPERATION", `IDE operation ${tool} is unavailable`);
|
|
103
|
+
const value = await executeScriptMutation(
|
|
104
|
+
services.editor,
|
|
105
|
+
definition,
|
|
106
|
+
arguments_,
|
|
107
|
+
signal,
|
|
108
|
+
context,
|
|
109
|
+
lastSource,
|
|
110
|
+
(source, presentation) => results.rememberMutation(source, presentation),
|
|
111
|
+
);
|
|
112
|
+
results.record(id, kind, value);
|
|
113
|
+
recorded = true;
|
|
114
|
+
for (const file of value.files) {
|
|
115
|
+
results.updateFile(file.source, file.before, file.after);
|
|
116
|
+
lastSource = file.source;
|
|
117
|
+
}
|
|
118
|
+
if (!value.ok)
|
|
119
|
+
throw failure(
|
|
120
|
+
value.errors[0]?.code ?? "OPERATION_FAILED",
|
|
121
|
+
value.errors[0]?.message ?? "Mutation failed",
|
|
122
|
+
value,
|
|
123
|
+
);
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
const schema = tool === "read" ? readParameters : searchSchema;
|
|
127
|
+
if (!Value.Check(schema, arguments_))
|
|
128
|
+
throw failure("INVALID_ARGUMENTS", `Invalid arguments for ${tool}`);
|
|
129
|
+
if (tool === "read") {
|
|
130
|
+
const outcome = await services.read.read(
|
|
131
|
+
arguments_,
|
|
132
|
+
{ cwd: context.cwd, signal },
|
|
133
|
+
"script",
|
|
134
|
+
);
|
|
135
|
+
const value = {
|
|
136
|
+
...(outcome.script ?? {
|
|
137
|
+
kind: "native",
|
|
138
|
+
source: outcome.details.source,
|
|
139
|
+
blocks: outcome.content,
|
|
140
|
+
}),
|
|
141
|
+
ok: !outcome.isError && outcome.details.failure === undefined,
|
|
142
|
+
};
|
|
143
|
+
results.record(id, kind, value, outcome);
|
|
144
|
+
recorded = true;
|
|
145
|
+
if (outcome.isError || outcome.details.failure)
|
|
146
|
+
throw failure(
|
|
147
|
+
readFailureCode(outcome.details.failure),
|
|
148
|
+
outcome.details.failure?.message ?? "Read failed",
|
|
149
|
+
value,
|
|
150
|
+
);
|
|
151
|
+
lastSource = outcome.details.source ?? lastSource;
|
|
152
|
+
services.rememberRead?.(outcome);
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
const outcome = await services.search.search(
|
|
156
|
+
arguments_ as SearchRequest,
|
|
157
|
+
{
|
|
158
|
+
cwd: context.cwd,
|
|
159
|
+
signal,
|
|
160
|
+
},
|
|
161
|
+
"script",
|
|
162
|
+
);
|
|
163
|
+
const searchFailure = outcome.details.failure;
|
|
164
|
+
const value = {
|
|
165
|
+
...outcome.script,
|
|
166
|
+
ok: searchFailure === undefined,
|
|
167
|
+
...(searchFailure && { error: searchFailure }),
|
|
168
|
+
};
|
|
169
|
+
results.record(id, kind, value, { content: outcome.content, details: {} });
|
|
170
|
+
recorded = true;
|
|
171
|
+
if (searchFailure !== undefined)
|
|
172
|
+
throw failure("SEARCH_FAILED", "Search failed", searchFailure);
|
|
173
|
+
return value;
|
|
174
|
+
} catch (error) {
|
|
175
|
+
if (!recorded)
|
|
176
|
+
results.record(id, kind, { operation, ok: false, error: serializeApplyError(error) });
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
async result(value, id) {
|
|
181
|
+
results.add(value, id);
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
return {
|
|
185
|
+
host: { ...host, execute: (...args) => scope.run(() => host.execute(...args)) },
|
|
186
|
+
results,
|
|
187
|
+
async finish() {
|
|
188
|
+
await services.editor.enqueueFileOperation(() =>
|
|
189
|
+
scope.finish((outcome) => {
|
|
190
|
+
const source = outcome.after.source;
|
|
191
|
+
const previous = results.mutationPresentation(source)?.data;
|
|
192
|
+
const formatting = outcome.postEditContributions
|
|
193
|
+
.map((item) => item.data)
|
|
194
|
+
.findLast(isFormattingContribution)?.formatting;
|
|
195
|
+
if (
|
|
196
|
+
!previous &&
|
|
197
|
+
outcome.before.content === outcome.after.content &&
|
|
198
|
+
!formatting?.formatter
|
|
199
|
+
)
|
|
200
|
+
return;
|
|
201
|
+
results.updateFile(source, outcome.before.content, outcome.after.content);
|
|
202
|
+
results.rememberMutation(
|
|
203
|
+
source,
|
|
204
|
+
new FileMutationResult({
|
|
205
|
+
ok: true,
|
|
206
|
+
path: source,
|
|
207
|
+
...previous,
|
|
208
|
+
afterContent: outcome.after.content,
|
|
209
|
+
afterDocument: outcome.after,
|
|
210
|
+
diffStatuses: outcome.postEditContributions
|
|
211
|
+
.map((item) => item.data)
|
|
212
|
+
.filter(isDiffStatusContribution)
|
|
213
|
+
.flatMap((item) => item.diffStatuses),
|
|
214
|
+
formatting: formatting ?? { status: "not-reported" },
|
|
215
|
+
}),
|
|
216
|
+
);
|
|
217
|
+
}),
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function failure(code: string, message: string, details?: unknown): Error {
|
|
224
|
+
return Object.assign(new Error(message), { code, details });
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function readFailureCode(
|
|
228
|
+
failure: { readonly code: string; readonly cause?: unknown } | undefined,
|
|
229
|
+
): string {
|
|
230
|
+
const cause = failure?.cause;
|
|
231
|
+
return cause !== null &&
|
|
232
|
+
typeof cause === "object" &&
|
|
233
|
+
"code" in cause &&
|
|
234
|
+
typeof cause.code === "string"
|
|
235
|
+
? cause.code
|
|
236
|
+
: (failure?.code ?? "READ_FAILED");
|
|
237
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FileMutationResult } from "#src/core/mutation-result/file-mutation-result.js";
|
|
2
|
+
import { createUnifiedDiff } from "#src/core/mutation-result/diff.js";
|
|
3
|
+
import type { ApplyResults } from "./results.js";
|
|
4
|
+
import type { ScriptMutationOutcome } from "./mutation-outcome.js";
|
|
5
|
+
|
|
6
|
+
/** Project recorded net effects into the same presentation model as standalone edits. */
|
|
7
|
+
export function finalApplyMutations(results: ApplyResults): FileMutationResult[] {
|
|
8
|
+
const selected = results.select();
|
|
9
|
+
const mutations = results.mutationValues().filter(isMutation);
|
|
10
|
+
return selected.files.map((file) => {
|
|
11
|
+
const receipts = mutations.flatMap((outcome) =>
|
|
12
|
+
outcome.files
|
|
13
|
+
.filter((changed) => changed.source === file.source)
|
|
14
|
+
.map((changed) => ({ outcome, changed })),
|
|
15
|
+
);
|
|
16
|
+
const presentation = results.mutationPresentation(file.source)?.data;
|
|
17
|
+
const latest = presentation?.afterContent === file.after ? presentation : undefined;
|
|
18
|
+
return new FileMutationResult({
|
|
19
|
+
ok: true,
|
|
20
|
+
path: file.source,
|
|
21
|
+
files: [{ path: file.source, action: file.before === null ? "created" : "edited" }],
|
|
22
|
+
snapshot: { content: file.before ?? "" },
|
|
23
|
+
beforeContentMap: { [file.source]: file.before },
|
|
24
|
+
afterContent: file.after ?? "",
|
|
25
|
+
afterDocument: latest?.afterDocument,
|
|
26
|
+
resultPresentation: latest?.resultPresentation,
|
|
27
|
+
scopeMarkers: latest?.scopeMarkers,
|
|
28
|
+
hints: latest?.hints,
|
|
29
|
+
warnings: latest?.warnings,
|
|
30
|
+
diffStatuses: latest?.diffStatuses,
|
|
31
|
+
diffs: [createUnifiedDiff(file.source, file.before ?? "", file.after ?? "").diff],
|
|
32
|
+
operations: receipts.map(({ outcome, changed }) => ({
|
|
33
|
+
operation: outcome.operation === "remove" ? "delete" : outcome.operation,
|
|
34
|
+
changes: changed.changes.length,
|
|
35
|
+
})),
|
|
36
|
+
formatting: latest?.formatting ?? receipts.at(-1)?.changed.formatting,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function isMutation(value: unknown): value is ScriptMutationOutcome {
|
|
42
|
+
return (
|
|
43
|
+
value !== null &&
|
|
44
|
+
typeof value === "object" &&
|
|
45
|
+
"operation" in value &&
|
|
46
|
+
"files" in value &&
|
|
47
|
+
Array.isArray(value.files) &&
|
|
48
|
+
"effect" in value
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { format } from "oxfmt";
|
|
2
|
+
|
|
3
|
+
/** Format only the completed display copy; execution always receives the original source. */
|
|
4
|
+
export async function formatApplySource(source: string): Promise<string> {
|
|
5
|
+
try {
|
|
6
|
+
const formatted = await format("apply.js", source, { printWidth: 90 });
|
|
7
|
+
return formatted.errors.length === 0 ? formatted.code.trimEnd() : source;
|
|
8
|
+
} catch {
|
|
9
|
+
return source;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { parser } from "@lezer/javascript";
|
|
2
|
+
import { TreeFragment, type Tree } from "@lezer/common";
|
|
3
|
+
|
|
4
|
+
const helpers = new Set([
|
|
5
|
+
"read",
|
|
6
|
+
"search",
|
|
7
|
+
"diff",
|
|
8
|
+
"write",
|
|
9
|
+
"replace",
|
|
10
|
+
"insert",
|
|
11
|
+
"remove",
|
|
12
|
+
"copy",
|
|
13
|
+
"move",
|
|
14
|
+
"undo",
|
|
15
|
+
"stage",
|
|
16
|
+
"unstage",
|
|
17
|
+
"delete_file",
|
|
18
|
+
"copy_file",
|
|
19
|
+
"move_file",
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
/** Bounded source expression; literal does not imply the operation has executed. */
|
|
23
|
+
export interface PreviewArgument {
|
|
24
|
+
readonly text: string;
|
|
25
|
+
readonly literal: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** A written call preview, never evidence that the call executed. */
|
|
28
|
+
export interface ApplyCallPreview {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly from: number;
|
|
31
|
+
readonly to: number;
|
|
32
|
+
readonly path?: PreviewArgument;
|
|
33
|
+
readonly query?: PreviewArgument;
|
|
34
|
+
readonly target?: PreviewArgument;
|
|
35
|
+
readonly before?: PreviewArgument;
|
|
36
|
+
readonly after?: PreviewArgument;
|
|
37
|
+
readonly arguments: Readonly<Record<string, PreviewArgument>>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Recover helper calls from incomplete JavaScript without evaluating arguments. */
|
|
41
|
+
export function parseApplyCalls(
|
|
42
|
+
source: string,
|
|
43
|
+
tree: Tree = parser.parse(source),
|
|
44
|
+
): ApplyCallPreview[] {
|
|
45
|
+
const shadows: { name: string; from: number; to: number }[] = [];
|
|
46
|
+
tree.iterate({
|
|
47
|
+
enter(node) {
|
|
48
|
+
if (node.name === "AssignmentExpression") {
|
|
49
|
+
const target = node.node.firstChild;
|
|
50
|
+
if (target?.name === "VariableName")
|
|
51
|
+
shadows.push({ name: source.slice(target.from, target.to), from: 0, to: source.length });
|
|
52
|
+
}
|
|
53
|
+
if (node.name !== "VariableDefinition") return;
|
|
54
|
+
let declaration = node.node.parent;
|
|
55
|
+
while (
|
|
56
|
+
declaration?.parent &&
|
|
57
|
+
!["VariableDeclaration", "ParamList", "Block", "Script"].includes(declaration.name)
|
|
58
|
+
)
|
|
59
|
+
declaration = declaration.parent;
|
|
60
|
+
const hoisted =
|
|
61
|
+
declaration?.name === "VariableDeclaration" && declaration.firstChild?.name === "var";
|
|
62
|
+
const boundaries = new Set([
|
|
63
|
+
"Script",
|
|
64
|
+
"FunctionDeclaration",
|
|
65
|
+
"FunctionExpression",
|
|
66
|
+
"ArrowFunction",
|
|
67
|
+
...(hoisted ? [] : ["Block"]),
|
|
68
|
+
]);
|
|
69
|
+
let scope = node.node.parent;
|
|
70
|
+
if (scope?.name === "FunctionDeclaration") scope = scope.parent;
|
|
71
|
+
while (scope?.parent && !boundaries.has(scope.name)) scope = scope.parent;
|
|
72
|
+
shadows.push({
|
|
73
|
+
name: source.slice(node.from, node.to),
|
|
74
|
+
from: scope?.from ?? 0,
|
|
75
|
+
to: scope?.to ?? source.length,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
const calls: ApplyCallPreview[] = [];
|
|
80
|
+
tree.iterate({
|
|
81
|
+
enter(node) {
|
|
82
|
+
if (node.name !== "CallExpression") return;
|
|
83
|
+
const callee = node.node.firstChild;
|
|
84
|
+
if (callee?.name !== "VariableName") return;
|
|
85
|
+
const name = source.slice(callee.from, callee.to);
|
|
86
|
+
if (
|
|
87
|
+
!helpers.has(name) ||
|
|
88
|
+
shadows.some(
|
|
89
|
+
(binding) => binding.name === name && binding.from <= node.from && binding.to >= node.to,
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
return;
|
|
93
|
+
const object = node.node.getChild("ArgList")?.getChild("ObjectExpression");
|
|
94
|
+
const fields = Object.create(null) as Record<string, PreviewArgument>;
|
|
95
|
+
if (!object) {
|
|
96
|
+
const args = node.node.getChild("ArgList");
|
|
97
|
+
const raw = args ? source.slice(args.from + 1, args.to).replace(/\)$/, "") : "";
|
|
98
|
+
if (raw)
|
|
99
|
+
fields.arguments = {
|
|
100
|
+
text: raw.length > 160 ? raw.slice(0, 120) + "…" : raw,
|
|
101
|
+
literal: false,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
for (const property of object?.getChildren("Property") ?? []) {
|
|
105
|
+
const key = property.firstChild;
|
|
106
|
+
const rawKey = key ? source.slice(key.from, key.to) : "";
|
|
107
|
+
const field = rawKey.replace(/^["']|["']$/g, "");
|
|
108
|
+
if (!/^[a-zA-Z_$][\w$]*$/.test(field)) {
|
|
109
|
+
// Computed keys and spreads can replace any earlier identity argument.
|
|
110
|
+
for (const identity of ["path", "query", "target", "before", "after"])
|
|
111
|
+
delete fields[identity];
|
|
112
|
+
const raw = source.slice(property.from, property.to);
|
|
113
|
+
fields[`argument@${property.from}`] = {
|
|
114
|
+
text: raw.length > 160 ? raw.slice(0, 160) + "…" : raw,
|
|
115
|
+
literal: false,
|
|
116
|
+
};
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const value = property.lastChild;
|
|
120
|
+
if (!value || value.type.isError || value.name === ":") continue;
|
|
121
|
+
const raw = source.slice(value.from, value.to);
|
|
122
|
+
const singleLine = raw.replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/\t/g, "\\t");
|
|
123
|
+
const anchor =
|
|
124
|
+
/^(?:["'])(?:\d+#[0-9A-F]+|CHANGE#[0-9A-F]+|begin|end|scope-(?:begin|end)-[^"']+)["']$/.test(
|
|
125
|
+
raw,
|
|
126
|
+
);
|
|
127
|
+
fields[field] = {
|
|
128
|
+
text:
|
|
129
|
+
singleLine.length > 160 && !anchor
|
|
130
|
+
? `${singleLine.slice(0, 100)}…${singleLine.slice(-40)} (${raw.length} source chars)`
|
|
131
|
+
: singleLine,
|
|
132
|
+
literal:
|
|
133
|
+
["String", "Number", "BooleanLiteral", "Null"].includes(value.name) &&
|
|
134
|
+
value.lastChild?.type.isError !== true,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
calls.push({
|
|
138
|
+
name,
|
|
139
|
+
from: node.from,
|
|
140
|
+
to: node.to,
|
|
141
|
+
path: fields.path,
|
|
142
|
+
query: fields.query,
|
|
143
|
+
target: fields.target,
|
|
144
|
+
before: fields.before,
|
|
145
|
+
after: fields.after,
|
|
146
|
+
arguments: fields,
|
|
147
|
+
});
|
|
148
|
+
return false;
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
return calls;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Compact written calls only; source and execution are never changed. */
|
|
155
|
+
export function compactApplySource(
|
|
156
|
+
source: string,
|
|
157
|
+
calls = parseApplyCalls(source),
|
|
158
|
+
renderCall?: (call: ApplyCallPreview) => string,
|
|
159
|
+
renderCode: (source: string) => string = (source) => source,
|
|
160
|
+
): string {
|
|
161
|
+
let cursor = 0;
|
|
162
|
+
const parts: string[] = [];
|
|
163
|
+
const codePreview = (text: string) =>
|
|
164
|
+
renderCode(
|
|
165
|
+
text
|
|
166
|
+
.split("\n")
|
|
167
|
+
.map((line) => (line.length > 200 ? line.slice(0, 200) + "…" : line))
|
|
168
|
+
.join("\n"),
|
|
169
|
+
);
|
|
170
|
+
for (const call of calls) {
|
|
171
|
+
parts.push(codePreview(source.slice(cursor, call.from)));
|
|
172
|
+
parts.push(
|
|
173
|
+
renderCall?.(call) ??
|
|
174
|
+
`${call.name}(${call.path ? (call.path.literal ? call.path.text : `‹${call.path.text}›`) : "…"})`,
|
|
175
|
+
);
|
|
176
|
+
cursor = call.to;
|
|
177
|
+
}
|
|
178
|
+
parts.push(codePreview(source.slice(cursor)));
|
|
179
|
+
return parts.join("");
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Reuse syntax trees across streamed argument updates and repeated terminal paints. */
|
|
183
|
+
export function createApplySourceProjection(
|
|
184
|
+
renderCall?: (call: ApplyCallPreview) => string,
|
|
185
|
+
renderCode?: (source: string) => string,
|
|
186
|
+
): (source: string) => string {
|
|
187
|
+
let previous = "";
|
|
188
|
+
let output = "";
|
|
189
|
+
let fragments: readonly TreeFragment[] = [];
|
|
190
|
+
return (source) => {
|
|
191
|
+
if (source === previous) return output;
|
|
192
|
+
let shared = 0;
|
|
193
|
+
while (
|
|
194
|
+
shared < previous.length &&
|
|
195
|
+
shared < source.length &&
|
|
196
|
+
previous[shared] === source[shared]
|
|
197
|
+
)
|
|
198
|
+
shared++;
|
|
199
|
+
fragments = TreeFragment.applyChanges(fragments, [
|
|
200
|
+
{ fromA: shared, toA: previous.length, fromB: shared, toB: source.length },
|
|
201
|
+
]);
|
|
202
|
+
const tree = parser.parse(source, fragments);
|
|
203
|
+
fragments = TreeFragment.addTree(tree);
|
|
204
|
+
output = compactApplySource(source, parseApplyCalls(source, tree), renderCall, renderCode);
|
|
205
|
+
previous = source;
|
|
206
|
+
return output;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TextAnchorRecoveryCandidate } from "pi-agent-text";
|
|
2
|
+
import type { MutationFormatting, AppliedTextChange } from "#src/api/mutation-result.js";
|
|
3
|
+
|
|
4
|
+
/** Plain recovery data from the same anchor resolver used by standalone mutations. */
|
|
5
|
+
export interface ScriptAnchorRecovery {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly field: string;
|
|
8
|
+
readonly anchor: string;
|
|
9
|
+
readonly status: "candidates" | "unavailable" | "timed-out" | "failed";
|
|
10
|
+
readonly candidates: readonly TextAnchorRecoveryCandidate[];
|
|
11
|
+
readonly total: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Plain resource data crossing the script bridge, independent of renderer objects. */
|
|
15
|
+
export interface ScriptMutationFile {
|
|
16
|
+
readonly source: string;
|
|
17
|
+
readonly before: string | null;
|
|
18
|
+
readonly after: string;
|
|
19
|
+
readonly action: string;
|
|
20
|
+
readonly changes: readonly AppliedTextChange[];
|
|
21
|
+
readonly formatting: MutationFormatting;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Shared mutation execution outcome before model-facing formatting. */
|
|
25
|
+
export interface ScriptMutationOutcome {
|
|
26
|
+
readonly operation: string;
|
|
27
|
+
readonly ok: boolean;
|
|
28
|
+
readonly effect: "not-applied" | "applied" | "unknown";
|
|
29
|
+
readonly files: readonly ScriptMutationFile[];
|
|
30
|
+
readonly completed: readonly string[];
|
|
31
|
+
readonly recoveries?: readonly ScriptAnchorRecovery[];
|
|
32
|
+
/** Structured contributions from configured IDE mutation handlers. */
|
|
33
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
34
|
+
readonly errors: readonly {
|
|
35
|
+
readonly source: string;
|
|
36
|
+
readonly code: string;
|
|
37
|
+
readonly message: string;
|
|
38
|
+
}[];
|
|
39
|
+
}
|