pi-agent-ide 0.6.4 → 0.7.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 +38 -0
- package/README.md +2 -2
- package/dist/{chunk-AWXVJ5AC.js → chunk-2RTCSZB3.js} +1 -1
- package/dist/{chunk-QEJGED4V.js → chunk-3HYXQ4YA.js} +1 -1
- package/dist/chunk-3JO7QFIL.js +1 -0
- package/dist/{chunk-5J43L2RL.js → chunk-4NIFBFFR.js} +1 -1
- package/dist/{chunk-BSICWXMH.js → chunk-64M3SQPG.js} +1 -1
- package/dist/{chunk-3BBJZSMS.js → chunk-7LD2OQH3.js} +1 -1
- package/dist/chunk-7LZKOHH2.js +1 -0
- package/dist/chunk-AJRIASPQ.js +2 -0
- package/dist/chunk-EAZGN5ND.js +7 -0
- package/dist/{chunk-GIRAEVUJ.js → chunk-F5YZG77W.js} +1 -1
- package/dist/chunk-FK42RSF4.js +1 -0
- package/dist/{chunk-WJTHY6AG.js → chunk-FXNKMNSJ.js} +1 -1
- package/dist/chunk-GBLKIB6O.js +2 -0
- package/dist/{chunk-KUPHNMUK.js → chunk-KBP3QUDT.js} +1 -1
- package/dist/{chunk-VBICI5YA.js → chunk-KR36BT5E.js} +1 -1
- package/dist/chunk-OE7QVAI2.js +5 -0
- package/dist/chunk-PNU3E7IO.js +3 -0
- package/dist/chunk-PS2B6THP.js +3 -0
- package/dist/{chunk-HPUAIWIH.js → chunk-PYPPV2F5.js} +1 -1
- package/dist/{chunk-FUG2TEKI.js → chunk-QFTBY67N.js} +2 -2
- package/dist/chunk-S5LXX32D.js +28 -0
- package/dist/chunk-SQKAXYIR.js +2 -0
- package/dist/chunk-VCGNVTXQ.js +1 -0
- package/dist/chunk-XYS4FSCC.js +12 -0
- package/dist/{chunk-FBOW7XOV.js → chunk-YRF7OATP.js} +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +1 -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 +13 -11
- package/dist/entry-33.js +1 -1
- package/dist/entry-37.js +6 -6
- package/dist/entry-42.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +13 -13
- package/dist/entry-46.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +3 -6
- package/dist/entry-51.js +11 -9
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +0 -1
- package/dist/entry-62.js +1 -0
- package/dist/entry-63.js +0 -1
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -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 +1 -1
- package/dist/entry-71.js +0 -1
- package/dist/entry-72.js +1 -0
- package/dist/entry-73.js +0 -1
- package/dist/entry-74.js +1 -0
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +67 -1
- package/dist/entry-78.js +14 -325
- package/dist/entry-79.js +2 -18
- package/dist/entry-80.js +1 -2
- package/dist/entry-81.js +1 -1
- package/dist/entry-82.js +5 -1
- package/dist/entry-83.js +3 -5
- package/dist/entry-84.js +1 -3
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/pi-agent-ide.js +5 -5
- package/docs/agent-guides/editing.md +20 -4
- package/docs/agent-guides/git-changes.md +1 -1
- package/docs/agent-guides/read-resources.md +9 -1
- package/docs/agent-guides/search-code.md +38 -1
- package/docs/agent-guides/select-code.md +194 -0
- package/docs/configuration.md +12 -17
- package/docs/development.md +2 -1
- package/docs/releases.md +1 -1
- package/docs/research/apply-native-capability-matrix.md +174 -0
- package/docs/research/apply-read-latency.md +2 -0
- package/docs/research/lpt-393-fuzzy-results/file.json +152 -0
- package/docs/research/lpt-393-fuzzy-results/repo.json +122 -0
- package/docs/research/lpt-393-search-fuzzy-fallback.md +97 -0
- package/docs/research/native-codemode-batch-decision.md +2 -0
- package/docs/research/native-codemode-batching.md +1 -1
- package/docs/structured-results.md +32 -5
- package/docs/tools.md +6 -2
- package/docs/user-hooks.md +1 -1
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- 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 +15 -10
- package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +193 -0
- package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +59 -0
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +5 -1
- package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +204 -0
- package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +2 -0
- package/node_modules/pi-agent-ide-ast/src/extension.ts +4 -2
- package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +184 -0
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +107 -21
- package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +104 -0
- package/node_modules/pi-agent-ide-ast/src/select-schema.ts +384 -0
- package/node_modules/pi-agent-ide-ast/src/selection-region.ts +41 -0
- package/node_modules/pi-agent-ide-ast/src/source-text.ts +92 -0
- package/node_modules/pi-agent-ide-ast/src/text-selection.ts +214 -0
- package/node_modules/pi-agent-ide-ast/src/tool-select.ts +251 -0
- package/node_modules/pi-agent-ide-changes/index.ts +2 -18
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +2 -2
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/index.ts +2 -2
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +5 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +8 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +19 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +204 -118
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +2 -17
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +88 -45
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +2 -2
- package/node_modules/pi-agent-read/src/api/tools/read.ts +4 -0
- package/node_modules/pi-agent-read/src/core/extension.ts +11 -0
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +93 -0
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +2 -0
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +8 -1
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +10 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +233 -0
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +208 -0
- package/node_modules/pi-agent-search/src/api/presentation.ts +68 -0
- package/node_modules/pi-agent-search/src/api/search-parameters.ts +9 -3
- package/node_modules/pi-agent-search/src/api/search-scope.ts +22 -0
- package/node_modules/pi-agent-search/src/api/search.ts +28 -0
- package/node_modules/pi-agent-search/src/api/structured-result.ts +69 -14
- package/node_modules/pi-agent-search/src/core/extension.ts +56 -16
- package/node_modules/pi-agent-search/src/core/search-core.ts +9 -1
- package/node_modules/pi-agent-search-text/index.ts +3 -1
- package/node_modules/pi-agent-search-text/package.json +7 -6
- package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +164 -0
- package/node_modules/pi-agent-search-text/src/resolvers.ts +161 -30
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +103 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +104 -17
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +89 -292
- package/node_modules/pi-agent-search-text/src/search-result.ts +77 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +96 -11
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/index.ts +0 -5
- package/node_modules/pi-agent-text-editor/package.json +26 -31
- package/node_modules/pi-agent-text-editor/runtime/entry-77.js +1 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +4 -23
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +12 -2
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +29 -4
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +76 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +168 -0
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +199 -19
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +22 -0
- package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +78 -0
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +175 -0
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +109 -11
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +6 -1
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +0 -75
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +211 -223
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +9 -6
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -7
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +8 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +8 -3
- package/node_modules/pi-agent-text-editor-renderer/index.ts +1 -72
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +19 -5
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
- 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-80.js +1 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/src/index.ts +7 -0
- package/node_modules/pi-agent-tool-ui/src/result-panel.ts +298 -0
- package/node_modules/pi-agent-web/index.ts +3 -0
- package/node_modules/pi-agent-web/package.json +8 -8
- package/node_modules/pi-agent-web/runtime/entry-82.js +2 -0
- package/node_modules/pi-agent-web/src/search.ts +111 -2
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/package.json +35 -36
- package/src/composite/module-labels.ts +1 -1
- package/src/composite/preferences.ts +0 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- 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-jq/package.json +5 -5
- 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 +3 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
- 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-83.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +111 -2
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +2 -2
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +4 -0
- package/src/extensions/pi-agent-read/src/core/extension.ts +11 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +93 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +2 -0
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +8 -1
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +3 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +164 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +161 -30
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +103 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +104 -17
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +89 -292
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +77 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +96 -11
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +208 -0
- package/src/extensions/pi-agent-search/src/api/presentation.ts +68 -0
- package/src/extensions/pi-agent-search/src/api/search-parameters.ts +9 -3
- package/src/extensions/pi-agent-search/src/api/search-scope.ts +22 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +28 -0
- package/src/extensions/pi-agent-search/src/api/structured-result.ts +69 -14
- package/src/extensions/pi-agent-search/src/core/extension.ts +56 -16
- package/src/extensions/pi-agent-search/src/core/search-core.ts +9 -1
- package/src/extensions/pi-agent-text-editor/index.ts +0 -5
- package/src/extensions/pi-agent-text-editor/package.json +26 -31
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +1 -72
- 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/runtime/entry-78.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +19 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
- 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-77.js +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +4 -23
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +12 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +29 -4
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +76 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +168 -0
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +199 -19
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +22 -0
- package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +78 -0
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +175 -0
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +109 -11
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +6 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +0 -75
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +211 -223
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +9 -6
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -7
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +8 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +8 -3
- package/src/pi-agent-ide.ts +0 -6
- package/src/plugins/pi-agent-ide-ast/package.json +15 -10
- package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +193 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +59 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +5 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +204 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +2 -0
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +4 -2
- package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +184 -0
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +107 -21
- package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +104 -0
- package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +384 -0
- package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +41 -0
- package/src/plugins/pi-agent-ide-ast/src/source-text.ts +92 -0
- package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +214 -0
- package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +251 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +2 -18
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +2 -2
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/index.ts +2 -2
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +5 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +8 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +19 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +204 -118
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +2 -17
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +88 -45
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +10 -36
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -1
- package/src/plugins/pi-agent-ide-vision/index.ts +19 -0
- package/dist/chunk-2P2OGO3G.js +0 -2
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/chunk-7AVXUV4A.js +0 -7
- package/dist/chunk-7WCZOO5I.js +0 -1
- package/dist/chunk-BAYETTZZ.js +0 -16
- package/dist/chunk-BVK5A7ED.js +0 -28
- package/dist/chunk-F7NVAC4Q.js +0 -0
- package/dist/chunk-FZBCKIJJ.js +0 -1
- package/dist/chunk-I5JLCFUX.js +0 -1
- package/dist/chunk-MIZAFRDR.js +0 -1
- package/dist/chunk-PJPA5EEE.js +0 -2
- package/dist/chunk-PXWDDBBC.js +0 -0
- package/dist/chunk-TQZBVOTT.js +0 -5
- package/dist/chunk-VWW3RLUX.js +0 -12
- package/dist/chunk-YHUTTZC6.js +0 -2
- package/dist/chunk-ZODCBFBL.js +0 -2
- package/dist/entry-87.js +0 -1
- package/docs/agent-guides/apply.md +0 -333
- package/node_modules/pi-agent-text-editor/src/api/apply-renderer.ts +0 -3
- package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +0 -159
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +0 -405
- package/node_modules/pi-agent-text-editor/src/core/apply/final-mutations.ts +0 -50
- package/node_modules/pi-agent-text-editor/src/core/apply/format-source.ts +0 -11
- package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +0 -203
- package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +0 -55
- package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +0 -276
- package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +0 -13
- package/node_modules/pi-agent-text-editor/src/core/apply/queue.ts +0 -25
- package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +0 -405
- package/node_modules/pi-agent-text-editor/src/core/apply/results.ts +0 -137
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
- package/node_modules/pi-agent-text-editor/src/core/apply/structured-result.ts +0 -251
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +0 -168
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +0 -942
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-82.js +0 -1
- package/node_modules/pi-agent-web-text/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-87.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-83.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-80.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +0 -2
- package/src/extensions/pi-agent-text-editor/src/api/apply-renderer.ts +0 -3
- package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +0 -159
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +0 -405
- package/src/extensions/pi-agent-text-editor/src/core/apply/final-mutations.ts +0 -50
- package/src/extensions/pi-agent-text-editor/src/core/apply/format-source.ts +0 -11
- package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +0 -203
- package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +0 -55
- package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +0 -276
- package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +0 -13
- package/src/extensions/pi-agent-text-editor/src/core/apply/queue.ts +0 -25
- package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +0 -405
- package/src/extensions/pi-agent-text-editor/src/core/apply/results.ts +0 -137
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
- package/src/extensions/pi-agent-text-editor/src/core/apply/structured-result.ts +0 -251
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +0 -168
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +0 -942
- /package/node_modules/{pi-agent-text-editor → pi-agent-text-editor-renderer}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-79.js +0 -0
- /package/node_modules/{pi-agent-tool-call-interception → pi-agent-tool-ui}/runtime/entry-81.js +0 -0
- /package/node_modules/{pi-agent-web → pi-agent-web-html}/runtime/entry-83.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-html → pi-agent-web-image}/runtime/entry-84.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-pdf}/runtime/entry-85.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-text}/runtime/entry-86.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-stale-anchor}/runtime/entry-79.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type, type Static } from "typebox";
|
|
2
2
|
import { Value } from "typebox/value";
|
|
3
3
|
import {
|
|
4
|
+
MAX_STRUCTURED_BYTES,
|
|
4
5
|
resultError,
|
|
5
6
|
resultErrorSchema,
|
|
6
7
|
structuredResultSchema,
|
|
@@ -19,7 +20,14 @@ const effect = Type.Union([
|
|
|
19
20
|
Type.Literal("unknown"),
|
|
20
21
|
]);
|
|
21
22
|
const file = Type.Object(
|
|
22
|
-
{
|
|
23
|
+
{
|
|
24
|
+
source: Type.String(),
|
|
25
|
+
effect,
|
|
26
|
+
action: Type.Optional(Type.String()),
|
|
27
|
+
state: Type.Optional(
|
|
28
|
+
Type.Union([Type.Literal("present"), Type.Literal("absent"), Type.Literal("unknown")]),
|
|
29
|
+
),
|
|
30
|
+
},
|
|
23
31
|
{ additionalProperties: false },
|
|
24
32
|
);
|
|
25
33
|
const operation = Type.Object(
|
|
@@ -46,11 +54,46 @@ export const mutationDataSchema = Type.Object(
|
|
|
46
54
|
operation: Type.String(),
|
|
47
55
|
effect,
|
|
48
56
|
operationId: Type.Optional(Type.String()),
|
|
57
|
+
target: Type.Optional(
|
|
58
|
+
Type.String({
|
|
59
|
+
description:
|
|
60
|
+
"Backend-owned resulting-text scope: replace/insert text, write's whole file, copy/move destinations, or undo's whole restored files. Delete never supplies a live target. Pending handles require a confirmed commit.",
|
|
61
|
+
}),
|
|
62
|
+
),
|
|
63
|
+
targetUnavailable: Type.Optional(
|
|
64
|
+
Type.String({
|
|
65
|
+
description:
|
|
66
|
+
"Why a completed mutation could not provide a safe resulting-text target. The write effect is reported separately.",
|
|
67
|
+
}),
|
|
68
|
+
),
|
|
49
69
|
files: Type.Array(file),
|
|
70
|
+
changes: Type.Optional(
|
|
71
|
+
Type.Array(
|
|
72
|
+
Type.Object(
|
|
73
|
+
{
|
|
74
|
+
source: Type.String(),
|
|
75
|
+
from: Type.Integer({
|
|
76
|
+
description:
|
|
77
|
+
"Inclusive zero-based UTF-16 offset in the pre-edit snapshot; not a live selector.",
|
|
78
|
+
}),
|
|
79
|
+
to: Type.Integer({
|
|
80
|
+
description:
|
|
81
|
+
"Exclusive zero-based UTF-16 offset in the pre-edit snapshot; not a live selector.",
|
|
82
|
+
}),
|
|
83
|
+
removedText: Type.String(),
|
|
84
|
+
insertedText: Type.String(),
|
|
85
|
+
},
|
|
86
|
+
{ additionalProperties: false },
|
|
87
|
+
),
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
changesUnavailable: Type.Optional(
|
|
91
|
+
Type.String({
|
|
92
|
+
description: "Why the exact change record is omitted; applied effects remain reported.",
|
|
93
|
+
}),
|
|
94
|
+
),
|
|
50
95
|
operations: Type.Optional(Type.Array(operation)),
|
|
51
96
|
parentToolCallId: Type.Optional(Type.String()),
|
|
52
|
-
transaction: Type.Optional(Type.String()),
|
|
53
|
-
transactions: Type.Optional(Type.Array(Type.String())),
|
|
54
97
|
recovery: Type.Optional(
|
|
55
98
|
Type.Array(
|
|
56
99
|
Type.Object({
|
|
@@ -137,6 +180,9 @@ export function mutationOutcome(
|
|
|
137
180
|
data: {
|
|
138
181
|
operation,
|
|
139
182
|
effect: "pending",
|
|
183
|
+
...(typeof details.metadata?.resultTarget === "string"
|
|
184
|
+
? { target: details.metadata.resultTarget }
|
|
185
|
+
: {}),
|
|
140
186
|
files:
|
|
141
187
|
typeof detailRecord.source === "string"
|
|
142
188
|
? [{ source: detailRecord.source, effect: "pending" }]
|
|
@@ -161,6 +207,7 @@ export function mutationOutcome(
|
|
|
161
207
|
for (const source of sources)
|
|
162
208
|
files.push({
|
|
163
209
|
source,
|
|
210
|
+
...(observed.has(source) ? { state: "present" as const } : {}),
|
|
164
211
|
effect:
|
|
165
212
|
observed.has(source) ||
|
|
166
213
|
(data.ok === true && data.files?.some((file) => file.path === source))
|
|
@@ -181,7 +228,8 @@ export function mutationOutcome(
|
|
|
181
228
|
});
|
|
182
229
|
}
|
|
183
230
|
for (const source of observed)
|
|
184
|
-
if (!files.some((file) => file.source === source))
|
|
231
|
+
if (!files.some((file) => file.source === source))
|
|
232
|
+
files.push({ source, effect: "applied", state: "present" });
|
|
185
233
|
const semantic =
|
|
186
234
|
record(details.metadata) && record(details.metadata.semanticAction)
|
|
187
235
|
? details.metadata.semanticAction
|
|
@@ -194,19 +242,30 @@ export function mutationOutcome(
|
|
|
194
242
|
? "unknown"
|
|
195
243
|
: "applied";
|
|
196
244
|
const source = typeof semantic.source === "string" ? semantic.source : undefined;
|
|
197
|
-
if (source
|
|
245
|
+
if (source)
|
|
198
246
|
files.push({
|
|
199
247
|
source,
|
|
248
|
+
...(semantic.kind === "file-operation" && semantic.ok === true
|
|
249
|
+
? {
|
|
250
|
+
state:
|
|
251
|
+
operation === "delete" || operation === "move"
|
|
252
|
+
? ("absent" as const)
|
|
253
|
+
: ("present" as const),
|
|
254
|
+
}
|
|
255
|
+
: {}),
|
|
200
256
|
effect:
|
|
201
257
|
operation === "copy" && typeof semantic.target === "string" && semantic.target !== source
|
|
202
258
|
? "not-applied"
|
|
203
259
|
: semanticEffect,
|
|
204
260
|
});
|
|
205
|
-
if (Array.isArray(semantic.restored))
|
|
206
|
-
for (const source of semantic.restored)
|
|
207
|
-
if (typeof source === "string") files.push({ source, effect: semanticEffect });
|
|
208
261
|
if (typeof semantic.target === "string")
|
|
209
|
-
files.push({
|
|
262
|
+
files.push({
|
|
263
|
+
source: semantic.target,
|
|
264
|
+
effect: semanticEffect,
|
|
265
|
+
...(semantic.kind === "file-operation" && semantic.ok === true
|
|
266
|
+
? { state: "present" as const }
|
|
267
|
+
: {}),
|
|
268
|
+
});
|
|
210
269
|
if (record(semantic.error))
|
|
211
270
|
errors.push(
|
|
212
271
|
resultError(
|
|
@@ -221,10 +280,36 @@ export function mutationOutcome(
|
|
|
221
280
|
errors.push(resultError("Resource operation failed", "MUTATION_FAILED", source));
|
|
222
281
|
}
|
|
223
282
|
const unique = [...new Map(files.map((file) => [file.source, file])).values()];
|
|
283
|
+
if (Array.isArray(details.metadata?.resultFileStates))
|
|
284
|
+
for (const state of details.metadata.resultFileStates) {
|
|
285
|
+
if (!record(state)) continue;
|
|
286
|
+
const file = unique.find((file) => file.source === state.source);
|
|
287
|
+
if (file && (state.state === "present" || state.state === "absent")) file.state = state.state;
|
|
288
|
+
}
|
|
289
|
+
const changes = (results ?? [])
|
|
290
|
+
.filter((item) => item.data.ok)
|
|
291
|
+
.flatMap((item) => {
|
|
292
|
+
const source = item.data.path;
|
|
293
|
+
if (source === undefined) return [];
|
|
294
|
+
return (item.data.rawChanges ?? []).map((change) => ({
|
|
295
|
+
source,
|
|
296
|
+
from: change.fromA,
|
|
297
|
+
to: change.toA,
|
|
298
|
+
removedText: change.removedText,
|
|
299
|
+
insertedText: change.insertedText,
|
|
300
|
+
}));
|
|
301
|
+
});
|
|
302
|
+
const changesFit = Buffer.byteLength(JSON.stringify(changes)) <= MAX_STRUCTURED_BYTES / 2;
|
|
224
303
|
const known = unique.some((file) => file.effect === "applied");
|
|
225
304
|
if (result.isError && errors.length === 0)
|
|
226
305
|
errors.push({ code: "MUTATION_FAILED", message: "Mutation failed" });
|
|
227
|
-
if (
|
|
306
|
+
if (
|
|
307
|
+
(results?.length ?? 0) === 0 &&
|
|
308
|
+
!semantic &&
|
|
309
|
+
observed.size === 0 &&
|
|
310
|
+
errors.length === 0 &&
|
|
311
|
+
details.effect !== "not-applied"
|
|
312
|
+
)
|
|
228
313
|
errors.push({ code: "UNKNOWN_RESULT", message: "Mutation effects were not reported" });
|
|
229
314
|
const effect =
|
|
230
315
|
unique.some((file) => file.effect === "unknown") ||
|
|
@@ -284,6 +369,20 @@ export function mutationOutcome(
|
|
|
284
369
|
operation,
|
|
285
370
|
effect,
|
|
286
371
|
files: unique,
|
|
372
|
+
...(changes.length === 0
|
|
373
|
+
? {}
|
|
374
|
+
: changesFit
|
|
375
|
+
? { changes }
|
|
376
|
+
: {
|
|
377
|
+
changesUnavailable:
|
|
378
|
+
"Exact change record exceeds the 512 KiB receipt budget; it was not clipped.",
|
|
379
|
+
}),
|
|
380
|
+
...(typeof details.metadata?.resultTarget === "string"
|
|
381
|
+
? { target: details.metadata.resultTarget }
|
|
382
|
+
: {}),
|
|
383
|
+
...(typeof details.metadata?.targetUnavailable === "string"
|
|
384
|
+
? { targetUnavailable: details.metadata.targetUnavailable }
|
|
385
|
+
: {}),
|
|
287
386
|
...(details.anchorRecoveries === undefined
|
|
288
387
|
? {}
|
|
289
388
|
: {
|
|
@@ -295,7 +394,6 @@ export function mutationOutcome(
|
|
|
295
394
|
candidates: [...item.candidates],
|
|
296
395
|
})),
|
|
297
396
|
}),
|
|
298
|
-
...(typeof semantic?.transaction === "string" ? { transaction: semantic.transaction } : {}),
|
|
299
397
|
...(checkedAction ? { action: checkedAction } : {}),
|
|
300
398
|
},
|
|
301
399
|
errors,
|
|
@@ -418,7 +418,12 @@ export async function executeRegisteredTextBatch(
|
|
|
418
418
|
return [];
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
|
|
421
|
+
// The core already validated the write; a created empty resource has no text delta.
|
|
422
|
+
const ownAfter = applyTextChanges(
|
|
423
|
+
resource.before.content,
|
|
424
|
+
edit.changes,
|
|
425
|
+
resource.before.content.length === 0,
|
|
426
|
+
).content;
|
|
422
427
|
return [
|
|
423
428
|
buildSuccessfulTextMutationResult(
|
|
424
429
|
resource,
|
|
@@ -46,7 +46,6 @@ import {
|
|
|
46
46
|
isTextAnchorResolverRegistration,
|
|
47
47
|
isTextEditorToolId,
|
|
48
48
|
type PromptDescriptionSource,
|
|
49
|
-
type ScriptIndexOperation,
|
|
50
49
|
type ResourceResolverRegistration,
|
|
51
50
|
TEXT_EDITOR_API_VERSION,
|
|
52
51
|
TEXT_EDITOR_PROTOCOL,
|
|
@@ -78,11 +77,6 @@ import {
|
|
|
78
77
|
} from "#src/core/text-change-engine.js";
|
|
79
78
|
import { previewTextMutation } from "#src/core/text-mutation.js";
|
|
80
79
|
import { loadTextEditorConfig, recoverySection } from "#src/core/text-editor-config.js";
|
|
81
|
-
import {
|
|
82
|
-
ApplyUndoStore,
|
|
83
|
-
type ApplyUndoBeforeState,
|
|
84
|
-
type ApplyUndoResult,
|
|
85
|
-
} from "#src/core/apply/apply-undo-store.js";
|
|
86
80
|
|
|
87
81
|
import type {
|
|
88
82
|
TextAnchorInspectionOutcome,
|
|
@@ -222,7 +216,6 @@ interface PluginContributionDraft {
|
|
|
222
216
|
readonly editCompletionListeners?: TextEditCompletionListener[];
|
|
223
217
|
readonly mutationGuards?: TextMutationGuardRegistration[];
|
|
224
218
|
readonly toolRenderers?: TextEditorToolRendererRegistration[];
|
|
225
|
-
readonly scriptIndexOperations?: ScriptIndexOperation[];
|
|
226
219
|
}
|
|
227
220
|
|
|
228
221
|
interface PluginContributionController {
|
|
@@ -336,12 +329,6 @@ export interface TextResourcesEditContext
|
|
|
336
329
|
extends ResourceResolverContext, TextMutationGuardContext {}
|
|
337
330
|
|
|
338
331
|
export interface TextEditorCore {
|
|
339
|
-
/** Record the complete pre-Apply state and return a session-scoped undo receipt. */
|
|
340
|
-
recordApplyUndo(before: readonly ApplyUndoBeforeState[]): Promise<string>;
|
|
341
|
-
/** Atomically restore one Apply receipt. */
|
|
342
|
-
restoreApplyUndo(transaction: string, signal?: AbortSignal): Promise<ApplyUndoResult>;
|
|
343
|
-
/** Return whether an Apply receipt is still active in this session. */
|
|
344
|
-
hasApplyUndo(transaction: string): boolean;
|
|
345
332
|
/** Finalize a surviving local text file after a whole-file operation; binary files are untouched. */
|
|
346
333
|
postProcessFile(source: string, context: ResourceResolverContext): Promise<void>;
|
|
347
334
|
/** Reserve complete file sets. Only an explicit transaction owner may enqueue covered nested edits. */
|
|
@@ -402,8 +389,6 @@ export interface TextEditorCore {
|
|
|
402
389
|
onMutationTool(listener: TextMutationToolListener): () => void;
|
|
403
390
|
onDidEdit(listener: TextEditCompletionListener): () => void;
|
|
404
391
|
getToolRenderer(tool: TextEditorToolId): TextEditorToolRendererRegistration | undefined;
|
|
405
|
-
/** Return a configured index operation for the Apply host. */
|
|
406
|
-
getScriptIndexOperation(name: string): ScriptIndexOperation | undefined;
|
|
407
392
|
registerPlugin(plugin: TextEditorPlugin): Promise<void>;
|
|
408
393
|
registerPostEditHandler(registration: TextPostEditHandlerRegistration): () => void;
|
|
409
394
|
registerTool(tool: TextEditorToolId): void;
|
|
@@ -435,18 +420,8 @@ export function createTextEditorCore(
|
|
|
435
420
|
const mutationTools = new Map<string, AnyTextMutationToolRegistration>();
|
|
436
421
|
const mutationListeners = new Set<TextMutationToolListener>();
|
|
437
422
|
const editCompletionListeners = new Set<TextEditCompletionListener>();
|
|
438
|
-
const applyUndoStore = new ApplyUndoStore();
|
|
439
|
-
editCompletionListeners.add((completion) => {
|
|
440
|
-
applyUndoStore.observeTextChange(
|
|
441
|
-
path.resolve(completion.cwd, completion.resourceSource),
|
|
442
|
-
completion.before.content,
|
|
443
|
-
completion.after.content,
|
|
444
|
-
completion.postProcessing ?? "complete",
|
|
445
|
-
);
|
|
446
|
-
});
|
|
447
423
|
const mutationGuards: TextMutationGuardRegistration[] = [];
|
|
448
424
|
const toolRenderers = new Map<TextEditorToolId, TextEditorToolRendererRegistration>();
|
|
449
|
-
const scriptIndexOperations = new Map<string, ScriptIndexOperation>();
|
|
450
425
|
let registrationQueue = Promise.resolve();
|
|
451
426
|
const scheduler = resourceScheduler;
|
|
452
427
|
const enqueueMutation = <T>(
|
|
@@ -465,17 +440,6 @@ export function createTextEditorCore(
|
|
|
465
440
|
);
|
|
466
441
|
|
|
467
442
|
const incomingMutationNames = new Set<string>();
|
|
468
|
-
const incomingIndexNames = new Set<string>();
|
|
469
|
-
for (const operation of draft.scriptIndexOperations ?? []) {
|
|
470
|
-
if (
|
|
471
|
-
!["stage", "unstage"].includes(operation.name) ||
|
|
472
|
-
typeof operation.execute !== "function" ||
|
|
473
|
-
scriptIndexOperations.has(operation.name) ||
|
|
474
|
-
incomingIndexNames.has(operation.name)
|
|
475
|
-
)
|
|
476
|
-
throw new Error(`Invalid or duplicate script index operation ${operation.name}`);
|
|
477
|
-
incomingIndexNames.add(operation.name);
|
|
478
|
-
}
|
|
479
443
|
|
|
480
444
|
for (const registration of draft.mutationTools ?? []) {
|
|
481
445
|
assertTextMutationToolRegistration(registration);
|
|
@@ -529,8 +493,6 @@ export function createTextEditorCore(
|
|
|
529
493
|
|
|
530
494
|
handlers.push(...draft.handlers);
|
|
531
495
|
semanticHandlers.push(...(draft.semanticHandlers ?? []));
|
|
532
|
-
for (const operation of draft.scriptIndexOperations ?? [])
|
|
533
|
-
scriptIndexOperations.set(operation.name, operation);
|
|
534
496
|
mutationGuards.push(...(draft.mutationGuards ?? []));
|
|
535
497
|
promptContributions.push(...draft.promptContributions);
|
|
536
498
|
writablePromptContributions.push(...draft.writablePromptContributions);
|
|
@@ -566,20 +528,6 @@ export function createTextEditorCore(
|
|
|
566
528
|
};
|
|
567
529
|
|
|
568
530
|
const core: TextEditorCore = {
|
|
569
|
-
recordApplyUndo(before) {
|
|
570
|
-
return applyUndoStore.record(before);
|
|
571
|
-
},
|
|
572
|
-
restoreApplyUndo(transaction, signal) {
|
|
573
|
-
const accesses = Promise.all(
|
|
574
|
-
applyUndoStore
|
|
575
|
-
.sources(transaction)
|
|
576
|
-
.map((source) => resourceAccesses(source, process.cwd(), "write")),
|
|
577
|
-
).then((sets) => sets.flat());
|
|
578
|
-
return enqueueMutation(() => applyUndoStore.restore(transaction), signal, accesses);
|
|
579
|
-
},
|
|
580
|
-
hasApplyUndo(transaction) {
|
|
581
|
-
return applyUndoStore.has(transaction);
|
|
582
|
-
},
|
|
583
531
|
async postProcessFile(source, context) {
|
|
584
532
|
await enqueueMutation(
|
|
585
533
|
async () => {
|
|
@@ -653,9 +601,6 @@ export function createTextEditorCore(
|
|
|
653
601
|
editCompletionListeners.add(listener);
|
|
654
602
|
return () => editCompletionListeners.delete(listener);
|
|
655
603
|
},
|
|
656
|
-
getScriptIndexOperation(name) {
|
|
657
|
-
return scriptIndexOperations.get(name);
|
|
658
|
-
},
|
|
659
604
|
getSemanticMutationHandler(tool, input): TextSemanticMutationHandler | undefined {
|
|
660
605
|
const matches = semanticHandlers.filter(
|
|
661
606
|
(registered) => registered.tool === tool && registered.handler.matches(input),
|
|
@@ -883,7 +828,6 @@ export function createTextEditorCore(
|
|
|
883
828
|
(listener) => core.onDidEdit(listener),
|
|
884
829
|
(request) => previewTextMutation(core, request),
|
|
885
830
|
(section) => recoverySection(projectConfig, section),
|
|
886
|
-
(transaction, signal) => core.restoreApplyUndo(transaction, signal),
|
|
887
831
|
);
|
|
888
832
|
const ready = registrationQueue.then(async () => {
|
|
889
833
|
try {
|
|
@@ -1993,7 +1937,6 @@ function createPluginContributionController(
|
|
|
1993
1937
|
onDidEdit: (listener: TextEditCompletionListener) => () => void,
|
|
1994
1938
|
previewMutation: (request: TextMutationPreviewRequest) => Promise<TextMutationPreviewOutcome>,
|
|
1995
1939
|
recoveryConfig: (section: string) => TextEditorRecoveryConfigSection,
|
|
1996
|
-
restoreApplyUndo: TextEditorPluginApi["restoreApplyUndo"],
|
|
1997
1940
|
): PluginContributionController {
|
|
1998
1941
|
const setupDraft: PluginContributionDraft = {
|
|
1999
1942
|
resolvers: [],
|
|
@@ -2009,7 +1952,6 @@ function createPluginContributionController(
|
|
|
2009
1952
|
editCompletionListeners: [],
|
|
2010
1953
|
mutationGuards: [],
|
|
2011
1954
|
toolRenderers: [],
|
|
2012
|
-
scriptIndexOperations: [],
|
|
2013
1955
|
};
|
|
2014
1956
|
let state: "active" | "closed" | "setup" = "setup";
|
|
2015
1957
|
const assertAvailable = (): void => {
|
|
@@ -2091,7 +2033,6 @@ function createPluginContributionController(
|
|
|
2091
2033
|
},
|
|
2092
2034
|
});
|
|
2093
2035
|
const api: TextEditorPluginApi = {
|
|
2094
|
-
restoreApplyUndo,
|
|
2095
2036
|
addMutationTool(registration): void {
|
|
2096
2037
|
assertAvailable();
|
|
2097
2038
|
assertTextMutationToolRegistration(registration);
|
|
@@ -2111,22 +2052,6 @@ function createPluginContributionController(
|
|
|
2111
2052
|
mutationTools: [registration],
|
|
2112
2053
|
});
|
|
2113
2054
|
},
|
|
2114
|
-
addScriptIndexOperation(operation): void {
|
|
2115
|
-
assertAvailable();
|
|
2116
|
-
if (state === "setup") {
|
|
2117
|
-
requiredValue(setupDraft.scriptIndexOperations).push(operation);
|
|
2118
|
-
return;
|
|
2119
|
-
}
|
|
2120
|
-
registerContributions({
|
|
2121
|
-
resolvers: [],
|
|
2122
|
-
anchorResolvers: [],
|
|
2123
|
-
handlers: [],
|
|
2124
|
-
promptContributions: [],
|
|
2125
|
-
writablePromptContributions: [],
|
|
2126
|
-
tools: [],
|
|
2127
|
-
scriptIndexOperations: [operation],
|
|
2128
|
-
});
|
|
2129
|
-
},
|
|
2130
2055
|
addToolRenderer(registration): void {
|
|
2131
2056
|
assertAvailable();
|
|
2132
2057
|
|