import { G as GenericAdapterConfig } from './createAdapter-C-pKR1aO.js';
export { C as CreateAdapterConfig, c as createAdapter } from './createAdapter-C-pKR1aO.js';
import * as _agentskit_core from '@agentskit/core';
import { AdapterFactory, AdapterRequest, DataRegion, AdapterCapabilities, StreamChunk, EmbedFn } from '@agentskit/core';
export { DataRegion } from '@agentskit/core';
import { R as RetryOptions } from './utils-ddwu4MN4.js';
export { c as chunkText, f as fetchWithRetry, s as simulateStream } from './utils-ddwu4MN4.js';

declare function generic(config: GenericAdapterConfig): AdapterFactory;

interface AnthropicConfig {
    apiKey: string;
    model: string;
    baseUrl?: string;
    maxTokens?: number;
    retry?: RetryOptions;
}
declare function anthropic(config: AnthropicConfig): AdapterFactory;

interface OpenAIConfig {
    apiKey: string;
    model: string;
    baseUrl?: string;
    retry?: RetryOptions;
    /**
     * Ask the provider to include token usage in the final stream chunk via
     * `stream_options: { include_usage: true }`. Off by default because some
     * OpenAI-compatible providers (OpenRouter proxies to a long tail of
     * backends) reject unknown params with a 4xx and break the whole stream.
     * Turn this on for vanilla `api.openai.com`.
     */
    includeUsage?: boolean;
}
declare function openai(config: OpenAIConfig): AdapterFactory;

interface GeminiConfig {
    apiKey: string;
    model: string;
    baseUrl?: string;
    retry?: RetryOptions;
}
declare function gemini(config: GeminiConfig): AdapterFactory;

interface OpenAICompatibleConfig extends OpenAIConfig {
}

interface GrokConfig extends OpenAICompatibleConfig {
}
declare const grok: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface OllamaConfig {
    model: string;
    baseUrl?: string;
    retry?: RetryOptions;
}
declare function ollama(config: OllamaConfig): AdapterFactory;

interface DeepSeekConfig extends OpenAICompatibleConfig {
}
declare const deepseek: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface KimiConfig extends OpenAICompatibleConfig {
}
declare const kimi: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

type LangChainRunnable = {
    stream?: (input: unknown, config?: Record<string, unknown>) => AsyncIterable<unknown> | Promise<AsyncIterable<unknown>>;
    streamEvents?: (input: unknown, config?: Record<string, unknown>) => AsyncIterable<Record<string, unknown>> | Promise<AsyncIterable<Record<string, unknown>>>;
};
interface LangChainConfig {
    runnable: LangChainRunnable;
    mode?: 'stream' | 'events';
}
declare function langchain(config: LangChainConfig): AdapterFactory;
interface LangGraphConfig {
    graph: LangChainRunnable;
}
declare function langgraph(config: LangGraphConfig): AdapterFactory;

interface VercelAIConfig {
    api: string;
    headers?: Record<string, string>;
    retry?: RetryOptions;
}
declare function vercelAI(config: VercelAIConfig): AdapterFactory;

interface MistralConfig extends OpenAICompatibleConfig {
}
/**
 * Mistral AI. Uses the OpenAI-compatible chat completions endpoint.
 * Default models: `mistral-large-latest`, `mistral-small-latest`,
 * `open-mistral-nemo`.
 */
declare const mistral: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface CohereConfig extends OpenAICompatibleConfig {
}
/**
 * Cohere Command models via Cohere's OpenAI-compatibility endpoint.
 *
 * - Streams tokens via SSE (OpenAI-compatible chunks).
 * - Supports tool calls in the OpenAI `tools` shape.
 * - Reports `usage` on the final stream chunk when the upstream model
 *   returns it (Cohere's compatibility layer mirrors OpenAI's
 *   `stream_options: { include_usage: true }` semantics).
 * - Inherits auto-retry from the shared OpenAI core (`retry`).
 *
 * Default model: `command-r-plus`. Override via `model`.
 */
