/** * Multi-profile support. * * Allows a single Meridian instance to route requests to different Claude * accounts. Each profile is a named auth context — a CLAUDE_CONFIG_DIR for * Max subscriptions, an Anthropic API key for direct API access, or a * long-lived OAuth token minted by `claude setup-token`. * * Profile selection priority: * 1. x-meridian-profile request header (per-request override) * 2. Active profile (set via POST /profiles/active or UI) * 3. First configured profile (or implicit "default" if none configured) * * This is a leaf module — no imports from server.ts or session/. */ /** * Load profiles from ~/.config/meridian/profiles.json. * Cached with a 5s TTL so new profiles are picked up without restart, * while avoiding synchronous disk I/O on every request. */ export declare function loadProfilesFromDisk(): ProfileConfig[]; export type ProfileType = "claude-max" | "api" | "oauth-token"; export interface ProfileConfig { /** Unique profile identifier (e.g. "personal", "work") */ id: string; /** * Auth type. Inferred from the populated credential field when omitted: * - `oauthToken` → "oauth-token" (CLAUDE_CODE_OAUTH_TOKEN) * - `apiKey`/`baseUrl` → must be combined with explicit `type: "api"` * - `claudeConfigDir` → "claude-max" (CLAUDE_CONFIG_DIR) */ type?: ProfileType; /** Path to .claude config directory (claude-max profiles) */ claudeConfigDir?: string; /** Anthropic API key (api profiles) */ apiKey?: string; /** Anthropic base URL override (api profiles) */ baseUrl?: string; /** Long-lived OAuth token from `claude setup-token` (oauth-token profiles) */ oauthToken?: string; } export interface ResolvedProfile { id: string; type: ProfileType; /** Env vars to overlay on the SDK subprocess environment */ env: Record; } /** * Set the active profile. All requests without an explicit x-meridian-profile * header will use this profile. Persisted to ~/.config/meridian/settings.json. */ export declare function setActiveProfile(profileId: string): void; /** * Get the current active profile ID. */ export declare function getActiveProfileId(): string | undefined; /** Reset active profile — for testing only. */ export declare function resetActiveProfile(): void; /** * Load persisted active profile from settings. Called once at startup * to restore the user's last selection. Only restores when disk * discovery is enabled (i.e. real CLI startup, not tests). * Validates the saved profile actually exists before restoring. */ export declare function restoreActiveProfile(configProfiles?: ProfileConfig[]): void; /** Enable disk auto-discovery of profiles. Called by the CLI when * no MERIDIAN_PROFILES env var is set, so the server picks up * profiles from ~/.config/meridian/profiles.json dynamically. */ export declare function enableDiskProfileDiscovery(): void; export declare function getEffectiveProfiles(configProfiles: ProfileConfig[] | undefined): ProfileConfig[]; /** Check if any profiles are available from any source */ export declare function hasProfiles(configProfiles: ProfileConfig[] | undefined): boolean; /** * Resolve a profile from the configuration. * * @param profiles - Configured profiles (from ProxyConfig) * @param defaultProfile - Default profile ID (from ProxyConfig) * @param requestedId - Explicit profile ID from request header */ export declare function resolveProfile(profiles: ProfileConfig[] | undefined, defaultProfile: string | undefined, requestedId?: string): ResolvedProfile; /** * Get all configured profile IDs with their types. */ export declare function listProfiles(profiles: ProfileConfig[] | undefined, defaultProfile: string | undefined): Array<{ id: string; type: ProfileType; isActive: boolean; }>; //# sourceMappingURL=profiles.d.ts.map