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
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { access } from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
|
|
4
1
|
import { DOCTOR_API_VERSION, DOCTOR_PROTOCOL } from "pi-agent-doctor/api/plugin-protocol";
|
|
5
|
-
import { projectIdeConfigPath } from "pi-agent-ide/api/tool-config";
|
|
6
2
|
import { URI } from "vscode-uri";
|
|
7
3
|
|
|
4
|
+
import { hasConfiguredExecutable } from "pi-agent-ide/api/tool-config";
|
|
5
|
+
|
|
8
6
|
import { LSP_RECIPES } from "./catalog.js";
|
|
9
7
|
import { LspClient } from "./lsp/client.js";
|
|
10
8
|
import { LspServerRegistry } from "./lsp/registry.js";
|
|
11
9
|
|
|
12
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
DoctorContext,
|
|
12
|
+
DoctorFinding,
|
|
13
|
+
DoctorPlugin,
|
|
14
|
+
DoctorSetupInspection,
|
|
15
|
+
} from "pi-agent-doctor/api/plugin-protocol";
|
|
16
|
+
import type { ResolvedServer } from "./lsp/types.js";
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
19
|
Doctor contribution owned by the LSP plugin.
|
|
@@ -23,67 +27,65 @@ export const lspDoctorPlugin: DoctorPlugin = {
|
|
|
23
27
|
api.addToolRecipe(recipe);
|
|
24
28
|
}
|
|
25
29
|
|
|
30
|
+
api.addSetupCheck({
|
|
31
|
+
id: "effective-config",
|
|
32
|
+
inspect: inspectLspSetup,
|
|
33
|
+
});
|
|
34
|
+
|
|
26
35
|
api.addCheck({
|
|
27
36
|
id: "config",
|
|
28
37
|
title: "LSP",
|
|
29
38
|
async run(context) {
|
|
30
|
-
const file = projectIdeConfigPath(context.cwd, "lsp-servers");
|
|
31
|
-
|
|
32
39
|
try {
|
|
33
|
-
await
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
status: "pass",
|
|
38
|
-
message: `${Object.keys(registry.servers).length} language servers loaded`,
|
|
39
|
-
detail: file,
|
|
40
|
-
},
|
|
41
|
-
];
|
|
40
|
+
const registry = await LspServerRegistry.fromPackageDir(context.cwd, {
|
|
41
|
+
environment: context.env,
|
|
42
|
+
});
|
|
43
|
+
const applicable = applicableServers(registry, context.files);
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
language.extensions.includes(path.extname(file).toLowerCase()),
|
|
48
|
-
),
|
|
49
|
-
)
|
|
50
|
-
) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
const client = new LspClient({
|
|
54
|
-
serverId: id,
|
|
55
|
-
rootUri: URI.file(context.cwd).toString(),
|
|
56
|
-
command: server.command,
|
|
57
|
-
env: definedEnvironment(context.env, server.env),
|
|
58
|
-
...(server.initializationOptions && { initOptions: server.initializationOptions }),
|
|
59
|
-
...(server.settings && { settings: server.settings }),
|
|
60
|
-
...(server.timeoutMs && { timeoutMs: server.timeoutMs }),
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
await client.start();
|
|
65
|
-
findings.push({ status: "pass", message: `${id} initialized` });
|
|
66
|
-
} catch (error) {
|
|
67
|
-
findings.push({
|
|
68
|
-
status: "fail",
|
|
69
|
-
message: `${id}: ${error instanceof Error ? error.message : String(error)}`,
|
|
70
|
-
});
|
|
71
|
-
} finally {
|
|
72
|
-
await client.shutdown().catch(() => {});
|
|
73
|
-
}
|
|
45
|
+
if (applicable.length === 0) {
|
|
46
|
+
return [
|
|
47
|
+
{ status: "skip", message: "No language server matches the inspected project files" },
|
|
48
|
+
];
|
|
74
49
|
}
|
|
75
50
|
|
|
76
|
-
return
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
51
|
+
return await Promise.all(
|
|
52
|
+
applicable.map(async (server): Promise<DoctorFinding> => {
|
|
53
|
+
const label = `${server.serverId} [${server.layer}] command ${JSON.stringify(server.config.command)}`;
|
|
54
|
+
const client = new LspClient({
|
|
55
|
+
serverId: server.serverId,
|
|
56
|
+
rootUri: URI.file(context.cwd).toString(),
|
|
57
|
+
command: server.config.command,
|
|
58
|
+
env: definedEnvironment(context.env, server.config.env),
|
|
59
|
+
...(server.config.initializationOptions && {
|
|
60
|
+
initOptions: server.config.initializationOptions,
|
|
61
|
+
}),
|
|
62
|
+
...(server.config.settings && { settings: server.config.settings }),
|
|
63
|
+
...(server.config.timeoutMs && { timeoutMs: server.config.timeoutMs }),
|
|
64
|
+
});
|
|
81
65
|
|
|
66
|
+
try {
|
|
67
|
+
await client.start();
|
|
68
|
+
return {
|
|
69
|
+
status: "pass",
|
|
70
|
+
message: `${label}: initialized`,
|
|
71
|
+
detail: server.sourcePath,
|
|
72
|
+
};
|
|
73
|
+
} catch (error) {
|
|
74
|
+
return {
|
|
75
|
+
status: "fail",
|
|
76
|
+
message: `${label}: ${error instanceof Error ? error.message : String(error)}`,
|
|
77
|
+
detail: server.sourcePath,
|
|
78
|
+
};
|
|
79
|
+
} finally {
|
|
80
|
+
await client.shutdown().catch(() => {});
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
} catch (error) {
|
|
82
85
|
return [
|
|
83
86
|
{
|
|
84
87
|
status: "fail",
|
|
85
88
|
message: error instanceof Error ? error.message : String(error),
|
|
86
|
-
detail: file,
|
|
87
89
|
},
|
|
88
90
|
];
|
|
89
91
|
}
|
|
@@ -92,8 +94,59 @@ export const lspDoctorPlugin: DoctorPlugin = {
|
|
|
92
94
|
},
|
|
93
95
|
};
|
|
94
96
|
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
+
async function inspectLspSetup(context: DoctorContext): Promise<DoctorSetupInspection> {
|
|
98
|
+
try {
|
|
99
|
+
const registry = await LspServerRegistry.fromPackageDir(context.cwd, {
|
|
100
|
+
environment: context.env,
|
|
101
|
+
});
|
|
102
|
+
const selections = [];
|
|
103
|
+
const actions = new Map<string, { readonly id: string; readonly message: string }>();
|
|
104
|
+
|
|
105
|
+
for (const [languageId, files] of context.detectedLanguages) {
|
|
106
|
+
const selected = files
|
|
107
|
+
.flatMap((file) => registry.resolve(file))
|
|
108
|
+
.find((server) => server.languageId === languageId);
|
|
109
|
+
if (selected === undefined) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
selections.push({ kind: "lsp" as const, languageId, toolId: selected.serverId });
|
|
114
|
+
if (!(await hasConfiguredExecutable(selected.config, context.cwd, context.env))) {
|
|
115
|
+
actions.set(selected.serverId, {
|
|
116
|
+
id: `lsp-${selected.serverId}-unavailable`,
|
|
117
|
+
message: `Configured language server ${selected.serverId} cannot run ${JSON.stringify(selected.config.command)}`,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return { selections, actions: [...actions.values()] };
|
|
123
|
+
} catch (error) {
|
|
124
|
+
return {
|
|
125
|
+
actions: [
|
|
126
|
+
{
|
|
127
|
+
id: "lsp-config-invalid",
|
|
128
|
+
message: `Language server configuration cannot load: ${error instanceof Error ? error.message : String(error)}`,
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function applicableServers(
|
|
136
|
+
registry: LspServerRegistry,
|
|
137
|
+
files: readonly string[],
|
|
138
|
+
): readonly ResolvedServer[] {
|
|
139
|
+
const applicable = new Map<string, ResolvedServer>();
|
|
140
|
+
|
|
141
|
+
for (const file of files) {
|
|
142
|
+
const server = registry.resolve(file)[0];
|
|
143
|
+
|
|
144
|
+
if (server !== undefined && !applicable.has(server.serverId)) {
|
|
145
|
+
applicable.set(server.serverId, server);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return [...applicable.values()];
|
|
97
150
|
}
|
|
98
151
|
|
|
99
152
|
function definedEnvironment(
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
import { requiredValue } from "
|
|
1
|
+
import { requiredValue } from "pi-agent-invariant";
|
|
2
2
|
import { type ChildProcess } from "node:child_process";
|
|
3
3
|
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
4
6
|
import spawnProcess from "cross-spawn";
|
|
7
|
+
import { createConfiguredProcessEnvironment } from "pi-agent-ide/api/tool-config";
|
|
5
8
|
import {
|
|
6
9
|
createMessageConnection,
|
|
10
|
+
CancellationTokenSource,
|
|
7
11
|
type MessageConnection,
|
|
8
12
|
StreamMessageReader,
|
|
9
|
-
StreamMessageWriter,
|
|
10
13
|
} from "vscode-jsonrpc/node";
|
|
11
14
|
import { URI } from "vscode-uri";
|
|
12
15
|
|
|
16
|
+
import type { LspDiagnostic } from "./types.js";
|
|
17
|
+
|
|
18
|
+
import { LspFileWatchers } from "./file-watchers.js";
|
|
19
|
+
|
|
20
|
+
import { TransportWriter } from "./transport-writer.js";
|
|
21
|
+
|
|
22
|
+
/** Latest push observation for an open document, without a completion guarantee. */
|
|
23
|
+
export interface LspDiagnosticPublication {
|
|
24
|
+
readonly version?: number;
|
|
25
|
+
readonly diagnostics: LspDiagnostic[];
|
|
26
|
+
}
|
|
27
|
+
|
|
13
28
|
/**
|
|
14
29
|
* Generic LSP client — JSON-RPC over stdio.
|
|
15
30
|
*
|
|
@@ -24,8 +39,16 @@ export class LspClient {
|
|
|
24
39
|
private _disposed = false;
|
|
25
40
|
|
|
26
41
|
private _crashed = false;
|
|
42
|
+
|
|
43
|
+
private _stderr = "";
|
|
44
|
+
|
|
45
|
+
private _fileWatchers: LspFileWatchers | undefined;
|
|
27
46
|
private readonly _handlers = new Map<string, ((parameters: unknown) => void)[]>();
|
|
28
47
|
private readonly _documentVersions = new Map<string, number>();
|
|
48
|
+
|
|
49
|
+
private readonly _documentContents = new Map<string, string>();
|
|
50
|
+
|
|
51
|
+
private readonly _diagnosticPublications = new Map<string, LspDiagnosticPublication>();
|
|
29
52
|
private _diagnosticMode: "unknown" | "pull" | "push" = "unknown";
|
|
30
53
|
private readonly _activeDiagnosticRequests = new Set<string>();
|
|
31
54
|
|
|
@@ -79,28 +102,17 @@ export class LspClient {
|
|
|
79
102
|
this._diagnosticMode = mode;
|
|
80
103
|
}
|
|
81
104
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const td = this._serverCapabilities.textDocument as Record<string, unknown> | undefined;
|
|
88
|
-
|
|
89
|
-
if (!td) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Pull-model diagnostic (LSP 3.17+)
|
|
94
|
-
if (td.diagnostic) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// Push-model publishDiagnostics
|
|
99
|
-
if (td.publishDiagnostics) {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
105
|
+
/** Maximum wait for a server response, including pushed diagnostics. */
|
|
106
|
+
get timeoutMs(): number {
|
|
107
|
+
return this._timeoutMs;
|
|
108
|
+
}
|
|
102
109
|
|
|
103
|
-
|
|
110
|
+
/** Whether initialization advertised a server-specific executeCommand capability. */
|
|
111
|
+
supportsCommand(command: string): boolean {
|
|
112
|
+
const provider = this._serverCapabilities?.executeCommandProvider as
|
|
113
|
+
| { commands?: unknown }
|
|
114
|
+
| undefined;
|
|
115
|
+
return Array.isArray(provider?.commands) && provider.commands.includes(command);
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
get hasFoldingRangeCapability(): boolean {
|
|
@@ -112,6 +124,11 @@ export class LspClient {
|
|
|
112
124
|
return this._documentVersions.get(uri);
|
|
113
125
|
}
|
|
114
126
|
|
|
127
|
+
/** Reuse a push that arrived after the latest synchronization, including an empty publication. */
|
|
128
|
+
diagnosticPublication(uri: string): LspDiagnosticPublication | undefined {
|
|
129
|
+
return this._diagnosticPublications.get(uri);
|
|
130
|
+
}
|
|
131
|
+
|
|
115
132
|
beginDiagnosticRequest(uri: string): void {
|
|
116
133
|
this._activeDiagnosticRequests.add(uri);
|
|
117
134
|
}
|
|
@@ -134,11 +151,20 @@ export class LspClient {
|
|
|
134
151
|
}
|
|
135
152
|
|
|
136
153
|
const bin = requiredValue(this._command[0]);
|
|
154
|
+
const projectRoot = URI.parse(this.rootUri).fsPath;
|
|
155
|
+
|
|
156
|
+
const workspaceFolders = [
|
|
157
|
+
{ uri: this.rootUri, name: path.basename(projectRoot) || projectRoot },
|
|
158
|
+
];
|
|
137
159
|
|
|
138
160
|
const childProcess = spawnProcess(bin, this._args, {
|
|
139
161
|
stdio: ["pipe", "pipe", "pipe"],
|
|
140
|
-
cwd:
|
|
141
|
-
env:
|
|
162
|
+
cwd: projectRoot,
|
|
163
|
+
env: createConfiguredProcessEnvironment(
|
|
164
|
+
{ command: this._command, env: this._env },
|
|
165
|
+
projectRoot,
|
|
166
|
+
process.env,
|
|
167
|
+
),
|
|
142
168
|
});
|
|
143
169
|
this._process = childProcess;
|
|
144
170
|
const spawnPromise = waitForSpawn(childProcess);
|
|
@@ -149,6 +175,12 @@ export class LspClient {
|
|
|
149
175
|
childProcess.stdout?.on("error", () => void 0);
|
|
150
176
|
childProcess.stderr?.on("error", () => void 0);
|
|
151
177
|
|
|
178
|
+
this._stderr = "";
|
|
179
|
+
childProcess.stderr?.setEncoding("utf8");
|
|
180
|
+
childProcess.stderr?.on("data", (chunk: string) => {
|
|
181
|
+
this._stderr = (this._stderr + chunk).slice(-4096);
|
|
182
|
+
});
|
|
183
|
+
|
|
152
184
|
childProcess.on("error", (error) => {
|
|
153
185
|
const code = "code" in error ? (error as { code?: unknown }).code : undefined;
|
|
154
186
|
|
|
@@ -163,6 +195,7 @@ export class LspClient {
|
|
|
163
195
|
});
|
|
164
196
|
|
|
165
197
|
childProcess.on("exit", (code, _signal) => {
|
|
198
|
+
this._fileWatchers?.dispose();
|
|
166
199
|
if (!this._disposed && code !== 0 && code !== null) {
|
|
167
200
|
this._crashed = true;
|
|
168
201
|
}
|
|
@@ -174,24 +207,106 @@ export class LspClient {
|
|
|
174
207
|
});
|
|
175
208
|
|
|
176
209
|
await spawnPromise;
|
|
177
|
-
|
|
210
|
+
const connection = createMessageConnection(
|
|
178
211
|
new StreamMessageReader(requiredValue(childProcess.stdout)),
|
|
179
|
-
new
|
|
212
|
+
new TransportWriter(requiredValue(childProcess.stdin), (error) => {
|
|
213
|
+
if (this._connection !== connection || this._disposed) return;
|
|
214
|
+
this._crashed = true;
|
|
215
|
+
this._initialized = false;
|
|
216
|
+
this._fileWatchers?.dispose();
|
|
217
|
+
connection.dispose();
|
|
218
|
+
console.error(`[lsp] ${this.serverId}: transport write failed:`, error);
|
|
219
|
+
}),
|
|
180
220
|
);
|
|
221
|
+
this._connection = connection;
|
|
181
222
|
|
|
182
223
|
this._connection.onError((error) => {
|
|
183
224
|
console.error(`[lsp] ${this.serverId}: connection error:`, error);
|
|
184
225
|
});
|
|
185
226
|
|
|
227
|
+
this._fileWatchers = new LspFileWatchers(
|
|
228
|
+
projectRoot,
|
|
229
|
+
(change) => {
|
|
230
|
+
this._sendNotification("workspace/didChangeWatchedFiles", { changes: [change] });
|
|
231
|
+
},
|
|
232
|
+
(error) => console.error(`[lsp] ${this.serverId}: file watcher failed:`, error),
|
|
233
|
+
);
|
|
234
|
+
this._connection.onRequest(
|
|
235
|
+
"client/registerCapability",
|
|
236
|
+
async (parameters: {
|
|
237
|
+
registrations: {
|
|
238
|
+
id: string;
|
|
239
|
+
method: string;
|
|
240
|
+
registerOptions?: { watchers?: Parameters<LspFileWatchers["register"]>[1] };
|
|
241
|
+
}[];
|
|
242
|
+
}) => {
|
|
243
|
+
for (const registration of parameters.registrations) {
|
|
244
|
+
// Settings are fixed for this client and already served by workspace/configuration.
|
|
245
|
+
if (registration.method === "workspace/didChangeConfiguration") continue;
|
|
246
|
+
if (registration.method !== "workspace/didChangeWatchedFiles")
|
|
247
|
+
throw new Error(`Unsupported dynamic capability: ${registration.method}`);
|
|
248
|
+
await this._fileWatchers?.register(
|
|
249
|
+
registration.id,
|
|
250
|
+
registration.registerOptions?.watchers ?? [],
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
},
|
|
255
|
+
);
|
|
256
|
+
this._connection.onRequest(
|
|
257
|
+
"client/unregisterCapability",
|
|
258
|
+
(parameters: { unregisterations: { id: string }[] }) => {
|
|
259
|
+
for (const registration of parameters.unregisterations)
|
|
260
|
+
this._fileWatchers?.unregister(registration.id);
|
|
261
|
+
return null;
|
|
262
|
+
},
|
|
263
|
+
);
|
|
264
|
+
this._connection.onRequest("window/workDoneProgress/create", () => null);
|
|
265
|
+
|
|
266
|
+
this._connection.onRequest(
|
|
267
|
+
"workspace/configuration",
|
|
268
|
+
(parameters: { items: { section?: string }[] }) =>
|
|
269
|
+
parameters.items.map((item) => {
|
|
270
|
+
let value: unknown = this._settings ?? null;
|
|
271
|
+
for (const segment of item.section?.split(".").filter(Boolean) ?? []) {
|
|
272
|
+
value =
|
|
273
|
+
typeof value === "object" && value !== null
|
|
274
|
+
? ((value as Record<string, unknown>)[segment] ?? null)
|
|
275
|
+
: null;
|
|
276
|
+
}
|
|
277
|
+
return value;
|
|
278
|
+
}),
|
|
279
|
+
);
|
|
280
|
+
|
|
186
281
|
this._connection.listen();
|
|
187
282
|
|
|
188
283
|
// Forward all incoming notifications to registered handlers
|
|
189
284
|
this._connection.onNotification((method, ...parameters) => {
|
|
285
|
+
if (method === "textDocument/publishDiagnostics") {
|
|
286
|
+
const publication = parameters[0] as
|
|
287
|
+
| { uri?: unknown; version?: unknown; diagnostics?: unknown }
|
|
288
|
+
| undefined;
|
|
289
|
+
if (
|
|
290
|
+
publication &&
|
|
291
|
+
typeof publication.uri === "string" &&
|
|
292
|
+
Array.isArray(publication.diagnostics) &&
|
|
293
|
+
this._documentVersions.has(publication.uri) &&
|
|
294
|
+
(publication.version === undefined ||
|
|
295
|
+
publication.version === this.documentVersion(publication.uri))
|
|
296
|
+
) {
|
|
297
|
+
this._diagnosticPublications.set(publication.uri, {
|
|
298
|
+
diagnostics: publication.diagnostics as LspDiagnostic[],
|
|
299
|
+
...(typeof publication.version === "number" && { version: publication.version }),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
190
303
|
for (const handler of this._handlers.get(method) ?? []) {
|
|
191
304
|
handler(parameters[0] as unknown);
|
|
192
305
|
}
|
|
193
306
|
});
|
|
194
307
|
|
|
308
|
+
this._connection.onRequest("workspace/workspaceFolders", () => workspaceFolders);
|
|
309
|
+
|
|
195
310
|
interface InitResult {
|
|
196
311
|
capabilities: Record<string, unknown>;
|
|
197
312
|
}
|
|
@@ -200,14 +315,24 @@ export class LspClient {
|
|
|
200
315
|
this._connection.sendRequest<InitResult>("initialize", {
|
|
201
316
|
processId: process.pid,
|
|
202
317
|
rootUri: this.rootUri,
|
|
318
|
+
|
|
319
|
+
workspaceFolders,
|
|
203
320
|
capabilities: {
|
|
204
321
|
workspace: {
|
|
205
322
|
applyEdit: false,
|
|
323
|
+
|
|
324
|
+
configuration: true,
|
|
325
|
+
|
|
326
|
+
workspaceFolders: true,
|
|
327
|
+
|
|
328
|
+
didChangeWatchedFiles: { dynamicRegistration: true, relativePatternSupport: true },
|
|
206
329
|
symbol: { dynamicRegistration: false },
|
|
207
330
|
},
|
|
208
331
|
textDocument: {
|
|
209
332
|
synchronization: { didOpen: true, didChange: true, didClose: true },
|
|
210
333
|
publishDiagnostics: { relatedInformation: true },
|
|
334
|
+
|
|
335
|
+
diagnostic: { dynamicRegistration: false, relatedDocumentSupport: false },
|
|
211
336
|
documentSymbol: { hierarchicalDocumentSymbolSupport: true },
|
|
212
337
|
foldingRange: { lineFoldingOnly: true },
|
|
213
338
|
},
|
|
@@ -216,20 +341,30 @@ export class LspClient {
|
|
|
216
341
|
}),
|
|
217
342
|
this._timeoutMs,
|
|
218
343
|
`[lsp] ${this.serverId}: initialize timed out`,
|
|
219
|
-
)
|
|
344
|
+
).catch((error: unknown) => {
|
|
345
|
+
const detail = this._stderr.trim();
|
|
346
|
+
if (!detail) throw error;
|
|
347
|
+
throw new Error(`[lsp] ${this.serverId}: ${detail}`, { cause: error });
|
|
348
|
+
});
|
|
220
349
|
|
|
221
|
-
|
|
350
|
+
await this._connection.sendNotification("initialized", {
|
|
222
351
|
capabilities: initResult.capabilities,
|
|
223
352
|
});
|
|
224
353
|
|
|
225
354
|
if (this._settings !== undefined) {
|
|
226
|
-
|
|
355
|
+
await this._connection.sendNotification("workspace/didChangeConfiguration", {
|
|
227
356
|
settings: this._settings,
|
|
228
357
|
});
|
|
229
358
|
}
|
|
230
359
|
|
|
360
|
+
if (this._crashed)
|
|
361
|
+
throw new Error(`[lsp] ${this.serverId}: transport failed during initialization`);
|
|
362
|
+
|
|
231
363
|
this._initialized = true;
|
|
232
364
|
this._serverCapabilities = initResult.capabilities;
|
|
365
|
+
|
|
366
|
+
// Unadvertised methods may return null or internal errors rather than MethodNotFound.
|
|
367
|
+
this._diagnosticMode = initResult.capabilities.diagnosticProvider ? "pull" : "push";
|
|
233
368
|
}
|
|
234
369
|
|
|
235
370
|
touch(): void {
|
|
@@ -237,6 +372,7 @@ export class LspClient {
|
|
|
237
372
|
}
|
|
238
373
|
|
|
239
374
|
async restart(): Promise<void> {
|
|
375
|
+
this._fileWatchers?.dispose();
|
|
240
376
|
this._connection?.dispose();
|
|
241
377
|
this._connection = null;
|
|
242
378
|
this._process = null;
|
|
@@ -244,6 +380,8 @@ export class LspClient {
|
|
|
244
380
|
this._crashed = false;
|
|
245
381
|
this._disposed = false;
|
|
246
382
|
this._documentVersions.clear();
|
|
383
|
+
this._documentContents.clear();
|
|
384
|
+
this._diagnosticPublications.clear();
|
|
247
385
|
this._diagnosticMode = "unknown";
|
|
248
386
|
this._activeDiagnosticRequests.clear();
|
|
249
387
|
this._serverCapabilities = null;
|
|
@@ -252,14 +390,56 @@ export class LspClient {
|
|
|
252
390
|
|
|
253
391
|
// ── LSP protocol ───────────────────────────────────────────────────
|
|
254
392
|
|
|
255
|
-
|
|
393
|
+
/** Send a request, forwarding optional cancellation to the language server. */
|
|
394
|
+
async sendRequest<T = unknown>(
|
|
395
|
+
method: string,
|
|
396
|
+
parameters: unknown,
|
|
397
|
+
signal?: AbortSignal,
|
|
398
|
+
): Promise<T> {
|
|
256
399
|
this._assertReady();
|
|
257
|
-
|
|
400
|
+
signal?.throwIfAborted();
|
|
401
|
+
if (!signal) return requiredValue(this._connection).sendRequest(method, parameters);
|
|
402
|
+
const cancellation = new CancellationTokenSource();
|
|
403
|
+
let onAbort: (() => void) | undefined;
|
|
404
|
+
try {
|
|
405
|
+
const request = requiredValue(this._connection).sendRequest<T>(
|
|
406
|
+
method,
|
|
407
|
+
parameters,
|
|
408
|
+
cancellation.token,
|
|
409
|
+
);
|
|
410
|
+
return await Promise.race([
|
|
411
|
+
request,
|
|
412
|
+
new Promise<never>((_resolve, reject) => {
|
|
413
|
+
onAbort = () => {
|
|
414
|
+
cancellation.cancel();
|
|
415
|
+
reject(signal.reason);
|
|
416
|
+
};
|
|
417
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
418
|
+
}),
|
|
419
|
+
]);
|
|
420
|
+
} finally {
|
|
421
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
422
|
+
cancellation.dispose();
|
|
423
|
+
}
|
|
258
424
|
}
|
|
259
425
|
|
|
426
|
+
/** Queue a notification; a failed write makes this client unavailable without escaping to Pi. */
|
|
260
427
|
sendNotification(method: string, parameters: unknown): void {
|
|
261
428
|
this._assertReady();
|
|
262
|
-
|
|
429
|
+
this._sendNotification(method, parameters);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
private _sendNotification(method: string, parameters: unknown): void {
|
|
433
|
+
const connection = this._connection;
|
|
434
|
+
if (!connection) return;
|
|
435
|
+
void connection.sendNotification(method, parameters).catch((error: unknown) => {
|
|
436
|
+
if (this._connection !== connection || this._disposed) return;
|
|
437
|
+
this._crashed = true;
|
|
438
|
+
this._initialized = false;
|
|
439
|
+
this._fileWatchers?.dispose();
|
|
440
|
+
connection.dispose();
|
|
441
|
+
console.error(`[lsp] ${this.serverId}: notification ${method} failed:`, error);
|
|
442
|
+
});
|
|
263
443
|
}
|
|
264
444
|
|
|
265
445
|
/**
|
|
@@ -299,36 +479,58 @@ export class LspClient {
|
|
|
299
479
|
return;
|
|
300
480
|
}
|
|
301
481
|
|
|
482
|
+
this._diagnosticPublications.delete(uri);
|
|
302
483
|
this.sendNotification("textDocument/didOpen", {
|
|
303
484
|
textDocument: { uri, languageId, version, text },
|
|
304
485
|
});
|
|
305
486
|
this._documentVersions.set(uri, version);
|
|
487
|
+
|
|
488
|
+
this._documentContents.set(uri, text);
|
|
306
489
|
}
|
|
307
490
|
|
|
308
|
-
|
|
491
|
+
/** Sync content, optionally reporting a completed disk write to servers that request saves. */
|
|
492
|
+
syncDocument(uri: string, text: string, languageId: string, saved = false): void {
|
|
493
|
+
if (this._documentContents.get(uri) === text) return;
|
|
309
494
|
const currentVersion = this._documentVersions.get(uri);
|
|
310
495
|
|
|
311
496
|
if (currentVersion === undefined) {
|
|
312
497
|
this.openDocument(uri, text, languageId);
|
|
313
|
-
|
|
498
|
+
} else {
|
|
499
|
+
this.changeDocument(uri, text, currentVersion + 1);
|
|
500
|
+
}
|
|
501
|
+
const synchronization = this._serverCapabilities?.textDocumentSync;
|
|
502
|
+
const save =
|
|
503
|
+
typeof synchronization === "object" && synchronization !== null
|
|
504
|
+
? (synchronization as { save?: boolean | { includeText?: boolean } }).save
|
|
505
|
+
: undefined;
|
|
506
|
+
if (saved && save) {
|
|
507
|
+
this.sendNotification("textDocument/didSave", {
|
|
508
|
+
textDocument: { uri },
|
|
509
|
+
...(typeof save === "object" && save.includeText && { text }),
|
|
510
|
+
});
|
|
314
511
|
}
|
|
315
|
-
|
|
316
|
-
this.changeDocument(uri, text, currentVersion + 1);
|
|
317
512
|
}
|
|
318
513
|
|
|
319
514
|
changeDocument(uri: string, text: string, version: number): void {
|
|
320
515
|
const currentVersion = this._documentVersions.get(uri);
|
|
321
516
|
const nextVersion = Math.max(version, (currentVersion ?? 0) + 1);
|
|
517
|
+
this._diagnosticPublications.delete(uri);
|
|
322
518
|
this.sendNotification("textDocument/didChange", {
|
|
323
519
|
textDocument: { uri, version: nextVersion },
|
|
324
520
|
contentChanges: [{ text }],
|
|
325
521
|
});
|
|
326
522
|
this._documentVersions.set(uri, nextVersion);
|
|
523
|
+
|
|
524
|
+
this._documentContents.set(uri, text);
|
|
327
525
|
}
|
|
328
526
|
|
|
329
527
|
closeDocument(uri: string): void {
|
|
330
528
|
this.sendNotification("textDocument/didClose", { textDocument: { uri } });
|
|
331
529
|
this._documentVersions.delete(uri);
|
|
530
|
+
|
|
531
|
+
this._documentContents.delete(uri);
|
|
532
|
+
|
|
533
|
+
this._diagnosticPublications.delete(uri);
|
|
332
534
|
}
|
|
333
535
|
|
|
334
536
|
// ── cleanup ────────────────────────────────────────────────────────
|
|
@@ -340,9 +542,15 @@ export class LspClient {
|
|
|
340
542
|
|
|
341
543
|
this._disposed = true;
|
|
342
544
|
|
|
545
|
+
this._fileWatchers?.dispose();
|
|
546
|
+
|
|
343
547
|
if (this._connection && this._initialized) {
|
|
344
548
|
try {
|
|
345
|
-
await
|
|
549
|
+
await withTimeout(
|
|
550
|
+
this._connection.sendRequest("shutdown"),
|
|
551
|
+
Math.min(this._timeoutMs, 1000),
|
|
552
|
+
`[lsp] ${this.serverId}: shutdown timed out`,
|
|
553
|
+
);
|
|
346
554
|
await this._connection.sendNotification("exit").catch(() => {
|
|
347
555
|
/* ok */
|
|
348
556
|
});
|
|
@@ -367,6 +575,8 @@ export class LspClient {
|
|
|
367
575
|
|
|
368
576
|
this._initialized = false;
|
|
369
577
|
this._documentVersions.clear();
|
|
578
|
+
this._documentContents.clear();
|
|
579
|
+
this._diagnosticPublications.clear();
|
|
370
580
|
this._diagnosticMode = "unknown";
|
|
371
581
|
this._activeDiagnosticRequests.clear();
|
|
372
582
|
this._serverCapabilities = null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { requiredValue } from "
|
|
1
|
+
import { requiredValue } from "pi-agent-invariant";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -511,6 +511,7 @@ function filePathFromUri(uri: string): string {
|
|
|
511
511
|
function displayFilePath(filePath: string, cwd: string): string {
|
|
512
512
|
const relative = path.relative(cwd, filePath);
|
|
513
513
|
|
|
514
|
+
// oxlint-disable-next-line repo/no-parent-paths -- defensive check against traversal, not a traversal
|
|
514
515
|
if (relative.length === 0 || relative.startsWith("..") || path.isAbsolute(relative)) {
|
|
515
516
|
return filePath;
|
|
516
517
|
}
|