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
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { requiredValue } from "
|
|
1
|
+
import { requiredValue } from "pi-agent-invariant";
|
|
2
|
+
import { renderTextAnchor } from "pi-agent-text";
|
|
3
|
+
import {
|
|
4
|
+
TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH,
|
|
5
|
+
type ToolCallAnchorRenderState,
|
|
6
|
+
} from "pi-agent-tool-call-interception";
|
|
2
7
|
import { FileMutationAgentResult } from "#src/core/mutation-result/file-mutation-agent-result.js";
|
|
8
|
+
import { resolvedTextAnchorType } from "#src/core/text-anchor-registry.js";
|
|
3
9
|
import {
|
|
4
10
|
applyTextChanges,
|
|
5
11
|
type TextChange,
|
|
@@ -17,16 +23,21 @@ import {
|
|
|
17
23
|
type TextBatchEntry,
|
|
18
24
|
type TextBatchParams,
|
|
19
25
|
} from "#src/core/text-edit-batch.js";
|
|
20
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
contextualizeTextMutationAnchorError,
|
|
28
|
+
TextMutationAnchorAggregateError,
|
|
29
|
+
TextMutationAnchorResolutionError,
|
|
30
|
+
} from "#src/core/text-mutation-anchor-error.js";
|
|
21
31
|
import {
|
|
22
32
|
buildFailedTextMutationResult,
|
|
23
33
|
buildSuccessfulTextMutationResult,
|
|
24
34
|
mutationSources,
|
|
35
|
+
preflightMutationAnchors,
|
|
25
36
|
} from "#src/core/text-mutation.js";
|
|
26
37
|
import { registerBlockedToolCallSink } from "#src/core/tool-call-interceptor/coordinator.js";
|
|
27
38
|
|
|
28
39
|
import type { TextEditIntent } from "#src/api/edit-completion.js";
|
|
29
|
-
import type { FileMutationResult } from "#src/api/mutation-result.js";
|
|
40
|
+
import type { FileMutationResult, MutationResultPresentation } from "#src/api/mutation-result.js";
|
|
30
41
|
import type { AnyTextMutationToolRegistration, TextMutation } from "#src/api/mutation-tool.js";
|
|
31
42
|
import type { BatchExecutionReporter } from "#src/core/text-edit-batch-execution.js";
|
|
32
43
|
import type {
|
|
@@ -45,9 +56,15 @@ interface TextBatchState {
|
|
|
45
56
|
readonly source: string;
|
|
46
57
|
readonly registration: AnyTextMutationToolRegistration;
|
|
47
58
|
}
|
|
59
|
+
interface PlannedTextMutation extends TextMutation {
|
|
60
|
+
readonly resultPresentations: ReadonlyMap<string, MutationResultPresentation>;
|
|
61
|
+
}
|
|
48
62
|
|
|
49
63
|
interface PlannedTextBatch {
|
|
50
|
-
readonly mutations: readonly {
|
|
64
|
+
readonly mutations: readonly {
|
|
65
|
+
readonly callId: string;
|
|
66
|
+
readonly mutation: PlannedTextMutation;
|
|
67
|
+
}[];
|
|
51
68
|
readonly failures: readonly {
|
|
52
69
|
readonly callId: string;
|
|
53
70
|
readonly source: string;
|
|
@@ -120,6 +137,7 @@ export function registerTextEditBatching(pi: ExtensionAPI, core: TextEditorCore)
|
|
|
120
137
|
onUpdate,
|
|
121
138
|
context,
|
|
122
139
|
reporter,
|
|
140
|
+
renderArguments,
|
|
123
141
|
),
|
|
124
142
|
splitResult: splitTextBatchResult,
|
|
125
143
|
onRenderArguments: renderArguments,
|
|
@@ -141,6 +159,7 @@ export async function executeRegisteredTextBatch(
|
|
|
141
159
|
onUpdate: AgentToolUpdateCallback<TextBatchDetails> | undefined,
|
|
142
160
|
context: ExtensionContext,
|
|
143
161
|
reporter: BatchExecutionReporter,
|
|
162
|
+
renderArguments: (toolCallId: string, patch: Readonly<Record<string, unknown>>) => void,
|
|
144
163
|
): Promise<AgentToolResult<TextBatchDetails>> {
|
|
145
164
|
const prepared = parameters.edits.map((entry) => {
|
|
146
165
|
const registration = registrations.get(entry.op);
|
|
@@ -182,7 +201,7 @@ export async function executeRegisteredTextBatch(
|
|
|
182
201
|
[...requests.values()],
|
|
183
202
|
{ cwd: context.cwd, intent, ...(signal !== undefined && { signal }) },
|
|
184
203
|
async (texts, resolveAnchor) => {
|
|
185
|
-
const mutations:
|
|
204
|
+
const mutations: PlannedTextBatch["mutations"][number][] = [];
|
|
186
205
|
const failures: PlannedTextBatch["failures"][number][] = [];
|
|
187
206
|
const changes = new Map<string, TextChange[]>();
|
|
188
207
|
|
|
@@ -205,6 +224,16 @@ export async function executeRegisteredTextBatch(
|
|
|
205
224
|
|
|
206
225
|
return new TextChangeDocument(text);
|
|
207
226
|
};
|
|
227
|
+
|
|
228
|
+
const majorAnchorSources = new Set<string>();
|
|
229
|
+
const publishAnchorRenderPatch = (
|
|
230
|
+
field: string,
|
|
231
|
+
state: ToolCallAnchorRenderState,
|
|
232
|
+
): void => {
|
|
233
|
+
renderArguments(item.callId, {
|
|
234
|
+
[TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH]: { [field]: state },
|
|
235
|
+
});
|
|
236
|
+
};
|
|
208
237
|
const resolveAnchors = async (field: string) => {
|
|
209
238
|
const descriptor = (item.registration.anchors ?? []).find(
|
|
210
239
|
(anchor) => anchor.field === field,
|
|
@@ -214,12 +243,25 @@ export async function executeRegisteredTextBatch(
|
|
|
214
243
|
descriptor === undefined ? undefined : item.sources.get(descriptor.sourceField);
|
|
215
244
|
|
|
216
245
|
if (descriptor === undefined || typeof value !== "string" || source === undefined) {
|
|
246
|
+
publishAnchorRenderPatch(field, { kind: "failed" });
|
|
217
247
|
throw new Error(`Unable to resolve mutation anchor ${field}`);
|
|
218
248
|
}
|
|
219
249
|
|
|
220
250
|
try {
|
|
221
|
-
|
|
251
|
+
const anchor = await resolveAnchor(source, value, descriptor.kinds);
|
|
252
|
+
if (resolvedTextAnchorType(anchor) === "major") {
|
|
253
|
+
majorAnchorSources.add(source);
|
|
254
|
+
}
|
|
255
|
+
const rendered = renderTextAnchor(anchor, value, { source, anchor });
|
|
256
|
+
publishAnchorRenderPatch(field, {
|
|
257
|
+
kind: "resolved",
|
|
258
|
+
full: rendered.full,
|
|
259
|
+
compact: rendered.compact,
|
|
260
|
+
resolverId: rendered.resolverId,
|
|
261
|
+
});
|
|
262
|
+
return new Map([[source, anchor]]);
|
|
222
263
|
} catch (error) {
|
|
264
|
+
publishAnchorRenderPatch(field, { kind: "failed" });
|
|
223
265
|
throw contextualizeTextMutationAnchorError(
|
|
224
266
|
error,
|
|
225
267
|
item.registration.name,
|
|
@@ -229,25 +271,46 @@ export async function executeRegisteredTextBatch(
|
|
|
229
271
|
);
|
|
230
272
|
}
|
|
231
273
|
};
|
|
232
|
-
|
|
233
274
|
try {
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return requiredValue(resolved.values().next().value);
|
|
246
|
-
},
|
|
275
|
+
const mutationContext = {
|
|
276
|
+
cwd: context.cwd,
|
|
277
|
+
...(signal !== undefined && { signal }),
|
|
278
|
+
sourceDocument: documentFor(sourceFor(item.registration.source.field)),
|
|
279
|
+
sourceFor,
|
|
280
|
+
documentFor,
|
|
281
|
+
targetDocument: (field: string) => documentFor(sourceFor(field)),
|
|
282
|
+
resolveAnchors,
|
|
283
|
+
async resolveAnchor(field: string) {
|
|
284
|
+
const resolved = await resolveAnchors(field);
|
|
285
|
+
return requiredValue(resolved.values().next().value);
|
|
247
286
|
},
|
|
248
|
-
|
|
249
|
-
);
|
|
250
|
-
|
|
287
|
+
};
|
|
288
|
+
await preflightMutationAnchors(item.registration, item.input, mutationContext);
|
|
289
|
+
const mutation = await item.registration.mutate(mutationContext, item.input);
|
|
290
|
+
for (const [source, edit] of mutation.edits) {
|
|
291
|
+
const existing = changes.get(source) ?? [];
|
|
292
|
+
if (
|
|
293
|
+
edit.changes.some((change) =>
|
|
294
|
+
existing.some((prior) => textChangesConflict(prior, change)),
|
|
295
|
+
)
|
|
296
|
+
) {
|
|
297
|
+
throw new Error(
|
|
298
|
+
`Text mutation ${item.callId} overlaps an earlier successful mutation.`,
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
mutations.push({
|
|
303
|
+
callId: item.callId,
|
|
304
|
+
mutation: {
|
|
305
|
+
...mutation,
|
|
306
|
+
resultPresentations: new Map(
|
|
307
|
+
[...mutation.edits.keys()].map((source) => [
|
|
308
|
+
source,
|
|
309
|
+
majorAnchorSources.has(source) ? "major-anchor" : "plain",
|
|
310
|
+
]),
|
|
311
|
+
),
|
|
312
|
+
},
|
|
313
|
+
});
|
|
251
314
|
|
|
252
315
|
for (const [source, edit] of mutation.edits) {
|
|
253
316
|
changes.set(source, [...(changes.get(source) ?? []), ...edit.changes]);
|
|
@@ -304,28 +367,102 @@ export async function executeRegisteredTextBatch(
|
|
|
304
367
|
|
|
305
368
|
const results: FileMutationResult[] = [];
|
|
306
369
|
const callIdsByResult: string[] = [];
|
|
370
|
+
const displayResults: FileMutationResult[] = [];
|
|
371
|
+
const callIdsByDisplayResult: string[] = [];
|
|
372
|
+
const finalCallIdBySource = new Map<string, string>();
|
|
373
|
+
const finalPresentationBySource = new Map<string, MutationResultPresentation>();
|
|
374
|
+
const resultsByCallId = new Map<string, FileMutationResult[]>();
|
|
375
|
+
const displayResultsByCallId = new Map<string, FileMutationResult[]>();
|
|
307
376
|
|
|
308
377
|
for (const { callId, mutation } of completedMutations) {
|
|
309
|
-
|
|
378
|
+
resultsByCallId.set(callId, []);
|
|
379
|
+
const callDisplayResults = [...mutation.edits].flatMap(([source, edit]) => {
|
|
310
380
|
const resource = outcome.resources.find((candidate) => candidate.source === source);
|
|
311
|
-
|
|
312
381
|
if (resource === undefined) {
|
|
313
382
|
return [];
|
|
314
383
|
}
|
|
315
384
|
|
|
316
385
|
const ownAfter = applyTextChanges(resource.before.content, edit.changes).content;
|
|
317
|
-
return [
|
|
386
|
+
return [
|
|
387
|
+
buildSuccessfulTextMutationResult(
|
|
388
|
+
resource,
|
|
389
|
+
source,
|
|
390
|
+
edit,
|
|
391
|
+
ownAfter,
|
|
392
|
+
mutation.resultPresentations.get(source) ?? "plain",
|
|
393
|
+
),
|
|
394
|
+
];
|
|
395
|
+
});
|
|
396
|
+
displayResultsByCallId.set(callId, callDisplayResults);
|
|
397
|
+
displayResults.push(...callDisplayResults);
|
|
398
|
+
callIdsByDisplayResult.push(...callDisplayResults.map(() => callId));
|
|
399
|
+
|
|
400
|
+
for (const source of mutation.edits.keys()) {
|
|
401
|
+
finalCallIdBySource.set(source, callId);
|
|
402
|
+
finalPresentationBySource.set(source, mutation.resultPresentations.get(source) ?? "plain");
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
for (const [source, finalCallId] of finalCallIdBySource) {
|
|
407
|
+
const resource = outcome.resources.find((candidate) => candidate.source === source);
|
|
408
|
+
const edits = outcome.result.mutations.flatMap(({ mutation }) => {
|
|
409
|
+
const edit = mutation.edits.get(source);
|
|
410
|
+
return edit === undefined ? [] : [edit];
|
|
318
411
|
});
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
412
|
+
|
|
413
|
+
if (resource === undefined || edits.length === 0) {
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const result = buildSuccessfulTextMutationResult(
|
|
418
|
+
resource,
|
|
419
|
+
source,
|
|
420
|
+
{
|
|
421
|
+
changes: edits.flatMap((edit) => edit.changes),
|
|
422
|
+
action: edits.some((edit) => edit.action === "overwritten") ? "overwritten" : "edited",
|
|
423
|
+
},
|
|
424
|
+
resource.after.content,
|
|
425
|
+
finalPresentationBySource.get(source) ?? "plain",
|
|
426
|
+
edits.length,
|
|
427
|
+
);
|
|
428
|
+
resultsByCallId.get(finalCallId)?.push(result);
|
|
429
|
+
results.push(result);
|
|
430
|
+
callIdsByResult.push(finalCallId);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
for (const { callId } of completedMutations) {
|
|
434
|
+
const callResults = resultsByCallId.get(callId) ?? [];
|
|
435
|
+
const callDisplayResults = displayResultsByCallId.get(callId) ?? [];
|
|
436
|
+
reporter.complete(
|
|
437
|
+
callId,
|
|
438
|
+
textBatchResult(
|
|
439
|
+
callResults,
|
|
440
|
+
callResults.map(() => callId),
|
|
441
|
+
callDisplayResults,
|
|
442
|
+
callDisplayResults.map(() => callId),
|
|
443
|
+
),
|
|
322
444
|
);
|
|
323
|
-
reporter.complete(callId, callResult);
|
|
324
|
-
results.push(...callResults);
|
|
325
|
-
callIdsByResult.push(...callResults.map(() => callId));
|
|
326
445
|
}
|
|
327
446
|
|
|
328
447
|
for (const failure of failures) {
|
|
448
|
+
const anchorFailures =
|
|
449
|
+
failure.error instanceof TextMutationAnchorAggregateError
|
|
450
|
+
? failure.error.failures
|
|
451
|
+
: failure.error instanceof TextMutationAnchorResolutionError
|
|
452
|
+
? [failure.error]
|
|
453
|
+
: [];
|
|
454
|
+
for (const anchorFailure of anchorFailures) {
|
|
455
|
+
const resource = outcome.resources.find(({ source }) => source === anchorFailure.source);
|
|
456
|
+
if (resource !== undefined) {
|
|
457
|
+
await anchorFailure.resolution.refreshRecovery({
|
|
458
|
+
source: resource.source,
|
|
459
|
+
content: resource.after.content,
|
|
460
|
+
lines: resource.after.lines.map(({ content }) => content),
|
|
461
|
+
cwd: context.cwd,
|
|
462
|
+
...(signal !== undefined && { signal }),
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
329
466
|
const failedResult = await buildFailedTextMutationResult(
|
|
330
467
|
core,
|
|
331
468
|
{
|
|
@@ -345,13 +482,20 @@ export async function executeRegisteredTextBatch(
|
|
|
345
482
|
});
|
|
346
483
|
results.push(...failureResults);
|
|
347
484
|
callIdsByResult.push(...failureResults.map(() => failure.callId));
|
|
485
|
+
displayResults.push(...failureResults);
|
|
486
|
+
callIdsByDisplayResult.push(...failureResults.map(() => failure.callId));
|
|
348
487
|
}
|
|
349
488
|
|
|
350
489
|
onUpdate?.({
|
|
351
490
|
content: [{ type: "text", text: "post-edit progress" }],
|
|
352
|
-
details: {
|
|
491
|
+
details: {
|
|
492
|
+
results: [...results],
|
|
493
|
+
callIdsByResult: [...callIdsByResult],
|
|
494
|
+
displayResults: [...displayResults],
|
|
495
|
+
callIdsByDisplayResult: [...callIdsByDisplayResult],
|
|
496
|
+
},
|
|
353
497
|
});
|
|
354
|
-
return textBatchResult(results, callIdsByResult);
|
|
498
|
+
return textBatchResult(results, callIdsByResult, displayResults, callIdsByDisplayResult);
|
|
355
499
|
}
|
|
356
500
|
|
|
357
501
|
async function failTextBatch(
|
|
@@ -398,6 +542,19 @@ function isTextResourceEditFailure(value: unknown): value is TextResourceEditFai
|
|
|
398
542
|
);
|
|
399
543
|
}
|
|
400
544
|
|
|
545
|
+
function textChangesConflict(left: TextChange, right: TextChange): boolean {
|
|
546
|
+
if (left.from === left.to && right.from === right.to) {
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
if (left.from === left.to) {
|
|
550
|
+
return left.from > right.from && left.from < right.to;
|
|
551
|
+
}
|
|
552
|
+
if (right.from === right.to) {
|
|
553
|
+
return right.from > left.from && right.from < left.to;
|
|
554
|
+
}
|
|
555
|
+
return left.from < right.to && right.from < left.to;
|
|
556
|
+
}
|
|
557
|
+
|
|
401
558
|
function errorMessage(error: unknown): string {
|
|
402
559
|
return error instanceof Error ? error.message : String(error);
|
|
403
560
|
}
|
|
@@ -409,10 +566,12 @@ function asTextBatchParams(value: unknown): TextBatchParams {
|
|
|
409
566
|
function textBatchResult(
|
|
410
567
|
results: FileMutationResult[],
|
|
411
568
|
callIdsByResult: string[],
|
|
569
|
+
displayResults: FileMutationResult[] = results,
|
|
570
|
+
callIdsByDisplayResult: string[] = callIdsByResult,
|
|
412
571
|
): AgentToolResult<TextBatchDetails> {
|
|
413
572
|
return {
|
|
414
573
|
content: [new FileMutationAgentResult(results).toTextContent()],
|
|
415
|
-
details: { results, callIdsByResult },
|
|
574
|
+
details: { results, callIdsByResult, displayResults, callIdsByDisplayResult },
|
|
416
575
|
};
|
|
417
576
|
}
|
|
418
577
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { requiredValue } from "
|
|
1
|
+
import { requiredValue } from "pi-agent-invariant";
|
|
2
2
|
import { type FileMutationBatchResult, FileMutationResult } from "#src/api/mutation-result.js";
|
|
3
3
|
import { createUnifiedDiff } from "#src/core/mutation-result/diff.js";
|
|
4
4
|
import { FileMutationAgentResult } from "#src/core/mutation-result/file-mutation-agent-result.js";
|
|
@@ -18,6 +18,10 @@ export interface TextBatchEntry extends Record<string, unknown> {
|
|
|
18
18
|
|
|
19
19
|
export interface TextBatchDetails extends FileMutationBatchResult {
|
|
20
20
|
readonly callIdsByResult: readonly string[];
|
|
21
|
+
/** Per-call results retained for the user-facing renderer. */
|
|
22
|
+
readonly displayResults?: readonly FileMutationResult[];
|
|
23
|
+
/** Original call id for each user-facing result. */
|
|
24
|
+
readonly callIdsByDisplayResult?: readonly string[];
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
function resultPath(result: FileMutationResult): string | undefined {
|
|
@@ -31,31 +35,57 @@ export function splitTextBatchResult(
|
|
|
31
35
|
calls: readonly OriginalToolCall[],
|
|
32
36
|
): ReadonlyMap<string, AgentToolResult<unknown>> {
|
|
33
37
|
const details = aggregate.details as TextBatchDetails | undefined;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const agentResultsByCall = groupResultsByCall(
|
|
39
|
+
calls,
|
|
40
|
+
details?.results ?? [],
|
|
41
|
+
details?.callIdsByResult ?? [],
|
|
42
|
+
);
|
|
43
|
+
const displayResultsByCall = groupResultsByCall(
|
|
44
|
+
calls,
|
|
45
|
+
details?.displayResults ?? details?.results ?? [],
|
|
46
|
+
details?.callIdsByDisplayResult ?? details?.callIdsByResult ?? [],
|
|
47
|
+
);
|
|
43
48
|
|
|
44
49
|
return new Map(
|
|
45
50
|
calls.map((call) => {
|
|
46
|
-
const
|
|
51
|
+
const agentResults = coalesceResults(agentResultsByCall.get(call.id) ?? []);
|
|
52
|
+
const displayResults = coalesceResults(displayResultsByCall.get(call.id) ?? []);
|
|
47
53
|
return [
|
|
48
54
|
call.id,
|
|
49
55
|
{
|
|
50
56
|
content:
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
agentResults.length === 0
|
|
58
|
+
? [
|
|
59
|
+
{
|
|
60
|
+
type: "text" as const,
|
|
61
|
+
text: "Batch edit applied; the final file result is in the last successful tool call for that file.",
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
: [new FileMutationAgentResult(agentResults).toTextContent()],
|
|
65
|
+
details: { results: displayResults },
|
|
53
66
|
},
|
|
54
67
|
];
|
|
55
68
|
}),
|
|
56
69
|
);
|
|
57
70
|
}
|
|
58
71
|
|
|
72
|
+
function groupResultsByCall(
|
|
73
|
+
calls: readonly OriginalToolCall[],
|
|
74
|
+
results: readonly FileMutationResult[],
|
|
75
|
+
callIdsByResult: readonly string[],
|
|
76
|
+
): ReadonlyMap<string, FileMutationResult[]> {
|
|
77
|
+
const grouped = new Map(calls.map((call) => [call.id, [] as FileMutationResult[]]));
|
|
78
|
+
|
|
79
|
+
for (const [index, result] of results.entries()) {
|
|
80
|
+
const callId = callIdsByResult[index];
|
|
81
|
+
if (callId !== undefined) {
|
|
82
|
+
grouped.get(callId)?.push(result);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return grouped;
|
|
87
|
+
}
|
|
88
|
+
|
|
59
89
|
function coalesceResults(results: readonly FileMutationResult[]): FileMutationResult[] {
|
|
60
90
|
const grouped = new Map<string, FileMutationResult[]>();
|
|
61
91
|
const ungrouped: FileMutationResult[] = [];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
export interface TextEditorRecoverySection {
|
|
5
|
+
readonly contextLines: number;
|
|
6
|
+
readonly timeoutMs: number;
|
|
7
|
+
readonly settings: unknown;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface LoadedTextEditorConfig {
|
|
11
|
+
readonly contextLines: number;
|
|
12
|
+
readonly timeoutMs: number;
|
|
13
|
+
readonly sections: Readonly<Record<string, unknown>>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Loads generic recovery settings and preserves plugin-owned subsections. */
|
|
17
|
+
export function loadTextEditorConfig(cwd: string): LoadedTextEditorConfig {
|
|
18
|
+
const file = path.join(cwd, ".pi", "pi-agent-ide", "text-editor.json");
|
|
19
|
+
let value: unknown;
|
|
20
|
+
try {
|
|
21
|
+
value = JSON.parse(readFileSync(file, "utf8"));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (isMissingFile(error)) {
|
|
24
|
+
return { contextLines: 5, timeoutMs: 2000, sections: {} };
|
|
25
|
+
}
|
|
26
|
+
throw new Error(`Invalid text editor config at ${file}`, { cause: error });
|
|
27
|
+
}
|
|
28
|
+
const root = record(value, "text editor config");
|
|
29
|
+
assertKeys(root, ["recovery", "renderer"], "text editor config");
|
|
30
|
+
if (root.recovery === undefined) {
|
|
31
|
+
return { contextLines: 5, timeoutMs: 2000, sections: {} };
|
|
32
|
+
}
|
|
33
|
+
const recovery = record(root.recovery, "recovery");
|
|
34
|
+
const sections = Object.fromEntries(
|
|
35
|
+
Object.entries(recovery).filter(([key]) => key !== "contextLines" && key !== "timeoutMs"),
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
contextLines: integer(recovery.contextLines, "contextLines", 0, 20, 5),
|
|
39
|
+
timeoutMs: integer(recovery.timeoutMs, "timeoutMs", 1, 10_000, 2000),
|
|
40
|
+
sections,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Returns one plugin-owned recovery subsection with generic limits. */
|
|
45
|
+
export function recoverySection(
|
|
46
|
+
config: LoadedTextEditorConfig,
|
|
47
|
+
name: string,
|
|
48
|
+
): TextEditorRecoverySection {
|
|
49
|
+
if (name.length === 0) {
|
|
50
|
+
throw new TypeError("Recovery config section name must be non-empty");
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
contextLines: config.contextLines,
|
|
54
|
+
timeoutMs: config.timeoutMs,
|
|
55
|
+
settings: config.sections[name],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function record(value: unknown, name: string): Record<string, unknown> {
|
|
60
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
61
|
+
throw new TypeError(`${name} must be an object`);
|
|
62
|
+
}
|
|
63
|
+
return Object.fromEntries(Object.entries(value));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function assertKeys(
|
|
67
|
+
value: Record<string, unknown>,
|
|
68
|
+
allowed: readonly string[],
|
|
69
|
+
name: string,
|
|
70
|
+
): void {
|
|
71
|
+
const unknown = Object.keys(value).find((key) => !allowed.includes(key));
|
|
72
|
+
if (unknown !== undefined) {
|
|
73
|
+
throw new TypeError(`${name} contains unknown key ${unknown}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function integer(
|
|
78
|
+
value: unknown,
|
|
79
|
+
name: string,
|
|
80
|
+
minimum: number,
|
|
81
|
+
maximum: number,
|
|
82
|
+
fallback: number,
|
|
83
|
+
): number {
|
|
84
|
+
if (value === undefined) {
|
|
85
|
+
return fallback;
|
|
86
|
+
}
|
|
87
|
+
if (!Number.isInteger(value) || typeof value !== "number" || value < minimum || value > maximum) {
|
|
88
|
+
throw new RangeError(`${name} must be an integer between ${minimum} and ${maximum}`);
|
|
89
|
+
}
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function isMissingFile(error: unknown): boolean {
|
|
94
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
95
|
+
}
|