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
|
@@ -14,7 +14,8 @@ import type {
|
|
|
14
14
|
TextDocument,
|
|
15
15
|
TextLine,
|
|
16
16
|
TextLinePresentation,
|
|
17
|
-
|
|
17
|
+
TextLinePresenter,
|
|
18
|
+
TextTargetResolver,
|
|
18
19
|
} from "pi-agent-text";
|
|
19
20
|
|
|
20
21
|
export type ReadPipelineStage = "pre-read" | "read" | "post-read";
|
|
@@ -25,13 +26,17 @@ export interface ReadRequest {
|
|
|
25
26
|
readonly path?: string;
|
|
26
27
|
readonly offset?: number;
|
|
27
28
|
readonly limit?: number;
|
|
29
|
+
/** Requested presentation views; without them text reads return raw content. */
|
|
30
|
+
readonly views?: readonly string[];
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
export interface ReadFailure {
|
|
31
34
|
readonly code:
|
|
35
|
+
| "FRAGMENT_FAILED"
|
|
32
36
|
| "INVALID_REQUEST"
|
|
33
37
|
| "INVALID_RESOLVER_RESULT"
|
|
34
38
|
| "INVALID_RESOURCE_CONTENT"
|
|
39
|
+
| "NO_FRAGMENT_RESOLVER"
|
|
35
40
|
| "NO_RESOLVER"
|
|
36
41
|
| "PIPELINE_FAILED"
|
|
37
42
|
| "READ_FAILED"
|
|
@@ -56,6 +61,45 @@ export interface ResourceResolverRegistration {
|
|
|
56
61
|
readonly preserveTruncatedOutput?: boolean;
|
|
57
62
|
}
|
|
58
63
|
|
|
64
|
+
export interface TextTargetResolverRegistration {
|
|
65
|
+
readonly resolver: TextTargetResolver;
|
|
66
|
+
readonly priority?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Input for resolving the anchor fragment of an anchored read source. */
|
|
70
|
+
export interface ReadFragmentContext {
|
|
71
|
+
readonly source: string;
|
|
72
|
+
readonly fragment: string;
|
|
73
|
+
readonly text: TextDocument;
|
|
74
|
+
readonly cwd: string;
|
|
75
|
+
readonly signal?: AbortSignal;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** One fragment resolver's outcome for an anchored read. */
|
|
79
|
+
export type ReadFragmentResolution =
|
|
80
|
+
| { readonly kind: "resolved"; readonly originLine: number }
|
|
81
|
+
| { readonly kind: "not-handled" }
|
|
82
|
+
| { readonly kind: "failed"; readonly message: string };
|
|
83
|
+
|
|
84
|
+
export interface FragmentResolverRegistration {
|
|
85
|
+
readonly id: string;
|
|
86
|
+
readonly priority?: number;
|
|
87
|
+
resolve(context: ReadFragmentContext): ReadFragmentResolution | Promise<ReadFragmentResolution>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* One named presentation view. A view collects line annotations (prefixes, suffixes,
|
|
92
|
+
* extra rows) that the read output shows only when the request lists the view name.
|
|
93
|
+
* Several plugins may contribute presenters under one view name.
|
|
94
|
+
*/
|
|
95
|
+
export interface ReadViewRegistration {
|
|
96
|
+
readonly view: string;
|
|
97
|
+
/** Requested views whose complete presentation this view already provides. */
|
|
98
|
+
readonly includes?: readonly string[];
|
|
99
|
+
readonly presenter: TextLinePresenter;
|
|
100
|
+
readonly priority?: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
59
103
|
export type ReadTextLinePresentation = TextLinePresentation;
|
|
60
104
|
|
|
61
105
|
export type ReadTextLine = TextLine;
|
|
@@ -111,6 +155,8 @@ export interface ReadResultDetails extends UnsupportedContentDetails {
|
|
|
111
155
|
readonly truncation?: TruncationResult;
|
|
112
156
|
readonly temporarySource?: string;
|
|
113
157
|
readonly lines?: readonly ReadTextLine[];
|
|
158
|
+
/** Requested view names that no registration backed; they were ignored. */
|
|
159
|
+
readonly ignoredViews?: readonly string[];
|
|
114
160
|
readonly failure?: ReadFailure;
|
|
115
161
|
}
|
|
116
162
|
|
|
@@ -149,9 +195,15 @@ export type PromptDescriptionSource = string | (() => string | undefined);
|
|
|
149
195
|
export interface ReadToolPluginApi {
|
|
150
196
|
read(request: ReadRequest, context: ResourceResolverContext): Promise<ReadToolResult>;
|
|
151
197
|
addResolver(registration: ResourceResolverRegistration): void;
|
|
198
|
+
addTargetResolver(registration: TextTargetResolverRegistration): void;
|
|
152
199
|
addHandler(registration: ReadHandlerRegistration): void;
|
|
153
|
-
|
|
200
|
+
/** Registers a named view whose presenter runs when a request lists the view. */
|
|
201
|
+
addView(registration: ReadViewRegistration): void;
|
|
202
|
+
addFragmentResolver(registration: FragmentResolverRegistration): void;
|
|
154
203
|
describe(description: PromptDescriptionSource): void;
|
|
204
|
+
|
|
205
|
+
/** Adds an operational rule to the read tool's system-prompt guidelines. */
|
|
206
|
+
addPromptGuideline(guideline: PromptDescriptionSource): void;
|
|
155
207
|
}
|
|
156
208
|
|
|
157
209
|
const functionSchema = Type.Function([], Type.Unknown());
|
|
@@ -161,6 +213,21 @@ const resourceResolverRegistrationSchema = Type.Object({
|
|
|
161
213
|
renderResult: Type.Optional(functionSchema),
|
|
162
214
|
preserveTruncatedOutput: Type.Optional(Type.Boolean()),
|
|
163
215
|
});
|
|
216
|
+
const textTargetResolverRegistrationSchema = Type.Object({
|
|
217
|
+
resolver: Type.Unknown(),
|
|
218
|
+
priority: Type.Optional(Type.Number()),
|
|
219
|
+
});
|
|
220
|
+
const fragmentResolverRegistrationSchema = Type.Object({
|
|
221
|
+
id: Type.String({ pattern: "\\S" }),
|
|
222
|
+
priority: Type.Optional(Type.Number()),
|
|
223
|
+
resolve: functionSchema,
|
|
224
|
+
});
|
|
225
|
+
const viewRegistrationSchema = Type.Object({
|
|
226
|
+
view: Type.String({ pattern: "\\S" }),
|
|
227
|
+
includes: Type.Optional(Type.Array(Type.String({ pattern: "\\S" }))),
|
|
228
|
+
presenter: Type.Object({ id: Type.String(), present: functionSchema }),
|
|
229
|
+
priority: Type.Optional(Type.Number()),
|
|
230
|
+
});
|
|
164
231
|
const readHandlerWhenSchema = Type.Object({
|
|
165
232
|
resolvedBy: Type.String({ pattern: "\\S" }),
|
|
166
233
|
contentKind: Type.Union([Type.Literal("text"), Type.Literal("any")]),
|
|
@@ -175,6 +242,20 @@ const readHandlerRegistrationSchema = Type.Union([
|
|
|
175
242
|
Type.Object({ stage: Type.Literal("post-read"), handler: functionSchema }),
|
|
176
243
|
]);
|
|
177
244
|
|
|
245
|
+
export function isTextTargetResolverRegistration(
|
|
246
|
+
value: unknown,
|
|
247
|
+
): value is TextTargetResolverRegistration {
|
|
248
|
+
if (!Value.Check(textTargetResolverRegistrationSchema, value)) return false;
|
|
249
|
+
const registration = value as { resolver?: unknown };
|
|
250
|
+
const resolver = registration.resolver as { id?: unknown; tryResolve?: unknown };
|
|
251
|
+
return (
|
|
252
|
+
typeof resolver.id === "string" &&
|
|
253
|
+
resolver.id.length > 0 &&
|
|
254
|
+
typeof resolver.tryResolve === "function" &&
|
|
255
|
+
(!("priority" in registration) || typeof registration.priority === "number")
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
178
259
|
export function isResourceResolverRegistration(
|
|
179
260
|
value: unknown,
|
|
180
261
|
): value is ResourceResolverRegistration {
|
|
@@ -198,3 +279,33 @@ export function isResourceResolverRegistration(
|
|
|
198
279
|
export function isReadHandlerRegistration(value: unknown): value is ReadHandlerRegistration {
|
|
199
280
|
return Value.Check(readHandlerRegistrationSchema, value);
|
|
200
281
|
}
|
|
282
|
+
|
|
283
|
+
export function isReadViewRegistration(value: unknown): value is ReadViewRegistration {
|
|
284
|
+
return Value.Check(viewRegistrationSchema, value);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export function isFragmentResolverRegistration(
|
|
288
|
+
value: unknown,
|
|
289
|
+
): value is FragmentResolverRegistration {
|
|
290
|
+
return Value.Check(fragmentResolverRegistrationSchema, value);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export function isReadFragmentResolution(value: unknown): value is ReadFragmentResolution {
|
|
294
|
+
if (!isRecord(value)) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (value.kind === "not-handled") {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (value.kind === "failed") {
|
|
303
|
+
return typeof value.message === "string" && value.message.length > 0;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return value.kind === "resolved" && typeof value.originLine === "number";
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
310
|
+
return typeof value === "object" && value !== null;
|
|
311
|
+
}
|
|
@@ -13,6 +13,12 @@ import {
|
|
|
13
13
|
} from "#src/api/plugin-protocol.js";
|
|
14
14
|
import { createReadCore } from "#src/core/read-core.js";
|
|
15
15
|
|
|
16
|
+
import { compactReadDetails } from "#src/core/tools/read/persisted-result.js";
|
|
17
|
+
|
|
18
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
19
|
+
return typeof value === "object" && value !== null;
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
export default async function registerReadCore(pi: ExtensionAPI): Promise<void> {
|
|
17
23
|
const core = createReadCore();
|
|
18
24
|
|
|
@@ -30,6 +36,19 @@ export default async function registerReadCore(pi: ExtensionAPI): Promise<void>
|
|
|
30
36
|
|
|
31
37
|
const interceptionRendering = new ToolCallInterceptionRenderStore();
|
|
32
38
|
pi.registerTool(withToolCallInterceptionRendering(core.read.tool, interceptionRendering));
|
|
39
|
+
pi.on("tool_result", (event) => {
|
|
40
|
+
if (event.toolName !== "read" || !isRecord(event.details)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
details: compactReadDetails(
|
|
46
|
+
event.details,
|
|
47
|
+
event.content.flatMap((block) => (block.type === "text" ? [block.text] : [])).join("\n"),
|
|
48
|
+
),
|
|
49
|
+
...(event.details.failure !== undefined && { isError: true }),
|
|
50
|
+
};
|
|
51
|
+
});
|
|
33
52
|
pi.events.emit(READ_CORE_READY_EVENT, {
|
|
34
53
|
protocol: READ_PROTOCOL,
|
|
35
54
|
apiVersion: READ_API_VERSION,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { isTextPresenterRegistration, type TextPresenterRegistration } from "pi-agent-text";
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
READ_API_VERSION,
|
|
5
3
|
READ_PROTOCOL,
|
|
@@ -7,11 +5,17 @@ import {
|
|
|
7
5
|
type ReadPluginApi,
|
|
8
6
|
} from "#src/api/plugin-protocol.js";
|
|
9
7
|
import {
|
|
8
|
+
isFragmentResolverRegistration,
|
|
10
9
|
isReadHandlerRegistration,
|
|
10
|
+
isReadViewRegistration,
|
|
11
11
|
isResourceResolverRegistration,
|
|
12
|
+
isTextTargetResolverRegistration,
|
|
13
|
+
type FragmentResolverRegistration,
|
|
12
14
|
type PromptDescriptionSource,
|
|
13
15
|
type ReadHandlerRegistration,
|
|
16
|
+
type ReadViewRegistration,
|
|
14
17
|
type ResourceResolverRegistration,
|
|
18
|
+
type TextTargetResolverRegistration,
|
|
15
19
|
} from "#src/api/tools/read.js";
|
|
16
20
|
import { createReadTool, type ReadTool } from "#src/core/tools/tool-read.js";
|
|
17
21
|
|
|
@@ -25,6 +29,8 @@ interface RegisteredPlugin {
|
|
|
25
29
|
readonly lifecycle: PluginLifecycle;
|
|
26
30
|
readonly plugin: ReadPlugin;
|
|
27
31
|
readonly promptContributions: PromptDescriptionSource[];
|
|
32
|
+
|
|
33
|
+
readonly promptGuidelines: PromptDescriptionSource[];
|
|
28
34
|
readonly ready: Promise<void>;
|
|
29
35
|
}
|
|
30
36
|
|
|
@@ -44,7 +50,7 @@ export interface ReadCore {
|
|
|
44
50
|
export function createReadCore(): ReadCore {
|
|
45
51
|
const pendingPlugins = new Set<Promise<void>>();
|
|
46
52
|
const plugins = new Map<string, RegisteredPlugin>();
|
|
47
|
-
const read = createReadTool(() =>
|
|
53
|
+
const read = createReadTool(() => renderPromptGuidelines(plugins));
|
|
48
54
|
let registrationQueue = Promise.resolve();
|
|
49
55
|
|
|
50
56
|
return {
|
|
@@ -68,9 +74,12 @@ export function createReadCore(): ReadCore {
|
|
|
68
74
|
|
|
69
75
|
const lifecycle: PluginLifecycle = { status: "pending" };
|
|
70
76
|
const promptContributions: PromptDescriptionSource[] = [];
|
|
77
|
+
|
|
78
|
+
const promptGuidelines: PromptDescriptionSource[] = [];
|
|
71
79
|
const contributions = createPluginContributionController(
|
|
72
80
|
plugin.id,
|
|
73
81
|
read,
|
|
82
|
+
promptGuidelines,
|
|
74
83
|
promptContributions,
|
|
75
84
|
);
|
|
76
85
|
const ready = registrationQueue.then(async () => {
|
|
@@ -87,6 +96,7 @@ export function createReadCore(): ReadCore {
|
|
|
87
96
|
const registeredPlugin: RegisteredPlugin = {
|
|
88
97
|
lifecycle,
|
|
89
98
|
plugin,
|
|
99
|
+
promptGuidelines,
|
|
90
100
|
promptContributions,
|
|
91
101
|
ready,
|
|
92
102
|
};
|
|
@@ -142,12 +152,17 @@ function getPluginValidationError(plugin: {
|
|
|
142
152
|
function createPluginContributionController(
|
|
143
153
|
pluginId: string,
|
|
144
154
|
read: ReadTool,
|
|
155
|
+
promptGuidelines: PromptDescriptionSource[],
|
|
145
156
|
promptContributions: PromptDescriptionSource[],
|
|
146
157
|
): PluginContributionController {
|
|
147
158
|
const setupPromptContributions: PromptDescriptionSource[] = [];
|
|
159
|
+
|
|
160
|
+
const setupPromptGuidelines: PromptDescriptionSource[] = [];
|
|
148
161
|
const setupResolvers: ResourceResolverRegistration[] = [];
|
|
162
|
+
const setupTargetResolvers: TextTargetResolverRegistration[] = [];
|
|
149
163
|
const setupReadHandlers: ReadHandlerRegistration[] = [];
|
|
150
|
-
const
|
|
164
|
+
const setupViews: ReadViewRegistration[] = [];
|
|
165
|
+
const setupFragmentResolvers: FragmentResolverRegistration[] = [];
|
|
151
166
|
let state: "active" | "closed" | "setup" = "setup";
|
|
152
167
|
const assertAvailable = (): void => {
|
|
153
168
|
if (state === "closed") {
|
|
@@ -161,18 +176,26 @@ function createPluginContributionController(
|
|
|
161
176
|
},
|
|
162
177
|
addResolver(registration): void {
|
|
163
178
|
assertAvailable();
|
|
164
|
-
|
|
165
179
|
if (!isResourceResolverRegistration(registration)) {
|
|
166
180
|
throw new TypeError(`Plugin ${pluginId} provided an invalid resource resolver`);
|
|
167
181
|
}
|
|
168
|
-
|
|
169
182
|
if (state === "setup") {
|
|
170
183
|
setupResolvers.push(registration);
|
|
171
184
|
return;
|
|
172
185
|
}
|
|
173
|
-
|
|
174
186
|
read.registerContributions(pluginId, { resolvers: [registration] });
|
|
175
187
|
},
|
|
188
|
+
addTargetResolver(registration): void {
|
|
189
|
+
assertAvailable();
|
|
190
|
+
if (!isTextTargetResolverRegistration(registration)) {
|
|
191
|
+
throw new TypeError(`Plugin ${pluginId} provided an invalid text target resolver`);
|
|
192
|
+
}
|
|
193
|
+
if (state === "setup") {
|
|
194
|
+
setupTargetResolvers.push(registration);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
read.registerContributions(pluginId, { targetResolvers: [registration] });
|
|
198
|
+
},
|
|
176
199
|
addHandler(registration): void {
|
|
177
200
|
assertAvailable();
|
|
178
201
|
|
|
@@ -187,19 +210,33 @@ function createPluginContributionController(
|
|
|
187
210
|
|
|
188
211
|
read.registerContributions(pluginId, { handlers: [registration] });
|
|
189
212
|
},
|
|
190
|
-
|
|
213
|
+
addView(registration): void {
|
|
214
|
+
assertAvailable();
|
|
215
|
+
|
|
216
|
+
if (!isReadViewRegistration(registration)) {
|
|
217
|
+
throw new TypeError(`Plugin ${pluginId} provided an invalid view registration`);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (state === "setup") {
|
|
221
|
+
setupViews.push(registration);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
read.registerContributions(pluginId, { views: [registration] });
|
|
226
|
+
},
|
|
227
|
+
addFragmentResolver(registration): void {
|
|
191
228
|
assertAvailable();
|
|
192
229
|
|
|
193
|
-
if (!
|
|
194
|
-
throw new TypeError(`Plugin ${pluginId} provided an invalid
|
|
230
|
+
if (!isFragmentResolverRegistration(registration)) {
|
|
231
|
+
throw new TypeError(`Plugin ${pluginId} provided an invalid fragment resolver`);
|
|
195
232
|
}
|
|
196
233
|
|
|
197
234
|
if (state === "setup") {
|
|
198
|
-
|
|
235
|
+
setupFragmentResolvers.push(registration);
|
|
199
236
|
return;
|
|
200
237
|
}
|
|
201
238
|
|
|
202
|
-
read.registerContributions(pluginId, {
|
|
239
|
+
read.registerContributions(pluginId, { fragments: [registration] });
|
|
203
240
|
},
|
|
204
241
|
describe(description): void {
|
|
205
242
|
assertAvailable();
|
|
@@ -217,6 +254,18 @@ function createPluginContributionController(
|
|
|
217
254
|
|
|
218
255
|
promptContributions.push(normalized);
|
|
219
256
|
},
|
|
257
|
+
|
|
258
|
+
addPromptGuideline(guideline): void {
|
|
259
|
+
assertAvailable();
|
|
260
|
+
const normalized = normalizeDescriptionSource(guideline);
|
|
261
|
+
|
|
262
|
+
if (state === "setup") {
|
|
263
|
+
setupPromptGuidelines.push(normalized);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
promptGuidelines.push(normalized);
|
|
268
|
+
},
|
|
220
269
|
};
|
|
221
270
|
|
|
222
271
|
return {
|
|
@@ -231,15 +280,38 @@ function createPluginContributionController(
|
|
|
231
280
|
|
|
232
281
|
read.registerContributions(pluginId, {
|
|
233
282
|
resolvers: setupResolvers,
|
|
283
|
+
targetResolvers: setupTargetResolvers,
|
|
234
284
|
handlers: setupReadHandlers,
|
|
235
|
-
|
|
285
|
+
views: setupViews,
|
|
286
|
+
fragments: setupFragmentResolvers,
|
|
236
287
|
});
|
|
237
288
|
promptContributions.push(...setupPromptContributions);
|
|
289
|
+
|
|
290
|
+
promptGuidelines.push(...setupPromptGuidelines);
|
|
238
291
|
state = "active";
|
|
239
292
|
},
|
|
240
293
|
};
|
|
241
294
|
}
|
|
242
295
|
|
|
296
|
+
function renderPromptGuidelines(plugins: ReadonlyMap<string, RegisteredPlugin>): readonly string[] {
|
|
297
|
+
const guidelines: string[] = [];
|
|
298
|
+
|
|
299
|
+
for (const registeredPlugin of plugins.values()) {
|
|
300
|
+
if (registeredPlugin.lifecycle.status !== "active") {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
for (const source of registeredPlugin.promptGuidelines) {
|
|
305
|
+
const guideline = renderDescriptionSource(source);
|
|
306
|
+
if (guideline !== undefined) {
|
|
307
|
+
guidelines.push(guideline);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return guidelines;
|
|
313
|
+
}
|
|
314
|
+
|
|
243
315
|
function renderPluginPromptGuideline(
|
|
244
316
|
plugins: ReadonlyMap<string, RegisteredPlugin>,
|
|
245
317
|
): string | undefined {
|
|
@@ -8,6 +8,11 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import type { ReadRequest, ReadResultDetails, ReadToolResult } from "#src/api/tools/read.js";
|
|
10
10
|
|
|
11
|
+
export interface ReadTruncationOptions {
|
|
12
|
+
/** Absolute 1-based line where an anchored read's window starts. */
|
|
13
|
+
readonly originLine?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
export const READ_OUTPUT_MAX_BYTES = DEFAULT_MAX_BYTES;
|
|
12
17
|
|
|
13
18
|
export const READ_OUTPUT_MAX_LINES = DEFAULT_MAX_LINES;
|
|
@@ -16,7 +21,9 @@ export async function limitReadOutput(
|
|
|
16
21
|
result: ReadToolResult,
|
|
17
22
|
request: ReadRequest,
|
|
18
23
|
saveFullOutput?: (text: string) => Promise<string>,
|
|
24
|
+
options?: ReadTruncationOptions,
|
|
19
25
|
): Promise<ReadToolResult> {
|
|
26
|
+
const originLine = options?.originLine;
|
|
20
27
|
const block = result.content.length === 1 ? result.content[0] : undefined;
|
|
21
28
|
|
|
22
29
|
if (block?.type !== "text") {
|
|
@@ -33,7 +40,7 @@ export async function limitReadOutput(
|
|
|
33
40
|
saveFullOutput === undefined ? undefined : await saveFullOutput(block.text);
|
|
34
41
|
const baseNotice = truncation.firstLineExceedsLimit
|
|
35
42
|
? oversizedFirstLineNotice(block.text, result.details, request)
|
|
36
|
-
: truncatedOutputNotice(truncation, result.details, request);
|
|
43
|
+
: truncatedOutputNotice(truncation, result.details, request, originLine);
|
|
37
44
|
const notice =
|
|
38
45
|
temporarySource === undefined
|
|
39
46
|
? baseNotice
|
|
@@ -49,7 +56,7 @@ export async function limitReadOutput(
|
|
|
49
56
|
};
|
|
50
57
|
}
|
|
51
58
|
|
|
52
|
-
const notice = explicitLimitNotice(result.details, request);
|
|
59
|
+
const notice = explicitLimitNotice(result.details, request, originLine);
|
|
53
60
|
|
|
54
61
|
if (notice === undefined) {
|
|
55
62
|
return result;
|
|
@@ -85,16 +92,16 @@ function truncatedOutputNotice(
|
|
|
85
92
|
truncation: TruncationResult,
|
|
86
93
|
details: ReadResultDetails,
|
|
87
94
|
request: ReadRequest,
|
|
95
|
+
originLine?: number,
|
|
88
96
|
): string {
|
|
89
97
|
const sourceRange = shownSourceRange(truncation, details, request);
|
|
90
98
|
|
|
91
99
|
if (sourceRange !== undefined && sourceRange.endLine < sourceRange.totalLines) {
|
|
92
100
|
const byteLimit =
|
|
93
101
|
truncation.truncatedBy === "bytes" ? ` (${formatSize(truncation.maxBytes)} limit)` : "";
|
|
102
|
+
const nextOffset = continuationOffset(sourceRange.endLine + 1, originLine);
|
|
94
103
|
|
|
95
|
-
return `[Showing lines ${sourceRange.startLine}-${sourceRange.endLine} of ${sourceRange.totalLines}${byteLimit}. Use offset=${
|
|
96
|
-
sourceRange.endLine + 1
|
|
97
|
-
} to continue.]`;
|
|
104
|
+
return `[Showing lines ${sourceRange.startLine}-${sourceRange.endLine} of ${sourceRange.totalLines}${byteLimit}. Use offset=${nextOffset} to continue.]`;
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
const limit =
|
|
@@ -139,7 +146,11 @@ function shownSourceRange(
|
|
|
139
146
|
};
|
|
140
147
|
}
|
|
141
148
|
|
|
142
|
-
function explicitLimitNotice(
|
|
149
|
+
function explicitLimitNotice(
|
|
150
|
+
details: ReadResultDetails,
|
|
151
|
+
request: ReadRequest,
|
|
152
|
+
originLine?: number,
|
|
153
|
+
): string | undefined {
|
|
143
154
|
if (request.limit === undefined || details.totalLines === undefined || details.totalLines === 0) {
|
|
144
155
|
return undefined;
|
|
145
156
|
}
|
|
@@ -150,15 +161,20 @@ function explicitLimitNotice(details: ReadResultDetails, request: ReadRequest):
|
|
|
150
161
|
return undefined;
|
|
151
162
|
}
|
|
152
163
|
|
|
153
|
-
const
|
|
164
|
+
const nextAbsolute =
|
|
154
165
|
details.endLine === undefined || details.endLine < startLine ? startLine : details.endLine + 1;
|
|
155
166
|
|
|
156
|
-
if (
|
|
167
|
+
if (nextAbsolute > details.totalLines) {
|
|
157
168
|
return undefined;
|
|
158
169
|
}
|
|
159
170
|
|
|
160
|
-
const remaining = details.totalLines -
|
|
161
|
-
return `[${remaining} more lines in source. Use offset=${
|
|
171
|
+
const remaining = details.totalLines - nextAbsolute + 1;
|
|
172
|
+
return `[${remaining} more lines in source. Use offset=${continuationOffset(nextAbsolute, originLine)} to continue.]`;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Converts an absolute next line into the offset the agent should send again. */
|
|
176
|
+
function continuationOffset(absoluteNextLine: number, originLine: number | undefined): number {
|
|
177
|
+
return originLine === undefined ? absoluteNextLine : absoluteNextLine - originLine + 1;
|
|
162
178
|
}
|
|
163
179
|
|
|
164
180
|
function sourceStartLine(details: ReadResultDetails, request: ReadRequest): number | undefined {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { storeText, restoreText, type StoredText } from "pi-agent-text";
|
|
2
|
+
import type { ReadResultDetails, ReadTextLine } from "#src/api/tools/read.js";
|
|
3
|
+
|
|
4
|
+
type StoredLine = readonly [
|
|
5
|
+
number,
|
|
6
|
+
StoredText,
|
|
7
|
+
string,
|
|
8
|
+
ReadTextLine["presentation"]?,
|
|
9
|
+
ReadTextLine["metadata"]?,
|
|
10
|
+
];
|
|
11
|
+
interface StoredReadDetails extends Omit<ReadResultDetails, "lines" | "truncation"> {
|
|
12
|
+
readonly storedLines?: readonly StoredLine[];
|
|
13
|
+
readonly truncation?: Omit<NonNullable<ReadResultDetails["truncation"]>, "content">;
|
|
14
|
+
readonly truncatedText?: StoredText;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Keeps line identity and annotations while reusing the saved model-facing text. */
|
|
18
|
+
export function compactReadDetails(details: ReadResultDetails, text: string): StoredReadDetails {
|
|
19
|
+
const { lines, truncation, ...rest } = details;
|
|
20
|
+
const storedLines = lines?.map((line): StoredLine => {
|
|
21
|
+
const tuple: [
|
|
22
|
+
number,
|
|
23
|
+
StoredText,
|
|
24
|
+
string,
|
|
25
|
+
ReadTextLine["presentation"]?,
|
|
26
|
+
ReadTextLine["metadata"]?,
|
|
27
|
+
] = [line.lineNumber, storeText(line.content, text), line.lineEnding];
|
|
28
|
+
if (line.presentation !== undefined || line.metadata !== undefined)
|
|
29
|
+
tuple.push(line.presentation);
|
|
30
|
+
if (line.metadata !== undefined) tuple.push(line.metadata);
|
|
31
|
+
return tuple;
|
|
32
|
+
});
|
|
33
|
+
const { content, ...truncated } = truncation ?? {};
|
|
34
|
+
return {
|
|
35
|
+
...rest,
|
|
36
|
+
...(storedLines === undefined ? {} : { storedLines }),
|
|
37
|
+
...(truncation === undefined
|
|
38
|
+
? {}
|
|
39
|
+
: {
|
|
40
|
+
truncation: truncated as StoredReadDetails["truncation"],
|
|
41
|
+
truncatedText: storeText(content ?? "", text),
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Recreates renderer inputs from a session result; no source access is needed. */
|
|
47
|
+
export function restoreReadDetails(
|
|
48
|
+
value: ReadResultDetails | StoredReadDetails,
|
|
49
|
+
text: string,
|
|
50
|
+
): ReadResultDetails {
|
|
51
|
+
const stored = value as StoredReadDetails;
|
|
52
|
+
if (stored.storedLines === undefined && stored.truncatedText === undefined)
|
|
53
|
+
return value as ReadResultDetails;
|
|
54
|
+
const { storedLines, truncatedText, truncation, ...rest } = stored;
|
|
55
|
+
return {
|
|
56
|
+
...rest,
|
|
57
|
+
...(storedLines === undefined
|
|
58
|
+
? {}
|
|
59
|
+
: {
|
|
60
|
+
lines: storedLines.map(([lineNumber, content, lineEnding, presentation, metadata]) => ({
|
|
61
|
+
lineNumber,
|
|
62
|
+
content: restoreText(content, text),
|
|
63
|
+
lineEnding,
|
|
64
|
+
...(presentation == null ? {} : { presentation }),
|
|
65
|
+
...(metadata == null ? {} : { metadata }),
|
|
66
|
+
})),
|
|
67
|
+
}),
|
|
68
|
+
...(truncation === undefined
|
|
69
|
+
? {}
|
|
70
|
+
: { truncation: { ...truncation, content: restoreText(truncatedText ?? "", text) } }),
|
|
71
|
+
};
|
|
72
|
+
}
|