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
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
IdeDiagnosticReport,
|
|
6
|
+
IdeDiagnosticResult,
|
|
7
|
+
IdeDiagnosticSnapshot,
|
|
8
|
+
IdeDiagnosticSource,
|
|
9
|
+
} from "#src/api/plugin-protocol.js";
|
|
10
|
+
import type { ToolContext } from "#src/toolchain/types.js";
|
|
11
|
+
|
|
12
|
+
interface FileState {
|
|
13
|
+
readonly cwd: string;
|
|
14
|
+
readonly filePath: string;
|
|
15
|
+
readonly content: string;
|
|
16
|
+
readonly controller: AbortController;
|
|
17
|
+
readonly results: Map<string, IdeDiagnosticResult>;
|
|
18
|
+
readonly jobs: Promise<void>[];
|
|
19
|
+
readonly publications: Map<string, number>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Session-owned background checks shared by reads and compact agent notifications. */
|
|
23
|
+
export class DiagnosticStore {
|
|
24
|
+
private readonly files = new Map<string, FileState>();
|
|
25
|
+
private readonly dirty = new Set<FileState>();
|
|
26
|
+
private readonly sent = new Map<string, string>();
|
|
27
|
+
private readonly queue: (() => Promise<void>)[] = [];
|
|
28
|
+
private running = 0;
|
|
29
|
+
private disposed = false;
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
private readonly sources: readonly IdeDiagnosticSource[],
|
|
33
|
+
private readonly options: {
|
|
34
|
+
readWaitMs?: number;
|
|
35
|
+
checkTimeoutMs?: number;
|
|
36
|
+
concurrency?: number;
|
|
37
|
+
} = {},
|
|
38
|
+
) {}
|
|
39
|
+
|
|
40
|
+
/** Schedule final edit text without waiting for a diagnostic provider. */
|
|
41
|
+
schedule(filePath: string, content: string, { cwd }: ToolContext): void {
|
|
42
|
+
if (!this.disposed) this.ensure(filePath, content, cwd);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Read one current text snapshot; never label unfinished checks as clean. */
|
|
46
|
+
async read(filePath: string, { cwd }: ToolContext): Promise<IdeDiagnosticSnapshot> {
|
|
47
|
+
this.assertActive();
|
|
48
|
+
const absolute = path.resolve(cwd, filePath);
|
|
49
|
+
const content = await readFile(absolute, "utf8");
|
|
50
|
+
this.assertActive();
|
|
51
|
+
const state = this.ensure(absolute, content, cwd);
|
|
52
|
+
await waitAtMost(Promise.all(state.jobs), this.options.readWaitMs ?? 5000);
|
|
53
|
+
this.assertActive();
|
|
54
|
+
const currentText = await readFile(absolute, "utf8");
|
|
55
|
+
this.assertActive();
|
|
56
|
+
const current = this.ensure(absolute, currentText, cwd);
|
|
57
|
+
return { filePath: absolute, content: current.content, results: [...current.results.values()] };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Drain changed current counts at a model boundary, not at each provider event. */
|
|
61
|
+
async takeNotifications(cwd: string): Promise<string[]> {
|
|
62
|
+
const lines: string[] = [];
|
|
63
|
+
for (const state of [...this.dirty]) {
|
|
64
|
+
if (state.cwd !== path.resolve(cwd)) continue;
|
|
65
|
+
this.dirty.delete(state);
|
|
66
|
+
if (!(await this.isCurrent(state))) continue;
|
|
67
|
+
const results = [...state.results.values()];
|
|
68
|
+
const summary = results
|
|
69
|
+
.map((result) => {
|
|
70
|
+
if (result.status === "pending" || result.status === "unavailable") {
|
|
71
|
+
return `${result.source} ${result.status}`;
|
|
72
|
+
}
|
|
73
|
+
const counts = ["error", "warning", "info", "hint"].map(
|
|
74
|
+
(severity) =>
|
|
75
|
+
`${result.diagnostics.filter((item) => item.severity === severity).length} ${severity}`,
|
|
76
|
+
);
|
|
77
|
+
return `${result.source} ${counts.join(", ")}${result.status === "snapshot" ? " (snapshot; completion unknown)" : result.status === "unversioned" ? " (unversioned)" : ""}`;
|
|
78
|
+
})
|
|
79
|
+
.join("; ");
|
|
80
|
+
const key = this.key(state.filePath, state.cwd);
|
|
81
|
+
// Fingerprint details too: a different error with the same count is still a change.
|
|
82
|
+
const fingerprint = JSON.stringify(results);
|
|
83
|
+
if (this.sent.get(key) === fingerprint) continue;
|
|
84
|
+
this.sent.set(key, fingerprint);
|
|
85
|
+
lines.push(
|
|
86
|
+
`${JSON.stringify(path.relative(cwd, state.filePath))}: ${summary || "no diagnostic sources"}.`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return lines;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Invalidate all revision-bound callbacks and cancel session-owned work. */
|
|
93
|
+
dispose(): void {
|
|
94
|
+
this.disposed = true;
|
|
95
|
+
for (const state of this.files.values()) state.controller.abort();
|
|
96
|
+
this.files.clear();
|
|
97
|
+
this.dirty.clear();
|
|
98
|
+
this.sent.clear();
|
|
99
|
+
// Queued jobs drain as cancelled jobs so their waiters can finish.
|
|
100
|
+
this.pump();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private key(filePath: string, cwd: string): string {
|
|
104
|
+
return JSON.stringify([path.resolve(cwd), path.resolve(cwd, filePath)]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private ensure(filePath: string, content: string, cwd: string): FileState {
|
|
108
|
+
const key = this.key(filePath, cwd);
|
|
109
|
+
const previous = this.files.get(key);
|
|
110
|
+
if (previous?.content === content) return previous;
|
|
111
|
+
previous?.controller.abort();
|
|
112
|
+
if (previous) this.dirty.delete(previous);
|
|
113
|
+
const state: FileState = {
|
|
114
|
+
cwd: path.resolve(cwd),
|
|
115
|
+
filePath: path.resolve(cwd, filePath),
|
|
116
|
+
content,
|
|
117
|
+
controller: new AbortController(),
|
|
118
|
+
results: new Map(),
|
|
119
|
+
jobs: [],
|
|
120
|
+
publications: new Map(),
|
|
121
|
+
};
|
|
122
|
+
this.files.set(key, state);
|
|
123
|
+
|
|
124
|
+
if (this.sources.length === 0)
|
|
125
|
+
state.results.set("diagnostics", {
|
|
126
|
+
source: "diagnostics",
|
|
127
|
+
status: "unavailable",
|
|
128
|
+
diagnostics: [],
|
|
129
|
+
reason: "No diagnostic sources registered",
|
|
130
|
+
});
|
|
131
|
+
this.dirty.add(state);
|
|
132
|
+
for (const source of this.sources) {
|
|
133
|
+
state.results.set(source.id, { source: source.id, status: "pending", diagnostics: [] });
|
|
134
|
+
const job = new Promise<void>((resolve) => {
|
|
135
|
+
this.queue.push(async () => {
|
|
136
|
+
try {
|
|
137
|
+
await this.check(state, source);
|
|
138
|
+
} finally {
|
|
139
|
+
resolve();
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
state.jobs.push(job);
|
|
144
|
+
}
|
|
145
|
+
// Start providers after the edit completion observer has returned.
|
|
146
|
+
queueMicrotask(() => this.pump());
|
|
147
|
+
return state;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private pump(): void {
|
|
151
|
+
while (this.running < (this.options.concurrency ?? 4) && this.queue.length > 0) {
|
|
152
|
+
const job = this.queue.shift();
|
|
153
|
+
if (!job) break;
|
|
154
|
+
this.running++;
|
|
155
|
+
void job().finally(() => {
|
|
156
|
+
this.running--;
|
|
157
|
+
this.pump();
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private active(state: FileState): boolean {
|
|
163
|
+
return !this.disposed && !state.controller.signal.aborted;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private assertActive(): void {
|
|
167
|
+
if (this.disposed) throw new Error("Diagnostics session has ended");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
private async isCurrent(state: FileState): Promise<boolean> {
|
|
171
|
+
if (!this.active(state)) return false;
|
|
172
|
+
const content = await readFile(state.filePath, "utf8").catch(() => undefined);
|
|
173
|
+
return this.active(state) && content === state.content;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private async publish(
|
|
177
|
+
state: FileState,
|
|
178
|
+
source: string,
|
|
179
|
+
report: IdeDiagnosticReport,
|
|
180
|
+
): Promise<void> {
|
|
181
|
+
const publication = (state.publications.get(source) ?? 0) + 1;
|
|
182
|
+
state.publications.set(source, publication);
|
|
183
|
+
if (!(await this.isCurrent(state)) || state.publications.get(source) !== publication) return;
|
|
184
|
+
const result: IdeDiagnosticResult = { source, ...report };
|
|
185
|
+
if (JSON.stringify(state.results.get(source)) === JSON.stringify(result)) return;
|
|
186
|
+
state.results.set(source, result);
|
|
187
|
+
this.dirty.add(state);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private async check(state: FileState, source: IdeDiagnosticSource): Promise<void> {
|
|
191
|
+
if (!(await this.isCurrent(state))) return;
|
|
192
|
+
const controller = new AbortController();
|
|
193
|
+
const signal = AbortSignal.any([controller.signal, state.controller.signal]);
|
|
194
|
+
|
|
195
|
+
if (signal.aborted) return;
|
|
196
|
+
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
197
|
+
let onAbort: (() => void) | undefined;
|
|
198
|
+
try {
|
|
199
|
+
const aborted = new Promise<never>((_resolve, reject) => {
|
|
200
|
+
onAbort = () => reject(signal.reason);
|
|
201
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
202
|
+
timeout = setTimeout(
|
|
203
|
+
() => controller.abort(new Error("Diagnostic check timed out")),
|
|
204
|
+
this.options.checkTimeoutMs ?? 30_000,
|
|
205
|
+
);
|
|
206
|
+
});
|
|
207
|
+
const result = await Promise.race([
|
|
208
|
+
source.diagnose(state.filePath, {
|
|
209
|
+
cwd: state.cwd,
|
|
210
|
+
content: state.content,
|
|
211
|
+
signal,
|
|
212
|
+
publish: (report) => {
|
|
213
|
+
if (!signal.aborted) void this.publish(state, source.id, report);
|
|
214
|
+
},
|
|
215
|
+
}),
|
|
216
|
+
aborted,
|
|
217
|
+
]);
|
|
218
|
+
await this.publish(state, source.id, result);
|
|
219
|
+
} catch (error) {
|
|
220
|
+
await this.publish(state, source.id, {
|
|
221
|
+
status: "unavailable",
|
|
222
|
+
diagnostics: [],
|
|
223
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
224
|
+
});
|
|
225
|
+
} finally {
|
|
226
|
+
clearTimeout(timeout);
|
|
227
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
async function waitAtMost(work: Promise<unknown>, milliseconds: number): Promise<void> {
|
|
233
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
234
|
+
try {
|
|
235
|
+
await Promise.race([
|
|
236
|
+
work,
|
|
237
|
+
new Promise<void>((resolve) => {
|
|
238
|
+
timer = setTimeout(resolve, milliseconds);
|
|
239
|
+
}),
|
|
240
|
+
]);
|
|
241
|
+
} finally {
|
|
242
|
+
clearTimeout(timer);
|
|
243
|
+
}
|
|
244
|
+
}
|
package/src/core/extension.ts
CHANGED
|
@@ -10,6 +10,13 @@ import { runIdePostEditGate } from "#src/post-edit/gate.js";
|
|
|
10
10
|
import { resetRegistry } from "#src/toolchain/registry.js";
|
|
11
11
|
import { connectTextEditorPostEditHandler } from "pi-agent-text-editor/api/post-edit";
|
|
12
12
|
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import { connectTextEditorPlugin } from "pi-agent-text-editor/api/connect-plugin";
|
|
15
|
+
import {
|
|
16
|
+
TEXT_EDITOR_PROTOCOL,
|
|
17
|
+
TEXT_EDITOR_API_VERSION,
|
|
18
|
+
} from "pi-agent-text-editor/api/plugin-protocol";
|
|
19
|
+
|
|
13
20
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
14
21
|
|
|
15
22
|
export default async function registerPiAgentIde(pi: ExtensionAPI): Promise<void> {
|
|
@@ -29,6 +36,7 @@ export default async function registerPiAgentIde(pi: ExtensionAPI): Promise<void
|
|
|
29
36
|
});
|
|
30
37
|
pi.on("session_shutdown", () => {
|
|
31
38
|
unsubscribePlugins();
|
|
39
|
+
core.diagnostics.dispose();
|
|
32
40
|
resetRegistry();
|
|
33
41
|
});
|
|
34
42
|
connectTextEditorPostEditHandler(pi, {
|
|
@@ -40,5 +48,37 @@ export default async function registerPiAgentIde(pi: ExtensionAPI): Promise<void
|
|
|
40
48
|
apiVersion: IDE_API_VERSION,
|
|
41
49
|
});
|
|
42
50
|
|
|
51
|
+
await connectTextEditorPlugin(pi, {
|
|
52
|
+
protocol: TEXT_EDITOR_PROTOCOL,
|
|
53
|
+
apiVersion: TEXT_EDITOR_API_VERSION,
|
|
54
|
+
id: "ide-diagnostics",
|
|
55
|
+
setup(api) {
|
|
56
|
+
api.onDidEdit((completion) => {
|
|
57
|
+
if (path.isAbsolute(completion.resourceSource)) {
|
|
58
|
+
core.diagnostics.schedule(completion.resourceSource, completion.after.content, {
|
|
59
|
+
cwd: completion.cwd,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
pi.on("context", async (event, ctx) => {
|
|
66
|
+
const lines = await core.diagnostics.takeNotifications(ctx.cwd);
|
|
67
|
+
if (lines.length === 0) return;
|
|
68
|
+
// Context-only delivery cannot wake an idle agent or create visible transcript rows.
|
|
69
|
+
return {
|
|
70
|
+
messages: [
|
|
71
|
+
...event.messages,
|
|
72
|
+
{
|
|
73
|
+
role: "custom" as const,
|
|
74
|
+
customType: "ide-diagnostics",
|
|
75
|
+
display: false,
|
|
76
|
+
content: `File diagnostics:\n${lines.join("\n")}`,
|
|
77
|
+
timestamp: Date.now(),
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
|
|
43
83
|
await core.waitForPendingPlugins();
|
|
44
84
|
}
|
package/src/core/ide-core.ts
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import { registerTools } from "#src/toolchain/registry.js";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { DiagnosticStore } from "#src/core/diagnostic-store.js";
|
|
4
|
+
|
|
5
|
+
import type { IdeDiagnosticSource, IdePlugin, IdePluginApi } from "#src/api/plugin-protocol.js";
|
|
4
6
|
import type { IdeTool } from "#src/toolchain/types.js";
|
|
5
7
|
|
|
6
8
|
export interface IdeCore {
|
|
9
|
+
readonly diagnostics: DiagnosticStore;
|
|
7
10
|
registerPlugin(plugin: IdePlugin): Promise<void>;
|
|
8
11
|
waitForPendingPlugins(): Promise<void>;
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export function createIdeCore(): IdeCore {
|
|
12
15
|
const plugins = new Map<string, Promise<void>>();
|
|
16
|
+
const diagnosticSources: IdeDiagnosticSource[] = [];
|
|
17
|
+
|
|
18
|
+
const diagnostics = new DiagnosticStore(diagnosticSources);
|
|
13
19
|
let queue = Promise.resolve();
|
|
14
20
|
|
|
15
21
|
return {
|
|
22
|
+
diagnostics,
|
|
16
23
|
registerPlugin(plugin): Promise<void> {
|
|
17
24
|
if (plugin.id.trim().length === 0) {
|
|
18
25
|
return Promise.reject(new Error("Plugin ID must not be empty"));
|
|
@@ -26,6 +33,7 @@ export function createIdeCore(): IdeCore {
|
|
|
26
33
|
|
|
27
34
|
const ready = queue.then(async () => {
|
|
28
35
|
const tools: IdeTool[] = [];
|
|
36
|
+
const incomingDiagnosticSources: IdeDiagnosticSource[] = [];
|
|
29
37
|
let isOpen = true;
|
|
30
38
|
const api: IdePluginApi = {
|
|
31
39
|
addTool(tool): void {
|
|
@@ -36,6 +44,17 @@ export function createIdeCore(): IdeCore {
|
|
|
36
44
|
assertIdeTool(tool);
|
|
37
45
|
tools.push(tool);
|
|
38
46
|
},
|
|
47
|
+
addDiagnosticSource(source): void {
|
|
48
|
+
if (!isOpen) {
|
|
49
|
+
throw new Error(`Plugin ${plugin.id} setup is already complete`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
assertDiagnosticSource(source);
|
|
53
|
+
incomingDiagnosticSources.push(source);
|
|
54
|
+
},
|
|
55
|
+
readDiagnostics(filePath, context) {
|
|
56
|
+
return diagnostics.read(filePath, context);
|
|
57
|
+
},
|
|
39
58
|
};
|
|
40
59
|
|
|
41
60
|
try {
|
|
@@ -46,9 +65,9 @@ export function createIdeCore(): IdeCore {
|
|
|
46
65
|
}
|
|
47
66
|
|
|
48
67
|
isOpen = false;
|
|
49
|
-
|
|
68
|
+
assertUniqueDiagnosticSources(diagnosticSources, incomingDiagnosticSources);
|
|
50
69
|
registerTools(tools);
|
|
51
|
-
|
|
70
|
+
diagnosticSources.push(...incomingDiagnosticSources);
|
|
52
71
|
});
|
|
53
72
|
plugins.set(plugin.id, ready);
|
|
54
73
|
queue = ready.catch(() => {});
|
|
@@ -64,6 +83,21 @@ export function createIdeCore(): IdeCore {
|
|
|
64
83
|
};
|
|
65
84
|
}
|
|
66
85
|
|
|
86
|
+
function assertUniqueDiagnosticSources(
|
|
87
|
+
registered: readonly IdeDiagnosticSource[],
|
|
88
|
+
incoming: readonly IdeDiagnosticSource[],
|
|
89
|
+
): void {
|
|
90
|
+
const ids = new Set(registered.map((source) => source.id));
|
|
91
|
+
|
|
92
|
+
for (const source of incoming) {
|
|
93
|
+
if (ids.has(source.id)) {
|
|
94
|
+
throw new Error(`Diagnostic source ${source.id} is already registered`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
ids.add(source.id);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
67
101
|
function assertIdeTool(value: unknown): asserts value is IdeTool {
|
|
68
102
|
if (!isRecord(value)) {
|
|
69
103
|
throw new TypeError("IDE tool must be an object");
|
|
@@ -95,6 +129,17 @@ function assertIdeTool(value: unknown): asserts value is IdeTool {
|
|
|
95
129
|
}
|
|
96
130
|
}
|
|
97
131
|
|
|
132
|
+
function assertDiagnosticSource(value: unknown): asserts value is IdeDiagnosticSource {
|
|
133
|
+
if (
|
|
134
|
+
!isRecord(value) ||
|
|
135
|
+
typeof value.id !== "string" ||
|
|
136
|
+
value.id.trim().length === 0 ||
|
|
137
|
+
typeof value.diagnose !== "function"
|
|
138
|
+
) {
|
|
139
|
+
throw new TypeError("Invalid pi-agent-ide diagnostic source contribution");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
98
143
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
99
144
|
return typeof value === "object" && value !== null;
|
|
100
145
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { requiredValue } from "
|
|
1
|
+
import { requiredValue } from "pi-agent-invariant";
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
|
|
4
4
|
import { projectIdeConfigDirectory, projectIdeConfigPath } from "#src/api/tool-config.js";
|
package/src/doctor/core.ts
CHANGED
|
@@ -4,6 +4,9 @@ import type {
|
|
|
4
4
|
DoctorFinding,
|
|
5
5
|
DoctorPlugin,
|
|
6
6
|
DoctorPluginApi,
|
|
7
|
+
DoctorSetupAction,
|
|
8
|
+
DoctorSetupCheck,
|
|
9
|
+
DoctorToolSelection,
|
|
7
10
|
} from "#src/api/doctor.js";
|
|
8
11
|
import type { LanguageDefinition, ToolRecipe } from "#src/api/tool-catalog.js";
|
|
9
12
|
|
|
@@ -15,6 +18,7 @@ export interface OwnedContribution<T> {
|
|
|
15
18
|
export interface DoctorSnapshot {
|
|
16
19
|
readonly languages: readonly OwnedContribution<LanguageDefinition>[];
|
|
17
20
|
readonly recipes: readonly OwnedContribution<ToolRecipe>[];
|
|
21
|
+
readonly setupChecks: readonly OwnedContribution<DoctorSetupCheck>[];
|
|
18
22
|
readonly checks: readonly OwnedContribution<DoctorCheck>[];
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -25,6 +29,7 @@ export class DoctorCore {
|
|
|
25
29
|
private readonly plugins = new Map<string, Promise<void>>();
|
|
26
30
|
private readonly languages: OwnedContribution<LanguageDefinition>[] = [];
|
|
27
31
|
private readonly recipes: OwnedContribution<ToolRecipe>[] = [];
|
|
32
|
+
private readonly setupChecks: OwnedContribution<DoctorSetupCheck>[] = [];
|
|
28
33
|
private readonly checks: OwnedContribution<DoctorCheck>[] = [];
|
|
29
34
|
private queue = Promise.resolve();
|
|
30
35
|
|
|
@@ -42,6 +47,7 @@ export class DoctorCore {
|
|
|
42
47
|
let isOpen = true;
|
|
43
48
|
const ownLanguages: OwnedContribution<LanguageDefinition>[] = [];
|
|
44
49
|
const ownRecipes: OwnedContribution<ToolRecipe>[] = [];
|
|
50
|
+
const ownSetupChecks: OwnedContribution<DoctorSetupCheck>[] = [];
|
|
45
51
|
const ownChecks: OwnedContribution<DoctorCheck>[] = [];
|
|
46
52
|
const api: DoctorPluginApi = {
|
|
47
53
|
addLanguage: (value) => {
|
|
@@ -50,6 +56,9 @@ export class DoctorCore {
|
|
|
50
56
|
addToolRecipe: (value) => {
|
|
51
57
|
add(value, ownRecipes, plugin.id, "tool recipe", () => isOpen);
|
|
52
58
|
},
|
|
59
|
+
addSetupCheck: (value) => {
|
|
60
|
+
add(value, ownSetupChecks, plugin.id, "setup check", () => isOpen);
|
|
61
|
+
},
|
|
53
62
|
addCheck: (value) => {
|
|
54
63
|
add(value, ownChecks, plugin.id, "check", () => isOpen);
|
|
55
64
|
},
|
|
@@ -65,6 +74,7 @@ export class DoctorCore {
|
|
|
65
74
|
assertAvailable(this.recipes, ownRecipes, "tool recipe");
|
|
66
75
|
this.languages.push(...ownLanguages);
|
|
67
76
|
this.recipes.push(...ownRecipes);
|
|
77
|
+
this.setupChecks.push(...ownSetupChecks);
|
|
68
78
|
this.checks.push(...ownChecks);
|
|
69
79
|
return undefined;
|
|
70
80
|
});
|
|
@@ -91,11 +101,48 @@ export class DoctorCore {
|
|
|
91
101
|
return {
|
|
92
102
|
languages: [...this.languages],
|
|
93
103
|
recipes: [...this.recipes],
|
|
104
|
+
setupChecks: [...this.setupChecks],
|
|
94
105
|
checks: [...this.checks],
|
|
95
106
|
};
|
|
96
107
|
}
|
|
97
108
|
}
|
|
98
109
|
|
|
110
|
+
export interface DoctorSetupState {
|
|
111
|
+
readonly selections: readonly (DoctorToolSelection & { readonly pluginId: string })[];
|
|
112
|
+
readonly actions: readonly (DoctorSetupAction & { readonly pluginId: string })[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Runs lightweight setup checks while isolating a broken plugin. */
|
|
116
|
+
export async function runContributedSetupChecks(
|
|
117
|
+
snapshot: DoctorSnapshot,
|
|
118
|
+
context: DoctorContext,
|
|
119
|
+
): Promise<DoctorSetupState> {
|
|
120
|
+
const selections: (DoctorToolSelection & { readonly pluginId: string })[] = [];
|
|
121
|
+
const actions: (DoctorSetupAction & { readonly pluginId: string })[] = [];
|
|
122
|
+
|
|
123
|
+
for (const contribution of snapshot.setupChecks) {
|
|
124
|
+
try {
|
|
125
|
+
const result = await contribution.value.inspect(context);
|
|
126
|
+
selections.push(
|
|
127
|
+
...(result.selections ?? []).map((selection) => ({
|
|
128
|
+
...selection,
|
|
129
|
+
pluginId: contribution.pluginId,
|
|
130
|
+
})),
|
|
131
|
+
);
|
|
132
|
+
actions.push(
|
|
133
|
+
...(result.actions ?? []).map((action) => ({
|
|
134
|
+
...action,
|
|
135
|
+
pluginId: contribution.pluginId,
|
|
136
|
+
})),
|
|
137
|
+
);
|
|
138
|
+
} catch {
|
|
139
|
+
// Setup guidance is optional. An internal inspection failure is not a user action.
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return { selections, actions };
|
|
144
|
+
}
|
|
145
|
+
|
|
99
146
|
/**
|
|
100
147
|
Executes checks independently so one broken plugin cannot hide the rest.
|
|
101
148
|
*/
|
package/src/doctor/discovery.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { access, readFile } from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
|
|
4
4
|
import { projectIdeConfigPath } from "#src/api/tool-config.js";
|
|
5
|
+
import type { DoctorToolSelection } from "#src/api/doctor.js";
|
|
5
6
|
import type { ToolRecipe } from "#src/api/tool-catalog.js";
|
|
6
7
|
import type { OwnedContribution } from "./core.js";
|
|
7
8
|
|
|
@@ -81,17 +82,24 @@ Selects at most one recipe per language and tool kind.
|
|
|
81
82
|
export function selectSuggestedRecipes(
|
|
82
83
|
candidates: readonly RecipeCandidate[],
|
|
83
84
|
detectedLanguageIds: ReadonlySet<string>,
|
|
85
|
+
selections: readonly DoctorToolSelection[] = [],
|
|
84
86
|
): readonly RecipeCandidate[] {
|
|
85
87
|
const selected = new Map<string, RecipeCandidate>();
|
|
88
|
+
const activeBySlot = new Map(
|
|
89
|
+
selections.map((selection) => [`${selection.kind}:${selection.languageId}`, selection.toolId]),
|
|
90
|
+
);
|
|
86
91
|
|
|
87
92
|
for (const language of detectedLanguageIds) {
|
|
88
93
|
for (const kind of ["formatter", "linter", "lsp"] as const) {
|
|
94
|
+
const activeToolId = activeBySlot.get(`${kind}:${language}`);
|
|
95
|
+
const minimumScore = activeToolId === undefined ? 4 : 7;
|
|
89
96
|
const matches = candidates.filter(
|
|
90
97
|
(candidate) =>
|
|
91
98
|
candidate.recipe.kind === kind &&
|
|
92
99
|
candidate.recipe.languages.includes(language) &&
|
|
93
100
|
candidate.executable !== undefined &&
|
|
94
|
-
candidate.
|
|
101
|
+
candidate.recipe.id !== activeToolId &&
|
|
102
|
+
candidate.score >= minimumScore,
|
|
95
103
|
);
|
|
96
104
|
const best = matches[0];
|
|
97
105
|
|
|
@@ -103,7 +111,7 @@ export function selectSuggestedRecipes(
|
|
|
103
111
|
continue;
|
|
104
112
|
}
|
|
105
113
|
|
|
106
|
-
selected.set(best.recipe.id
|
|
114
|
+
selected.set(`${best.recipe.kind}:${best.recipe.id}`, best);
|
|
107
115
|
}
|
|
108
116
|
}
|
|
109
117
|
|
package/src/doctor/extension.ts
CHANGED
|
@@ -8,7 +8,14 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { writeSuggestedConfigs } from "./config-writer.js";
|
|
10
10
|
import { DoctorCore } from "./core.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
buildDoctorAgentPrompt,
|
|
13
|
+
doctorNeedsWork,
|
|
14
|
+
formatDoctorReport,
|
|
15
|
+
inspectDoctorSetup,
|
|
16
|
+
runDoctor,
|
|
17
|
+
} from "./run.js";
|
|
18
|
+
import { registerDoctorTipProvider } from "./tip-provider.js";
|
|
12
19
|
|
|
13
20
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
14
21
|
|
|
@@ -17,6 +24,10 @@ Registers the modular doctor core and `/pi-agent-ide-doctor`.
|
|
|
17
24
|
*/
|
|
18
25
|
export default async function registerDoctor(pi: ExtensionAPI): Promise<void> {
|
|
19
26
|
const core = new DoctorCore();
|
|
27
|
+
registerDoctorTipProvider(pi, async (context) => {
|
|
28
|
+
await core.waitForPlugins();
|
|
29
|
+
return inspectDoctorSetup(core.snapshot(), context.cwd, process.env, context.signal);
|
|
30
|
+
});
|
|
20
31
|
let delegatedProject: string | undefined;
|
|
21
32
|
const unsubscribe = pi.events.on(DOCTOR_PLUGIN_REGISTER_EVENT, (request) => {
|
|
22
33
|
if (!isDoctorPluginRegistrationRequest(request)) {
|
package/src/doctor/inventory.ts
CHANGED
|
@@ -23,7 +23,11 @@ const skippedDirectories = new Set([
|
|
|
23
23
|
/**
|
|
24
24
|
Collects project files while respecting Git ignores when Git is available.
|
|
25
25
|
*/
|
|
26
|
-
export async function collectProjectFiles(
|
|
26
|
+
export async function collectProjectFiles(
|
|
27
|
+
cwd: string,
|
|
28
|
+
signal?: AbortSignal,
|
|
29
|
+
): Promise<readonly string[]> {
|
|
30
|
+
signal?.throwIfAborted();
|
|
27
31
|
try {
|
|
28
32
|
const result = await execFileAsync(
|
|
29
33
|
"git",
|
|
@@ -32,15 +36,20 @@ export async function collectProjectFiles(cwd: string): Promise<readonly string[
|
|
|
32
36
|
cwd,
|
|
33
37
|
encoding: "utf8",
|
|
34
38
|
maxBuffer: 16 * 1024 * 1024,
|
|
39
|
+
|
|
40
|
+
signal,
|
|
35
41
|
},
|
|
36
42
|
);
|
|
37
43
|
const files = result.stdout
|
|
38
44
|
.split("\0")
|
|
39
45
|
.filter(Boolean)
|
|
40
|
-
.map((file) => path.resolve(cwd, file))
|
|
41
|
-
|
|
46
|
+
.map((file) => path.resolve(cwd, file))
|
|
47
|
+
.filter((file) => !isManagedIdeConfig(file));
|
|
48
|
+
signal?.throwIfAborted();
|
|
49
|
+
return files.length > 0 ? files : await walk(cwd, signal);
|
|
42
50
|
} catch {
|
|
43
|
-
|
|
51
|
+
signal?.throwIfAborted();
|
|
52
|
+
return walk(cwd, signal);
|
|
44
53
|
}
|
|
45
54
|
}
|
|
46
55
|
|
|
@@ -70,7 +79,8 @@ export function detectProjectLanguages(
|
|
|
70
79
|
return detected;
|
|
71
80
|
}
|
|
72
81
|
|
|
73
|
-
async function walk(directory: string): Promise<string[]> {
|
|
82
|
+
async function walk(directory: string, signal?: AbortSignal): Promise<string[]> {
|
|
83
|
+
signal?.throwIfAborted();
|
|
74
84
|
const files: string[] = [];
|
|
75
85
|
|
|
76
86
|
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
@@ -80,8 +90,12 @@ async function walk(directory: string): Promise<string[]> {
|
|
|
80
90
|
|
|
81
91
|
const absolute = path.join(directory, entry.name);
|
|
82
92
|
|
|
93
|
+
if (isManagedIdeConfig(absolute)) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
|
|
83
97
|
if (entry.isDirectory()) {
|
|
84
|
-
files.push(...(await walk(absolute)));
|
|
98
|
+
files.push(...(await walk(absolute, signal)));
|
|
85
99
|
} else if (entry.isFile()) {
|
|
86
100
|
files.push(absolute);
|
|
87
101
|
}
|
|
@@ -89,3 +103,7 @@ async function walk(directory: string): Promise<string[]> {
|
|
|
89
103
|
|
|
90
104
|
return files;
|
|
91
105
|
}
|
|
106
|
+
|
|
107
|
+
function isManagedIdeConfig(file: string): boolean {
|
|
108
|
+
return file.split(path.sep).join("/").includes("/.pi/pi-agent-ide/");
|
|
109
|
+
}
|