declare function cohere(config: Partial<CohereConfig> & {
    apiKey: string;
}): AdapterFactory;
/** Alias for naming consistency with other native adapters. */
declare const cohereAdapter: typeof cohere;

interface TogetherConfig extends OpenAICompatibleConfig {
}
/**
 * Together AI. OpenAI-compatible endpoint, broad open-model catalog
 * (Llama, Qwen, DeepSeek, Mixtral, etc.).
 */
declare const together: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface GroqConfig extends OpenAICompatibleConfig {
}
/**
 * Groq — OpenAI-compatible endpoint serving Llama / Mixtral on LPUs.
 * Known for very low first-token latency.
 *
 * Default model: `llama-3.3-70b-versatile`.
 */
declare function groq(config: Partial<GroqConfig> & {
    apiKey: string;
}): AdapterFactory;
/** Alias for naming consistency with other native adapters. */
declare const groqAdapter: typeof groq;

interface FireworksConfig extends OpenAICompatibleConfig {
}
/**
 * Fireworks AI. OpenAI-compatible endpoint with tuned open-source
 * models and fine-tunes (Llama, DeepSeek, Qwen, etc.).
 */
declare const fireworks: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface OpenRouterConfig extends OpenAICompatibleConfig {
}
/**
 * OpenRouter — routes to 300+ provider models behind a single
 * OpenAI-compatible endpoint. Pass the fully-qualified id as
 * `model`, e.g. `anthropic/claude-sonnet-4-6`.
 */
declare const openrouter: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface HuggingFaceConfig extends OpenAICompatibleConfig {
}
/**
 * Hugging Face Inference Providers router. OpenAI-compatible
 * endpoint that fans out to HF-hosted model inference providers.
 * Pass any supported repo id as `model`, e.g.
 * `meta-llama/Meta-Llama-3.1-8B-Instruct`.
 */
declare const huggingface: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface LMStudioConfig extends OpenAICompatibleConfig {
}
/**
 * LM Studio local server. Start the built-in OpenAI-compatible
 * server in LM Studio, then point this adapter at
 * `http://localhost:1234/v1` (the default).
 */
declare const lmstudio: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface VLLMConfig extends OpenAICompatibleConfig {
}
/**
 * vLLM's OpenAI-compatible serving endpoint. Defaults to
 * `http://localhost:8000/v1` — the standard `vllm serve ...` port.
 */
declare const vllm: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface LlamaCppConfig extends OpenAICompatibleConfig {
}
/**
 * llama.cpp's OpenAI-compatible HTTP server (`llama-server`). Defaults
 * to `http://localhost:8080/v1`, matching the binary's default port.
 */
declare const llamacpp: (config: OpenAICompatibleConfig) => _agentskit_core.AdapterFactory;

interface CerebrasConfig extends OpenAICompatibleConfig {
}
/**
 * Cerebras — ultra-fast inference on wafer-scale chips. OpenAI-compatible
 * endpoint serving Llama / Qwen models with very low first-token latency.
 *
 * Default model: `llama-3.3-70b`.
 */
declare function cerebras(config: Partial<CerebrasConfig> & {
    apiKey: string;
}): AdapterFactory;
declare const cerebrasAdapter: typeof cerebras;

interface AzureOpenAIConfig {
    apiKey: string;
    /** Resource endpoint, e.g. `https://my-resource.openai.azure.com`. */
    endpoint: string;
    /** Deployment name (NOT the underlying model name — Azure routes by deployment). */
    deployment: string;
    /** Azure REST `api-version`. Defaults to `2024-10-21`. */
    apiVersion?: string;
    retry?: RetryOptions;
    /** Surface usage by setting `stream_options.include_usage`. Defaults to true. */
    includeUsage?: boolean;
}
declare function azureOpenAI(config: AzureOpenAIConfig): AdapterFactory;
declare const azureOpenAIAdapter: typeof azureOpenAI;

