/** * Universal sovereign-first LLM provider resolution. * * Founder directive (2026-06-10): HoloClaw, the fleet, and Brittney resolve * their LLM the SAME way — sovereign by default, frontier APIs as BYOK * fallback only. This file is the canonical implementation of that policy * (F.112 extended ecosystem-wide; P.009 sovereign embeddings is the * companion for embeddings). Surfaces that still carry their own copy of * the policy (studio's lib/brittney/provider.ts) should converge here. * * Auto-detect priority (no explicit provider): * 1. local-fleet — owned laptop/Jetson model-fleet routes, discovered per request * 2. fleet — Vast serverless sovereign serving fleet (P.008), route-probed * per request so cold pools can fall back while they wake * 3. cloud — pinned sovereign serving endpoint (BrittneyCloudAdapter) * 4. holollama — sovereign local inference layer (llama.cpp llama-server, D.117), * when HOLOLLAMA_URL is set; preferred over legacy Ollama * 5. ollama — legacy local model (OLLAMA_HOST), kept for back-compat * 6. anthropic / xai / openai — BYOK frontier fallback, in that order * 7. holollama (default :18080) — TERMINAL sovereign default (D.117), instead of * a bare "nothing configured" throw * * Env surface (universal names first, BRITTNEY_* kept as compat aliases): * HOLO_LLM_PROVIDER | BRITTNEY_PROVIDER explicit override * HOLO_LLM_SERVICE_URL | BRITTNEY_SERVICE_URL cloud endpoint * HOLO_LLM_MODEL | BRITTNEY_MODEL model override * HOLO_LLM_MAX_TOKENS | BRITTNEY_MAX_TOKENS max-token override * OLLAMA_HOST | OLLAMA_BASE_URL | OLLAMA_URL local endpoint * FLEET_PROVIDER_ENDPOINT | VAST_QWEN_ENDPOINT_NAME Vast endpoint * HOLO_LLM_FLEET_MODEL | BRITTNEY_FLEET_MODEL fleet model * HOLO_LLM_FLEET_BRAIN owned local @model_fleet source * VAST_API_KEY Vast route + worker bearer * ANTHROPIC_API_KEY / XAI_API_KEY / OPENAI_API_KEY BYOK fallbacks * HOLOSERVE_PARITY_PINS model@binding-sha256 pins (comma-separated) * HOLOSERVE_PARITY_REGISTRY path to the parity pin registry JSON * (maintained by ai-ecosystem * scripts/holoserve-llamaserver-parity-receipt.mjs) */ import type { ILLMProvider } from './types'; import type { FleetBackend } from './fleet-router'; export type SovereignProviderName = 'local-fleet' | 'fleet' | 'cloud' | 'holoserve' | 'holollama' | 'ollama' | 'anthropic' | 'xai' | 'openai'; export interface ResolvedSovereignProvider { provider: ILLMProvider; /** Model string to pass to complete()/streamCompletion(). */ model: string; maxTokens: number; providerName: SovereignProviderName; /** Concrete owned-fleet wire protocol selected in-band by resolveLocalFleet. */ fleetBackend?: FleetBackend; /** Exact parity-tested HoloServe binding when a strangler pin selected this route. */ artifactBindingSha256?: string; } export interface SovereignResolveOptions { /** Explicit provider override (CLI flag etc.) — beats every env. */ explicit?: string; /** BYOK Anthropic key (e.g. per-user vault) — overrides ANTHROPIC_API_KEY. */ anthropicKey?: string | null; /** Model override — beats HOLO_LLM_MODEL/BRITTNEY_MODEL. */ model?: string; /** Max-token override — beats HOLO_LLM_MAX_TOKENS/BRITTNEY_MAX_TOKENS. */ maxTokens?: number; } /** * Synchronous sovereign-first resolution: cloud → ollama → anthropic → xai → * openai. Fleet (dynamic-resolve) needs a network round-trip — use * `resolveSovereignProviderAsync` to include it. */ export declare function resolveSovereignProvider(opts?: SovereignResolveOptions): ResolvedSovereignProvider; /** * Async sovereign-first resolution — prefers the serving fleet * (dynamic-resolve; the GET also bumps demand so the autoscaler warms a box), * gracefully falling back to the sync chain when the fleet is cold or * unreachable, so scale-to-zero never breaks a caller. */ export declare function resolveSovereignProviderAsync(opts?: SovereignResolveOptions): Promise;