/** * Bridge between SaaS-side envs (envs.json / /api/v1/user — managed by * configure_env, signin_*) and on-prem env-config docs (k8s ConfigMap / * AWS SSM / GCP Secret Manager / Azure App Config / local file — * managed by env_register, offload_add, etc.). * * Background — arc v9 surfaced the same defect across 4 tools (doctor, * pattern_trend, pattern_examples, metric_overlay): a user who typed * the on-prem env-config nickname ("otel-demo") got "Unknown * environment" because resolveEnv only matches against the SaaS * envs.json nickname ("10x Demo"). Same env_id, two identity surfaces, * no bridge. * * This module fixes that by walking the on-prem stores at startup, * finding every env-config doc, and aliasing its nickname + env_id * into envs.byNickname pointing at the same SaaS EnvConfig (joined * via env_id). Also adds the SaaS env_id as an alias so users can * type a UUID at any prompt. * * Idempotent. Conflicts (two on-prem docs claiming the same alias for * different SaaS envs) are logged and skipped — first one wins. * Failures during on-prem read are NON-FATAL — the boot must succeed * for laptop / dev / no-cluster setups where every store reports * unavailable. */ import type { Environments } from './environments.js'; import type { StoreKind } from './env-config/store-interface.js'; export interface AliasBridgeResult { /** Total aliases added to envs.byNickname across all paths. */ aliases_added: number; /** Per-store breakdown — what was found, what was added, what was skipped. */ per_store: Array<{ store_kind: StoreKind; available: boolean; reason: string; docs_found: number; aliases_added: number; aliases_skipped_conflict: number; }>; /** SaaS-side env_ids added as aliases (UUID typing path). */ saas_env_id_aliases: number; } /** * Walks the on-prem store chain and adds alias entries to * envs.byNickname so users can resolve an env by any of: * - its SaaS nickname (already worked) * - its SaaS env_id / UUID * - any on-prem env-config nickname that joins to the same env_id * * Mutates envs in place. Returns a structured summary for diagnostics. * * Non-fatal: store failures are caught and reported in per_store, not * thrown. Boot continues even if every store is unavailable. */ export declare function enrichEnvAliasesFromOnPrem(envs: Environments): Promise;