interface ReplicateConfig {
    apiKey: string;
    /** Replicate model id, e.g. `meta/meta-llama-3-70b-instruct`. */
    model: string;
    /** Optional pinned version hash (for non-official models). */
    version?: string;
    /** Override the prediction endpoint base. */
    baseUrl?: string;
    /** Map AdapterRequest → Replicate `input` object. Defaults to `{ prompt }`. */
    toInput?: (request: AdapterRequest) => Record<string, unknown>;
}
declare function replicate(config: ReplicateConfig): AdapterFactory;
declare const replicateAdapter: typeof replicate;

interface BailConfig extends OpenAICompatibleConfig {
}
/**
 * Alibaba Bailian (Qwen) via the DashScope OpenAI-compatibility endpoint.
 *
 * Supports the Qwen-2.5 / 3 chat series and Qwen-VL multimodal models. APAC
 * users typically prefer this over OpenAI for latency + data residency.
 *
 * Default model: `qwen-max`.
 */
declare function bail(config: Partial<BailConfig> & {
    apiKey: string;
}): AdapterFactory;
declare const bailAdapter: typeof bail;
/** Alias matching Alibaba's product naming. */
declare const qwen: typeof bail;

interface VertexConfig {
    /** GCP project id. */
    project: string;
    /** Region, e.g. `us-central1`. */
    region: string;
    /** Vertex model id, e.g. `gemini-2.5-pro`. */
    model: string;
    /**
     * OAuth2 access token, or a function returning one (called per request).
     *
     * Use the `google-auth-library` (or `gcloud auth print-access-token`) to
     * mint these — the adapter intentionally doesn't take that as a hard dep.
     */
    accessToken: string | (() => string | Promise<string>);
    /** Override the publisher (defaults to `google`; set for partner publishers). */
    publisher?: string;
    retry?: RetryOptions;
}
declare function vertex(config: VertexConfig): AdapterFactory;
declare const vertexAdapter: typeof vertex;

interface BedrockConfig {
    /** Bedrock model id, e.g. `anthropic.claude-3-5-sonnet-20241022-v2:0`. */
    model: string;
    /** AWS region (e.g. `us-east-1`). Falls back to the SDK's default credential chain. */
    region?: string;
    /** Override `max_tokens` (Anthropic on Bedrock requires it). Defaults to 4096. */
    maxTokens?: number;
    /**
     * Override the SDK client. Mostly for tests; production code should let the
     * adapter create the client from `region` + the SDK's default credential
     * chain.
     */
    client?: BedrockRuntimeClientLike;
}
/**
 * Minimal structural type for `BedrockRuntimeClient` so we don't take a hard
 * dep on `@aws-sdk/client-bedrock-runtime`.
 *
 * Second options argument is optional so existing one-argument injected
 * clients remain structurally valid.
 */
interface BedrockRuntimeClientLike {
    send(command: {
        input: BedrockInvokeInput;
    }, options?: {
        abortSignal?: AbortSignal;
    }): Promise<{
        body?: AsyncIterable<{
            chunk?: {
                bytes?: Uint8Array;
            };
        }>;
    }>;
}
interface BedrockInvokeInput {
    modelId: string;
    contentType: string;
    accept: string;
    body: string;
}
declare function bedrock(config: BedrockConfig): AdapterFactory;
declare const bedrockAdapter: typeof bedrock;

/**
 * Browser-only adapter backed by WebLLM (https://github.com/mlc-ai/web-llm).
 * Models run on-device via WebGPU; no network for inference. The MLCEngine
 * is loaded lazily on first stream so apps can ship the import without
 * paying the wasm cost up front.
 *
 * `@mlc-ai/web-llm` is an **optional peer dependency** — install it
 * alongside this package when you opt into browser-only inference.
 */
