pi-agent-ide 0.9.0 → 0.9.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 +24 -0
- package/dist/{chunk-TVH2ND35.js → chunk-35LZOKEW.js} +1 -1
- package/dist/chunk-3LVBARLW.js +33 -0
- package/dist/chunk-4GBFIGH3.js +1 -1
- package/dist/{chunk-64JTD2DJ.js → chunk-5PC5INOL.js} +1 -1
- package/dist/{chunk-FKKAHI62.js → chunk-BT2CFM7D.js} +1 -1
- package/dist/{chunk-VN3XBH2Q.js → chunk-DVNL5NZE.js} +1 -1
- package/dist/{chunk-PLMHBXWI.js → chunk-FXPY3V4L.js} +1 -1
- package/dist/{chunk-AJZVKDYC.js → chunk-HGCJDIRR.js} +1 -1
- package/dist/{chunk-RVFMH77U.js → chunk-HISGZD3C.js} +43 -44
- package/dist/{chunk-KFBRL2V4.js → chunk-HKYVP2Q6.js} +1 -1
- package/dist/{chunk-TVXZE4KW.js → chunk-HRBUY2FF.js} +1 -1
- package/dist/{chunk-QM5WDEFI.js → chunk-IOGWZNWT.js} +1 -1
- package/dist/{chunk-HT7LZN5A.js → chunk-IUJUECXH.js} +1 -1
- package/dist/chunk-LXDF2NWX.js +1 -0
- package/dist/{chunk-TVSZYABY.js → chunk-MPNE25CY.js} +1 -1
- package/dist/{chunk-Y74EKJOY.js → chunk-O7V6G3OO.js} +1 -1
- package/dist/chunk-OUCVZBOR.js +28 -0
- package/dist/{chunk-WUO3UW4J.js → chunk-PCGBM2D6.js} +1 -1
- package/dist/{chunk-V4J3TLCV.js → chunk-RIZARTUM.js} +1 -1
- package/dist/{chunk-LTADNZKW.js → chunk-T3Z4KXOX.js} +1 -1
- package/dist/chunk-TSQ6FBTB.js +1 -0
- package/dist/{chunk-CVOYSEBE.js → chunk-VNWGT367.js} +1 -1
- package/dist/{chunk-FS3KCKFX.js → chunk-X2WFNMQR.js} +1 -1
- package/dist/{chunk-7SG756UO.js → chunk-XCPIIDFS.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-1.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-16.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-18.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -1
- package/dist/entry-22.js +1 -0
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- 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-3.js +1 -1
- package/dist/entry-30.js +1 -2
- package/dist/entry-31.js +2 -1
- package/dist/entry-32.js +1 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -15
- package/dist/entry-38.js +15 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +1 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +1 -1
- package/dist/entry-46.js +1 -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-5.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-54.js +1 -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-6.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +1 -0
- package/dist/entry-68.js +0 -1
- package/dist/entry-69.js +1 -0
- package/dist/entry-7.js +1 -1
- package/dist/entry-70.js +0 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +1 -1
- package/dist/entry-73.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +1 -0
- package/dist/entry-78.js +0 -1
- package/dist/entry-79.js +1 -0
- package/dist/entry-8.js +1 -1
- package/dist/entry-80.js +0 -1
- package/dist/entry-81.js +1 -1
- package/dist/entry-82.js +1 -1
- package/dist/entry-83.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -2
- package/dist/entry-86.js +2 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-88.js +1 -1
- package/dist/entry-89.js +1 -1
- package/dist/entry-9.js +1 -1
- package/dist/entry-90.js +1 -3
- package/dist/entry-91.js +3 -1
- package/dist/entry-92.js +1 -1
- package/dist/entry-93.js +1 -1
- package/dist/entry-94.js +1 -0
- package/dist/pi-agent-ide.js +13 -10
- package/docs/agent-guides/editing.md +3 -0
- package/docs/tools.md +2 -2
- package/node_modules/pi-agent-doctor/package.json +7 -7
- package/node_modules/pi-agent-documentation/package.json +2 -2
- package/node_modules/pi-agent-documentation/runtime/entry-30.js +1 -0
- package/node_modules/pi-agent-filesystem/package.json +8 -8
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-image/runtime/entry-32.js +2 -0
- package/node_modules/pi-agent-filesystem-jq/package.json +7 -7
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-33.js +0 -1
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-36.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +15 -15
- package/node_modules/pi-agent-ide-ast/runtime/entry-37.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-38.js +2 -0
- package/node_modules/pi-agent-ide-changes/package.json +10 -10
- package/node_modules/pi-agent-ide-changes/runtime/entry-39.js +0 -1
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lsp/package.json +13 -13
- package/node_modules/pi-agent-ide-lsp/runtime/entry-44.js +2 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-read/package.json +12 -12
- package/node_modules/pi-agent-read/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-52.js +2 -0
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-search/package.json +9 -9
- package/node_modules/pi-agent-search/runtime/entry-56.js +0 -1
- package/node_modules/pi-agent-search-text/package.json +15 -15
- package/node_modules/pi-agent-search-text/runtime/entry-58.js +1 -0
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-62.js +1 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-63.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-64.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-65.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-67.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +26 -26
- package/node_modules/pi-agent-text-editor/runtime/entry-83.js +0 -1
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +2 -6
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +17 -36
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +40 -82
- package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -9
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +1 -3
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +2 -8
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-86.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/package.json +3 -3
- package/node_modules/pi-agent-tool-ui/runtime/entry-89.js +1 -0
- package/node_modules/pi-agent-web/package.json +8 -8
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-94.js +2 -0
- package/package.json +61 -57
- package/src/api/capabilities.ts +60 -0
- package/src/composite/capabilities.ts +252 -0
- package/src/composite/capability-schemas.ts +53 -0
- package/src/composite/responses-tools.ts +27 -9
- package/src/composite/tool-availability.ts +28 -13
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-32.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-33.js +0 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-36.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-31.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-94.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-90.js +2 -0
- package/src/extensions/pi-agent-read/package.json +12 -12
- package/src/extensions/pi-agent-read/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-52.js +2 -0
- package/src/extensions/pi-agent-search/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +15 -15
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-58.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-61.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-56.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-57.js +2 -0
- package/src/extensions/pi-agent-text-editor/package.json +26 -26
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-63.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-64.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-65.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-67.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-86.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-84.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +2 -6
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +17 -36
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +40 -82
- package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +5 -9
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +1 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +2 -8
- package/src/pi-agent-ide.ts +4 -1
- package/src/plugins/pi-agent-ide-ast/package.json +15 -15
- package/src/plugins/pi-agent-ide-ast/runtime/entry-37.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-38.js +2 -0
- package/src/plugins/pi-agent-ide-changes/package.json +10 -10
- package/src/plugins/pi-agent-ide-changes/runtime/entry-39.js +0 -1
- package/src/plugins/pi-agent-ide-debugger/index.ts +31 -26
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lsp/package.json +13 -13
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-44.js +2 -0
- package/src/plugins/pi-agent-ide-terminal/index.ts +42 -0
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +0 -21
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +0 -3
- package/dist/chunk-7URANI6I.js +0 -28
- package/dist/chunk-K4UTEMDU.js +0 -1
- package/dist/chunk-TNAUCNUT.js +0 -33
- package/dist/entry-23.js +0 -1
- package/node_modules/pi-agent-doctor/runtime/entry-23.js +0 -1
- package/node_modules/pi-agent-filesystem/runtime/entry-30.js +0 -2
- package/node_modules/pi-agent-filesystem-jq/runtime/entry-32.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-36.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +0 -1
- package/node_modules/pi-agent-image/runtime/entry-44.js +0 -1
- package/node_modules/pi-agent-resource/runtime/entry-52.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-62.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-63.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-65.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-67.js +0 -1
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-86.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-89.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-31.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +0 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-90.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-47.js +0 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-53.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-62.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-63.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-65.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-84.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-67.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-36.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +0 -1
- /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-jq}/runtime/entry-34.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-40.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-42.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-43.js +0 -0
- /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-45.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-46.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-47.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-53.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-57.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-61.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-84.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-85.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-87.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-90.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-91.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-92.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-93.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-jq}/runtime/entry-34.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-35.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-91.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-92.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-93.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-85.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-40.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-41.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-42.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-43.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,82 +8,82 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./api/anchor-inspection": {
|
|
10
10
|
"types": "./src/api/anchor-inspection.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-68.js"
|
|
12
12
|
},
|
|
13
13
|
"./api/connect-plugin": {
|
|
14
14
|
"types": "./src/api/connect-plugin.ts",
|
|
15
|
-
"default": "./runtime/entry-
|
|
15
|
+
"default": "./runtime/entry-69.js"
|
|
16
16
|
},
|
|
17
17
|
"./api/edit-completion": {
|
|
18
18
|
"types": "./src/api/edit-completion.ts",
|
|
19
|
-
"default": "./runtime/entry-
|
|
19
|
+
"default": "./runtime/entry-70.js"
|
|
20
20
|
},
|
|
21
21
|
"./api/edit-pipeline": {
|
|
22
22
|
"types": "./src/api/edit-pipeline.ts",
|
|
23
|
-
"default": "./runtime/entry-
|
|
23
|
+
"default": "./runtime/entry-71.js"
|
|
24
24
|
},
|
|
25
25
|
"./api/plugin-protocol": {
|
|
26
26
|
"types": "./src/api/plugin-protocol.ts",
|
|
27
|
-
"default": "./runtime/entry-
|
|
27
|
+
"default": "./runtime/entry-72.js"
|
|
28
28
|
},
|
|
29
29
|
"./api/stale-anchor-message": {
|
|
30
30
|
"types": "./src/api/stale-anchor-message.ts",
|
|
31
|
-
"default": "./runtime/entry-
|
|
31
|
+
"default": "./runtime/entry-73.js"
|
|
32
32
|
},
|
|
33
33
|
"./api/text-selection-anchor": {
|
|
34
34
|
"types": "./src/api/text-selection-anchor.ts",
|
|
35
|
-
"default": "./runtime/entry-
|
|
35
|
+
"default": "./runtime/entry-74.js"
|
|
36
36
|
},
|
|
37
37
|
"./api/post-edit": {
|
|
38
38
|
"types": "./src/api/post-edit.ts",
|
|
39
|
-
"default": "./runtime/entry-
|
|
39
|
+
"default": "./runtime/entry-75.js"
|
|
40
40
|
},
|
|
41
41
|
"./api/native-edit-batch-event": {
|
|
42
42
|
"types": "./src/api/native-edit-batch-event.ts",
|
|
43
|
-
"default": "./runtime/entry-
|
|
43
|
+
"default": "./runtime/entry-76.js"
|
|
44
44
|
},
|
|
45
45
|
"./api/mutation-result": {
|
|
46
46
|
"types": "./src/api/mutation-result.ts",
|
|
47
|
-
"default": "./runtime/entry-
|
|
47
|
+
"default": "./runtime/entry-77.js"
|
|
48
48
|
},
|
|
49
49
|
"./api/mutation-guard": {
|
|
50
50
|
"types": "./src/api/mutation-guard.ts",
|
|
51
|
-
"default": "./runtime/entry-
|
|
51
|
+
"default": "./runtime/entry-78.js"
|
|
52
52
|
},
|
|
53
53
|
"./api/mutation-tool": {
|
|
54
54
|
"types": "./src/api/mutation-tool.ts",
|
|
55
|
-
"default": "./runtime/entry-
|
|
55
|
+
"default": "./runtime/entry-79.js"
|
|
56
56
|
},
|
|
57
57
|
"./api/mutation-preview": {
|
|
58
58
|
"types": "./src/api/mutation-preview.ts",
|
|
59
|
-
"default": "./runtime/entry-
|
|
59
|
+
"default": "./runtime/entry-80.js"
|
|
60
60
|
},
|
|
61
61
|
"./api/last-resolved-resource": {
|
|
62
62
|
"types": "./src/api/last-resolved-resource.ts",
|
|
63
|
-
"default": "./runtime/entry-
|
|
63
|
+
"default": "./runtime/entry-81.js"
|
|
64
64
|
},
|
|
65
65
|
"./api/tool-call-interceptor": {
|
|
66
66
|
"types": "./src/api/tool-call-interceptor.ts",
|
|
67
|
-
"default": "./runtime/entry-
|
|
67
|
+
"default": "./runtime/entry-82.js"
|
|
68
68
|
},
|
|
69
69
|
"./api/tool-renderer": {
|
|
70
70
|
"types": "./src/api/tool-renderer.ts",
|
|
71
|
-
"default": "./runtime/entry-
|
|
71
|
+
"default": "./runtime/entry-83.js"
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"pi-agent-documentation": "0.9.
|
|
76
|
-
"pi-agent-invariant": "0.9.
|
|
77
|
-
"pi-agent-read": "0.9.
|
|
78
|
-
"pi-agent-resource": "0.9.
|
|
79
|
-
"pi-agent-search": "0.9.
|
|
80
|
-
"pi-agent-text": "0.9.
|
|
81
|
-
"pi-agent-tool-call-interception": "0.9.
|
|
82
|
-
"pi-agent-tool-ui": "0.9.
|
|
75
|
+
"pi-agent-documentation": "0.9.2",
|
|
76
|
+
"pi-agent-invariant": "0.9.2",
|
|
77
|
+
"pi-agent-read": "0.9.2",
|
|
78
|
+
"pi-agent-resource": "0.9.2",
|
|
79
|
+
"pi-agent-search": "0.9.2",
|
|
80
|
+
"pi-agent-text": "0.9.2",
|
|
81
|
+
"pi-agent-tool-call-interception": "0.9.2",
|
|
82
|
+
"pi-agent-tool-ui": "0.9.2"
|
|
83
83
|
},
|
|
84
84
|
"pi": {
|
|
85
85
|
"extensions": [
|
|
86
|
-
"./runtime/entry-
|
|
86
|
+
"./runtime/entry-84.js"
|
|
87
87
|
]
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-constant",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-text": "0.9.
|
|
10
|
-
"pi-agent-text-editor": "0.9.
|
|
9
|
+
"pi-agent-text": "0.9.2",
|
|
10
|
+
"pi-agent-text-editor": "0.9.2"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
14
|
-
"./runtime/entry-
|
|
14
|
+
"./runtime/entry-63.js"
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-exact",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./api/anchor": {
|
|
10
10
|
"types": "./src/anchor.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-64.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-text": "0.9.
|
|
16
|
-
"pi-agent-text-editor": "0.9.
|
|
15
|
+
"pi-agent-text": "0.9.2",
|
|
16
|
+
"pi-agent-text-editor": "0.9.2"
|
|
17
17
|
},
|
|
18
18
|
"pi": {
|
|
19
19
|
"extensions": [
|
|
20
|
-
"./runtime/entry-
|
|
20
|
+
"./runtime/entry-65.js"
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-anchor-line-hash",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"./api/anchor": {
|
|
10
10
|
"types": "./src/anchor.ts",
|
|
11
|
-
"default": "./runtime/entry-
|
|
11
|
+
"default": "./runtime/entry-66.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-invariant": "0.9.
|
|
16
|
-
"pi-agent-read": "0.9.
|
|
17
|
-
"pi-agent-text": "0.9.
|
|
18
|
-
"pi-agent-text-editor": "0.9.
|
|
15
|
+
"pi-agent-invariant": "0.9.2",
|
|
16
|
+
"pi-agent-read": "0.9.2",
|
|
17
|
+
"pi-agent-text": "0.9.2",
|
|
18
|
+
"pi-agent-text-editor": "0.9.2"
|
|
19
19
|
},
|
|
20
20
|
"pi": {
|
|
21
21
|
"extensions": [
|
|
22
|
-
"./runtime/entry-
|
|
22
|
+
"./runtime/entry-67.js"
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-renderer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-invariant": "0.9.
|
|
10
|
-
"pi-agent-text-editor": "0.9.
|
|
11
|
-
"pi-agent-tool-call-interception": "0.9.
|
|
12
|
-
"pi-agent-tool-ui": "0.9.
|
|
9
|
+
"pi-agent-invariant": "0.9.2",
|
|
10
|
+
"pi-agent-text-editor": "0.9.2",
|
|
11
|
+
"pi-agent-tool-call-interception": "0.9.2",
|
|
12
|
+
"pi-agent-tool-ui": "0.9.2"
|
|
13
13
|
},
|
|
14
14
|
"pi": {
|
|
15
15
|
"extensions": [
|
|
16
|
-
"./runtime/entry-
|
|
16
|
+
"./runtime/entry-85.js"
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text-editor-stale-anchor",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-invariant": "0.9.
|
|
7
|
-
"pi-agent-read": "0.9.
|
|
8
|
-
"pi-agent-resource": "0.9.
|
|
9
|
-
"pi-agent-text-editor": "0.9.
|
|
6
|
+
"pi-agent-invariant": "0.9.2",
|
|
7
|
+
"pi-agent-read": "0.9.2",
|
|
8
|
+
"pi-agent-resource": "0.9.2",
|
|
9
|
+
"pi-agent-text-editor": "0.9.2"
|
|
10
10
|
},
|
|
11
11
|
"pi": {
|
|
12
12
|
"extensions": [
|
|
13
|
-
"./runtime/entry-
|
|
13
|
+
"./runtime/entry-86.js"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
@@ -5,11 +5,7 @@ import type {
|
|
|
5
5
|
TextMutationEdit,
|
|
6
6
|
} from "#src/api/mutation-tool.js";
|
|
7
7
|
import { TextChangeDocument, type TextChange } from "./text-change-engine.js";
|
|
8
|
-
import {
|
|
9
|
-
anchorSpanRange,
|
|
10
|
-
insertionAfterAnchor,
|
|
11
|
-
replaceAnchorSpan,
|
|
12
|
-
} from "#src/tools/text-selection.js";
|
|
8
|
+
import { anchorSpanRange, insertionAfterAnchor } from "#src/tools/text-selection.js";
|
|
13
9
|
import { wholeFileResultSource } from "./result-input.js";
|
|
14
10
|
|
|
15
11
|
/** Distinguish structured source authority from ordinary paths and legacy anchors. */
|
|
@@ -176,7 +172,7 @@ export async function prepareResultTransfer(
|
|
|
176
172
|
);
|
|
177
173
|
planned.push({
|
|
178
174
|
target,
|
|
179
|
-
change:
|
|
175
|
+
change: { from: target.from, to: target.to, insert: copied },
|
|
180
176
|
});
|
|
181
177
|
}
|
|
182
178
|
}
|
|
@@ -80,13 +80,21 @@ export class TextChangeDocument {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
public deleteLines(firstLine: number, lastLine: number): TextChange {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (range.to === this.content.length && range.from > 0 && !endsWithLineBreak(this.content)) {
|
|
86
|
-
return { from: previousLineBreakStart(this.content, range.from), to: range.to, insert: "" };
|
|
87
|
-
}
|
|
83
|
+
return this.replaceLines(firstLine, lastLine, "");
|
|
84
|
+
}
|
|
88
85
|
|
|
89
|
-
|
|
86
|
+
/** Insert at a character boundary; separators are added only when requested. */
|
|
87
|
+
public insertAt(from: number, text: string, separation?: LineSeparation): TextChange {
|
|
88
|
+
this.#assertRange({ from, to: from });
|
|
89
|
+
if (text.length === 0) throw new Error("Insert text must not be empty.");
|
|
90
|
+
if (separation === undefined) return { from, to: from, insert: text };
|
|
91
|
+
const prefix =
|
|
92
|
+
from > 0 && !endsWithLineBreak(this.content.slice(0, from)) ? this.#separator : "";
|
|
93
|
+
return {
|
|
94
|
+
from,
|
|
95
|
+
to: from,
|
|
96
|
+
insert: this.#lineInsertion(from, text, separation, from < this.content.length, prefix),
|
|
97
|
+
};
|
|
90
98
|
}
|
|
91
99
|
|
|
92
100
|
public insertBeforeLine(
|
|
@@ -94,13 +102,7 @@ export class TextChangeDocument {
|
|
|
94
102
|
text: string,
|
|
95
103
|
separation: LineSeparation = "line",
|
|
96
104
|
): TextChange {
|
|
97
|
-
this
|
|
98
|
-
const from = requiredValue(this.#lineStarts[lineNumber - 1]);
|
|
99
|
-
return {
|
|
100
|
-
from,
|
|
101
|
-
to: from,
|
|
102
|
-
insert: this.#lineInsertion(from, text, separation, from < this.content.length),
|
|
103
|
-
};
|
|
105
|
+
return this.insertAt(this.lineRange(lineNumber, lineNumber).from, text, separation);
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
public insertAfterLine(
|
|
@@ -108,24 +110,7 @@ export class TextChangeDocument {
|
|
|
108
110
|
text: string,
|
|
109
111
|
separation: LineSeparation = "line",
|
|
110
112
|
): TextChange {
|
|
111
|
-
this
|
|
112
|
-
const nextLine = this.#lineStarts[lineNumber];
|
|
113
|
-
|
|
114
|
-
if (nextLine !== undefined) {
|
|
115
|
-
return {
|
|
116
|
-
from: nextLine,
|
|
117
|
-
to: nextLine,
|
|
118
|
-
insert: this.#lineInsertion(nextLine, text, separation, nextLine < this.content.length),
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const prefix =
|
|
123
|
-
this.content.length > 0 && !endsWithLineBreak(this.content) ? this.#separator : "";
|
|
124
|
-
return {
|
|
125
|
-
from: this.content.length,
|
|
126
|
-
to: this.content.length,
|
|
127
|
-
insert: this.#lineInsertion(this.content.length, text, separation, false, prefix),
|
|
128
|
-
};
|
|
113
|
+
return this.insertAt(this.lineRange(lineNumber, lineNumber).to, text, separation);
|
|
129
114
|
}
|
|
130
115
|
|
|
131
116
|
public replaceAll(text: string): TextChange {
|
|
@@ -134,7 +119,7 @@ export class TextChangeDocument {
|
|
|
134
119
|
|
|
135
120
|
#replacementText(range: TextRange, text: string): string {
|
|
136
121
|
const selected = this.text(range);
|
|
137
|
-
return endsWithLineBreak(selected) && !endsWithLineBreak(text)
|
|
122
|
+
return text.length > 0 && endsWithLineBreak(selected) && !endsWithLineBreak(text)
|
|
138
123
|
? text + requiredValue(lineBreakOf(selected))
|
|
139
124
|
: text;
|
|
140
125
|
}
|
|
@@ -290,7 +275,3 @@ function endsWithLineBreak(text: string): boolean {
|
|
|
290
275
|
function lineBreakOf(text: string): "\n" | "\r\n" | undefined {
|
|
291
276
|
return text.endsWith("\r\n") ? "\r\n" : text.endsWith("\n") ? "\n" : undefined;
|
|
292
277
|
}
|
|
293
|
-
|
|
294
|
-
function previousLineBreakStart(text: string, offset: number): number {
|
|
295
|
-
return text[offset - 2] === "\r" && text[offset - 1] === "\n" ? offset - 2 : offset - 1;
|
|
296
|
-
}
|
|
@@ -39,10 +39,6 @@ export interface TextAnchorSpan {
|
|
|
39
39
|
readonly to: number;
|
|
40
40
|
readonly selection: boolean;
|
|
41
41
|
readonly preservesTrailingLineBreak: boolean;
|
|
42
|
-
/** First selected line when this span represents whole lines. */
|
|
43
|
-
readonly linewiseStartLine?: number;
|
|
44
|
-
/** Last selected line when this span represents whole lines. */
|
|
45
|
-
readonly linewiseEndLine?: number;
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
/** Resolves one anchor to one character span, converting line anchors to whole-line spans. */
|
|
@@ -50,7 +46,6 @@ export function singleAnchorSpan(
|
|
|
50
46
|
context: TextMutationContext,
|
|
51
47
|
anchors: ReadonlyMap<string, TextAnchor>,
|
|
52
48
|
field: string,
|
|
53
|
-
wholeLines = false,
|
|
54
49
|
rangeEndpoint = false,
|
|
55
50
|
): TextAnchorSpan {
|
|
56
51
|
if (anchors.size !== 1) {
|
|
@@ -67,9 +62,7 @@ export function singleAnchorSpan(
|
|
|
67
62
|
);
|
|
68
63
|
const document = context.documentFor(source);
|
|
69
64
|
const exactRange = selectionRange(context, source, selectedRange);
|
|
70
|
-
const endLine =
|
|
71
|
-
? containingEndLine(selectedRange)
|
|
72
|
-
: linewiseSelectionEndLine(selectedRange);
|
|
65
|
+
const endLine = linewiseSelectionEndLine(selectedRange);
|
|
73
66
|
if (endLine !== undefined) {
|
|
74
67
|
const range = document.lineRange(selectedRange.start.lineNumber, endLine);
|
|
75
68
|
return {
|
|
@@ -77,8 +70,6 @@ export function singleAnchorSpan(
|
|
|
77
70
|
...range,
|
|
78
71
|
selection: false,
|
|
79
72
|
preservesTrailingLineBreak: true,
|
|
80
|
-
linewiseStartLine: selectedRange.start.lineNumber,
|
|
81
|
-
linewiseEndLine: endLine,
|
|
82
73
|
};
|
|
83
74
|
}
|
|
84
75
|
return { source, ...exactRange, selection: true, preservesTrailingLineBreak: false };
|
|
@@ -90,29 +81,9 @@ export function singleAnchorSpan(
|
|
|
90
81
|
...range,
|
|
91
82
|
selection: false,
|
|
92
83
|
preservesTrailingLineBreak: true,
|
|
93
|
-
linewiseStartLine: anchor.lineNumber,
|
|
94
|
-
linewiseEndLine: anchor.lineNumber,
|
|
95
84
|
};
|
|
96
85
|
}
|
|
97
86
|
|
|
98
|
-
/**
|
|
99
|
-
* Text to transfer into a destination. A whole-line literal source selects its line, but an
|
|
100
|
-
* exact character destination receives the literal itself, so no extra line break is added.
|
|
101
|
-
*/
|
|
102
|
-
export function transferText(
|
|
103
|
-
context: TextMutationContext,
|
|
104
|
-
starts: ReadonlyMap<string, TextAnchor>,
|
|
105
|
-
ends: ReadonlyMap<string, TextAnchor> | undefined,
|
|
106
|
-
sourceSpan: TextAnchorSpan,
|
|
107
|
-
targetSpan: TextAnchorSpan | undefined,
|
|
108
|
-
): string {
|
|
109
|
-
const span =
|
|
110
|
-
ends === undefined && targetSpan?.selection === true && !sourceSpan.selection
|
|
111
|
-
? singleAnchorSpan(context, starts, "start", false, true)
|
|
112
|
-
: sourceSpan;
|
|
113
|
-
return context.documentFor(span.source).text(span);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
87
|
/** Whether an endpoint selects complete lines: a line anchor or text matching a whole line. */
|
|
117
88
|
function selectsWholeLines(anchors: ReadonlyMap<string, TextAnchor>): boolean {
|
|
118
89
|
const anchor = anchors.values().next().value;
|
|
@@ -134,8 +105,8 @@ export function anchorSpanRange(
|
|
|
134
105
|
): TextAnchorSpan {
|
|
135
106
|
if (ends === undefined) return singleAnchorSpan(context, starts, startField);
|
|
136
107
|
const exactEndpoints = !(selectsWholeLines(starts) && selectsWholeLines(ends));
|
|
137
|
-
const start = singleAnchorSpan(context, starts, startField,
|
|
138
|
-
const end = singleAnchorSpan(context, ends, endField,
|
|
108
|
+
const start = singleAnchorSpan(context, starts, startField, exactEndpoints);
|
|
109
|
+
const end = singleAnchorSpan(context, ends, endField, exactEndpoints);
|
|
139
110
|
if (start.source !== end.source) {
|
|
140
111
|
throw new Error(`Anchors ${startField} and ${endField} must resolve in one resource.`);
|
|
141
112
|
}
|
|
@@ -163,7 +134,7 @@ export function replaceAnchorSpan(
|
|
|
163
134
|
span: TextAnchorSpan,
|
|
164
135
|
text: string,
|
|
165
136
|
): { readonly from: number; readonly to: number; readonly insert: string } {
|
|
166
|
-
if (text === "") return deleteAnchorSpan(
|
|
137
|
+
if (text === "") return deleteAnchorSpan(span);
|
|
167
138
|
const document = context.documentFor(span.source);
|
|
168
139
|
let insert = targetText(context, span.source, text);
|
|
169
140
|
const selected = document.text(span);
|
|
@@ -176,28 +147,32 @@ export function replaceAnchorSpan(
|
|
|
176
147
|
return { from: span.from, to: span.to, insert };
|
|
177
148
|
}
|
|
178
149
|
|
|
179
|
-
/**
|
|
180
|
-
export function deleteAnchorSpan(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (
|
|
186
|
-
!span.selection &&
|
|
187
|
-
span.to === content.length &&
|
|
188
|
-
span.from > 0 &&
|
|
189
|
-
!/(?:\r\n|\r|\n)$/u.test(content)
|
|
190
|
-
) {
|
|
191
|
-
const prefix = content.slice(0, span.from);
|
|
192
|
-
const match = /(?:\r\n|\r|\n)$/u.exec(prefix);
|
|
193
|
-
if (match !== null) {
|
|
194
|
-
return { from: span.from - match[0].length, to: span.to, insert: "" };
|
|
195
|
-
}
|
|
196
|
-
}
|
|
150
|
+
/** Deletes exactly the resolved extent, including only its own line separator. */
|
|
151
|
+
export function deleteAnchorSpan(span: TextAnchorSpan): {
|
|
152
|
+
readonly from: number;
|
|
153
|
+
readonly to: number;
|
|
154
|
+
readonly insert: "";
|
|
155
|
+
} {
|
|
197
156
|
return { from: span.from, to: span.to, insert: "" };
|
|
198
157
|
}
|
|
199
158
|
|
|
200
|
-
|
|
159
|
+
function insertionAtSpan(
|
|
160
|
+
context: TextMutationContext,
|
|
161
|
+
span: Pick<TextAnchorSpan, "source" | "from" | "to" | "selection">,
|
|
162
|
+
insert: string,
|
|
163
|
+
before: boolean,
|
|
164
|
+
separation: "line" | "blank-line",
|
|
165
|
+
) {
|
|
166
|
+
return context
|
|
167
|
+
.documentFor(span.source)
|
|
168
|
+
.insertAt(
|
|
169
|
+
before ? span.from : span.to,
|
|
170
|
+
insert,
|
|
171
|
+
!span.selection || separation === "blank-line" ? separation : undefined,
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Inserts transferred text after the resolved selection without normalizing its bytes. */
|
|
201
176
|
export function insertionAfterAnchor(
|
|
202
177
|
context: TextMutationContext,
|
|
203
178
|
anchors: ReadonlyMap<string, TextAnchor>,
|
|
@@ -205,17 +180,11 @@ export function insertionAfterAnchor(
|
|
|
205
180
|
insert: string,
|
|
206
181
|
separation: "line" | "blank-line" = "line",
|
|
207
182
|
): readonly [string, { readonly from: number; readonly to: number; readonly insert: string }] {
|
|
208
|
-
const span = singleAnchorSpan(context, anchors, field
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const lineNumber = span.linewiseEndLine ?? lineAnchor(anchors, field).lineNumber;
|
|
212
|
-
return [
|
|
213
|
-
span.source,
|
|
214
|
-
context.documentFor(span.source).insertAfterLine(lineNumber, normalizedInsert, separation),
|
|
215
|
-
];
|
|
183
|
+
const span = singleAnchorSpan(context, anchors, field);
|
|
184
|
+
return [span.source, insertionAtSpan(context, span, insert, false, separation)];
|
|
216
185
|
}
|
|
217
186
|
|
|
218
|
-
/** Inserts before the
|
|
187
|
+
/** Inserts transferred text before the resolved selection without normalizing its bytes. */
|
|
219
188
|
export function insertionBeforeAnchor(
|
|
220
189
|
context: TextMutationContext,
|
|
221
190
|
anchors: ReadonlyMap<string, TextAnchor>,
|
|
@@ -223,14 +192,8 @@ export function insertionBeforeAnchor(
|
|
|
223
192
|
insert: string,
|
|
224
193
|
separation: "line" | "blank-line" = "line",
|
|
225
194
|
): readonly [string, { readonly from: number; readonly to: number; readonly insert: string }] {
|
|
226
|
-
const span = singleAnchorSpan(context, anchors, field
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const lineNumber = span.linewiseStartLine ?? lineAnchor(anchors, field).lineNumber;
|
|
230
|
-
return [
|
|
231
|
-
span.source,
|
|
232
|
-
context.documentFor(span.source).insertBeforeLine(lineNumber, normalizedInsert, separation),
|
|
233
|
-
];
|
|
195
|
+
const span = singleAnchorSpan(context, anchors, field);
|
|
196
|
+
return [span.source, insertionAtSpan(context, span, insert, true, separation)];
|
|
234
197
|
}
|
|
235
198
|
|
|
236
199
|
function coalesceAdjacentLinewiseRanges(
|
|
@@ -297,20 +260,15 @@ export function insertionChanges(
|
|
|
297
260
|
return new Map(
|
|
298
261
|
[...selections].map(([source, anchor]) => [
|
|
299
262
|
source,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
263
|
+
anchor.ranges.map((range) =>
|
|
264
|
+
insertionAtSpan(
|
|
265
|
+
context,
|
|
266
|
+
{ source, ...selectionRange(context, source, range), selection: range.linewise !== true },
|
|
267
|
+
targetText(context, source, insert),
|
|
268
|
+
before,
|
|
269
|
+
separation,
|
|
306
270
|
),
|
|
307
|
-
|
|
308
|
-
const document = context.documentFor(source);
|
|
309
|
-
const normalizedInsert = targetText(context, source, insert);
|
|
310
|
-
return before
|
|
311
|
-
? document.insertBeforeLine(line, normalizedInsert, separation)
|
|
312
|
-
: document.insertAfterLine(line, normalizedInsert, separation);
|
|
313
|
-
}),
|
|
271
|
+
),
|
|
314
272
|
]),
|
|
315
273
|
);
|
|
316
274
|
}
|
|
@@ -40,7 +40,7 @@ export function targetProperties(directorySemantics: string) {
|
|
|
40
40
|
targetStart: Type.Optional(
|
|
41
41
|
Type.String({
|
|
42
42
|
description:
|
|
43
|
-
"Anchor or unique exact text in the destination file; the text goes after its
|
|
43
|
+
"Anchor or unique exact text in the destination file; the text goes after its selected extent. Required when the text goes into a file path.",
|
|
44
44
|
}),
|
|
45
45
|
),
|
|
46
46
|
targetEnd: Type.Optional(
|
|
@@ -7,12 +7,7 @@ import {
|
|
|
7
7
|
} from "#src/tools/text-tool-schema-properties.js";
|
|
8
8
|
|
|
9
9
|
import { TEXT_POSITION_ANCHOR_KIND, TEXT_SEARCH_ANCHOR_KIND } from "#src/api/plugin-protocol.js";
|
|
10
|
-
import {
|
|
11
|
-
anchorSpanRange,
|
|
12
|
-
transferText,
|
|
13
|
-
insertionAfterAnchor,
|
|
14
|
-
replaceAnchorSpan,
|
|
15
|
-
} from "#src/tools/text-selection.js";
|
|
10
|
+
import { anchorSpanRange, insertionAfterAnchor } from "#src/tools/text-selection.js";
|
|
16
11
|
|
|
17
12
|
import type { TextMutationToolRegistration } from "#src/api/mutation-tool.js";
|
|
18
13
|
|
|
@@ -74,10 +69,10 @@ export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> =
|
|
|
74
69
|
const starts = await context.resolveAnchors("start");
|
|
75
70
|
const ends = parameters.end === undefined ? undefined : await context.resolveAnchors("end");
|
|
76
71
|
const sourceSpan = anchorSpanRange(context, starts, ends, "start", "end");
|
|
72
|
+
const copied = context.documentFor(sourceSpan.source).text(sourceSpan);
|
|
77
73
|
|
|
78
74
|
const targetStarts = await context.resolveAnchors("targetStart");
|
|
79
75
|
if (parameters.targetEnd === undefined) {
|
|
80
|
-
const copied = context.documentFor(sourceSpan.source).text(sourceSpan);
|
|
81
76
|
const [target, change] = insertionAfterAnchor(context, targetStarts, "targetStart", copied);
|
|
82
77
|
return {
|
|
83
78
|
edits: new Map([
|
|
@@ -94,13 +89,14 @@ export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> =
|
|
|
94
89
|
"targetStart",
|
|
95
90
|
"targetEnd",
|
|
96
91
|
);
|
|
97
|
-
const copied = transferText(context, starts, ends, sourceSpan, targetSpan);
|
|
98
92
|
return {
|
|
99
93
|
edits: new Map([
|
|
100
94
|
[
|
|
101
95
|
targetSpan.source,
|
|
102
96
|
{
|
|
103
|
-
changes: [
|
|
97
|
+
changes: [
|
|
98
|
+
{ from: targetSpan.from, to: targetSpan.to, insert: copied, allowUnchanged: true },
|
|
99
|
+
],
|
|
104
100
|
action: "edited",
|
|
105
101
|
},
|
|
106
102
|
],
|