pi-agent-ide 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +11 -5
- package/dist/chunk-266RH77Z.js +1 -0
- package/dist/chunk-2SKAED2I.js +2 -0
- package/dist/chunk-2ZMYT6ZC.js +1 -0
- package/dist/chunk-34ZQTTU2.js +2 -0
- package/dist/chunk-3H2EU7VQ.js +0 -0
- package/dist/chunk-3YK4XMWB.js +0 -0
- package/dist/chunk-476MR2QB.js +1 -0
- package/dist/chunk-4KQOODGE.js +13 -0
- package/dist/chunk-4SQQKEVD.js +16 -0
- package/dist/chunk-52BM6J6I.js +6 -0
- package/dist/chunk-5A25RATC.js +3 -0
- package/dist/chunk-5BWUVAR4.js +1 -0
- package/dist/chunk-6DN7NO7L.js +1 -0
- package/dist/chunk-6SMFVLTY.js +1 -0
- package/dist/chunk-7NDBZ4WX.js +1 -0
- package/dist/chunk-AP7Z3VWC.js +1 -0
- package/dist/chunk-BYWAG6X3.js +6 -0
- package/dist/chunk-DEP55R35.js +1 -0
- package/dist/chunk-E2RESHYR.js +1 -0
- package/dist/chunk-E4SECPF4.js +1 -0
- package/dist/chunk-EEH4WYI7.js +1 -0
- package/dist/chunk-EI7MMDWY.js +1 -0
- package/dist/chunk-ERVMDQGX.js +1 -0
- package/dist/chunk-EW2KVKCN.js +2 -0
- package/dist/chunk-F6SESI3P.js +4 -0
- package/dist/chunk-GTK5AREE.js +2 -0
- package/dist/chunk-HOBTFFQR.js +1 -0
- package/dist/chunk-IMVCVPMP.js +3 -0
- package/dist/chunk-IOCABSRL.js +1 -0
- package/dist/chunk-JASLOB2X.js +1 -0
- package/dist/chunk-JMVDFOTQ.js +1 -0
- package/dist/chunk-K4ZMRDEI.js +0 -0
- package/dist/chunk-KINKBPPX.js +1 -0
- package/dist/chunk-KNMWCDDK.js +7 -0
- package/dist/chunk-KP37XTDI.js +1 -0
- package/dist/chunk-KYVOMBO5.js +1 -0
- package/dist/chunk-KZBAJFCV.js +1 -0
- package/dist/chunk-LFV6G5Z3.js +1 -0
- package/dist/chunk-MB6VVVAF.js +2 -0
- package/dist/chunk-MBUXFKIW.js +3 -0
- package/dist/chunk-MTTKFJV6.js +1 -0
- package/dist/chunk-NI2NK4JU.js +1 -0
- package/dist/chunk-NNCZYO4Q.js +0 -0
- package/dist/chunk-OBWZ5RYN.js +1 -0
- package/dist/chunk-OIL6BB2S.js +33 -0
- package/dist/chunk-ORAPGW7W.js +1 -0
- package/dist/chunk-OVUYPHDE.js +1 -0
- package/dist/chunk-PETQCA7G.js +1 -0
- package/dist/chunk-PODWLGNO.js +6 -0
- package/dist/chunk-QNZVPFSP.js +3 -0
- package/dist/chunk-QW5O42QJ.js +2 -0
- package/dist/chunk-SJYDLHEF.js +108 -0
- package/dist/chunk-SSZB66C3.js +3 -0
- package/dist/chunk-STUZZM5B.js +1 -0
- package/dist/chunk-T2RPMEM2.js +1 -0
- package/dist/chunk-TG6H6EOI.js +1 -0
- package/dist/chunk-TNWYEXFG.js +1 -0
- package/dist/chunk-U4D6FT66.js +1 -0
- package/dist/chunk-VCCMVQXU.js +1 -0
- package/dist/chunk-VFBLX4TG.js +1 -0
- package/dist/chunk-VSP2QQPQ.js +2 -0
- package/dist/chunk-VUNCBASK.js +10 -0
- package/dist/chunk-VWVLBOMU.js +8 -0
- package/dist/chunk-W3XYKJ5H.js +1 -0
- package/dist/chunk-XGUAL3CA.js +1 -0
- package/dist/chunk-XNXQYPVT.js +10 -0
- package/dist/chunk-YHUTTZC6.js +2 -0
- package/dist/chunk-YPHXLAQF.js +1 -0
- package/dist/chunk-YQTLJ5ZV.js +58 -0
- package/dist/chunk-ZC65Z3CK.js +1 -0
- package/dist/entry-0.js +1 -0
- package/dist/entry-1.js +1 -0
- package/dist/entry-10.js +1 -0
- package/dist/entry-11.js +1 -0
- package/dist/entry-12.js +1 -0
- package/dist/entry-13.js +1 -0
- package/dist/entry-14.js +1 -0
- package/dist/entry-16.js +1 -0
- package/dist/entry-17.js +1 -0
- package/dist/entry-18.js +1 -0
- package/dist/entry-19.js +1 -0
- package/dist/entry-2.js +1 -0
- package/dist/entry-20.js +1 -0
- package/dist/entry-21.js +1 -0
- package/dist/entry-22.js +1 -0
- package/dist/entry-23.js +1 -0
- package/dist/entry-24.js +1 -0
- package/dist/entry-25.js +1 -0
- package/dist/entry-26.js +1 -0
- package/dist/entry-27.js +1 -0
- package/dist/entry-28.js +1 -0
- package/dist/entry-29.js +1 -0
- package/dist/entry-3.js +1 -0
- package/dist/entry-30.js +1 -0
- package/dist/entry-31.js +1 -0
- package/dist/entry-32.js +1 -0
- package/dist/entry-33.js +1 -0
- package/dist/entry-34.js +1 -0
- package/dist/entry-35.js +1 -0
- package/dist/entry-36.js +1 -0
- package/dist/entry-37.js +1 -0
- package/dist/entry-38.js +1 -0
- package/dist/entry-39.js +1 -0
- package/dist/entry-4.js +1 -0
- package/dist/entry-40.js +1 -0
- package/dist/entry-41.js +1 -0
- package/dist/entry-42.js +1 -0
- package/dist/entry-43.js +1 -0
- package/dist/entry-44.js +1 -0
- package/dist/entry-45.js +1 -0
- package/dist/entry-46.js +1 -0
- package/dist/entry-47.js +1 -0
- package/dist/entry-48.js +1 -0
- package/dist/entry-49.js +1 -0
- package/dist/entry-5.js +1 -0
- package/dist/entry-50.js +1 -0
- package/dist/entry-51.js +1 -0
- package/dist/entry-52.js +1 -0
- package/dist/entry-53.js +0 -0
- package/dist/entry-54.js +1 -0
- package/dist/entry-55.js +0 -0
- package/dist/entry-56.js +1 -0
- package/dist/entry-57.js +1 -0
- package/dist/entry-58.js +1 -0
- package/dist/entry-59.js +1 -0
- package/dist/entry-6.js +1 -0
- package/dist/entry-60.js +1 -0
- package/dist/entry-61.js +1 -0
- package/dist/entry-62.js +0 -0
- package/dist/entry-63.js +1 -0
- package/dist/entry-64.js +0 -0
- package/dist/entry-65.js +1 -0
- package/dist/entry-66.js +1 -0
- package/dist/entry-67.js +1 -0
- package/dist/entry-68.js +1 -0
- package/dist/entry-69.js +1 -0
- package/dist/entry-7.js +1 -0
- package/dist/entry-70.js +1 -0
- package/dist/entry-71.js +1 -0
- package/dist/entry-72.js +1 -0
- package/dist/entry-73.js +1 -0
- package/dist/entry-74.js +1 -0
- package/dist/entry-75.js +1 -0
- package/dist/entry-76.js +1 -0
- package/dist/entry-77.js +1 -0
- package/dist/entry-78.js +1 -0
- package/dist/entry-79.js +1 -0
- package/dist/entry-8.js +1 -0
- package/dist/entry-9.js +1 -0
- package/dist/pi-agent-ide.js +13 -0
- package/docs/architecture.md +21 -17
- package/docs/configuration.md +149 -52
- package/docs/development.md +105 -5
- package/docs/extensions.md +64 -4
- package/docs/generated/tool-catalog/css.md +7 -6
- package/docs/generated/tool-catalog/html.md +6 -5
- package/docs/generated/tool-catalog/javascript.md +8 -6
- package/docs/generated/tool-catalog/json.md +7 -6
- package/docs/generated/tool-catalog/markdown.md +6 -5
- package/docs/generated/tool-catalog/toml.md +6 -5
- package/docs/generated/tool-catalog/typescript.md +8 -6
- package/docs/generated/tool-catalog/yaml.md +6 -5
- package/docs/tools.md +88 -6
- package/node_modules/pi-agent-doctor/package.json +8 -5
- package/node_modules/pi-agent-doctor/runtime/entry-16.js +1 -0
- package/node_modules/pi-agent-doctor/runtime/entry-17.js +1 -0
- package/node_modules/pi-agent-doctor/runtime/entry-18.js +1 -0
- package/node_modules/pi-agent-doctor/runtime/entry-19.js +1 -0
- package/node_modules/pi-agent-doctor/src/executable.ts +33 -0
- package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +30 -4
- package/node_modules/pi-agent-filesystem/index.ts +4 -3
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem/runtime/entry-20.js +2 -0
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-image/runtime/entry-21.js +2 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-22.js +2 -0
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-23.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +11 -10
- package/node_modules/pi-agent-ide-ast/runtime/entry-24.js +1 -0
- package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +2 -0
- package/node_modules/pi-agent-ide-ast/src/api/scope.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +25 -0
- package/node_modules/pi-agent-ide-ast/src/extension.ts +13 -5
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +6 -0
- package/node_modules/pi-agent-ide-changes/index.ts +6 -2
- package/node_modules/pi-agent-ide-changes/package.json +8 -7
- package/node_modules/pi-agent-ide-changes/runtime/entry-26.js +1 -0
- package/node_modules/pi-agent-ide-changes/runtime/entry-27.js +2 -0
- package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +6 -0
- package/node_modules/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
- package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +1 -1
- package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -0
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +1 -1
- package/node_modules/pi-agent-ide-changes/src/doctor-plugin.ts +31 -1
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -0
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +7 -0
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-formatter/runtime/entry-28.js +2 -0
- package/node_modules/pi-agent-ide-formatter/src/catalog.ts +34 -0
- package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +115 -63
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +71 -28
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/runtime/entry-29.js +2 -0
- package/node_modules/pi-agent-ide-lint/index.ts +30 -155
- package/node_modules/pi-agent-ide-lint/package.json +8 -7
- package/node_modules/pi-agent-ide-lint/runtime/entry-30.js +2 -0
- package/node_modules/pi-agent-ide-lint/src/catalog.ts +14 -2
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +60 -4
- package/node_modules/pi-agent-ide-lint/src/diagnostics.ts +3 -1
- package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +115 -64
- package/node_modules/pi-agent-ide-lint/src/registry.ts +72 -27
- package/node_modules/pi-agent-ide-lsp/index.ts +35 -134
- package/node_modules/pi-agent-ide-lsp/package.json +9 -8
- package/node_modules/pi-agent-ide-lsp/runtime/entry-31.js +2 -0
- package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +113 -0
- package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +108 -53
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +94 -27
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +2 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +76 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostics.ts +137 -144
- package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +2 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +9 -32
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +86 -50
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +1 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/types.ts +8 -6
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +5 -5
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-image/runtime/entry-32.js +1 -0
- package/node_modules/pi-agent-invariant/package.json +12 -0
- package/node_modules/pi-agent-invariant/runtime/entry-33.js +1 -0
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-pdf/runtime/entry-34.js +1 -0
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +3 -2
- package/node_modules/pi-agent-read/package.json +11 -9
- package/node_modules/pi-agent-read/runtime/entry-35.js +1 -0
- package/node_modules/pi-agent-read/runtime/entry-36.js +1 -0
- package/node_modules/pi-agent-read/runtime/entry-37.js +1 -0
- package/node_modules/pi-agent-read/runtime/entry-38.js +1 -0
- package/node_modules/pi-agent-read/runtime/entry-39.js +2 -0
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/tools/read.ts +113 -2
- package/node_modules/pi-agent-read/src/core/extension.ts +19 -0
- package/node_modules/pi-agent-read/src/core/read-core.ts +85 -13
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +26 -10
- package/node_modules/pi-agent-read/src/core/tools/read/persisted-result.ts +72 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +102 -12
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +27 -3
- package/node_modules/pi-agent-read/src/core/tools/read/views.ts +29 -0
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +532 -46
- package/node_modules/pi-agent-resource/package.json +5 -2
- package/node_modules/pi-agent-resource/runtime/entry-40.js +1 -0
- package/node_modules/pi-agent-resource/src/content-conversion/content-converter.ts +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-runner.ts +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/validation.ts +1 -1
- package/node_modules/pi-agent-search/package.json +7 -6
- package/node_modules/pi-agent-search/runtime/entry-41.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-42.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-43.js +1 -0
- package/node_modules/pi-agent-search/runtime/entry-44.js +2 -0
- package/node_modules/pi-agent-search/src/api/search.ts +4 -0
- package/node_modules/pi-agent-search/src/core/extension.ts +99 -27
- package/node_modules/pi-agent-search/src/core/search-config.ts +98 -0
- package/node_modules/pi-agent-search/src/core/search-core.ts +32 -28
- package/node_modules/pi-agent-search/src/core/search-timeout.ts +54 -0
- package/node_modules/pi-agent-search-text/index.ts +53 -3
- package/node_modules/pi-agent-search-text/package.json +9 -9
- package/node_modules/pi-agent-search-text/runtime/entry-45.js +2 -0
- package/node_modules/pi-agent-search-text/runtime/entry-46.js +1 -0
- package/node_modules/pi-agent-search-text/src/doctor-plugin.ts +20 -1
- package/node_modules/pi-agent-search-text/src/persisted-result.ts +56 -0
- package/node_modules/pi-agent-search-text/src/resolvers.ts +36 -34
- package/node_modules/pi-agent-search-text/src/search-query.ts +254 -71
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +68 -0
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +71 -117
- package/node_modules/pi-agent-search-text/src/search-result.ts +1 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +276 -110
- package/node_modules/pi-agent-text/package.json +6 -3
- package/node_modules/pi-agent-text/runtime/entry-47.js +1 -0
- package/node_modules/pi-agent-text/src/index.ts +23 -0
- package/node_modules/pi-agent-text/src/stored-text.ts +14 -0
- package/node_modules/pi-agent-text/src/text-anchor.ts +160 -16
- package/node_modules/pi-agent-text/src/text-document.ts +26 -5
- package/node_modules/pi-agent-text/src/text-target.ts +105 -0
- package/node_modules/pi-agent-text-anchor-constant/package.json +7 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-48.js +2 -0
- package/node_modules/pi-agent-text-anchor-constant/src/resolver.ts +6 -0
- package/node_modules/pi-agent-text-anchor-exact/index.ts +34 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +27 -0
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-49.js +1 -0
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-50.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +230 -0
- package/node_modules/pi-agent-text-anchor-exact/src/config.ts +159 -0
- package/node_modules/pi-agent-text-anchor-exact/src/fuzzy-worker.ts +100 -0
- package/node_modules/pi-agent-text-anchor-exact/src/recovery.ts +151 -0
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +8 -2
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +10 -6
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-51.js +1 -0
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-52.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/src/anchor.ts +32 -1
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +20 -12
- package/node_modules/pi-agent-text-editor/package.json +22 -21
- package/node_modules/pi-agent-text-editor/runtime/entry-53.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-54.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-55.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-56.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-57.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-58.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-59.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-60.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-61.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-62.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-63.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-64.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-65.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-66.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-67.js +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-68.js +2 -0
- package/node_modules/pi-agent-text-editor/src/api/anchor-inspection.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +1 -0
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +38 -0
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +30 -15
- package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +10 -13
- package/node_modules/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +12 -5
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +15 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +14 -10
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +3 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +64 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/read-fragment-resolver.ts +83 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +96 -8
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +4 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +194 -35
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +43 -13
- package/node_modules/pi-agent-text-editor/src/core/text-editor-config.ts +95 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +75 -5
- package/node_modules/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +7 -0
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +541 -130
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +5 -9
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/rendering.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +228 -6
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +50 -70
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +25 -26
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +30 -21
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +57 -71
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +30 -27
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -0
- package/node_modules/pi-agent-text-editor-argument-order/package.json +3 -3
- package/node_modules/pi-agent-text-editor-argument-order/runtime/entry-69.js +2 -0
- package/node_modules/pi-agent-text-editor-overwrite/index.ts +1 -1
- package/node_modules/pi-agent-text-editor-overwrite/package.json +4 -3
- package/node_modules/pi-agent-text-editor-overwrite/runtime/entry-70.js +2 -0
- package/node_modules/pi-agent-text-editor-renderer/index.ts +21 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -3
- package/node_modules/pi-agent-text-editor-renderer/runtime/entry-71.js +2 -0
- package/node_modules/pi-agent-text-editor-renderer/src/animation-pressure.ts +50 -0
- package/node_modules/pi-agent-text-editor-renderer/src/config.ts +73 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +77 -22
- package/node_modules/pi-agent-text-editor-renderer/src/diff-theme.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +140 -24
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +274 -43
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +33 -6
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +47 -0
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +7 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +265 -105
- package/node_modules/pi-agent-text-editor-renderer/src/typing-interpolation.ts +96 -15
- package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +22 -6
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -4
- package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-72.js +2 -0
- package/node_modules/pi-agent-tool-call-interception/package.json +5 -2
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +1 -0
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +175 -32
- package/node_modules/pi-agent-tool-ui/package.json +15 -0
- package/node_modules/pi-agent-tool-ui/runtime/entry-74.js +1 -0
- package/node_modules/pi-agent-tool-ui/src/index.ts +318 -0
- package/node_modules/pi-agent-web/index.ts +16 -6
- package/node_modules/pi-agent-web/package.json +8 -6
- package/node_modules/pi-agent-web/runtime/entry-75.js +2 -0
- package/node_modules/pi-agent-web/src/browser-loader.ts +180 -0
- package/node_modules/pi-agent-web/src/doctor-plugin.ts +41 -0
- package/node_modules/pi-agent-web/src/resolver.ts +128 -24
- package/node_modules/pi-agent-web-html/package.json +6 -3
- package/node_modules/pi-agent-web-html/runtime/entry-76.js +2 -0
- package/node_modules/pi-agent-web-html/src/extract-readable-html.ts +19 -6
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-image/runtime/entry-77.js +2 -0
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-78.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-79.js +2 -0
- package/package.json +68 -54
- package/src/api/code-view.ts +4 -0
- package/src/api/connect-tip-provider.ts +49 -0
- package/src/api/plugin-protocol.ts +41 -2
- package/src/api/tips.ts +77 -0
- package/src/api/tool-config/formatters.json +215 -0
- package/src/api/tool-config/linters.json +257 -0
- package/src/api/tool-config/lsp-servers.json +275 -0
- package/src/api/tool-config.ts +217 -13
- package/src/api/toolchain.ts +0 -5
- package/src/code-view/diagnostic-view.ts +117 -26
- package/src/code-view/source-view.ts +1 -1
- package/src/composite/builtin-extensions.ts +12 -6
- package/src/composite/extensions-config.ts +137 -0
- package/src/composite/selection.ts +58 -3
- package/src/core/diagnostic-store.ts +244 -0
- package/src/core/extension.ts +40 -0
- package/src/core/ide-core.ts +48 -3
- package/src/doctor/config-writer.ts +1 -1
- package/src/doctor/core.ts +47 -0
- package/src/doctor/discovery.ts +10 -2
- package/src/doctor/extension.ts +12 -1
- package/src/doctor/inventory.ts +24 -6
- package/src/doctor/run.ts +68 -87
- package/src/doctor/tip-provider.ts +92 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +4 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-21.js +2 -0
- 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-pdf/runtime/entry-22.js +2 -0
- 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-23.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-20.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +16 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +6 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/extract-readable-html.ts +19 -6
- 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-image/runtime/entry-77.js +2 -0
- 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-pdf/runtime/entry-78.js +2 -0
- 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-79.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/browser-loader.ts +180 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/doctor-plugin.ts +41 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +128 -24
- package/src/extensions/pi-agent-read/package.json +11 -9
- package/src/extensions/pi-agent-read/runtime/entry-35.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-36.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-37.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-38.js +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-39.js +2 -0
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +113 -2
- package/src/extensions/pi-agent-read/src/core/extension.ts +19 -0
- package/src/extensions/pi-agent-read/src/core/read-core.ts +85 -13
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +26 -10
- package/src/extensions/pi-agent-read/src/core/tools/read/persisted-result.ts +72 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +102 -12
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +27 -3
- package/src/extensions/pi-agent-read/src/core/tools/read/views.ts +29 -0
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +532 -46
- package/src/extensions/pi-agent-search/package.json +7 -6
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +53 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-45.js +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-46.js +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/doctor-plugin.ts +20 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +56 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +36 -34
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +254 -71
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +68 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +71 -117
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +1 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +276 -110
- package/src/extensions/pi-agent-search/runtime/entry-41.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-42.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-43.js +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-44.js +2 -0
- package/src/extensions/pi-agent-search/src/api/search.ts +4 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +99 -27
- package/src/extensions/pi-agent-search/src/core/search-config.ts +98 -0
- package/src/extensions/pi-agent-search/src/core/search-core.ts +32 -28
- package/src/extensions/pi-agent-search/src/core/search-timeout.ts +54 -0
- package/src/extensions/pi-agent-text-editor/package.json +22 -21
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +7 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-48.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/src/resolver.ts +6 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +34 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +27 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-49.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-50.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +230 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/config.ts +159 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/fuzzy-worker.ts +100 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/recovery.ts +151 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +8 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +10 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-51.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-52.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/anchor.ts +32 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +20 -12
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-69.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/index.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +4 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/runtime/entry-70.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +21 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-71.js +2 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/animation-pressure.ts +50 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/config.ts +73 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +77 -22
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-theme.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +140 -24
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +274 -43
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +33 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +47 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +7 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +265 -105
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/typing-interpolation.ts +96 -15
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +22 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-72.js +2 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-53.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-54.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-55.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-56.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-57.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-58.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-59.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-60.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-61.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-62.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-63.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-64.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-67.js +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-68.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/anchor-inspection.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +1 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +38 -0
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +30 -15
- package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +10 -13
- package/src/extensions/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +12 -5
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +15 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +14 -10
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +3 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +64 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/read-fragment-resolver.ts +83 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +96 -8
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +4 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +194 -35
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +43 -13
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-config.ts +95 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +75 -5
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +7 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +541 -130
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +5 -9
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/rendering.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +228 -6
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +50 -70
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +25 -26
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +30 -21
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +57 -71
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +30 -27
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -0
- package/src/pi-agent-ide.ts +15 -3
- package/src/plugins/pi-agent-ide-ast/package.json +11 -10
- package/src/plugins/pi-agent-ide-ast/runtime/entry-24.js +1 -0
- package/src/plugins/pi-agent-ide-ast/runtime/entry-25.js +2 -0
- package/src/plugins/pi-agent-ide-ast/src/api/scope.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +25 -0
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +13 -5
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +6 -0
- package/src/plugins/pi-agent-ide-changes/index.ts +6 -2
- package/src/plugins/pi-agent-ide-changes/package.json +8 -7
- package/src/plugins/pi-agent-ide-changes/runtime/entry-26.js +1 -0
- package/src/plugins/pi-agent-ide-changes/runtime/entry-27.js +2 -0
- package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +6 -0
- package/src/plugins/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -0
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/src/doctor-plugin.ts +31 -1
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -0
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +7 -0
- package/src/plugins/pi-agent-ide-diagnostics/index.ts +1 -0
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +191 -0
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-formatter/runtime/entry-28.js +2 -0
- package/src/plugins/pi-agent-ide-formatter/src/catalog.ts +34 -0
- package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +115 -63
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +71 -28
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/runtime/entry-29.js +2 -0
- package/src/plugins/pi-agent-ide-lint/index.ts +30 -155
- package/src/plugins/pi-agent-ide-lint/package.json +8 -7
- package/src/plugins/pi-agent-ide-lint/runtime/entry-30.js +2 -0
- package/src/plugins/pi-agent-ide-lint/src/catalog.ts +14 -2
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +60 -4
- package/src/plugins/pi-agent-ide-lint/src/diagnostics.ts +3 -1
- package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +115 -64
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +72 -27
- package/src/plugins/pi-agent-ide-lsp/index.ts +35 -134
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -8
- package/src/plugins/pi-agent-ide-lsp/runtime/entry-31.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +113 -0
- package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +108 -53
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +94 -27
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +2 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +76 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostics.ts +137 -144
- package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +2 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +9 -32
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +86 -50
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +1 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/types.ts +8 -6
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +5 -5
- package/src/post-edit/gate.ts +17 -141
- package/src/tips/core.ts +86 -0
- package/src/tips/extension.ts +115 -0
- package/src/tips/persistence.ts +225 -0
- package/src/tips/tip-callout.ts +77 -0
- package/src/toolchain/registry.ts +8 -23
- package/src/toolchain/types.ts +6 -74
- package/node_modules/pi-agent-search-semantic/index.ts +0 -97
- package/node_modules/pi-agent-search-semantic/package.json +0 -17
- package/node_modules/pi-agent-search-text/src/lucene-query-parser.d.ts +0 -20
- package/node_modules/pi-agent-search-web/index.ts +0 -82
- package/node_modules/pi-agent-search-web/package.json +0 -20
- package/node_modules/pi-agent-search-web/src/config.ts +0 -560
- package/node_modules/pi-agent-search-web/src/doctor-plugin.ts +0 -40
- package/node_modules/pi-agent-search-web/src/providers/duckduckgo-html.ts +0 -74
- package/node_modules/pi-agent-search-web/src/providers/endpoints.ts +0 -81
- package/node_modules/pi-agent-search-web/src/providers/request.ts +0 -427
- package/node_modules/pi-agent-search-web/src/providers/response.ts +0 -353
- package/node_modules/pi-agent-search-web/src/search-format.ts +0 -24
- package/node_modules/pi-agent-search-web/src/search.ts +0 -376
- package/node_modules/pi-agent-search-web/src/types.ts +0 -141
- package/src/composite/config.ts +0 -100
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-semantic/index.ts +0 -97
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-semantic/package.json +0 -17
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/lucene-query-parser.d.ts +0 -20
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/index.ts +0 -82
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/package.json +0 -20
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/config.ts +0 -560
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/doctor-plugin.ts +0 -40
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/providers/duckduckgo-html.ts +0 -74
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/providers/endpoints.ts +0 -81
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/providers/request.ts +0 -427
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/providers/response.ts +0 -353
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/search-format.ts +0 -24
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/search.ts +0 -376
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-web/src/types.ts +0 -141
- package/src/toolchain/gate.ts +0 -305
- /package/{src/utils/required-value.ts → node_modules/pi-agent-invariant/src/index.ts} +0 -0
|
@@ -330,15 +330,7 @@ class InterceptorImpl implements ToolCallInterceptor {
|
|
|
330
330
|
pi.on("agent_end", async () => {
|
|
331
331
|
await this.finalizeRecovery();
|
|
332
332
|
|
|
333
|
-
|
|
334
|
-
if (
|
|
335
|
-
!entry.complete &&
|
|
336
|
-
!this.recoveryAppliedBatchIndexes.has(entry.index) &&
|
|
337
|
-
!this.emittedToolCallAnnotationKinds.get(contentIndex)?.has("stale-anchor")
|
|
338
|
-
) {
|
|
339
|
-
this.annotateContent(contentIndex, { kind: "aborted" });
|
|
340
|
-
}
|
|
341
|
-
}
|
|
333
|
+
this.annotateIncompleteCalls();
|
|
342
334
|
|
|
343
335
|
this.cleanupAll();
|
|
344
336
|
});
|
|
@@ -585,8 +577,12 @@ class InterceptorImpl implements ToolCallInterceptor {
|
|
|
585
577
|
}
|
|
586
578
|
private annotateIncompleteCalls(): void {
|
|
587
579
|
for (const [contentIndex, entry] of this.streamedBatchEntries) {
|
|
580
|
+
// Contents whose transient state was already cleaned up ended one way or
|
|
581
|
+
// another; re-annotating them would leak the annotation onto the next
|
|
582
|
+
// call that reuses the same content index.
|
|
588
583
|
if (
|
|
589
584
|
!entry.complete &&
|
|
585
|
+
this.contentNames.has(contentIndex) &&
|
|
590
586
|
!this.recoveryAppliedBatchIndexes.has(entry.index) &&
|
|
591
587
|
!this.emittedToolCallAnnotationKinds.get(contentIndex)?.has("stale-anchor")
|
|
592
588
|
) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { requiredValue } from "
|
|
1
|
+
import { requiredValue } from "pi-agent-invariant";
|
|
2
2
|
import { TextSelectionAnchor, type TextSelectionRange } from "#src/api/text-selection-anchor.js";
|
|
3
3
|
|
|
4
4
|
import type { TextMutationContext } from "#src/api/mutation-tool.js";
|
|
@@ -33,6 +33,192 @@ export function lineAnchor(anchors: ReadonlyMap<string, TextAnchor>, field: stri
|
|
|
33
33
|
return requiredValue(anchors.values().next().value);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export interface TextAnchorSpan {
|
|
37
|
+
readonly source: string;
|
|
38
|
+
readonly from: number;
|
|
39
|
+
readonly to: number;
|
|
40
|
+
readonly selection: boolean;
|
|
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
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Resolves one anchor to one character span, converting line anchors to whole-line spans. */
|
|
49
|
+
export function singleAnchorSpan(
|
|
50
|
+
context: TextMutationContext,
|
|
51
|
+
anchors: ReadonlyMap<string, TextAnchor>,
|
|
52
|
+
field: string,
|
|
53
|
+
): TextAnchorSpan {
|
|
54
|
+
if (anchors.size !== 1) {
|
|
55
|
+
throw new Error(`Anchor ${field} must resolve in one resource.`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const [source, anchor] = requiredValue(anchors.entries().next().value);
|
|
59
|
+
if (TextSelectionAnchor.is(anchor)) {
|
|
60
|
+
if (anchor.ranges.length !== 1) {
|
|
61
|
+
throw new Error(`Anchor ${field} must select one match for this operation.`);
|
|
62
|
+
}
|
|
63
|
+
const selectedRange = requiredValue(anchor.ranges[0]);
|
|
64
|
+
const document = context.documentFor(source);
|
|
65
|
+
const exactRange = selectionRange(context, source, selectedRange);
|
|
66
|
+
const endLine = linewiseSelectionEndLine(selectedRange);
|
|
67
|
+
if (endLine !== undefined) {
|
|
68
|
+
const range = document.lineRange(selectedRange.start.lineNumber, endLine);
|
|
69
|
+
return {
|
|
70
|
+
source,
|
|
71
|
+
...range,
|
|
72
|
+
selection: false,
|
|
73
|
+
preservesTrailingLineBreak: true,
|
|
74
|
+
linewiseStartLine: selectedRange.start.lineNumber,
|
|
75
|
+
linewiseEndLine: endLine,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return { source, ...exactRange, selection: true, preservesTrailingLineBreak: false };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const range = context.documentFor(source).lineRange(anchor.lineNumber, anchor.lineNumber);
|
|
82
|
+
return {
|
|
83
|
+
source,
|
|
84
|
+
...range,
|
|
85
|
+
selection: false,
|
|
86
|
+
preservesTrailingLineBreak: true,
|
|
87
|
+
linewiseStartLine: anchor.lineNumber,
|
|
88
|
+
linewiseEndLine: anchor.lineNumber,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Builds a natural range from the left edge of start through the right edge of end. */
|
|
93
|
+
export function anchorSpanRange(
|
|
94
|
+
context: TextMutationContext,
|
|
95
|
+
starts: ReadonlyMap<string, TextAnchor>,
|
|
96
|
+
ends: ReadonlyMap<string, TextAnchor> | undefined,
|
|
97
|
+
startField: string,
|
|
98
|
+
endField: string,
|
|
99
|
+
): TextAnchorSpan {
|
|
100
|
+
const start = singleAnchorSpan(context, starts, startField);
|
|
101
|
+
const end = ends === undefined ? start : singleAnchorSpan(context, ends, endField);
|
|
102
|
+
if (start.source !== end.source) {
|
|
103
|
+
throw new Error(`Anchors ${startField} and ${endField} must resolve in one resource.`);
|
|
104
|
+
}
|
|
105
|
+
if (start.from > end.to) {
|
|
106
|
+
throw new Error(`Anchor ${startField} must not come after ${endField}.`);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
source: start.source,
|
|
110
|
+
from: start.from,
|
|
111
|
+
to: end.to,
|
|
112
|
+
selection: start.selection || end.selection,
|
|
113
|
+
preservesTrailingLineBreak: end.preservesTrailingLineBreak,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Converts inserted line endings to the target document's style. */
|
|
118
|
+
export function targetText(context: TextMutationContext, source: string, text: string): string {
|
|
119
|
+
const separator = context.documentFor(source).content.includes("\r\n") ? "\r\n" : "\n";
|
|
120
|
+
return text.replace(/\r\n|\r|\n/gu, separator);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Creates a replacement while preserving a line endpoint's trailing separator. */
|
|
124
|
+
export function replaceAnchorSpan(
|
|
125
|
+
context: TextMutationContext,
|
|
126
|
+
span: TextAnchorSpan,
|
|
127
|
+
text: string,
|
|
128
|
+
): { readonly from: number; readonly to: number; readonly insert: string } {
|
|
129
|
+
const document = context.documentFor(span.source);
|
|
130
|
+
let insert = targetText(context, span.source, text);
|
|
131
|
+
const selected = document.text(span);
|
|
132
|
+
if (span.preservesTrailingLineBreak && !/(?:\r\n|\r|\n)$/u.test(insert)) {
|
|
133
|
+
const ending = /(?:\r\n|\r|\n)$/u.exec(selected)?.[0];
|
|
134
|
+
if (ending !== undefined) {
|
|
135
|
+
insert += ending;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return { from: span.from, to: span.to, insert };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Creates a deletion while keeping whole-line deletion behavior at EOF. */
|
|
142
|
+
export function deleteAnchorSpan(
|
|
143
|
+
context: TextMutationContext,
|
|
144
|
+
span: TextAnchorSpan,
|
|
145
|
+
): { readonly from: number; readonly to: number; readonly insert: "" } {
|
|
146
|
+
const content = context.documentFor(span.source).content;
|
|
147
|
+
if (
|
|
148
|
+
!span.selection &&
|
|
149
|
+
span.to === content.length &&
|
|
150
|
+
span.from > 0 &&
|
|
151
|
+
!/(?:\r\n|\r|\n)$/u.test(content)
|
|
152
|
+
) {
|
|
153
|
+
const prefix = content.slice(0, span.from);
|
|
154
|
+
const match = /(?:\r\n|\r|\n)$/u.exec(prefix);
|
|
155
|
+
if (match !== null) {
|
|
156
|
+
return { from: span.from - match[0].length, to: span.to, insert: "" };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return { from: span.from, to: span.to, insert: "" };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Creates an insertion after a selection span or after a line anchor. */
|
|
163
|
+
export function insertionAfterAnchor(
|
|
164
|
+
context: TextMutationContext,
|
|
165
|
+
anchors: ReadonlyMap<string, TextAnchor>,
|
|
166
|
+
field: string,
|
|
167
|
+
insert: string,
|
|
168
|
+
): readonly [string, { readonly from: number; readonly to: number; readonly insert: string }] {
|
|
169
|
+
const span = singleAnchorSpan(context, anchors, field);
|
|
170
|
+
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
|
+
|
|
175
|
+
const lineNumber = span.linewiseEndLine ?? lineAnchor(anchors, field).lineNumber;
|
|
176
|
+
return [
|
|
177
|
+
span.source,
|
|
178
|
+
context.documentFor(span.source).insertAfterLine(lineNumber, normalizedInsert),
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Creates an insertion before a selection span or before a line anchor. */
|
|
183
|
+
export function insertionBeforeAnchor(
|
|
184
|
+
context: TextMutationContext,
|
|
185
|
+
anchors: ReadonlyMap<string, TextAnchor>,
|
|
186
|
+
field: string,
|
|
187
|
+
insert: string,
|
|
188
|
+
): readonly [string, { readonly from: number; readonly to: number; readonly insert: string }] {
|
|
189
|
+
const span = singleAnchorSpan(context, anchors, field);
|
|
190
|
+
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
|
+
const lineNumber = span.linewiseStartLine ?? lineAnchor(anchors, field).lineNumber;
|
|
196
|
+
return [
|
|
197
|
+
span.source,
|
|
198
|
+
context.documentFor(span.source).insertBeforeLine(lineNumber, normalizedInsert),
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function coalesceAdjacentLinewiseRanges(
|
|
203
|
+
ranges: readonly TextSelectionRange[],
|
|
204
|
+
): readonly TextSelectionRange[] {
|
|
205
|
+
const result: TextSelectionRange[] = [];
|
|
206
|
+
for (const range of ranges) {
|
|
207
|
+
const previous = result.at(-1);
|
|
208
|
+
if (
|
|
209
|
+
previous?.linewise === true &&
|
|
210
|
+
range.linewise === true &&
|
|
211
|
+
previous.end.lineNumber === range.start.lineNumber &&
|
|
212
|
+
previous.end.column === range.start.column
|
|
213
|
+
) {
|
|
214
|
+
result[result.length - 1] = { ...previous, end: range.end };
|
|
215
|
+
} else {
|
|
216
|
+
result.push(range);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
|
|
36
222
|
export function selectionChanges(
|
|
37
223
|
context: TextMutationContext,
|
|
38
224
|
selections: ReadonlyMap<string, TextSelectionAnchor>,
|
|
@@ -44,15 +230,30 @@ export function selectionChanges(
|
|
|
44
230
|
return new Map(
|
|
45
231
|
[...selections].map(([source, anchor]) => [
|
|
46
232
|
source,
|
|
47
|
-
|
|
233
|
+
(insert.length === 0 ? coalesceAdjacentLinewiseRanges(anchor.ranges) : anchor.ranges).map(
|
|
234
|
+
(range) => {
|
|
235
|
+
const span = selectionRange(context, source, range);
|
|
236
|
+
const lineSpan = {
|
|
237
|
+
source,
|
|
238
|
+
...span,
|
|
239
|
+
selection: false,
|
|
240
|
+
preservesTrailingLineBreak: range.linewise === true && insert.length > 0,
|
|
241
|
+
};
|
|
242
|
+
return insert.length === 0 && range.linewise === true
|
|
243
|
+
? deleteAnchorSpan(context, lineSpan)
|
|
244
|
+
: replaceAnchorSpan(context, lineSpan, insert);
|
|
245
|
+
},
|
|
246
|
+
),
|
|
48
247
|
]),
|
|
49
248
|
);
|
|
50
249
|
}
|
|
51
250
|
|
|
251
|
+
/** Creates insertions before or after every selected range. */
|
|
52
252
|
export function insertionChanges(
|
|
53
253
|
context: TextMutationContext,
|
|
54
254
|
selections: ReadonlyMap<string, TextSelectionAnchor>,
|
|
55
255
|
insert: string,
|
|
256
|
+
before = false,
|
|
56
257
|
): ReadonlyMap<
|
|
57
258
|
string,
|
|
58
259
|
readonly { readonly from: number; readonly to: number; readonly insert: string }[]
|
|
@@ -61,10 +262,22 @@ export function insertionChanges(
|
|
|
61
262
|
[...selections].map(([source, anchor]) => [
|
|
62
263
|
source,
|
|
63
264
|
anchor.ranges.map((range) => {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
265
|
+
const document = context.documentFor(source);
|
|
266
|
+
const normalizedInsert = targetText(context, source, insert);
|
|
267
|
+
const linewiseEnd = linewiseSelectionEndLine(range);
|
|
268
|
+
if (linewiseEnd !== undefined) {
|
|
269
|
+
return before
|
|
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 };
|
|
68
281
|
}),
|
|
69
282
|
]),
|
|
70
283
|
);
|
|
@@ -96,3 +309,12 @@ export function selectionRange(
|
|
|
96
309
|
.documentFor(source)
|
|
97
310
|
.range(range.start.lineNumber, range.start.column, range.end.lineNumber, range.end.column);
|
|
98
311
|
}
|
|
312
|
+
|
|
313
|
+
function linewiseSelectionEndLine(range: TextSelectionRange): number | undefined {
|
|
314
|
+
if (range.linewise !== true) {
|
|
315
|
+
return undefined;
|
|
316
|
+
}
|
|
317
|
+
return range.end.column === 0 && range.end.lineNumber > range.start.lineNumber
|
|
318
|
+
? range.end.lineNumber - 1
|
|
319
|
+
: range.end.lineNumber;
|
|
320
|
+
}
|
|
@@ -2,29 +2,40 @@ import { Type } from "typebox";
|
|
|
2
2
|
|
|
3
3
|
import { TEXT_POSITION_ANCHOR_KIND, TEXT_SEARCH_ANCHOR_KIND } from "#src/api/plugin-protocol.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
textSelections,
|
|
5
|
+
anchorSpanRange,
|
|
6
|
+
insertionAfterAnchor,
|
|
7
|
+
replaceAnchorSpan,
|
|
9
8
|
} from "#src/tools/text-selection.js";
|
|
10
9
|
|
|
11
10
|
import type { TextMutationToolRegistration } from "#src/api/mutation-tool.js";
|
|
12
11
|
|
|
13
12
|
export const copySchema = Type.Object(
|
|
14
13
|
{
|
|
15
|
-
path: Type.Optional(
|
|
16
|
-
start: Type.String({ description: "Registered text anchor selecting the first line to copy" }),
|
|
17
|
-
end: Type.Optional(
|
|
14
|
+
path: Type.Optional(
|
|
18
15
|
Type.String({
|
|
19
|
-
description:
|
|
16
|
+
description:
|
|
17
|
+
"Source resource reference or file path; a typed resource may select one source span",
|
|
18
|
+
}),
|
|
19
|
+
),
|
|
20
|
+
start: Type.Optional(
|
|
21
|
+
Type.String({
|
|
22
|
+
description: "Registered text anchor or unique exact text at the source start",
|
|
23
|
+
}),
|
|
24
|
+
),
|
|
25
|
+
end: Type.Optional(Type.String({ description: "Source end anchor; defaults to start" })),
|
|
26
|
+
target: Type.Optional(
|
|
27
|
+
Type.String({
|
|
28
|
+
description:
|
|
29
|
+
"Target resource reference or file path; a typed resource may select the destination; defaults to the source",
|
|
30
|
+
}),
|
|
31
|
+
),
|
|
32
|
+
targetStart: Type.Optional(
|
|
33
|
+
Type.String({
|
|
34
|
+
description: "Target anchor; copied text is inserted after it when targetEnd is omitted",
|
|
20
35
|
}),
|
|
21
36
|
),
|
|
22
|
-
target: Type.Optional(Type.String({ description: "Target file; defaults to the source file" })),
|
|
23
|
-
targetStart: Type.String({
|
|
24
|
-
description: "First target line; copied text is inserted after it when targetEnd is omitted",
|
|
25
|
-
}),
|
|
26
37
|
targetEnd: Type.Optional(
|
|
27
|
-
Type.String({ description: "
|
|
38
|
+
Type.String({ description: "Target end anchor; the natural target range is replaced" }),
|
|
28
39
|
),
|
|
29
40
|
},
|
|
30
41
|
{ additionalProperties: false },
|
|
@@ -32,17 +43,19 @@ export const copySchema = Type.Object(
|
|
|
32
43
|
|
|
33
44
|
interface CopyParameters {
|
|
34
45
|
readonly path?: string;
|
|
35
|
-
readonly start
|
|
46
|
+
readonly start?: string;
|
|
36
47
|
readonly end?: string;
|
|
37
48
|
readonly target?: string;
|
|
38
|
-
readonly targetStart
|
|
49
|
+
readonly targetStart?: string;
|
|
39
50
|
readonly targetEnd?: string;
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> = {
|
|
43
54
|
name: "copy",
|
|
44
|
-
description:
|
|
45
|
-
|
|
55
|
+
description: "Copy one span or an anchor range, then insert it or replace a target range.",
|
|
56
|
+
|
|
57
|
+
promptSnippet:
|
|
58
|
+
"Make precise file edits by copying text within or between files using exact matches or anchors",
|
|
46
59
|
parameters: copySchema,
|
|
47
60
|
source: { field: "path", inherited: true, targets: [{ field: "target", fallbackTo: "path" }] },
|
|
48
61
|
anchors: [
|
|
@@ -72,64 +85,31 @@ export const copyMutationTool: TextMutationToolRegistration<typeof copySchema> =
|
|
|
72
85
|
pair: ["start", "end"],
|
|
73
86
|
mutate: async (context, parameters: CopyParameters) => {
|
|
74
87
|
const starts = await context.resolveAnchors("start");
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (sourceSelections === undefined) {
|
|
79
|
-
const source = context.sourceFor("path");
|
|
80
|
-
const start = lineAnchor(starts, "start");
|
|
81
|
-
const end =
|
|
82
|
-
parameters.end === undefined
|
|
83
|
-
? start
|
|
84
|
-
: lineAnchor(await context.resolveAnchors("end"), "end");
|
|
85
|
-
const sourceDocument = context.documentFor(source);
|
|
86
|
-
copied = sourceDocument.text(sourceDocument.lineRange(start.lineNumber, end.lineNumber));
|
|
87
|
-
} else {
|
|
88
|
-
if (parameters.end !== undefined) {
|
|
89
|
-
throw new Error("end cannot be combined with a search selection.");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const [source, range] = singleSelection(sourceSelections, "start");
|
|
93
|
-
copied = context.documentFor(source).text(selectionRange(context, source, range));
|
|
94
|
-
}
|
|
88
|
+
const ends = parameters.end === undefined ? undefined : await context.resolveAnchors("end");
|
|
89
|
+
const sourceSpan = anchorSpanRange(context, starts, ends, "start", "end");
|
|
90
|
+
const copied = context.documentFor(sourceSpan.source).text(sourceSpan);
|
|
95
91
|
|
|
96
92
|
const targetStarts = await context.resolveAnchors("targetStart");
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (parameters.targetEnd !== undefined) {
|
|
101
|
-
throw new Error("targetEnd cannot be combined with a search selection.");
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const [target, range] = singleSelection(targetSelections, "targetStart");
|
|
105
|
-
const targetDocument = context.documentFor(target);
|
|
106
|
-
const insertion = targetDocument.range(
|
|
107
|
-
range.end.lineNumber,
|
|
108
|
-
range.end.column,
|
|
109
|
-
range.end.lineNumber,
|
|
110
|
-
range.end.column,
|
|
111
|
-
);
|
|
112
|
-
return {
|
|
113
|
-
edits: new Map([
|
|
114
|
-
[target, { changes: [{ ...insertion, insert: copied }], action: "edited" }],
|
|
115
|
-
]),
|
|
116
|
-
};
|
|
93
|
+
if (parameters.targetEnd === undefined) {
|
|
94
|
+
const [target, change] = insertionAfterAnchor(context, targetStarts, "targetStart", copied);
|
|
95
|
+
return { edits: new Map([[target, { changes: [change], action: "edited" }]]) };
|
|
117
96
|
}
|
|
118
97
|
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
targetEnd === undefined
|
|
128
|
-
? targetDocument.insertAfterLine(targetStart.lineNumber, copied)
|
|
129
|
-
: targetDocument.replaceLines(targetStart.lineNumber, targetEnd.lineNumber, copied);
|
|
130
|
-
|
|
98
|
+
const targetEnds = await context.resolveAnchors("targetEnd");
|
|
99
|
+
const targetSpan = anchorSpanRange(
|
|
100
|
+
context,
|
|
101
|
+
targetStarts,
|
|
102
|
+
targetEnds,
|
|
103
|
+
"targetStart",
|
|
104
|
+
"targetEnd",
|
|
105
|
+
);
|
|
131
106
|
return {
|
|
132
|
-
edits: new Map([
|
|
107
|
+
edits: new Map([
|
|
108
|
+
[
|
|
109
|
+
targetSpan.source,
|
|
110
|
+
{ changes: [replaceAnchorSpan(context, targetSpan, copied)], action: "edited" },
|
|
111
|
+
],
|
|
112
|
+
]),
|
|
133
113
|
};
|
|
134
114
|
},
|
|
135
115
|
};
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
|
|
3
3
|
import { TEXT_POSITION_ANCHOR_KIND, TEXT_SEARCH_ANCHOR_KIND } from "#src/api/plugin-protocol.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
anchorSpanRange,
|
|
6
|
+
deleteAnchorSpan,
|
|
7
|
+
selectionChanges,
|
|
8
|
+
textSelections,
|
|
9
|
+
} from "#src/tools/text-selection.js";
|
|
5
10
|
|
|
6
11
|
import type { TextMutationToolRegistration } from "#src/api/mutation-tool.js";
|
|
7
12
|
|
|
8
13
|
export const deleteSchema = Type.Object(
|
|
9
14
|
{
|
|
10
|
-
path: Type.Optional(
|
|
15
|
+
path: Type.Optional(
|
|
16
|
+
Type.String({
|
|
17
|
+
description:
|
|
18
|
+
"Source resource reference or file path. A typed SEARCH#... resource can select deletion ranges.",
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
11
21
|
start: Type.Optional(
|
|
12
|
-
Type.String({
|
|
22
|
+
Type.String({
|
|
23
|
+
description: "Registered text anchor or unique exact text selecting the first span",
|
|
24
|
+
}),
|
|
13
25
|
),
|
|
14
26
|
end: Type.Optional(
|
|
15
|
-
Type.String({
|
|
27
|
+
Type.String({
|
|
28
|
+
description: "Registered text anchor or unique exact text selecting the last span",
|
|
29
|
+
}),
|
|
16
30
|
),
|
|
17
31
|
},
|
|
18
32
|
{ additionalProperties: false },
|
|
@@ -26,7 +40,9 @@ interface DeleteParameters {
|
|
|
26
40
|
|
|
27
41
|
export const deleteMutationTool: TextMutationToolRegistration<typeof deleteSchema> = {
|
|
28
42
|
name: "delete",
|
|
29
|
-
description: "Delete
|
|
43
|
+
description: "Delete one selected span or the natural range between two anchors.",
|
|
44
|
+
|
|
45
|
+
promptSnippet: "Make precise file edits by deleting text using exact matches or anchors",
|
|
30
46
|
parameters: deleteSchema,
|
|
31
47
|
source: { field: "path", inherited: true },
|
|
32
48
|
anchors: [
|
|
@@ -45,18 +61,9 @@ export const deleteMutationTool: TextMutationToolRegistration<typeof deleteSchem
|
|
|
45
61
|
],
|
|
46
62
|
pair: ["start", "end"],
|
|
47
63
|
mutate: async (context, parameters: DeleteParameters) => {
|
|
48
|
-
if (parameters.start === undefined) {
|
|
49
|
-
throw new Error("start anchor is required.");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
64
|
const starts = await context.resolveAnchors("start");
|
|
53
65
|
const selections = textSelections(starts, "start");
|
|
54
|
-
|
|
55
|
-
if (selections !== undefined) {
|
|
56
|
-
if (parameters.end !== undefined) {
|
|
57
|
-
throw new Error("end cannot be combined with a search selection.");
|
|
58
|
-
}
|
|
59
|
-
|
|
66
|
+
if (parameters.end === undefined && selections !== undefined) {
|
|
60
67
|
const changes = selectionChanges(context, selections, "");
|
|
61
68
|
return {
|
|
62
69
|
edits: new Map(
|
|
@@ -68,19 +75,11 @@ export const deleteMutationTool: TextMutationToolRegistration<typeof deleteSchem
|
|
|
68
75
|
};
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const end =
|
|
74
|
-
parameters.end === undefined ? start : lineAnchor(await context.resolveAnchors("end"), "end");
|
|
78
|
+
const ends = parameters.end === undefined ? undefined : await context.resolveAnchors("end");
|
|
79
|
+
const span = anchorSpanRange(context, starts, ends, "start", "end");
|
|
75
80
|
return {
|
|
76
81
|
edits: new Map([
|
|
77
|
-
[
|
|
78
|
-
source,
|
|
79
|
-
{
|
|
80
|
-
changes: [context.documentFor(source).deleteLines(start.lineNumber, end.lineNumber)],
|
|
81
|
-
action: "edited",
|
|
82
|
-
},
|
|
83
|
-
],
|
|
82
|
+
[span.source, { changes: [deleteAnchorSpan(context, span)], action: "edited" }],
|
|
84
83
|
]),
|
|
85
84
|
};
|
|
86
85
|
},
|
|
@@ -1,30 +1,49 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
|
|
3
3
|
import { TEXT_POSITION_ANCHOR_KIND, TEXT_SEARCH_ANCHOR_KIND } from "#src/api/plugin-protocol.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
insertionAfterAnchor,
|
|
6
|
+
insertionBeforeAnchor,
|
|
7
|
+
insertionChanges,
|
|
8
|
+
textSelections,
|
|
9
|
+
} from "#src/tools/text-selection.js";
|
|
5
10
|
|
|
6
11
|
import type { TextMutationToolRegistration } from "#src/api/mutation-tool.js";
|
|
7
12
|
|
|
8
13
|
export const insertSchema = Type.Object(
|
|
9
14
|
{
|
|
10
|
-
path: Type.Optional(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
path: Type.Optional(
|
|
16
|
+
Type.String({
|
|
17
|
+
description:
|
|
18
|
+
"Source resource reference or file path. A typed SEARCH#... resource can select insertion positions.",
|
|
19
|
+
}),
|
|
20
|
+
),
|
|
21
|
+
anchor: Type.Optional(
|
|
22
|
+
Type.String({
|
|
23
|
+
description: "Registered text anchor or unique exact text span",
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
14
26
|
text: Type.String({ description: "Content to insert" }),
|
|
27
|
+
before: Type.Optional(
|
|
28
|
+
Type.Boolean({ description: "Insert before the anchor instead of after it" }),
|
|
29
|
+
),
|
|
15
30
|
},
|
|
16
31
|
{ additionalProperties: false },
|
|
17
32
|
);
|
|
18
33
|
|
|
19
34
|
interface InsertParameters {
|
|
20
35
|
readonly path?: string;
|
|
21
|
-
readonly anchor
|
|
36
|
+
readonly anchor?: string;
|
|
22
37
|
readonly text: string;
|
|
38
|
+
readonly before?: boolean;
|
|
23
39
|
}
|
|
24
40
|
|
|
25
41
|
export const insertMutationTool: TextMutationToolRegistration<typeof insertSchema> = {
|
|
26
42
|
name: "insert",
|
|
27
|
-
description: "Insert text after
|
|
43
|
+
description: "Insert text before or after a registered anchor or one unique exact text span.",
|
|
44
|
+
|
|
45
|
+
promptSnippet:
|
|
46
|
+
"Make precise file edits by inserting text before or after exact matches or anchors",
|
|
28
47
|
parameters: insertSchema,
|
|
29
48
|
source: { field: "path", inherited: true },
|
|
30
49
|
anchors: [
|
|
@@ -39,7 +58,7 @@ export const insertMutationTool: TextMutationToolRegistration<typeof insertSchem
|
|
|
39
58
|
const selections = textSelections(anchors, "anchor");
|
|
40
59
|
|
|
41
60
|
if (selections !== undefined) {
|
|
42
|
-
const changes = insertionChanges(context, selections, parameters.text);
|
|
61
|
+
const changes = insertionChanges(context, selections, parameters.text, parameters.before);
|
|
43
62
|
return {
|
|
44
63
|
edits: new Map(
|
|
45
64
|
[...changes].map(([source, sourceChanges]) => [
|
|
@@ -50,20 +69,10 @@ export const insertMutationTool: TextMutationToolRegistration<typeof insertSchem
|
|
|
50
69
|
};
|
|
51
70
|
}
|
|
52
71
|
|
|
53
|
-
const
|
|
54
|
-
const
|
|
72
|
+
const insertion = parameters.before === true ? insertionBeforeAnchor : insertionAfterAnchor;
|
|
73
|
+
const [source, change] = insertion(context, anchors, "anchor", parameters.text);
|
|
55
74
|
return {
|
|
56
|
-
edits: new Map([
|
|
57
|
-
[
|
|
58
|
-
source,
|
|
59
|
-
{
|
|
60
|
-
changes: [
|
|
61
|
-
context.documentFor(source).insertAfterLine(anchor.lineNumber, parameters.text),
|
|
62
|
-
],
|
|
63
|
-
action: "edited",
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
]),
|
|
75
|
+
edits: new Map([[source, { changes: [change], action: "edited" }]]),
|
|
67
76
|
};
|
|
68
77
|
},
|
|
69
78
|
};
|