interface WebLlmConfig {
    /** Model id from MLC's catalog, e.g. `Llama-3.1-8B-Instruct-q4f16_1-MLC`. */
    model: string;
    /**
     * Override the engine to inject a pre-loaded one (the MLCEngine spin-up
     * is non-trivial — apps usually warm it once, not per turn).
     */
    engine?: WebLlmEngineLike;
    /** Engine progress callback (model download / compile percent). */
    onProgress?: (info: {
        progress: number;
        text: string;
    }) => void;
}
interface WebLlmEngineLike {
    reload(model: string, opts?: {
        initProgressCallback?: (i: {
            progress: number;
            text: string;
        }) => void;
    }): Promise<void>;
    chat: {
        completions: {
            create(params: {
                messages: Array<{
                    role: string;
                    content: string;
                }>;
                stream: true;
            }): AsyncIterable<{
                choices: Array<{
                    delta?: {
                        content?: string;
                    };
                }>;
            }> | Promise<AsyncIterable<{
                choices: Array<{
                    delta?: {
                        content?: string;
                    };
                }>;
            }>>;
        };
    };
}
declare function webllm(config: WebLlmConfig): AdapterFactory;
declare const webllmAdapter: typeof webllm;

interface RouterCandidate {
    id: string;
    adapter: AdapterFactory;
    /** Data residency region for this adapter endpoint. */
    region?: DataRegion;
    /**
     * Relative cost hint (lower wins for policy='cheapest'). Only
     * relative values matter — use $/1M tokens or any consistent unit.
     */
    cost?: number;
    /** Typical latency in ms. Lower wins for policy='fastest'. */
    latencyMs?: number;
    /**
     * Capability override. Defaults to `adapter.capabilities`.
     * Used to reject candidates missing required features
     * (e.g. tools, multiModal).
     */
    capabilities?: AdapterCapabilities;
    /** Free-form tags used by classifier routing (e.g. 'fast', 'coding'). */
    tags?: string[];
    /**
     * Estimated grid CO2 intensity (gCO2eq per 1k tokens) for this
     * adapter+region. Lower wins for `policy='greenest'`. Use
     * `applyCarbonTable()` to populate from `DEFAULT_CARBON_TABLE` or
     * a custom table.
     */
    gCO2PerKtok?: number;
}
type RouterPolicy = 'cheapest' | 'fastest' | 'greenest' | 'green-cost' | 'capability-match' | ((input: {
    request: AdapterRequest;
    candidates: RouterCandidate[];
}) => string | Promise<string>);
interface RouterOptions {
    candidates: RouterCandidate[];
    /** Require all selected adapters to match this data-residency region. */
    region?: DataRegion;
    /** Dynamic region selector. Takes precedence over `region`. */
    regionOf?: (request: AdapterRequest) => DataRegion | undefined;
    /** Policy when `classify` doesn't pick a candidate. Default 'cheapest'. */
    policy?: RouterPolicy;
    /**
     * Fast path: inspect the request, return a candidate id or tag(s).
     * Return `undefined` to fall back to `policy`.
     */
    classify?: (request: AdapterRequest) => string | string[] | undefined;
    /** Observability hook — fires once per decision. */
    onRoute?: (decision: {
        id: string;
        reason: string;
        request: AdapterRequest;
    }) => void;
}
/**
 * Build an AdapterFactory that picks one of N candidates per request.
 *
 * Resolution order:
 *  1. `classify(request)` returns a candidate id → use it
 *  2. `classify(request)` returns tag(s) → filter by tags, then `policy`
 *  3. Fall back to `policy` over all capability-matched candidates
 */
declare function createRouter(options: RouterOptions): AdapterFactory;

/**
 * Carbon-aware routing data. Estimated grid CO2 intensity (gCO2eq per
 * 1k tokens) per provider+region. Numbers are best-effort approximations
 * derived from public grid-mix data and provider PUE disclosures — they
 * are good enough to differentiate "very dirty" from "very clean" but
 * are not audited.
 *
 * Sources:
 *   - Electricity Maps (electricitymaps.com) for grid carbon intensity.
 *   - Provider PUE / efficiency reports (Anthropic, Google, AWS).
 *   - LLMCarbon (Faiz et al., 2024) for tok→J coefficients.
 *
 * Pull-requests welcome to refine. The table is community-updateable
 * and ships at compile time; a runtime table can be passed via
 * `applyCarbonTable(candidates, customTable)`.
 *
 * Closes part of issue #209.
 */
type ProviderRegionKey = `${string}:${string}`;
type CarbonTable = Record<ProviderRegionKey, number>;
/**
 * Default carbon table. Keys are `provider:region`; values are
 * estimated gCO2eq per 1k tokens of typical mixed input/output. Lower
 * is greener.
 */
