/** * Unified agent resolution — resolves Canon agent credentials from * environment variables or ~/.canon/agents.json profiles. * * Used by the Claude Code plugin (host.ts, server.ts) and available * for any future agent integration. * * Resolution order: * 1. CANON_API_KEY env var (highest priority, no lock) * 2. CANON_AGENT env var (named profile with lock) * 3. Auto-select from profiles (first unlocked, with lock) */ import { type ProfileLockHandle } from './agent-profiles.js'; import type { CanonEnvironmentId } from '@canonmsg/backend-contracts'; import type { AgentClientType } from './types.js'; export interface ResolvedAgent { apiKey: string; agentId?: string; profile: string | null; agentName?: string; clientType?: AgentClientType; environmentId: CanonEnvironmentId; baseUrl: string; streamUrl: string; rtdbUrl: string; firebaseApiKey: string; lockHandle?: ProfileLockHandle; } export declare function verifyResolvedAgentEnvironment(resolved: ResolvedAgent): Promise; /** Get the currently locked profile name (for cleanup on shutdown). */ export declare function getActiveProfile(): string | null; export declare function getActiveProfileLock(): ProfileLockHandle | null; export declare function resolveCanonProfile(name: string, opts?: { logPrefix?: string; lock?: boolean; expectedClientType?: AgentClientType; }): ResolvedAgent; /** * Resolve Canon agent credentials. * * @param opts.logPrefix - Log prefix for console messages (default: '[canon]') * @returns Resolved agent with API key, optional agentId, and profile name * @throws Error if no agent can be resolved */ export declare function resolveCanonAgent(opts?: { logPrefix?: string; expectedClientType?: AgentClientType; lock?: boolean; }): ResolvedAgent;