pi-agent-ide 0.1.1 → 0.2.1
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 +53 -0
- package/README.md +11 -5
- package/dist/chunk-266RH77Z.js +1 -0
- package/dist/chunk-2SKAED2I.js +2 -0
- package/dist/chunk-2XYXV5HS.js +4 -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-4SQQKEVD.js +16 -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-6XQQBKPE.js +58 -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-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-KH5KPBCR.js +10 -0
- package/dist/chunk-KINKBPPX.js +1 -0
- package/dist/chunk-KNMWCDDK.js +7 -0
- package/dist/chunk-KYVOMBO5.js +1 -0
- package/dist/chunk-KZBAJFCV.js +1 -0
- package/dist/chunk-L4FA6OD4.js +1 -0
- package/dist/chunk-LFV6G5Z3.js +1 -0
- package/dist/chunk-LGN7EJYR.js +13 -0
- package/dist/chunk-MB6VVVAF.js +2 -0
- package/dist/chunk-MBUXFKIW.js +3 -0
- package/dist/chunk-MTQSGWZJ.js +1 -0
- package/dist/chunk-MTTKFJV6.js +1 -0
- package/dist/chunk-N34ATN52.js +1 -0
- package/dist/chunk-NI2NK4JU.js +1 -0
- package/dist/chunk-NNCZYO4Q.js +0 -0
- package/dist/chunk-NXHPO7ER.js +6 -0
- package/dist/chunk-OBWZ5RYN.js +1 -0
- package/dist/chunk-OFHVDY4Q.js +2 -0
- package/dist/chunk-OIL6BB2S.js +33 -0
- package/dist/chunk-ONWUJXUR.js +1 -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-QZANC2IG.js +1 -0
- package/dist/chunk-SJYDLHEF.js +108 -0
- package/dist/chunk-SMSIT3CE.js +3 -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-UTTW55S2.js +1 -0
- package/dist/chunk-VCCMVQXU.js +1 -0
- package/dist/chunk-VEJGSURY.js +8 -0
- package/dist/chunk-VFBLX4TG.js +1 -0
- package/dist/chunk-VSP2QQPQ.js +2 -0
- package/dist/chunk-W3XYKJ5H.js +1 -0
- package/dist/chunk-WZI4YC2O.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-ZC65Z3CK.js +1 -0
- package/dist/chunk-ZIHEF6K3.js +3 -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 +1 -0
- package/dist/entry-54.js +0 -0
- package/dist/entry-55.js +1 -0
- package/dist/entry-56.js +0 -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 +1 -0
- package/dist/entry-63.js +0 -0
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +0 -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-80.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 +180 -52
- package/docs/development.md +105 -5
- package/docs/extensions.md +64 -4
- package/docs/generated/tool-catalog/cmake.md +5 -5
- package/docs/generated/tool-catalog/csharp.md +5 -5
- package/docs/generated/tool-catalog/css.md +7 -6
- package/docs/generated/tool-catalog/dart.md +9 -0
- package/docs/generated/tool-catalog/dockerfile.md +5 -5
- package/docs/generated/tool-catalog/elixir.md +9 -0
- package/docs/generated/tool-catalog/html.md +7 -5
- package/docs/generated/tool-catalog/index.md +9 -0
- package/docs/generated/tool-catalog/javascript.md +8 -6
- package/docs/generated/tool-catalog/json.md +7 -6
- package/docs/generated/tool-catalog/julia.md +8 -0
- package/docs/generated/tool-catalog/kotlin.md +6 -5
- package/docs/generated/tool-catalog/markdown.md +6 -5
- package/docs/generated/tool-catalog/powershell.md +9 -0
- package/docs/generated/tool-catalog/python.md +6 -6
- package/docs/generated/tool-catalog/r.md +9 -0
- package/docs/generated/tool-catalog/scala.md +9 -0
- package/docs/generated/tool-catalog/svelte.md +9 -0
- package/docs/generated/tool-catalog/toml.md +6 -5
- package/docs/generated/tool-catalog/typescript.md +9 -6
- package/docs/generated/tool-catalog/vue.md +9 -0
- package/docs/generated/tool-catalog/yaml.md +6 -5
- package/docs/generated/tool-catalog/zig.md +9 -0
- package/docs/tools.md +88 -6
- package/node_modules/pi-agent-doctor/package.json +15 -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/runtime/entry-20.js +1 -0
- package/node_modules/pi-agent-doctor/src/catalog.ts +27 -1
- package/node_modules/pi-agent-doctor/src/evidence.ts +118 -0
- package/node_modules/pi-agent-doctor/src/executable.ts +85 -6
- 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-21.js +2 -0
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-image/runtime/entry-22.js +2 -0
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/runtime/entry-23.js +2 -0
- package/node_modules/pi-agent-filesystem-text/package.json +4 -4
- package/node_modules/pi-agent-filesystem-text/runtime/entry-24.js +2 -0
- package/node_modules/pi-agent-ide-ast/package.json +11 -10
- package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +1 -0
- package/node_modules/pi-agent-ide-ast/runtime/entry-26.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/manager.ts +3 -0
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +4 -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-27.js +1 -0
- package/node_modules/pi-agent-ide-changes/runtime/entry-28.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-29.js +2 -0
- package/node_modules/pi-agent-ide-formatter/src/catalog.ts +165 -13
- package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +115 -63
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +86 -31
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/runtime/entry-30.js +2 -0
- package/node_modules/pi-agent-ide-languages/src/languages.ts +15 -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-31.js +2 -0
- package/node_modules/pi-agent-ide-lint/src/catalog.ts +210 -41
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +80 -4
- package/node_modules/pi-agent-ide-lint/src/diagnostics.ts +76 -34
- package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +115 -64
- package/node_modules/pi-agent-ide-lint/src/registry.ts +87 -30
- 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-32.js +2 -0
- package/node_modules/pi-agent-ide-lsp/src/catalog.ts +161 -7
- 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 +110 -0
- package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +108 -55
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +248 -38
- 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/file-watchers.ts +88 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/initialization-options.ts +14 -0
- 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 +17 -36
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +139 -68
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +1 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/transport-writer.ts +24 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/types.ts +13 -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-33.js +1 -0
- package/node_modules/pi-agent-invariant/package.json +12 -0
- package/node_modules/pi-agent-invariant/runtime/entry-34.js +1 -0
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-pdf/runtime/entry-35.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-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 +1 -0
- package/node_modules/pi-agent-read/runtime/entry-40.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-41.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-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 +1 -0
- package/node_modules/pi-agent-search/runtime/entry-45.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-46.js +2 -0
- package/node_modules/pi-agent-search-text/runtime/entry-47.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-48.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-49.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-50.js +1 -0
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.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-52.js +1 -0
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.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-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 +1 -0
- package/node_modules/pi-agent-text-editor/runtime/entry-69.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-70.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-71.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-72.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-73.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-74.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-75.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-76.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-77.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-78.js +2 -0
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/runtime/entry-79.js +2 -0
- package/node_modules/pi-agent-web-text/package.json +4 -4
- package/node_modules/pi-agent-web-text/runtime/entry-80.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 +273 -0
- package/src/api/tool-config/linters.json +339 -0
- package/src/api/tool-config/lsp-servers.json +410 -0
- package/src/api/tool-config.ts +248 -12
- package/src/api/toolchain.ts +0 -5
- package/src/code-view/diagnostic-view.ts +121 -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 +15 -2
- package/src/doctor/core.ts +47 -0
- package/src/doctor/discovery.ts +23 -70
- package/src/doctor/extension.ts +12 -1
- package/src/doctor/inventory.ts +24 -6
- package/src/doctor/run.ts +100 -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-22.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-23.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-24.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-21.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-77.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-78.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-79.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-80.js +2 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.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-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 +1 -0
- package/src/extensions/pi-agent-read/runtime/entry-40.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-46.js +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.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-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 +1 -0
- package/src/extensions/pi-agent-search/runtime/entry-45.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-49.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-50.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.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-52.js +1 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.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-70.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-71.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-72.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-73.js +2 -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 +1 -0
- package/src/extensions/pi-agent-text-editor/runtime/entry-69.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-25.js +1 -0
- package/src/plugins/pi-agent-ide-ast/runtime/entry-26.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/manager.ts +3 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +4 -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-27.js +1 -0
- package/src/plugins/pi-agent-ide-changes/runtime/entry-28.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 +199 -0
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-formatter/runtime/entry-29.js +2 -0
- package/src/plugins/pi-agent-ide-formatter/src/catalog.ts +165 -13
- package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +115 -63
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +86 -31
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/runtime/entry-30.js +2 -0
- package/src/plugins/pi-agent-ide-languages/src/languages.ts +15 -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-31.js +2 -0
- package/src/plugins/pi-agent-ide-lint/src/catalog.ts +210 -41
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +80 -4
- package/src/plugins/pi-agent-ide-lint/src/diagnostics.ts +76 -34
- package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +115 -64
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +87 -30
- 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-32.js +2 -0
- package/src/plugins/pi-agent-ide-lsp/src/catalog.ts +161 -7
- 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 +110 -0
- package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +108 -55
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +248 -38
- 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/file-watchers.ts +88 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/initialization-options.ts +14 -0
- 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 +17 -36
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +139 -68
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +1 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/transport-writer.ts +24 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/types.ts +13 -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 +8 -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,76 @@
|
|
|
1
|
+
import type { Diagnostic } from "pi-agent-ide/api/toolchain";
|
|
2
|
+
import type { LspClient } from "./client.js";
|
|
3
|
+
|
|
4
|
+
/** A server capability that returns completed diagnostics rather than intermediate pushes. */
|
|
5
|
+
export interface CompletedDiagnosticAdapter {
|
|
6
|
+
readonly command: string;
|
|
7
|
+
request(client: LspClient, uri: string, signal: AbortSignal): Promise<Diagnostic[]>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const typescript: CompletedDiagnosticAdapter = {
|
|
11
|
+
command: "typescript.tsserverRequest",
|
|
12
|
+
async request(client, uri, signal) {
|
|
13
|
+
const reports = await Promise.all(
|
|
14
|
+
["syntacticDiagnosticsSync", "semanticDiagnosticsSync", "suggestionDiagnosticsSync"].map(
|
|
15
|
+
async (command) => {
|
|
16
|
+
const response = await client.sendRequest(
|
|
17
|
+
"workspace/executeCommand",
|
|
18
|
+
{
|
|
19
|
+
command: "typescript.tsserverRequest",
|
|
20
|
+
arguments: [
|
|
21
|
+
command,
|
|
22
|
+
{ file: uri, includeLinePosition: true },
|
|
23
|
+
{ isAsync: false, expectsResult: true },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
signal,
|
|
27
|
+
);
|
|
28
|
+
if (!isRecord(response) || response.success !== true || !Array.isArray(response.body))
|
|
29
|
+
throw new Error(`Invalid completed TypeScript diagnostic report: ${command}`);
|
|
30
|
+
return response.body.map(convertTypeScriptDiagnostic);
|
|
31
|
+
},
|
|
32
|
+
),
|
|
33
|
+
);
|
|
34
|
+
return reports.flat();
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Select by advertised server capability, never by file extension or configured server name. */
|
|
39
|
+
export function completedDiagnosticAdapter(
|
|
40
|
+
client: LspClient,
|
|
41
|
+
): CompletedDiagnosticAdapter | undefined {
|
|
42
|
+
return client.supportsCommand(typescript.command) ? typescript : undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function convertTypeScriptDiagnostic(value: unknown): Diagnostic {
|
|
46
|
+
if (
|
|
47
|
+
!isRecord(value) ||
|
|
48
|
+
typeof value.message !== "string" ||
|
|
49
|
+
(typeof value.code !== "number" && typeof value.code !== "string") ||
|
|
50
|
+
!isRecord(value.startLocation) ||
|
|
51
|
+
!Number.isInteger(value.startLocation.line) ||
|
|
52
|
+
!Number.isInteger(value.startLocation.offset) ||
|
|
53
|
+
Number(value.startLocation.line) < 1 ||
|
|
54
|
+
Number(value.startLocation.offset) < 1 ||
|
|
55
|
+
!["error", "warning", "suggestion", "message"].includes(String(value.category))
|
|
56
|
+
)
|
|
57
|
+
throw new Error("Invalid TypeScript diagnostic entry");
|
|
58
|
+
return {
|
|
59
|
+
code: String(value.code),
|
|
60
|
+
message: value.message,
|
|
61
|
+
line: Number(value.startLocation.line),
|
|
62
|
+
column: Number(value.startLocation.offset),
|
|
63
|
+
severity:
|
|
64
|
+
value.category === "error"
|
|
65
|
+
? "error"
|
|
66
|
+
: value.category === "warning"
|
|
67
|
+
? "warning"
|
|
68
|
+
: value.category === "suggestion"
|
|
69
|
+
? "hint"
|
|
70
|
+
: "info",
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
75
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
76
|
+
}
|
|
@@ -1,170 +1,163 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
|
|
3
2
|
import { URI } from "vscode-uri";
|
|
4
|
-
|
|
5
3
|
import { DiagnosticSeverity, type LspDiagnostic } from "./types.js";
|
|
6
|
-
|
|
7
4
|
import type { LspClient } from "./client.js";
|
|
8
|
-
import type { Diagnostic, Severity } from "pi-agent-ide/api/toolchain";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Request diagnostics from an LSP server for a document.
|
|
12
|
-
*
|
|
13
|
-
* Returns IDE Diagnostic[] with proper severity classification
|
|
14
|
-
* suitable for both compiler (syntax errors cause rollback) and linter
|
|
15
|
-
* (warnings are informational only).
|
|
16
|
-
*/
|
|
17
|
-
export async function requestDiagnostics(
|
|
18
|
-
client: LspClient,
|
|
19
|
-
uri: string,
|
|
20
|
-
languageId?: string,
|
|
21
|
-
): Promise<{
|
|
22
|
-
diagnostics: Diagnostic[];
|
|
23
|
-
syntaxErrors: Diagnostic[];
|
|
24
|
-
otherDiagnostics: Diagnostic[];
|
|
25
|
-
}> {
|
|
26
|
-
// Try pull-model first (LSP 3.17+). Fall back to push notifications.
|
|
27
|
-
try {
|
|
28
|
-
const raw = await client.sendRequest<LspDiagnosticResult>("textDocument/diagnostic", {
|
|
29
|
-
textDocument: { uri },
|
|
30
|
-
});
|
|
31
|
-
client.setDiagnosticMode("pull");
|
|
32
|
-
return classify(toDiagnostics(raw.items));
|
|
33
|
-
} catch (error) {
|
|
34
|
-
if (isMethodNotFound(error)) {
|
|
35
|
-
// Server doesn't support pull model — check if it supports diagnostics at all
|
|
36
|
-
if (!client.hasServerDiagnosticsCapability) {
|
|
37
|
-
return classify([]);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
client.setDiagnosticMode("push");
|
|
41
|
-
return await waitForPushDiagnostics(client, uri, languageId);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
throw error;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// ── LSP types ───────────────────────────────────────────────────────
|
|
49
|
-
|
|
50
|
-
interface LspDiagnosticResult {
|
|
51
|
-
kind: "full";
|
|
52
|
-
items: LspDiagnostic[];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ── conversion ───────────────────────────────────────────────────────
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
Convert an LSP diagnostic to a Gate Diagnostic (1-based coordinates).
|
|
59
|
-
*/
|
|
60
|
-
function toGateDiagnostic(d: LspDiagnostic): Diagnostic {
|
|
61
|
-
return {
|
|
62
|
-
code: typeof d.code === "number" ? String(d.code) : (d.code ?? "LSP"),
|
|
63
|
-
message: d.message,
|
|
64
|
-
line: d.range.start.line + 1,
|
|
65
|
-
column: d.range.start.character + 1,
|
|
66
|
-
severity: lspSeverityToGate(d.severity),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
Map LSP DiagnosticSeverity (1-4) to Gate Severity.
|
|
72
|
-
*/
|
|
73
|
-
function lspSeverityToGate(severity: DiagnosticSeverity): Severity {
|
|
74
|
-
switch (severity) {
|
|
75
|
-
case DiagnosticSeverity.Error: {
|
|
76
|
-
return "error";
|
|
77
|
-
}
|
|
78
|
-
case DiagnosticSeverity.Warning: {
|
|
79
|
-
return "warning";
|
|
80
|
-
}
|
|
81
|
-
case DiagnosticSeverity.Information: {
|
|
82
|
-
return "info";
|
|
83
|
-
}
|
|
84
|
-
case DiagnosticSeverity.Hint: {
|
|
85
|
-
return "hint";
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// ── helpers ───────────────────────────────────────────────────────────
|
|
91
5
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
6
|
+
import { completedDiagnosticAdapter } from "./diagnostic-adapters.js";
|
|
7
|
+
import type { Diagnostic } from "pi-agent-ide/api/toolchain";
|
|
95
8
|
|
|
96
|
-
|
|
9
|
+
/** LSP diagnostics do not reliably distinguish parser errors from type errors. */
|
|
10
|
+
export interface LspDiagnosticResult {
|
|
97
11
|
diagnostics: Diagnostic[];
|
|
98
12
|
syntaxErrors: Diagnostic[];
|
|
99
13
|
otherDiagnostics: Diagnostic[];
|
|
100
|
-
|
|
101
|
-
const syntaxErrors = diags.filter((d) => d.severity === "error");
|
|
102
|
-
const otherDiagnostics = diags.filter((d) => d.severity !== "error");
|
|
103
|
-
return { diagnostics: diags, syntaxErrors, otherDiagnostics };
|
|
104
|
-
}
|
|
14
|
+
unversioned: boolean;
|
|
105
15
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
error !== null &&
|
|
109
|
-
typeof error === "object" &&
|
|
110
|
-
"code" in error &&
|
|
111
|
-
(error as { code: number }).code === -32601
|
|
112
|
-
);
|
|
16
|
+
/** False for push snapshots, even when a publication carries a document version. */
|
|
17
|
+
complete: boolean;
|
|
113
18
|
}
|
|
114
19
|
|
|
115
|
-
/**
|
|
116
|
-
|
|
117
|
-
*/
|
|
118
|
-
async function waitForPushDiagnostics(
|
|
20
|
+
/** Request current diagnostics using pull when supported, otherwise a version-aware push wait. */
|
|
21
|
+
export async function requestDiagnostics(
|
|
119
22
|
client: LspClient,
|
|
120
23
|
uri: string,
|
|
121
24
|
languageId?: string,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
25
|
+
options: { signal?: AbortSignal; content?: string } = {},
|
|
26
|
+
): Promise<LspDiagnosticResult> {
|
|
27
|
+
const controller = new AbortController();
|
|
28
|
+
const signal = AbortSignal.any([controller.signal, ...(options.signal ? [options.signal] : [])]);
|
|
29
|
+
const timeout = setTimeout(
|
|
30
|
+
() => controller.abort(new Error(`[lsp] ${client.serverId}: diagnostics timed out for ${uri}`)),
|
|
31
|
+
client.timeoutMs,
|
|
32
|
+
);
|
|
33
|
+
try {
|
|
34
|
+
return await requestCurrentDiagnostics(client, uri, languageId, options.content, signal);
|
|
35
|
+
} finally {
|
|
36
|
+
clearTimeout(timeout);
|
|
131
37
|
}
|
|
38
|
+
}
|
|
132
39
|
|
|
133
|
-
|
|
40
|
+
async function requestCurrentDiagnostics(
|
|
41
|
+
client: LspClient,
|
|
42
|
+
uri: string,
|
|
43
|
+
languageId: string | undefined,
|
|
44
|
+
content: string | undefined,
|
|
45
|
+
signal: AbortSignal,
|
|
46
|
+
): Promise<LspDiagnosticResult> {
|
|
47
|
+
signal.throwIfAborted();
|
|
48
|
+
if (client.diagnosticMode !== "push") {
|
|
49
|
+
const version = client.documentVersion(uri);
|
|
50
|
+
try {
|
|
51
|
+
const raw = await client.sendRequest<{ kind: string; items?: LspDiagnostic[] }>(
|
|
52
|
+
"textDocument/diagnostic",
|
|
53
|
+
{ textDocument: { uri } },
|
|
54
|
+
signal,
|
|
55
|
+
);
|
|
56
|
+
if (raw.kind !== "full" || !Array.isArray(raw.items))
|
|
57
|
+
throw new Error("Invalid full diagnostic report");
|
|
58
|
+
if (client.documentVersion(uri) !== version)
|
|
59
|
+
throw new Error("Document changed during diagnostic request");
|
|
60
|
+
client.setDiagnosticMode("pull");
|
|
61
|
+
return classify(raw.items, false, true);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (!isMethodNotFound(error)) throw error;
|
|
64
|
+
client.setDiagnosticMode("push");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const adapter = completedDiagnosticAdapter(client);
|
|
68
|
+
if (adapter) {
|
|
69
|
+
if (client.documentVersion(uri) === undefined)
|
|
70
|
+
client.syncDocument(
|
|
71
|
+
uri,
|
|
72
|
+
content ?? (await readFile(URI.parse(uri).fsPath, "utf8")),
|
|
73
|
+
languageId ?? "plaintext",
|
|
74
|
+
);
|
|
75
|
+
const version = client.documentVersion(uri);
|
|
76
|
+
const diagnostics = await adapter.request(client, uri, signal);
|
|
77
|
+
signal.throwIfAborted();
|
|
78
|
+
if (client.documentVersion(uri) !== version)
|
|
79
|
+
throw new Error("Document changed during diagnostic request");
|
|
80
|
+
return {
|
|
81
|
+
diagnostics,
|
|
82
|
+
syntaxErrors: [],
|
|
83
|
+
otherDiagnostics: diagnostics,
|
|
84
|
+
unversioned: false,
|
|
85
|
+
complete: true,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
signal.throwIfAborted();
|
|
89
|
+
const opened = client.documentVersion(uri) !== undefined;
|
|
90
|
+
const text = opened ? undefined : (content ?? (await readFile(URI.parse(uri).fsPath, "utf8")));
|
|
91
|
+
signal.throwIfAborted();
|
|
134
92
|
client.beginDiagnosticRequest(uri);
|
|
135
|
-
|
|
136
93
|
try {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
const notification = parameters as {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
94
|
+
return await new Promise<LspDiagnosticResult>((resolve, reject) => {
|
|
95
|
+
const expectedVersion = client.documentVersion(uri) ?? 1;
|
|
96
|
+
const receive = (parameters: unknown) => {
|
|
97
|
+
const notification = parameters as {
|
|
98
|
+
uri?: unknown;
|
|
99
|
+
version?: unknown;
|
|
100
|
+
diagnostics?: unknown;
|
|
101
|
+
};
|
|
102
|
+
if (notification.uri !== uri || !Array.isArray(notification.diagnostics)) return;
|
|
103
|
+
if (notification.version !== undefined && notification.version !== expectedVersion) return;
|
|
104
|
+
if (client.documentVersion(uri) !== expectedVersion) return;
|
|
105
|
+
cleanup();
|
|
106
|
+
resolve(
|
|
107
|
+
classify(notification.diagnostics as LspDiagnostic[], notification.version === undefined),
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
const unsubscribe = client.onNotification("textDocument/publishDiagnostics", receive);
|
|
111
|
+
const onAbort = () => {
|
|
112
|
+
cleanup();
|
|
113
|
+
reject(signal.reason);
|
|
114
|
+
};
|
|
115
|
+
function cleanup(): void {
|
|
159
116
|
unsubscribe();
|
|
160
|
-
|
|
117
|
+
signal.removeEventListener("abort", onAbort);
|
|
118
|
+
}
|
|
119
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
120
|
+
try {
|
|
121
|
+
if (!opened) client.syncDocument(uri, text ?? "", languageId ?? "plaintext");
|
|
122
|
+
const cached = client.diagnosticPublication(uri);
|
|
123
|
+
if (cached) receive({ uri, ...cached });
|
|
124
|
+
} catch (error) {
|
|
125
|
+
cleanup();
|
|
126
|
+
reject(error);
|
|
161
127
|
}
|
|
162
|
-
|
|
163
|
-
client.syncDocument(uri, text, langId);
|
|
164
128
|
});
|
|
165
|
-
|
|
166
|
-
return classify(toDiagnostics(items));
|
|
167
129
|
} finally {
|
|
168
130
|
client.endDiagnosticRequest(uri);
|
|
169
131
|
}
|
|
170
132
|
}
|
|
133
|
+
|
|
134
|
+
/** Convert protocol coordinates and severity to the shared 1-based diagnostic format. */
|
|
135
|
+
export function toDiagnostic(diagnostic: LspDiagnostic): Diagnostic {
|
|
136
|
+
return {
|
|
137
|
+
code: String(diagnostic.code ?? "LSP"),
|
|
138
|
+
message: diagnostic.message,
|
|
139
|
+
line: diagnostic.range.start.line + 1,
|
|
140
|
+
column: diagnostic.range.start.character + 1,
|
|
141
|
+
severity:
|
|
142
|
+
diagnostic.severity === DiagnosticSeverity.Warning
|
|
143
|
+
? "warning"
|
|
144
|
+
: diagnostic.severity === DiagnosticSeverity.Information
|
|
145
|
+
? "info"
|
|
146
|
+
: diagnostic.severity === DiagnosticSeverity.Hint
|
|
147
|
+
? "hint"
|
|
148
|
+
: "error",
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function classify(
|
|
153
|
+
items: LspDiagnostic[],
|
|
154
|
+
unversioned: boolean,
|
|
155
|
+
complete = false,
|
|
156
|
+
): LspDiagnosticResult {
|
|
157
|
+
const diagnostics = items.map(toDiagnostic);
|
|
158
|
+
return { diagnostics, syntaxErrors: [], otherDiagnostics: diagnostics, unversioned, complete };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function isMethodNotFound(error: unknown): boolean {
|
|
162
|
+
return error !== null && typeof error === "object" && "code" in error && error.code === -32601;
|
|
163
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { watch, type FSWatcher } from "node:fs";
|
|
2
|
+
import { readdir, stat } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { URI } from "vscode-uri";
|
|
5
|
+
|
|
6
|
+
interface WatchPattern {
|
|
7
|
+
globPattern: string | { baseUri: string | { uri: string }; pattern: string };
|
|
8
|
+
kind?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** A native filesystem event translated to the LSP file change types. */
|
|
12
|
+
export interface WatchedFileChange {
|
|
13
|
+
uri: string;
|
|
14
|
+
type: 1 | 2 | 3;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Own the filesystem subscriptions requested by one language server. */
|
|
18
|
+
export class LspFileWatchers {
|
|
19
|
+
private readonly registrations = new Map<string, FSWatcher[]>();
|
|
20
|
+
|
|
21
|
+
private disposed = false;
|
|
22
|
+
|
|
23
|
+
constructor(
|
|
24
|
+
private readonly root: string,
|
|
25
|
+
private readonly changed: (change: WatchedFileChange) => void,
|
|
26
|
+
private readonly failed: (error: Error) => void,
|
|
27
|
+
) {}
|
|
28
|
+
|
|
29
|
+
/** Install all patterns for one workspace/didChangeWatchedFiles registration. */
|
|
30
|
+
async register(id: string, patterns: readonly WatchPattern[]): Promise<void> {
|
|
31
|
+
const watchers: FSWatcher[] = [];
|
|
32
|
+
try {
|
|
33
|
+
for (const pattern of patterns) {
|
|
34
|
+
const glob = pattern.globPattern;
|
|
35
|
+
const root =
|
|
36
|
+
typeof glob === "string"
|
|
37
|
+
? this.root
|
|
38
|
+
: URI.parse(typeof glob.baseUri === "string" ? glob.baseUri : glob.baseUri.uri).fsPath;
|
|
39
|
+
const expression = typeof glob === "string" ? glob : glob.pattern;
|
|
40
|
+
const matches = (file: string) =>
|
|
41
|
+
path.matchesGlob(path.isAbsolute(expression) ? path.join(root, file) : file, expression);
|
|
42
|
+
const existing = new Set((await readdir(root, { recursive: true })).filter(matches));
|
|
43
|
+
|
|
44
|
+
if (this.disposed) throw new Error("Language server file watchers are disposed");
|
|
45
|
+
const watcher = watch(root, { recursive: true }, (_event, name) => {
|
|
46
|
+
if (!name || !matches(name)) return;
|
|
47
|
+
void stat(path.join(root, name)).then(
|
|
48
|
+
() => {
|
|
49
|
+
if (!this.registrations.get(id)?.includes(watcher)) return;
|
|
50
|
+
const type = existing.has(name) ? 2 : 1;
|
|
51
|
+
existing.add(name);
|
|
52
|
+
if ((pattern.kind ?? 7) & (type === 1 ? 1 : 2))
|
|
53
|
+
this.changed({ uri: URI.file(path.join(root, name)).toString(), type });
|
|
54
|
+
},
|
|
55
|
+
(error: NodeJS.ErrnoException) => {
|
|
56
|
+
if (!this.registrations.get(id)?.includes(watcher)) return;
|
|
57
|
+
if (error.code !== "ENOENT") {
|
|
58
|
+
this.failed(error);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (existing.delete(name) && (pattern.kind ?? 7) & 4)
|
|
62
|
+
this.changed({ uri: URI.file(path.join(root, name)).toString(), type: 3 });
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
watcher.on("error", this.failed);
|
|
67
|
+
watchers.push(watcher);
|
|
68
|
+
}
|
|
69
|
+
} catch (error) {
|
|
70
|
+
for (const watcher of watchers) watcher.close();
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
this.unregister(id);
|
|
74
|
+
this.registrations.set(id, watchers);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Stop a server registration without affecting its other subscriptions. */
|
|
78
|
+
unregister(id: string): void {
|
|
79
|
+
for (const watcher of this.registrations.get(id) ?? []) watcher.close();
|
|
80
|
+
this.registrations.delete(id);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Close all subscriptions when the server exits or the session ends. */
|
|
84
|
+
dispose(): void {
|
|
85
|
+
this.disposed = true;
|
|
86
|
+
for (const id of this.registrations.keys()) this.unregister(id);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Expand the project path in JSON initialization options, including plugin locations. */
|
|
2
|
+
export function resolveInitializationOptions(
|
|
3
|
+
value: Record<string, unknown>,
|
|
4
|
+
projectRoot: string,
|
|
5
|
+
): Record<string, unknown> {
|
|
6
|
+
const expand = (item: unknown): unknown => {
|
|
7
|
+
if (typeof item === "string") return item.replaceAll("{project}", () => projectRoot);
|
|
8
|
+
if (Array.isArray(item)) return item.map(expand);
|
|
9
|
+
if (item !== null && typeof item === "object")
|
|
10
|
+
return Object.fromEntries(Object.entries(item).map(([key, child]) => [key, expand(child)]));
|
|
11
|
+
return item;
|
|
12
|
+
};
|
|
13
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, expand(item)]));
|
|
14
|
+
}
|
|
@@ -11,7 +11,7 @@ import type { Compiler, CompileResult, Diagnostic, ToolContext } from "pi-agent-
|
|
|
11
11
|
* higher than skip (0). Handles any language with a configured LSP server
|
|
12
12
|
* that provides diagnostics capability.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
14
|
+
* LSP errors include type errors and never act as a syntax-only formatting gate.
|
|
15
15
|
*/
|
|
16
16
|
export function createLspCompiler(manager: LspManager): Compiler {
|
|
17
17
|
let _client: LspClient | null = null;
|
|
@@ -33,7 +33,7 @@ export function createLspCompiler(manager: LspManager): Compiler {
|
|
|
33
33
|
_client = client;
|
|
34
34
|
|
|
35
35
|
return {
|
|
36
|
-
ok:
|
|
36
|
+
ok: !diagnostics.some((diagnostic) => diagnostic.severity === "error"),
|
|
37
37
|
diagnostics,
|
|
38
38
|
syntaxErrors,
|
|
39
39
|
otherDiagnostics,
|
|
@@ -4,12 +4,17 @@ import path from "node:path";
|
|
|
4
4
|
import { URI } from "vscode-uri";
|
|
5
5
|
|
|
6
6
|
import { LspClient } from "./client.js";
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import { resolveInitializationOptions } from "./initialization-options.js";
|
|
9
|
+
import { toDiagnostic } from "./diagnostics.js";
|
|
10
|
+
import { type LspDiagnostic, type ResolvedServer } from "./types.js";
|
|
8
11
|
|
|
9
12
|
import type { LspServerRegistry } from "./registry.js";
|
|
10
13
|
import type { Diagnostic } from "pi-agent-ide/api/toolchain";
|
|
11
14
|
|
|
15
|
+
/** A workspace-scoped published report; an omitted version leaves freshness unverified. */
|
|
12
16
|
export interface LspPushDiagnosticsEvent {
|
|
17
|
+
cwd: string;
|
|
13
18
|
serverId: string;
|
|
14
19
|
uri: string;
|
|
15
20
|
version?: number;
|
|
@@ -83,6 +88,7 @@ export class LspManager {
|
|
|
83
88
|
return this._clients.size;
|
|
84
89
|
}
|
|
85
90
|
|
|
91
|
+
/** Subscribe to full published reports, including clearing updates from pull-capable servers. */
|
|
86
92
|
onPushDiagnostics(handler: PushHandler): () => void {
|
|
87
93
|
this._pushHandlers.add(handler);
|
|
88
94
|
return () => this._pushHandlers.delete(handler);
|
|
@@ -155,7 +161,10 @@ export class LspManager {
|
|
|
155
161
|
command: match.config.command,
|
|
156
162
|
...(match.config.env && { env: match.config.env }),
|
|
157
163
|
...(match.config.initializationOptions && {
|
|
158
|
-
initOptions:
|
|
164
|
+
initOptions: resolveInitializationOptions(
|
|
165
|
+
match.config.initializationOptions,
|
|
166
|
+
URI.parse(rootUri).fsPath,
|
|
167
|
+
),
|
|
159
168
|
}),
|
|
160
169
|
...(match.config.settings && { settings: match.config.settings }),
|
|
161
170
|
...(match.config.timeoutMs && { timeoutMs: match.config.timeoutMs }),
|
|
@@ -295,16 +304,15 @@ export class LspManager {
|
|
|
295
304
|
cwd: string,
|
|
296
305
|
capability: "diagnostics" | "symbols" = "diagnostics",
|
|
297
306
|
): Promise<{ client: LspClient; uri: string; languageId: string } | null> {
|
|
298
|
-
const extension = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
299
307
|
const absolutePath = path.resolve(cwd, filePath);
|
|
300
|
-
const client = await this.getOrStart(
|
|
308
|
+
const client = await this.getOrStart(absolutePath, cwd, capability);
|
|
301
309
|
|
|
302
310
|
if (!client) {
|
|
303
311
|
return null;
|
|
304
312
|
}
|
|
305
313
|
|
|
306
314
|
const uri = client.toUri(absolutePath);
|
|
307
|
-
const resolved = this._registry.resolve(
|
|
315
|
+
const resolved = this._registry.resolve(absolutePath);
|
|
308
316
|
const languageId = resolved[0]?.languageId ?? "plaintext";
|
|
309
317
|
|
|
310
318
|
// Read file content for didOpen
|
|
@@ -329,11 +337,7 @@ export class LspManager {
|
|
|
329
337
|
const unsubscribe = client.onNotification("textDocument/publishDiagnostics", (parameters) => {
|
|
330
338
|
const notification = parsePushNotification(parameters);
|
|
331
339
|
|
|
332
|
-
if (
|
|
333
|
-
!notification ||
|
|
334
|
-
client.diagnosticMode !== "push" ||
|
|
335
|
-
client.hasActiveDiagnosticRequest(notification.uri)
|
|
336
|
-
) {
|
|
340
|
+
if (!notification || client.hasActiveDiagnosticRequest(notification.uri)) {
|
|
337
341
|
return;
|
|
338
342
|
}
|
|
339
343
|
|
|
@@ -347,15 +351,9 @@ export class LspManager {
|
|
|
347
351
|
return;
|
|
348
352
|
}
|
|
349
353
|
|
|
350
|
-
const key = `${
|
|
351
|
-
|
|
352
|
-
if (notification.diagnostics.length === 0) {
|
|
353
|
-
this._pushFingerprints.delete(key);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
|
|
354
|
+
const key = `${clientKey}:${notification.uri}`;
|
|
357
355
|
const diagnostics = notification.diagnostics.map(toDiagnostic);
|
|
358
|
-
const fingerprint = JSON.stringify(diagnostics);
|
|
356
|
+
const fingerprint = JSON.stringify([notification.version, currentVersion, diagnostics]);
|
|
359
357
|
|
|
360
358
|
if (this._pushFingerprints.get(key) === fingerprint) {
|
|
361
359
|
return;
|
|
@@ -363,6 +361,7 @@ export class LspManager {
|
|
|
363
361
|
|
|
364
362
|
this._pushFingerprints.set(key, fingerprint);
|
|
365
363
|
const event: LspPushDiagnosticsEvent = {
|
|
364
|
+
cwd: URI.parse(client.rootUri).fsPath,
|
|
366
365
|
serverId: client.serverId,
|
|
367
366
|
uri: notification.uri,
|
|
368
367
|
diagnostics,
|
|
@@ -423,21 +422,3 @@ function parsePushNotification(parameters: unknown):
|
|
|
423
422
|
...(typeof value.version === "number" && { version: value.version }),
|
|
424
423
|
};
|
|
425
424
|
}
|
|
426
|
-
|
|
427
|
-
function toDiagnostic(diagnostic: LspDiagnostic): Diagnostic {
|
|
428
|
-
return {
|
|
429
|
-
code:
|
|
430
|
-
typeof diagnostic.code === "number" ? String(diagnostic.code) : (diagnostic.code ?? "LSP"),
|
|
431
|
-
message: diagnostic.message,
|
|
432
|
-
line: diagnostic.range.start.line + 1,
|
|
433
|
-
column: diagnostic.range.start.character + 1,
|
|
434
|
-
severity:
|
|
435
|
-
diagnostic.severity === DiagnosticSeverity.Error
|
|
436
|
-
? "error"
|
|
437
|
-
: diagnostic.severity === DiagnosticSeverity.Warning
|
|
438
|
-
? "warning"
|
|
439
|
-
: diagnostic.severity === DiagnosticSeverity.Information
|
|
440
|
-
? "info"
|
|
441
|
-
: "hint",
|
|
442
|
-
};
|
|
443
|
-
}
|