declare const DEFAULT_CARBON_TABLE: CarbonTable;
interface ApplyCarbonOptions {
    /** Override the default table. */
    table?: CarbonTable;
    /**
     * How to derive the lookup key for a candidate. Defaults to
     * `${provider}:${region}` where `provider` is the candidate id
     * before the first `-` and `region` is `candidate.region`.
     */
    keyFor?: (candidate: RouterCandidate) => ProviderRegionKey | undefined;
    /** Fallback gCO2eq per 1k tokens when no table entry is found. */
    fallback?: number;
}
/**
 * Decorate a list of router candidates with `gCO2PerKtok` from a
 * carbon table. Returns a new list — does not mutate the input.
 *
 * ```ts
 * const candidates = applyCarbonTable([
 *   { id: 'openai-eu',   adapter: openai({...}), region: 'swedencentral', cost: 0.6 },
 *   { id: 'anthropic-us', adapter: anthropic({...}), region: 'us-east-1',   cost: 0.5 },
 * ])
 *
 * const router = createRouter({ candidates, policy: 'green-cost' })
 * ```
 */
declare function applyCarbonTable(candidates: RouterCandidate[], options?: ApplyCarbonOptions): RouterCandidate[];
/**
 * Estimated CO2 emitted by a single completion (grams). Multiply
 * `gCO2PerKtok` by `tokens / 1000`. Provided as a convenience for
 * dashboards / chargeback reports — runtimes typically derive this
 * from token usage events.
 */
declare function estimateCO2Grams(gCO2PerKtok: number | undefined, tokens: number): number;

interface EnsembleCandidate {
    id: string;
    adapter: AdapterFactory;
    /** Weight used by 'weighted-vote' aggregator. Default 1. */
    weight?: number;
}
interface EnsembleBranchResult {
    id: string;
    text: string;
    chunks: StreamChunk[];
    error?: Error;
}
type EnsembleAggregator = 'majority-vote' | 'concat' | 'longest' | ((branches: EnsembleBranchResult[]) => string | Promise<string>);
interface EnsembleOptions {
    candidates: EnsembleCandidate[];
    /** How to combine branches into the single output text. Default 'majority-vote'. */
    aggregate?: EnsembleAggregator;
    /** Per-candidate timeout in ms. Branches that time out are marked with an error. */
    timeoutMs?: number;
    /** Observability hook — fires once with every branch's result. */
    onBranches?: (branches: EnsembleBranchResult[]) => void;
}
/**
 * Build an AdapterFactory that runs the same request against N
 * candidates in parallel, then aggregates the results into a single
 * text output. Unlike `speculate` (which picks a winner), `ensemble`
 * combines — majority vote, concatenation, longest, or a custom fn.
 *
 * The returned source emits a single `{ type: 'text' }` chunk with
 * the aggregated output followed by `{ type: 'done' }`, so it plugs
 * into any runtime that expects a regular streaming adapter.
 */
declare function createEnsembleAdapter(options: EnsembleOptions): AdapterFactory;

interface FallbackOptions {
    /**
     * Predicate deciding whether an error from a given adapter should
     * trigger fall-through to the next. Default: always retry the next.
     */
    shouldRetry?: (error: Error, index: number) => boolean;
    /** Observability hook — fires when one adapter fails and the chain advances. */
    onFallback?: (from: {
        id: string;
        index: number;
        error: Error;
    }) => void;
}
interface FallbackCandidate {
    id: string;
    adapter: AdapterFactory;
}
/**
 * Try adapters in order. If the first fails (throws while opening, or
 * errors mid-stream before emitting any non-done chunk), fall through
 * to the next. As soon as a candidate produces its first real chunk,
 * that's the committed one — we don't retroactively retry mid-stream.
 *
 * Errors that happen *after* committing are propagated; the caller
 * sees a normal streaming failure, not a mysterious cross-candidate
 * retry that could duplicate tool calls.
 */
