@herbertgao/pi-extensions 2026.8.11 → 2026.8.13
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/README.md +23 -10
- package/{node_modules/@herbertgao/pi-mermaid-open/LICENSE → THIRD_PARTY_NOTICES.md} +19 -1
- package/node_modules/@czottmann/pi-automode/CHANGELOG.md +15 -0
- package/node_modules/@czottmann/pi-automode/README.md +5 -3
- package/node_modules/@czottmann/pi-automode/docs/adr/ADR-001-permission-precedence-and-trust-boundaries.md +2 -0
- package/node_modules/@czottmann/pi-automode/docs/adr/ADR-002-global-config-in-extension-data-directory.md +60 -0
- package/node_modules/@czottmann/pi-automode/docs/adr/INDEX.md +1 -0
- package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +4 -4
- package/node_modules/@czottmann/pi-automode/docs/configuration.md +20 -4
- package/node_modules/@czottmann/pi-automode/docs/observability-logging.md +1 -1
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/bash.ts +692 -0
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/config.ts +181 -3
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +4 -1
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +143 -36
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/hard-deny.ts +103 -148
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/paths.ts +32 -6
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/permissions.ts +344 -22
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode.ts +1 -0
- package/node_modules/@czottmann/pi-automode/package.json +4 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +4 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +21 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +19 -19
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +4 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +10 -2
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +10 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +21 -15
- package/node_modules/@herbertgao/pi-subagents/package.json +3 -3
- package/node_modules/@herbertgao/pi-subagents/src/agent-file-toggle.ts +11 -8
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +184 -106
- package/node_modules/@herbertgao/pi-subagents/src/cross-extension-rpc.ts +31 -11
- package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +9 -1
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +156 -31
- package/node_modules/@herbertgao/pi-subagents/src/invocation-config.ts +17 -0
- package/node_modules/@herbertgao/pi-subagents/src/model-resolver.ts +14 -0
- package/node_modules/@herbertgao/pi-subagents/src/schedule.ts +8 -0
- package/node_modules/@herbertgao/pi-subagents/src/settings.ts +32 -1
- package/node_modules/@herbertgao/pi-subagents/src/types.ts +17 -2
- package/node_modules/@herbertgao/pi-subagents/src/ui/agent-widget.ts +23 -2
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +259 -24
- package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
- package/node_modules/@luxusai/pi-hindsight/CHANGELOG.md +376 -0
- package/node_modules/@luxusai/pi-hindsight/README.md +92 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/001-memory-lifecycle-and-scope.md +56 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/002-explicit-routing-strategy-seam.md +169 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/003-tui-memory-mode-vocabulary.md +107 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/004-lifeos-dual-bank-design.md +89 -0
- package/node_modules/@luxusai/pi-hindsight/docs/adr/005-domain-banks-and-agent-first-surface.md +189 -0
- package/node_modules/@luxusai/pi-hindsight/docs/assets/logos/pi-hindsight-logo-dark.webp +0 -0
- package/node_modules/@luxusai/pi-hindsight/docs/assets/logos/pi-hindsight-logo-dark@2x.webp +0 -0
- package/node_modules/@luxusai/pi-hindsight/docs/coding-memory-evaluation.md +54 -0
- package/node_modules/@luxusai/pi-hindsight/docs/compatibility.md +75 -0
- package/node_modules/@luxusai/pi-hindsight/docs/hindsight-core-functions.md +300 -0
- package/node_modules/@luxusai/pi-hindsight/docs/mission-and-mental-model-quality.md +158 -0
- package/node_modules/@luxusai/pi-hindsight/docs/next-opt-out-design.md +164 -0
- package/node_modules/@luxusai/pi-hindsight/docs/risky-memory-modes.md +139 -0
- package/node_modules/@luxusai/pi-hindsight/docs/starter-mental-model-suggestions.md +74 -0
- package/node_modules/@luxusai/pi-hindsight/docs/surface-reference.md +261 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-operations.ts +151 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-selection.ts +18 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-settings-presenter.ts +46 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/bank-templates.ts +383 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/banking.ts +240 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/knowledge-page-seed.ts +176 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/banks/retain-strategies.ts +178 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/client/client-retry.ts +41 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/client/client.ts +386 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/client/fetch-compat.ts +39 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/client/timeout.ts +34 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-defaults.ts +140 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-editing-model.ts +61 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-editing-registry.ts +925 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-field-paths.ts +247 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-normalize.ts +547 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config-writer.ts +480 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/config.ts +182 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/config/setup-gate.ts +86 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-execute.ts +1010 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-parse.ts +175 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-plan.ts +425 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-presentation.ts +210 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/imports/import-sessions.ts +817 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/index.ts +25 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/git-seed.ts +319 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-recall.ts +196 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-retain.ts +189 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle-runtime.ts +65 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/memory-lifecycle.ts +260 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/mental-models.ts +244 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/observation-scopes.ts +59 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall-cleanup.ts +82 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall-visibility.ts +45 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/recall.ts +331 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-cursor.ts +354 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-job-builder.ts +66 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain-receipts.ts +132 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/lifecycle/retain.ts +228 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-bank-template-operations.ts +74 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-config-operations.ts +16 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-control-operations.ts +648 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-diagnostics-operations.ts +105 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-identity.ts +68 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-operation-service.ts +71 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-operation-types.ts +13 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-recall-operations.ts +162 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-retain-operations.ts +131 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-scope.ts +104 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/memory-session-operations.ts +37 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/operation-catalog.ts +893 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/reflect-presenter.ts +35 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/scope-migrate.ts +177 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/operations/tools.ts +7 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/flush-presenter.ts +21 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/jsonl-queue-store.ts +112 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-delivery.ts +111 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-lock.ts +214 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue-operations.ts +70 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/queue/queue.ts +392 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/bank-template-presentation.ts +45 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/commands.ts +9 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/guided-setup.ts +860 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/prefill-input.ts +105 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-flow.ts +189 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-server-probe.ts +299 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-actions.ts +201 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-facts.ts +47 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-render.ts +239 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui-types.ts +50 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/setup-tui.ts +259 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/tui/tool-presenters.ts +77 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/types.ts +534 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/diagnostics.ts +319 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/messages.ts +325 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/sanitize.ts +42 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session-memory-meta.ts +244 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session-operations.ts +56 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/session.ts +50 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status-fields.ts +167 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status-health.ts +207 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/utils/status.ts +120 -0
- package/node_modules/@luxusai/pi-hindsight/extensions/version.ts +8 -0
- package/node_modules/@luxusai/pi-hindsight/package.json +118 -0
- package/node_modules/@luxusai/pi-hindsight/skills/hindsight-memory-doctor/SKILL.md +75 -0
- package/node_modules/@narumitw/pi-btw/dist/index.ts +143 -46
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +3 -3
- package/node_modules/@narumitw/pi-btw/package.json +6 -6
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +136 -22
- package/node_modules/{@herbertgao → @tifan}/pi-copy-response/README.md +2 -4
- package/node_modules/{@herbertgao → @tifan}/pi-copy-response/package.json +5 -15
- package/node_modules/{@herbertgao → @tifan}/pi-handoff/README.md +4 -6
- package/node_modules/@tifan/pi-handoff/package.json +43 -0
- package/node_modules/{@herbertgao → @tifan}/pi-handoff/src/index.ts +1 -1
- package/node_modules/{@herbertgao → @tifan}/pi-inline-skills/README.md +2 -4
- package/node_modules/{@herbertgao → @tifan}/pi-inline-skills/package.json +5 -15
- package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/README.md +5 -7
- package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/package.json +5 -19
- package/node_modules/{@herbertgao → @tifan}/pi-preferred-thinking/README.md +4 -6
- package/node_modules/{@herbertgao → @tifan}/pi-preferred-thinking/package.json +6 -16
- package/node_modules/{@herbertgao → @tifan}/pi-preferred-thinking/src/index.ts +1 -6
- package/node_modules/{@herbertgao → @tifan}/pi-recap/README.md +4 -6
- package/node_modules/@tifan/pi-recap/package.json +42 -0
- package/node_modules/{@herbertgao → @tifan}/pi-recap/src/models.ts +1 -6
- package/node_modules/{@herbertgao → @tifan}/pi-rename/README.md +13 -8
- package/node_modules/@tifan/pi-rename/package.json +47 -0
- package/node_modules/@tifan/pi-rename/src/herdr-label.ts +4 -0
- package/node_modules/{@herbertgao → @tifan}/pi-rename/src/index.ts +4 -16
- package/node_modules/{@herbertgao → @tifan}/pi-rename/src/models.ts +1 -6
- package/node_modules/{@herbertgao → @tifan}/pi-titlebar-spinner/README.md +2 -4
- package/node_modules/{@herbertgao → @tifan}/pi-titlebar-spinner/package.json +5 -15
- package/node_modules/pi-lens/CHANGELOG.md +96 -1
- package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +2 -1
- package/node_modules/pi-lens/dist/clients/actionable-warnings.js +14 -5
- package/node_modules/pi-lens/dist/clients/advisory-provenance.js +48 -18
- package/node_modules/pi-lens/dist/clients/ast-grep-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/atomic-write-staging.js +16 -4
- package/node_modules/pi-lens/dist/clients/bash-file-access.js +3 -1
- package/node_modules/pi-lens/dist/clients/biome-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/blocker-freshness.js +21 -8
- package/node_modules/pi-lens/dist/clients/bounded-cache.js +24 -8
- package/node_modules/pi-lens/dist/clients/bounded-pid-file-lock.js +4 -3
- package/node_modules/pi-lens/dist/clients/cache-manager.js +6 -7
- package/node_modules/pi-lens/dist/clients/cache-observability.js +461 -66
- package/node_modules/pi-lens/dist/clients/call-graph.js +238 -63
- package/node_modules/pi-lens/dist/clients/codebase-model.js +13 -5
- package/node_modules/pi-lens/dist/clients/complexity-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/dead-code-client.js +19 -8
- package/node_modules/pi-lens/dist/clients/dead-code-logger.js +1 -2
- package/node_modules/pi-lens/dist/clients/deadline-utils.js +3 -1
- package/node_modules/pi-lens/dist/clients/debug-heap.js +8 -1
- package/node_modules/pi-lens/dist/clients/degradation-ledger.js +1 -1
- package/node_modules/pi-lens/dist/clients/dependency-checker.js +11 -7
- package/node_modules/pi-lens/dist/clients/diagnostic-dispositions.js +39 -2
- package/node_modules/pi-lens/dist/clients/diagnostic-line-freshness.js +5 -1
- package/node_modules/pi-lens/dist/clients/dispatch/auxiliary-lsp.js +2 -3
- package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +13 -1
- package/node_modules/pi-lens/dist/clients/dispatch/facts/function-facts.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/facts/import-facts.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/integration.js +9 -4
- package/node_modules/pi-lens/dist/clients/dispatch/rules/error-swallowing.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +6 -2
- package/node_modules/pi-lens/dist/clients/dispatch/rules/unsafe-boundary.js +31 -7
- package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +5 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +10 -14
- package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +5 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +25 -6
- package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +3 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +13 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +4 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +25 -10
- package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +28 -4
- package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +6 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +212 -11
- package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +8 -4
- package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +10 -6
- package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +23 -14
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +7 -9
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +5 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +7 -7
- package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +6 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +13 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +13 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +17 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +7 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +24 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/tool-failure.js +35 -0
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +1 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +6 -8
- package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/suppress-writer.js +2 -1
- package/node_modules/pi-lens/dist/clients/dispatch/types.js +6 -1
- package/node_modules/pi-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +6 -2
- package/node_modules/pi-lens/dist/clients/extension-log.js +5 -3
- package/node_modules/pi-lens/dist/clients/feature-hints.js +8 -1
- package/node_modules/pi-lens/dist/clients/file-kinds.js +34 -129
- package/node_modules/pi-lens/dist/clients/file-utils.js +17 -1
- package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +57 -2
- package/node_modules/pi-lens/dist/clients/formatters.js +144 -27
- package/node_modules/pi-lens/dist/clients/freshness.js +38 -0
- package/node_modules/pi-lens/dist/clients/git-guard.js +43 -13
- package/node_modules/pi-lens/dist/clients/go-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/grammar-source.js +1 -1
- package/node_modules/pi-lens/dist/clients/gzip-stage-write.js +30 -4
- package/node_modules/pi-lens/dist/clients/host-edit-normalize.js +1 -3
- package/node_modules/pi-lens/dist/clients/install-diagnostics.js +4 -2
- package/node_modules/pi-lens/dist/clients/installer/index.js +86 -77
- package/node_modules/pi-lens/dist/clients/instance-reaper.js +5 -2
- package/node_modules/pi-lens/dist/clients/instance-registry.js +4 -2
- package/node_modules/pi-lens/dist/clients/jscpd-client.js +6 -1
- package/node_modules/pi-lens/dist/clients/knip-client.js +29 -15
- package/node_modules/pi-lens/dist/clients/language-profile.js +4 -1
- package/node_modules/pi-lens/dist/clients/latency-logger.js +13 -2
- package/node_modules/pi-lens/dist/clients/lens-config.js +1 -1
- package/node_modules/pi-lens/dist/clients/lens-map.js +8 -3
- package/node_modules/pi-lens/dist/clients/live-bus-emitter.js +1 -1
- package/node_modules/pi-lens/dist/clients/lsp/config.js +4 -6
- package/node_modules/pi-lens/dist/clients/lsp/edits.js +119 -32
- package/node_modules/pi-lens/dist/clients/lsp/index.js +94 -35
- package/node_modules/pi-lens/dist/clients/lsp/inferred-project.js +2 -1
- package/node_modules/pi-lens/dist/clients/lsp/jvm-runtime.js +4 -1
- package/node_modules/pi-lens/dist/clients/lsp/launch.js +11 -3
- package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +152 -0
- package/node_modules/pi-lens/dist/clients/lsp/server.js +19 -7
- package/node_modules/pi-lens/dist/clients/lsp/tsserver-sync.js +10 -2
- package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +9 -4
- package/node_modules/pi-lens/dist/clients/lsp-document-symbols.js +1 -3
- package/node_modules/pi-lens/dist/clients/lsp-mutation.js +10 -20
- package/node_modules/pi-lens/dist/clients/mcp/host-shim.js +1 -1
- package/node_modules/pi-lens/dist/clients/memory-sampler.js +73 -7
- package/node_modules/pi-lens/dist/clients/metrics-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/middle-man-analysis.js +8 -3
- package/node_modules/pi-lens/dist/clients/module-report-lsp.js +7 -1
- package/node_modules/pi-lens/dist/clients/module-report.js +14 -17
- package/node_modules/pi-lens/dist/clients/ndjson-logger.js +3 -5
- package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +220 -0
- package/node_modules/pi-lens/dist/clients/package-manager.js +6 -1
- package/node_modules/pi-lens/dist/clients/pipeline.js +57 -9
- package/node_modules/pi-lens/dist/clients/project-conventions.js +2 -8
- package/node_modules/pi-lens/dist/clients/project-diagnostics/cache.js +10 -7
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +2 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +3 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +13 -9
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +3 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +5 -2
- package/node_modules/pi-lens/dist/clients/project-lens-config.js +12 -5
- package/node_modules/pi-lens/dist/clients/project-snapshot-fingerprint.js +48 -0
- package/node_modules/pi-lens/dist/clients/project-snapshot-persist-worker.js +15 -1
- package/node_modules/pi-lens/dist/clients/project-snapshot.js +472 -66
- package/node_modules/pi-lens/dist/clients/read-expansion.js +12 -2
- package/node_modules/pi-lens/dist/clients/read-guard-logger.js +5 -4
- package/node_modules/pi-lens/dist/clients/read-guard-tool-lines.js +5 -2
- package/node_modules/pi-lens/dist/clients/read-guard.js +1 -1
- package/node_modules/pi-lens/dist/clients/resource-sampler.js +1 -1
- package/node_modules/pi-lens/dist/clients/reverse-deps.js +6 -5
- package/node_modules/pi-lens/dist/clients/review-graph/builder.js +42 -17
- package/node_modules/pi-lens/dist/clients/review-graph/git-identity.js +8 -2
- package/node_modules/pi-lens/dist/clients/review-graph/import-resolvers.js +10 -1
- package/node_modules/pi-lens/dist/clients/review-graph/query.js +2 -1
- package/node_modules/pi-lens/dist/clients/review-graph/tsconfig-paths.js +4 -2
- package/node_modules/pi-lens/dist/clients/review-graph/workspace-modules.js +2 -2
- package/node_modules/pi-lens/dist/clients/ruff-client.js +6 -5
- package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +63 -31
- package/node_modules/pi-lens/dist/clients/runtime-context.js +12 -4
- package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +83 -4
- package/node_modules/pi-lens/dist/clients/runtime-session.js +14 -0
- package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +59 -3
- package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +148 -34
- package/node_modules/pi-lens/dist/clients/runtime-turn.js +147 -6
- package/node_modules/pi-lens/dist/clients/rust-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/safe-spawn.js +150 -11
- package/node_modules/pi-lens/dist/clients/security-scan-client.js +1 -3
- package/node_modules/pi-lens/dist/clients/session-summary.js +3 -1
- package/node_modules/pi-lens/dist/clients/sg-runner.js +1 -3
- package/node_modules/pi-lens/dist/clients/source-filter.js +10 -6
- package/node_modules/pi-lens/dist/clients/source-walker.js +1 -1
- package/node_modules/pi-lens/dist/clients/spawn-timeout-cooldown.js +96 -0
- package/node_modules/pi-lens/dist/clients/startup-scan.js +4 -1
- package/node_modules/pi-lens/dist/clients/tool-definition.js +7 -0
- package/node_modules/pi-lens/dist/clients/tool-policy.js +26 -11
- package/node_modules/pi-lens/dist/clients/tool-render.js +2 -1
- package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +10 -4
- package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +2 -2
- package/node_modules/pi-lens/dist/clients/tree-sitter-symbol-extractor.js +12 -5
- package/node_modules/pi-lens/dist/clients/warm-attach.js +12 -5
- package/node_modules/pi-lens/dist/clients/widget-state.js +27 -11
- package/node_modules/pi-lens/dist/clients/word-index.js +3 -1
- package/node_modules/pi-lens/dist/clients/workspace-topology.js +8 -2
- package/node_modules/pi-lens/dist/clients/zizmor-config.js +9 -1
- package/node_modules/pi-lens/dist/i18n.js +13 -5
- package/node_modules/pi-lens/dist/index.js +10797 -8627
- package/node_modules/pi-lens/dist/mcp/server.js +3 -1
- package/node_modules/pi-lens/dist/tools/ast-grep-replace.js +68 -12
- package/node_modules/pi-lens/dist/tools/lens-diagnostic-mark.js +21 -7
- package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +164 -35
- package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +24 -7
- package/node_modules/pi-lens/dist/tools/lsp-navigation.js +3 -1
- package/node_modules/pi-lens/dist/tools/module-report.js +1 -1
- package/node_modules/pi-lens/dist/tools/project-report.js +1 -1
- package/node_modules/pi-lens/dist/tools/symbol-search.js +5 -2
- package/node_modules/pi-lens/docs/durable-store-audit-1202.md +1 -1
- package/node_modules/pi-lens/docs/servercapabilities.md +1 -1
- package/node_modules/pi-lens/package.json +160 -156
- package/node_modules/pi-lens/rules/typos/_typos.toml +2 -2
- package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +31 -13
- package/node_modules/pi-lens/scripts/download-grammars.js +9 -3
- package/node_modules/pi-lens/scripts/rpc-load-check.mjs +30 -9
- package/node_modules/pi-mcp-adapter/CHANGELOG.md +47 -0
- package/node_modules/pi-mcp-adapter/README.md +42 -13
- package/node_modules/pi-mcp-adapter/commands.ts +4 -2
- package/node_modules/pi-mcp-adapter/config.ts +45 -5
- package/node_modules/pi-mcp-adapter/direct-tools.ts +103 -92
- package/node_modules/pi-mcp-adapter/dist/agent-dir.d.ts +10 -0
- package/node_modules/pi-mcp-adapter/dist/agent-dir.js +63 -0
- package/node_modules/pi-mcp-adapter/dist/agent-dir.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.d.ts +8 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js +356 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/config.d.ts +123 -0
- package/node_modules/pi-mcp-adapter/dist/config.js +1087 -0
- package/node_modules/pi-mcp-adapter/dist/config.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.d.ts +19 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +319 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.d.ts +2 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js +156 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.d.ts +1 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.js +15 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/types.d.ts +564 -0
- package/node_modules/pi-mcp-adapter/dist/types.js +287 -0
- package/node_modules/pi-mcp-adapter/dist/types.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.d.ts +6 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js +37 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.d.ts +104 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js +59 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.d.ts +4 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js +27 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/utils.d.ts +32 -0
- package/node_modules/pi-mcp-adapter/dist/utils.js +338 -0
- package/node_modules/pi-mcp-adapter/dist/utils.js.map +1 -0
- package/node_modules/pi-mcp-adapter/failure-backoff.ts +23 -0
- package/node_modules/pi-mcp-adapter/index.ts +204 -82
- package/node_modules/pi-mcp-adapter/init.ts +41 -30
- package/node_modules/pi-mcp-adapter/lifecycle.ts +16 -8
- package/node_modules/pi-mcp-adapter/mcp-code.ts +2 -0
- package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +66 -16
- package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +95 -7
- package/node_modules/pi-mcp-adapter/mcp-probe.ts +18 -4
- package/node_modules/pi-mcp-adapter/mcp-references.ts +368 -0
- package/node_modules/pi-mcp-adapter/mcp-status.ts +8 -19
- package/node_modules/pi-mcp-adapter/metadata-cache.ts +20 -12
- package/node_modules/pi-mcp-adapter/namespace-tools.ts +276 -0
- package/node_modules/pi-mcp-adapter/package.json +24 -6
- package/node_modules/pi-mcp-adapter/proxy-modes.ts +66 -10
- package/node_modules/pi-mcp-adapter/search-ranking.ts +2 -0
- package/node_modules/pi-mcp-adapter/server-manager.ts +63 -12
- package/node_modules/pi-mcp-adapter/state.ts +1 -3
- package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +16 -2
- package/node_modules/pi-mcp-adapter/types.ts +48 -1
- package/node_modules/pi-mcp-adapter/ui-server.ts +3 -19
- package/node_modules/pi-mcp-adapter/ui-session.ts +2 -1
- package/node_modules/pi-mcp-adapter/utils.ts +21 -19
- package/node_modules/pi-web-access/CHANGELOG.md +26 -0
- package/node_modules/pi-web-access/README.md +71 -14
- package/node_modules/pi-web-access/chrome-cookies.ts +115 -35
- package/node_modules/pi-web-access/credential-source.ts +6 -2
- package/node_modules/pi-web-access/curator-page.ts +5 -3
- package/node_modules/pi-web-access/curator-server.ts +2 -1
- package/node_modules/pi-web-access/extract.ts +89 -9
- package/node_modules/pi-web-access/fetch-params.ts +13 -0
- package/node_modules/pi-web-access/gemini-adc.ts +298 -0
- package/node_modules/pi-web-access/gemini-api.ts +59 -15
- package/node_modules/pi-web-access/gemini-search.ts +58 -18
- package/node_modules/pi-web-access/gemini-url-context.ts +3 -2
- package/node_modules/pi-web-access/gemini-web-config.ts +57 -7
- package/node_modules/pi-web-access/gemini-web.ts +9 -3
- package/node_modules/pi-web-access/github-api.ts +5 -4
- package/node_modules/pi-web-access/github-issue-pr.ts +700 -0
- package/node_modules/pi-web-access/index.ts +403 -297
- package/node_modules/pi-web-access/kimi-search.ts +234 -0
- package/node_modules/pi-web-access/openai-search.ts +118 -21
- package/node_modules/pi-web-access/package.json +3 -2
- package/node_modules/pi-web-access/ssrf-protection.ts +4 -1
- package/node_modules/pi-web-access/utils.ts +307 -1
- package/node_modules/pi-web-access/youtube-extract.ts +2 -2
- package/package.json +46 -37
- package/node_modules/@herbertgao/pi-copy-response/CHANGELOG.md +0 -49
- package/node_modules/@herbertgao/pi-copy-response/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-handoff/CHANGELOG.md +0 -83
- package/node_modules/@herbertgao/pi-handoff/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-handoff/package.json +0 -60
- package/node_modules/@herbertgao/pi-inline-skills/CHANGELOG.md +0 -57
- package/node_modules/@herbertgao/pi-inline-skills/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-mermaid-open/CHANGELOG.md +0 -39
- package/node_modules/@herbertgao/pi-preferred-thinking/CHANGELOG.md +0 -63
- package/node_modules/@herbertgao/pi-preferred-thinking/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-recap/CHANGELOG.md +0 -101
- package/node_modules/@herbertgao/pi-recap/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-recap/package.json +0 -55
- package/node_modules/@herbertgao/pi-rename/CHANGELOG.md +0 -49
- package/node_modules/@herbertgao/pi-rename/LICENSE +0 -22
- package/node_modules/@herbertgao/pi-rename/package.json +0 -63
- package/node_modules/@herbertgao/pi-titlebar-spinner/CHANGELOG.md +0 -25
- package/node_modules/@herbertgao/pi-titlebar-spinner/LICENSE +0 -22
- /package/node_modules/{@herbertgao → @tifan}/pi-copy-response/src/index.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-handoff/src/complete-text.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-handoff/src/session-query.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-inline-skills/src/index.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/herdr-plugin/herdr-plugin.toml +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/herdr-plugin/viewer.mjs +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-mermaid-open/src/index.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-recap/src/index.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-recap/src/model-picker.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-recap/src/sanitize.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-recap/src/tui.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-rename/src/model-picker.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-rename/src/naming.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-rename/src/sanitize.ts +0 -0
- /package/node_modules/{@herbertgao → @tifan}/pi-titlebar-spinner/src/index.ts +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
export function getConfigDirName() {
|
|
5
|
+
const configDir = readPiConfig()?.configDir;
|
|
6
|
+
return typeof configDir === "string" && configDir.trim() ? configDir.trim() : ".pi";
|
|
7
|
+
}
|
|
8
|
+
export function getAgentDir() {
|
|
9
|
+
const piConfig = readPiConfig();
|
|
10
|
+
const name = piConfig?.name;
|
|
11
|
+
const appName = typeof name === "string" && name.trim() ? name.trim() : "pi";
|
|
12
|
+
const configured = process.env[`${appName.toUpperCase()}_CODING_AGENT_DIR`]?.trim();
|
|
13
|
+
if (!configured) {
|
|
14
|
+
return join(homedir(), getConfigDirName(), "agent");
|
|
15
|
+
}
|
|
16
|
+
if (configured === "~") {
|
|
17
|
+
return homedir();
|
|
18
|
+
}
|
|
19
|
+
if (configured.startsWith("~/")) {
|
|
20
|
+
return resolve(homedir(), configured.slice(2));
|
|
21
|
+
}
|
|
22
|
+
return resolve(configured);
|
|
23
|
+
}
|
|
24
|
+
export function getAgentPath(...segments) {
|
|
25
|
+
return join(getAgentDir(), ...segments);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* What the host calls itself.
|
|
29
|
+
*
|
|
30
|
+
* pi supports rebranding through `piConfig.name` in the package.json that its
|
|
31
|
+
* `getPackageDir()` resolves, and distributions built on pi (arc, tau, …) point
|
|
32
|
+
* `PI_PACKAGE_DIR` at their own manifest. Read that manifest directly rather
|
|
33
|
+
* than importing pi: this package deliberately depends on pi-ai and pi-tui
|
|
34
|
+
* only, and `getAgentDir()` above reads its env var the same self-contained way.
|
|
35
|
+
*
|
|
36
|
+
* Falls back to "pi", which is what pi's own APP_NAME resolves to.
|
|
37
|
+
*/
|
|
38
|
+
function readPiConfig() {
|
|
39
|
+
const dir = process.env.PI_PACKAGE_DIR?.trim();
|
|
40
|
+
if (!dir)
|
|
41
|
+
return undefined;
|
|
42
|
+
try {
|
|
43
|
+
const manifest = JSON.parse(readFileSync(join(resolve(dir), "package.json"), "utf8"));
|
|
44
|
+
return manifest.piConfig;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function getAppName() {
|
|
51
|
+
const name = readPiConfig()?.name;
|
|
52
|
+
return typeof name === "string" && name.trim() ? name.trim() : "pi";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Home page the host declares for itself, via `piConfig.clientUri` in the same
|
|
56
|
+
* manifest that carries `piConfig.name`. Only the distribution knows its own
|
|
57
|
+
* URL, so this is the one place it can come from without guessing.
|
|
58
|
+
*/
|
|
59
|
+
export function getAppClientUri() {
|
|
60
|
+
const uri = readPiConfig()?.clientUri;
|
|
61
|
+
return typeof uri === "string" && uri.trim() ? uri.trim() : undefined;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=agent-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-dir.js","sourceRoot":"","sources":["../agent-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,UAAU,gBAAgB;IAC9B,MAAM,SAAS,GAAG,YAAY,EAAE,EAAE,SAAS,CAAC;IAC5C,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC;IAC5B,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAAE,IAAI,EAAE,CAAC;IACpF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB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,GAAG,GAAG,YAAY,EAAE,EAAE,SAAS,CAAA;IACrC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACvE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { McpConfig } from "./types.ts";
|
|
2
|
+
export interface AgentPluginSummary {
|
|
3
|
+
path: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
serverCount: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function loadAgentPluginConfigs(paths: unknown, cwd?: string): McpConfig;
|
|
8
|
+
export declare function getAgentPluginSummaries(paths: unknown, cwd?: string): AgentPluginSummary[];
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { getAgentPath } from "./agent-dir.js";
|
|
4
|
+
const PLUGIN_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
5
|
+
const MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
|
|
6
|
+
const PLUGIN_NAME_PATTERN = /^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/;
|
|
7
|
+
const PLUGIN_MANIFEST_FIELDS = new Set([
|
|
8
|
+
"$schema",
|
|
9
|
+
"name",
|
|
10
|
+
"version",
|
|
11
|
+
"description",
|
|
12
|
+
"author",
|
|
13
|
+
"homepage",
|
|
14
|
+
"repository",
|
|
15
|
+
"license",
|
|
16
|
+
"keywords",
|
|
17
|
+
"extensions",
|
|
18
|
+
]);
|
|
19
|
+
const MCP_CONFIG_FIELDS = new Set(["$schema", "mcpServers"]);
|
|
20
|
+
const STDIO_FIELDS = new Set(["type", "command", "args", "env", "cwd"]);
|
|
21
|
+
const HTTP_FIELDS = new Set(["type", "url", "headers"]);
|
|
22
|
+
export function loadAgentPluginConfigs(paths, cwd = process.cwd()) {
|
|
23
|
+
const mcpServers = {};
|
|
24
|
+
for (const pluginPath of getPluginPaths(paths)) {
|
|
25
|
+
const loaded = loadAgentPluginMcpConfig(pluginPath, cwd);
|
|
26
|
+
if (!loaded)
|
|
27
|
+
continue;
|
|
28
|
+
for (const [serverName, server] of Object.entries(loaded.mcpServers)) {
|
|
29
|
+
if (mcpServers[serverName]) {
|
|
30
|
+
console.warn(`Agent Plugin at ${resolvePluginPath(pluginPath, cwd)} skips duplicate normalized MCP server ${serverName}`);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
mcpServers[serverName] = server;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { mcpServers };
|
|
37
|
+
}
|
|
38
|
+
export function getAgentPluginSummaries(paths, cwd = process.cwd()) {
|
|
39
|
+
return getPluginPaths(paths).map(path => {
|
|
40
|
+
const pluginRoot = resolvePluginPath(path, cwd);
|
|
41
|
+
const loaded = loadAgentPluginMcpConfig(path, cwd);
|
|
42
|
+
const manifest = loaded ? readPluginManifest(pluginRoot, false) : null;
|
|
43
|
+
return {
|
|
44
|
+
path: pluginRoot,
|
|
45
|
+
...(manifest?.name ? { name: manifest.name } : {}),
|
|
46
|
+
serverCount: loaded ? Object.keys(loaded.mcpServers).length : 0,
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function getPluginPaths(paths) {
|
|
51
|
+
return Array.isArray(paths) ? paths.filter((path) => typeof path === "string") : [];
|
|
52
|
+
}
|
|
53
|
+
function loadAgentPluginMcpConfig(path, cwd) {
|
|
54
|
+
const pluginRoot = resolvePluginPath(path, cwd);
|
|
55
|
+
const manifest = readPluginManifest(pluginRoot, true);
|
|
56
|
+
if (!manifest)
|
|
57
|
+
return null;
|
|
58
|
+
const mcpPath = resolve(pluginRoot, "mcp.json");
|
|
59
|
+
if (!existsSync(mcpPath))
|
|
60
|
+
return { mcpServers: {} };
|
|
61
|
+
if (!statSync(mcpPath).isFile()) {
|
|
62
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: mcp.json is not a regular file`);
|
|
63
|
+
return { mcpServers: {} };
|
|
64
|
+
}
|
|
65
|
+
let raw;
|
|
66
|
+
try {
|
|
67
|
+
raw = JSON.parse(readFileSync(mcpPath, "utf8"));
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: failed to parse mcp.json`, error);
|
|
71
|
+
return { mcpServers: {} };
|
|
72
|
+
}
|
|
73
|
+
return translateAgentPluginMcpConfig(raw, manifest, pluginRoot);
|
|
74
|
+
}
|
|
75
|
+
function readPluginManifest(pluginRoot, report) {
|
|
76
|
+
const manifestPath = resolve(pluginRoot, "plugin.json");
|
|
77
|
+
if (!existsSync(manifestPath)) {
|
|
78
|
+
if (report)
|
|
79
|
+
console.warn(`Agent Plugin at ${pluginRoot} is invalid: missing plugin.json`);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
if (!statSync(manifestPath).isFile()) {
|
|
83
|
+
if (report)
|
|
84
|
+
console.warn(`Agent Plugin at ${pluginRoot} is invalid: plugin.json is not a regular file`);
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
let raw;
|
|
88
|
+
try {
|
|
89
|
+
raw = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (report)
|
|
93
|
+
console.warn(`Agent Plugin at ${pluginRoot} is invalid: failed to parse plugin.json`, error);
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
97
|
+
if (report)
|
|
98
|
+
console.warn(`Agent Plugin at ${pluginRoot} is invalid: plugin.json must be an object`);
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const manifest = raw;
|
|
102
|
+
for (const key of Object.keys(manifest)) {
|
|
103
|
+
if (!PLUGIN_MANIFEST_FIELDS.has(key) && report) {
|
|
104
|
+
console.warn(`Agent Plugin at ${pluginRoot} ignores unknown plugin.json field: ${key}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (manifest.$schema !== PLUGIN_SCHEMA) {
|
|
108
|
+
if (report)
|
|
109
|
+
console.warn(`Agent Plugin at ${pluginRoot} is invalid: unsupported plugin.json $schema`);
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
if (typeof manifest.name !== "string" || manifest.name.length < 1 || manifest.name.length > 64 || !PLUGIN_NAME_PATTERN.test(manifest.name)) {
|
|
113
|
+
if (report)
|
|
114
|
+
console.warn(`Agent Plugin at ${pluginRoot} is invalid: plugin.json name is invalid`);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
if (manifest.extensions !== undefined && (!manifest.extensions || typeof manifest.extensions !== "object" || Array.isArray(manifest.extensions))) {
|
|
118
|
+
if (report)
|
|
119
|
+
console.warn(`Agent Plugin ${manifest.name} ignores non-object plugin.json extensions`);
|
|
120
|
+
}
|
|
121
|
+
return { name: manifest.name };
|
|
122
|
+
}
|
|
123
|
+
function translateAgentPluginMcpConfig(raw, manifest, pluginRoot) {
|
|
124
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
125
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: mcp.json must be an object`);
|
|
126
|
+
return { mcpServers: {} };
|
|
127
|
+
}
|
|
128
|
+
const mcpConfig = raw;
|
|
129
|
+
for (const key of Object.keys(mcpConfig)) {
|
|
130
|
+
if (!MCP_CONFIG_FIELDS.has(key)) {
|
|
131
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: unknown top-level field ${key}`);
|
|
132
|
+
return { mcpServers: {} };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (mcpConfig.$schema !== MCP_SCHEMA) {
|
|
136
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: unsupported mcp.json $schema`);
|
|
137
|
+
return { mcpServers: {} };
|
|
138
|
+
}
|
|
139
|
+
if (!mcpConfig.mcpServers || typeof mcpConfig.mcpServers !== "object" || Array.isArray(mcpConfig.mcpServers)) {
|
|
140
|
+
console.warn(`Agent Plugin ${manifest.name} has invalid MCP config: mcpServers must be an object`);
|
|
141
|
+
return { mcpServers: {} };
|
|
142
|
+
}
|
|
143
|
+
const mcpServers = {};
|
|
144
|
+
for (const [serverName, entry] of Object.entries(mcpConfig.mcpServers)) {
|
|
145
|
+
const translated = translateAgentPluginServer(manifest, pluginRoot, serverName, entry);
|
|
146
|
+
if (!translated)
|
|
147
|
+
continue;
|
|
148
|
+
const normalizedName = formatAgentPluginServerName(manifest.name, serverName);
|
|
149
|
+
if (mcpServers[normalizedName]) {
|
|
150
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: normalized server name ${normalizedName} already exists`);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
mcpServers[normalizedName] = translated;
|
|
154
|
+
}
|
|
155
|
+
return { mcpServers };
|
|
156
|
+
}
|
|
157
|
+
function translateAgentPluginServer(manifest, pluginRoot, serverName, entry) {
|
|
158
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
159
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: entry must be an object`);
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
const raw = entry;
|
|
163
|
+
if (raw.type === "stdio")
|
|
164
|
+
return translateStdioServer(manifest, pluginRoot, serverName, raw);
|
|
165
|
+
if (raw.type === "streamable-http" || raw.type === "sse")
|
|
166
|
+
return translateHttpServer(manifest, serverName, raw, raw.type);
|
|
167
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: unsupported type`);
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
function translateStdioServer(manifest, pluginRoot, serverName, raw) {
|
|
171
|
+
for (const key of Object.keys(raw)) {
|
|
172
|
+
if (!STDIO_FIELDS.has(key))
|
|
173
|
+
return skipServer(manifest, serverName, `unknown field ${key}`);
|
|
174
|
+
}
|
|
175
|
+
if (typeof raw.command !== "string" || raw.command.length === 0)
|
|
176
|
+
return skipServer(manifest, serverName, "command must be a non-empty string");
|
|
177
|
+
if (!isBareCommand(raw.command) && !raw.command.startsWith("./"))
|
|
178
|
+
return skipServer(manifest, serverName, "command must be bare or plugin-relative");
|
|
179
|
+
const args = translateStringArray(raw.args, manifest, serverName, "args");
|
|
180
|
+
if (args === null)
|
|
181
|
+
return null;
|
|
182
|
+
const env = translateEnv(raw.env, manifest, serverName);
|
|
183
|
+
if (env === null)
|
|
184
|
+
return null;
|
|
185
|
+
const command = raw.command.startsWith("./") ? resolveContainedPath(pluginRoot, raw.command, pluginRoot) : raw.command;
|
|
186
|
+
if (command === null)
|
|
187
|
+
return skipServer(manifest, serverName, "command must stay inside the plugin directory");
|
|
188
|
+
const pluginDataDir = getAgentPath("agent-plugin-data", manifest.name);
|
|
189
|
+
const cwd = resolvePluginCwd(raw.cwd, pluginRoot, pluginDataDir);
|
|
190
|
+
if (cwd === null)
|
|
191
|
+
return skipServer(manifest, serverName, "cwd must be plugin-relative, PLUGIN_ROOT-rooted, or PLUGIN_DATA-rooted");
|
|
192
|
+
return {
|
|
193
|
+
command,
|
|
194
|
+
args: args.map(value => expandPluginPlaceholders(value, pluginRoot, pluginDataDir)),
|
|
195
|
+
env: {
|
|
196
|
+
...Object.fromEntries(Object.entries(env).map(([key, value]) => [key, expandPluginPlaceholders(value, pluginRoot, pluginDataDir)])),
|
|
197
|
+
PLUGIN_ROOT: pluginRoot,
|
|
198
|
+
PLUGIN_DATA: pluginDataDir,
|
|
199
|
+
},
|
|
200
|
+
cwd,
|
|
201
|
+
pluginDataDir,
|
|
202
|
+
literalEnv: true,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function translateHttpServer(manifest, serverName, raw, type) {
|
|
206
|
+
for (const key of Object.keys(raw)) {
|
|
207
|
+
if (!HTTP_FIELDS.has(key))
|
|
208
|
+
return skipServer(manifest, serverName, `unknown field ${key}`);
|
|
209
|
+
}
|
|
210
|
+
if (typeof raw.url !== "string" || raw.url.length === 0)
|
|
211
|
+
return skipServer(manifest, serverName, "url must be a non-empty string");
|
|
212
|
+
if (!isValidAgentPluginUrl(raw.url))
|
|
213
|
+
return skipServer(manifest, serverName, "url must be an allowed absolute HTTP(S) URL");
|
|
214
|
+
const headers = translateHeaders(raw.headers, manifest, serverName);
|
|
215
|
+
if (headers === null)
|
|
216
|
+
return null;
|
|
217
|
+
return {
|
|
218
|
+
url: raw.url,
|
|
219
|
+
httpTransport: type,
|
|
220
|
+
...(headers ? { headers } : {}),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function formatAgentPluginServerName(pluginName, serverName) {
|
|
224
|
+
const pluginPart = pluginName.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "") || "plugin";
|
|
225
|
+
const serverPart = serverName.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^[_-]+|[_-]+$/g, "") || "server";
|
|
226
|
+
return `${pluginPart}__${serverPart}`;
|
|
227
|
+
}
|
|
228
|
+
function skipServer(manifest, serverName, reason) {
|
|
229
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: ${reason}`);
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
function translateStringArray(value, manifest, serverName, field) {
|
|
233
|
+
if (value === undefined)
|
|
234
|
+
return [];
|
|
235
|
+
if (!Array.isArray(value) || value.some(item => typeof item !== "string")) {
|
|
236
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: ${field} must be an array of strings`);
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
return value;
|
|
240
|
+
}
|
|
241
|
+
function translateEnv(value, manifest, serverName) {
|
|
242
|
+
if (value === undefined)
|
|
243
|
+
return {};
|
|
244
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
245
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: env must be an object of strings`);
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
const env = {};
|
|
249
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
250
|
+
if (key === "PLUGIN_ROOT" || key === "PLUGIN_DATA") {
|
|
251
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: env must not define ${key}`);
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
if (typeof entry !== "string") {
|
|
255
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: env values must be strings`);
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
env[key] = entry;
|
|
259
|
+
}
|
|
260
|
+
return env;
|
|
261
|
+
}
|
|
262
|
+
function translateHeaders(value, manifest, serverName) {
|
|
263
|
+
if (value === undefined)
|
|
264
|
+
return undefined;
|
|
265
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
266
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: headers must be an object of strings`);
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
const headers = {};
|
|
270
|
+
const seen = new Set();
|
|
271
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
272
|
+
if (typeof entry !== "string") {
|
|
273
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: header values must be strings`);
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
const normalized = key.toLowerCase();
|
|
277
|
+
if (seen.has(normalized)) {
|
|
278
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: duplicate header ${key}`);
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
seen.add(normalized);
|
|
282
|
+
headers[key] = entry;
|
|
283
|
+
}
|
|
284
|
+
try {
|
|
285
|
+
new Headers(headers);
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
console.warn(`Agent Plugin ${manifest.name} skips invalid MCP server ${serverName}: headers are not valid HTTP fields`);
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
return Object.keys(headers).length > 0 ? headers : undefined;
|
|
292
|
+
}
|
|
293
|
+
function resolvePluginPath(path, cwd) {
|
|
294
|
+
if (path === "~")
|
|
295
|
+
return resolve(process.env.HOME ?? "", ".");
|
|
296
|
+
if (path.startsWith("~/"))
|
|
297
|
+
return resolve(process.env.HOME ?? "", path.slice(2));
|
|
298
|
+
return isAbsolute(path) ? resolve(path) : resolve(cwd, path);
|
|
299
|
+
}
|
|
300
|
+
function isBareCommand(command) {
|
|
301
|
+
return !command.includes("/") && !command.includes("\\") && !command.includes("${PLUGIN_ROOT}") && !command.includes("${PLUGIN_DATA}");
|
|
302
|
+
}
|
|
303
|
+
function resolvePluginCwd(value, pluginRoot, pluginDataDir) {
|
|
304
|
+
if (value === undefined)
|
|
305
|
+
return pluginRoot;
|
|
306
|
+
if (typeof value !== "string")
|
|
307
|
+
return null;
|
|
308
|
+
if (value.startsWith("./"))
|
|
309
|
+
return resolveContainedPath(pluginRoot, value, pluginRoot);
|
|
310
|
+
if (value === "${PLUGIN_ROOT}" || value.startsWith("${PLUGIN_ROOT}/")) {
|
|
311
|
+
return resolveContainedPath(pluginRoot, value.replace("${PLUGIN_ROOT}", "."), pluginRoot);
|
|
312
|
+
}
|
|
313
|
+
if (value === "${PLUGIN_DATA}" || value.startsWith("${PLUGIN_DATA}/")) {
|
|
314
|
+
return resolveContainedPath(pluginDataDir, value.replace("${PLUGIN_DATA}", "."), pluginDataDir);
|
|
315
|
+
}
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
function resolveContainedPath(root, value, containmentRoot) {
|
|
319
|
+
const resolved = resolve(root, value);
|
|
320
|
+
const rel = relative(containmentRoot, resolved);
|
|
321
|
+
if (rel === "" || (!rel.startsWith("..") && !rel.startsWith(sep) && !isAbsolute(rel)))
|
|
322
|
+
return resolved;
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
function expandPluginPlaceholders(value, pluginRoot, pluginDataDir) {
|
|
326
|
+
return value
|
|
327
|
+
.replaceAll("${PLUGIN_ROOT}", pluginRoot)
|
|
328
|
+
.replaceAll("${PLUGIN_DATA}", pluginDataDir);
|
|
329
|
+
}
|
|
330
|
+
function isValidAgentPluginUrl(value) {
|
|
331
|
+
if (value.includes("${") || value.includes("$env:") || value.includes("{env:"))
|
|
332
|
+
return false;
|
|
333
|
+
let url;
|
|
334
|
+
try {
|
|
335
|
+
url = new URL(value);
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
if (url.protocol !== "http:" && url.protocol !== "https:")
|
|
341
|
+
return false;
|
|
342
|
+
if (url.username || url.password || url.hash)
|
|
343
|
+
return false;
|
|
344
|
+
if (url.protocol === "https:")
|
|
345
|
+
return true;
|
|
346
|
+
return isLoopbackHost(url.hostname);
|
|
347
|
+
}
|
|
348
|
+
function isLoopbackHost(hostname) {
|
|
349
|
+
const host = hostname.toLowerCase();
|
|
350
|
+
if (host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]")
|
|
351
|
+
return true;
|
|
352
|
+
if (/^127(?:\.\d{1,3}){3}$/.test(host))
|
|
353
|
+
return true;
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=agent-plugin-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-plugin-loader.js","sourceRoot":"","sources":["../agent-plugin-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,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AAC;IAC3C,OAAO,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACpC,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IACpG,IAAI,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { type AgentPluginSummary } from "./agent-plugin-loader.ts";
|
|
2
|
+
import { type HostConfigDiscovery, type McpConfig, type ServerEntry, type ImportKind, type ServerProvenance } from "./types.ts";
|
|
3
|
+
export interface KnownServerPreset {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
summary: string;
|
|
7
|
+
entry: ServerEntry;
|
|
8
|
+
}
|
|
9
|
+
export declare const KNOWN_SERVER_PRESETS: readonly KnownServerPreset[];
|
|
10
|
+
interface ConfigSourceSpec {
|
|
11
|
+
id: "shared-global" | "agents-global" | "agents-nested-global" | "pi-global" | "shared-project" | "pi-project";
|
|
12
|
+
label: string;
|
|
13
|
+
readPath: string;
|
|
14
|
+
writePath: string;
|
|
15
|
+
kind: "user" | "project" | "import";
|
|
16
|
+
importKind?: string;
|
|
17
|
+
shared: boolean;
|
|
18
|
+
scope: "global" | "project";
|
|
19
|
+
}
|
|
20
|
+
export interface ConfigDiscoveryPath {
|
|
21
|
+
label: string;
|
|
22
|
+
path: string;
|
|
23
|
+
exists: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface DiscoveredImportConfig {
|
|
26
|
+
kind: ImportKind;
|
|
27
|
+
path: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ConfigDiscoverySource extends ConfigDiscoveryPath {
|
|
30
|
+
id: ConfigSourceSpec["id"];
|
|
31
|
+
scope: ConfigSourceSpec["scope"];
|
|
32
|
+
kind: "shared" | "pi";
|
|
33
|
+
serverCount: number;
|
|
34
|
+
}
|
|
35
|
+
export interface ImportConfigSummary extends DiscoveredImportConfig {
|
|
36
|
+
serverCount: number;
|
|
37
|
+
}
|
|
38
|
+
export interface HostConfigSummary extends ImportConfigSummary {
|
|
39
|
+
active: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface McpConfigConflict {
|
|
42
|
+
serverName: string;
|
|
43
|
+
sources: Array<{
|
|
44
|
+
kind: "shared" | "pi" | "host";
|
|
45
|
+
path: string;
|
|
46
|
+
}>;
|
|
47
|
+
winner: {
|
|
48
|
+
kind: "shared" | "pi" | "host";
|
|
49
|
+
path: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface RepoPromptDiscovery {
|
|
53
|
+
configured: boolean;
|
|
54
|
+
configuredPath?: string;
|
|
55
|
+
executablePath?: string;
|
|
56
|
+
targetPath?: string;
|
|
57
|
+
serverName?: string;
|
|
58
|
+
entry?: ServerEntry;
|
|
59
|
+
}
|
|
60
|
+
export interface McpDiscoverySummary {
|
|
61
|
+
sources: ConfigDiscoverySource[];
|
|
62
|
+
imports: ImportConfigSummary[];
|
|
63
|
+
hostConfigs: HostConfigSummary[];
|
|
64
|
+
hostConfigDiscovery: HostConfigDiscovery;
|
|
65
|
+
agentPlugins: AgentPluginSummary[];
|
|
66
|
+
conflicts: McpConfigConflict[];
|
|
67
|
+
hasAnyConfig: boolean;
|
|
68
|
+
hasAnyDetectedPaths: boolean;
|
|
69
|
+
hasSharedServers: boolean;
|
|
70
|
+
hasPiOwnedServers: boolean;
|
|
71
|
+
totalServerCount: number;
|
|
72
|
+
fingerprint: string;
|
|
73
|
+
repoPrompt: RepoPromptDiscovery;
|
|
74
|
+
}
|
|
75
|
+
export interface McpStandardConfigSummary {
|
|
76
|
+
sources: ConfigDiscoverySource[];
|
|
77
|
+
hasSharedServers: boolean;
|
|
78
|
+
fingerprint: string;
|
|
79
|
+
}
|
|
80
|
+
export interface ConfigWritePreview {
|
|
81
|
+
path: string;
|
|
82
|
+
existed: boolean;
|
|
83
|
+
changed: boolean;
|
|
84
|
+
beforeText: string;
|
|
85
|
+
afterText: string;
|
|
86
|
+
diffText: string;
|
|
87
|
+
}
|
|
88
|
+
export declare function getPiGlobalConfigPath(overridePath?: string): string;
|
|
89
|
+
export declare function getGenericGlobalConfigPath(): string;
|
|
90
|
+
export declare function getProjectConfigPath(cwd?: string): string;
|
|
91
|
+
export declare function getProjectPiConfigPath(cwd?: string): string;
|
|
92
|
+
export declare function getConfigDiscoveryPaths(overridePath?: string, cwd?: string): ConfigDiscoveryPath[];
|
|
93
|
+
export declare function findAvailableImportConfigs(cwd?: string): DiscoveredImportConfig[];
|
|
94
|
+
export declare function getMcpStandardConfigSummary(overridePath?: string, cwd?: string): McpStandardConfigSummary;
|
|
95
|
+
export declare function getMcpDiscoverySummary(overridePath?: string, cwd?: string, options?: {
|
|
96
|
+
includeHostConfigs?: boolean;
|
|
97
|
+
}): McpDiscoverySummary;
|
|
98
|
+
export declare function cloneMcpConfig(config: McpConfig): McpConfig;
|
|
99
|
+
export declare function loadMcpConfig(overridePath?: string, cwd?: string): McpConfig;
|
|
100
|
+
export interface ServerDisabledOverrideResult {
|
|
101
|
+
path: string;
|
|
102
|
+
changed: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Persist only the disabled field in the project Pi layer. Enabling writes an
|
|
106
|
+
* explicit false only when a lower-precedence source is itself disabled; this
|
|
107
|
+
* writer never copies a server definition or its credentials into the file.
|
|
108
|
+
*/
|
|
109
|
+
export declare function writeProjectServerDisabledOverride(overridePath: string | undefined, cwd: string, serverName: string, disabled: boolean): ServerDisabledOverrideResult;
|
|
110
|
+
export declare function previewCompatibilityImports(importKinds: ImportKind[], overridePath?: string): ConfigWritePreview;
|
|
111
|
+
export declare function ensureCompatibilityImports(importKinds: ImportKind[], overridePath?: string): {
|
|
112
|
+
path: string;
|
|
113
|
+
added: ImportKind[];
|
|
114
|
+
};
|
|
115
|
+
export declare function buildStarterProjectConfig(): McpConfig;
|
|
116
|
+
export declare function previewStarterProjectConfig(cwd?: string): ConfigWritePreview;
|
|
117
|
+
export declare function writeStarterProjectConfig(cwd?: string): string;
|
|
118
|
+
export declare function previewSharedServerEntry(filePath: string, serverName: string, entry: ServerEntry): ConfigWritePreview;
|
|
119
|
+
export declare function writeSharedServerEntry(filePath: string, serverName: string, entry: ServerEntry): string;
|
|
120
|
+
export declare function getServerProvenance(overridePath?: string, cwd?: string): Map<string, ServerProvenance>;
|
|
121
|
+
export declare function writeDirectToolsConfig(changes: Map<string, true | string[] | false>, provenance: Map<string, ServerProvenance>, fullConfig: McpConfig): void;
|
|
122
|
+
export declare function resolveConfiguredOAuthDir(raw: unknown, cwd?: string): string | undefined;
|
|
123
|
+
export {};
|