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,4 +1,5 @@
|
|
|
1
1
|
import { requiredValue } from "pi-agent-invariant";
|
|
2
|
+
import type { SearchSelectionMatch, SearchSelectionRegistration } from "pi-agent-search/api/search";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
4
|
import { readFile } from "node:fs/promises";
|
|
4
5
|
import path from "node:path";
|
|
@@ -21,14 +22,7 @@ import { runSearchRecipe, type SearchRecipe } from "#src/search-recipe.js";
|
|
|
21
22
|
const searchAnchorPattern = /^SEARCH#([A-F0-9]{4,64}):(all|[1-9]\d*):(line|match)$/u;
|
|
22
23
|
const minimumSearchSessionIdLength = 4;
|
|
23
24
|
|
|
24
|
-
export
|
|
25
|
-
readonly source: string;
|
|
26
|
-
readonly lineNumber: number;
|
|
27
|
-
readonly startColumn: number;
|
|
28
|
-
readonly endColumn: number;
|
|
29
|
-
readonly matchedText: string;
|
|
30
|
-
readonly lineText: string;
|
|
31
|
-
}
|
|
25
|
+
export type TextSearchMatch = SearchSelectionMatch;
|
|
32
26
|
|
|
33
27
|
export interface TextSearchSession {
|
|
34
28
|
readonly id: string;
|
|
@@ -44,6 +38,7 @@ interface SearchSnapshot {
|
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
interface StoredSearchSession extends TextSearchSession, SearchSnapshot {
|
|
41
|
+
readonly refresh?: SearchSelectionRegistration["refresh"];
|
|
47
42
|
readonly recipe: SearchRecipe;
|
|
48
43
|
readonly cwd: string;
|
|
49
44
|
readonly refreshedComplete?: SearchSnapshot;
|
|
@@ -92,6 +87,7 @@ export function createSearchSessionIdentity(
|
|
|
92
87
|
source,
|
|
93
88
|
match.lineNumber,
|
|
94
89
|
match.startColumn,
|
|
90
|
+
match.endLineNumber ?? match.lineNumber,
|
|
95
91
|
match.endColumn,
|
|
96
92
|
match.matchedText,
|
|
97
93
|
match.lineText,
|
|
@@ -153,6 +149,7 @@ export class SearchSessionStore {
|
|
|
153
149
|
query,
|
|
154
150
|
regex: true,
|
|
155
151
|
},
|
|
152
|
+
refresh?: SearchSelectionRegistration["refresh"],
|
|
156
153
|
): Promise<TextSearchSession> {
|
|
157
154
|
const matches = sourceMatches
|
|
158
155
|
.map((match) => ({ ...match, source: path.resolve(match.source) }))
|
|
@@ -168,6 +165,7 @@ export class SearchSessionStore {
|
|
|
168
165
|
complete,
|
|
169
166
|
contentBySource,
|
|
170
167
|
recipe,
|
|
168
|
+
...(refresh !== undefined && { refresh }),
|
|
171
169
|
cwd: path.resolve(cwd),
|
|
172
170
|
};
|
|
173
171
|
this.#idsByIdentity.set(identity, id);
|
|
@@ -175,6 +173,57 @@ export class SearchSessionStore {
|
|
|
175
173
|
return session;
|
|
176
174
|
}
|
|
177
175
|
|
|
176
|
+
/** Repeats each referenced search once, keeping its original scope, limits and fallback rules. */
|
|
177
|
+
public async observeAfterEdit(
|
|
178
|
+
values: readonly unknown[],
|
|
179
|
+
signal?: AbortSignal,
|
|
180
|
+
): Promise<
|
|
181
|
+
readonly {
|
|
182
|
+
sessionId: string;
|
|
183
|
+
query: string;
|
|
184
|
+
scope: Record<string, unknown>;
|
|
185
|
+
matches?: number;
|
|
186
|
+
complete?: boolean;
|
|
187
|
+
notices?: readonly string[];
|
|
188
|
+
error?: string;
|
|
189
|
+
}[]
|
|
190
|
+
> {
|
|
191
|
+
const ids = new Set(
|
|
192
|
+
values.flatMap((value) => {
|
|
193
|
+
const anchor = typeof value === "string" ? parseSearchAnchor(value) : undefined;
|
|
194
|
+
return anchor === undefined ? [] : [anchor.id];
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
const observations = [];
|
|
198
|
+
for (const id of ids) {
|
|
199
|
+
const session = this.#sessions.get(id);
|
|
200
|
+
if (session === undefined) continue;
|
|
201
|
+
const base = {
|
|
202
|
+
sessionId: id,
|
|
203
|
+
query: session.recipe.originalQuery ?? session.query,
|
|
204
|
+
scope: normalizeRecipe(session.recipe, session.cwd),
|
|
205
|
+
};
|
|
206
|
+
try {
|
|
207
|
+
const result =
|
|
208
|
+
session.refresh === undefined
|
|
209
|
+
? await runSearchRecipe(session.recipe, session.cwd, signal)
|
|
210
|
+
: await session.refresh(signal);
|
|
211
|
+
observations.push({
|
|
212
|
+
...base,
|
|
213
|
+
matches: result.matches.length,
|
|
214
|
+
complete: result.complete,
|
|
215
|
+
notices: result.notices,
|
|
216
|
+
});
|
|
217
|
+
} catch (error) {
|
|
218
|
+
observations.push({
|
|
219
|
+
...base,
|
|
220
|
+
error: error instanceof Error ? error.message : String(error),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return observations;
|
|
225
|
+
}
|
|
226
|
+
|
|
178
227
|
public anchorResolver(): TextAnchorResolver {
|
|
179
228
|
return {
|
|
180
229
|
id: "search",
|
|
@@ -315,14 +364,21 @@ export class SearchSessionStore {
|
|
|
315
364
|
);
|
|
316
365
|
grouped.set(match.source, ranges);
|
|
317
366
|
}
|
|
318
|
-
const targets: TextTarget[] = [...grouped].map(([source, ranges]) => ({
|
|
367
|
+
const targets: TextTarget[] = [...grouped].map(([source, ranges]) => ({
|
|
368
|
+
source,
|
|
369
|
+
ranges,
|
|
370
|
+
expectedContent: snapshot.contentBySource.get(source),
|
|
371
|
+
}));
|
|
319
372
|
return targets.length === 0
|
|
320
373
|
? { kind: "rejected", rejection: { code: "missing", reason: "search anchor has no matches" } }
|
|
321
374
|
: { kind: "resolved", targets };
|
|
322
375
|
}
|
|
323
376
|
|
|
324
377
|
async #refresh(session: StoredSearchSession, signal?: AbortSignal): Promise<SearchSnapshot> {
|
|
325
|
-
const result =
|
|
378
|
+
const result =
|
|
379
|
+
session.refresh === undefined
|
|
380
|
+
? await runSearchRecipe(session.recipe, session.cwd, signal)
|
|
381
|
+
: await session.refresh(signal);
|
|
326
382
|
const matches = result.matches
|
|
327
383
|
.map((match) => ({ ...match, source: path.resolve(match.source) }))
|
|
328
384
|
.sort(compareMatches);
|
|
@@ -362,13 +418,28 @@ function selectMatches(
|
|
|
362
418
|
}
|
|
363
419
|
|
|
364
420
|
const seenLines = new Set<string>();
|
|
365
|
-
return selected.
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
return
|
|
421
|
+
return selected.flatMap((match) => {
|
|
422
|
+
const document = createTextDocument(
|
|
423
|
+
match.source,
|
|
424
|
+
session.contentBySource.get(match.source) ?? match.lineText,
|
|
425
|
+
);
|
|
426
|
+
const last = lastContainingLine(match);
|
|
427
|
+
return document.lines.slice(match.lineNumber - 1, last).flatMap((line) => {
|
|
428
|
+
const key = `${match.source}\u0000${String(line.lineNumber)}`;
|
|
429
|
+
if (seenLines.has(key)) return [];
|
|
430
|
+
seenLines.add(key);
|
|
431
|
+
return [
|
|
432
|
+
{
|
|
433
|
+
...match,
|
|
434
|
+
lineNumber: line.lineNumber,
|
|
435
|
+
endLineNumber: line.lineNumber,
|
|
436
|
+
startColumn: 0,
|
|
437
|
+
endColumn: line.content.length,
|
|
438
|
+
lineText: line.content,
|
|
439
|
+
matchedText: line.content,
|
|
440
|
+
},
|
|
441
|
+
];
|
|
442
|
+
});
|
|
372
443
|
});
|
|
373
444
|
}
|
|
374
445
|
|
|
@@ -376,6 +447,10 @@ function isMatch(value: TextSearchMatch | undefined): value is TextSearchMatch {
|
|
|
376
447
|
return value !== undefined;
|
|
377
448
|
}
|
|
378
449
|
|
|
450
|
+
function lastContainingLine(match: TextSearchMatch): number {
|
|
451
|
+
const end = match.endLineNumber ?? match.lineNumber;
|
|
452
|
+
return end > match.lineNumber && match.endColumn === 0 ? end - 1 : end;
|
|
453
|
+
}
|
|
379
454
|
function selectionRange(
|
|
380
455
|
document: ReturnType<typeof createTextDocument>,
|
|
381
456
|
match: TextSearchMatch,
|
|
@@ -384,21 +459,36 @@ function selectionRange(
|
|
|
384
459
|
if (mode === "match") {
|
|
385
460
|
return {
|
|
386
461
|
start: { lineNumber: match.lineNumber, column: match.startColumn },
|
|
387
|
-
end: { lineNumber: match.lineNumber, column: match.endColumn },
|
|
462
|
+
end: { lineNumber: match.endLineNumber ?? match.lineNumber, column: match.endColumn },
|
|
388
463
|
};
|
|
389
464
|
}
|
|
390
465
|
|
|
391
|
-
const
|
|
466
|
+
const lastLine = lastContainingLine(match);
|
|
467
|
+
const line = requiredValue(document.lines[lastLine - 1]);
|
|
392
468
|
return {
|
|
393
469
|
start: { lineNumber: match.lineNumber, column: 0 },
|
|
394
470
|
end: {
|
|
395
|
-
lineNumber:
|
|
471
|
+
lineNumber: lastLine + (line.lineEnding.length > 0 ? 1 : 0),
|
|
396
472
|
column: line.lineEnding.length > 0 ? 0 : line.content.length,
|
|
397
473
|
},
|
|
398
474
|
linewise: true,
|
|
399
475
|
};
|
|
400
476
|
}
|
|
401
477
|
|
|
478
|
+
function matchedSourceText(
|
|
479
|
+
document: ReturnType<typeof createTextDocument>,
|
|
480
|
+
match: TextSearchMatch,
|
|
481
|
+
): string {
|
|
482
|
+
const endLine = match.endLineNumber ?? match.lineNumber;
|
|
483
|
+
return document.lines
|
|
484
|
+
.slice(match.lineNumber - 1, endLine)
|
|
485
|
+
.map((line) => {
|
|
486
|
+
const start = line.lineNumber === match.lineNumber ? match.startColumn : 0;
|
|
487
|
+
const end = line.lineNumber === endLine ? match.endColumn : line.content.length;
|
|
488
|
+
return line.content.slice(start, end) + (line.lineNumber === endLine ? "" : line.lineEnding);
|
|
489
|
+
})
|
|
490
|
+
.join("");
|
|
491
|
+
}
|
|
402
492
|
async function snapshotContents(
|
|
403
493
|
matches: readonly TextSearchMatch[],
|
|
404
494
|
signal?: AbortSignal,
|
|
@@ -412,10 +502,7 @@ async function snapshotContents(
|
|
|
412
502
|
const document = createTextDocument(source, content);
|
|
413
503
|
for (const match of matches.filter((candidate) => candidate.source === source)) {
|
|
414
504
|
const line = document.lines[match.lineNumber - 1]?.content;
|
|
415
|
-
if (
|
|
416
|
-
line !== match.lineText ||
|
|
417
|
-
line.slice(match.startColumn, match.endColumn) !== match.matchedText
|
|
418
|
-
) {
|
|
505
|
+
if (line !== match.lineText || matchedSourceText(document, match) !== match.matchedText) {
|
|
419
506
|
throw new Error(`Search result in ${source} changed before its anchors were registered.`);
|
|
420
507
|
}
|
|
421
508
|
}
|
|
@@ -493,6 +580,7 @@ function compareMatches(left: TextSearchMatch, right: TextSearchMatch): number {
|
|
|
493
580
|
left.source.localeCompare(right.source) ||
|
|
494
581
|
left.lineNumber - right.lineNumber ||
|
|
495
582
|
left.startColumn - right.startColumn ||
|
|
583
|
+
(left.endLineNumber ?? left.lineNumber) - (right.endLineNumber ?? right.lineNumber) ||
|
|
496
584
|
left.endColumn - right.endColumn
|
|
497
585
|
);
|
|
498
586
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"imports": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"pi-agent-resource": "0.
|
|
16
|
+
"pi-agent-resource": "0.3.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"typebox": "*"
|
|
@@ -25,7 +25,7 @@ const textualAppMediaTypes = new Set([
|
|
|
25
25
|
export function createTextContentConverter(): ContentConverter {
|
|
26
26
|
return {
|
|
27
27
|
id: "text",
|
|
28
|
-
description: "
|
|
28
|
+
description: "Text file paths and URLs return their text.",
|
|
29
29
|
tryConvert(input, context) {
|
|
30
30
|
return Promise.resolve(convertText(input, context));
|
|
31
31
|
},
|
|
@@ -20,6 +20,8 @@ export interface TextLinePresentation {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface TextLine {
|
|
23
|
+
/** Complete edit selectors supplied by configured presenters, without display markup. */
|
|
24
|
+
readonly anchors?: readonly string[];
|
|
23
25
|
readonly lineNumber: number;
|
|
24
26
|
readonly content: string;
|
|
25
27
|
readonly lineEnding: string;
|
|
@@ -35,6 +37,9 @@ export interface TextDocument {
|
|
|
35
37
|
|
|
36
38
|
export interface TextPresentationContext {
|
|
37
39
|
readonly purpose: "read" | "edit-diff";
|
|
40
|
+
/** Script data enrichment differs from explicitly requested views. */
|
|
41
|
+
readonly audience?: "agent" | "script";
|
|
42
|
+
readonly requestedViews?: readonly string[];
|
|
38
43
|
readonly source: string;
|
|
39
44
|
readonly cwd: string;
|
|
40
45
|
readonly resolvedBy: string;
|
|
@@ -14,6 +14,8 @@ export interface TextSelectionRange {
|
|
|
14
14
|
|
|
15
15
|
/** A source and optional ranges selected by a typed text anchor. */
|
|
16
16
|
export interface TextTarget {
|
|
17
|
+
/** Reject an edit if this resolved selection no longer belongs to the same source text. */
|
|
18
|
+
readonly expectedContent?: string;
|
|
17
19
|
readonly source: string;
|
|
18
20
|
readonly ranges?: readonly TextSelectionRange[];
|
|
19
21
|
}
|
|
@@ -78,6 +80,8 @@ export function isTextTargetResolutionAttempt(
|
|
|
78
80
|
return (
|
|
79
81
|
typeof source === "string" &&
|
|
80
82
|
source.length > 0 &&
|
|
83
|
+
((target as Record<string, unknown>).expectedContent === undefined ||
|
|
84
|
+
typeof (target as Record<string, unknown>).expectedContent === "string") &&
|
|
81
85
|
(ranges === undefined || (Array.isArray(ranges) && ranges.every(isTextSelectionRange)))
|
|
82
86
|
);
|
|
83
87
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-constant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-text": "0.
|
|
10
|
-
"pi-agent-text-editor": "0.
|
|
9
|
+
"pi-agent-text": "0.3.0",
|
|
10
|
+
"pi-agent-text-editor": "0.3.0"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-exact",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"fast-fuzzy": "1.12.0",
|
|
16
|
-
"pi-agent-text": "0.
|
|
17
|
-
"pi-agent-text-editor": "0.
|
|
16
|
+
"pi-agent-text": "0.3.0",
|
|
17
|
+
"pi-agent-text-editor": "0.3.0"
|
|
18
18
|
},
|
|
19
19
|
"pi": {
|
|
20
20
|
"extensions": [
|
|
@@ -24,13 +24,9 @@ export default async function registerLineHashTextAnchor(pi: ExtensionAPI): Prom
|
|
|
24
24
|
apiVersion: READ_API_VERSION,
|
|
25
25
|
id: "text-anchor-line-hash",
|
|
26
26
|
setup(api) {
|
|
27
|
-
api.addView({ view: "anchors",
|
|
27
|
+
api.addView({ view: "anchors", presenter });
|
|
28
28
|
api.describe(
|
|
29
|
-
"
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
api.addPromptGuideline(
|
|
33
|
-
'You can use read with `views: ["anchors"]` to add `LINE#HASH` anchors for later edits.',
|
|
29
|
+
'views: ["anchors"] — LINE#HASH references for editing individual source lines.',
|
|
34
30
|
);
|
|
35
31
|
},
|
|
36
32
|
} satisfies ReadPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-line-hash",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-invariant": "0.
|
|
16
|
-
"pi-agent-read": "0.
|
|
17
|
-
"pi-agent-text": "0.
|
|
18
|
-
"pi-agent-text-editor": "0.
|
|
15
|
+
"pi-agent-invariant": "0.3.0",
|
|
16
|
+
"pi-agent-read": "0.3.0",
|
|
17
|
+
"pi-agent-text": "0.3.0",
|
|
18
|
+
"pi-agent-text-editor": "0.3.0"
|
|
19
19
|
},
|
|
20
20
|
"pi": {
|
|
21
21
|
"extensions": [
|
|
@@ -32,6 +32,7 @@ export function createLineHashPresenter(): TextLinePresenter {
|
|
|
32
32
|
|
|
33
33
|
return {
|
|
34
34
|
...line,
|
|
35
|
+
anchors: [...new Set([...(line.anchors ?? []), item.anchor.value])],
|
|
35
36
|
presentation: {
|
|
36
37
|
...line.presentation,
|
|
37
38
|
prefix: `${item.anchor.value.padStart(anchorWidth)}|${line.presentation?.prefix ?? ""}`,
|
|
@@ -9,9 +9,7 @@ export default async function registerTextEditor(pi: ExtensionAPI): Promise<void
|
|
|
9
9
|
const core = await registerTextEditorCore(pi);
|
|
10
10
|
registerBuiltinEditFilter(pi);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
registerTextEditorTools(pi, core);
|
|
14
|
-
}
|
|
12
|
+
registerTextEditorTools(pi, core);
|
|
15
13
|
|
|
16
14
|
registerTextEditBatching(pi, core);
|
|
17
15
|
}
|
|
@@ -1,87 +1,97 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
|
-
"#src/*": "./src/*"
|
|
7
|
-
"#overwrite/*": "./plugins/pi-agent-text-editor-overwrite/*"
|
|
6
|
+
"#src/*": "./src/*"
|
|
8
7
|
},
|
|
9
8
|
"exports": {
|
|
9
|
+
"./api/apply-renderer": {
|
|
10
|
+
"types": "./src/api/apply-renderer.ts",
|
|
11
|
+
"default": "./runtime/entry-54.js"
|
|
12
|
+
},
|
|
10
13
|
"./api/anchor-inspection": {
|
|
11
14
|
"types": "./src/api/anchor-inspection.ts",
|
|
12
|
-
"default": "./runtime/entry-
|
|
15
|
+
"default": "./runtime/entry-55.js"
|
|
13
16
|
},
|
|
14
17
|
"./api/connect-plugin": {
|
|
15
18
|
"types": "./src/api/connect-plugin.ts",
|
|
16
|
-
"default": "./runtime/entry-
|
|
19
|
+
"default": "./runtime/entry-56.js"
|
|
17
20
|
},
|
|
18
21
|
"./api/edit-completion": {
|
|
19
22
|
"types": "./src/api/edit-completion.ts",
|
|
20
|
-
"default": "./runtime/entry-
|
|
23
|
+
"default": "./runtime/entry-57.js"
|
|
21
24
|
},
|
|
22
25
|
"./api/edit-pipeline": {
|
|
23
26
|
"types": "./src/api/edit-pipeline.ts",
|
|
24
|
-
"default": "./runtime/entry-
|
|
27
|
+
"default": "./runtime/entry-58.js"
|
|
25
28
|
},
|
|
26
29
|
"./api/plugin-protocol": {
|
|
27
30
|
"types": "./src/api/plugin-protocol.ts",
|
|
28
|
-
"default": "./runtime/entry-
|
|
31
|
+
"default": "./runtime/entry-59.js"
|
|
29
32
|
},
|
|
30
33
|
"./api/stale-anchor-message": {
|
|
31
34
|
"types": "./src/api/stale-anchor-message.ts",
|
|
32
|
-
"default": "./runtime/entry-
|
|
35
|
+
"default": "./runtime/entry-60.js"
|
|
33
36
|
},
|
|
34
37
|
"./api/text-selection-anchor": {
|
|
35
38
|
"types": "./src/api/text-selection-anchor.ts",
|
|
36
|
-
"default": "./runtime/entry-
|
|
39
|
+
"default": "./runtime/entry-61.js"
|
|
37
40
|
},
|
|
38
41
|
"./api/post-edit": {
|
|
39
42
|
"types": "./src/api/post-edit.ts",
|
|
40
|
-
"default": "./runtime/entry-
|
|
43
|
+
"default": "./runtime/entry-62.js"
|
|
41
44
|
},
|
|
42
45
|
"./api/mutation-result": {
|
|
43
46
|
"types": "./src/api/mutation-result.ts",
|
|
44
|
-
"default": "./runtime/entry-
|
|
47
|
+
"default": "./runtime/entry-63.js"
|
|
45
48
|
},
|
|
46
49
|
"./api/mutation-guard": {
|
|
47
50
|
"types": "./src/api/mutation-guard.ts",
|
|
48
|
-
"default": "./runtime/entry-
|
|
51
|
+
"default": "./runtime/entry-64.js"
|
|
49
52
|
},
|
|
50
53
|
"./api/mutation-tool": {
|
|
51
54
|
"types": "./src/api/mutation-tool.ts",
|
|
52
|
-
"default": "./runtime/entry-
|
|
55
|
+
"default": "./runtime/entry-65.js"
|
|
53
56
|
},
|
|
54
57
|
"./api/mutation-preview": {
|
|
55
58
|
"types": "./src/api/mutation-preview.ts",
|
|
56
|
-
"default": "./runtime/entry-
|
|
59
|
+
"default": "./runtime/entry-66.js"
|
|
57
60
|
},
|
|
58
61
|
"./api/last-resolved-resource": {
|
|
59
62
|
"types": "./src/api/last-resolved-resource.ts",
|
|
60
|
-
"default": "./runtime/entry-
|
|
63
|
+
"default": "./runtime/entry-67.js"
|
|
61
64
|
},
|
|
62
65
|
"./api/tool-call-interceptor": {
|
|
63
66
|
"types": "./src/api/tool-call-interceptor.ts",
|
|
64
|
-
"default": "./runtime/entry-
|
|
67
|
+
"default": "./runtime/entry-68.js"
|
|
65
68
|
},
|
|
66
69
|
"./api/tool-renderer": {
|
|
67
70
|
"types": "./src/api/tool-renderer.ts",
|
|
68
|
-
"default": "./runtime/entry-
|
|
71
|
+
"default": "./runtime/entry-69.js"
|
|
69
72
|
}
|
|
70
73
|
},
|
|
71
74
|
"dependencies": {
|
|
72
75
|
"@codemirror/state": "^6.5.0",
|
|
76
|
+
"@lezer/common": "^1.5.2",
|
|
77
|
+
"@lezer/javascript": "^1.5.4",
|
|
73
78
|
"diff": "^9.0.0",
|
|
79
|
+
"fs-extra": "^11.4.0",
|
|
80
|
+
"oxfmt": "0.64.0",
|
|
74
81
|
"partial-json": "^0.1.7",
|
|
75
|
-
"pi-agent-invariant": "0.
|
|
76
|
-
"pi-agent-read": "0.
|
|
77
|
-
"pi-agent-resource": "0.
|
|
78
|
-
"pi-agent-
|
|
79
|
-
"pi-agent-
|
|
82
|
+
"pi-agent-invariant": "0.3.0",
|
|
83
|
+
"pi-agent-read": "0.3.0",
|
|
84
|
+
"pi-agent-resource": "0.3.0",
|
|
85
|
+
"pi-agent-search": "0.3.0",
|
|
86
|
+
"pi-agent-text": "0.3.0",
|
|
87
|
+
"pi-agent-tool-call-interception": "0.3.0",
|
|
88
|
+
"pi-agent-tool-ui": "0.3.0",
|
|
89
|
+
"run": "2.1.4",
|
|
80
90
|
"typebox-guard": "npm:typebox@^1.1.38"
|
|
81
91
|
},
|
|
82
92
|
"pi": {
|
|
83
93
|
"extensions": [
|
|
84
|
-
"./runtime/entry-
|
|
94
|
+
"./runtime/entry-70.js"
|
|
85
95
|
]
|
|
86
96
|
},
|
|
87
97
|
"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>;
|