declare function createFallbackAdapter(candidates: FallbackCandidate[], options?: FallbackOptions): AdapterFactory;

type MockResponse = StreamChunk[] | ((request: AdapterRequest) => StreamChunk[]);
interface MockAdapterOptions {
    /**
     * Static chunks, a request-aware function, or a sequence of responses
     * (the i-th call returns the i-th item, looping when exhausted).
     */
    response: MockResponse | MockResponse[];
    /** ms between yielded chunks. Default 0 (synchronous). */
    delayMs?: number;
    /** Track every request the adapter received. Useful for assertions. */
    history?: AdapterRequest[];
}
/**
 * A deterministic adapter for tests, demos, and dry-run experiments.
 *
 * Conforms to ADR 0001 — Adapter contract:
 * - createSource is pure (A1) — no work until stream() runs
 * - Always emits a terminal chunk (A3)
 * - abort() is safe (A6)
 * - Does not mutate input messages (A7)
 *
 * Examples:
 *
 *   // Static
 *   const adapter = mockAdapter({
 *     response: [
 *       { type: 'text', content: 'Hello!' },
 *       { type: 'done' },
 *     ],
 *   })
 *
 *   // Request-aware
 *   const adapter = mockAdapter({
 *     response: req => {
 *       const last = req.messages[req.messages.length - 1]?.content ?? ''
 *       return [
 *         { type: 'text', content: 'Echo: ' + last },
 *         { type: 'done' },
 *       ]
 *     },
 *   })
 *
 *   // Sequenced — different output each call
 *   const adapter = mockAdapter({
 *     response: [
 *       [{ type: 'text', content: 'first' }, { type: 'done' }],
 *       [{ type: 'text', content: 'second' }, { type: 'done' }],
 *     ],
 *   })
 */
declare function mockAdapter(options: MockAdapterOptions): AdapterFactory;
interface RecordedTurn {
    /** ISO timestamp when this turn was recorded. */
    recordedAt: string;
    /** The request that produced this turn. */
    request: AdapterRequest;
    /** Every chunk yielded by the wrapped adapter. */
    chunks: StreamChunk[];
}
type RecordingFixture = RecordedTurn[];
interface RecordingSink {
    push(turn: RecordedTurn): void | Promise<void>;
}
/**
 * Wrap a real adapter so every turn is captured to a sink. Use this in
 * dev to build up a fixture, then replay with replayAdapter() in tests.
 */
declare function recordingAdapter(inner: AdapterFactory, sink: RecordingSink): AdapterFactory;
/**
 * In-memory recording sink — useful for tests and ephemeral capture.
 */
declare function inMemorySink(): RecordingSink & {
    fixture: RecordingFixture;
};
/**
 * Replay an adapter from a recorded fixture. Each turn maps 1:1 to a
 * recorded entry by index — call N replays fixture[N % fixture.length].
 */
declare function replayAdapter(fixture: RecordingFixture): AdapterFactory;

interface OpenAIEmbedderConfig {
    apiKey: string;
    model?: string;
    baseUrl?: string;
}
declare function openaiEmbedder(config: OpenAIEmbedderConfig): EmbedFn;

interface GeminiEmbedderConfig {
    apiKey: string;
    model?: string;
    baseUrl?: string;
}
declare function geminiEmbedder(config: GeminiEmbedderConfig): EmbedFn;

interface OllamaEmbedderConfig {
    model?: string;
    baseUrl?: string;
}
declare function ollamaEmbedder(config: OllamaEmbedderConfig): EmbedFn;

interface OpenAICompatibleEmbedderConfig {
    apiKey: string;
    model: string;
    baseUrl?: string;
}
declare function createOpenAICompatibleEmbedder(provider: string, defaultBaseUrl: string): (config: OpenAICompatibleEmbedderConfig) => EmbedFn;

interface DeepSeekEmbedderConfig extends OpenAICompatibleEmbedderConfig {
}
declare const deepseekEmbedder: (config: OpenAICompatibleEmbedderConfig) => _agentskit_core.EmbedFn;

