pi-agent-ide 0.2.0 → 0.2.2
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 +57 -0
- package/dist/{chunk-XNXQYPVT.js → chunk-4LUW26BX.js} +1 -1
- package/dist/{chunk-2ZMYT6ZC.js → chunk-4U6KGABH.js} +1 -1
- package/dist/chunk-4ZTEPMJO.js +14 -0
- package/dist/{chunk-KNMWCDDK.js → chunk-6ACQQBUY.js} +1 -1
- package/dist/chunk-76WHES5H.js +7 -0
- package/dist/chunk-BHSO2MDK.js +6 -0
- package/dist/chunk-BMOJTJJJ.js +3 -0
- package/dist/chunk-GFWDXTOB.js +4 -0
- package/dist/{chunk-VSP2QQPQ.js → chunk-GIRAEVUJ.js} +1 -1
- package/dist/chunk-JJVXUL5U.js +2 -0
- package/dist/chunk-KCEOTU5Z.js +3 -0
- package/dist/chunk-KVGQG43U.js +1 -0
- package/dist/{chunk-MTTKFJV6.js → chunk-LQYZG62K.js} +1 -1
- package/dist/chunk-N34ATN52.js +1 -0
- package/dist/{chunk-PETQCA7G.js → chunk-P6T3Q7LB.js} +1 -1
- package/dist/chunk-QIJMV2P2.js +2 -0
- package/dist/chunk-QJFRAMK7.js +2 -0
- package/dist/{chunk-2SKAED2I.js → chunk-RAZOACDD.js} +2 -2
- package/dist/chunk-RIGRP3FD.js +1 -0
- package/dist/chunk-S3ZPXWX7.js +2 -0
- package/dist/{chunk-266RH77Z.js → chunk-THSCUT2L.js} +1 -1
- package/dist/{chunk-EEH4WYI7.js → chunk-WNMGUALD.js} +1 -1
- package/dist/chunk-WZI4YC2O.js +1 -0
- package/dist/{chunk-5A25RATC.js → chunk-X6MPU7UO.js} +3 -3
- package/dist/{chunk-QNZVPFSP.js → chunk-XF5PVZOS.js} +1 -1
- package/dist/{chunk-SJYDLHEF.js → chunk-ZXN3TWWW.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-13.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-18.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +2 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-23.js +1 -1
- package/dist/entry-24.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-26.js +7 -1
- package/dist/entry-27.js +1 -1
- package/dist/entry-28.js +1 -1
- package/dist/entry-29.js +1 -1
- package/dist/entry-30.js +1 -1
- package/dist/entry-31.js +4 -1
- package/dist/entry-32.js +8 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +1 -1
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +14 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-45.js +7 -1
- package/dist/entry-46.js +11 -1
- package/dist/entry-47.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -0
- package/dist/entry-54.js +0 -1
- package/dist/entry-55.js +1 -0
- package/dist/entry-56.js +0 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -0
- package/dist/entry-63.js +0 -1
- package/dist/entry-64.js +1 -0
- package/dist/entry-65.js +0 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-68.js +1 -1
- package/dist/entry-69.js +59 -1
- package/dist/entry-70.js +4 -1
- package/dist/entry-71.js +1 -1
- package/dist/entry-72.js +29 -1
- package/dist/entry-73.js +2 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-76.js +1 -1
- package/dist/entry-77.js +3 -1
- package/dist/entry-78.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-80.js +1 -0
- package/dist/pi-agent-ide.js +2 -13
- package/docs/configuration.md +57 -1
- package/docs/extensions.md +4 -2
- 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 -7
- 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 -6
- package/docs/generated/tool-catalog/index.md +9 -0
- package/docs/generated/tool-catalog/javascript.md +8 -8
- package/docs/generated/tool-catalog/json.md +7 -7
- 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 -6
- 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/typescript.md +9 -8
- package/docs/generated/tool-catalog/vue.md +9 -0
- package/docs/generated/tool-catalog/yaml.md +6 -6
- package/docs/generated/tool-catalog/zig.md +9 -0
- package/docs/tools.md +1 -1
- package/node_modules/pi-agent-doctor/package.json +10 -3
- 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 +63 -17
- package/node_modules/pi-agent-filesystem/index.ts +2 -2
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +4 -4
- package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
- 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 -11
- package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +0 -1
- package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +2 -0
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +3 -0
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +92 -19
- package/node_modules/pi-agent-ide-ast/src/extension.ts +9 -14
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +60 -0
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/node_modules/pi-agent-ide-changes/index.ts +1 -5
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/runtime/entry-27.js +0 -1
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +1 -7
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/node_modules/pi-agent-ide-formatter/package.json +4 -4
- package/node_modules/pi-agent-ide-formatter/src/catalog.ts +131 -13
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +12 -7
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +20 -8
- package/node_modules/pi-agent-ide-languages/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/src/languages.ts +15 -0
- package/node_modules/pi-agent-ide-lint/index.ts +4 -1
- package/node_modules/pi-agent-ide-lint/package.json +8 -8
- package/node_modules/pi-agent-ide-lint/src/catalog.ts +196 -39
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +23 -3
- package/node_modules/pi-agent-ide-lint/src/diagnostics.ts +73 -33
- package/node_modules/pi-agent-ide-lint/src/registry.ts +20 -8
- package/node_modules/pi-agent-ide-lsp/index.ts +1 -12
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- 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/diagnostic-source.ts +10 -10
- package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +2 -4
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +162 -12
- 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/manager.ts +8 -4
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +69 -34
- 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 +5 -0
- package/node_modules/pi-agent-image/package.json +3 -3
- package/node_modules/pi-agent-image/src/image-converter.ts +1 -1
- package/node_modules/pi-agent-invariant/package.json +2 -2
- package/node_modules/pi-agent-pdf/package.json +3 -3
- package/node_modules/pi-agent-pdf/src/pdf-converter.ts +1 -1
- package/node_modules/pi-agent-read/package.json +11 -11
- package/node_modules/pi-agent-read/runtime/entry-39.js +0 -1
- package/node_modules/pi-agent-read/runtime/entry-40.js +2 -0
- package/node_modules/pi-agent-read/src/api/rendering.ts +3 -0
- package/node_modules/pi-agent-read/src/core/read-core.ts +6 -26
- package/node_modules/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +28 -7
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +35 -30
- package/node_modules/pi-agent-resource/package.json +2 -2
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -8
- package/node_modules/pi-agent-search/package.json +7 -7
- package/node_modules/pi-agent-search/runtime/entry-44.js +0 -1
- package/node_modules/pi-agent-search/src/core/extension.ts +7 -5
- package/node_modules/pi-agent-search/src/core/search-core.ts +10 -0
- package/node_modules/pi-agent-search-text/index.ts +42 -33
- package/node_modules/pi-agent-search-text/package.json +9 -9
- package/node_modules/pi-agent-search-text/runtime/entry-46.js +1 -0
- package/node_modules/pi-agent-search-text/src/file-search.ts +9 -1
- package/node_modules/pi-agent-search-text/src/resolvers.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/node_modules/pi-agent-search-text/src/search-session.ts +48 -0
- package/node_modules/pi-agent-text/package.json +3 -3
- package/node_modules/pi-agent-text/runtime/entry-48.js +1 -0
- package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
- package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-49.js +2 -0
- package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +2 -0
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -6
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +2 -0
- package/node_modules/pi-agent-text-editor/package.json +22 -22
- package/node_modules/pi-agent-text-editor/runtime/entry-68.js +0 -1
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +71 -1
- package/node_modules/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +7 -9
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +27 -2
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +38 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +23 -0
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +5 -9
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +54 -14
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/node_modules/pi-agent-text-editor-argument-order/package.json +3 -3
- package/node_modules/pi-agent-text-editor-overwrite/package.json +4 -4
- package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -1
- package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
- package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +52 -4
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +5 -3
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- 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 +3 -3
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
- package/node_modules/pi-agent-tool-ui/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +1 -0
- package/node_modules/pi-agent-web/index.ts +1 -6
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web-html/package.json +3 -3
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- package/node_modules/pi-agent-web-image/package.json +4 -4
- package/node_modules/pi-agent-web-pdf/package.json +4 -4
- 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 +35 -35
- package/src/api/plugin-protocol.ts +2 -0
- package/src/api/text-editor.ts +7 -0
- package/src/api/tool-config/formatters.json +70 -12
- package/src/api/tool-config/linters.json +148 -66
- package/src/api/tool-config/lsp-servers.json +142 -7
- package/src/api/tool-config.ts +60 -24
- package/src/code-view/diagnostic-view.ts +14 -10
- package/src/composite/builtin-extensions.ts +148 -66
- package/src/composite/extensions-config.ts +18 -0
- package/src/core/diagnostic-entry.ts +94 -0
- package/src/core/diagnostic-store.ts +43 -21
- package/src/core/extension.ts +39 -17
- package/src/doctor/config-writer.ts +14 -1
- package/src/doctor/discovery.ts +13 -68
- package/src/doctor/run.ts +33 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
- 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-pdf/package.json +4 -4
- 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 +1 -6
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
- 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-pdf/package.json +4 -4
- 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/package.json +11 -11
- package/src/extensions/pi-agent-read/runtime/entry-39.js +0 -1
- package/src/extensions/pi-agent-read/runtime/entry-40.js +2 -0
- package/src/extensions/pi-agent-read/src/api/rendering.ts +3 -0
- package/src/extensions/pi-agent-read/src/core/read-core.ts +6 -26
- package/src/extensions/pi-agent-read/src/core/tools/read/native-resource-renderer.ts +74 -0
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +28 -7
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +35 -30
- package/src/extensions/pi-agent-search/package.json +7 -7
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +42 -33
- 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 +1 -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/file-search.ts +9 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -0
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +48 -0
- package/src/extensions/pi-agent-search/runtime/entry-44.js +0 -1
- package/src/extensions/pi-agent-search/runtime/entry-45.js +2 -0
- package/src/extensions/pi-agent-search/src/core/extension.ts +7 -5
- package/src/extensions/pi-agent-search/src/core/search-core.ts +10 -0
- package/src/extensions/pi-agent-text-editor/package.json +22 -22
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -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-exact/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
- 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-line-hash/index.ts +2 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
- 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-editor-argument-order/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-overwrite/package.json +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +7 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +11 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +140 -52
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +52 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +53 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +8 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +10 -0
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +5 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- 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-68.js +0 -1
- package/src/extensions/pi-agent-text-editor/runtime/entry-69.js +2 -0
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -0
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +71 -1
- package/src/extensions/pi-agent-text-editor/src/core/builtin-edit-filter.ts +4 -12
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +7 -9
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +27 -2
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +38 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -0
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +81 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +5 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +23 -0
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +5 -9
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +54 -14
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +45 -43
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +7 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +13 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +18 -8
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +2 -1
- package/src/pi-agent-ide.ts +11 -0
- package/src/plugins/pi-agent-ide-ast/package.json +11 -11
- package/src/plugins/pi-agent-ide-ast/runtime/entry-25.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +2 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +3 -0
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +92 -19
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +9 -14
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +60 -0
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +1 -5
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/runtime/entry-27.js +0 -1
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +1 -7
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +1 -5
- package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +1 -8
- package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
- package/src/plugins/pi-agent-ide-formatter/src/catalog.ts +131 -13
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +12 -7
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +20 -8
- package/src/plugins/pi-agent-ide-languages/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/src/languages.ts +15 -0
- package/src/plugins/pi-agent-ide-lint/index.ts +4 -1
- package/src/plugins/pi-agent-ide-lint/package.json +8 -8
- package/src/plugins/pi-agent-ide-lint/src/catalog.ts +196 -39
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +23 -3
- package/src/plugins/pi-agent-ide-lint/src/diagnostics.ts +73 -33
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +20 -8
- package/src/plugins/pi-agent-ide-lsp/index.ts +1 -12
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- 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/diagnostic-source.ts +10 -10
- package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +2 -4
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +162 -12
- 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/manager.ts +8 -4
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +69 -34
- 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 +5 -0
- package/src/post-edit/gate.ts +44 -15
- package/src/toolchain/types.ts +4 -0
- package/dist/chunk-34ZQTTU2.js +0 -2
- package/dist/chunk-476MR2QB.js +0 -1
- package/dist/chunk-4KQOODGE.js +0 -13
- package/dist/chunk-4SQQKEVD.js +0 -16
- package/dist/chunk-52BM6J6I.js +0 -6
- package/dist/chunk-5BWUVAR4.js +0 -1
- package/dist/chunk-6DN7NO7L.js +0 -1
- package/dist/chunk-6SMFVLTY.js +0 -1
- package/dist/chunk-7NDBZ4WX.js +0 -1
- package/dist/chunk-AP7Z3VWC.js +0 -1
- package/dist/chunk-BYWAG6X3.js +0 -6
- package/dist/chunk-E4SECPF4.js +0 -1
- package/dist/chunk-EW2KVKCN.js +0 -2
- package/dist/chunk-F6SESI3P.js +0 -4
- package/dist/chunk-GTK5AREE.js +0 -2
- package/dist/chunk-HOBTFFQR.js +0 -1
- package/dist/chunk-IMVCVPMP.js +0 -3
- package/dist/chunk-IOCABSRL.js +0 -1
- package/dist/chunk-KP37XTDI.js +0 -1
- package/dist/chunk-KYVOMBO5.js +0 -1
- package/dist/chunk-LFV6G5Z3.js +0 -1
- package/dist/chunk-MB6VVVAF.js +0 -2
- package/dist/chunk-NI2NK4JU.js +0 -1
- package/dist/chunk-OIL6BB2S.js +0 -33
- package/dist/chunk-PODWLGNO.js +0 -6
- package/dist/chunk-QW5O42QJ.js +0 -2
- package/dist/chunk-SSZB66C3.js +0 -3
- package/dist/chunk-TG6H6EOI.js +0 -1
- package/dist/chunk-TNWYEXFG.js +0 -1
- package/dist/chunk-U4D6FT66.js +0 -1
- package/dist/chunk-VUNCBASK.js +0 -10
- package/dist/chunk-VWVLBOMU.js +0 -8
- package/dist/chunk-W3XYKJ5H.js +0 -1
- package/dist/chunk-XGUAL3CA.js +0 -1
- package/dist/chunk-YQTLJ5ZV.js +0 -58
- package/node_modules/pi-agent-filesystem/runtime/entry-20.js +0 -2
- package/node_modules/pi-agent-ide-ast/runtime/entry-24.js +0 -1
- package/node_modules/pi-agent-ide-changes/runtime/entry-26.js +0 -1
- package/node_modules/pi-agent-image/runtime/entry-32.js +0 -1
- package/node_modules/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/node_modules/pi-agent-resource/runtime/entry-40.js +0 -1
- package/node_modules/pi-agent-text-anchor-constant/runtime/entry-48.js +0 -2
- package/node_modules/pi-agent-text-anchor-exact/runtime/entry-49.js +0 -1
- package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-51.js +0 -1
- package/node_modules/pi-agent-text-editor/runtime/entry-53.js +0 -1
- package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +0 -1
- package/node_modules/pi-agent-web/runtime/entry-75.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-21.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-20.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +0 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +0 -2
- package/src/extensions/pi-agent-read/runtime/entry-35.js +0 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/views.ts +0 -29
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-45.js +0 -2
- package/src/extensions/pi-agent-search/runtime/entry-41.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-48.js +0 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-49.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-51.js +0 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-argument-order/runtime/entry-69.js +0 -2
- package/src/extensions/pi-agent-text-editor/runtime/entry-53.js +0 -1
- package/src/plugins/pi-agent-ide-ast/runtime/entry-24.js +0 -1
- package/src/plugins/pi-agent-ide-changes/runtime/entry-26.js +0 -1
- /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-21.js +0 -0
- /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-22.js +0 -0
- /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-23.js +0 -0
- /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-28.js +0 -0
- /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-29.js +0 -0
- /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-30.js +0 -0
- /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-31.js +0 -0
- /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-33.js +0 -0
- /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-34.js +0 -0
- /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-35.js +0 -0
- /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-41.js +0 -0
- /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-45.js +0 -0
- /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-47.js +0 -0
- /package/node_modules/{pi-agent-text-editor-argument-order → pi-agent-text-editor}/runtime/entry-69.js +0 -0
- /package/node_modules/{pi-agent-text-editor-overwrite → pi-agent-text-editor-argument-order}/runtime/entry-70.js +0 -0
- /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor-overwrite}/runtime/entry-71.js +0 -0
- /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
- /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-74.js +0 -0
- /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-76.js +0 -0
- /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
- /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
- /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-22.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-23.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
- /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-overwrite → pi-agent-text-editor-argument-order}/runtime/entry-70.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-renderer → pi-agent-text-editor-overwrite}/runtime/entry-71.js +0 -0
- /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
- /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-28.js +0 -0
- /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-29.js +0 -0
- /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-30.js +0 -0
- /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-31.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as c}from"./chunk-
|
|
1
|
+
import{d as c}from"./chunk-S3ZPXWX7.js";import{e as a}from"./chunk-RAZOACDD.js";import{a as r}from"./chunk-EI7MMDWY.js";import{Type as e}from"typebox";import{Value as i}from"typebox/value";var n="pi-agent-text-editor",p=17,P="pi-agent-text-editor/position",I="pi-agent-text-editor/search",b=`${n}/core/ready`,S=`${n}/plugin/register`,s=e.Function([],e.Unknown()),d=e.Object({tryResolve:s},{additionalProperties:!0}),l=e.Object({lineNumber:e.Integer({minimum:1}),column:e.Integer({minimum:0})}),T=e.Object({start:l,end:l,linewise:e.Optional(e.Boolean())}),R=e.Object({source:e.String({minLength:1}),ranges:e.Optional(e.Array(T))}),x=e.Union([e.Object({kind:e.Literal("not-handled")},{additionalProperties:!0}),e.Object({kind:e.Literal("resolved"),targets:e.Array(R,{minItems:1})},{additionalProperties:!0}),e.Object({kind:e.Literal("rejected"),rejection:e.Object({code:e.Union([e.Literal("invalid"),e.Literal("stale"),e.Literal("missing"),e.Literal("ambiguous")]),reason:e.String(),contextRange:e.Optional(e.Object({offset:e.Number(),limit:e.Number()}))})},{additionalProperties:!0}),e.Object({kind:e.Literal("failed"),error:e.Unknown()},{additionalProperties:!0})]),g=e.String({pattern:"\\S"}),m=e.Object({resolver:e.Unknown(),priority:e.Optional(e.Number())}),y=e.Object({resolver:e.Unknown(),resources:e.Optional(e.Unknown()),kind:e.String({pattern:"\\S"}),type:e.Union([e.Literal("major"),e.Literal("auxiliary"),e.Literal("constant")]),priority:e.Optional(e.Number())}),v=e.Object({protocol:e.Literal(n),apiVersion:e.Literal(p)}),u=e.Object({protocol:e.Literal(n),apiVersion:e.Literal(p),id:e.String(),setup:s}),E=e.Object({plugin:u,accept:s});function k(t){return i.Check(g,t)}r(k,"isTextEditorToolId");function _(t){if(!i.Check(m,t))return!1;let o=t;return c(o.resolver)&&(!("priority"in o)||typeof o.priority=="number")}r(_,"isResourceResolverRegistration");function j(t){if(!i.Check(y,t))return!1;let o=t;return a(o.resolver)&&(!("resources"in o)||i.Check(d,o.resources))&&(!("priority"in o)||typeof o.priority=="number")}r(j,"isTextAnchorResolverRegistration");function C(t){return i.Check(x,t)}r(C,"isTextAnchorResourceResolutionAttempt");function L(t){return i.Check(v,t)}r(L,"isTextEditorCoreReady");function w(t){return i.Check(u,t)}r(w,"isTextEditorPlugin");function N(t){return i.Check(E,t)}r(N,"isTextEditorPluginRegistrationRequest");export{n as a,p as b,P as c,I as d,b as e,S as f,k as g,_ as h,j as i,C as j,L as k,w as l,N as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as u,f as E,k as a}from"./chunk-
|
|
1
|
+
import{e as u,f as E,k as a}from"./chunk-THSCUT2L.js";import{a as n}from"./chunk-EI7MMDWY.js";function T(o,r){let s=n(()=>{let e,i={plugin:r,accept(c){if(e!==void 0)throw new Error(`Plugin ${r.id} registration was accepted more than once`);e=c}};return o.events.emit(E,i),e},"announce"),t=n(()=>{},"unsubscribe");t=o.events.on(u,e=>{if(!a(e))throw new Error("Invalid pi-agent-text-editor core readiness event");let i=s();if(i===void 0)throw new Error("pi-agent-text-editor core announced readiness without accepting the plugin");t(),i.catch(()=>{})}),o.on("session_shutdown",t);let d=s();if(d!==void 0)return t(),d}n(T,"connectTextEditorPlugin");export{T as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s}from"./chunk-EI7MMDWY.js";import{access as R,readFile as b,readdir as P}from"node:fs/promises";import u from"node:path";async function D(e,t){let o=new Map,c=s(i=>{let n=o.get(i);return n===void 0&&(n=b(u.join(e,i),"utf8").catch(()=>{}),o.set(i,n)),n},"content"),w=y(await c("package.json")),l=new Set;for(let i of["dependencies","devDependencies","peerDependencies","optionalDependencies"]){let n=w?.[i];if(p(n))for(let d of Object.keys(n))l.add(d)}let k=await Promise.all(t.map(async i=>{let n;for(let r of i.configFiles??[])if(await v(e,r)){n=r;break}if(n===void 0)for(let[r,h]of Object.entries(i.configSections??{})){let a=await c(r);if(a===void 0)continue;let g=r.endsWith(".json")?y(a):void 0;if(h.some(f=>g===void 0?a.split(/\r?\n/).some(j=>{let m=/^\s*\[([^\]]+)\]/.exec(j)?.[1]?.trim();return m===f||m?.startsWith(`${f}.`)===!0}):x(g,f)!==void 0)){n=r;break}}let d=i.dependencies?.find(r=>l.has(r));return[i.id,{score:(n===void 0?0:6)+(d===void 0?0:4),...n!==void 0&&{config:n},...d!==void 0&&{dependency:d}}]}));return new Map(k)}s(D,"inspectRecipeEvidence");async function v(e,t){if(!t.includes("*"))try{return await R(u.join(e,t)),!0}catch{return!1}try{return(await P(e)).some(c=>u.matchesGlob(c,t))}catch{return!1}}s(v,"hasProjectMarker");function p(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(p,"isRecord");function y(e){try{let t=JSON.parse(e??"");return p(t)?t:void 0}catch{return}}s(y,"parseJson");function x(e,t){let o=e;for(let c of t.split("."))o=p(o)?o[c]:void 0;return o}s(x,"jsonSection");export{D as a,v as b};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as V}from"./chunk-
|
|
2
|
-
`),sourceLines:S}}a(j,"createDiagnosticViewContent");function O(e,n){let t=b(n,e.lines.length),o=e.lines.map(r=>{let i=t.get(r.lineNumber);if(i===void 0)return r;let s=i.map(({diagnostic:c,source:d})=>`<!-- ${d}: ${m(c,d)} -->`).join(" ");return{...r,presentation:{...r.presentation,suffix:`${r.presentation?.suffix??""} ${s}`}}});return{...e,lines:o}}a(O,"addDiagnosticAnnotations");function w(e){return e.filter(n=>n.status&&n.status!=="ready").map(n=>`${n.source}: ${n.status}${n.reason?` (${n.reason})`:""}.`).join(" ")}a(w,"diagnosticStatus");function b(e,n){let
|
|
3
|
-
`),sourceLines:n}}a(L,"sourceMappedContent");function A(e){if(typeof e!="object"||e===null||!("sourceLines"in e))return;let n=e.sourceLines;if(!(typeof n!="object"||n===null)){for(let t of Object.values(n))if(!I(t))return;return n}}a(A,"sourceLineMap");function I(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.source=="string"&&n.source.length>0&&Number.isInteger(n.lineNumber)&&(n.lineNumber??0)>0&&typeof n.content=="string"}a(I,"isTextSourceLine");export{T as a,
|
|
1
|
+
import{j as V}from"./chunk-RAZOACDD.js";import{a as m}from"./chunk-KINKBPPX.js";import{a as y}from"./chunk-ZC65Z3CK.js";import{a}from"./chunk-EI7MMDWY.js";import x from"node:path";import{fileURLToPath as R}from"node:url";function T(e,n){let t=`${n}:`;if(!e.startsWith(t))return;let o=e.slice(t.length),r=o.indexOf("#"),i=r===-1?o:o.slice(0,r);if(i.length===0)throw new TypeError(`${n}: requires a file path.`);let s=$(i,`${n}: path`),c=r===-1?void 0:o.slice(r+1);if(n==="ast"){if(c!==void 0)throw new TypeError("ast: accepts only a file path and does not accept a symbol selector.");return{scheme:n,path:s}}if(n==="symbol"&&c===void 0)throw new TypeError("symbol: requires #<symbol-selector> after the file path.");if(c===void 0)return{scheme:n,path:s};if(c.length===0)throw new TypeError(`${n}: symbol selector must not be empty.`);let d=c.split("/").map(f=>{if(f.length===0)throw new TypeError(`${n}: symbol selector contains an empty segment.`);return $(f,`${n}: symbol selector`)});return{scheme:n,path:s,selector:d}}a(T,"parseCodeViewReference");function D(e,n){return e.startsWith("file://")?R(new URL(e)):x.isAbsolute(e)?x.normalize(e):x.resolve(n,e)}a(D,"resolveCodeViewPath");function C(e,n,t){let o=n.replaceAll("%","%25").replaceAll("#","%23"),r=t===void 0?"":`#${t.map(i=>encodeURIComponent(i)).join("/")}`;return`${e}:${o}${r}`}a(C,"formatCodeViewReference");function k(e){return e.map(n=>encodeURIComponent(n)).join("/")}a(k,"formatSymbolSelector");function $(e,n){try{return decodeURIComponent(e)}catch(t){throw new TypeError(`${n} contains invalid percent encoding.`,{cause:t})}}a($,"decodePart");import v from"node:path";function N(e,n,t){let o=`${n}:`;if(!e.startsWith(o))return;let r=e.slice(o.length);if(r.length===0)throw new Error(`${n}: requires a file path.`);return v.resolve(t,r)}a(N,"resolveDiagnosticViewPath");function M(e,n){return`${e}:${n}`}a(M,"formatDiagnosticViewSource");function j(e,n,t,o={}){let r=n.split(/\r\n|\r|\n/u),i=b(t,r.length);if(i.size===0)return{type:"text",text:w(t)||"No diagnostics.",sourceLines:{}};let s=o.contextLines??5;if(!Number.isInteger(s)||s<0)throw new TypeError("Diagnostic contextLines must be a non-negative integer.");let c=new Set;for(let l of i.keys()){let u=Math.max(1,l-s),p=Math.min(r.length,l+s);for(let g=u;g<=p;g+=1)c.add(g)}let d=w(t),f=d?[d]:[],S={};for(let l of[...c].sort((u,p)=>u-p)){let u=r[l-1]??"",p=(i.get(l)??[]).map(({diagnostic:g,source:h})=>`<!-- ${h}: ${m(g,h)} -->`).join(" ");f.push(p.length===0?u:`${u} ${p}`),S[String(f.length)]={source:e,lineNumber:l,content:u}}return{type:"text",text:f.join(`
|
|
2
|
+
`),sourceLines:S}}a(j,"createDiagnosticViewContent");function O(e,n){let t=b(n,e.lines.length,/[\r\n]$/u.test(e.content)),o=e.lines.map(r=>{let i=t.get(r.lineNumber);if(i===void 0)return r;let s=i.map(({diagnostic:c,source:d})=>`<!-- ${d}: ${m(c,d)}${c.line===r.lineNumber?"":` @${c.line}:${c.column}`} -->`).join(" ");return{...r,presentation:{...r.presentation,suffix:`${r.presentation?.suffix??""} ${s}`}}});return{...e,lines:o}}a(O,"addDiagnosticAnnotations");function w(e){return e.filter(n=>n.status&&n.status!=="ready").map(n=>`${n.source}: ${n.status}${n.reason?` (${n.reason})`:""}.`).join(" ")}a(w,"diagnosticStatus");function b(e,n,t=!1){let o=new Map;for(let{diagnostics:r,source:i}of e)for(let s of r){let c=t&&s.line===n+1?n:s.line;if(!Number.isInteger(s.line)||c<1||c>n)continue;let d=o.get(c)??[];d.push({diagnostic:s,source:i}),o.set(c,d)}return o}a(b,"diagnosticsByValidLine");function B(e){return{text:`${e.content}${e.suffix??""}`,...e.sourceLine!==void 0&&{sourceLine:e.sourceLine}}}a(B,"renderSourceViewLine");function E(e,n){if(e.length===0)return L([{text:"<empty-result>"}]);if(e.length===1&&y(e[0]).status==="failed"&&y(e[0]).path===""){let o=y(e[0]),r=n.recovery===void 0?[]:["","Recovery:",...n.recovery],i=n.includeNoChange===!0?["","No file was changed."]:[];return L([o.code??n.failureLabel,"",`Reason: ${o.error??n.unknownFailure??"unknown failure"}`,...i,...r].map(s=>({text:s})))}let t=[];for(let[o,r]of e.entries())o>0&&t.push({text:""},{text:""}),t.push(...P(r,n));return L(t)}a(E,"formatSourceViewResults");function F(){return e=>{let n=e.state;if(n?.contentKind!=="text")return{kind:"continue",context:e};let t=A(n.content[0]);if(t===void 0)return{kind:"continue",context:e};let o=n.text.lines.map(r=>{let i=t[String(r.lineNumber)];return i===void 0?r:V(r,i)});return{kind:"continue",context:{...e,state:{...n,text:{...n.text,lines:o}}}}}}a(F,"createSourceMappedTextReadHandler");function P(e,n){if(e.status==="failed")return[...e.heading===void 0?[`## file: ${e.path||"<unknown>"}`]:[`## ${e.heading}`,...e.details??[]],`${n.failureLabel} | ${e.error??n.unknownFailure??"unknown failure"}`].map(s=>({text:s}));let t=e.heading===void 0?[`## file: ${e.path}`]:[`## ${e.heading}`,...e.details??[]],o=e.continuation??"",r=e.warning===void 0?[]:[{text:""},{text:e.warning}];return[...t.map(i=>({text:i})),{text:`Lines: ${e.startLine}-${e.endLine} of ${e.totalLines}${o}`},{text:""},...e.renderedLines,...r]}a(P,"formatSourceViewBlock");function L(e){let n={};for(let[t,o]of e.entries())o.sourceLine!==void 0&&(n[String(t+1)]=o.sourceLine);return{type:"text",text:e.map(t=>t.text).join(`
|
|
3
|
+
`),sourceLines:n}}a(L,"sourceMappedContent");function A(e){if(typeof e!="object"||e===null||!("sourceLines"in e))return;let n=e.sourceLines;if(!(typeof n!="object"||n===null)){for(let t of Object.values(n))if(!I(t))return;return n}}a(A,"sourceLineMap");function I(e){if(typeof e!="object"||e===null)return!1;let n=e;return typeof n.source=="string"&&n.source.length>0&&Number.isInteger(n.lineNumber)&&(n.lineNumber??0)>0&&typeof n.content=="string"}a(I,"isTextSourceLine");export{T as a,D as b,C as c,k as d,N as e,M as f,j as g,O as h,w as i,B as j,E as k,F as l};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as w}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-RAZOACDD.js";import{a as u}from"./chunk-EI7MMDWY.js";import{createHash as T}from"node:crypto";import{createRequire as P}from"node:module";import L from"node:path";import*as h from"web-tree-sitter";var F=P(new URL("../src/plugins/pi-agent-ide-ast/src/ast/manager.ts",import.meta.url).href),j=new Set(["program","module"]),y=new Set(["body","consequence","alternative","handler","finalizer"]),S,x=new Map;function E(c){switch(c){case".ts":case".tsx":return"tree-sitter-typescript/tree-sitter-typescript.wasm";case".js":case".jsx":case".mjs":case".cjs":return"tree-sitter-javascript/tree-sitter-javascript.wasm";case".py":return"tree-sitter-python/tree-sitter-python.wasm";case".rs":return"tree-sitter-rust/tree-sitter-rust.wasm";case".c":case".cc":case".hh":case".hxx":case".cpp":case".cxx":case".h":case".hpp":return"tree-sitter-cpp/tree-sitter-cpp.wasm";case".json":case".jsonc":return"tree-sitter-json/tree-sitter-json.wasm";case".yaml":case".yml":return"@tree-sitter-grammars/tree-sitter-yaml/tree-sitter-yaml.wasm";case".toml":return"@tree-sitter-grammars/tree-sitter-toml/tree-sitter-toml.wasm";default:return}}u(E,"grammarWasmPath");async function B(c){let n=E(c);if(!n)return;S??=h.Parser.init(),await S;let t=x.get(n);if(t===void 0){let o=F.resolve(n);t=h.Language.load(o),x.set(n,t)}let s=await t,i=new h.Parser;return i.setLanguage(s),i}u(B,"ensureParser");async function W(c,n,t){if(t.length===0)return;let s=L.isAbsolute(c)?c:L.resolve(n,c),i=await B(L.extname(s).toLowerCase());if(i)return i.parse(t.join(`
|
|
2
2
|
`))??void 0}u(W,"parseDocument");function A(c,n,t){let s=c.slice(Math.max(0,n-1),Math.max(0,t)).join(`
|
|
3
3
|
`);return T("sha1").update(s).digest("hex").slice(0,4).toUpperCase()}u(A,"hashScope");var b=class extends w{static{u(this,"AstScopeTextAnchor")}constructor(n,t,s,i){super(`scope-${n}-${t}${i===void 0?"":`-${i}`}`,s)}};function g(c,n,t,s){return new b(c,n,t,s)}u(g,"createScopeAnchor");var C=class{static{u(this,"AstScopeManager")}async getDocumentScopes(n,t,s){if(s.length===0)return[];let i=await W(n,t,s);if(!i)return[];let o=[];return this.collectCandidates(i.rootNode,o),this.buildEntries(o,s)}collectCandidates(n,t,s=0,i=!1){if(s>100||!n.isNamed)return;let o=n.type;if(!o||j.has(o)){for(let a of n.namedChildren)this.collectCandidates(a,t,s+1);return}for(let a of y){let e=n.childForFieldName(a);if(!e?.isNamed)continue;let r=e.startPosition.row+1,l=e.endPosition.row+1,f=l-r>=3,d=[...y].some(m=>e.childForFieldName(m)!==null);f&&!d&&t.push({startLine:r,endLine:l,kind:`${o}.${a}`,fromBodyField:!0}),this.collectCandidates(e,t,s+1,!0)}if(![...y].some(a=>n.childForFieldName(a)!==null)&&!i){let a=n.startPosition.row+1,e=n.endPosition.row+1;e-a>=3&&n.namedChildren.length>0&&t.push({startLine:a,endLine:e,kind:o,fromBodyField:!1})}for(let a of n.namedChildren)this.collectCandidates(a,t,s+1)}buildEntries(n,t){let s=new Map;for(let e of n){let r=s.get(e.startLine);(!r||e.endLine>r.endLine||e.endLine===r.endLine&&e.fromBodyField&&!r.fromBodyField)&&s.set(e.startLine,e)}let i=[...s.values()].sort((e,r)=>e.startLine-r.startLine||r.endLine-e.endLine),o=[];for(let e of i)o.some(l=>l.startLine<e.startLine&&l.endLine===e.endLine)||o.push(e);let p=new Map;for(let e of o){let r=A(t,e.startLine,e.endLine);p.set(r,(p.get(r)??0)+1)}let a=new Map;return o.map(e=>{let r=A(t,e.startLine,e.endLine),l=p.get(r)??1,f=(a.get(r)??0)+1;a.set(r,f);let d=l>1?f:void 0;return{name:e.kind,kind:e.kind,startLine:e.startLine,endLine:e.endLine,depth:o.filter(m=>m!==e&&m.startLine<=e.startLine&&m.endLine>=e.endLine&&(m.startLine<e.startLine||m.endLine>e.endLine)).length,hash:r,blockHash:r,...d!==void 0&&{occurrence:d},beginAnchor:g("begin",r,e.startLine,d),endScopeAnchor:g("end",r,e.endLine,d),scopeBeginAnchor:g("begin",r,e.startLine,d),scopeEndAnchor:g("end",r,e.endLine,d)}})}};export{W as a,C as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as y}from"./chunk-
|
|
1
|
+
import{a as y}from"./chunk-LQYZG62K.js";import{a as s}from"./chunk-EI7MMDWY.js";import{Worker as v}from"node:worker_threads";var p=String.raw`
|
|
2
2
|
const { parentPort, workerData } = require("node:worker_threads");
|
|
3
3
|
let fuzzy;
|
|
4
4
|
let prepared;
|
package/dist/entry-0.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-X6MPU7UO.js";import"./chunk-RAZOACDD.js";import"./chunk-KINKBPPX.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{h as addDiagnosticAnnotations,g as createDiagnosticViewContent,l as createSourceMappedTextReadHandler,i as diagnosticStatus,c as formatCodeViewReference,f as formatDiagnosticViewSource,k as formatSourceViewResults,d as formatSymbolSelector,a as parseCodeViewReference,j as renderSourceViewLine,b as resolveCodeViewPath,e as resolveDiagnosticViewPath};
|
package/dist/entry-10.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as g,e as h,f as i}from"./chunk-
|
|
1
|
+
import{a as b,b as c,c as d,d as g,e as h,f as i}from"./chunk-4U6KGABH.js";import"./chunk-NNCZYO4Q.js";import{c as a}from"./chunk-KCEOTU5Z.js";import"./chunk-YHUTTZC6.js";import{a as x}from"./chunk-ORAPGW7W.js";import{a as o,b as r,c as e,d as f,e as m,f as p,g as t}from"./chunk-JASLOB2X.js";import"./chunk-S3ZPXWX7.js";import"./chunk-RAZOACDD.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{r as READ_API_VERSION,e as READ_CORE_READY_EVENT,f as READ_PLUGIN_REGISTER_EVENT,o as READ_PROTOCOL,x as connectReadPlugin,a as createReadResultRenderer,h as isFragmentResolverRegistration,m as isReadCoreReady,i as isReadFragmentResolution,d as isReadHandlerRegistration,p as isReadPlugin,t as isReadPluginRegistrationRequest,g as isReadViewRegistration,c as isResourceResolverRegistration,b as isTextTargetResolverRegistration};
|
package/dist/entry-11.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,u as s,v as u}from"./chunk-
|
|
1
|
+
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,u as s,v as u}from"./chunk-S3ZPXWX7.js";import"./chunk-EI7MMDWY.js";export{j as CONTENT_API_VERSION,l as CONTENT_CONVERTER_REGISTER_EVENT,k as CONTENT_HOST_READY_EVENT,i as CONTENT_PROTOCOL,d as UnsupportedContentError,u as connectContentConverter,s as createContentHost,g as createContentRunner,r as isAgentContent,b as isContentConversionAttempt,x as isContentConversionContext,a as isContentConverter,c as isContentConverterRegistration,q as isContentConverterRegistrationRequest,n as isContentHostReady,t as isContentInput,p as isContentTarget,e as isResource,m as isResourceResolutionAttempt,f as isResourceResolver,o as renderContentDescription,h as targetsEqual};
|
package/dist/entry-13.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,u as s}from"./chunk-
|
|
1
|
+
import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c,l as d,m as g,n as h,o as i,p as j,q as k,r as l,s as n,t as q,u as s}from"./chunk-RAZOACDD.js";import"./chunk-EI7MMDWY.js";export{o as TextAnchor,r as attachTextAnchorRenderer,j as createTextContentConverter,g as createTextDocument,e as getTextAnchorRenderer,a as getTextSourceLine,t as isTextAnchorRecoveryOutcome,p as isTextAnchorResolutionAttempt,m as isTextAnchorResolver,c as isTextLinePresenter,d as isTextPresenterRegistration,n as isTextTargetResolutionAttempt,k as isTextualMediaType,i as renderPresentedTextDocument,x as renderPresentedTextRows,f as renderTextAnchor,h as renderTextDocument,s as restoreText,q as storeText,l as textFromAgentContent,b as withTextSourceLine};
|
package/dist/entry-14.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{g as t}from"./chunk-RIGRP3FD.js";import{a as E}from"./chunk-WNMGUALD.js";import{a as o,b as e,c as r,d as i,e as n,f as a,g as p,h as x,i as s,j as d,k as f,l as u,m}from"./chunk-THSCUT2L.js";import"./chunk-S3ZPXWX7.js";import"./chunk-RAZOACDD.js";import"./chunk-EI7MMDWY.js";export{e as TEXT_EDITOR_API_VERSION,n as TEXT_EDITOR_CORE_READY_EVENT,a as TEXT_EDITOR_PLUGIN_REGISTER_EVENT,o as TEXT_EDITOR_PROTOCOL,r as TEXT_POSITION_ANCHOR_KIND,i as TEXT_SEARCH_ANCHOR_KIND,E as connectTextEditorPlugin,t as connectTextEditorPostEditHandler,x as isResourceResolverRegistration,s as isTextAnchorResolverRegistration,d as isTextAnchorResourceResolutionAttempt,f as isTextEditorCoreReady,u as isTextEditorPlugin,m as isTextEditorPluginRegistrationRequest,p as isTextEditorToolId};
|
package/dist/entry-18.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-WZI4YC2O.js";import"./chunk-EI7MMDWY.js";export{b as hasProjectMarker,a as inspectRecipeEvidence};
|
package/dist/entry-19.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-N34ATN52.js";import"./chunk-EI7MMDWY.js";export{d as isExecutableAvailable,b as normalizeProcessEnvironment,e as probeExecutable,a as projectExecutableDirectories,c as projectProcessEnvironment};
|
package/dist/entry-20.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunk-VFBLX4TG.js";import"./chunk-EI7MMDWY.js";export{b as DOCTOR_API_VERSION,c as DOCTOR_CORE_READY_EVENT,d as DOCTOR_PLUGIN_REGISTER_EVENT,a as DOCTOR_PROTOCOL,e as isDoctorCoreReady,f as isDoctorPluginRegistrationRequest};
|
package/dist/entry-21.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import"./chunk-NNCZYO4Q.js";import{c as v}from"./chunk-KCEOTU5Z.js";import"./chunk-YHUTTZC6.js";import{a as R}from"./chunk-ORAPGW7W.js";import{a as y,b as p}from"./chunk-JASLOB2X.js";import{a as w}from"./chunk-WNMGUALD.js";import{a as h,b as F}from"./chunk-THSCUT2L.js";import{a as g,u as m}from"./chunk-S3ZPXWX7.js";import{r as f}from"./chunk-RAZOACDD.js";import"./chunk-ZC65Z3CK.js";import{a as o}from"./chunk-EI7MMDWY.js";import{readdirSync as x,realpathSync as H,statSync as S}from"node:fs";import{mkdir as k,readFile as D,writeFile as O}from"node:fs/promises";import b from"node:path";import{fileURLToPath as I,pathToFileURL as _}from"node:url";function T(e){return P("read",e)}o(T,"createFilesystemReadResolver");function C(e){return P("write",e)}o(C,"createFilesystemWriteResolver");function P(e,s){return{id:"filesystem",tryResolve(t,i){return Promise.resolve(L(t,i,e,s))}}}o(P,"createFilesystemResolver");function L(e,s,t,i){if(e.length===0)return{kind:"failed",error:new TypeError("Filesystem source must not be empty")};if(!W(e))return{kind:"not-handled"};if(s.signal?.aborted===!0)return{kind:"failed",error:E()};let r=e.startsWith("file://")?H(I(new URL(e))):b.resolve(s.cwd,e),l=_(r).href,c=(()=>{try{return S(r).isDirectory()}catch{return!1}})(),n=o(async({signal:d})=>c?U(r,d):V(r,i,d),"read");return t==="read"||c?{kind:"resolved",resource:{source:r,link:l,read:n}}:{kind:"resolved",resource:{source:r,link:l,read:n,async write(d,u){a(u.signal);let A=f(d);await k(b.dirname(r),{recursive:!0}),a(u.signal),await O(r,A,{encoding:"utf8",...u.signal!==void 0&&{signal:u.signal}})}}}}o(L,"resolveFilesystemSource");function U(e,s){a(s);let t=x(e,{withFileTypes:!0}),i=[`\u{1F4C1} ${e}/`];t.length>0&&i.push("");for(let r of t){let l=r.isDirectory()?"\u{1F4C1}":r.isFile()?"\u{1F4C4}":"\u{1F517}";i.push(` ${l} ${r.name}`)}return[{type:"text",text:i.join(`
|
|
2
|
+
`)}]}o(U,"readDirectoryContent");async function V(e,s,t){a(t);let i=await D(e,{encoding:null,...t!==void 0&&{signal:t}});return a(t),s.convert({source:e,bytes:i},t===void 0?{}:{signal:t})}o(V,"readFilesystemContent");function W(e){return/^[A-Za-z]:[\\/]/u.test(e)||e.startsWith("file://")?!0:!/^[A-Za-z][A-Za-z\d+.-]*:/u.test(e)}o(W,"isFilesystemSource");function a(e){if(e?.aborted===!0)throw E()}o(a,"throwIfAborted");function E(){let e=new Error("The operation was aborted");return e.name="AbortError",e}o(E,"abortError");var z={provider:"filesystem",capability:"read"},Z={provider:"filesystem",capability:"write"},$=v({kind:"source",nativeResources:!0});async function j(e){let s=m(e,z),t=m(e,Z),i=T(s),r=C(t),l={protocol:y,apiVersion:p,id:"filesystem",setup(n){n.addResolver({resolver:i,renderResult:$}),n.describe(()=>g("File path \u2014 file content; directory path \u2014 entry listing. Relative, absolute and file:// paths accepted.",s.listDescriptions())),n.addPromptGuideline("Use read with paths relative to the current working directory for project files. Use read with absolute paths for files elsewhere on the system.")}},c={protocol:h,apiVersion:F,id:"filesystem",setup(n){n.addResolver({resolver:r})}};await Promise.all([R(e,l),w(e,c)])}o(j,"registerFilesystemPlugin");export{j as default};
|
package/dist/entry-22.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-QIJMV2P2.js";import{v as e}from"./chunk-S3ZPXWX7.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"filesystem",capability:"read"},converter:r(),priority:100};async function i(o){await e(o,n)}t(i,"registerFilesystemImage");export{i as default};
|
package/dist/entry-23.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-BHSO2MDK.js";import{v as e}from"./chunk-S3ZPXWX7.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"filesystem",capability:"read"},converter:r(),priority:200};async function i(o){await e(o,n)}t(i,"registerFilesystemPdf");export{i as default};
|
package/dist/entry-24.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as t}from"./chunk-S3ZPXWX7.js";import{p as i}from"./chunk-RAZOACDD.js";import{a as r}from"./chunk-EI7MMDWY.js";var o=i(),n={target:{provider:"filesystem",capability:"read"},converter:o,priority:300},s={target:{provider:"filesystem",capability:"write"},converter:o,priority:300};async function a(e){await Promise.all([t(e,n),t(e,s)])}r(a,"registerFilesystemText");export{a as default};
|
package/dist/entry-25.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as e,b as o}from"./chunk-XF5PVZOS.js";import"./chunk-RAZOACDD.js";import"./chunk-EI7MMDWY.js";export{o as AstScopeManager,e as parseDocument};
|
package/dist/entry-26.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-
|
|
1
|
+
import{a as H,b as j}from"./chunk-XF5PVZOS.js";import{a as L}from"./chunk-ERVMDQGX.js";import{a as x,b as O}from"./chunk-VFBLX4TG.js";import"./chunk-NNCZYO4Q.js";import{c as k}from"./chunk-KCEOTU5Z.js";import"./chunk-YHUTTZC6.js";import{a as P}from"./chunk-ORAPGW7W.js";import{a as T,b as E}from"./chunk-JASLOB2X.js";import{a as C}from"./chunk-E2RESHYR.js";import{a as $,b as M}from"./chunk-T2RPMEM2.js";import{a as D}from"./chunk-WNMGUALD.js";import{a as I,b as N,c as _}from"./chunk-THSCUT2L.js";import"./chunk-S3ZPXWX7.js";import{a as A,b as R,c as S,l as b}from"./chunk-X6MPU7UO.js";import"./chunk-RAZOACDD.js";import"./chunk-KINKBPPX.js";import{i as w}from"./chunk-KVGQG43U.js";import{e as v}from"./chunk-N34ATN52.js";import"./chunk-ZC65Z3CK.js";import{a as c}from"./chunk-EI7MMDWY.js";import{readFile as Q}from"node:fs/promises";var h=new Set(["c","cpp","javascript","typescript","python","rust","json","yaml","toml"]),B={protocol:x,apiVersion:1,id:"ast",setup(t){t.addSetupCheck({id:"structural-search",async inspect(e){return[...e.detectedLanguageIds].some(r=>h.has(r))?await w({command:["ast-grep"]},e.cwd,e.env)?{}:{actions:[{id:"ast-grep-unavailable",message:"Structural search is unavailable because ast-grep was not found"}]}:{}}}),t.addCheck({id:"parsers",title:"AST",async run(e){let o=[];for(let r of e.detectedLanguageIds){if(!h.has(r))continue;let n=e.files.find(s=>U(s,r));if(n!==void 0)try{let s=await Q(n,"utf8"),a=await H(n,e.cwd,s.replaceAll(`\r
|
|
2
|
+
`,`
|
|
3
|
+
`).split(`
|
|
4
|
+
`));o.push(a===void 0?{status:"fail",message:`${r} parser did not return a tree`}:{status:"pass",message:`${r} parser loaded`,detail:n})}catch(s){o.push({status:"fail",message:`${r}: ${s instanceof Error?s.message:String(s)}`})}}return o.length>0?o:[{status:"skip",message:"No supported AST files found"}]}}),t.addCheck({id:"ast-grep",title:"Structural search",async run(e){if(![...e.detectedLanguageIds].some(r=>h.has(r)))return[{status:"skip",message:"No supported structural-search files found"}];let o=await v("ast-grep",["--version"],e.cwd,e.env);return[o.ok?{status:"pass",message:"ast-grep is available",detail:o.detail}:{status:"fail",message:"ast-grep is not available",detail:o.detail}]}})}};function U(t,e){let o=t.slice(t.lastIndexOf(".")).toLowerCase();return{c:[".c",".h"],cpp:[".cc",".cpp",".cxx",".hh",".hpp",".hxx"],javascript:[".js",".jsx",".mjs",".cjs"],typescript:[".ts",".tsx",".mts",".cts"],python:[".py",".pyi"],rust:[".rs"],json:[".json",".jsonc"],yaml:[".yaml",".yml"],toml:[".toml"]}[e]?.includes(o)??!1}c(U,"matchesLanguage");var ee,te;function V(t){return{id:"ast",tryResolve(e,o){return Promise.resolve(ne(e,o,t))}}}c(V,"createAstOutlineResolver");function ne(t,e,o){let r;try{r=A(t,"ast")}catch(a){return{kind:"failed",error:a}}if(r===void 0)return{kind:"not-handled"};let n;try{n=R(r.path,e.cwd)}catch(a){return{kind:"failed",error:a}}return{kind:"resolved",resource:{source:S("ast",n),async read({signal:a}){a?.throwIfAborted();let d=await(te??=import("./chunk-4ZTEPMJO.js")),i=await(o??(ee??=new d.AstOutlineManager)).readFileOutline(n,e.cwd);return a?.throwIfAborted(),[d.formatAstOutline(i)]}}}}c(ne,"resolveAstOutlineSource");import{truncateHead as y}from"@earendil-works/pi-coding-agent";function G(){return async t=>{let{state:e,result:o}=t,r=o?.content.length===1?o.content[0]:void 0;if(e?.contentKind!=="text"||e.resolvedBy!=="filesystem"||r?.type!=="text"||!y(r.text).truncated)return{kind:"continue",context:t};try{let{AstOutlineManager:n,isSupportedOutlinePath:s}=await import("./chunk-4ZTEPMJO.js");if(!s(e.source))return{kind:"continue",context:t};let a=c(i=>[`AST overview of ${i.path}, source lines 1-${i.totalLines}: the requested text exceeded the read buffer.`,"Source line numbers are on the left. Detail is reduced to fit the buffer; omitted bodies are not exact source text. Read a small source range when needed.",...i.renderedLines.map(u=>`${u.sourceLine?.lineNumber??"\u2026"} | ${u.text}`)].join(`
|
|
5
|
+
`),"format");t.resolverContext.signal?.throwIfAborted();let d=await new n(12).readDocumentOutline(e.source,t.resolverContext.cwd,e.text.lines.map(i=>i.content),i=>(t.resolverContext.signal?.throwIfAborted(),!y(a(i)).truncated)),l=a(d);return y(l).truncated?{kind:"continue",context:t}:{kind:"return",result:{content:[{type:"text",text:l}],details:{source:e.source,resolvedBy:"ast-overflow"}}}}catch{return t.resolverContext.signal?.throwIfAborted(),{kind:"continue",context:t}}}}c(G,"createAstOverflowHandler");var K="pi-agent-ast";function F(t){return{id:"ast-scopes",async present(e,o){if(o.resolvedBy!=="filesystem")return e;try{let r=await t.getDocumentScopes(e.source,o.cwd,e.lines.map(s=>s.content)),n=re(e.lines,r);return n===e.lines?e:{...e,lines:n}}catch{return e}}}}c(F,"createAstScopePresenter");function X(){return t=>{let e=t.state,o=t.result;if(e?.contentKind!=="text"||o===void 0)return{kind:"continue",context:t};let r=o.details.lines;if(r===void 0)return{kind:"continue",context:t};let n=new Map(e.text.lines.map(u=>[u.lineNumber,u])),s=new Set(r.map(u=>u.lineNumber)),a=new Map;for(let u of r){let p=n.get(u.lineNumber),f=z(p);for(let m of f?.boundaries??[]){if(s.has(m.endLine))continue;let g=n.get(m.endLine);g!==void 0&&a.set(m.endLine,g)}}if(a.size===0)return{kind:"continue",context:t};let d=[...a.values()].sort((u,p)=>u.lineNumber-p.lineNumber),l=[...r,...d],i=oe(o,l,r.at(-1));return{kind:"continue",context:{...t,result:i}}}}c(X,"createAstScopePostReadHandler");function re(t,e){if(e.length===0)return t;let o=new Map,r=new Map;for(let n of e){let s=o.get(n.startLine)??[];s.push(n.beginAnchor.value),o.set(n.startLine,s);let a=r.get(n.startLine)??[];a.push({endLine:n.endLine}),r.set(n.startLine,a);let d=o.get(n.endLine)??[];d.push(n.endScopeAnchor.value),o.set(n.endLine,d)}return t.map(n=>{let s=o.get(n.lineNumber),a=r.get(n.lineNumber);return s===void 0&&a===void 0?n:{...n,...s!==void 0&&{presentation:{...n.presentation,suffix:`${n.presentation?.suffix??""}${s.map(d=>` <!-- ${d} -->`).join("")}`}},metadata:{...n.metadata,[K]:{...z(n),...a!==void 0&&{boundaries:a}}}}})}c(re,"addScopeMarkers");function z(t){let e=t?.metadata?.[K];if(!(typeof e!="object"||e===null))return e}c(z,"getAstScopeMetadata");function oe(t,e,o){let r=t.content.length===1?t.content[0]:void 0;if(r?.type!=="text"||t.details.lines===void 0)return t;let n=e.slice(t.details.lines.length);if(n.length===0)return t;let s=o?.lineEnding!==void 0&&o.lineEnding.length>0?o.lineEnding:n[0]?.lineEnding!==void 0&&n[0].lineEnding.length>0?n[0].lineEnding:`
|
|
6
|
+
`,a=n.map((i,u)=>{let f=u===n.length-1?i.lineEnding:i.lineEnding||s,m=i.presentation?.prefix??"",g=i.presentation?.suffix??"";return`${m}${i.content}${g}${f}`}).join(""),d=/(?:\r\n|\r|\n)$/.test(r.text)?"":s,l=`${r.text}${d}${a}`;return{...t,content:[{...r,text:l}],details:{...t.details,lines:e}}}c(oe,"appendTextLines");var J=/^scope-(begin|end)-[A-Z0-9]{3,4}(?:-[1-9]\d*)?$/;function W(t){return{id:"ast-scope",description:'`scope-begin-HASH` / `scope-end-HASH` from read views: ["ast"] \u2014 first/last lines of a scope. Any numeric suffix is part of the anchor.',renderFull(e){return e},renderCompact(e){return J.exec(e)?.[1]==="begin"?"scope start":"scope end"},async tryResolve(e,o){if(!J.test(e))return{kind:"not-handled"};try{let n=(await t.getDocumentScopes(o.source,o.cwd,o.lines)).find(s=>s.beginAnchor.value===e||s.endScopeAnchor.value===e);return n===void 0?{kind:"rejected",rejection:{code:"stale",reason:`AST scope anchor ${e} is stale`}}:{kind:"resolved",anchor:n.beginAnchor.value===e?n.beginAnchor:n.endScopeAnchor}}catch(r){return{kind:"failed",error:r}}}}}c(W,"createAstScopeAnchorResolver");import{spawn as se}from"node:child_process";function Z(){return{id:"ast",async tryResolve(t,e){if(!t.query.startsWith("ast:"))return{kind:"not-handled"};let o=t.query.slice(4).trim();if(o.length===0)return{kind:"failed",error:new Error("ast: pattern must not be empty")};let r=await ae(o,t,e.cwd,e.signal),n=t.limit??100;return{kind:"resolved",payload:{pattern:o,matches:r.slice(0,n),complete:r.length<=n}}},format(t){let e=t;if(e.matches.length===0)return{content:[{type:"text",text:"No AST matches found."}],details:e};let o=e.matches.flatMap((r,n)=>[`${String(n+1)}. ${r.file}:${String(r.range.start.line+1)}:${String(r.range.start.column+1)} ${r.language}`,` ${r.lines.trim()}`]);return e.complete||o.push("Result limit reached."),{content:[{type:"text",text:o.join(`
|
|
7
|
+
`)}],details:e}}}}c(Z,"createAstSearchResolver");function ae(t,e,o,r){let n=["run","--pattern",t,"--json=compact","--no-ignore","parent"];for(let s of Y(e.include))n.push("--globs",s);for(let s of Y(e.exclude))n.push("--globs",`!${s}`);return n.push(e.path??"."),new Promise((s,a)=>{let d=se("ast-grep",n,{cwd:o,stdio:["ignore","pipe","pipe"]}),l="",i="";d.stdout.setEncoding("utf8"),d.stderr.setEncoding("utf8"),d.stdout.on("data",p=>l+=p),d.stderr.on("data",p=>i+=p);let u=c(()=>{d.kill("SIGTERM")},"abort");r?.addEventListener("abort",u,{once:!0}),d.once("error",a),d.once("close",p=>{if(r?.removeEventListener("abort",u),r?.aborted===!0){a(r.reason instanceof Error?r.reason:new Error("AST search aborted"));return}if(p!==0&&p!==1){a(new Error(i.trim()||`ast-grep exited with code ${String(p)}`));return}try{let f=JSON.parse(l.length===0?"[]":l);if(!Array.isArray(f))throw new TypeError("ast-grep returned non-array JSON");s(f)}catch(f){a(f instanceof Error?f:new Error(String(f)))}})})}c(ae,"runAstGrep");function Y(t){return t?.split(",").map(e=>e.trim()).filter(Boolean)??[]}c(Y,"splitGlobs");var ie=k({kind:"code-view",label:"AST"});async function q(t){let e=new j,o=F(e),r={protocol:T,apiVersion:E,id:"ast",setup(s){s.addResolver({resolver:V(),renderResult:ie}),s.addHandler({stage:"read",when:{resolvedBy:"ast",contentKind:"text"},handler:b()}),s.addView({view:"ast",presenter:o});let a=G(),d=X();s.addHandler({stage:"post-read",async handler(l){let i=await a(l);return i.kind==="return"?i:d(i.context)}}),s.describe('ast:<path> \u2014 compact declaration outline. views: ["ast"] \u2014 scope boundaries alongside source text. Oversized code reads may return an outline with source line numbers; offset/limit read a smaller source range.')}},n={protocol:I,apiVersion:N,id:"ast",setup(s){s.addAnchorResolver({resolver:W(e),kind:_,type:"auxiliary"}),s.addTextPresenter({presenter:o})}};await Promise.all([P(t,r),L(t,B),D(t,n),C(t,{protocol:$,apiVersion:M,id:"ast-search",setup(s){s.addResolver({resolver:Z()}),s.describe("Search code structure with ast:<pattern>, using source-code syntax and placeholders such as $NAME for one node and $$$BODY for several nodes. path, include and exclude narrow the search.")}})])}c(q,"registerAst");export{q as default};
|
package/dist/entry-27.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a,b,c}from"./chunk-DEP55R35.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as createChangeGroups,c as replaceHeadRangeInIndex,b as reverseChangeGroup};
|
package/dist/entry-28.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-TNWYEXFG.js";import"./chunk-ERVMDQGX.js";import"./chunk-VFBLX4TG.js";import"./chunk-OBWZ5RYN.js";import"./chunk-KZBAJFCV.js";import"./chunk-7NDBZ4WX.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as default};
|
|
1
|
+
import{a as j,b as _,c as B}from"./chunk-DEP55R35.js";import{a as D}from"./chunk-ERVMDQGX.js";import{a as H,b as $}from"./chunk-VFBLX4TG.js";import{a as F}from"./chunk-ORAPGW7W.js";import{a as L,b as N}from"./chunk-JASLOB2X.js";import{a as M}from"./chunk-WNMGUALD.js";import{a as O,b as U}from"./chunk-THSCUT2L.js";import"./chunk-S3ZPXWX7.js";import{a as I}from"./chunk-RAZOACDD.js";import{d as R,e as S}from"./chunk-N34ATN52.js";import{a as x}from"./chunk-ZC65Z3CK.js";import{a}from"./chunk-EI7MMDWY.js";import{access as te}from"node:fs/promises";import ne from"node:path";var V={protocol:H,apiVersion:1,id:"changes",setup(r){r.addSetupCheck({id:"git",async inspect(e){return await re(e.cwd)?await R("git",e.cwd,e.env)?{}:{actions:[{id:"git-unavailable",message:"Git integration is unavailable because Git was not found"}]}:{}}}),r.addCheck({id:"git",title:"Git changes",async run(e){let t=await S("git",["--version"],e.cwd,e.env);return[t.ok?{status:"pass",message:"Git is available",detail:t.detail}:{status:"warn",message:"Git is not available; change anchors and index tools are disabled",detail:t.detail}]}})}};async function re(r){try{return await te(ne.join(r,".git")),!0}catch{return!1}}a(re,"isGitProject");import{mkdtemp as oe,rm as ie,writeFile as ae}from"node:fs/promises";import se from"node:os";import m from"node:path";var b=class r{constructor(e,t){this.executor=e;this.repositoryRoot=t}static{a(this,"GitChangesBackend")}static async create(e,t,n){let o=await e.exec("git",["rev-parse","--show-toplevel"],{cwd:t,...n!==void 0&&{signal:n}});return o.code!==0?{status:"unavailable",reason:"no-worktree",message:o.stderr.trim()||"not inside a Git worktree"}:{status:"ready",backend:new r(e,m.resolve(o.stdout.trim()))}}async readTrackedFile(e,t,n){let o=m.resolve(t,e),i=m.relative(this.repositoryRoot,o);return i===".."||i.startsWith(`..${m.sep}`)||m.isAbsolute(i)?{status:"unavailable",reason:"outside-worktree",message:`${o} is outside ${this.repositoryRoot}`}:this.readTrackedRepositoryFile(i.split(m.sep).join("/"),n)}async readTrackedRepositoryFile(e,t){let n=await this.git(["rev-parse","--verify","HEAD"],t);if(n.code!==0)return{status:"unavailable",reason:"missing-head",message:n.stderr.trim()||"Git HEAD does not exist"};let o=await this.git(["--literal-pathspecs","ls-tree","-z","HEAD","--",e],t);if(o.code!==0)return{status:"unavailable",reason:"head-file-lookup-failed",message:o.stderr.trim()||`could not inspect HEAD:${e}`};let i=de(o.stdout);if(i===void 0)return{status:"untracked"};let d=await this.readBlob(i.blob,"HEAD",e,t);if(d.status!=="found")return d;let c=await this.git(["--literal-pathspecs","ls-files","--stage","-z","--",e],t);if(c.code!==0)return{status:"unavailable",reason:"index-file-lookup-failed",message:c.stderr.trim()||`could not inspect the index entry for ${e}`};let s=ce(c.stdout);if(s.some(({stage:g})=>g!==0))return{status:"unavailable",reason:"conflicted",message:`${e} has unresolved Git index entries`};let u=s.find(({stage:g})=>g===0),l="";if(u!==void 0){let g=await this.readBlob(u.blob,"index",e,t);if(g.status!=="found")return g;l=g.text}return{status:"found",head:n.stdout.trim(),repositoryPath:e,repositoryRoot:this.repositoryRoot,headText:d.text,indexText:l,indexMode:u?.mode??i.mode}}async writeIndexFile(e,t,n,o){let i=await oe(m.join(se.tmpdir(),"pi-agent-index-")),d=m.join(i,"content");try{await ae(d,n,"utf8");let c=await this.git(["hash-object","-w",`--path=${e}`,d],o);if(c.code!==0||c.stdout.trim().length===0)throw new Error(c.stderr.trim()||`could not write a Git blob for ${e}`);let s=await this.git(["update-index","--add","--cacheinfo",t,c.stdout.trim(),e],o);if(s.code!==0)throw new Error(s.stderr.trim()||`could not update the Git index entry for ${e}`)}finally{await ie(i,{recursive:!0,force:!0})}}async readBlob(e,t,n,o){let i=await this.git(["cat-file","blob",e],o);return i.code!==0?{status:"unavailable",reason:t==="HEAD"?"head-file-lookup-failed":"index-file-lookup-failed",message:i.stderr.trim()||`could not read ${t}:${n}`}:{status:"found",text:i.stdout}}git(e,t){return this.executor.exec("git",e,{cwd:this.repositoryRoot,...t!==void 0&&{signal:t}})}};function de(r){let e=r.split("\0",1)[0];if(e===void 0||e.length===0)return;let t=e.indexOf(" ");if(t===-1)return;let[n,o,i]=e.slice(0,t).split(" ",3);return n===void 0||o!=="blob"||i===void 0?void 0:{mode:n,blob:i,path:e.slice(t+1)}}a(de,"parseTreeEntry");function ce(r){return r.split("\0").filter(Boolean).flatMap(e=>{let t=e.indexOf(" ");if(t===-1)return[];let[n,o,i]=e.slice(0,t).split(" ",3),d=Number(i);return n===void 0||o===void 0||!Number.isInteger(d)?[]:[{mode:n,blob:o,stage:d,path:e.slice(t+1)}]})}a(ce,"parseIndexEntries");function z(r){return{exec:a((e,t,n)=>r.exec(e,t,n),"exec")}}a(z,"extensionGitExecutor");var p=class r{constructor(e){this.git=e}static{a(this,"ChangeService")}static async create(e,t,n){let o=await b.create(e,t,n);return o.status==="unavailable"?o:{status:"ready",service:new r(o.backend)}}async inspect(e){if(e.worktreeText.includes("\0"))return{status:"unavailable",reason:"binary",message:"worktree file contains binary content"};let t=await this.git.readTrackedFile(e.source,e.cwd,e.signal);if(t.status!=="found")return t.status==="untracked"?{status:"not-applicable",reason:"untracked"}:t;if(t.headText.includes("\0")||t.indexText.includes("\0"))return{status:"unavailable",reason:"binary",message:"Git file state contains binary content"};let n=j(t.repositoryPath,t.headText,t.indexText,e.worktreeText);return n.length===0?{status:"not-applicable",reason:"clean"}:{status:"applicable",head:t.head,repositoryRoot:t.repositoryRoot,repositoryPath:t.repositoryPath,groups:n}}async changeIndex(e,t,n){let o=await this.inspect(e);if(o.status!=="applicable")return o;let i=o.groups.find(u=>u.selector===t);if(i===void 0)return k(t,o.groups.map(({selector:u})=>u));let d=n==="stage"?"staged":"unstaged";if(i.state===d)return{status:"unchanged",state:d,group:i};let c=x(i.segments[0]),s={head:o.head,repositoryPath:o.repositoryPath,headStart:c.headStart,headEnd:c.headEnd,replacementText:n==="stage"?c.worktreeText:c.headText};try{await this.applyIndexUpdate(s,e.signal)}catch(u){return{status:"unavailable",reason:"index-write-failed",message:ue(u)}}return{status:"applied",state:d,group:i}}async prepareUndo(e,t){let n=await this.inspect(e);if(n.status!=="applicable")return n;let o=n.groups.find(s=>s.selector===t);if(o===void 0)return k(t,n.groups.map(({selector:s})=>s));let i=_(e.worktreeText,o);if(i===void 0)return k(t,n.groups.map(({selector:s})=>s));let d=x(o.segments[0]),c=o.state==="unstaged"?void 0:{head:n.head,repositoryPath:n.repositoryPath,headStart:d.headStart,headEnd:d.headEnd,replacementText:d.headText};return{status:"applied",worktreeText:i,group:o,...c!==void 0&&{indexUpdate:c}}}async applyIndexUpdate(e,t){let n=await this.git.readTrackedRepositoryFile(e.repositoryPath,t);if(n.status!=="found")throw new Error(n.status==="untracked"?`${e.repositoryPath} is no longer tracked by HEAD`:n.message);if(n.head!==e.head)throw new Error(`Git HEAD changed while updating ${e.repositoryPath}`);let o=B(n.headText,n.indexText,e.headStart,e.headEnd,e.replacementText);o!==n.indexText&&await this.git.writeIndexFile(e.repositoryPath,n.indexMode,o,t)}};function k(r,e){return{status:"unavailable",reason:"stale-selector",message:`${r} is not available in the current file state`,availableSelectors:e}}a(k,"staleSelector");function ue(r){return r instanceof Error?r.message:String(r)}a(ue,"errorMessage");var w="pi-agent-ide-changes/change",le=/^CHANGE#[0-9A-F]{4,64}$/,ge=/^[A-Za-z][A-Za-z\d+.-]*:\/\//,E=class extends I{static{a(this,"ChangeTextAnchor")}constructor(e){super(e.selector,e.currentStartLine)}};function Q(r){return{resolver:fe(a(async t=>{if(ge.test(t.source))return;let n=await p.create(r,t.cwd,t.signal);if(n.status!=="ready")throw new Error(n.message);return n.service.inspect({source:t.source,worktreeText:t.content,cwd:t.cwd,...t.signal!==void 0&&{signal:t.signal}})},"inspect"))}}a(Q,"createChangeAnchorRegistration");function fe(r){return{id:"git-change",description:"Use the complete `CHANGE#HASH` shown beside a current Git change.",renderFull(e){return e},renderCompact(e){return e},async tryResolve(e,t){if(!le.test(e))return{kind:"not-handled"};try{let n=await r(t);if(n===void 0)return{kind:"not-handled"};if(n.status==="unavailable")return{kind:"failed",error:new Error(n.message)};let o=n.status==="applicable"?n.groups.find(i=>i.selector===e):void 0;return o===void 0?{kind:"rejected",rejection:{code:"stale",reason:`Change anchor ${e} is stale or unknown`}}:{kind:"resolved",anchor:new E(o)}}catch(n){return{kind:"failed",error:n}}}}}a(fe,"createChangeAnchorResolver");import{diffLines as pe}from"diff";var me="filesystem";function K(r){return{id:"current-git-changes",async present(e,t){if(t.purpose!=="read"||t.resolvedBy!==me)return e;let n=await p.create(r,t.cwd,t.signal);if(n.status!=="ready")return e;let o=await n.service.inspect({source:t.source,worktreeText:e.content,cwd:t.cwd,...t.signal!==void 0&&{signal:t.signal}});return o.status!=="applicable"?e:he(e,o.groups)}}}a(K,"createCurrentChangePresenter");function he(r,e){let t=new Map;for(let n of e)xe(r,n,t);return{...r,lines:r.lines.map(n=>be(n,t.get(n.lineNumber)))}}a(he,"presentChangeGroups");function xe(r,e,t){let n=x(e.segments[0]),o=pe(n.headText,n.worktreeText),i=e.currentStartLine,d,c;for(let s of o){let u=Te(s.value);if(s.removed){let l=we(r,i),g=A(t,l.lineNumber),f=l.after?g.after:g.before;for(let h of u){let y={kind:"synthetic",rows:f,index:f.length};f.push({marker:"-",prefix:"|",content:h}),d??=y,c=y}continue}if(s.added){for(let l of u){let g=A(t,i),f={kind:"current",lineNumber:i};g.added=!0,d??=f,c=f,i++}continue}i+=u.length}if(d!==void 0&&c!==void 0){let s=`${e.selector} \xB7 ${e.state}`;ye(d,c)?P(t,d,`<!-- change: ${s} -->`):(P(t,d,`<!-- change-begin: ${s} -->`),P(t,c,`<!-- change-end: ${s} -->`))}}a(xe,"presentChangeGroup");function ye(r,e){return r.kind==="current"&&e.kind==="current"?r.lineNumber===e.lineNumber:r.kind==="synthetic"&&e.kind==="synthetic"?r.rows===e.rows&&r.index===e.index:!1}a(ye,"sameTarget");function P(r,e,t){if(e.kind==="current"){A(r,e.lineNumber).annotations.push(t);return}let n=x(e.rows[e.index]);e.rows[e.index]={...n,suffix:`${n.suffix??""} ${t}`}}a(P,"annotateTarget");function be(r,e){if(e===void 0)return r;let t=e.annotations.length===0?"":` ${e.annotations.join(" ")}`;return{...r,presentation:{...r.presentation,...e.added&&{marker:"+"},before:[...r.presentation?.before??[],...e.before],after:[...e.after,...r.presentation?.after??[]],suffix:`${r.presentation?.suffix??""}${t}`}}}a(be,"presentLine");function A(r,e){let t=r.get(e);if(t!==void 0)return t;let n={before:[],after:[],annotations:[],added:!1};return r.set(e,n),n}a(A,"presentationsFor");function we(r,e){return e<=r.lines.length?{lineNumber:Math.max(1,e),after:!1}:{lineNumber:r.lines.length,after:!0}}a(we,"placementFor");function Te(r){if(r.length===0)return[];let e=r.split(/\r\n|\r|\n/u);return e.at(-1)===""&&e.pop(),e}a(Te,"splitLines");var T=class{static{a(this,"IndexMutationQueue")}tail=Promise.resolve();run(e){let t=this.tail.then(e,e);return this.tail=t.then(()=>{},()=>{}),t}};import{createHash as ve}from"node:crypto";import{realpathSync as Ce}from"node:fs";import Z from"node:path";import{fileURLToPath as ke}from"node:url";var v=class{static{a(this,"LastTextTransactionStore")}#e=new Map;observe(e){let t=W(e.resourceSource,e.cwd);if(e.intent!=="edit"||!e.existed||e.before.content===e.after.content){this.#e.delete(t);return}this.#e.set(t,{before:e.before.content,afterDigest:X(e.after.content)})}restore(e,t,n){let o=W(e,t),i=this.#e.get(o);if(i===void 0)throw new Error(`No last text transaction is available for ${e}.`);if(i.afterDigest!==X(n))throw this.#e.delete(o),new Error(`${e} changed after its last text transaction; refusing to overwrite newer text.`);return i.before}};function W(r,e){return r.startsWith("file://")?q(ke(new URL(r))):/^[a-z][a-z\d+.-]*:/iu.test(r)?r:q(Z.resolve(e,r))}a(W,"sourceKey");function q(r){try{return Ce.native(r)}catch{return Z.normalize(r)}}a(q,"canonicalFile");function X(r){return ve("sha256").update(r).digest("hex")}a(X,"textDigest");import{readFile as Ee}from"node:fs/promises";import Pe from"node:path";import{defineTool as Ae,withFileMutationQueue as Ge}from"@earendil-works/pi-coding-agent";import{Type as G}from"typebox";var Ie=G.Object({file:G.String({description:"Path to the tracked text file"}),change:G.String({description:"Complete CHANGE#HASH anchor shown by read",pattern:"^CHANGE#[0-9A-F]{4,64}$"})},{additionalProperties:!1});function J(r,e,t){r.registerTool(Y("stage",e,t)),r.registerTool(Y("unstage",e,t))}a(J,"registerIndexChangeTools");function Y(r,e,t){let n=r==="stage"?"staged":"unstaged",o=r==="stage"?"Staged":"Unstaged";return Ae({name:r,label:r,promptSnippet:`${o.slice(0,-1)} a selected Git change`,description:`Use ${r} to ${r==="stage"?"add one current Git change to the index":"remove one current Git change from the index"}. Select the change with a CHANGE# anchor; worktree content is kept.`,parameters:Ie,async execute(i,d,c,s,u){let l=Re(d.file,u.cwd);return Ge(l,()=>t.run(async()=>{let g=await Ee(l,"utf8"),f=await p.create(e,u.cwd,c);if(f.status!=="ready")throw new Error(f.message);let h=await f.service.changeIndex({source:l,worktreeText:g,cwd:u.cwd,...c!==void 0&&{signal:c}},d.change,r);if(h.status==="unavailable")throw new Error(h.message);if(h.status==="not-applicable")throw new Error(`${r} is not applicable to ${l}: ${h.reason}`);let y=h.status==="unchanged";return{content:[{type:"text",text:y?`${d.change} is already ${n} in ${d.file}.`:`${o} ${d.change} in ${d.file}.`}],details:{action:r,change:d.change,file:l,state:n,unchanged:y}}}))}})}a(Y,"createIndexChangeTool");function Re(r,e){let t=r.startsWith("@")?r.slice(1):r;return Pe.resolve(e,t)}a(Re,"resolveFile");import{diffChars as Se}from"diff";import{Type as C}from"typebox";var He=C.Object({file:C.Optional(C.String({description:"File to restore; may be omitted to inherit the previous batched source"})),change:C.String({description:"Complete CHANGE#HASH anchor shown by read, or last for this file's latest text-editor transaction",pattern:"^(?:CHANGE#[0-9A-F]{4,64}|last)$"})},{additionalProperties:!1});function ee(r,e,t){return{name:"undo",description:"Use undo to revert a selected uncommitted Git change or the latest text-editor transaction for one file. A CHANGE# anchor restores that change to HEAD in both worktree and index; last restores the file's state before its latest text-editor transaction.",promptSnippet:"Restore a Git change or the latest text edit",parameters:He,intent:"restore",source:{field:"file",inherited:!0},anchors:[{field:"change",sourceField:"file",kinds:[w],nonAnchorValues:["last"]}],async mutate(n,o){let i=n.sourceFor("file"),d,c;if(o.change==="last")d=e.restore(i,n.cwd,n.sourceDocument.content);else{await n.resolveAnchor("change");let s=await p.create(r,n.cwd,n.signal);if(s.status!=="ready")throw new Error(s.message);let u=await s.service.prepareUndo({source:i,worktreeText:n.sourceDocument.content,cwd:n.cwd,...n.signal!==void 0&&{signal:n.signal}},o.change);if(u.status!=="applied")throw u.status==="unavailable"?new Error(u.message):new Error(`Undo is not applicable to ${i}: ${u.reason}`);if(d=u.worktreeText,u.indexUpdate!==void 0){let l=u.indexUpdate;c=a(()=>t.run(()=>s.service.applyIndexUpdate(l,n.signal)),"afterWrite")}}return{edits:new Map([[i,{changes:$e(n.sourceDocument.content,d),action:"edited"}]]),...c!==void 0&&{afterWrite:c}}}}}a(ee,"createUndoMutationTool");function $e(r,e){let t=[],n=0,o,i=0,d="",c=a(()=>{o!==void 0&&(t.push({from:o,to:o+i,insert:d}),o=void 0,i=0,d="")},"flush");for(let s of Se(r,e)){if(!s.added&&!s.removed){c(),n+=s.value.length;continue}o??=n,s.removed?(n+=s.value.length,i+=s.value.length):d+=s.value}return c(),t}a($e,"createTextChanges");async function De(r){if(process.argv.includes("--old-tools"))return;let e=z(r),t=new v,n=new T,o=K(e),i=Q(e),d={protocol:L,apiVersion:N,id:"current-git-changes",setup(s){s.addView({view:"changes",presenter:o}),s.describe('views: ["changes"] \u2014 uncommitted edits in tracked files, staged/unstaged state, and CHANGE# anchors for stage, unstage and undo.')}},c={protocol:O,apiVersion:U,id:"current-git-changes",setup(s){s.addAnchorResolver({...i,kind:w,type:"auxiliary"}),s.onDidEdit(u=>{t.observe(u)}),s.addMutationTool(ee(e,t,n)),s.addTextPresenter({presenter:o})}};await Promise.all([D(r,V),F(r,d),M(r,c)]),J(r,e,n)}a(De,"registerGitChanges");export{De as default};
|
package/dist/entry-29.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-AP7Z3VWC.js";import"./chunk-ERVMDQGX.js";import"./chunk-VFBLX4TG.js";import"./chunk-EI7MMDWY.js";export{a as default};
|
|
1
|
+
import{a as P}from"./chunk-WZI4YC2O.js";import{a as F}from"./chunk-ERVMDQGX.js";import{a as x,b as E}from"./chunk-VFBLX4TG.js";import{a as j}from"./chunk-OBWZ5RYN.js";import{a as h,b as v}from"./chunk-KZBAJFCV.js";import{b,f as C,h as w,i as d,k as g,l as k}from"./chunk-KVGQG43U.js";import"./chunk-N34ATN52.js";import"./chunk-ZC65Z3CK.js";import{a as l}from"./chunk-EI7MMDWY.js";import{copyFile as z,mkdtemp as $,rm as A}from"node:fs/promises";import y from"node:path";var D=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".html",".md",".yaml",".yml",".vue",".svelte"],O=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".less",".html",".htm",".md",".markdown",".mdx",".yaml",".yml",".toml"],u=[o("dart-format",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],[".dart"],["dart","format","{file}"],"https://dart.dev/tools/dart-format"),o("zig-format",["zig"],["zig"],["build.zig","build.zig.zon","zls.json"],[".zig",".zon"],["zig","fmt","{file}"],"https://ziglang.org/documentation/master/"),o("styler",["r"],["Rscript"],[".Rprofile","DESCRIPTION"],[".r"],["Rscript","-e","styler::style_file(commandArgs(TRUE)[1])","{file}"],"https://styler.r-lib.org/"),o("clang-format",["c","cpp"],["clang-format"],[".clang-format","_clang-format"],[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["clang-format","-i","{file}"],"https://clang.llvm.org/docs/ClangFormat.html"),o("prettier",["javascript","typescript","html","css","json","yaml","markdown","vue","svelte"],["prettier"],[".prettierrc",".prettierrc.json",".prettierrc.json5",".prettierrc.yaml",".prettierrc.yml",".prettierrc.toml",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs","prettier.config.js","prettier.config.cjs","prettier.config.mjs","prettier.config.ts","prettier.config.mts","prettier.config.cts"],D,["prettier","--write","{file}"],"https://prettier.io/docs/",["prettier"],{"package.json":["prettier"]}),o("biome",["javascript","typescript","json","css"],["biome"],["biome.json","biome.jsonc"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css"],["biome","format","--write","{file}"],"https://biomejs.dev/",["@biomejs/biome"]),o("oxfmt",["javascript","typescript","json","css","html","markdown","yaml","toml"],["oxfmt"],[".oxfmtrc.json",".oxfmtrc.jsonc","oxfmt.config.ts","oxfmt.config.mts"],O,["oxfmt","--write","{file}"],"https://oxc.rs/docs/guide/usage/formatter.html",["oxfmt"]),o("ruff-format",["python"],["ruff"],["ruff.toml",".ruff.toml"],[".py",".pyi"],["ruff","format","{file}"],"https://docs.astral.sh/ruff/formatter/",["ruff"],{"pyproject.toml":["tool.ruff"]}),o("black",["python"],["black"],[],[".py",".pyi"],["black","--quiet","{file}"],"https://black.readthedocs.io/",["black"],{"pyproject.toml":["tool.black"]}),o("gofmt",["go"],["gofmt"],["go.mod"],[".go"],["gofmt","-w","{file}"],"https://pkg.go.dev/cmd/gofmt"),o("goimports",["go"],["goimports"],["go.mod"],[".go"],["goimports","-w","{file}"],"https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),o("rustfmt",["rust"],["rustfmt"],["rustfmt.toml",".rustfmt.toml","Cargo.toml"],[".rs"],["rustfmt","{file}"],"https://github.com/rust-lang/rustfmt"),o("csharpier",["csharp"],["csharpier"],[".csharpierrc",".csharpierrc.json",".csharpierrc.yaml",".csharpierrc.yml"],[".cs"],["csharpier","format","{file}"],"https://csharpier.com/"),o("google-java-format",["java"],["google-java-format"],["pom.xml","build.gradle"],[".java"],["google-java-format","--replace","{file}"],"https://github.com/google/google-java-format"),o("ktlint-format",["kotlin"],["ktlint"],[".editorconfig","build.gradle.kts"],[".kt",".kts"],["ktlint","-F","{file}"],"https://pinterest.github.io/ktlint/"),o("rubocop-format",["ruby"],["rubocop"],[".rubocop.yml","Gemfile"],[".rb",".rake"],["rubocop","--fix-layout","{file}"],"https://docs.rubocop.org/"),o("pint",["php"],["pint"],["pint.json","composer.json"],[".php"],["pint","{file}"],"https://laravel.com/docs/pint"),o("swift-format",["swift"],["swift-format"],[".swift-format","Package.swift"],[".swift"],["swift-format","format","--in-place","{file}"],"https://github.com/swiftlang/swift-format"),o("stylua",["lua"],["stylua"],["stylua.toml",".stylua.toml"],[".lua"],["stylua","{file}"],"https://github.com/JohnnyMorganz/StyLua"),o("shfmt",["shell"],["shfmt"],[".editorconfig"],[".sh",".bash",".zsh"],["shfmt","-w","{file}"],"https://github.com/mvdan/sh"),o("taplo",["toml"],["taplo"],["taplo.toml"],[".toml"],["taplo","format","{file}"],"https://taplo.tamasfe.dev/"),o("sqlfluff-format",["sql"],["sqlfluff"],[".sqlfluff","pyproject.toml"],[".sql"],["sqlfluff","format","{file}"],"https://docs.sqlfluff.com/"),o("terraform-fmt",["terraform"],["terraform"],[".terraform.lock.hcl"],[".tf",".tfvars"],["terraform","fmt","{file}"],"https://developer.hashicorp.com/terraform/cli/commands/fmt"),o("cmake-format",["cmake"],["cmake-format"],[".cmake-format.py","CMakeLists.txt"],[".cmake"],["cmake-format","-i","{file}"],"https://cmake-format.readthedocs.io/",void 0,void 0,["CMakeLists.txt"]),o("xmlformat",["xml"],["xmlformat"],[".xmlformat.conf"],[".xml",".xsd",".xsl"],["xmlformat","--overwrite","{file}"],"https://github.com/pamoller/xmlformatter"),o("mix-format",["elixir"],["mix"],["mix.exs",".formatter.exs"],[".ex",".exs"],["mix","format","{file}"],"https://hexdocs.pm/mix/Mix.Tasks.Format.html"),o("scalafmt",["scala"],["scalafmt"],[".scalafmt.conf"],[".scala",".sc",".sbt"],["scalafmt","{file}"],"https://scalameta.org/scalafmt/"),o("julia-format",["julia"],["julia"],[".JuliaFormatter.toml","Project.toml"],[".jl"],["julia","--startup-file=no","--history-file=no","-e","using JuliaFormatter; format_file(ARGS[1])","{file}"],"https://github.com/domluna/JuliaFormatter.jl"),o("powershell-format",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],[".ps1",".psm1",".psd1"],["pwsh","-NoProfile","-NonInteractive","-CommandWithArgs",'$ErrorActionPreference="Stop";$p=$args[0];$options=@{};if(Test-Path -LiteralPath PSScriptAnalyzerSettings.psd1){$options.Settings="PSScriptAnalyzerSettings.psd1"};[IO.File]::WriteAllText($p,(Invoke-Formatter -ScriptDefinition ([IO.File]::ReadAllText($p)) @options))',"{file}"],"https://learn.microsoft.com/powershell/module/psscriptanalyzer/invoke-formatter"),o("dockfmt",["dockerfile"],["dockfmt"],["Dockerfile","Containerfile"],[".dockerfile"],["dockfmt","fmt","--write","{file}"],"https://github.com/jessfraz/dockfmt",void 0,void 0,["Dockerfile","Containerfile"])];function o(r,t,e,i,a,n,m,f,s,c){return{id:r,name:r,kind:"formatter",languages:t,executables:e,configFiles:i,documentation:m,...f&&{dependencies:f},...s&&{configSections:s},formatter:{extensions:a,...c&&{fileNames:c},run:{command:n},output:"in-place"}}}l(o,"recipe");var p=class r{constructor(t,e,i=new Map){this.formatters=t;this.availableBuiltIns=e;this.evidence=i}static{l(this,"FormatterCommandRegistry")}static async fromDirectory(t,e={}){let i=await C(t,"formatters",s=>k(s).formatters,e),a=e.environment??process.env,n=await Promise.all(i.entries.filter(s=>s.layer==="built-in").map(async s=>({id:s.id,available:await d(s.config.run,t,a)}))),m=await P(t,u),f=[...i.entries].sort((s,c)=>s.layer==="built-in"&&c.layer==="built-in"?(m.get(c.id)?.score??0)-(m.get(s.id)?.score??0):0);return new r(f,new Set(n.filter(s=>s.available).map(s=>s.id)),m)}static fromConfig(t){return new r(Object.entries(t.formatters).map(([e,i])=>({id:e,config:i,layer:"project",sourcePath:"<memory>"})),new Set)}resolve(t,e){return this.resolveEntry(t,e)?.config}resolveEntry(t,e){return w(this.formatters,this.availableBuiltIns,this.evidence,t,e)}get entries(){return this.formatters}};var R={protocol:x,apiVersion:1,id:"formatter",setup(r){for(let t of u)r.addToolRecipe(t);r.addSetupCheck({id:"effective-config",inspect:M}),r.addCheck({id:"config",title:"Formatter",async run(t){try{let e=await p.fromDirectory(t.cwd,{environment:t.env}),i=_(e,t.files,t.cwd);return i.length===0?[{status:"skip",message:"No formatter matches the inspected project files"}]:await Promise.all(i.map(async({entry:a,source:n})=>{let m=`${a.id} [${a.layer}] command ${JSON.stringify(a.config.run.command)}`,f=await $(y.join(y.dirname(n),".pi-agent-ide-doctor-")),s=y.join(f,y.basename(n));try{return await z(n,s),(await g(a.config,{projectRoot:t.cwd,filePath:s,env:t.env})).ok?{status:"pass",message:`${m}: probe passed`,detail:a.sourcePath}:{status:"fail",message:`${m}: probe failed`,detail:a.sourcePath}}catch(c){return{status:"fail",message:`${m}: ${c instanceof Error?c.message:String(c)}`,detail:a.sourcePath}}finally{await A(f,{recursive:!0,force:!0})}}))}catch(e){return[{status:"fail",message:e instanceof Error?e.message:String(e)}]}}})}};async function M(r){try{let t=await p.fromDirectory(r.cwd,{environment:r.env}),e=[],i=new Map;for(let[a,n]of r.detectedLanguages){let m=n.map(f=>t.resolveEntry(f,r.cwd)).find(f=>f!==void 0);m!==void 0&&(e.push({kind:"formatter",languageId:a,toolId:m.id}),await d(m.config.run,r.cwd,r.env)||i.set(m.id,{id:`formatter-${m.id}-unavailable`,message:`Configured formatter ${m.id} cannot run ${JSON.stringify(m.config.run.command)}`}))}return{selections:e,actions:[...i.values()]}}catch(t){return{actions:[{id:"formatter-config-invalid",message:`Formatter configuration cannot load: ${t instanceof Error?t.message:String(t)}`}]}}}l(M,"inspectFormatterSetup");function _(r,t,e){let i=new Map;for(let a of t){let n=r.resolveEntry(a,e);n!==void 0&&!i.has(n.id)&&i.set(n.id,{entry:n,source:a})}return[...i.values()]}l(_,"applicableFormatters");var T=new Map;function I(){return{kind:"formatter",name:"formatter",priority:100,extensions:["*"],detect:l(async r=>(await S(r.cwd),!0),"detect"),async format({filePath:r},t){let i=(await S(t.cwd)).resolve(r,t.cwd);if(i===void 0)return{ok:!0,edits:0,formatter:null};let a=b(i.run.command);try{let n=await g(i,{projectRoot:t.cwd,filePath:r});return{ok:n.ok,edits:n.changed?1:0,formatter:a}}catch{return{ok:!1,edits:0,formatter:a}}}}}l(I,"createFormatter");async function S(r){let t=T.get(r);return t===void 0&&(t=p.fromDirectory(r),T.set(r,t)),t}l(S,"loadRegistry");async function L(r){let t={kind:"formatter",name:"pi-agent-ide-formatter",priority:200,extensions:["*"],detect:l(()=>Promise.resolve(!0),"detect"),async format(i,a){return I().format(i,a)}},e={protocol:h,apiVersion:3,id:"formatter",setup(i){i.addTool(t)}};await Promise.all([j(r,e),F(r,R)])}l(L,"registerFormatter");export{L as default};
|
package/dist/entry-30.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as p}from"./chunk-ERVMDQGX.js";import{a as n,b as c}from"./chunk-VFBLX4TG.js";import{a as e}from"./chunk-EI7MMDWY.js";var m=[t("c","C",[".c",".h"],["CMakeLists.txt","meson.build","compile_commands.json"],"tree-sitter"),t("cpp","C++",[".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["CMakeLists.txt","meson.build","compile_commands.json","conanfile.py","vcpkg.json"],"tree-sitter"),t("csharp","C#",[".cs"],[".sln",".csproj","global.json"]),t("go","Go",[".go"],["go.mod","go.work"]),t("java","Java",[".java"],["pom.xml","build.gradle","build.gradle.kts"]),t("kotlin","Kotlin",[".kt",".kts"],["build.gradle.kts","settings.gradle.kts"]),t("javascript","JavaScript",[".js",".jsx",".mjs",".cjs"],["package.json"],"tree-sitter"),t("typescript","TypeScript",[".ts",".tsx",".mts",".cts"],["tsconfig.json","package.json"],"tree-sitter"),t("python","Python",[".py",".pyi"],["pyproject.toml","requirements.txt","setup.py"],"tree-sitter"),t("rust","Rust",[".rs"],["Cargo.toml"],"tree-sitter"),t("ruby","Ruby",[".rb",".rake"],["Gemfile",".ruby-version"]),t("php","PHP",[".php"],["composer.json"]),t("swift","Swift",[".swift"],["Package.swift"]),t("lua","Lua",[".lua"],[".luarc.json","stylua.toml"]),t("dart","Dart",[".dart"],["pubspec.yaml","analysis_options.yaml"]),t("powershell","PowerShell",[".ps1",".psm1",".psd1"],["PSScriptAnalyzerSettings.psd1"]),t("r","R",[".r"],["DESCRIPTION",".lintr",".Rprofile"]),t("scala","Scala",[".scala",".sc"],["build.sbt","project.scala",".scalafmt.conf"]),t("elixir","Elixir",[".ex",".exs"],["mix.exs",".formatter.exs"]),t("zig","Zig",[".zig",".zon"],["build.zig","build.zig.zon","zls.json"]),t("julia","Julia",[".jl"],["Project.toml",".JuliaFormatter.toml"]),t("vue","Vue",[".vue"],["package.json"]),t("svelte","Svelte",[".svelte"],["svelte.config.js","svelte.config.ts"]),t("shell","Shell",[".sh",".bash",".zsh"],[".shellcheckrc"]),t("html","HTML",[".html",".htm"],[]),t("css","CSS",[".css",".scss",".sass",".less"],["stylelint.config.js"]),t("json","JSON",[".json",".jsonc"],[],"tree-sitter"),t("yaml","YAML",[".yaml",".yml"],[".yamllint"],"tree-sitter"),t("toml","TOML",[".toml"],["taplo.toml"],"tree-sitter"),t("xml","XML",[".xml",".xsd",".xsl"],[]),t("markdown","Markdown",[".md",".mdx"],[".markdownlint.json"]),t("sql","SQL",[".sql"],[".sqlfluff"]),t("dockerfile","Dockerfile",[],["Dockerfile","compose.yaml"],void 0,["Dockerfile","Containerfile"]),t("terraform","Terraform",[".tf",".tfvars"],[".terraform.lock.hcl"]),t("cmake","CMake",[".cmake"],["CMakeLists.txt"],void 0,["CMakeLists.txt"])];function t(s,i,o,r,l,a){return{id:s,name:i,extensions:o,projectMarkers:r,...l&&{ast:l},...a&&{fileNames:a}}}e(t,"language");function g(s){return p(s,{protocol:n,apiVersion:1,id:"languages",setup(o){for(let r of m)o.addLanguage(r)}})}e(g,"registerLanguages");export{g as default};
|
package/dist/entry-31.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a as T}from"./chunk-WZI4YC2O.js";import{a as A}from"./chunk-ERVMDQGX.js";import{a as $,b as I}from"./chunk-VFBLX4TG.js";import{a as j}from"./chunk-OBWZ5RYN.js";import{a as b,b as L}from"./chunk-KZBAJFCV.js";import{b as P,f as R,h as E,i as w,j as S,m as D}from"./chunk-KVGQG43U.js";import"./chunk-N34ATN52.js";import{a as u}from"./chunk-ZC65Z3CK.js";import{a as s}from"./chunk-EI7MMDWY.js";import x from"node:path";import{fileURLToPath as K}from"node:url";function O(t,e){if(t.trim().length===0)return[];switch(e.format){case"pi-json":return F(t);case"eslint-json":return J(t);case"sarif":return V(t);case"checkstyle":return W(t);case"gcc":case"clang":return G(t);case"regex":return Z(t,u(e.pattern),e.columnBase??1)}}s(O,"parseDiagnostics");function F(t){let e=JSON.parse(t);return Array.isArray(e.diagnostics)?e.diagnostics.flatMap(p):[]}s(F,"parsePiJson");function J(t){return JSON.parse(t).flatMap(n=>Array.isArray(n.messages)?n.messages.flatMap(i=>p(i).map(r=>({...r,...n.filePath&&{file:n.filePath}}))):[])}s(J,"parseEslintJson");function V(t){return(JSON.parse(t).runs??[]).flatMap(n=>(n.results??[]).flatMap(i=>{let r=i.locations?.[0]?.physicalLocation,c=r?.region??{},o=i.message;return p({file:r?.artifactLocation?.uri,line:c.startLine,column:c.startColumn,message:o?.text,code:i.ruleId,severity:U(i.level)})}))}s(V,"parseSarif");function W(t){let e=[];for(let n of t.matchAll(/<file\s+([^>]+)>([\s\S]*?)<\/file>/gu)){let i=N(u(n[1])).name;for(let r of u(n[2]).matchAll(/<error\s+([^>]+?)\/?>(?:<\/error>)?/gu)){let c=N(u(r[1]));e.push(...p({file:i,line:Number(c.line),column:Number(c.column??1),message:c.message,code:c.source,severity:c.severity}))}}return e}s(W,"parseCheckstyle");function N(t){return Object.fromEntries([...t.matchAll(/([\w-]+)="([^"]*)"/gu)].map(e=>[u(e[1]),X(u(e[2]))]))}s(N,"xmlAttributes");function G(t){return B(t,/^(?<file>.+?):(?<line>\d+):(?<column>\d+):\s*(?<severity>fatal error|error|warning|note|info|hint):\s*(?<message>.*?)(?:\s+\[(?<code>[^\]]+)\])?$/u)}s(G,"parseCompilerLines");function Z(t,e,n){return[...t.replaceAll(`\r
|
|
2
|
+
`,`
|
|
3
|
+
`).matchAll(new RegExp(e,"gmu"))].flatMap(i=>i.groups===void 0?[]:p({...i.groups,...i.groups.column!==void 0&&{column:Number(i.groups.column)+(1-n)}}))}s(Z,"parseRegexLines");function B(t,e){return t.split(/\r?\n/u).flatMap(n=>{let i=n.match(e)?.groups;return i===void 0?[]:p(i)})}s(B,"parseMatchingLines");function p(t){if(typeof t!="object"||t===null)return[];let e=t,n=z(e.line??e.startLine),i=z(e.column??e.startColumn,1),r=typeof e.message=="string"?e.message:void 0;return n===void 0||r===void 0?[]:[{...typeof e.file=="string"&&{file:e.file},code:_(e.code??e.ruleId,"lint"),message:r,line:n,column:i??1,severity:H(e.severity)}]}s(p,"normalizeDiagnostic");function z(t,e){let n=typeof t=="string"?Number.parseInt(t,10):t;return typeof n=="number"&&Number.isInteger(n)&&n>=1?n:e}s(z,"numberValue");function _(t,e){return typeof t=="string"||typeof t=="number"?String(t):e}s(_,"stringValue");function H(t){if(t===2)return"error";if(t===1)return"warning";let e=_(t,"warning").toLowerCase();return e.includes("error")||e==="e"||e==="f"||e==="fatal"?"error":e==="info"||e==="note"||e==="notice"?"info":e==="hint"?"hint":"warning"}s(H,"severityValue");function U(t){return t==="error"||t==="warning"||t==="note"?t:"warning"}s(U,"sarifSeverity");function X(t){return t.replace(/&#(x[0-9a-f]+|\d+);/giu,(e,n)=>{let i=n.toLowerCase().startsWith("x")?Number.parseInt(n.slice(1),16):Number(n);return i<=1114111?String.fromCodePoint(i):e}).replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}s(X,"decodeXml");var C=[a("dart-analyze",["dart"],["dart"],["analysis_options.yaml","pubspec.yaml"],[".dart"],["dart","analyze","--format","machine","{file}"],"regex","https://dart.dev/tools/dart-analyze","^(?<severity>[^|]+)\\|[^|]+\\|(?<code>[^|]+)\\|(?<file>[^|]+)\\|(?<line>\\d+)\\|(?<column>\\d+)\\|\\d+\\|(?<message>.*)$",void 0,[0,1,2,3]),a("zig-ast-check",["zig"],["zig"],["build.zig","build.zig.zon","zls.json"],[".zig",".zon"],["zig","ast-check","{file}"],"gcc","https://ziglang.org/documentation/master/"),a("lintr",["r"],["Rscript"],[".lintr","DESCRIPTION"],[".r"],["Rscript","-e","print(lintr::lint(commandArgs(TRUE)[1]))","{file}"],"regex","https://lintr.r-lib.org/","^(?<file>.+?):(?<line>\\d+):(?<column>\\d+): (?<severity>[^:]+): \\[(?<code>[^\\]]+)\\] (?<message>.*)$"),a("clang-tidy",["c","cpp"],["clang-tidy"],[".clang-tidy","compile_commands.json"],[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["clang-tidy","{file}"],"clang","https://clang.llvm.org/extra/clang-tidy/"),a("eslint",["javascript","typescript","vue","svelte"],["eslint"],["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.json",".eslintrc.js",".eslintrc.cjs",".eslintrc.yaml",".eslintrc.yml"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".vue",".svelte"],["eslint","--format","json","{file}"],"eslint-json","https://eslint.org/docs/latest/",void 0,["eslint"]),a("oxlint",["javascript","typescript"],["oxlint"],[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts","oxlint.config.mts"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts"],["oxlint","--format","sarif","{file}"],"sarif","https://oxc.rs/docs/guide/usage/linter.html",void 0,["oxlint"]),a("ruff",["python"],["ruff"],["pyproject.toml","ruff.toml",".ruff.toml"],[".py",".pyi"],["ruff","check","--output-format","concise","{file}"],"regex","https://docs.astral.sh/ruff/","^(?<file>.+?):(?<line>\\d+):(?<column>\\d+): (?<code>\\S+) (?<message>.+)$",["ruff"]),a("golangci-lint",["go"],["golangci-lint"],[".golangci.yml",".golangci.yaml","go.mod"],[".go"],["golangci-lint","run","--output.text.path=","--output.checkstyle.path=stdout","--show-stats=false","./..."],"checkstyle","https://golangci-lint.run/"),a("clippy",["rust"],["cargo"],["Cargo.toml","clippy.toml"],[".rs"],["cargo","clippy","--message-format","short"],"gcc","https://doc.rust-lang.org/clippy/"),a("dotnet-format",["csharp"],["dotnet"],[".editorconfig","global.json"],[".cs"],["dotnet","format","--verify-no-changes","--include","{relativeFile}"],"regex","https://learn.microsoft.com/dotnet/core/tools/dotnet-format","^(?<file>.+)\\((?<line>\\d+),(?<column>\\d+)\\): (?<severity>error|warning) (?<code>[^:]+): (?<message>.*?)(?: \\[.*\\])?$",void 0,[0,2]),a("checkstyle",["java"],["checkstyle"],["checkstyle.xml","pom.xml"],[".java"],["checkstyle","-c","checkstyle.xml","-f","xml","{file}"],"checkstyle","https://checkstyle.org/"),a("detekt",["kotlin"],["detekt"],["detekt.yml","build.gradle.kts"],[".kt",".kts"],["detekt","--input","{file}","--config","detekt.yml"],"regex","https://detekt.dev/","^(?<file>.+?):(?<line>\\d+):(?<column>\\d+): (?<message>.*?) \\[(?<code>[^\\]]+)\\]$",void 0,[0,2]),a("rubocop",["ruby"],["rubocop"],[".rubocop.yml","Gemfile"],[".rb",".rake"],["rubocop","--format","clang","{file}"],"regex","https://docs.rubocop.org/","^(?<file>.+?):(?<line>\\d+):(?<column>\\d+): (?<severity>[A-Z]): (?:\\[Correctable\\] )?(?<code>[^:]+): (?<message>.*)$"),a("phpcs",["php"],["phpcs"],["phpcs.xml","phpcs.xml.dist","composer.json"],[".php"],["phpcs","--report=checkstyle","{file}"],"checkstyle","https://github.com/PHPCSStandards/PHP_CodeSniffer",void 0,void 0,[0,1,2,3]),a("swiftlint",["swift"],["swiftlint"],[".swiftlint.yml","Package.swift"],[".swift"],["swiftlint","lint","--quiet","--reporter","checkstyle","{file}"],"checkstyle","https://github.com/realm/SwiftLint",void 0,void 0,[0,2]),a("scalafix",["scala"],["scalafix"],[".scalafix.conf"],[".scala",".sc"],["scalafix","--check","--files","{file}"],"gcc","https://scalacenter.github.io/scalafix/",void 0,void 0,[0,2,64,66]),a("credo",["elixir"],["mix"],["mix.exs",".credo.exs"],[".ex",".exs"],["mix","credo","--strict","--format","flycheck","--files-included","{file}"],"regex","https://hexdocs.pm/credo/","^(?<file>.+):(?<line>\\d+):(?<column>\\d+): (?<severity>[A-Z]): (?<message>.+)$",void 0,Array.from({length:32},(t,e)=>e)),a("psscriptanalyzer",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],[".ps1",".psm1",".psd1"],["pwsh","-NoProfile","-NonInteractive","-CommandWithArgs",'$ErrorActionPreference="Stop";$options=@{};if(Test-Path -LiteralPath PSScriptAnalyzerSettings.psd1){$options.Settings="PSScriptAnalyzerSettings.psd1"};Invoke-ScriptAnalyzer -Path $args[0] @options | ForEach-Object {"$($_.ScriptPath):$($_.Line):$($_.Column): $($_.Severity): $($_.Message) [$($_.RuleName)]"}',"{file}"],"regex","https://learn.microsoft.com/powershell/module/psscriptanalyzer/invoke-scriptanalyzer","^(?<file>.+):(?<line>\\d+):(?<column>\\d+): (?<severity>\\w+): (?<message>.+) \\[(?<code>[^\\]]+)\\]$",void 0,[0]),a("luacheck",["lua"],["luacheck"],[".luacheckrc"],[".lua"],["luacheck","--formatter","plain","--codes","--no-color","{file}"],"regex","https://github.com/lunarmodules/luacheck","^(?<file>.+):(?<line>\\d+):(?<column>\\d+): \\((?<code>(?<severity>[WE])\\d+)\\) (?<message>.+)$",void 0,[0,1,2]),a("shellcheck",["shell"],["shellcheck"],[".shellcheckrc"],[".sh",".bash",".zsh"],["shellcheck","-f","gcc","{file}"],"gcc","https://www.shellcheck.net/"),a("stylelint",["css"],["stylelint"],["stylelint.config.js",".stylelintrc.json"],[".css",".scss",".sass",".less"],["stylelint","--formatter","compact","{file}"],"regex","https://stylelint.io/","^(?<file>.+): line (?<line>\\d+), col (?<column>\\d+), (?<severity>error|warning) - (?<message>.+) \\((?<code>[^)]+)\\)$",["stylelint"],[0,2]),a("yamllint",["yaml"],["yamllint"],[".yamllint",".yamllint.yml"],[".yaml",".yml"],["yamllint","-f","parsable","{file}"],"regex","https://yamllint.readthedocs.io/","^(?<file>.+?):(?<line>\\d+):(?<column>\\d+): \\[(?<severity>[^\\]]+)\\] (?<message>.*?) \\((?<code>[^)]+)\\)$"),a("markdownlint",["markdown"],["markdownlint"],[".markdownlint.json",".markdownlint.yaml"],[".md",".mdx"],["markdownlint","{file}"],"regex","https://github.com/DavidAnson/markdownlint","^(?<file>.+?):(?<line>\\d+)(?::(?<column>\\d+))? (?<severity>error|warning) (?<code>MD\\d+)(?:/\\S+)? (?<message>.*)$"),a("sqlfluff",["sql"],["sqlfluff"],[".sqlfluff","pyproject.toml"],[".sql"],["sqlfluff","lint","--format","sarif","{file}"],"sarif","https://docs.sqlfluff.com/"),a("hadolint",["dockerfile"],["hadolint"],[".hadolint.yaml"],[".dockerfile"],["hadolint","--format","checkstyle","{file}"],"checkstyle","https://github.com/hadolint/hadolint",void 0,void 0,[0,1],void 0,["Dockerfile","Containerfile"]),a("tflint",["terraform"],["tflint"],[".tflint.hcl"],[".tf"],["tflint","--format","checkstyle"],"checkstyle","https://github.com/terraform-linters/tflint",void 0,void 0,[0,2]),a("cmake-lint",["cmake"],["cmake-lint"],[".cmake-format.py","CMakeLists.txt"],[".cmake"],["cmake-lint","{file}"],"regex","https://cmake-format.readthedocs.io/","^(?<file>.+?):(?<line>\\d+),(?<column>\\d+): \\[(?<code>(?<severity>[A-Z])\\d+)\\] (?<message>.*)$",void 0,[0,1],0,["CMakeLists.txt"]),a("htmlhint",["html"],["htmlhint"],[".htmlhintrc"],[".html",".htm"],["htmlhint","--format","checkstyle","--nocolor","{file}"],"checkstyle","https://htmlhint.com/"),a("jsonlint",["json"],["jsonlint"],[".jsonlintrc",".jsonlintrc.json",".jsonlintrc.yaml",".jsonlintrc.yml",".jsonlintrc.js",".jsonlintrc.cjs","jsonlint.config.js","jsonlint.config.cjs"],[".json"],["jsonlint","-q","{file}"],"regex","https://github.com/prantlf/jsonlint","^(?:Error: )?(?<message>Parse (?<severity>error) on line (?<line>\\d+)(?:, column (?<column>\\d+))?:[^\\n]*)$",["@prantlf/jsonlint","jsonlint"]),a("taplo-check",["toml"],["taplo"],["taplo.toml"],[".toml"],["taplo","check","--colors","never","{file}"],"regex","https://taplo.tamasfe.dev/","^(?<severity>error): (?<message>[^\\n]+)\\n\\s*\u250C\u2500 (?<file>.+):(?<line>\\d+):(?<column>\\d+)"),a("xmllint",["xml"],["xmllint"],[".xmllintrc"],[".xml",".xsd",".xsl"],["xmllint","--noout","{file}"],"regex","https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html","^(?<file>.+?):(?<line>\\d+): (?<severity>(?:parser |validity )?(?:error|warning)) : (?<message>.*)$",void 0,[0,1,2,3,4])];function a(t,e,n,i,r,c,o,d,l,f,y=[0,1],h,g){return{id:t,name:t,kind:"linter",languages:e,executables:n,configFiles:i,documentation:d,...f&&{dependencies:f},linter:{extensions:r,...g&&{fileNames:g},check:{command:c,successExitCodes:y},diagnostics:{format:o,...l&&{pattern:l},...h!==void 0&&{columnBase:h}}}}}s(a,"recipe");var m=class t{constructor(e,n,i=new Map){this.linters=e;this.availableBuiltIns=n;this.evidence=i}static{s(this,"LintCommandRegistry")}static async fromDirectory(e,n={}){let i=await R(e,"linters",l=>D(l).linters,n),r=n.environment??process.env,c=await Promise.all(i.entries.filter(l=>l.layer==="built-in").map(async l=>({id:l.id,available:await w(l.config.check,e,r)}))),o=await T(e,C),d=[...i.entries].sort((l,f)=>l.layer==="built-in"&&f.layer==="built-in"?(o.get(f.id)?.score??0)-(o.get(l.id)?.score??0):0);return new t(d,new Set(c.filter(l=>l.available).map(l=>l.id)),o)}static fromConfig(e){return new t(Object.entries(e.linters).map(([n,i])=>({id:n,config:i,layer:"project",sourcePath:"<memory>"})),new Set)}resolve(e,n){return this.resolveEntry(e,n)?.config}resolveEntry(e,n){return E(this.linters,this.availableBuiltIns,this.evidence,e,n)}get entries(){return this.linters}};async function k(t,e){let n;try{n=await S(t.check,e)}catch(d){return{ok:!1,diagnostics:[],failure:`command could not start: ${d instanceof Error?d.message:String(d)}`}}let i=t.diagnostics.format==="regex"||t.diagnostics.format==="clang"?[n.stdout,n.stderr].filter(d=>d.trim().length>0).join(`
|
|
4
|
+
`):n.stdout.trim().length>0?n.stdout:n.stderr,r;try{r=O(i,t.diagnostics)}catch{return{ok:!1,diagnostics:[],failure:`invalid ${t.diagnostics.format} diagnostics: ${i.trim().slice(0,200)||"empty command output"}`}}let c=n.ok&&(n.exitCode===0||r.length>0),o=t.check.cwd==="file"?x.dirname(e.filePath):e.projectRoot;return r=r.filter(d=>{if(d.file===void 0)return!0;let l=d.file.startsWith("file:")?K(d.file):d.file;return x.resolve(o,l)===x.resolve(e.filePath)}).map(({file:d,...l})=>l),{ok:c,diagnostics:r,...!c&&{failure:n.stderr.trim().slice(0,200)||`command exited with code ${String(n.exitCode)}`}}}s(k,"runConfiguredLinter");function M(t){return{kind:"linter",name:"command-lint",priority:100,extensions:["*"],detect:s(()=>Promise.resolve(!0),"detect"),async lint({filePath:e,fix:n},i){let r=t.resolve(e,i.cwd);if(r===void 0)return{ok:!0,diagnostics:[]};let c=n===!0&&r.fix!==void 0?r.fix:r.check,o=await k({...r,check:c},{projectRoot:i.cwd,filePath:e});return{ok:o.ok,diagnostics:o.diagnostics}}}}s(M,"createCommandLinter");import{copyFile as Q,mkdtemp as Y,rm as ee}from"node:fs/promises";import v from"node:path";var q={protocol:$,apiVersion:1,id:"lint",setup(t){for(let e of C)t.addToolRecipe(e);t.addSetupCheck({id:"effective-config",inspect:te}),t.addCheck({id:"config",title:"Linter",async run(e){try{let n=await m.fromDirectory(e.cwd,{environment:e.env}),i=ne(n,e.files,e.cwd);return i.length===0?[{status:"skip",message:"No linter matches the inspected project files"}]:await Promise.all(i.map(async({entry:r,source:c})=>{let o=`${r.id} [${r.layer}] command ${JSON.stringify(r.config.check.command)}`,d=await Y(v.join(v.dirname(c),".pi-agent-ide-doctor-")),l=v.join(d,v.basename(c));try{await Q(c,l);let f=await k(r.config,{projectRoot:e.cwd,filePath:l,env:e.env});return f.ok?{status:"pass",message:`${o}: probe passed`,detail:r.sourcePath}:{status:"fail",message:`${o}: probe failed`,detail:f.failure??r.sourcePath}}catch(f){return{status:"fail",message:`${o}: ${f instanceof Error?f.message:String(f)}`,detail:r.sourcePath}}finally{await ee(d,{recursive:!0,force:!0})}}))}catch(n){return[{status:"fail",message:n instanceof Error?n.message:String(n)}]}}})}};async function te(t){try{let e=await m.fromDirectory(t.cwd,{environment:t.env}),n=[],i=new Map;for(let[r,c]of t.detectedLanguages){let o=c.map(d=>e.resolveEntry(d,t.cwd)).find(d=>d!==void 0);o!==void 0&&(n.push({kind:"linter",languageId:r,toolId:o.id}),await w(o.config.check,t.cwd,t.env)||i.set(o.id,{id:`linter-${o.id}-unavailable`,message:`Configured linter ${o.id} cannot run ${JSON.stringify(o.config.check.command)}`}))}return{selections:n,actions:[...i.values()]}}catch(e){return{actions:[{id:"linter-config-invalid",message:`Linter configuration cannot load: ${e instanceof Error?e.message:String(e)}`}]}}}s(te,"inspectLinterSetup");function ne(t,e,n){let i=new Map;for(let r of e){let c=t.resolveEntry(r,n);c!==void 0&&!i.has(c.id)&&i.set(c.id,{entry:c,source:r})}return[...i.values()]}s(ne,"applicableLinters");async function ie(t){let e,n,i=s(o=>((n===void 0||e!==o)&&(e=o,n=re(o)),n),"registryFor"),r={kind:"linter",name:"pi-agent-ide-lint",priority:200,extensions:["*"],detect:s(async o=>(await i(o.cwd),!0),"detect"),async lint(o,d){let l=await i(d.cwd);return M(l).lint(o,d)}},c={protocol:b,apiVersion:3,id:"lint",setup(o){o.addTool(r),o.addDiagnosticSource({id:"lint",async diagnose(d,l){let f=await i(l.cwd);l.signal.throwIfAborted();let y=f.resolve(d,l.cwd);if(!y)return{status:"unavailable",diagnostics:[],reason:"No linter configured for this file"};let h=P(y.check.command),g=await k(y,{projectRoot:l.cwd,filePath:d,signal:l.signal});return!g.ok&&g.diagnostics.length===0?{status:"unavailable",diagnostics:[],reason:g.failure??"Lint check failed",source:h}:{status:"ready",diagnostics:g.diagnostics,source:h}}})}};await Promise.all([j(t,c),A(t,q)])}s(ie,"registerLint");async function re(t){let e=process.env.PI_AGENT_IDE_CONFIG_DIR??t;return m.fromDirectory(e)}s(re,"loadRegistry");export{ie as default};
|
package/dist/entry-32.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-GTK5AREE.js";import"./chunk-EI7MMDWY.js";export{c as createImageContent,a as createImageContentConverter,b as detectSupportedImageMimeType};
|
|
1
|
+
import{a as be}from"./chunk-ERVMDQGX.js";import{a as ye,b as ve}from"./chunk-VFBLX4TG.js";import"./chunk-NNCZYO4Q.js";import{c as Re}from"./chunk-KCEOTU5Z.js";import"./chunk-YHUTTZC6.js";import{a as Se}from"./chunk-ORAPGW7W.js";import{a as we,b as Le}from"./chunk-JASLOB2X.js";import{a as Pe}from"./chunk-E2RESHYR.js";import{a as _e,b as ke}from"./chunk-T2RPMEM2.js";import{a as oe,b as ae,c as E,d as R,j as ce,k as le,l as pe}from"./chunk-X6MPU7UO.js";import"./chunk-RAZOACDD.js";import{a as ge}from"./chunk-OBWZ5RYN.js";import{a as de,b as ue}from"./chunk-KZBAJFCV.js";import"./chunk-KINKBPPX.js";import{b as me,f as fe,i as A,n as he}from"./chunk-KVGQG43U.js";import"./chunk-N34ATN52.js";import{a as h}from"./chunk-ZC65Z3CK.js";import{a as c}from"./chunk-EI7MMDWY.js";import it from"node:path";import ot from"cross-spawn";import{createMessageConnection as at,CancellationTokenSource as ct,StreamMessageReader as lt}from"vscode-jsonrpc/node";import{URI as Ce}from"vscode-uri";import{watch as tt}from"node:fs";import{readdir as rt,stat as nt}from"node:fs/promises";import C from"node:path";import{URI as F}from"vscode-uri";var O=class{constructor(e,t,n){this.root=e;this.changed=t;this.failed=n}static{c(this,"LspFileWatchers")}registrations=new Map;disposed=!1;async register(e,t){let n=[];try{for(let s of t){let i=s.globPattern,o=typeof i=="string"?this.root:F.parse(typeof i.baseUri=="string"?i.baseUri:i.baseUri.uri).fsPath,l=typeof i=="string"?i:i.pattern,a=c(m=>C.matchesGlob(C.isAbsolute(l)?C.join(o,m):m,l),"matches"),p=new Set((await rt(o,{recursive:!0})).filter(a));if(this.disposed)throw new Error("Language server file watchers are disposed");let d=tt(o,{recursive:!0},(m,f)=>{!f||!a(f)||nt(C.join(o,f)).then(()=>{if(!this.registrations.get(e)?.includes(d))return;let g=p.has(f)?2:1;p.add(f),(s.kind??7)&(g===1?1:2)&&this.changed({uri:F.file(C.join(o,f)).toString(),type:g})},g=>{if(this.registrations.get(e)?.includes(d)){if(g.code!=="ENOENT"){this.failed(g);return}p.delete(f)&&(s.kind??7)&4&&this.changed({uri:F.file(C.join(o,f)).toString(),type:3})}})});d.on("error",this.failed),n.push(d)}}catch(s){for(let i of n)i.close();throw s}this.unregister(e),this.registrations.set(e,n)}unregister(e){for(let t of this.registrations.get(e)??[])t.close();this.registrations.delete(e)}dispose(){this.disposed=!0;for(let e of this.registrations.keys())this.unregister(e)}};import{StreamMessageWriter as st}from"vscode-jsonrpc/node";var T=class extends st{constructor(t,n){super(t);this.fail=n}static{c(this,"TransportWriter")}async write(t){try{await super.write(t)}catch(n){this.fail(n)}}};var _=class{static{c(this,"LspClient")}_process=null;_connection=null;_initialized=!1;_serverCapabilities=null;_disposed=!1;_crashed=!1;_stderr="";_fileWatchers;_handlers=new Map;_documentVersions=new Map;_documentContents=new Map;_diagnosticPublications=new Map;_diagnosticMode="unknown";_activeDiagnosticRequests=new Set;serverId;rootUri;_command;_args;_env;_initOptions;_settings;_timeoutMs;constructor(e){this.serverId=e.serverId,this.rootUri=e.rootUri,this._command=e.command,this._args=e.command.slice(1),this._env=e.env??{},this._initOptions=e.initOptions,this._settings=e.settings,this._timeoutMs=e.timeoutMs??3e4}get ready(){return this._initialized&&!this._disposed}get crashed(){return this._crashed}get pid(){return this._process?.pid??null}get commandName(){return me(this._command)}get diagnosticMode(){return this._diagnosticMode}setDiagnosticMode(e){this._diagnosticMode=e}get timeoutMs(){return this._timeoutMs}supportsCommand(e){let t=this._serverCapabilities?.executeCommandProvider;return Array.isArray(t?.commands)&&t.commands.includes(e)}get hasFoldingRangeCapability(){let e=this._serverCapabilities?.foldingRangeProvider;return e===!0||typeof e=="object"&&e!==null}documentVersion(e){return this._documentVersions.get(e)}diagnosticPublication(e){return this._diagnosticPublications.get(e)}beginDiagnosticRequest(e){this._activeDiagnosticRequests.add(e)}endDiagnosticRequest(e){this._activeDiagnosticRequests.delete(e)}hasActiveDiagnosticRequest(e){return this._activeDiagnosticRequests.has(e)}async start(){if(this._initialized)return;if(this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);let e=h(this._command[0]),t=Ce.parse(this.rootUri).fsPath,n=[{uri:this.rootUri,name:it.basename(t)||t}],s=ot(e,this._args,{stdio:["pipe","pipe","pipe"],cwd:t,env:he({command:this._command,env:this._env},t,process.env)});this._process=s;let i=pt(s);s.stdin?.on("error",()=>{}),s.stdout?.on("error",()=>{}),s.stderr?.on("error",()=>{}),this._stderr="",s.stderr?.setEncoding("utf8"),s.stderr?.on("data",a=>{this._stderr=(this._stderr+a).slice(-4096)}),s.on("error",a=>{("code"in a?a.code:void 0)!=="ENOENT"&&console.error(`[lsp] ${this.serverId}: spawn failed:`,a),this._crashed=!0,this._connection?.dispose(),this._connection=null,this._process=null}),s.on("exit",(a,p)=>{this._fileWatchers?.dispose(),!this._disposed&&a!==0&&a!==null&&(this._crashed=!0),this._connection?.dispose(),this._connection=null,this._process=null,this._initialized=!1}),await i;let o=at(new lt(h(s.stdout)),new T(h(s.stdin),a=>{this._connection!==o||this._disposed||(this._crashed=!0,this._initialized=!1,this._fileWatchers?.dispose(),o.dispose(),console.error(`[lsp] ${this.serverId}: transport write failed:`,a))}));this._connection=o,this._connection.onError(a=>{console.error(`[lsp] ${this.serverId}: connection error:`,a)}),this._fileWatchers=new O(t,a=>{this._sendNotification("workspace/didChangeWatchedFiles",{changes:[a]})},a=>console.error(`[lsp] ${this.serverId}: file watcher failed:`,a)),this._connection.onRequest("client/registerCapability",async a=>{for(let p of a.registrations)if(p.method!=="workspace/didChangeConfiguration"){if(p.method!=="workspace/didChangeWatchedFiles")throw new Error(`Unsupported dynamic capability: ${p.method}`);await this._fileWatchers?.register(p.id,p.registerOptions?.watchers??[])}return null}),this._connection.onRequest("client/unregisterCapability",a=>{for(let p of a.unregisterations)this._fileWatchers?.unregister(p.id);return null}),this._connection.onRequest("window/workDoneProgress/create",()=>null),this._connection.onRequest("workspace/configuration",a=>a.items.map(p=>{let d=this._settings??null;for(let m of p.section?.split(".").filter(Boolean)??[])d=typeof d=="object"&&d!==null?d[m]??null:null;return d})),this._connection.listen(),this._connection.onNotification((a,...p)=>{if(a==="textDocument/publishDiagnostics"){let d=p[0];d&&typeof d.uri=="string"&&Array.isArray(d.diagnostics)&&this._documentVersions.has(d.uri)&&(d.version===void 0||d.version===this.documentVersion(d.uri))&&this._diagnosticPublications.set(d.uri,{diagnostics:d.diagnostics,...typeof d.version=="number"&&{version:d.version}})}for(let d of this._handlers.get(a)??[])d(p[0])}),this._connection.onRequest("workspace/workspaceFolders",()=>n);let l=await xe(this._connection.sendRequest("initialize",{processId:process.pid,rootUri:this.rootUri,workspaceFolders:n,capabilities:{workspace:{applyEdit:!1,configuration:!0,workspaceFolders:!0,didChangeWatchedFiles:{dynamicRegistration:!0,relativePatternSupport:!0},symbol:{dynamicRegistration:!1}},textDocument:{synchronization:{didOpen:!0,didChange:!0,didClose:!0},publishDiagnostics:{relatedInformation:!0},diagnostic:{dynamicRegistration:!1,relatedDocumentSupport:!1},documentSymbol:{hierarchicalDocumentSymbolSupport:!0},foldingRange:{lineFoldingOnly:!0}}},initializationOptions:this._initOptions}),this._timeoutMs,`[lsp] ${this.serverId}: initialize timed out`).catch(a=>{let p=this._stderr.trim();throw p?new Error(`[lsp] ${this.serverId}: ${p}`,{cause:a}):a});if(await this._connection.sendNotification("initialized",{capabilities:l.capabilities}),this._settings!==void 0&&await this._connection.sendNotification("workspace/didChangeConfiguration",{settings:this._settings}),this._crashed)throw new Error(`[lsp] ${this.serverId}: transport failed during initialization`);this._initialized=!0,this._serverCapabilities=l.capabilities,this._diagnosticMode=l.capabilities.diagnosticProvider?"pull":"push"}touch(){}async restart(){this._fileWatchers?.dispose(),this._connection?.dispose(),this._connection=null,this._process=null,this._initialized=!1,this._crashed=!1,this._disposed=!1,this._documentVersions.clear(),this._documentContents.clear(),this._diagnosticPublications.clear(),this._diagnosticMode="unknown",this._activeDiagnosticRequests.clear(),this._serverCapabilities=null,await this.start()}async sendRequest(e,t,n){if(this._assertReady(),n?.throwIfAborted(),!n)return h(this._connection).sendRequest(e,t);let s=new ct,i;try{let o=h(this._connection).sendRequest(e,t,s.token);return await Promise.race([o,new Promise((l,a)=>{i=c(()=>{s.cancel(),a(n.reason)},"onAbort"),n.addEventListener("abort",i,{once:!0})})])}finally{i&&n.removeEventListener("abort",i),s.dispose()}}sendNotification(e,t){this._assertReady(),this._sendNotification(e,t)}_sendNotification(e,t){let n=this._connection;n&&n.sendNotification(e,t).catch(s=>{this._connection!==n||this._disposed||(this._crashed=!0,this._initialized=!1,this._fileWatchers?.dispose(),n.dispose(),console.error(`[lsp] ${this.serverId}: notification ${e} failed:`,s))})}onNotification(e,t){let n=this._handlers.get(e)??[];return n.push(t),this._handlers.set(e,n),()=>{let s=n.indexOf(t);s!==-1&&n.splice(s,1)}}toUri(e){return e.startsWith("file://")?e:Ce.file(e).toString()}openDocument(e,t,n,s=1){let i=this._documentVersions.get(e);if(i!==void 0){this.changeDocument(e,t,Math.max(s,i+1));return}this._diagnosticPublications.delete(e),this.sendNotification("textDocument/didOpen",{textDocument:{uri:e,languageId:n,version:s,text:t}}),this._documentVersions.set(e,s),this._documentContents.set(e,t)}syncDocument(e,t,n,s=!1){if(this._documentContents.get(e)===t)return;let i=this._documentVersions.get(e);i===void 0?this.openDocument(e,t,n):this.changeDocument(e,t,i+1);let o=this._serverCapabilities?.textDocumentSync,l=typeof o=="object"&&o!==null?o.save:void 0;s&&l&&this.sendNotification("textDocument/didSave",{textDocument:{uri:e},...typeof l=="object"&&l.includeText&&{text:t}})}changeDocument(e,t,n){let s=this._documentVersions.get(e),i=Math.max(n,(s??0)+1);this._diagnosticPublications.delete(e),this.sendNotification("textDocument/didChange",{textDocument:{uri:e,version:i},contentChanges:[{text:t}]}),this._documentVersions.set(e,i),this._documentContents.set(e,t)}closeDocument(e){this.sendNotification("textDocument/didClose",{textDocument:{uri:e}}),this._documentVersions.delete(e),this._documentContents.delete(e),this._diagnosticPublications.delete(e)}async shutdown(){if(!this._disposed){if(this._disposed=!0,this._fileWatchers?.dispose(),this._connection&&this._initialized)try{await xe(this._connection.sendRequest("shutdown"),Math.min(this._timeoutMs,1e3),`[lsp] ${this.serverId}: shutdown timed out`),await this._connection.sendNotification("exit").catch(()=>{})}catch{}this._connection?.dispose(),this._connection=null,this._process&&!this._process.killed&&(this._process.kill("SIGTERM"),setTimeout(()=>{this._process&&!this._process.killed&&this._process.kill("SIGKILL")},2e3).unref()),this._initialized=!1,this._documentVersions.clear(),this._documentContents.clear(),this._diagnosticPublications.clear(),this._diagnosticMode="unknown",this._activeDiagnosticRequests.clear(),this._serverCapabilities=null}}dispose(){this.shutdown()}_assertReady(){if(this._disposed)throw new Error(`[lsp] ${this.serverId}: disposed`);if(this._crashed)throw new Error(`[lsp] ${this.serverId}: crashed \u2014 call restart()`);if(!this._initialized)throw new Error(`[lsp] ${this.serverId}: not started \u2014 call start()`);if(!this._connection)throw new Error(`[lsp] ${this.serverId}: connection lost`)}};function pt(r){return new Promise((e,t)=>{let n=c(()=>{r.off("spawn",s),r.off("error",i)},"cleanup"),s=c(()=>{n(),e()},"onSpawn"),i=c(o=>{n(),t(o)},"onError");r.once("spawn",s),r.once("error",i)})}c(pt,"waitForSpawn");function xe(r,e,t){return new Promise((n,s)=>{let i=setTimeout(()=>{s(new Error(t))},e);r.then(o=>{clearTimeout(i),n(o)}).catch(o=>{clearTimeout(i),s(o instanceof Error?o:new Error(String(o)))})})}c(xe,"withTimeout");import{readFile as Ee}from"node:fs/promises";import{URI as Ie}from"vscode-uri";var I={Error:1,Warning:2,Information:3,Hint:4};var De={command:"typescript.tsserverRequest",async request(r,e,t){return(await Promise.all(["syntacticDiagnosticsSync","semanticDiagnosticsSync","suggestionDiagnosticsSync"].map(async s=>{let i=await r.sendRequest("workspace/executeCommand",{command:"typescript.tsserverRequest",arguments:[s,{file:e,includeLinePosition:!0},{isAsync:!1,expectsResult:!0}]},t);if(!W(i)||i.success!==!0||!Array.isArray(i.body))throw new Error(`Invalid completed TypeScript diagnostic report: ${s}`);return i.body.map(dt)}))).flat()}};function q(r){return r.supportsCommand(De.command)?De:void 0}c(q,"completedDiagnosticAdapter");function dt(r){if(!W(r)||typeof r.message!="string"||typeof r.code!="number"&&typeof r.code!="string"||!W(r.startLocation)||!Number.isInteger(r.startLocation.line)||!Number.isInteger(r.startLocation.offset)||Number(r.startLocation.line)<1||Number(r.startLocation.offset)<1||!["error","warning","suggestion","message"].includes(String(r.category)))throw new Error("Invalid TypeScript diagnostic entry");return{code:String(r.code),message:r.message,line:Number(r.startLocation.line),column:Number(r.startLocation.offset),severity:r.category==="error"?"error":r.category==="warning"?"warning":r.category==="suggestion"?"hint":"info"}}c(dt,"convertTypeScriptDiagnostic");function W(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}c(W,"isRecord");async function j(r,e,t,n={}){let s=new AbortController,i=AbortSignal.any([s.signal,...n.signal?[n.signal]:[]]),o=setTimeout(()=>s.abort(new Error(`[lsp] ${r.serverId}: diagnostics timed out for ${e}`)),r.timeoutMs);try{return await ut(r,e,t,n.content,i)}finally{clearTimeout(o)}}c(j,"requestDiagnostics");async function ut(r,e,t,n,s){if(s.throwIfAborted(),r.diagnosticMode!=="push"){let a=r.documentVersion(e);try{let p=await r.sendRequest("textDocument/diagnostic",{textDocument:{uri:e}},s);if(p.kind!=="full"||!Array.isArray(p.items))throw new Error("Invalid full diagnostic report");if(r.documentVersion(e)!==a)throw new Error("Document changed during diagnostic request");return r.setDiagnosticMode("pull"),je(p.items,!1,!0)}catch(p){if(!gt(p))throw p;r.setDiagnosticMode("push")}}let i=q(r);if(i){r.documentVersion(e)===void 0&&r.syncDocument(e,n??await Ee(Ie.parse(e).fsPath,"utf8"),t??"plaintext");let a=r.documentVersion(e),p=await i.request(r,e,s);if(s.throwIfAborted(),r.documentVersion(e)!==a)throw new Error("Document changed during diagnostic request");return{diagnostics:p,syntaxErrors:[],otherDiagnostics:p,unversioned:!1,complete:!0}}s.throwIfAborted();let o=r.documentVersion(e)!==void 0,l=o?void 0:n??await Ee(Ie.parse(e).fsPath,"utf8");s.throwIfAborted(),r.beginDiagnosticRequest(e);try{return await new Promise((a,p)=>{let d=r.documentVersion(e)??1,m=c(w=>{let v=w;v.uri!==e||!Array.isArray(v.diagnostics)||v.version!==void 0&&v.version!==d||r.documentVersion(e)===d&&(b(),a(je(v.diagnostics,v.version===void 0)))},"receive"),f=r.onNotification("textDocument/publishDiagnostics",m),g=c(()=>{b(),p(s.reason)},"onAbort");function b(){f(),s.removeEventListener("abort",g)}c(b,"cleanup"),s.addEventListener("abort",g,{once:!0});try{o||r.syncDocument(e,l??"",t??"plaintext");let w=r.diagnosticPublication(e);w&&m({uri:e,...w})}catch(w){b(),p(w)}})}finally{r.endDiagnosticRequest(e)}}c(ut,"requestCurrentDiagnostics");function z(r){return{code:String(r.code??"LSP"),message:r.message,line:r.range.start.line+1,column:r.range.start.character+1,severity:r.severity===I.Warning?"warning":r.severity===I.Information?"info":r.severity===I.Hint?"hint":"error"}}c(z,"toDiagnostic");function je(r,e,t=!1){let n=r.map(z);return{diagnostics:n,syntaxErrors:[],otherDiagnostics:n,unversioned:e,complete:t}}c(je,"classify");function gt(r){return r!==null&&typeof r=="object"&&"code"in r&&r.code===-32601}c(gt,"isMethodNotFound");var mt={1:"File",2:"Module",3:"Namespace",4:"Package",5:"Class",6:"Method",7:"Property",8:"Field",9:"Constructor",10:"Enum",11:"Interface",12:"Function",13:"Variable",14:"Constant",15:"String",16:"Number",17:"Boolean",18:"Array",19:"Object",20:"Key",21:"Null",22:"EnumMember",23:"Struct",24:"Event",25:"Operator",26:"TypeParameter"};function L(r){return mt[r]??`SymbolKind(${r})`}c(L,"symbolKindName");async function H(r,e){return await r.sendRequest("textDocument/documentSymbol",{textDocument:{uri:e}})??[]}c(H,"requestDocumentSymbols");async function U(r,e,t=100){return(await r.sendRequest("workspace/symbol",{query:e})??[]).slice(0,t)}c(U,"requestWorkspaceSymbols");import yt from"node:path";import{URI as vt}from"vscode-uri";import{readdir as ft}from"node:fs/promises";import N from"node:path";import{URI as G}from"vscode-uri";function Me(r,e){let t=c(n=>typeof n=="string"?n.replaceAll("{project}",()=>e):Array.isArray(n)?n.map(t):n!==null&&typeof n=="object"?Object.fromEntries(Object.entries(n).map(([s,i])=>[s,t(i)])):n,"expand");return Object.fromEntries(Object.entries(r).map(([n,s])=>[n,t(s)]))}c(Me,"resolveInitializationOptions");var k=class r{constructor(e){this._registry=e}static{c(this,"LspManager")}_clients=new Map;_clientStarts=new Map;_openDocs=new Set;_pushUnsubscribers=new Map;_pushHandlers=new Set;_pushFingerprints=new Map;_disposed=!1;static _instance=null;static getInstance(){if(!r._instance)throw new Error("[lsp] LspManager not initialized");return r._instance}static getInstanceOrNull(){return r._instance}static init(e){let t=r._instance;return t?._disposed?(t._registry=e,t._disposed=!1,t):(r._instance=new r(e),r._instance)}static async resetForTest(){r._instance&&(await r._instance.shutdownAll(),r._instance=null)}get clientCount(){return this._clients.size}onPushDiagnostics(e){return this._pushHandlers.add(e),()=>this._pushHandlers.delete(e)}async getOrStart(e,t,n){if(this._disposed)return null;let s=this._registry.resolve(e),i=n==="symbols"?s[0]:s.find(m=>m.config.capabilities.includes(n));if(!i)return null;let o=G.file(t).toString(),l=`${i.serverId}:${o}`,a=this._clientStarts.get(l);if(a)return a;let p=this._clients.get(l);if(p?.ready)return p;let d=this._startClient(l,o,i,p);this._clientStarts.set(l,d);try{return await d}finally{this._clientStarts.get(l)===d&&this._clientStarts.delete(l)}}async _startClient(e,t,n,s){let i=s??new _({serverId:n.serverId,rootUri:t,command:n.config.command,...n.config.env&&{env:n.config.env},...n.config.initializationOptions&&{initOptions:Me(n.config.initializationOptions,G.parse(t).fsPath)},...n.config.settings&&{settings:n.config.settings},...n.config.timeoutMs&&{timeoutMs:n.config.timeoutMs}});try{s?await s.restart():await i.start()}catch(o){throw await i.shutdown().catch(()=>{}),o}if(this._disposed)throw await i.shutdown(),new Error(`[lsp] ${n.serverId}: manager disposed during startup`);return this._clients.set(e,i),this._subscribeToPushDiagnostics(e,i),i}async getWorkspaceClients(e,t="symbols"){let n=new Set;for(let s of this._registry.knownExtensions)try{let i=await this.getOrStart(s,e,t);i&&n.add(i)}catch{}return[...n]}async prepareWorkspaceSymbols(e){let t=await this.getWorkspaceClients(e),n=new Set(this._registry.knownExtensions),s=new Set([".git",".cache","node_modules","dist","build"]),i=c(async o=>{if(n.size===0)return;let l;try{l=await ft(o,{withFileTypes:!0})}catch{return}for(let a of l){if(n.size===0)return;if(a.isDirectory()){s.has(a.name)||await i(N.join(o,a.name));continue}if(!a.isFile())continue;let p=N.extname(a.name).toLowerCase();if(!n.has(p))continue;let d=N.join(o,a.name);await this.openFile(d,e,"symbols").catch(()=>null)&&n.delete(p)}},"visit");return await i(e),t}hasServerFor(e){return this._registry.resolve(e).length>0}languageId(e){return this._registry.languageId(e)}isOpen(e){return this._openDocs.has(e)}async openFile(e,t,n="diagnostics"){let s=N.resolve(t,e),i=await this.getOrStart(s,t,n);if(!i)return null;let o=i.toUri(s),a=this._registry.resolve(s)[0]?.languageId??"plaintext";try{let{readFile:p}=await import("node:fs/promises"),d=await p(s,"utf8");i.openDocument(o,d,a),this._openDocs.add(o)}catch{}return{client:i,uri:o,languageId:a}}_subscribeToPushDiagnostics(e,t){if(this._pushUnsubscribers.has(e))return;let n=t.onNotification("textDocument/publishDiagnostics",s=>{let i=ht(s);if(!i||t.hasActiveDiagnosticRequest(i.uri))return;let o=t.documentVersion(i.uri);if(i.version!==void 0&&o!==void 0&&i.version<o)return;let l=`${e}:${i.uri}`,a=i.diagnostics.map(z),p=JSON.stringify([i.version,o,a]);if(this._pushFingerprints.get(l)===p)return;this._pushFingerprints.set(l,p);let d={cwd:G.parse(t.rootUri).fsPath,serverId:t.serverId,uri:i.uri,diagnostics:a,...i.version!==void 0&&{version:i.version}};for(let m of this._pushHandlers)m(d)});this._pushUnsubscribers.set(e,n)}async shutdownAll(){this._disposed=!0,await Promise.allSettled(this._clientStarts.values());let e=[...this._clients.values()];await Promise.all(e.map(t=>t.shutdown()));for(let t of this._pushUnsubscribers.values())t();this._pushUnsubscribers.clear(),this._clientStarts.clear(),this._pushFingerprints.clear(),this._pushHandlers.clear(),this._clients.clear()}dispose(){this.shutdownAll()}};function ht(r){if(r===null||typeof r!="object")return;let e=r;if(!(typeof e.uri!="string"||!Array.isArray(e.diagnostics)))return{uri:e.uri,diagnostics:e.diagnostics,...typeof e.version=="number"&&{version:e.version}}}c(ht,"parsePushNotification");async function M(r,e,t){return await r.sendRequest("textDocument/references",{textDocument:{uri:e},position:t,context:{includeDeclaration:!0}})??[]}c(M,"requestReferences");async function B(r,e,t){let n=await r.sendRequest("textDocument/prepareCallHierarchy",{textDocument:{uri:e},position:t}),s=n?.[0];if(!s)return{items:[],incoming:[],outgoing:[]};let[i,o]=await Promise.all([r.sendRequest("callHierarchy/incomingCalls",{item:s}).catch(()=>[]),r.sendRequest("callHierarchy/outgoingCalls",{item:s}).catch(()=>[])]);return{items:n,incoming:i??[],outgoing:o??[]}}c(B,"requestCallHierarchy");function Ae(r){try{return vt.parse(r).fsPath}catch{return r.startsWith("file://")?decodeURIComponent(r.slice(7)):r}}c(Ae,"uriToFilePath");function $e(r,e,t,n,s){let i=Ae(t),o=yt.relative(r,i);return{filePath:o.startsWith("..")?i:o,lineNumber:n+1,column:s+1,kind:String(e.kind),name:e.name}}c($e,"toHit");async function J(r,e,t,n){if(n?.aborted)throw new Error("Operation aborted");let s=k.getInstance(),i=await s.prepareWorkspaceSymbols(e),o=[];for(let p of i){if(n?.aborted)throw new Error("Operation aborted");try{o.push(...await U(p,r,t))}catch{}}let l=new Set,a=[];for(let p of o){if(n?.aborted)throw new Error("Operation aborted");if(a.length>=t)break;let d=p.location,m=$e(e,p,d.uri,d.range.start.line,d.range.start.character),f=`${m.filePath}:${m.lineNumber}:${m.column}`;if(l.has(f)||(l.add(f),a.push(m)),a.length>=t)break;let g=Ae(d.uri),b=await s.openFile(g,e,"symbols").catch(()=>null);if(!b)continue;let w=await M(b.client,b.uri,d.range.start).catch(()=>[]);for(let v of w){let $=$e(e,p,v.uri,v.range.start.line,v.range.start.character),ie=`${$.filePath}:${$.lineNumber}:${$.column}`;if(l.has(ie)||(l.add(ie),a.push($)),a.length>=t)break}}return a}c(J,"searchSymbols");import{readFile as bt}from"node:fs/promises";import x from"node:path";import{fileURLToPath as wt}from"node:url";var Lt={failureLabel:"SYMBOL_READ_FAILED",emptyReason:"no symbol source was produced."},K=10,X=5,D=10;async function Z(r,e,t,n,s){P(s);let i=await ne(r,e,n),o=re(i.symbols,t,i.displayPath),l=await Ct(i.filePath);P(s);let a=o.range.start.line+1,p=Math.min(o.range.end.line+1,l.lines.length),d=l.lines.slice(Math.max(0,a-1),Math.max(0,p)).map((f,g)=>{let b=a+g;return ce({content:f,sourceLine:{source:i.filePath,lineNumber:b,content:f}})}),m={path:i.displayPath,heading:`symbol: ${R(o.selector)}`,details:[`defined in: ${i.displayPath}:${a}-${p} (${L(o.kind)})`],startLine:a,endLine:p,totalLines:l.lines.length,renderedLines:d};return le([m],Lt)}c(Z,"readLspSymbolBody");async function ee(r,e,t,n,s){P(s);let i=await ne(r,e,n),o=re(i.symbols,t,i.displayPath),l=await Fe(i,o,s),a=new V(n);return await St(i,o,l,a)}c(ee,"readLspSymbolGraph");async function te(r,e,t,n){P(n);let s=await ne(r,e,t),i=new V(t),o=[`## file graph: ${s.displayPath}`,`Top-level declarations: ${s.symbols.length}`];for(let l of s.symbols){P(n);let a=await Fe(s,l,n);o.push("",...await Pt(s,l,a,i))}return o.join(`
|
|
2
|
+
`)}c(te,"readLspFileGraph");function re(r,e,t){if(e.length===0)throw new TypeError("A symbol selector must contain at least one segment.");if(e.length===1){let i=Ve(r,h(e[0]));if(i.length===1)return h(i[0]);throw i.length>1?new Error(`Symbol selector "${R(e)}" is ambiguous in ${t}; use parent/child.`):Oe(e,t)}let n=r,s;for(let i of e){let o=n.filter(l=>l.name===i);if(o.length===0)throw Oe(e,t);if(o.length>1)throw new Error(`Symbol selector "${R(e)}" is ambiguous at "${i}" in ${t}.`);s=h(o[0]),n=s.children}return h(s)}c(re,"resolveLspCodeSymbol");async function ne(r,e,t){let n=x.isAbsolute(e)?x.normalize(e):x.resolve(t,e),s=await r.openFile(n,t,"symbols");if(!s)throw new Error(`No LSP server with symbol support is configured for ${Q(n,t)}.`);let i=await H(s.client,s.uri),o=qe(i).sort(Ne);return{client:s.client,uri:s.uri,filePath:n,displayPath:Q(n,t),symbols:o}}c(ne,"openCodeDocument");function qe(r,e=[]){return r.flatMap(t=>{let n=t.selectionRange??t.range;if(!n)return[];let s=t.range??n,i=[...e,t.name];return[{name:t.name,kind:t.kind,range:s,selectionRange:n,selector:i,children:qe(t.children??[],i).sort(Ne)}]})}c(qe,"normalizeDocumentSymbols");function Ne(r,e){return r.range.start.line-e.range.start.line||r.range.start.character-e.range.start.character||r.name.localeCompare(e.name)}c(Ne,"compareSymbols");function Ve(r,e){return r.flatMap(t=>[...t.name===e?[t]:[],...Ve(t.children,e)])}c(Ve,"collectNamedSymbols");function Oe(r,e){return new Error(`Symbol "${R(r)}" was not found in ${e}.`)}c(Oe,"symbolNotFound");async function Fe(r,e,t){let n=e.selectionRange.start,[s,i]=await Promise.all([Te(M(r.client,r.uri,n),[],t),Te(B(r.client,r.uri,n),{items:[],incoming:[],outgoing:[]},t)]);return P(t),{references:s,calls:i}}c(Fe,"queryRelations");async function Te(r,e,t){try{let n=await r;return P(t),n}catch(n){if(t?.aborted===!0)throw ze(t,n);return e}}c(Te,"optionalRequest");async function St(r,e,t,n){let s=R(e.selector),i=await n.line(r.uri,e.selectionRange.start.line+1);return[`## graph: ${s}`,`Definition: ${r.displayPath} ${i} (${L(e.kind)})`,`Source: ${E("graph",r.displayPath,e.selector)}`,"",...await Rt(t.references,n),"",...await _t(t.calls.incoming,n),"",...await kt(t.calls.outgoing,n)].join(`
|
|
3
|
+
`)}c(St,"formatSymbolGraph");async function Rt(r,e){let t=We(r),n=[`References: ${r.length} in ${t.length} file(s)`];for(let[s,i]of t.slice(0,K)){n.push(`- ${e.display(s)} (${i.length})`);for(let o of i.slice(0,X))n.push(` - ${await e.line(s,o.range.start.line+1)}`);i.length>X&&n.push(` - ... ${i.length-X} more`)}return t.length>K&&n.push(`- ... ${t.length-K} more file(s)`),n}c(Rt,"formatReferences");async function _t(r,e){let t=[`Incoming calls: ${r.length}`];for(let n of r.slice(0,D)){let s=n.fromRanges[0]?.start.line??n.from.selectionRange.start.line,i=await e.line(n.from.uri,s+1);t.push(`- ${L(n.from.kind)} ${n.from.name} \u2014 ${e.display(n.from.uri)} ${i}`)}return r.length>D&&t.push(`- ... ${r.length-D} more`),t}c(_t,"formatIncomingCalls");async function kt(r,e){let t=[`Outgoing calls: ${r.length}`];for(let n of r.slice(0,D)){let s=await e.line(n.to.uri,n.to.selectionRange.start.line+1);t.push(`- ${L(n.to.kind)} ${n.to.name} \u2014 ${e.display(n.to.uri)} ${s}`)}return r.length>D&&t.push(`- ... ${r.length-D} more`),t}c(kt,"formatOutgoingCalls");async function Pt(r,e,t,n){let s=L(e.kind),i=await n.line(r.uri,e.selectionRange.start.line+1),o=We(t.references).map(([d,m])=>`${n.display(d)} (${m.length})`),l=t.calls.incoming.map(d=>`${d.from.name} (${n.display(d.from.uri)})`),a=t.calls.outgoing.map(d=>`${d.to.name} (${n.display(d.to.uri)})`),p=[`### ${s} ${e.name}`,`Selector: ${R(e.selector)}`,`Definition: ${i}`,`Used by: ${Y(o)}`,`Incoming calls: ${Y(l)}`,`Outgoing calls: ${Y(a)}`];if(e.children.length>0){p.push("Members:");for(let d of e.children){let m=E("graph",r.displayPath,d.selector);p.push(`- ${L(d.kind)} ${d.name} \u2014 ${m}`)}}return p}c(Pt,"formatFileGraphSymbol");function Y(r,e=5){if(r.length===0)return"none";let t=r.slice(0,e).join(", ");return r.length>e?`${t}, ... ${r.length-e} more`:t}c(Y,"summarize");function We(r){let e=new Map;for(let t of r){let n=e.get(t.uri)??[];n.push(t),e.set(t.uri,n)}return[...e].map(([t,n])=>[t,n.sort((s,i)=>s.range.start.line-i.range.start.line||s.range.start.character-i.range.start.character)]).sort(([t],[n])=>t.localeCompare(n))}c(We,"groupLocationsByUri");async function Ct(r){let e=await bt(r);if(e.byteLength>256*1024)throw new Error(`File exceeds the 262144-byte code-view limit: ${r}`);if(e.includes(0))throw new Error(`File appears to be binary and cannot be read as text: ${r}`);let t=e.toString("utf8").replaceAll(`\r
|
|
4
|
+
`,`
|
|
5
|
+
`),n=t.endsWith(`
|
|
6
|
+
`)?t.slice(0,-1):t,s=n.length===0?[]:n.split(`
|
|
7
|
+
`);return{content:t,lines:s}}c(Ct,"readTextFile");var V=class{static{c(this,"LocationPresenter")}#e;constructor(e){this.#e=e}display(e){return Q(xt(e),this.#e)}line(e,t){return Promise.resolve(String(t))}};function xt(r){if(!r.startsWith("file://"))return r;try{return wt(r)}catch{return decodeURIComponent(r.slice(7))}}c(xt,"filePathFromUri");function Q(r,e){let t=x.relative(e,r);return t.length===0||t.startsWith("..")||x.isAbsolute(t)?r:t.replaceAll(x.sep,"/")}c(Q,"displayFilePath");function P(r){if(r?.aborted===!0)throw ze(r)}c(P,"throwIfAborted");function ze(r,e){if(r.reason instanceof Error)return r.reason;if(e instanceof Error)return e;let t=new Error("The operation was aborted");return t.name="AbortError",t}c(ze,"abortReason");function se(r){let e=null;return{kind:"compiler",name:"lsp",priority:100,extensions:["*"],detect:c(()=>Promise.resolve(!0),"detect"),async compile({filePath:t},n){let s=await Dt(t,n,r);if(!s)return Et();let{client:i,diagnostics:o,syntaxErrors:l,otherDiagnostics:a}=s;return e=i,{ok:!o.some(p=>p.severity==="error"),diagnostics:o,syntaxErrors:l,otherDiagnostics:a}},async restart(){e&&(await e.restart(),e=null)}}}c(se,"createLspCompiler");async function Dt(r,e,t){let n=await t.openFile(r,e.cwd);if(!n)return null;let s=await j(n.client,n.uri,n.languageId);return{client:n.client,...s}}c(Dt,"openAndDiagnose");function Et(){return{ok:!0,diagnostics:[],syntaxErrors:[],otherDiagnostics:[]}}c(Et,"skipOk");import y from"node:path";import{existsSync as It}from"node:fs";function He(r){let e=new Map,t=new Map;for(let[n,s]of Object.entries(r))for(let[i,o]of Object.entries(s.languages))for(let l of o.extensions){let a=l.toLowerCase(),p=e.get(a);if(p!==void 0&&p!==i)throw new Error(`[lsp] extension conflict: "${a}" claimed by "${p}" and "${i}"`);e.set(a,i);let d=t.get(a)??[];d.push(n),t.set(a,d)}return{extToLanguageId:e,extToServerIds:t}}c(He,"buildLanguageLookup");var S=class r{constructor(e,t,n){this._projectRoot=n;this._entries=e;let s=e.filter(i=>i.layer!=="built-in"||t.has(i.id));this._servers=Object.fromEntries(s.map(i=>[i.id,i.config])),this._lookup=He(this._servers)}static{c(this,"LspServerRegistry")}_servers;_entries;_lookup;static async fromPackageDir(e,t={}){let n=await fe(e,"lsp-servers",o=>jt(o).servers,t),s=t.environment??process.env,i=await Promise.all(n.entries.filter(o=>o.layer==="built-in").map(async o=>({id:o.id,available:await A(o.config,e,s)})));return new r(n.entries,new Set(i.filter(o=>o.available).map(o=>o.id)),y.resolve(e))}static fromConfig(e,t=process.cwd()){return new r(Object.entries(e.servers).map(([n,s])=>({id:n,config:s,layer:"project",sourcePath:"<memory>"})),new Set,y.resolve(t))}resolve(e){let t=y.basename(e),n=y.extname(e)||(e.startsWith(".")?e:`.${e}`),s=c(o=>process.platform==="win32"?o.toLowerCase():o,"normalizeName"),i=[];for(let o of this._entries)if(this._servers[o.id]&&!(o.config.requireRootMarker&&!this.hasRootMarker(e,o.config.rootMarkers))){for(let[l,a]of Object.entries(o.config.languages))if(a.extensions.some(p=>p.toLowerCase()===n.toLowerCase())||a.fileNames?.some(p=>s(p)===s(t))){i.push({serverId:o.id,config:o.config,languageId:l,layer:o.layer,sourcePath:o.sourcePath});break}}return i}hasRootMarker(e,t){let n=y.dirname(y.resolve(this._projectRoot,e));for(e.startsWith(".")&&!e.includes(y.sep)&&(n=this._projectRoot);;){let s=y.relative(this._projectRoot,n);if(s===".."||s.startsWith(`..${y.sep}`)||y.isAbsolute(s))return!1;if(t.some(i=>It(y.join(n,i))))return!0;if(n===this._projectRoot)return!1;n=y.dirname(n)}}get servers(){return this._servers}get entries(){return this._entries}get knownExtensions(){return new Set(this._lookup.extToLanguageId.keys())}languageId(e){return this.resolve(e)[0]?.languageId??e.slice(1)}};function jt(r){if(typeof r!="object"||r===null||Array.isArray(r))throw new Error("LSP config must be an object");let e=r;if(e.version!==1)throw new Error("LSP config version must be 1");if(typeof e.servers!="object"||e.servers===null||Array.isArray(e.servers))throw new Error("LSP config servers must be an object");for(let[t,n]of Object.entries(e.servers)){if(typeof n!="object"||n===null||Array.isArray(n))throw new Error(`LSP server ${t} must be an object`);let s=n;if(!Array.isArray(s.command)||s.command.length===0||s.command.some(i=>typeof i!="string"||i.length===0))throw new Error(`LSP server ${t}.command must be a non-empty string array`);if(s.transport!==void 0&&s.transport!=="stdio")throw new Error(`LSP server ${t} only supports stdio transport`);if(!Array.isArray(s.rootMarkers)||s.rootMarkers.some(i=>typeof i!="string"))throw new Error(`LSP server ${t}.rootMarkers must be a string array`);if(s.requireRootMarker!==void 0&&typeof s.requireRootMarker!="boolean")throw new TypeError(`LSP server ${t}.requireRootMarker must be a boolean`);if(s.requireRootMarker&&s.rootMarkers.length===0)throw new Error(`LSP server ${t}.requireRootMarker requires rootMarkers`);if(typeof s.languages!="object"||s.languages===null||Array.isArray(s.languages))throw new Error(`LSP server ${t}.languages must be an object`);for(let[i,o]of Object.entries(s.languages)){let l=typeof o=="object"&&o!==null&&!Array.isArray(o)?o.extensions:void 0;if(!Array.isArray(l)||l.length===0||l.some(p=>typeof p!="string"))throw new Error(`LSP server ${t} language ${i} requires extensions`);let a=o.fileNames;if(a!==void 0&&(!Array.isArray(a)||a.some(p=>typeof p!="string"||p.length===0||/[/\\]/u.test(p))))throw new Error(`LSP server ${t} language ${i}.fileNames must contain basenames`)}if(!Array.isArray(s.capabilities))throw new TypeError(`LSP server ${t}.capabilities must be an array`)}return r}c(jt,"parseLspConfig");function Ue(r){return Be("symbol","lsp-symbol",r,async e=>await Z(e.manager,e.filePath,h(e.selector),e.cwd,e.signal))}c(Ue,"createLspSymbolResolver");function Ge(r){return Be("graph","lsp-graph",r,async e=>e.selector===void 0?await te(e.manager,e.filePath,e.cwd,e.signal):await ee(e.manager,e.filePath,e.selector,e.cwd,e.signal))}c(Ge,"createLspGraphResolver");function Be(r,e,t,n){return{id:e,tryResolve(s,i){return Promise.resolve(Mt(s,i,r,t,n))}}}c(Be,"createCodeViewResolver");function Mt(r,e,t,n,s){let i;try{i=oe(r,t)}catch(a){return{kind:"failed",error:a}}if(i===void 0)return{kind:"not-handled"};let o;try{o=ae(i.path,e.cwd)}catch(a){return{kind:"failed",error:a}}return{kind:"resolved",resource:{source:E(t,o,i.selector),async read(a){let p=await n(e.cwd),d=await s({manager:p,filePath:o,cwd:e.cwd,...$t(i.selector),...At(a.signal)});return[typeof d=="string"?{type:"text",text:d}:d]}}}}c(Mt,"resolveCodeViewSource");function $t(r){return r===void 0?{}:{selector:r}}c($t,"optionalSelector");function At(r){return r===void 0?{}:{signal:r}}c(At,"optionalSignal");function Ke(r){return{id:"lsp",async diagnose(e,t){let n=await r(t.cwd);t.signal.throwIfAborted();let s=await n.getOrStart(e,t.cwd,"diagnostics");if(t.signal.throwIfAborted(),!s)return{status:"unavailable",diagnostics:[],reason:"No language server configured for this file"};let i=s.toUri(e),o=n.languageId(e);s.syncDocument(i,t.content,o,!0);let l=s.documentVersion(i),a={active:!0,queued:!1},p=c(()=>!t.signal.aborted&&s.documentVersion(i)===l,"current"),d=c(()=>j(s,i,o,{signal:t.signal,content:t.content}),"request"),m=c(async()=>{if(a.queued=!0,!a.active){a.active=!0;try{for(;a.queued&&p();){a.queued=!1;let g=await d();p()&&t.publish(Je(g,s.commandName))}}catch(g){p()&&t.publish({status:"unavailable",diagnostics:[],reason:g instanceof Error?g.message:String(g),source:s.commandName})}finally{a.active=!1}}},"refresh"),f=n.onPushDiagnostics(g=>{!p()||g.uri!==i||g.serverId!==s.serverId||g.cwd!==t.cwd||g.version!==void 0&&g.version!==l||(s.diagnosticMode==="pull"||q(s)?m():t.publish({status:"snapshot",diagnostics:g.diagnostics,source:s.commandName,reason:Xe(g.version===void 0)}))});t.signal.addEventListener("abort",f,{once:!0});try{let g=await d();return l=s.documentVersion(i),Je(g,s.commandName)}catch(g){throw a.queued=!1,f(),t.signal.removeEventListener("abort",f),g}finally{a.active=!1,a.queued&&p()&&queueMicrotask(()=>{m()})}}}}c(Ke,"createLspDiagnosticSource");function Xe(r){return`Latest push snapshot; completion is unknown${r?"; language server omitted the document version":""}`}c(Xe,"snapshotReason");function Je(r,e){return r.complete?{status:"ready",diagnostics:r.diagnostics,source:e}:{status:"snapshot",diagnostics:r.diagnostics,reason:Xe(r.unversioned),source:e}}c(Je,"toReport");import{URI as Ot}from"vscode-uri";var Ye=[{id:"vue-typescript-language-server",name:"vue-typescript-language-server",kind:"lsp",languages:["vue"],executables:["typescript-language-server"],dependencies:["typescript-language-server","@vue/typescript-plugin"],configFiles:["tsconfig.json"],documentation:"https://github.com/vuejs/language-tools/tree/master/packages/typescript-plugin",lsp:{command:["typescript-language-server","--stdio"],rootMarkers:["tsconfig.json","package.json"],languageIds:{vue:[".vue"]},initializationOptions:{plugins:[{name:"@vue/typescript-plugin",location:"{project}/node_modules/@vue/typescript-plugin",languages:["vue"]}]}}},u("elixir-ls",["elixir"],["elixir-ls"],["mix.exs"],{elixir:[".ex",".exs"]},["elixir-ls"],"https://github.com/elixir-lsp/elixir-ls",void 0,void 0,{elixirLS:{mcpEnabled:!1}}),u("metals",["scala"],["metals"],["build.sbt","project.scala",".bsp"],{scala:[".scala",".sc"]},["metals"],"https://scalameta.org/metals/"),{id:"angular-language-server",name:"angular-language-server",kind:"lsp",languages:["typescript","html"],executables:["ngserver"],dependencies:["@angular/language-server"],configFiles:["angular.json"],documentation:"https://github.com/angular/vscode-ng-language-service",lsp:{command:["ngserver","--stdio","--tsProbeLocations",".","--ngProbeLocations","."],rootMarkers:["angular.json"],requireRootMarker:!0,languageIds:{typescript:[".ts"],html:[".html"]}}},u("svelte-language-server",["svelte"],["svelteserver"],["svelte.config.js","package.json"],{svelte:[".svelte"]},["svelteserver","--stdio"],"https://github.com/sveltejs/language-tools/tree/master/packages/language-server",["svelte-language-server"]),u("dart-language-server",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],{dart:[".dart"]},["dart","language-server","--protocol=lsp"],"https://dart.dev/tools/dart-language-server"),u("r-language-server",["r"],["Rscript"],["DESCRIPTION",".lintr",".Rprofile"],{r:[".r"]},["Rscript","-e","languageserver::run()"],"https://github.com/REditorSupport/languageserver"),u("zls",["zig"],["zls"],["build.zig","build.zig.zon","zls.json"],{zig:[".zig",".zon"]},["zls"],"https://zigtools.org/zls/"),u("clangd",["c","cpp"],["clangd"],[".clangd","compile_commands.json","CMakeLists.txt"],{c:[".c",".h"],cpp:[".cc",".cpp",".cxx",".hh",".hpp",".hxx"]},["clangd"],"https://clangd.llvm.org/"),u("typescript-language-server",["javascript","typescript"],["typescript-language-server"],["tsconfig.json","jsconfig.json","package.json"],{javascript:[".js",".mjs",".cjs"],javascriptreact:[".jsx"],typescript:[".ts",".mts",".cts"],typescriptreact:[".tsx"]},["typescript-language-server","--stdio"],"https://github.com/typescript-language-server/typescript-language-server",["typescript-language-server"]),u("basedpyright",["python"],["basedpyright-langserver","pyright-langserver"],["pyproject.toml","pyrightconfig.json"],{python:[".py",".pyi"]},["basedpyright-langserver","--stdio"],"https://docs.basedpyright.com/",["basedpyright"]),u("gopls",["go"],["gopls"],["go.mod","go.work"],{go:[".go"]},["gopls"],"https://go.dev/gopls/"),u("rust-analyzer",["rust"],["rust-analyzer"],["Cargo.toml","rust-project.json"],{rust:[".rs"]},["rust-analyzer"],"https://rust-analyzer.github.io/"),u("csharp-ls",["csharp"],["csharp-ls"],[".sln",".csproj"],{csharp:[".cs"]},["csharp-ls"],"https://github.com/razzmatazz/csharp-language-server"),u("jdtls",["java"],["jdtls"],["pom.xml","build.gradle",".project"],{java:[".java"]},["jdtls"],"https://projects.eclipse.org/projects/eclipse.jdt.ls"),u("kotlin-language-server",["kotlin"],["kotlin-language-server"],["build.gradle.kts","pom.xml"],{kotlin:[".kt",".kts"]},["kotlin-language-server"],"https://github.com/fwcd/kotlin-language-server"),u("solargraph",["ruby"],["solargraph"],["Gemfile",".solargraph.yml"],{ruby:[".rb",".rake"]},["solargraph","stdio"],"https://solargraph.org/"),u("intelephense",["php"],["intelephense"],["composer.json"],{php:[".php"]},["intelephense","--stdio"],"https://intelephense.com/"),u("sourcekit-lsp",["swift"],["sourcekit-lsp"],["Package.swift"],{swift:[".swift"]},["sourcekit-lsp"],"https://github.com/swiftlang/sourcekit-lsp"),u("lua-language-server",["lua"],["lua-language-server"],[".luarc.json",".luarc.jsonc"],{lua:[".lua"]},["lua-language-server"],"https://luals.github.io/"),u("bash-language-server",["shell"],["bash-language-server"],[".shellcheckrc"],{shell:[".sh",".bash"]},["bash-language-server","start"],"https://github.com/bash-lsp/bash-language-server"),u("vscode-css-language-server",["css"],["vscode-css-language-server"],["package.json"],{css:[".css",".scss",".less"]},["vscode-css-language-server","--stdio"],"https://github.com/microsoft/vscode-css-languageservice",void 0,void 0,{css:{},scss:{},less:{}}),u("vscode-html-language-server",["html"],["vscode-html-language-server"],["package.json"],{html:[".html",".htm"]},["vscode-html-language-server","--stdio"],"https://github.com/microsoft/vscode-html-languageservice"),u("yaml-language-server",["yaml"],["yaml-language-server"],[".yamllint","package.json"],{yaml:[".yaml",".yml"]},["yaml-language-server","--stdio"],"https://github.com/redhat-developer/yaml-language-server"),u("taplo-lsp",["toml"],["taplo"],["taplo.toml"],{toml:[".toml"]},["taplo","lsp","stdio"],"https://taplo.tamasfe.dev/"),u("marksman",["markdown"],["marksman"],[".marksman.toml"],{markdown:[".md",".mdx"]},["marksman","server"],"https://github.com/artempyanykh/marksman"),u("terraform-ls",["terraform"],["terraform-ls"],[".terraform.lock.hcl"],{terraform:[".tf",".tfvars"]},["terraform-ls","serve"],"https://github.com/hashicorp/terraform-ls"),u("kotlin-lsp",["kotlin"],["intellij-server"],["build.gradle.kts","build.gradle","pom.xml","settings.gradle.kts"],{kotlin:[".kt",".kts"]},["intellij-server","--stdio"],"https://github.com/Kotlin/kotlin-lsp"),u("julia-language-server",["julia"],["julia"],["Project.toml","JuliaProject.toml"],{julia:[".jl"]},["julia","--startup-file=no","--history-file=no","-e","using LanguageServer; runserver()"],"https://github.com/julia-vscode/LanguageServer.jl"),u("powershell-editor-services",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],{powershell:[".ps1",".psm1",".psd1"]},["pwsh","-NoProfile","-NonInteractive","-Command",'$ErrorActionPreference="Stop";Import-Module PowerShellEditorServices;$d=Join-Path (Get-Location) ".agents/tmp/powershell-lsp-$PID";[IO.Directory]::CreateDirectory($d)|Out-Null;Start-EditorServices -HostName Pi -HostProfileId Pi -HostVersion 1.0.0 -Stdio -LanguageServiceOnly -LogPath (Join-Path $d "server.log") -SessionDetailsPath (Join-Path $d "session.json")'],"https://github.com/PowerShell/PowerShellEditorServices"),u("neocmakelsp",["cmake"],["neocmakelsp"],["CMakeLists.txt",".neocmake.toml",".neocmakelint.toml"],{cmake:[".cmake"]},["neocmakelsp","stdio"],"https://github.com/neocmakelsp/neocmakelsp",void 0,{cmake:["CMakeLists.txt"]}),u("vscode-json-language-server",["json"],["vscode-json-language-server"],["package.json"],{json:[".json",".jsonc"]},["vscode-json-language-server","--stdio"],"https://github.com/microsoft/vscode-json-languageservice"),u("lemminx",["xml"],["lemminx"],[".lemminx.json"],{xml:[".xml",".xsd",".xsl"]},["lemminx"],"https://github.com/eclipse-lemminx/lemminx"),u("sqls",["sql"],["sqls"],[".sqls.yml"],{sql:[".sql"]},["sqls"],"https://github.com/sqls-server/sqls"),u("docker-langserver",["dockerfile"],["docker-langserver"],["Dockerfile"],{dockerfile:[".dockerfile"]},["docker-langserver","--stdio"],"https://github.com/rcjsuen/dockerfile-language-server-nodejs",void 0,{dockerfile:["Dockerfile","Containerfile"]})];function u(r,e,t,n,s,i,o,l,a,p){return{id:r,name:r,kind:"lsp",languages:e,executables:t,configFiles:n,documentation:o,...l&&{dependencies:l},lsp:{command:i,rootMarkers:n,languageIds:s,...a&&{fileNames:a},...p&&{settings:p}}}}c(u,"recipe");var Qe={protocol:ye,apiVersion:1,id:"lsp",setup(r){for(let e of Ye)r.addToolRecipe(e);r.addSetupCheck({id:"effective-config",inspect:Tt}),r.addCheck({id:"config",title:"LSP",async run(e){try{let t=await S.fromPackageDir(e.cwd,{environment:e.env}),n=qt(t,e.files);return n.length===0?[{status:"skip",message:"No language server matches the inspected project files"}]:await Promise.all(n.map(async s=>{let i=`${s.serverId} [${s.layer}] command ${JSON.stringify(s.config.command)}`,o=new _({serverId:s.serverId,rootUri:Ot.file(e.cwd).toString(),command:s.config.command,env:Nt(e.env,s.config.env),...s.config.initializationOptions&&{initOptions:s.config.initializationOptions},...s.config.settings&&{settings:s.config.settings},...s.config.timeoutMs&&{timeoutMs:s.config.timeoutMs}});try{return await o.start(),{status:"pass",message:`${i}: initialized`,detail:s.sourcePath}}catch(l){return{status:"fail",message:`${i}: ${l instanceof Error?l.message:String(l)}`,detail:s.sourcePath}}finally{await o.shutdown().catch(()=>{})}}))}catch(t){return[{status:"fail",message:t instanceof Error?t.message:String(t)}]}}})}};async function Tt(r){try{let e=await S.fromPackageDir(r.cwd,{environment:r.env}),t=[],n=new Map;for(let[s,i]of r.detectedLanguages){let o=i.flatMap(l=>e.resolve(l)).find(l=>l.languageId===s);o!==void 0&&(t.push({kind:"lsp",languageId:s,toolId:o.serverId}),await A(o.config,r.cwd,r.env)||n.set(o.serverId,{id:`lsp-${o.serverId}-unavailable`,message:`Configured language server ${o.serverId} cannot run ${JSON.stringify(o.config.command)}`}))}return{selections:t,actions:[...n.values()]}}catch(e){return{actions:[{id:"lsp-config-invalid",message:`Language server configuration cannot load: ${e instanceof Error?e.message:String(e)}`}]}}}c(Tt,"inspectLspSetup");function qt(r,e){let t=new Map;for(let n of e){let s=r.resolve(n)[0];s!==void 0&&!t.has(s.serverId)&&t.set(s.serverId,s)}return[...t.values()]}c(qt,"applicableServers");function Nt(r,e){return Object.fromEntries(Object.entries({...r,...e}).filter(t=>t[1]!==void 0))}c(Nt,"definedEnvironment");function Ze(r){return{id:"symbols",async tryResolve(e,t){if(!e.query.startsWith("symbols:"))return{kind:"not-handled"};let n=e.query.slice(8).trim();if(n.length===0)return{kind:"failed",error:new Error("symbols: query must not be empty")};await r(t.cwd);let s=await J(n,t.cwd,e.limit??100,t.signal);return{kind:"resolved",payload:{query:n,hits:s}}},format(e){let{query:t,hits:n}=e;return{content:[{type:"text",text:n.length===0?"No symbols found.":n.map((i,o)=>`${String(o+1)}. ${i.filePath}:${String(i.lineNumber)}:${String(i.column)} ${i.kind} ${i.name}`).join(`
|
|
8
|
+
`)}],details:{query:t,hits:n}}}}}c(Ze,"createLspSearchResolver");var et=Re({kind:"code-view",label:"LSP"});async function Vt(r){let e=new Map,t=!1,n=c(l=>{if(t)return Promise.reject(new Error("LSP session has ended"));let a=e.get(l);return a||(a=Ft(l).then(p=>{if(t)throw new Error("LSP session has ended");return k.init(p)}),e.set(l,a)),a},"managerFor"),s={kind:"compiler",name:"pi-agent-ide-lsp",priority:200,extensions:["*"],detect:c(async l=>(await n(l.cwd),!0),"detect"),async compile(l,a){let p=await n(a.cwd);return se(p).compile(l,a)}},i={protocol:de,apiVersion:3,id:"lsp",setup(l){l.addTool(s),l.addDiagnosticSource(Ke(n))}};r.on("session_shutdown",async()=>{t=!0,await Promise.allSettled([...e.values()].map(async l=>(await l).shutdownAll())),e.clear()});let o={protocol:we,apiVersion:Le,id:"lsp",setup(l){l.addResolver({resolver:Ue(n),renderResult:et}),l.addResolver({resolver:Ge(n),renderResult:et}),l.addHandler({stage:"read",when:{resolvedBy:"any",contentKind:"text"},handler:pe()}),l.describe("symbol:<file>#<selector> \u2014 declaration source, e.g. symbol:src/catalog.ts#Catalog/find. graph:<file> \u2014 top-level declarations, references and calls; members include selectors. graph:<file>#<selector> \u2014 references and incoming/outgoing calls for that declaration or member.")}};await Promise.all([ge(r,i),Se(r,o),be(r,Qe),Pe(r,{protocol:_e,apiVersion:ke,id:"symbols",setup(l){l.addResolver({resolver:Ze(n)}),l.describe("Use `symbols:<query>` to search workspace symbols and their references through configured language servers.")}})])}c(Vt,"registerLsp");async function Ft(r){let e=process.env.PI_AGENT_IDE_CONFIG_DIR??r;return S.fromPackageDir(e)}c(Ft,"loadRegistry");export{Vt as default};
|
package/dist/entry-33.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a,b,c}from"./chunk-QIJMV2P2.js";import"./chunk-EI7MMDWY.js";export{c as createImageContent,a as createImageContentConverter,b as detectSupportedImageMimeType};
|
package/dist/entry-34.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a}from"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as requiredValue};
|
package/dist/entry-35.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a,b,c}from"./chunk-BHSO2MDK.js";import"./chunk-EI7MMDWY.js";export{c as createPdfContent,a as createPdfContentConverter,b as isPdf};
|
package/dist/entry-36.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{a}from"./chunk-ORAPGW7W.js";import"./chunk-JASLOB2X.js";import"./chunk-EI7MMDWY.js";export{a as connectReadPlugin};
|
package/dist/entry-37.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import"./chunk-NNCZYO4Q.js";import{c as a}from"./chunk-KCEOTU5Z.js";import"./chunk-YHUTTZC6.js";import"./chunk-RAZOACDD.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as createReadResultRenderer};
|