pi-agent-ide 0.2.1 → 0.2.2
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 +31 -0
- package/dist/{chunk-XNXQYPVT.js → chunk-4LUW26BX.js} +1 -1
- package/dist/{chunk-2ZMYT6ZC.js → chunk-4U6KGABH.js} +1 -1
- package/dist/chunk-4ZTEPMJO.js +14 -0
- package/dist/{chunk-KNMWCDDK.js → chunk-6ACQQBUY.js} +1 -1
- package/dist/chunk-76WHES5H.js +7 -0
- package/dist/chunk-BHSO2MDK.js +6 -0
- package/dist/chunk-BMOJTJJJ.js +3 -0
- package/dist/chunk-GFWDXTOB.js +4 -0
- package/dist/{chunk-VSP2QQPQ.js → chunk-GIRAEVUJ.js} +1 -1
- package/dist/chunk-JJVXUL5U.js +2 -0
- package/dist/chunk-KCEOTU5Z.js +3 -0
- package/dist/chunk-KVGQG43U.js +1 -0
- package/dist/{chunk-MTTKFJV6.js → chunk-LQYZG62K.js} +1 -1
- package/dist/{chunk-PETQCA7G.js → chunk-P6T3Q7LB.js} +1 -1
- package/dist/chunk-QIJMV2P2.js +2 -0
- package/dist/chunk-QJFRAMK7.js +2 -0
- package/dist/{chunk-2SKAED2I.js → chunk-RAZOACDD.js} +2 -2
- package/dist/chunk-RIGRP3FD.js +1 -0
- package/dist/chunk-S3ZPXWX7.js +2 -0
- package/dist/{chunk-266RH77Z.js → chunk-THSCUT2L.js} +1 -1
- package/dist/{chunk-EEH4WYI7.js → chunk-WNMGUALD.js} +1 -1
- package/dist/{chunk-ZIHEF6K3.js → chunk-X6MPU7UO.js} +1 -1
- package/dist/{chunk-SMSIT3CE.js → chunk-XF5PVZOS.js} +1 -1
- package/dist/{chunk-SJYDLHEF.js → chunk-ZXN3TWWW.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-10.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-21.js +2 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +7 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +4 -1
- package/dist/entry-32.js +8 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +14 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-45.js +7 -1
- package/dist/entry-46.js +11 -1
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-55.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-69.js +59 -1
- package/dist/entry-70.js +4 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +29 -1
- package/dist/entry-73.js +2 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +3 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +1 -1
- package/dist/pi-agent-ide.js +2 -13
- package/docs/configuration.md +25 -0
- package/docs/extensions.md +4 -2
- package/docs/tools.md +1 -1
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +2 -2
- package/node_modules/pi-agent-filesystem/package.json +6 -6
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +9 -9
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/node_modules/pi-agent-ide-ast/src/extension.ts +9 -14
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +60 -0
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/node_modules/pi-agent-ide-changes/index.ts +1 -5
- package/node_modules/pi-agent-ide-changes/package.json +6 -6
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +1 -7
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +12 -7
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/index.ts +4 -1
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/index.ts +1 -12
- package/node_modules/pi-agent-ide-lsp/package.json +8 -8
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +7 -4
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +8 -1
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-image/src/image-converter.ts +1 -1
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +1 -1
- package/node_modules/pi-agent-read/package.json +6 -6
- package/node_modules/pi-agent-read/src/api/rendering.ts +3 -0
- package/node_modules/pi-agent-read/src/core/read-core.ts +6 -26
- package/node_modules/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +28 -7
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +35 -30
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -8
- package/node_modules/pi-agent-search/package.json +3 -3
- package/node_modules/pi-agent-search/src/core/extension.ts +7 -5
- package/node_modules/pi-agent-search/src/core/search-core.ts +10 -0
- package/node_modules/pi-agent-search-text/index.ts +42 -33
- package/node_modules/pi-agent-search-text/package.json +6 -6
- package/node_modules/pi-agent-search-text/src/file-search.ts +9 -1
- package/node_modules/pi-agent-search-text/src/resolvers.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +48 -0
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/package.json +6 -6
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +71 -1
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +7 -9
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +27 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +38 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +23 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +5 -9
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +54 -14
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/node_modules/pi-agent-text-editor-argument-order/package.json +2 -2
- package/node_modules/pi-agent-text-editor-overwrite/package.json +3 -3
- package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +52 -4
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +5 -3
- 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-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-web/index.ts +1 -6
- package/node_modules/pi-agent-web/package.json +6 -6
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- 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 +35 -35
- package/src/api/plugin-protocol.ts +2 -0
- package/src/api/text-editor.ts +7 -0
- package/src/api/tool-config.ts +4 -0
- package/src/composite/builtin-extensions.ts +148 -66
- package/src/composite/extensions-config.ts +18 -0
- package/src/core/diagnostic-entry.ts +94 -0
- package/src/core/diagnostic-store.ts +43 -21
- package/src/core/extension.ts +39 -17
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +6 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +1 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +6 -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-html/src/html-converter.ts +1 -1
- 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/package.json +6 -6
- package/src/extensions/pi-agent-read/src/api/rendering.ts +3 -0
- package/src/extensions/pi-agent-read/src/core/read-core.ts +6 -26
- package/src/extensions/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +28 -7
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +35 -30
- package/src/extensions/pi-agent-search/package.json +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +42 -33
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +6 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +9 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +48 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +7 -5
- package/src/extensions/pi-agent-search/src/core/search-core.ts +10 -0
- package/src/extensions/pi-agent-text-editor/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +52 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +5 -3
- 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-result.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +71 -1
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +7 -9
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +27 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +38 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +23 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +5 -9
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +54 -14
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/src/pi-agent-ide.ts +11 -0
- package/src/plugins/pi-agent-ide-ast/package.json +9 -9
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +89 -19
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +9 -14
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +60 -0
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +1 -5
- package/src/plugins/pi-agent-ide-changes/package.json +6 -6
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +1 -7
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +1 -16
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +12 -7
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/index.ts +4 -1
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/index.ts +1 -12
- package/src/plugins/pi-agent-ide-lsp/package.json +8 -8
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +7 -4
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +8 -1
- package/src/post-edit/gate.ts +44 -15
- package/src/toolchain/types.ts +2 -0
- package/dist/chunk-2XYXV5HS.js +0 -4
- package/dist/chunk-34ZQTTU2.js +0 -2
- package/dist/chunk-4SQQKEVD.js +0 -16
- package/dist/chunk-5BWUVAR4.js +0 -1
- package/dist/chunk-6DN7NO7L.js +0 -1
- package/dist/chunk-6SMFVLTY.js +0 -1
- package/dist/chunk-6XQQBKPE.js +0 -58
- package/dist/chunk-BYWAG6X3.js +0 -6
- package/dist/chunk-EW2KVKCN.js +0 -2
- package/dist/chunk-F6SESI3P.js +0 -4
- package/dist/chunk-GTK5AREE.js +0 -2
- package/dist/chunk-HOBTFFQR.js +0 -1
- package/dist/chunk-IMVCVPMP.js +0 -3
- package/dist/chunk-IOCABSRL.js +0 -1
- package/dist/chunk-KH5KPBCR.js +0 -10
- package/dist/chunk-KYVOMBO5.js +0 -1
- package/dist/chunk-L4FA6OD4.js +0 -1
- package/dist/chunk-LFV6G5Z3.js +0 -1
- package/dist/chunk-LGN7EJYR.js +0 -13
- package/dist/chunk-MB6VVVAF.js +0 -2
- package/dist/chunk-MTQSGWZJ.js +0 -1
- package/dist/chunk-NI2NK4JU.js +0 -1
- package/dist/chunk-NXHPO7ER.js +0 -6
- package/dist/chunk-OFHVDY4Q.js +0 -2
- package/dist/chunk-OIL6BB2S.js +0 -33
- package/dist/chunk-ONWUJXUR.js +0 -1
- package/dist/chunk-PODWLGNO.js +0 -6
- package/dist/chunk-QZANC2IG.js +0 -1
- package/dist/chunk-SSZB66C3.js +0 -3
- package/dist/chunk-TG6H6EOI.js +0 -1
- package/dist/chunk-UTTW55S2.js +0 -1
- package/dist/chunk-VEJGSURY.js +0 -8
- package/dist/chunk-W3XYKJ5H.js +0 -1
- package/dist/chunk-XGUAL3CA.js +0 -1
- package/node_modules/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/src/extensions/pi-agent-read/src/core/tools/read/views.ts +0 -29
|
@@ -57,6 +57,7 @@ interface TextBatchState {
|
|
|
57
57
|
readonly registration: AnyTextMutationToolRegistration;
|
|
58
58
|
}
|
|
59
59
|
interface PlannedTextMutation extends TextMutation {
|
|
60
|
+
readonly operation: string;
|
|
60
61
|
readonly resultPresentations: ReadonlyMap<string, MutationResultPresentation>;
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -303,6 +304,8 @@ export async function executeRegisteredTextBatch(
|
|
|
303
304
|
callId: item.callId,
|
|
304
305
|
mutation: {
|
|
305
306
|
...mutation,
|
|
307
|
+
|
|
308
|
+
operation: item.registration.name,
|
|
306
309
|
resultPresentations: new Map(
|
|
307
310
|
[...mutation.edits.keys()].map((source) => [
|
|
308
311
|
source,
|
|
@@ -390,6 +393,19 @@ export async function executeRegisteredTextBatch(
|
|
|
390
393
|
edit,
|
|
391
394
|
ownAfter,
|
|
392
395
|
mutation.resultPresentations.get(source) ?? "plain",
|
|
396
|
+
|
|
397
|
+
1,
|
|
398
|
+
[{ operation: mutation.operation, changes: edit.changes.length }],
|
|
399
|
+
|
|
400
|
+
completedMutations.flatMap((peer) =>
|
|
401
|
+
peer.callId === callId
|
|
402
|
+
? []
|
|
403
|
+
: (peer.mutation.edits.get(source)?.changes ?? []).map(({ from, to, insert }) => ({
|
|
404
|
+
from,
|
|
405
|
+
to,
|
|
406
|
+
insert,
|
|
407
|
+
})),
|
|
408
|
+
),
|
|
393
409
|
),
|
|
394
410
|
];
|
|
395
411
|
});
|
|
@@ -424,6 +440,13 @@ export async function executeRegisteredTextBatch(
|
|
|
424
440
|
resource.after.content,
|
|
425
441
|
finalPresentationBySource.get(source) ?? "plain",
|
|
426
442
|
edits.length,
|
|
443
|
+
|
|
444
|
+
completedMutations.flatMap(({ mutation }) => {
|
|
445
|
+
const edit = mutation.edits.get(source);
|
|
446
|
+
return edit === undefined
|
|
447
|
+
? []
|
|
448
|
+
: [{ operation: mutation.operation, changes: edit.changes.length }];
|
|
449
|
+
}),
|
|
427
450
|
);
|
|
428
451
|
resultsByCallId.get(finalCallId)?.push(result);
|
|
429
452
|
results.push(result);
|
|
@@ -309,7 +309,7 @@ export interface TextEditorCore {
|
|
|
309
309
|
registerPostEditHandler(registration: TextPostEditHandlerRegistration): () => void;
|
|
310
310
|
registerTool(tool: TextEditorToolId): void;
|
|
311
311
|
waitForPendingPlugins(): Promise<void>;
|
|
312
|
-
renderGeneralPromptGuideline(): string | undefined;
|
|
312
|
+
renderGeneralPromptGuideline(kinds?: ReadonlySet<string>): string | undefined;
|
|
313
313
|
/** Returns the configured number of lines around recovery candidates. */
|
|
314
314
|
recoveryContextLines(): number;
|
|
315
315
|
renderToolPromptGuideline(tool: TextEditorToolId): string | undefined;
|
|
@@ -687,7 +687,7 @@ export function createTextEditorCore(
|
|
|
687
687
|
recoveryContextLines(): number {
|
|
688
688
|
return projectConfig.contextLines;
|
|
689
689
|
},
|
|
690
|
-
renderGeneralPromptGuideline(): string | undefined {
|
|
690
|
+
renderGeneralPromptGuideline(kinds?: ReadonlySet<string>): string | undefined {
|
|
691
691
|
const sections: string[] = [];
|
|
692
692
|
const writableEntries: string[] = [];
|
|
693
693
|
|
|
@@ -717,7 +717,7 @@ export function createTextEditorCore(
|
|
|
717
717
|
);
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
-
const anchorSection = anchorRegistry.renderPromptSection();
|
|
720
|
+
const anchorSection = anchorRegistry.renderPromptSection(kinds);
|
|
721
721
|
|
|
722
722
|
if (anchorSection !== undefined) {
|
|
723
723
|
sections.push(anchorSection);
|
|
@@ -739,15 +739,11 @@ export function createTextEditorCore(
|
|
|
739
739
|
);
|
|
740
740
|
|
|
741
741
|
if (contribution !== undefined) {
|
|
742
|
-
entries.push(
|
|
742
|
+
entries.push(contribution.description);
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
745
|
|
|
746
|
-
return entries.length === 0
|
|
747
|
-
? undefined
|
|
748
|
-
: indentGuidelineContinuation(
|
|
749
|
-
[`${tool} supports these installed extensions:`, ...entries].join("\n"),
|
|
750
|
-
);
|
|
746
|
+
return entries.length === 0 ? undefined : entries.join("\n");
|
|
751
747
|
},
|
|
752
748
|
async waitForPendingPlugins(): Promise<void> {
|
|
753
749
|
await Promise.all(pendingPlugins);
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type FileMutationBatchResult,
|
|
20
20
|
FileMutationResult,
|
|
21
21
|
type MutationResultPresentation,
|
|
22
|
+
type MutationOperationReceipt,
|
|
22
23
|
} from "#src/api/mutation-result.js";
|
|
23
24
|
import {
|
|
24
25
|
isMutationAnchorValue,
|
|
@@ -28,7 +29,11 @@ import {
|
|
|
28
29
|
type TextMutationEdit,
|
|
29
30
|
type TextMutationToolRegistration,
|
|
30
31
|
} from "#src/api/mutation-tool.js";
|
|
31
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
isFormattingContribution,
|
|
34
|
+
isDiffStatusContribution,
|
|
35
|
+
isTextMutationResultContributionData,
|
|
36
|
+
} from "#src/api/post-edit.js";
|
|
32
37
|
import {
|
|
33
38
|
formatStaleAnchorMessage,
|
|
34
39
|
type StaleAnchorMessageDetails,
|
|
@@ -49,7 +54,6 @@ import {
|
|
|
49
54
|
type ToolCallInterceptionRenderStore,
|
|
50
55
|
withToolCallInterceptionRendering,
|
|
51
56
|
} from "#src/core/tool-call-interceptor/rendering.js";
|
|
52
|
-
import { appendSchemaFieldOrder } from "#src/core/tool-description.js";
|
|
53
57
|
|
|
54
58
|
import type { TextEditExecutionOutcome } from "#src/api/edit-pipeline.js";
|
|
55
59
|
import type {
|
|
@@ -83,7 +87,9 @@ export function createTextTool<TParameters extends TSchema>(
|
|
|
83
87
|
label: definition.name,
|
|
84
88
|
|
|
85
89
|
promptSnippet: definition.promptSnippet,
|
|
86
|
-
|
|
90
|
+
promptGuidelines:
|
|
91
|
+
definition.promptGuidelines === undefined ? undefined : [...definition.promptGuidelines],
|
|
92
|
+
description: definition.description,
|
|
87
93
|
parameters: definition.parameters,
|
|
88
94
|
prepareArguments: (arguments_) =>
|
|
89
95
|
// oxlint-disable-next-line typescript/no-unsafe-return -- TypeBox resolves only concrete tool schemas.
|
|
@@ -116,15 +122,18 @@ export function createTextTool<TParameters extends TSchema>(
|
|
|
116
122
|
}),
|
|
117
123
|
annotations,
|
|
118
124
|
);
|
|
119
|
-
Object.defineProperty(tool, "
|
|
125
|
+
Object.defineProperty(tool, "description", {
|
|
120
126
|
enumerable: true,
|
|
121
|
-
get(): string
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
get(): string {
|
|
128
|
+
return [
|
|
129
|
+
definition.description,
|
|
130
|
+
definition.source.inherited
|
|
131
|
+
? `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.`
|
|
132
|
+
: "",
|
|
133
|
+
pluginPromptGuideline() ?? "",
|
|
134
|
+
]
|
|
135
|
+
.filter(Boolean)
|
|
136
|
+
.join("\n");
|
|
128
137
|
},
|
|
129
138
|
});
|
|
130
139
|
return tool;
|
|
@@ -195,6 +204,7 @@ async function resolveMutationSources(
|
|
|
195
204
|
const expandedByAnchor = new Map<string, readonly TextTarget[]>();
|
|
196
205
|
const expandedBySourceField = new Map<string, readonly TextTarget[]>();
|
|
197
206
|
const expandedFromExplicitSource = new Set<string>();
|
|
207
|
+
const sourceSelections = new Map<string, readonly TextTarget[]>();
|
|
198
208
|
const explicitlyScopedSourceFields = new Set<string>();
|
|
199
209
|
const allKinds = [
|
|
200
210
|
...new Set((definition.anchors ?? []).flatMap((descriptor) => descriptor.kinds)),
|
|
@@ -239,6 +249,7 @@ async function resolveMutationSources(
|
|
|
239
249
|
const expanded = await resolveTargets(explicit, descriptor.field, explicit);
|
|
240
250
|
if (expanded !== undefined) {
|
|
241
251
|
expandedFromExplicitSource.add(descriptor.field);
|
|
252
|
+
sourceSelections.set(descriptor.field, expanded);
|
|
242
253
|
expandedBySourceField.set(
|
|
243
254
|
descriptor.field,
|
|
244
255
|
mergeTargets(expandedBySourceField.get(descriptor.field) ?? [], expanded),
|
|
@@ -288,14 +299,20 @@ async function resolveMutationSources(
|
|
|
288
299
|
const anchors = new Map<string, readonly string[]>();
|
|
289
300
|
const implicitTargets = new Map<string, readonly TextTarget[]>();
|
|
290
301
|
for (const descriptor of definition.anchors ?? []) {
|
|
291
|
-
const targets =
|
|
302
|
+
const targets = sourceSelections.get(descriptor.sourceField);
|
|
303
|
+
const firstAnchor = definition.anchors?.find(
|
|
304
|
+
(anchor) => anchor.sourceField === descriptor.sourceField,
|
|
305
|
+
);
|
|
292
306
|
|
|
293
307
|
const hasExplicitAnchor = isMutationAnchorValue(descriptor, input[descriptor.field]);
|
|
294
308
|
const hasImplicitSourceSelection = expandedFromExplicitSource.has(descriptor.sourceField);
|
|
295
309
|
if (!hasExplicitAnchor && !hasImplicitSourceSelection) continue;
|
|
310
|
+
// A sibling endpoint can identify the file, but must not contribute its
|
|
311
|
+
// selected ranges to this endpoint. Only a typed source supplies a selection.
|
|
296
312
|
if (
|
|
297
313
|
targets !== undefined &&
|
|
298
|
-
|
|
314
|
+
hasImplicitSourceSelection &&
|
|
315
|
+
descriptor.field === firstAnchor?.field
|
|
299
316
|
) {
|
|
300
317
|
implicitTargets.set(descriptor.field, targets);
|
|
301
318
|
}
|
|
@@ -759,7 +776,7 @@ export async function executeTextMutation<TParameters extends TSchema>(
|
|
|
759
776
|
},
|
|
760
777
|
);
|
|
761
778
|
|
|
762
|
-
return buildToolResult(core, pipeline, source, context);
|
|
779
|
+
return buildToolResult(core, pipeline, source, context, definition.name);
|
|
763
780
|
}
|
|
764
781
|
|
|
765
782
|
export function mutationSources(
|
|
@@ -795,6 +812,7 @@ type CompletedTextResource = Extract<
|
|
|
795
812
|
{ readonly kind: "completed" }
|
|
796
813
|
>;
|
|
797
814
|
|
|
815
|
+
/** Builds a mutation receipt; peer ranges are supplied only for per-call batch display results. */
|
|
798
816
|
export function buildSuccessfulTextMutationResult(
|
|
799
817
|
resource: CompletedTextResource,
|
|
800
818
|
resultSource: string,
|
|
@@ -802,6 +820,13 @@ export function buildSuccessfulTextMutationResult(
|
|
|
802
820
|
diffAfterContent = resource.after.content,
|
|
803
821
|
resultPresentation: MutationResultPresentation = "plain",
|
|
804
822
|
editCount = 1,
|
|
823
|
+
operations: readonly MutationOperationReceipt[] = [],
|
|
824
|
+
|
|
825
|
+
diffPeerRanges?: readonly {
|
|
826
|
+
readonly from: number;
|
|
827
|
+
readonly to: number;
|
|
828
|
+
readonly insert: string;
|
|
829
|
+
}[],
|
|
805
830
|
): FileMutationResult {
|
|
806
831
|
const before = resource.before.content;
|
|
807
832
|
const finalAfter = resource.after.content;
|
|
@@ -822,6 +847,17 @@ export function buildSuccessfulTextMutationResult(
|
|
|
822
847
|
|
|
823
848
|
return new FileMutationResult({
|
|
824
849
|
...mutationResultData,
|
|
850
|
+
|
|
851
|
+
...(diffPeerRanges === undefined ? {} : { diffPeerRanges }),
|
|
852
|
+
|
|
853
|
+
operations,
|
|
854
|
+
diffStatuses: resource.postEditContributions
|
|
855
|
+
.map((item) => item.data)
|
|
856
|
+
.filter(isDiffStatusContribution)
|
|
857
|
+
.flatMap((item) => item.diffStatuses),
|
|
858
|
+
formatting: resource.postEditContributions
|
|
859
|
+
.map((item) => item.data)
|
|
860
|
+
.find(isFormattingContribution)?.formatting ?? { status: "not-reported" },
|
|
825
861
|
ok: true,
|
|
826
862
|
path: resultSource,
|
|
827
863
|
diffs: [unified.diff],
|
|
@@ -868,6 +904,7 @@ async function buildToolResult(
|
|
|
868
904
|
pipeline: TextEditExecutionOutcome,
|
|
869
905
|
source: string,
|
|
870
906
|
context: ExtensionContext,
|
|
907
|
+
operation: string,
|
|
871
908
|
): Promise<AgentToolResult<FileMutationBatchResult>> {
|
|
872
909
|
if (pipeline.kind === "failed") {
|
|
873
910
|
return failureToolResult(
|
|
@@ -916,6 +953,9 @@ async function buildToolResult(
|
|
|
916
953
|
edit,
|
|
917
954
|
undefined,
|
|
918
955
|
mutation.resultPresentations.get(resultSource) ?? "plain",
|
|
956
|
+
|
|
957
|
+
1,
|
|
958
|
+
[{ operation, changes: edit.changes.length }],
|
|
919
959
|
),
|
|
920
960
|
];
|
|
921
961
|
});
|
|
@@ -50,6 +50,7 @@ export function singleAnchorSpan(
|
|
|
50
50
|
context: TextMutationContext,
|
|
51
51
|
anchors: ReadonlyMap<string, TextAnchor>,
|
|
52
52
|
field: string,
|
|
53
|
+
wholeLines = false,
|
|
53
54
|
): TextAnchorSpan {
|
|
54
55
|
if (anchors.size !== 1) {
|
|
55
56
|
throw new Error(`Anchor ${field} must resolve in one resource.`);
|
|
@@ -63,7 +64,9 @@ export function singleAnchorSpan(
|
|
|
63
64
|
const selectedRange = requiredValue(anchor.ranges[0]);
|
|
64
65
|
const document = context.documentFor(source);
|
|
65
66
|
const exactRange = selectionRange(context, source, selectedRange);
|
|
66
|
-
const endLine =
|
|
67
|
+
const endLine = wholeLines
|
|
68
|
+
? containingEndLine(selectedRange)
|
|
69
|
+
: linewiseSelectionEndLine(selectedRange);
|
|
67
70
|
if (endLine !== undefined) {
|
|
68
71
|
const range = document.lineRange(selectedRange.start.lineNumber, endLine);
|
|
69
72
|
return {
|
|
@@ -89,7 +92,7 @@ export function singleAnchorSpan(
|
|
|
89
92
|
};
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
/**
|
|
95
|
+
/** A single anchor keeps its own extent; two ordered anchors select inclusive whole lines. */
|
|
93
96
|
export function anchorSpanRange(
|
|
94
97
|
context: TextMutationContext,
|
|
95
98
|
starts: ReadonlyMap<string, TextAnchor>,
|
|
@@ -102,15 +105,18 @@ export function anchorSpanRange(
|
|
|
102
105
|
if (start.source !== end.source) {
|
|
103
106
|
throw new Error(`Anchors ${startField} and ${endField} must resolve in one resource.`);
|
|
104
107
|
}
|
|
105
|
-
if (start.from > end.
|
|
108
|
+
if (start.from > end.from) {
|
|
106
109
|
throw new Error(`Anchor ${startField} must not come after ${endField}.`);
|
|
107
110
|
}
|
|
111
|
+
if (ends === undefined) return start;
|
|
112
|
+
const first = singleAnchorSpan(context, starts, startField, true);
|
|
113
|
+
const last = singleAnchorSpan(context, ends, endField, true);
|
|
108
114
|
return {
|
|
109
|
-
source:
|
|
110
|
-
from:
|
|
111
|
-
to:
|
|
112
|
-
selection:
|
|
113
|
-
preservesTrailingLineBreak:
|
|
115
|
+
source: first.source,
|
|
116
|
+
from: first.from,
|
|
117
|
+
to: last.to,
|
|
118
|
+
selection: false,
|
|
119
|
+
preservesTrailingLineBreak: true,
|
|
114
120
|
};
|
|
115
121
|
}
|
|
116
122
|
|
|
@@ -120,12 +126,13 @@ export function targetText(context: TextMutationContext, source: string, text: s
|
|
|
120
126
|
return text.replace(/\r\n|\r|\n/gu, separator);
|
|
121
127
|
}
|
|
122
128
|
|
|
123
|
-
/**
|
|
129
|
+
/** Empty text deletes the selection; nonempty text preserves a line endpoint's separator. */
|
|
124
130
|
export function replaceAnchorSpan(
|
|
125
131
|
context: TextMutationContext,
|
|
126
132
|
span: TextAnchorSpan,
|
|
127
133
|
text: string,
|
|
128
134
|
): { readonly from: number; readonly to: number; readonly insert: string } {
|
|
135
|
+
if (text === "") return deleteAnchorSpan(context, span);
|
|
129
136
|
const document = context.documentFor(span.source);
|
|
130
137
|
let insert = targetText(context, span.source, text);
|
|
131
138
|
const selected = document.text(span);
|
|
@@ -159,18 +166,15 @@ export function deleteAnchorSpan(
|
|
|
159
166
|
return { from: span.from, to: span.to, insert: "" };
|
|
160
167
|
}
|
|
161
168
|
|
|
162
|
-
/**
|
|
169
|
+
/** Inserts after the last containing line of one resolved anchor. */
|
|
163
170
|
export function insertionAfterAnchor(
|
|
164
171
|
context: TextMutationContext,
|
|
165
172
|
anchors: ReadonlyMap<string, TextAnchor>,
|
|
166
173
|
field: string,
|
|
167
174
|
insert: string,
|
|
168
175
|
): readonly [string, { readonly from: number; readonly to: number; readonly insert: string }] {
|
|
169
|
-
const span = singleAnchorSpan(context, anchors, field);
|
|
176
|
+
const span = singleAnchorSpan(context, anchors, field, true);
|
|
170
177
|
const normalizedInsert = targetText(context, span.source, insert);
|
|
171
|
-
if (span.selection) {
|
|
172
|
-
return [span.source, { from: span.to, to: span.to, insert: normalizedInsert }];
|
|
173
|
-
}
|
|
174
178
|
|
|
175
179
|
const lineNumber = span.linewiseEndLine ?? lineAnchor(anchors, field).lineNumber;
|
|
176
180
|
return [
|
|
@@ -179,18 +183,15 @@ export function insertionAfterAnchor(
|
|
|
179
183
|
];
|
|
180
184
|
}
|
|
181
185
|
|
|
182
|
-
/**
|
|
186
|
+
/** Inserts before the first containing line of one resolved anchor. */
|
|
183
187
|
export function insertionBeforeAnchor(
|
|
184
188
|
context: TextMutationContext,
|
|
185
189
|
anchors: ReadonlyMap<string, TextAnchor>,
|
|
186
190
|
field: string,
|
|
187
191
|
insert: string,
|
|
188
192
|
): readonly [string, { readonly from: number; readonly to: number; readonly insert: string }] {
|
|
189
|
-
const span = singleAnchorSpan(context, anchors, field);
|
|
193
|
+
const span = singleAnchorSpan(context, anchors, field, true);
|
|
190
194
|
const normalizedInsert = targetText(context, span.source, insert);
|
|
191
|
-
if (span.selection) {
|
|
192
|
-
return [span.source, { from: span.from, to: span.from, insert: normalizedInsert }];
|
|
193
|
-
}
|
|
194
195
|
|
|
195
196
|
const lineNumber = span.linewiseStartLine ?? lineAnchor(anchors, field).lineNumber;
|
|
196
197
|
return [
|
|
@@ -233,15 +234,16 @@ export function selectionChanges(
|
|
|
233
234
|
(insert.length === 0 ? coalesceAdjacentLinewiseRanges(anchor.ranges) : anchor.ranges).map(
|
|
234
235
|
(range) => {
|
|
235
236
|
const span = selectionRange(context, source, range);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
237
|
+
return replaceAnchorSpan(
|
|
238
|
+
context,
|
|
239
|
+
{
|
|
240
|
+
source,
|
|
241
|
+
...span,
|
|
242
|
+
selection: range.linewise !== true,
|
|
243
|
+
preservesTrailingLineBreak: range.linewise === true,
|
|
244
|
+
},
|
|
245
|
+
insert,
|
|
246
|
+
);
|
|
245
247
|
},
|
|
246
248
|
),
|
|
247
249
|
]),
|
|
@@ -261,23 +263,19 @@ export function insertionChanges(
|
|
|
261
263
|
return new Map(
|
|
262
264
|
[...selections].map(([source, anchor]) => [
|
|
263
265
|
source,
|
|
264
|
-
|
|
266
|
+
[
|
|
267
|
+
...new Set(
|
|
268
|
+
anchor.ranges.map((range) => {
|
|
269
|
+
selectionRange(context, source, range);
|
|
270
|
+
return before ? range.start.lineNumber : containingEndLine(range);
|
|
271
|
+
}),
|
|
272
|
+
),
|
|
273
|
+
].map((line) => {
|
|
265
274
|
const document = context.documentFor(source);
|
|
266
275
|
const normalizedInsert = targetText(context, source, insert);
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
? document.insertBeforeLine(range.start.lineNumber, normalizedInsert)
|
|
271
|
-
: document.insertAfterLine(linewiseEnd, normalizedInsert);
|
|
272
|
-
}
|
|
273
|
-
const position = before ? range.start : range.end;
|
|
274
|
-
const at = document.range(
|
|
275
|
-
position.lineNumber,
|
|
276
|
-
position.column,
|
|
277
|
-
position.lineNumber,
|
|
278
|
-
position.column,
|
|
279
|
-
);
|
|
280
|
-
return { ...at, insert: normalizedInsert };
|
|
276
|
+
return before
|
|
277
|
+
? document.insertBeforeLine(line, normalizedInsert)
|
|
278
|
+
: document.insertAfterLine(line, normalizedInsert);
|
|
281
279
|
}),
|
|
282
280
|
]),
|
|
283
281
|
);
|
|
@@ -314,6 +312,10 @@ function linewiseSelectionEndLine(range: TextSelectionRange): number | undefined
|
|
|
314
312
|
if (range.linewise !== true) {
|
|
315
313
|
return undefined;
|
|
316
314
|
}
|
|
315
|
+
return containingEndLine(range);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function containingEndLine(range: TextSelectionRange): number {
|
|
317
319
|
return range.end.column === 0 && range.end.lineNumber > range.start.lineNumber
|
|
318
320
|
? range.end.lineNumber - 1
|
|
319
321
|
: range.end.lineNumber;
|
|
@@ -13,29 +13,38 @@ export const copySchema = Type.Object(
|
|
|
13
13
|
{
|
|
14
14
|
path: Type.Optional(
|
|
15
15
|
Type.String({
|
|
16
|
-
description:
|
|
17
|
-
"Source resource reference or file path; a typed resource may select one source span",
|
|
16
|
+
description: "Source file path, or a returned SEARCH# reference selecting the text to copy",
|
|
18
17
|
}),
|
|
19
18
|
),
|
|
20
19
|
start: Type.Optional(
|
|
21
20
|
Type.String({
|
|
22
|
-
description:
|
|
21
|
+
description:
|
|
22
|
+
"Anchor or unique exact text. Alone, selects that fragment; a line anchor selects only its line. Required unless path supplies a SEARCH# selection. With end, selects a whole-line range.",
|
|
23
|
+
}),
|
|
24
|
+
),
|
|
25
|
+
end: Type.Optional(
|
|
26
|
+
Type.String({
|
|
27
|
+
description:
|
|
28
|
+
"Optional anchor or unique exact text. Range includes start's first line through end's last line, even for SEARCH :match. Mixed types allowed; boundaries must be unique, in one file, and forward-ordered. Omit when start already selects the intended content; do not repeat start. The end line is included, not a stopping point before it.",
|
|
23
29
|
}),
|
|
24
30
|
),
|
|
25
|
-
end: Type.Optional(Type.String({ description: "Source end anchor; defaults to start" })),
|
|
26
31
|
target: Type.Optional(
|
|
27
32
|
Type.String({
|
|
28
33
|
description:
|
|
29
|
-
"Target resource reference or file path; a
|
|
34
|
+
"Target resource reference or file path; a returned SEARCH# reference may select the destination; defaults to the source",
|
|
30
35
|
}),
|
|
31
36
|
),
|
|
32
37
|
targetStart: Type.Optional(
|
|
33
38
|
Type.String({
|
|
34
|
-
description:
|
|
39
|
+
description:
|
|
40
|
+
"Registered anchor or unique exact text in the destination. Required unless target already selects one destination range. 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.",
|
|
35
41
|
}),
|
|
36
42
|
),
|
|
37
43
|
targetEnd: Type.Optional(
|
|
38
|
-
Type.String({
|
|
44
|
+
Type.String({
|
|
45
|
+
description:
|
|
46
|
+
"Optional inclusive destination end. Replaces whole lines through the last line containing this anchor, including SEARCH :match. May differ in type from targetStart; both must resolve uniquely in the target file and in forward order. Omit to insert after targetStart instead.",
|
|
47
|
+
}),
|
|
39
48
|
),
|
|
40
49
|
},
|
|
41
50
|
{ additionalProperties: false },
|
|
@@ -52,7 +61,8 @@ interface CopyParameters {
|
|
|
52
61
|
|
|
53
62
|
export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> = {
|
|
54
63
|
name: "copy",
|
|
55
|
-
description:
|
|
64
|
+
description:
|
|
65
|
+
"Use copy to duplicate existing text within or between files while keeping the source. Select the source and destination without reproducing the text in your call. The copy is inserted at the destination or replaces a destination range.",
|
|
56
66
|
|
|
57
67
|
promptSnippet:
|
|
58
68
|
"Make precise file edits by copying text within or between files using exact matches or anchors",
|
|
@@ -15,17 +15,19 @@ export const deleteSchema = Type.Object(
|
|
|
15
15
|
path: Type.Optional(
|
|
16
16
|
Type.String({
|
|
17
17
|
description:
|
|
18
|
-
"Source resource reference or file path. A
|
|
18
|
+
"Source resource reference or file path. A returned SEARCH# reference can select deletion ranges.",
|
|
19
19
|
}),
|
|
20
20
|
),
|
|
21
21
|
start: Type.Optional(
|
|
22
22
|
Type.String({
|
|
23
|
-
description:
|
|
23
|
+
description:
|
|
24
|
+
"Anchor or unique exact text. Alone, selects that fragment; a line anchor selects only its line. Required unless path supplies a SEARCH# selection. With end, selects a whole-line range.",
|
|
24
25
|
}),
|
|
25
26
|
),
|
|
26
27
|
end: Type.Optional(
|
|
27
28
|
Type.String({
|
|
28
|
-
description:
|
|
29
|
+
description:
|
|
30
|
+
"Optional anchor or unique exact text. Range includes start's first line through end's last line, even for SEARCH :match. Mixed types allowed; boundaries must be unique, in one file, and forward-ordered. Omit when start already selects the intended content; do not repeat start. The end line is included, not a stopping point before it.",
|
|
29
31
|
}),
|
|
30
32
|
),
|
|
31
33
|
},
|
|
@@ -40,7 +42,8 @@ interface DeleteParameters {
|
|
|
40
42
|
|
|
41
43
|
export const deleteMutationTool: TextMutationToolRegistration<typeof deleteSchema> = {
|
|
42
44
|
name: "delete",
|
|
43
|
-
description:
|
|
45
|
+
description:
|
|
46
|
+
"Use delete to remove an existing text fragment or an inclusive range of whole lines. Select only the content to remove; surrounding text is kept.",
|
|
44
47
|
|
|
45
48
|
promptSnippet: "Make precise file edits by deleting text using exact matches or anchors",
|
|
46
49
|
parameters: deleteSchema,
|
|
@@ -15,17 +15,24 @@ export const insertSchema = Type.Object(
|
|
|
15
15
|
path: Type.Optional(
|
|
16
16
|
Type.String({
|
|
17
17
|
description:
|
|
18
|
-
"Source resource reference or file path. A
|
|
18
|
+
"Source resource reference or file path. A returned SEARCH# reference can select insertion positions.",
|
|
19
19
|
}),
|
|
20
20
|
),
|
|
21
21
|
anchor: Type.Optional(
|
|
22
22
|
Type.String({
|
|
23
|
-
description:
|
|
23
|
+
description:
|
|
24
|
+
"Registered anchor or unique exact text locating the insertion. Required unless path already supplies a SEARCH selection. Inserts after the last containing line by default, or before the first containing line when before is true. This includes SEARCH :match and multiline exact text; the selected text is kept. Multiple matches on the same insertion line produce one insertion.",
|
|
24
25
|
}),
|
|
25
26
|
),
|
|
26
|
-
text: Type.String({
|
|
27
|
+
text: Type.String({
|
|
28
|
+
description:
|
|
29
|
+
"New text only. The tool supplies the line boundary; do not prefix a newline just to start a new line. For example, 'NEW' inserts one line, while '\\nNEW' intentionally adds a blank line before it. A missing trailing newline is supplied before following text; additional newlines remain intentional blank lines. When appending after an unterminated final line, the tool supplies the separator before the new text and removes one trailing newline from the payload. Payload line endings follow the destination file's LF/CRLF style.",
|
|
30
|
+
}),
|
|
27
31
|
before: Type.Optional(
|
|
28
|
-
Type.Boolean({
|
|
32
|
+
Type.Boolean({
|
|
33
|
+
description:
|
|
34
|
+
"Defaults to false: insert after the last containing line. True: insert before the first containing line. The anchor's text and its lines are kept.",
|
|
35
|
+
}),
|
|
29
36
|
),
|
|
30
37
|
},
|
|
31
38
|
{ additionalProperties: false },
|
|
@@ -40,7 +47,8 @@ interface InsertParameters {
|
|
|
40
47
|
|
|
41
48
|
export const insertMutationTool: TextMutationToolRegistration<typeof insertSchema> = {
|
|
42
49
|
name: "insert",
|
|
43
|
-
description:
|
|
50
|
+
description:
|
|
51
|
+
"Use insert to add new text before or after selected lines while keeping existing text. Insertion is line-based, including for exact-text and SEARCH :match anchors.",
|
|
44
52
|
|
|
45
53
|
promptSnippet:
|
|
46
54
|
"Make precise file edits by inserting text before or after exact matches or anchors",
|
|
@@ -15,29 +15,38 @@ export const moveSchema = Type.Object(
|
|
|
15
15
|
{
|
|
16
16
|
path: Type.Optional(
|
|
17
17
|
Type.String({
|
|
18
|
-
description:
|
|
19
|
-
"Source resource reference or file path; a typed resource may select one source span",
|
|
18
|
+
description: "Source file path, or a returned SEARCH# reference selecting the text to move",
|
|
20
19
|
}),
|
|
21
20
|
),
|
|
22
21
|
start: Type.Optional(
|
|
23
22
|
Type.String({
|
|
24
|
-
description:
|
|
23
|
+
description:
|
|
24
|
+
"Anchor or unique exact text. Alone, selects that fragment; a line anchor selects only its line. Required unless path supplies a SEARCH# selection. With end, selects a whole-line range.",
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
end: Type.Optional(
|
|
28
|
+
Type.String({
|
|
29
|
+
description:
|
|
30
|
+
"Optional anchor or unique exact text. Range includes start's first line through end's last line, even for SEARCH :match. Mixed types allowed; boundaries must be unique, in one file, and forward-ordered. Omit when start already selects the intended content; do not repeat start. The end line is included, not a stopping point before it.",
|
|
25
31
|
}),
|
|
26
32
|
),
|
|
27
|
-
end: Type.Optional(Type.String({ description: "Source end anchor; defaults to start" })),
|
|
28
33
|
target: Type.Optional(
|
|
29
34
|
Type.String({
|
|
30
35
|
description:
|
|
31
|
-
"Target resource reference or file path; a
|
|
36
|
+
"Target resource reference or file path; a returned SEARCH# reference may select the destination; defaults to the source",
|
|
32
37
|
}),
|
|
33
38
|
),
|
|
34
39
|
targetStart: Type.Optional(
|
|
35
40
|
Type.String({
|
|
36
|
-
description:
|
|
41
|
+
description:
|
|
42
|
+
"Registered anchor or unique exact text in the destination. Required unless target already selects one destination range. 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.",
|
|
37
43
|
}),
|
|
38
44
|
),
|
|
39
45
|
targetEnd: Type.Optional(
|
|
40
|
-
Type.String({
|
|
46
|
+
Type.String({
|
|
47
|
+
description:
|
|
48
|
+
"Optional inclusive destination end. Replaces whole lines through the last line containing this anchor, including SEARCH :match. May differ in type from targetStart; both must resolve uniquely in the target file and in forward order. Omit to insert after targetStart instead.",
|
|
49
|
+
}),
|
|
41
50
|
),
|
|
42
51
|
},
|
|
43
52
|
{ additionalProperties: false },
|
|
@@ -54,7 +63,8 @@ interface MoveParameters {
|
|
|
54
63
|
|
|
55
64
|
export const moveMutationTool: TextMutationToolRegistration<typeof moveSchema> = {
|
|
56
65
|
name: "move",
|
|
57
|
-
description:
|
|
66
|
+
description:
|
|
67
|
+
"Use move to relocate existing text within or between files. Select the source and destination without reproducing the text in your call. The selected text is removed from the source and inserted at the destination, or replaces a destination range.",
|
|
58
68
|
|
|
59
69
|
promptSnippet:
|
|
60
70
|
"Make precise file edits by moving text within or between files using exact matches or anchors",
|