interface GrokEmbedderConfig extends OpenAICompatibleEmbedderConfig {
}
declare const grokEmbedder: (config: OpenAICompatibleEmbedderConfig) => _agentskit_core.EmbedFn;

interface KimiEmbedderConfig extends OpenAICompatibleEmbedderConfig {
}
declare const kimiEmbedder: (config: OpenAICompatibleEmbedderConfig) => _agentskit_core.EmbedFn;

/**
 * Provider model deprecation policy. When a provider deprecates a
 * model, today the adapter silently 404s in production. This module
 * lets you ship a deprecation table per provider and pick a behaviour:
 *
 *  - `warn`  — log once at startup, keep using the model.
 *  - `remap` — auto-substitute the configured successor.
 *  - `fail`  — throw at startup so deploys catch it.
 *
 * The deprecation table is community-updateable: the default export
 * holds known deprecations as of the AgentsKit release; consumers can
 * pass their own table to override or extend.
 *
 * Closes issue #800.
 */
type DeprecationAction = 'warn' | 'remap' | 'fail';
interface ModelDeprecation {
    provider: string;
    model: string;
    /** ISO date the provider's sunset takes effect. */
    sunsetOn?: string;
    /** Suggested successor — used when `onDeprecation: 'remap'`. */
    successor?: string;
    /** Optional human-readable reason / link. */
    note?: string;
}
interface DeprecationPolicy {
    onDeprecation: DeprecationAction;
    table?: ModelDeprecation[];
    /** Sink for warnings. Defaults to `console.warn`. */
    logger?: (msg: string) => void;
}
/**
 * Known deprecations (current as of AgentsKit shipping). Bump on each
 * release; PRs welcome. Successor picks lean towards the same
 * provider's current default unless the entire family is gone.
 */
declare const DEFAULT_DEPRECATION_TABLE: ModelDeprecation[];
interface ResolveModelInput {
    provider: string;
    model: string;
}
interface ResolveModelResult {
    /** Final model id to use (may differ from input if remapped). */
    model: string;
    remapped: boolean;
    deprecation?: ModelDeprecation;
}
declare function resolveModel(input: ResolveModelInput, policy: DeprecationPolicy): ResolveModelResult;
/**
 * Wrap an `AdapterFactory` so that any model field on its requests is
 * checked against the deprecation policy at startup. Convenience for
 * adapters that don't want to plumb the check into their own code:
 *
 * ```ts
 * const adapter = withDeprecationPolicy(openai({ apiKey, model: 'gpt-3.5-turbo-0301' }), {
 *   provider: 'openai',
 *   onDeprecation: 'remap',
 * })
 * ```
 *
 * For adapters with internal model state (most), prefer calling
 * `resolveModel()` inside the factory and substituting before the
 * first request — this wrapper is a fallback for opaque adapters.
 */
declare function withDeprecationPolicy<F extends AdapterFactory>(factory: F, options: {
    provider: string;
    model: string;
} & DeprecationPolicy): F;

/**
 * Opt-in credential rotation primitives.
 *
 * These utilities do **not** automatically wire into stock adapters. Built-in
 * factories (openai, anthropic, bedrock, vertex, …) still take a plain
 * `apiKey` / `accessToken` string (or a caller-supplied resolver) at
 * construction. Use `createRotatingCredentials` / `refreshCredentials` only
 * when you explicitly opt in — e.g. custom wrappers that call `current()` on
 * every request, or adapters you implement that expose
 * `CredentialRefreshable.refreshCredentials`.
 *
 * Without that opt-in, rotating a provider key still means reconstructing the
 * adapter (or restarting the process). The helpers stay exported so production
 * apps can build that layer without re-inventing the holder + audit event shape.
 *
 * Closes issue #799 (primitives only; adapter adoption is opt-in).
 */
