pi-agent-ide 0.6.3 → 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 +97 -0
- package/README.md +10 -3
- package/dist/{chunk-AWXVJ5AC.js → chunk-2RTCSZB3.js} +1 -1
- package/dist/chunk-3HYXQ4YA.js +28 -0
- package/dist/chunk-3JO7QFIL.js +1 -0
- package/dist/chunk-4NIFBFFR.js +11 -0
- package/dist/{chunk-VCTK4JSN.js → chunk-64M3SQPG.js} +1 -1
- package/dist/{chunk-5QQABP47.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-ZM4L5AGN.js → chunk-EDURPQAV.js} +3 -2
- package/dist/{chunk-GIRAEVUJ.js → chunk-F5YZG77W.js} +1 -1
- package/dist/chunk-FK42RSF4.js +1 -0
- package/dist/{chunk-O6LE42GK.js → chunk-FXNKMNSJ.js} +1 -1
- package/dist/chunk-GBLKIB6O.js +2 -0
- package/dist/chunk-KBP3QUDT.js +2 -0
- package/dist/chunk-KR36BT5E.js +1 -0
- package/dist/{chunk-NTYXZ3EL.js → chunk-KVHDMIZS.js} +1 -1
- package/dist/{chunk-QDST6VIU.js → chunk-KZC7TI5M.js} +1 -1
- package/dist/chunk-OE7QVAI2.js +5 -0
- package/dist/{chunk-GUTQ3PWL.js → chunk-PLKYHUNT.js} +1 -1
- package/dist/chunk-PNU3E7IO.js +3 -0
- package/dist/chunk-PS2B6THP.js +3 -0
- package/dist/chunk-PYPPV2F5.js +25 -0
- package/dist/{chunk-25CZ5ZIU.js → chunk-QFTBY67N.js} +3 -3
- package/dist/chunk-S5LXX32D.js +28 -0
- package/dist/chunk-SILJ3OL4.js +9 -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-YGGKGZO2.js +1 -0
- package/dist/{chunk-L7JMDDSD.js → chunk-YRF7OATP.js} +1 -1
- package/dist/chunk-ZPT5D4VP.js +2 -0
- package/dist/entry-0.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-16.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-25.js +2 -2
- package/dist/entry-26.js +1 -1
- package/dist/entry-27.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 +11 -9
- 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 +12 -11
- 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-55.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -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 +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-72.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-77.js +50 -307
- package/dist/entry-78.js +14 -26
- package/dist/entry-79.js +2 -2
- package/dist/entry-80.js +1 -1
- package/dist/entry-81.js +1 -1
- package/dist/entry-82.js +5 -3
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/pi-agent-ide.js +15 -3
- package/docs/agent-guides/editing.md +31 -3
- package/docs/agent-guides/git-changes.md +1 -1
- package/docs/agent-guides/json-reading.md +19 -3
- package/docs/agent-guides/read-resources.md +15 -1
- package/docs/agent-guides/search-code.md +43 -2
- package/docs/agent-guides/select-code.md +194 -0
- package/docs/agent-guides/terminal.md +1 -1
- package/docs/code-review.md +99 -0
- package/docs/configuration.md +36 -7
- package/docs/development.md +16 -19
- package/docs/nightly.md +7 -0
- package/docs/releases.md +42 -0
- 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 +29 -0
- package/docs/research/native-codemode-batching.md +65 -0
- package/docs/structured-results.md +86 -0
- package/docs/tools.md +24 -4
- 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-documentation/src/index.ts +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +6 -1
- package/node_modules/pi-agent-filesystem/package.json +7 -6
- package/node_modules/pi-agent-filesystem/src/path-recovery.ts +109 -0
- 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/overflow-handler.ts +6 -1
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +6 -2
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +110 -7
- 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 -24
- package/node_modules/pi-agent-ide-changes/package.json +8 -7
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +126 -48
- 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 +92 -30
- 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 +35 -2
- package/node_modules/pi-agent-read/src/core/extension.ts +11 -0
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
- 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 +218 -0
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +127 -73
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/index.ts +22 -0
- package/node_modules/pi-agent-resource/src/resource-access.ts +55 -0
- package/node_modules/pi-agent-resource/src/resource-scheduler.ts +204 -0
- package/node_modules/pi-agent-resource/src/result-targets.ts +233 -0
- package/node_modules/pi-agent-resource/src/tool-result.ts +125 -0
- package/node_modules/pi-agent-search/package.json +5 -4
- 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 +13 -6
- package/node_modules/pi-agent-search/src/api/search-scope.ts +22 -0
- package/node_modules/pi-agent-search/src/api/search.ts +39 -0
- package/node_modules/pi-agent-search/src/api/structured-result.ts +148 -0
- package/node_modules/pi-agent-search/src/core/extension.ts +90 -24
- package/node_modules/pi-agent-search/src/core/search-core.ts +145 -78
- package/node_modules/pi-agent-search-text/index.ts +6 -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 +174 -26
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +103 -0
- package/node_modules/pi-agent-search-text/src/search-backend.ts +201 -18
- package/node_modules/pi-agent-search-text/src/search-query.ts +42 -34
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +18 -4
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +90 -259
- package/node_modules/pi-agent-search-text/src/search-result.ts +77 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +110 -17
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-document.ts +15 -10
- 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-exact/src/anchor.ts +4 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/index.ts +4 -7
- package/node_modules/pi-agent-text-editor/package.json +20 -21
- package/node_modules/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +78 -41
- package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
- 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 +35 -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 +2 -0
- 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 +820 -0
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
- 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 +412 -0
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +149 -139
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +236 -185
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +253 -203
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
- 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 +9 -73
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -5
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +276 -129
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +19 -45
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +16 -1
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- 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 +23 -0
- package/node_modules/pi-agent-web/package.json +7 -6
- package/node_modules/pi-agent-web/src/search.ts +221 -0
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +42 -37
- package/skills/capture-code-review-rule/SKILL.md +60 -0
- package/src/code-review/config.ts +68 -0
- package/src/code-review/extension.ts +105 -0
- package/src/code-review/fragments.ts +26 -0
- package/src/code-review/reviewer.ts +198 -0
- package/src/composite/host-version.ts +13 -0
- package/src/composite/module-labels.ts +1 -1
- package/src/composite/nested-tool-rendering.ts +298 -0
- package/src/composite/preferences.ts +0 -5
- package/src/composite/tool-availability.ts +90 -0
- package/src/core/extension.ts +2 -0
- package/src/documentation/extension.ts +81 -145
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +6 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -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-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-filesystem/src/path-recovery.ts +109 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +23 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +221 -0
- 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 +35 -2
- package/src/extensions/pi-agent-read/src/core/extension.ts +11 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +9 -10
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +28 -15
- 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 +218 -0
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +127 -73
- package/src/extensions/pi-agent-search/package.json +5 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +6 -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 +174 -26
- 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 +201 -18
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +42 -34
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +18 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +90 -259
- 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 +110 -17
- 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 +13 -6
- package/src/extensions/pi-agent-search/src/api/search-scope.ts +22 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +39 -0
- package/src/extensions/pi-agent-search/src/api/structured-result.ts +148 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +90 -24
- package/src/extensions/pi-agent-search/src/core/search-core.ts +145 -78
- package/src/extensions/pi-agent-text-editor/index.ts +4 -7
- package/src/extensions/pi-agent-text-editor/package.json +20 -21
- 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-exact/src/anchor.ts +4 -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 +9 -73
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +276 -129
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +36 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +28 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +40 -10
- 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/index.ts +16 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/src/api/mutation-preview.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +6 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +3 -1
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +12 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +1 -20
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit.ts +16 -0
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +78 -41
- package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +8 -0
- 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 +35 -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 +2 -0
- 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 +820 -0
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +20 -6
- 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 +412 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +149 -139
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +236 -185
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +253 -203
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +25 -5
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +8 -4
- 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 +61 -8
- 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/overflow-handler.ts +6 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +6 -2
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +110 -7
- 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 -24
- package/src/plugins/pi-agent-ide-changes/package.json +8 -7
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +5 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +126 -48
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +11 -40
- package/src/plugins/pi-agent-ide-debugger/index.ts +63 -17
- package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +18 -2
- package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +24 -4
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +68 -2
- package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +357 -0
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -3
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +13 -13
- 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 +92 -30
- package/src/plugins/pi-agent-ide-terminal/index.ts +12 -2
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +65 -30
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +16 -37
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +1 -0
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +100 -0
- package/src/plugins/pi-agent-ide-terminal/src/steering.ts +62 -0
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +98 -46
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +3 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +15 -6
- package/src/plugins/pi-agent-ide-vision/index.ts +35 -1
- package/dist/chunk-3E2NTWCN.js +0 -2
- package/dist/chunk-4LUW26BX.js +0 -10
- package/dist/chunk-4U2GUKNJ.js +0 -0
- package/dist/chunk-5VSE5X5R.js +0 -2
- package/dist/chunk-6EYWFBNG.js +0 -0
- package/dist/chunk-7WCZOO5I.js +0 -1
- package/dist/chunk-CEX3VOJ7.js +0 -2
- package/dist/chunk-FA6BKC5Y.js +0 -1
- package/dist/chunk-FEDVTZJG.js +0 -1
- package/dist/chunk-HMLH43ZS.js +0 -4
- package/dist/chunk-ITSNK5YG.js +0 -7
- package/dist/chunk-KII2JQC5.js +0 -1
- package/dist/chunk-LVWMWWWF.js +0 -28
- package/dist/chunk-P7XO5CIP.js +0 -2
- package/dist/chunk-PZFOOHY2.js +0 -15
- package/dist/chunk-ROXXK6TW.js +0 -0
- package/dist/chunk-S3ZPXWX7.js +0 -2
- package/dist/chunk-T7CZIACQ.js +0 -27
- package/dist/chunk-VXD6FZP5.js +0 -5
- package/dist/chunk-YHUTTZC6.js +0 -2
- package/dist/chunk-YT42LKFV.js +0 -16
- 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 -155
- package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +0 -344
- 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 -133
- package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
- package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +0 -148
- package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +0 -920
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
- 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 -155
- package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +0 -344
- 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 -133
- package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +0 -369
- package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +0 -148
- package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +0 -920
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +0 -52
|
@@ -2,7 +2,6 @@ import { requiredValue } from "pi-agent-invariant";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
import type { TextEditCompletion } from "#src/api/edit-completion.js";
|
|
5
|
-
import { Value } from "typebox/value";
|
|
6
5
|
import type {
|
|
7
6
|
TextAnchorRecoveryCandidateRange,
|
|
8
7
|
TextAnchorRecoveryRange,
|
|
@@ -47,6 +46,15 @@ import { readTextAnchorRecovery } from "#src/core/text-anchor-recovery.js";
|
|
|
47
46
|
import { applyTextChanges, TextChangeDocument } from "#src/core/text-change-engine.js";
|
|
48
47
|
import { resolvedTextAnchorType } from "#src/core/text-anchor-registry.js";
|
|
49
48
|
import { executeTextToolWithBatch } from "#src/core/text-edit-batch-registrar.js";
|
|
49
|
+
import {
|
|
50
|
+
executeNativeTextEditBatch,
|
|
51
|
+
runNativePostEditScope,
|
|
52
|
+
recordNativeTextMutation,
|
|
53
|
+
} from "#src/core/native-text-edit-batch.js";
|
|
54
|
+
import { attachCommittedMutationTarget } from "./mutation-result-targets.js";
|
|
55
|
+
import { wholeFileResultSource } from "./result-input.js";
|
|
56
|
+
import { TEXT_SEARCH_ANCHOR_KIND } from "#src/api/plugin-protocol.js";
|
|
57
|
+
import { isResultInput, prepareResultTransfer } from "./result-transfer.js";
|
|
50
58
|
import {
|
|
51
59
|
contextualizeTextMutationAnchorError,
|
|
52
60
|
TextMutationAnchorAggregateError,
|
|
@@ -74,14 +82,17 @@ import { renderTextAnchor, type TextAnchor } from "pi-agent-text";
|
|
|
74
82
|
import { TextSelectionAnchor } from "#src/api/text-selection-anchor.js";
|
|
75
83
|
import type { ToolCallAnchorRenderState } from "pi-agent-tool-call-interception";
|
|
76
84
|
import type { Static, TSchema } from "typebox";
|
|
77
|
-
import type { ScriptMutationOutcome } from "#src/core/apply/mutation-outcome.js";
|
|
78
85
|
import { executeWholeFileTool, isWholeFileInvocation } from "#src/core/file-operation-tools.js";
|
|
86
|
+
import { EDITING_GUIDELINES } from "#src/core/editing-guidelines.js";
|
|
87
|
+
import { mutationOutputSchema, structuredMutation } from "./structured-result.js";
|
|
88
|
+
import type { ResultTargetStore } from "pi-agent-resource";
|
|
79
89
|
|
|
80
90
|
export function createTextTool<TParameters extends TSchema>(
|
|
81
91
|
core: TextEditorCore,
|
|
82
92
|
definition: TextMutationToolRegistration<TParameters>,
|
|
83
93
|
annotations: ToolCallInterceptionRenderStore,
|
|
84
94
|
getLastResolvedSource: () => string | undefined,
|
|
95
|
+
resultTargets?: ResultTargetStore,
|
|
85
96
|
): ToolDefinition<TParameters, FileMutationBatchResult> {
|
|
86
97
|
const renderer = core.getToolRenderer(definition.name);
|
|
87
98
|
const initialRenderCall = renderer?.renderCall;
|
|
@@ -90,13 +101,24 @@ export function createTextTool<TParameters extends TSchema>(
|
|
|
90
101
|
const tool = withToolCallInterceptionRendering<TParameters, FileMutationBatchResult, unknown>(
|
|
91
102
|
defineTool<TParameters, FileMutationBatchResult, unknown>({
|
|
92
103
|
name: definition.name,
|
|
104
|
+
exposure: "direct",
|
|
105
|
+
namespace: {
|
|
106
|
+
name: "ide_edit",
|
|
107
|
+
description: "Edit files and live IDE resources with guarded operations.",
|
|
108
|
+
},
|
|
109
|
+
annotations: {
|
|
110
|
+
readOnlyHint: false,
|
|
111
|
+
destructiveHint: true,
|
|
112
|
+
idempotentHint: false,
|
|
113
|
+
openWorldHint: true,
|
|
114
|
+
},
|
|
93
115
|
label: definition.name,
|
|
94
116
|
|
|
95
117
|
promptSnippet: definition.promptSnippet,
|
|
96
|
-
promptGuidelines:
|
|
97
|
-
definition.promptGuidelines === undefined ? undefined : [...definition.promptGuidelines],
|
|
118
|
+
promptGuidelines: [...EDITING_GUIDELINES, ...(definition.promptGuidelines ?? [])],
|
|
98
119
|
description: definition.description,
|
|
99
120
|
parameters: definition.parameters,
|
|
121
|
+
outputSchema: mutationOutputSchema,
|
|
100
122
|
prepareArguments: (arguments_) =>
|
|
101
123
|
// oxlint-disable-next-line typescript/no-unsafe-return -- TypeBox resolves only concrete tool schemas.
|
|
102
124
|
prepareGuardedArguments(
|
|
@@ -119,50 +141,198 @@ export function createTextTool<TParameters extends TSchema>(
|
|
|
119
141
|
),
|
|
120
142
|
}),
|
|
121
143
|
async execute(toolCallId, parameters, signal, onUpdate, context) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
144
|
+
let plannedEdits: ReadonlyMap<string, TextMutationEdit> | undefined;
|
|
145
|
+
const captured = await runNativePostEditScope(core, toolCallId, () =>
|
|
146
|
+
captureScriptMutation(core, async () => {
|
|
147
|
+
const execute = async (): Promise<AgentToolResult<FileMutationBatchResult>> => {
|
|
148
|
+
let input = asMutationParameters<TParameters>(parameters);
|
|
149
|
+
if (
|
|
150
|
+
["replace", "write", "delete", "undo"].includes(definition.name) &&
|
|
151
|
+
isResultInput(input[definition.source.field])
|
|
152
|
+
) {
|
|
153
|
+
try {
|
|
154
|
+
if (resultTargets === undefined)
|
|
155
|
+
throw new Error("Result targets are unavailable.");
|
|
156
|
+
if (input.start !== undefined || input.end !== undefined)
|
|
157
|
+
throw new Error("Do not combine result targets with start/end.");
|
|
158
|
+
const selected = resultTargets.resolve(
|
|
159
|
+
input[definition.source.field],
|
|
160
|
+
context.cwd,
|
|
161
|
+
);
|
|
162
|
+
if (!selected.complete)
|
|
163
|
+
throw new Error(
|
|
164
|
+
"Incomplete result targets cannot establish a complete edit; repeat Search.",
|
|
165
|
+
);
|
|
166
|
+
await resultTargets.verify(selected, signal);
|
|
167
|
+
if (definition.name === "write" || definition.name === "undo")
|
|
168
|
+
wholeFileResultSource(selected);
|
|
169
|
+
if (selected.targets.length === 0)
|
|
170
|
+
return {
|
|
171
|
+
content: [{ type: "text", text: "Empty result target set; no changes." }],
|
|
172
|
+
details: {
|
|
173
|
+
results: [],
|
|
174
|
+
effect: "not-applied",
|
|
175
|
+
metadata: { emptyTargets: true },
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
input = {
|
|
179
|
+
...input,
|
|
180
|
+
[definition.source.field]: resultTargets.register(
|
|
181
|
+
selected.targets,
|
|
182
|
+
context.cwd,
|
|
183
|
+
selected.complete,
|
|
184
|
+
),
|
|
185
|
+
};
|
|
186
|
+
} catch (error) {
|
|
187
|
+
signal?.throwIfAborted();
|
|
188
|
+
return failureToolResult(
|
|
189
|
+
"",
|
|
190
|
+
"RESULT_INPUT_REJECTED",
|
|
191
|
+
errorMessage(error),
|
|
192
|
+
"not-applied",
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
let executionDefinition = definition;
|
|
197
|
+
let verifyFileSource: (() => Promise<void>) | undefined;
|
|
198
|
+
if (
|
|
199
|
+
(definition.name === "copy" || definition.name === "move") &&
|
|
200
|
+
(isResultInput(input.path) || isResultInput(input.target))
|
|
201
|
+
) {
|
|
202
|
+
try {
|
|
203
|
+
if (resultTargets === undefined)
|
|
204
|
+
throw new Error("Result targets are unavailable.");
|
|
205
|
+
const prepared = await prepareResultTransfer(
|
|
206
|
+
definition.name,
|
|
207
|
+
input,
|
|
208
|
+
resultTargets,
|
|
209
|
+
context.cwd,
|
|
210
|
+
signal,
|
|
211
|
+
);
|
|
212
|
+
input = asMutationParameters<TParameters>(prepared.input);
|
|
213
|
+
verifyFileSource = prepared.verifyFileSource;
|
|
214
|
+
if (prepared.empty)
|
|
215
|
+
return {
|
|
216
|
+
content: [{ type: "text", text: "Empty result target set; no changes." }],
|
|
217
|
+
details: {
|
|
218
|
+
results: [],
|
|
219
|
+
effect: "not-applied",
|
|
220
|
+
metadata: { emptyTargets: true },
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
if (prepared.mutate !== undefined)
|
|
224
|
+
executionDefinition = { ...definition, mutate: prepared.mutate };
|
|
225
|
+
} catch (error) {
|
|
226
|
+
signal?.throwIfAborted();
|
|
227
|
+
return failureToolResult(
|
|
228
|
+
"",
|
|
229
|
+
"RESULT_INPUT_REJECTED",
|
|
230
|
+
errorMessage(error),
|
|
231
|
+
"not-applied",
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const directDefinition = executionDefinition;
|
|
236
|
+
executionDefinition = {
|
|
237
|
+
...directDefinition,
|
|
238
|
+
mutate: async (mutationContext, arguments_) => {
|
|
239
|
+
const mutation = await directDefinition.mutate(mutationContext, arguments_);
|
|
240
|
+
plannedEdits = mutation.edits;
|
|
241
|
+
return mutation;
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
const queued = executeNativeTextEditBatch(
|
|
245
|
+
core,
|
|
246
|
+
toolCallId,
|
|
247
|
+
definition,
|
|
248
|
+
input,
|
|
249
|
+
signal,
|
|
250
|
+
context,
|
|
251
|
+
);
|
|
252
|
+
if (queued !== undefined) return queued;
|
|
253
|
+
if (definition.direct?.matches(input) === true) {
|
|
254
|
+
try {
|
|
255
|
+
const action = await definition.direct.execute(
|
|
256
|
+
{ cwd: context.cwd, ...(signal !== undefined && { signal }) },
|
|
257
|
+
input,
|
|
258
|
+
);
|
|
259
|
+
return {
|
|
260
|
+
content: [{ type: "text", text: action.summary }],
|
|
261
|
+
details: {
|
|
262
|
+
results: [],
|
|
263
|
+
metadata: { semanticAction: { ...action.data, source: action.source } },
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
} catch (error) {
|
|
267
|
+
const code =
|
|
268
|
+
error !== null && typeof error === "object" && "code" in error
|
|
269
|
+
? String(error.code)
|
|
270
|
+
: "DIRECT_MUTATION_FAILED";
|
|
271
|
+
return failureToolResult(
|
|
272
|
+
"transaction" in input ? String(input.transaction) : "",
|
|
273
|
+
code,
|
|
274
|
+
error instanceof Error ? error.message : String(error),
|
|
275
|
+
"unknown",
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (
|
|
280
|
+
isWholeFileInvocation(definition.wholeFileOperation, input) &&
|
|
281
|
+
core.getSemanticMutationHandler(definition.name, input) === undefined
|
|
282
|
+
) {
|
|
283
|
+
return executeWholeFileTool(
|
|
284
|
+
core,
|
|
285
|
+
definition.wholeFileOperation,
|
|
286
|
+
input,
|
|
287
|
+
signal,
|
|
288
|
+
context,
|
|
289
|
+
verifyFileSource,
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
const directExecute = () =>
|
|
293
|
+
executeTextMutation(
|
|
294
|
+
core,
|
|
295
|
+
executionDefinition,
|
|
296
|
+
input,
|
|
297
|
+
signal,
|
|
298
|
+
context,
|
|
299
|
+
(field, state) =>
|
|
300
|
+
annotations.resolveArguments(toolCallId, {
|
|
301
|
+
[TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH]: { [field]: state },
|
|
302
|
+
}),
|
|
303
|
+
getLastResolvedSource(),
|
|
304
|
+
);
|
|
305
|
+
return executeTextToolWithBatch(toolCallId, directExecute, signal, onUpdate, context);
|
|
135
306
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"not-applied",
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (isWholeFileInvocation(definition.wholeFileOperation, input)) {
|
|
150
|
-
return executeWholeFileTool(core, definition.wholeFileOperation, input, signal, context);
|
|
151
|
-
}
|
|
152
|
-
const directExecute = () =>
|
|
153
|
-
executeTextMutation(
|
|
154
|
-
core,
|
|
155
|
-
definition,
|
|
156
|
-
input,
|
|
157
|
-
signal,
|
|
158
|
-
context,
|
|
159
|
-
(field, state) =>
|
|
160
|
-
annotations.resolveArguments(toolCallId, {
|
|
161
|
-
[TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH]: { [field]: state },
|
|
162
|
-
}),
|
|
163
|
-
getLastResolvedSource(),
|
|
307
|
+
return execute();
|
|
308
|
+
}),
|
|
309
|
+
);
|
|
310
|
+
if (captured.kind === "failed") {
|
|
311
|
+
const failed = failureToolResult(
|
|
312
|
+
"",
|
|
313
|
+
"EXECUTION_FAILED",
|
|
314
|
+
errorMessage(captured.error),
|
|
315
|
+
"unknown",
|
|
164
316
|
);
|
|
165
|
-
|
|
317
|
+
return structuredMutation(failed, definition.name, captured.completions, toolCallId);
|
|
318
|
+
}
|
|
319
|
+
recordNativeTextMutation(core, toolCallId, captured.value);
|
|
320
|
+
const value =
|
|
321
|
+
resultTargets &&
|
|
322
|
+
["replace", "insert", "write", "copy", "move", "undo"].includes(definition.name)
|
|
323
|
+
? await attachCommittedMutationTarget(
|
|
324
|
+
captured.value,
|
|
325
|
+
captured.completions,
|
|
326
|
+
resultTargets,
|
|
327
|
+
toolCallId,
|
|
328
|
+
context.cwd,
|
|
329
|
+
signal,
|
|
330
|
+
definition.name === "write" || definition.name === "undo",
|
|
331
|
+
plannedEdits,
|
|
332
|
+
definition.name === "copy" || definition.name === "move",
|
|
333
|
+
)
|
|
334
|
+
: captured.value;
|
|
335
|
+
return structuredMutation(value, definition.name, captured.completions, toolCallId);
|
|
166
336
|
},
|
|
167
337
|
}),
|
|
168
338
|
annotations,
|
|
@@ -172,6 +342,26 @@ export function createTextTool<TParameters extends TSchema>(
|
|
|
172
342
|
get(): string {
|
|
173
343
|
return [
|
|
174
344
|
definition.description,
|
|
345
|
+
definition.intent !== "restore"
|
|
346
|
+
? "In native Codemode, local text edits share original snapshots and return acceptance before writing. Another tool, whole-file operation, or resource-owned selector commits the batch first; script completion also commits it. Formatting and registered resource post-edit handlers run at script end, not at flush or dependency boundaries. Earlier targets become stale if final processing changes bytes. Ordinary script errors keep accepted edits; aborts and deadlines discard pending edits."
|
|
347
|
+
: "",
|
|
348
|
+
(
|
|
349
|
+
{
|
|
350
|
+
replace:
|
|
351
|
+
"Local data.target selects this call's resulting text; empty replacement selects the resulting position, not the removed text.",
|
|
352
|
+
insert:
|
|
353
|
+
"Local data.target selects this call's inserted text, including supplied line separators.",
|
|
354
|
+
write: "Local data.target selects the whole written file, not only its changed span.",
|
|
355
|
+
copy: "Local data.target selects only the destination text; a whole-file copy selects the whole destination. The source is unchanged.",
|
|
356
|
+
move: "Local data.target selects only the destination text; a whole-file move selects the whole destination. Source removals never become output targets.",
|
|
357
|
+
delete:
|
|
358
|
+
"Deletion returns a change record and file state, never a live target or an empty-position target.",
|
|
359
|
+
undo: "Local data.target selects whole restored text files, not only reversed spans. Restored absence is reported in files[].state without a live target.",
|
|
360
|
+
} as Record<string, string>
|
|
361
|
+
)[definition.name] ?? "",
|
|
362
|
+
["replace", "insert", "write", "copy", "move", "undo"].includes(definition.name)
|
|
363
|
+
? "A pending data.target requires confirmed writing. Successful changes without a verified text mapping expose data.targetUnavailable; inspect effects separately."
|
|
364
|
+
: "",
|
|
175
365
|
definition.source.inherited
|
|
176
366
|
? definition.wholeFileOperation === undefined
|
|
177
367
|
? `When ${definition.source.field} is omitted, the tool can reuse the file identified by the supplied anchor, the last read, or the preceding edit in the same batch.`
|
|
@@ -263,7 +453,11 @@ async function resolveMutationSources(
|
|
|
263
453
|
source: string,
|
|
264
454
|
): Promise<readonly TextTarget[] | undefined> => {
|
|
265
455
|
try {
|
|
266
|
-
return await core.resolveTextAnchorResources(
|
|
456
|
+
return await core.resolveTextAnchorResources(
|
|
457
|
+
value,
|
|
458
|
+
value.startsWith("RESULT#") ? [...allKinds, TEXT_SEARCH_ANCHOR_KIND] : allKinds,
|
|
459
|
+
context,
|
|
460
|
+
);
|
|
267
461
|
} catch (error) {
|
|
268
462
|
throw contextualizeTextMutationAnchorError(error, definition.name, field, source, value);
|
|
269
463
|
}
|
|
@@ -360,6 +554,7 @@ async function resolveMutationSources(
|
|
|
360
554
|
if (
|
|
361
555
|
targets !== undefined &&
|
|
362
556
|
hasImplicitSourceSelection &&
|
|
557
|
+
definition.name !== "undo" &&
|
|
363
558
|
descriptor.field === firstAnchor?.field
|
|
364
559
|
) {
|
|
365
560
|
implicitTargets.set(descriptor.field, targets);
|
|
@@ -968,7 +1163,8 @@ export async function executeTextMutationPipeline<TParameters extends TSchema>(
|
|
|
968
1163
|
|
|
969
1164
|
const scriptMutationScope = new AsyncLocalStorage<TextEditCompletion[]>();
|
|
970
1165
|
|
|
971
|
-
|
|
1166
|
+
/** Capture actual completed effects across a tool or batch, including failed post-edit hooks. */
|
|
1167
|
+
export async function captureScriptMutation<T>(core: TextEditorCore, action: () => Promise<T>) {
|
|
972
1168
|
const completions: TextEditCompletion[] = [];
|
|
973
1169
|
const unsubscribe = core.onDidEdit((completion) => {
|
|
974
1170
|
if (scriptMutationScope.getStore() === completions) completions.push(completion);
|
|
@@ -982,140 +1178,6 @@ async function captureScriptMutation<T>(core: TextEditorCore, action: () => Prom
|
|
|
982
1178
|
unsubscribe();
|
|
983
1179
|
}
|
|
984
1180
|
}
|
|
985
|
-
/**
|
|
986
|
-
* Runs the configured mutation pipeline and returns plain script data.
|
|
987
|
-
* onPresentation retains rich edit annotations on the host without sending classes to the guest.
|
|
988
|
-
*/
|
|
989
|
-
export async function executeScriptMutation<TParameters extends TSchema>(
|
|
990
|
-
core: TextEditorCore,
|
|
991
|
-
definition: TextMutationToolRegistration<TParameters>,
|
|
992
|
-
arguments_: unknown,
|
|
993
|
-
signal: AbortSignal | undefined,
|
|
994
|
-
context: ExtensionContext,
|
|
995
|
-
lastResolvedSource?: string,
|
|
996
|
-
onPresentation?: (source: string, result: FileMutationResult) => void,
|
|
997
|
-
): Promise<ScriptMutationOutcome> {
|
|
998
|
-
const parameters = prepareGuardedArguments(
|
|
999
|
-
definition.parameters,
|
|
1000
|
-
arguments_,
|
|
1001
|
-
definition.source.inherited ? definition.source.field : undefined,
|
|
1002
|
-
lastResolvedSource,
|
|
1003
|
-
definition.anchors ?? [],
|
|
1004
|
-
definition.wholeFileOperation !== undefined,
|
|
1005
|
-
);
|
|
1006
|
-
if (!Value.Check(definition.parameters, parameters)) {
|
|
1007
|
-
throw Object.assign(new Error(`Invalid arguments for ${definition.name}`), {
|
|
1008
|
-
code: "INVALID_ARGUMENTS",
|
|
1009
|
-
details: { operation: definition.name, effect: "not-applied" },
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
const captured = await captureScriptMutation(core, () =>
|
|
1013
|
-
executeTextMutationPipeline(
|
|
1014
|
-
core,
|
|
1015
|
-
definition,
|
|
1016
|
-
parameters,
|
|
1017
|
-
signal,
|
|
1018
|
-
context,
|
|
1019
|
-
undefined,
|
|
1020
|
-
lastResolvedSource,
|
|
1021
|
-
),
|
|
1022
|
-
);
|
|
1023
|
-
const source =
|
|
1024
|
-
captured.kind === "completed" ? captured.value.source : mutationSource(definition, parameters);
|
|
1025
|
-
const observedFiles: ScriptMutationOutcome["files"] = captured.completions.map((completion) => ({
|
|
1026
|
-
source: completion.resourceSource,
|
|
1027
|
-
before: completion.existed ? completion.before.content : null,
|
|
1028
|
-
after: completion.after.content,
|
|
1029
|
-
action: definition.name === "write" ? "overwritten" : "edited",
|
|
1030
|
-
changes: [],
|
|
1031
|
-
formatting: { status: "not-reported" },
|
|
1032
|
-
}));
|
|
1033
|
-
const failed = (
|
|
1034
|
-
code: string,
|
|
1035
|
-
message: string,
|
|
1036
|
-
effect: ScriptMutationOutcome["effect"],
|
|
1037
|
-
completed: readonly string[] = [],
|
|
1038
|
-
): ScriptMutationOutcome => ({
|
|
1039
|
-
operation: definition.name,
|
|
1040
|
-
ok: false,
|
|
1041
|
-
effect: effect === "unknown" ? "unknown" : observedFiles.length > 0 ? "applied" : effect,
|
|
1042
|
-
completed: [...new Set([...completed, ...observedFiles.map((file) => file.source)])],
|
|
1043
|
-
files: observedFiles,
|
|
1044
|
-
errors: [{ source, code, message }],
|
|
1045
|
-
});
|
|
1046
|
-
if (captured.kind === "failed")
|
|
1047
|
-
return failed("EXECUTION_FAILED", errorMessage(captured.error), "unknown");
|
|
1048
|
-
const { pipeline } = captured.value;
|
|
1049
|
-
if (pipeline.kind === "failed")
|
|
1050
|
-
return {
|
|
1051
|
-
...failed(pipeline.failure.code, pipeline.failure.message, "not-applied"),
|
|
1052
|
-
recoveries: await scriptAnchorRecoveries(pipeline.failure.cause),
|
|
1053
|
-
};
|
|
1054
|
-
const outcome = pipeline.state.result;
|
|
1055
|
-
if (!isResourcesEditOutcome(outcome))
|
|
1056
|
-
return failed("INVALID_RESULT", "Invalid mutation outcome", "unknown");
|
|
1057
|
-
if (outcome.kind === "failed")
|
|
1058
|
-
return {
|
|
1059
|
-
...failed(
|
|
1060
|
-
outcome.failure.code,
|
|
1061
|
-
outcome.failure.message,
|
|
1062
|
-
outcome.completed.length > 0 ? "unknown" : "not-applied",
|
|
1063
|
-
outcome.completed,
|
|
1064
|
-
),
|
|
1065
|
-
recoveries: await scriptAnchorRecoveries(outcome.failure.cause),
|
|
1066
|
-
};
|
|
1067
|
-
const mutation = outcome.result as ExecutedTextMutation;
|
|
1068
|
-
if (mutation.semanticAction !== undefined) {
|
|
1069
|
-
return {
|
|
1070
|
-
operation: definition.name,
|
|
1071
|
-
ok: true,
|
|
1072
|
-
effect: "applied",
|
|
1073
|
-
files: [],
|
|
1074
|
-
completed: [mutation.semanticAction.source],
|
|
1075
|
-
metadata: {
|
|
1076
|
-
semanticAction: {
|
|
1077
|
-
...mutation.semanticAction.data,
|
|
1078
|
-
source: mutation.semanticAction.source,
|
|
1079
|
-
},
|
|
1080
|
-
},
|
|
1081
|
-
errors: [],
|
|
1082
|
-
};
|
|
1083
|
-
}
|
|
1084
|
-
const files = outcome.resources.flatMap((resource) => {
|
|
1085
|
-
const edit = mutation.edits.get(resource.source);
|
|
1086
|
-
if (edit === undefined) return [];
|
|
1087
|
-
const presentation = withPipelineStatuses(
|
|
1088
|
-
buildSuccessfulTextMutationResult(resource, resource.source, edit),
|
|
1089
|
-
pipeline.state.metadata,
|
|
1090
|
-
);
|
|
1091
|
-
onPresentation?.(resource.after.source, presentation);
|
|
1092
|
-
const data = presentation.data;
|
|
1093
|
-
return [
|
|
1094
|
-
{
|
|
1095
|
-
source: resource.after.source,
|
|
1096
|
-
before:
|
|
1097
|
-
captured.completions.find(
|
|
1098
|
-
(completion) => completion.resourceSource === resource.after.source,
|
|
1099
|
-
)?.existed === false
|
|
1100
|
-
? null
|
|
1101
|
-
: resource.before.content,
|
|
1102
|
-
after: resource.after.content,
|
|
1103
|
-
action: edit.action,
|
|
1104
|
-
changes: data.rawChanges ?? [],
|
|
1105
|
-
formatting: data.formatting ?? { status: "not-reported" as const },
|
|
1106
|
-
},
|
|
1107
|
-
];
|
|
1108
|
-
});
|
|
1109
|
-
return {
|
|
1110
|
-
operation: definition.name,
|
|
1111
|
-
ok: true,
|
|
1112
|
-
effect: files.length > 0 ? "applied" : "not-applied",
|
|
1113
|
-
files,
|
|
1114
|
-
completed: files.map((file) => file.source),
|
|
1115
|
-
...(pipeline.state.metadata !== undefined && { metadata: pipeline.state.metadata }),
|
|
1116
|
-
errors: [],
|
|
1117
|
-
};
|
|
1118
|
-
}
|
|
1119
1181
|
export function mutationSources(
|
|
1120
1182
|
definition: TextMutationToolRegistration,
|
|
1121
1183
|
parameters: Readonly<Record<string, unknown>>,
|
|
@@ -1330,24 +1392,6 @@ async function resolveAnchorRecovery(error: TextMutationAnchorResolutionError) {
|
|
|
1330
1392
|
return error.resolution.recovery;
|
|
1331
1393
|
}
|
|
1332
1394
|
|
|
1333
|
-
async function scriptAnchorRecoveries(
|
|
1334
|
-
cause: unknown,
|
|
1335
|
-
): Promise<NonNullable<ScriptMutationOutcome["recoveries"]>> {
|
|
1336
|
-
if (cause instanceof TextMutationAnchorAggregateError)
|
|
1337
|
-
return (await Promise.all(cause.failures.map(scriptAnchorRecoveries))).flat();
|
|
1338
|
-
if (!(cause instanceof TextMutationAnchorResolutionError)) return [];
|
|
1339
|
-
const recovery = await resolveAnchorRecovery(cause);
|
|
1340
|
-
return [
|
|
1341
|
-
{
|
|
1342
|
-
path: cause.source,
|
|
1343
|
-
field: cause.field,
|
|
1344
|
-
anchor: cause.anchor,
|
|
1345
|
-
status: recovery?.kind ?? "unavailable",
|
|
1346
|
-
candidates: recovery?.kind === "candidates" ? recovery.candidates : [],
|
|
1347
|
-
total: recovery?.kind === "candidates" ? recovery.total : 0,
|
|
1348
|
-
},
|
|
1349
|
-
];
|
|
1350
|
-
}
|
|
1351
1395
|
async function anchorFailureToolResult(
|
|
1352
1396
|
core: TextEditorCore,
|
|
1353
1397
|
failure: TextResourceEditFailure,
|
|
@@ -1379,7 +1423,7 @@ async function anchorFailureToolResult(
|
|
|
1379
1423
|
}
|
|
1380
1424
|
return {
|
|
1381
1425
|
content: [{ type: "text", text: messages.join("\n\n") }],
|
|
1382
|
-
details: { results, anchorRecoveries },
|
|
1426
|
+
details: { results, anchorRecoveries, effect: "not-applied" },
|
|
1383
1427
|
};
|
|
1384
1428
|
}
|
|
1385
1429
|
if (!(failure.cause instanceof TextMutationAnchorResolutionError)) {
|
|
@@ -1436,7 +1480,13 @@ async function anchorFailureToolResult(
|
|
|
1436
1480
|
const result = new FileMutationResult({
|
|
1437
1481
|
ok: false,
|
|
1438
1482
|
path: contextual.source,
|
|
1439
|
-
errors: [
|
|
1483
|
+
errors: [
|
|
1484
|
+
{
|
|
1485
|
+
path: contextual.source,
|
|
1486
|
+
code: resolution.rejection?.code ?? failure.code,
|
|
1487
|
+
reason: resolution.message,
|
|
1488
|
+
},
|
|
1489
|
+
],
|
|
1440
1490
|
});
|
|
1441
1491
|
const recoveryContext = recoveryTexts.join("\n");
|
|
1442
1492
|
const rejectionCode = resolution.rejection?.code;
|
|
@@ -1548,7 +1598,7 @@ function failureToolResult(
|
|
|
1548
1598
|
|
|
1549
1599
|
return {
|
|
1550
1600
|
content: [new FileMutationAgentResult(result).toTextContent()],
|
|
1551
|
-
details: { results: [result], effect }
|
|
1601
|
+
details: { results: [result], effect },
|
|
1552
1602
|
};
|
|
1553
1603
|
}
|
|
1554
1604
|
|
|
@@ -3,6 +3,8 @@ Runtime for intercepting streamed Pi tool calls.
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Allow } from "partial-json";
|
|
6
|
+
import { resultError, withStructuredResult } from "pi-agent-resource";
|
|
7
|
+
import { mutationDataSchema } from "#src/core/structured-result.js";
|
|
6
8
|
import {
|
|
7
9
|
isToolCallAnnotation,
|
|
8
10
|
type ToolCallAnnotation,
|
|
@@ -285,11 +287,29 @@ class InterceptorImpl implements ToolCallInterceptor {
|
|
|
285
287
|
this.toolCallRecords.delete(event.toolCallId);
|
|
286
288
|
|
|
287
289
|
if (guardResult) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
details
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
const details = guardResult.details;
|
|
291
|
+
const effect =
|
|
292
|
+
typeof details === "object" &&
|
|
293
|
+
details !== null &&
|
|
294
|
+
"effect" in details &&
|
|
295
|
+
(details.effect === "not-applied" || details.effect === "applied")
|
|
296
|
+
? details.effect
|
|
297
|
+
: "unknown";
|
|
298
|
+
const message = guardResult.content
|
|
299
|
+
.flatMap((block) => (block.type === "text" ? [block.text] : []))
|
|
300
|
+
.join("\n");
|
|
301
|
+
return withStructuredResult(
|
|
302
|
+
{
|
|
303
|
+
content: guardResult.content,
|
|
304
|
+
details,
|
|
305
|
+
},
|
|
306
|
+
mutationDataSchema,
|
|
307
|
+
{
|
|
308
|
+
status: "error",
|
|
309
|
+
errors: [resultError(message, "INTERCEPTED")],
|
|
310
|
+
data: { operation: event.toolName, operationId: event.toolCallId, effect, files: [] },
|
|
311
|
+
},
|
|
312
|
+
);
|
|
293
313
|
}
|
|
294
314
|
|
|
295
315
|
return;
|
package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts
CHANGED
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
type AssistantMessage,
|
|
4
4
|
type AssistantMessageEvent,
|
|
5
5
|
type AssistantMessageEventStream,
|
|
6
|
-
type
|
|
6
|
+
type TranscriptContext,
|
|
7
|
+
type ToolCall,
|
|
7
8
|
createAssistantMessageEventStream,
|
|
8
9
|
type Model,
|
|
9
10
|
type SimpleStreamOptions,
|
|
@@ -14,7 +15,7 @@ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-a
|
|
|
14
15
|
|
|
15
16
|
type StreamSimple = (
|
|
16
17
|
model: Model<Api>,
|
|
17
|
-
context:
|
|
18
|
+
context: TranscriptContext,
|
|
18
19
|
options?: SimpleStreamOptions,
|
|
19
20
|
) => AssistantMessageEventStream;
|
|
20
21
|
|
|
@@ -174,7 +175,7 @@ export function registerStreamingInterceptorProvider(
|
|
|
174
175
|
function wrapStream(
|
|
175
176
|
delegate: StreamSimple,
|
|
176
177
|
model: Model<Api>,
|
|
177
|
-
context:
|
|
178
|
+
context: TranscriptContext,
|
|
178
179
|
options: SimpleStreamOptions | undefined,
|
|
179
180
|
subscribers: ReadonlySet<StreamingSubscriber>,
|
|
180
181
|
): AssistantMessageEventStream {
|
|
@@ -266,7 +267,10 @@ function wrapStream(
|
|
|
266
267
|
)
|
|
267
268
|
.map((block) =>
|
|
268
269
|
block.type === "toolCall" && block.id === interception.toolCallId
|
|
269
|
-
? {
|
|
270
|
+
? {
|
|
271
|
+
...block,
|
|
272
|
+
arguments: structuredClone(interception.arguments) as ToolCall["arguments"],
|
|
273
|
+
}
|
|
270
274
|
: block,
|
|
271
275
|
),
|
|
272
276
|
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
+
import { resultInputSchema } from "pi-agent-resource";
|
|
3
|
+
|
|
4
|
+
/** Build a structured source selector without changing legacy path semantics. */
|
|
5
|
+
export function resultSourceProperty(description: string) {
|
|
6
|
+
return Type.Optional({ ...resultInputSchema, description });
|
|
7
|
+
}
|
|
2
8
|
|
|
3
9
|
/** Build the source selector shared by text mutation schemas. */
|
|
4
10
|
export function sourcePathProperty(description: string) {
|
|
@@ -26,16 +32,13 @@ export function sourceRangeProperties() {
|
|
|
26
32
|
/** Build the destination selectors shared by copy and move schemas. */
|
|
27
33
|
export function targetProperties() {
|
|
28
34
|
return {
|
|
29
|
-
target:
|
|
30
|
-
|
|
31
|
-
description:
|
|
32
|
-
"Target resource reference or file path. Required for a whole-file operation; defaults to the source for selected text.",
|
|
33
|
-
}),
|
|
35
|
+
target: resultSourceProperty(
|
|
36
|
+
"Destination file path or source result. A structured result replaces its exact ranges (zero-width ranges insert); omit targetStart/targetEnd. Source and destination selections pair in declared order with equal counts. A string target keeps its existing anchor semantics.",
|
|
34
37
|
),
|
|
35
38
|
targetStart: Type.Optional(
|
|
36
39
|
Type.String({
|
|
37
40
|
description:
|
|
38
|
-
"Registered anchor or unique exact text in the destination. Required
|
|
41
|
+
"Registered anchor or unique exact text in the destination. Required for text transfers with a string target; omit for whole-file transfers or a structured target. Without targetEnd, inserts after the last containing line, keeping the selected text. With targetEnd, replacement starts at the first containing line. SEARCH :match also uses these line boundaries.",
|
|
39
42
|
}),
|
|
40
43
|
),
|
|
41
44
|
targetEnd: Type.Optional(
|