/**
 * Shared Anthropic API credentials.
 *
 * Three tiers, highest priority first:
 *   1. Per-agent bundle (`credentialBundle.body.llm` for Anthropic) —
 *      delivered by the heartbeat. Authoritative when present.
 *   2. Shared in-memory heartbeat cache (`sharedKeys.anthropicApiKey`).
 *   3. Local `config.anthropicApiKey` — manual or per-agent persisted
 *      fallback used when the higher-priority runtime tiers are unavailable.
 *      The heartbeat shared-keys path seeds this on first delivery but
 *      never overwrites an existing value.
 *
 * This mirrors `gemini-credentials.ts` / `phonecall-credentials.ts`.
 */
let bundleAnthropicApiKey;
let sharedAnthropicApiKey;
export function setBundleAnthropicApiKey(apiKey) {
    if (bundleAnthropicApiKey === apiKey)
        return false;
    bundleAnthropicApiKey = apiKey;
    return true;
}
export function setSharedAnthropicApiKey(apiKey) {
    if (sharedAnthropicApiKey === apiKey)
        return false;
    sharedAnthropicApiKey = apiKey;
    return true;
}
/**
 * Resolve the Anthropic API key to use.
 *
 * Precedence: per-agent bundle > shared cache > local config (offline cache).
 */
export function resolveAnthropicApiKey(config) {
    return bundleAnthropicApiKey ?? sharedAnthropicApiKey ?? config.anthropicApiKey;
}
//# sourceMappingURL=anthropic-credentials.js.map