type CredentialResolver = () => string | Promise<string>;
interface RotatingCredentials {
    /** Resolve the current secret. Opt-in adapters call this on every request. */
    current: CredentialResolver;
    /** Replace the in-memory secret. Returns the new value. */
    rotate: (next: string) => Promise<string>;
    /** Subscribe to rotation events. Returns an unsubscribe handle. */
    onRotate: (handler: (event: CredentialRotationEvent) => void) => () => void;
}
interface CredentialRotationEvent {
    /** ISO timestamp of the rotation. */
    rotatedAt: string;
    /** Stable id (e.g. provider name) for audit-log correlation. */
    id: string;
    /** Last 4 chars of the new secret — useful for "did the rotation actually happen?" without leaking the key. */
    fingerprint: string;
}
interface CredentialRefreshable {
    /**
     * Opt-in adapters that support credential rotation expose this method.
     * Stock AgentsKit adapters do not implement it unless documented otherwise.
     * Calling it replaces the in-memory secret. The next request uses
     * the new value; in-flight requests are unaffected.
     */
    refreshCredentials: (next: string) => Promise<void>;
}
declare function createRotatingCredentials(initial: string, options: {
    id: string;
}): RotatingCredentials;
/**
 * Refresh credentials on any object that implements
 * `CredentialRefreshable`. A no-op (with a debug log) if the adapter
 * doesn't support rotation, so callers can run the rotation playbook
 * across a heterogeneous set of adapters without branching.
 *
 * Most stock adapters do **not** implement `refreshCredentials` — this
 * remains an opt-in primitive unless an adapter documents support.
 */
declare function refreshCredentials(adapter: unknown, next: string, options?: {
    id?: string;
    logger?: (msg: string) => void;
}): Promise<boolean>;

export { type AnthropicConfig, type ApplyCarbonOptions, type AzureOpenAIConfig, type BailConfig, type BedrockConfig, type BedrockRuntimeClientLike, type CarbonTable, type CerebrasConfig, type CohereConfig, type CredentialRefreshable, DEFAULT_CARBON_TABLE, DEFAULT_DEPRECATION_TABLE, type DeepSeekConfig, type DeepSeekEmbedderConfig, type DeprecationAction, type DeprecationPolicy, type EnsembleAggregator, type EnsembleBranchResult, type EnsembleCandidate, type EnsembleOptions, type FallbackCandidate, type FallbackOptions, type FireworksConfig, type GeminiConfig, type GeminiEmbedderConfig, GenericAdapterConfig, type GrokConfig, type GrokEmbedderConfig, type GroqConfig, type HuggingFaceConfig, type KimiConfig, type KimiEmbedderConfig, type LMStudioConfig, type LangChainConfig, type LangGraphConfig, type LlamaCppConfig, type MistralConfig, type MockAdapterOptions, type MockResponse, type ModelDeprecation, type OllamaConfig, type OllamaEmbedderConfig, type OpenAICompatibleEmbedderConfig, type OpenAIConfig, type OpenAIEmbedderConfig, type OpenRouterConfig, type ProviderRegionKey, type RecordedTurn, type RecordingFixture, type RecordingSink, type ReplicateConfig, type ResolveModelInput, type ResolveModelResult, RetryOptions, type RotatingCredentials, type RouterCandidate, type RouterOptions, type RouterPolicy, type TogetherConfig, type VLLMConfig, type VercelAIConfig, type VertexConfig, type WebLlmConfig, type WebLlmEngineLike, anthropic, applyCarbonTable, azureOpenAI, azureOpenAIAdapter, bail, bailAdapter, bedrock, bedrockAdapter, cerebras, cerebrasAdapter, cohere, cohereAdapter, createEnsembleAdapter, createFallbackAdapter, createOpenAICompatibleEmbedder, createRotatingCredentials, createRouter, deepseek, deepseekEmbedder, estimateCO2Grams, fireworks, gemini, geminiEmbedder, generic, grok, grokEmbedder, groq, groqAdapter, huggingface, inMemorySink, kimi, kimiEmbedder, langchain, langgraph, llamacpp, lmstudio, mistral, mockAdapter, ollama, ollamaEmbedder, openai, openaiEmbedder, openrouter, qwen, recordingAdapter, refreshCredentials, replayAdapter, replicate, replicateAdapter, resolveModel, together, vercelAI, vertex, vertexAdapter, vllm, webllm, webllmAdapter, withDeprecationPolicy };
