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
|
@@ -27,9 +27,10 @@ export function resolveMutationResultResources(
|
|
|
27
27
|
): readonly MutationRenderResource[] {
|
|
28
28
|
const stored = details?.mutationRender;
|
|
29
29
|
if (stored !== undefined) {
|
|
30
|
-
return stored.map(({ path, model }) => ({
|
|
30
|
+
return stored.map(({ path, model, diffStatuses }) => ({
|
|
31
31
|
path,
|
|
32
32
|
model,
|
|
33
|
+
...(diffStatuses === undefined ? {} : { diffStatuses }),
|
|
33
34
|
ranges: [],
|
|
34
35
|
beforeContent: "",
|
|
35
36
|
afterContent: "",
|
|
@@ -62,6 +63,12 @@ function finalResource(result: FileMutationResult): readonly MutationRenderResou
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
const replayed = changes === undefined ? undefined : replayChanges(before ?? "", changes);
|
|
66
|
+
const finalLineOwnership = unchangedBatchOwnership(
|
|
67
|
+
before ?? "",
|
|
68
|
+
afterContent,
|
|
69
|
+
changes,
|
|
70
|
+
result.data.diffPeerRanges,
|
|
71
|
+
);
|
|
65
72
|
const typingIdentity =
|
|
66
73
|
replayed === afterContent
|
|
67
74
|
? {
|
|
@@ -76,12 +83,57 @@ function finalResource(result: FileMutationResult): readonly MutationRenderResou
|
|
|
76
83
|
ranges: [],
|
|
77
84
|
beforeContent: before ?? "",
|
|
78
85
|
...(typingIdentity === undefined ? {} : { typingIdentity }),
|
|
86
|
+
|
|
87
|
+
...(finalLineOwnership === undefined ? {} : { finalLineOwnership }),
|
|
88
|
+
|
|
89
|
+
...(result.data.diffPeerRanges === undefined
|
|
90
|
+
? {}
|
|
91
|
+
: { diffPeerRanges: result.data.diffPeerRanges }),
|
|
92
|
+
...(result.data.diffStatuses === undefined
|
|
93
|
+
? {}
|
|
94
|
+
: { diffStatuses: result.data.diffStatuses }),
|
|
95
|
+
|
|
79
96
|
afterContent,
|
|
80
97
|
},
|
|
81
98
|
];
|
|
82
99
|
});
|
|
83
100
|
}
|
|
84
101
|
|
|
102
|
+
function unchangedBatchOwnership(
|
|
103
|
+
before: string,
|
|
104
|
+
after: string,
|
|
105
|
+
own: readonly PersistedTextChange[] | undefined,
|
|
106
|
+
peers: FileMutationResult["data"]["diffPeerRanges"],
|
|
107
|
+
): MutationRenderResource["finalLineOwnership"] {
|
|
108
|
+
if (own === undefined || peers === undefined) return undefined;
|
|
109
|
+
const edits = [
|
|
110
|
+
...own.map(({ fromA: from, toA: to, insertedText: insert }) => ({
|
|
111
|
+
from,
|
|
112
|
+
to,
|
|
113
|
+
insert,
|
|
114
|
+
own: true,
|
|
115
|
+
})),
|
|
116
|
+
...peers.map((peer) => ({ ...peer, own: false })),
|
|
117
|
+
].sort((a, b) => a.from - b.from);
|
|
118
|
+
const ownership = { own: new Set<number>(), peers: new Set<number>() };
|
|
119
|
+
let content = "";
|
|
120
|
+
let offset = 0;
|
|
121
|
+
for (const edit of edits) {
|
|
122
|
+
if (edit.from < offset || edit.to < edit.from || edit.to > before.length) return undefined;
|
|
123
|
+
content += before.slice(offset, edit.from);
|
|
124
|
+
const firstLine = content.split("\n").length;
|
|
125
|
+
content += edit.insert;
|
|
126
|
+
if (edit.insert.length > 0) {
|
|
127
|
+
const lastLine = content.slice(0, -1).split("\n").length;
|
|
128
|
+
for (let line = firstLine; line <= lastLine; line++)
|
|
129
|
+
ownership[edit.own ? "own" : "peers"].add(line);
|
|
130
|
+
}
|
|
131
|
+
offset = edit.to;
|
|
132
|
+
}
|
|
133
|
+
if (content + before.slice(offset) !== after) return undefined;
|
|
134
|
+
return { own: [...ownership.own], peers: [...ownership.peers] };
|
|
135
|
+
}
|
|
136
|
+
|
|
85
137
|
function persistedViewports(
|
|
86
138
|
results: readonly FileMutationResult[],
|
|
87
139
|
): FrozenMutationViewports | undefined {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FileMutationResult,
|
|
3
3
|
type FileMutationBatchResult,
|
|
4
|
+
type MutationDiffStatus,
|
|
4
5
|
} from "pi-agent-text-editor/api/mutation-result";
|
|
5
6
|
import { resolveMutationResultResources } from "./mutation-result.js";
|
|
6
7
|
import type { DiffModel } from "./diff-model.js";
|
|
@@ -9,6 +10,7 @@ import type { DiffModel } from "./diff-model.js";
|
|
|
9
10
|
export interface PersistedMutationResource {
|
|
10
11
|
readonly path: string;
|
|
11
12
|
readonly model: DiffModel;
|
|
13
|
+
readonly diffStatuses?: readonly MutationDiffStatus[];
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** Completed history owns diff fragments, not the engine's document snapshots. */
|
|
@@ -35,13 +37,17 @@ export function compactMutationDetails(details: FileMutationBatchResult): Persis
|
|
|
35
37
|
inputEdits: _input,
|
|
36
38
|
beforeReadText: _read,
|
|
37
39
|
rawChanges: _changes,
|
|
40
|
+
|
|
41
|
+
diffPeerRanges: _peerRanges,
|
|
38
42
|
diffs: _diffs,
|
|
39
43
|
...data
|
|
40
44
|
} = result.data;
|
|
41
45
|
return new FileMutationResult(data);
|
|
42
46
|
}),
|
|
43
|
-
mutationRender: resources.flatMap(({ path, model }) =>
|
|
44
|
-
model === undefined
|
|
47
|
+
mutationRender: resources.flatMap(({ path, model, diffStatuses }) =>
|
|
48
|
+
model === undefined
|
|
49
|
+
? []
|
|
50
|
+
: [{ path, model, ...(diffStatuses === undefined ? {} : { diffStatuses }) }],
|
|
45
51
|
),
|
|
46
52
|
};
|
|
47
53
|
}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import type { MutationDiffStatus } from "pi-agent-text-editor/api/mutation-result";
|
|
1
2
|
import type { DiffModel } from "./diff-model.js";
|
|
2
3
|
import type { TextMutationPreviewResource } from "pi-agent-text-editor/api/mutation-preview";
|
|
3
4
|
|
|
4
5
|
export interface MutationRenderResource extends TextMutationPreviewResource {
|
|
5
6
|
readonly model?: DiffModel;
|
|
7
|
+
readonly diffStatuses?: readonly MutationDiffStatus[];
|
|
8
|
+
|
|
9
|
+
/** Original spans owned by sibling batch calls, excluded from this local diff. */
|
|
10
|
+
readonly diffPeerRanges?: readonly { readonly from: number; readonly to: number }[];
|
|
11
|
+
/** Exact final line ownership when postprocessing left the requested batch text unchanged. */
|
|
12
|
+
readonly finalLineOwnership?: {
|
|
13
|
+
readonly own: readonly number[];
|
|
14
|
+
readonly peers: readonly number[];
|
|
15
|
+
};
|
|
6
16
|
readonly cursorOffset?: number;
|
|
7
17
|
/** Original mutation spans retained when final rendering uses an unscoped semantic diff. */
|
|
8
18
|
readonly typingIdentity?: {
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts
CHANGED
|
@@ -88,16 +88,18 @@ interface RenderState {
|
|
|
88
88
|
export function registerMutationRenderers(
|
|
89
89
|
api: TextEditorPluginApi,
|
|
90
90
|
animationPressure?: MutationAnimationPressure,
|
|
91
|
+
animationsEnabled: () => boolean = () => true,
|
|
91
92
|
): void {
|
|
92
93
|
api.onMutationTool((registration) => {
|
|
93
|
-
api.addToolRenderer(createRenderer(api, registration, animationPressure));
|
|
94
|
+
api.addToolRenderer(createRenderer(api, registration, animationPressure, animationsEnabled));
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
function createRenderer(
|
|
98
99
|
api: TextEditorPluginApi,
|
|
99
100
|
registration: AnyTextMutationToolRegistration,
|
|
100
|
-
animationPressure
|
|
101
|
+
animationPressure: MutationAnimationPressure | undefined,
|
|
102
|
+
animationsEnabled: () => boolean,
|
|
101
103
|
): TextEditorToolRendererRegistration {
|
|
102
104
|
const tool = registration.name;
|
|
103
105
|
|
|
@@ -161,7 +163,7 @@ function createRenderer(
|
|
|
161
163
|
const isArgumentsComplete = context.argsComplete;
|
|
162
164
|
const key = `${isArgumentsComplete ? "complete" : "typing"}:${JSON.stringify(input)}`;
|
|
163
165
|
|
|
164
|
-
if (generated !== undefined) {
|
|
166
|
+
if (generated !== undefined && animationsEnabled()) {
|
|
165
167
|
const typing = (state.typing ??= new TypingInterpolation());
|
|
166
168
|
|
|
167
169
|
state.releaseAnimationPressure ??= animationPressure?.track(context.toolCallId, () => {
|
|
@@ -700,6 +702,14 @@ function mutationCallDetails(
|
|
|
700
702
|
});
|
|
701
703
|
}
|
|
702
704
|
|
|
705
|
+
/** Render a written call header without preparing previews or reading files. */
|
|
706
|
+
export function renderWrittenMutationHeader(
|
|
707
|
+
registration: AnyTextMutationToolRegistration,
|
|
708
|
+
input: Readonly<Record<string, unknown>>,
|
|
709
|
+
theme: Theme,
|
|
710
|
+
): string {
|
|
711
|
+
return renderHeader(registration, input, undefined, theme, undefined, false);
|
|
712
|
+
}
|
|
703
713
|
function renderHeader(
|
|
704
714
|
registration: AnyTextMutationToolRegistration,
|
|
705
715
|
input: Readonly<Record<string, unknown>>,
|
|
@@ -768,18 +778,19 @@ function renderAnchorRange(
|
|
|
768
778
|
if (field === undefined) {
|
|
769
779
|
return undefined;
|
|
770
780
|
}
|
|
771
|
-
const state = anchorRenderPatch?.[field];
|
|
772
|
-
if (state?.kind === "resolved") {
|
|
773
|
-
return singleLine(expanded ? state.full : state.compact);
|
|
774
|
-
}
|
|
775
|
-
if (state?.kind === "failed") {
|
|
776
|
-
return "selected range";
|
|
777
|
-
}
|
|
778
781
|
const raw = stringValue(input[field]);
|
|
779
|
-
if (raw
|
|
780
|
-
|
|
782
|
+
if (raw !== undefined) {
|
|
783
|
+
const displayed = singleLine(raw);
|
|
784
|
+
const structured =
|
|
785
|
+
/^(?:\d+#[0-9A-F]+|CHANGE#[0-9A-F]+|SEARCH#|scope-(?:begin|end)-|begin$|end$)/.test(raw);
|
|
786
|
+
return expanded || structured || displayed.length <= 100
|
|
787
|
+
? displayed
|
|
788
|
+
: `${displayed.slice(0, 60)}…${displayed.slice(-30)} (${raw.length} chars)`;
|
|
781
789
|
}
|
|
782
|
-
|
|
790
|
+
const state = anchorRenderPatch?.[field];
|
|
791
|
+
return state?.kind === "resolved"
|
|
792
|
+
? singleLine(expanded ? state.full : state.compact)
|
|
793
|
+
: undefined;
|
|
783
794
|
};
|
|
784
795
|
return range(renderField(fields.at(0)), renderField(fields.at(1)), theme);
|
|
785
796
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { MutationDiffStatus } from "pi-agent-text-editor/api/mutation-result";
|
|
2
|
+
|
|
3
|
+
/** Aggregate successful formatting by unique file and tool; leave failures identifiable. */
|
|
4
|
+
export function summarizeStatuses(
|
|
5
|
+
resources: readonly {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly diffStatuses?: readonly MutationDiffStatus[];
|
|
8
|
+
}[],
|
|
9
|
+
) {
|
|
10
|
+
const formatted = new Set<string>();
|
|
11
|
+
const formatters = new Set<string>();
|
|
12
|
+
const remaining = new Map<string, { status: MutationDiffStatus; paths: Set<string> }>();
|
|
13
|
+
for (const resource of resources)
|
|
14
|
+
for (const status of resource.diffStatuses ?? []) {
|
|
15
|
+
if (status.formatter !== undefined && status.tone === "success") {
|
|
16
|
+
formatted.add(resource.path);
|
|
17
|
+
formatters.add(status.formatter);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const key = JSON.stringify([status.text, status.tone]);
|
|
21
|
+
let group = remaining.get(key);
|
|
22
|
+
if (!group) {
|
|
23
|
+
group = { status, paths: new Set() };
|
|
24
|
+
remaining.set(key, group);
|
|
25
|
+
}
|
|
26
|
+
group.paths.add(resource.path);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
formatted: [...formatted],
|
|
30
|
+
formatters: [...formatters],
|
|
31
|
+
statuses: [...remaining.values()].map(({ status, paths }) => ({ status, paths: [...paths] })),
|
|
32
|
+
};
|
|
33
|
+
}
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-stale-anchor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-invariant": "0.
|
|
7
|
-
"pi-agent-read": "0.
|
|
8
|
-
"pi-agent-text-editor": "0.
|
|
6
|
+
"pi-agent-invariant": "0.3.0",
|
|
7
|
+
"pi-agent-read": "0.3.0",
|
|
8
|
+
"pi-agent-text-editor": "0.3.0"
|
|
9
9
|
},
|
|
10
10
|
"pi": {
|
|
11
11
|
"extensions": [
|
|
12
|
-
"./runtime/entry-
|
|
12
|
+
"./runtime/entry-72.js"
|
|
13
13
|
]
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
@@ -3,6 +3,8 @@ import type { TextDocument } from "pi-agent-text";
|
|
|
3
3
|
export type TextEditIntent = "edit" | "restore" | "mixed";
|
|
4
4
|
|
|
5
5
|
export interface TextEditCompletion {
|
|
6
|
+
/** Deferred writes remain observable; final updates reconcile formatting without another edit. */
|
|
7
|
+
readonly postProcessing?: "deferred" | "final" | "complete";
|
|
6
8
|
readonly source: string;
|
|
7
9
|
readonly resourceSource: string;
|
|
8
10
|
readonly resolvedBy: string;
|
|
@@ -5,10 +5,25 @@ import type { TextEditorToolId } from "#src/api/plugin-protocol.js";
|
|
|
5
5
|
|
|
6
6
|
export type TextEditPipelineStage = "text-pre-edit" | "text-edit" | "text-post-edit";
|
|
7
7
|
|
|
8
|
+
/** Host-plugin edit plan, checked against exact snapshots before any writes. */
|
|
9
|
+
export interface TextEditPlan {
|
|
10
|
+
readonly files: readonly {
|
|
11
|
+
readonly source: string;
|
|
12
|
+
readonly expectedContent: string;
|
|
13
|
+
readonly changes: readonly {
|
|
14
|
+
readonly from: number;
|
|
15
|
+
readonly to: number;
|
|
16
|
+
readonly insert: string;
|
|
17
|
+
}[];
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
8
20
|
export interface TextPreEditState<Input = unknown> {
|
|
9
21
|
readonly cwd: string;
|
|
10
22
|
readonly input: Input;
|
|
23
|
+
/** Optional native semantic edits supplied by the owning plugin, not by tool arguments. */
|
|
24
|
+
readonly editPlan?: TextEditPlan;
|
|
11
25
|
readonly signal?: AbortSignal;
|
|
26
|
+
/** A validated diffStatuses contribution is added to each completed file's presentation. */
|
|
12
27
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
13
28
|
}
|
|
14
29
|
|
|
@@ -16,6 +16,11 @@ export function rememberLastResolvedResource(pi: ExtensionAPI, details: unknown)
|
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
if (Array.isArray(details.resources)) {
|
|
20
|
+
for (const resource of details.resources) {
|
|
21
|
+
if (isRecord(resource)) rememberLastResolvedResource(pi, resource.details);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
19
24
|
const source = details.source;
|
|
20
25
|
const resolverId = details.resolvedBy;
|
|
21
26
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AgentToolResult, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { TSchema } from "typebox";
|
|
1
3
|
import { isResourceResolver, type ResourceResolver } from "pi-agent-resource";
|
|
2
4
|
import {
|
|
3
5
|
isTextAnchorResolver,
|
|
@@ -26,9 +28,19 @@ import type {
|
|
|
26
28
|
} from "#src/api/mutation-tool.js";
|
|
27
29
|
import type { TextEditorToolRendererRegistration } from "#src/api/tool-renderer.js";
|
|
28
30
|
|
|
31
|
+
/** Shared index operations; Apply uses the same implementation and guards as standalone tools. */
|
|
32
|
+
export interface ScriptIndexOperation {
|
|
33
|
+
readonly name: "stage" | "unstage";
|
|
34
|
+
readonly parameters: TSchema;
|
|
35
|
+
execute(
|
|
36
|
+
input: unknown,
|
|
37
|
+
signal: AbortSignal,
|
|
38
|
+
context: ExtensionContext,
|
|
39
|
+
): Promise<AgentToolResult<unknown>>;
|
|
40
|
+
}
|
|
29
41
|
export const TEXT_EDITOR_PROTOCOL = "pi-agent-text-editor";
|
|
30
42
|
|
|
31
|
-
export const TEXT_EDITOR_API_VERSION =
|
|
43
|
+
export const TEXT_EDITOR_API_VERSION = 20;
|
|
32
44
|
|
|
33
45
|
export const TEXT_POSITION_ANCHOR_KIND = "pi-agent-text-editor/position";
|
|
34
46
|
|
|
@@ -89,6 +101,8 @@ export interface TextEditorPluginApi {
|
|
|
89
101
|
addMutationTool(registration: TextMutationToolRegistration): void;
|
|
90
102
|
addMutationGuard(registration: TextMutationGuardRegistration): void;
|
|
91
103
|
addToolRenderer(registration: TextEditorToolRendererRegistration): void;
|
|
104
|
+
/** Register an index operation for Apply without exposing unrelated Pi tools. */
|
|
105
|
+
addScriptIndexOperation(operation: ScriptIndexOperation): void;
|
|
92
106
|
onMutationTool(listener: TextMutationToolListener): () => void;
|
|
93
107
|
onDidEdit(listener: TextEditCompletionListener): () => void;
|
|
94
108
|
previewMutation(request: TextMutationPreviewRequest): Promise<TextMutationPreviewOutcome>;
|
|
@@ -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,
|