/** * Lazy provider module loading. * * Each provider module is loaded only when its stream function is first called. * This avoids eagerly importing heavy SDK dependencies (e.g., @anthropic-ai/sdk, * openai) at startup. The loaded module promise is cached so subsequent calls * reuse the same import. * * stream.ts imports its provider stream functions from this module (see the * lazy wrappers below), so this file IS the main streaming path's provider * loader: heavy SDKs stay out of the CLI startup parse graph. */ import type { Api, AssistantMessageEventStream, Context, Model, OptionsForApi } from "../types"; import { AssistantMessageEventStream as EventStreamImpl } from "../utils/event-stream"; import type { BedrockOptions } from "./amazon-bedrock"; /** * Lazy runtime descriptor for a built-in provider implementation. * * The registry stores descriptors with an erased module type because each * provider's stream options are intentionally different. Callers narrow the * loaded module at the single API dispatch boundary instead of forcing * distributive variance through the collection type. */ export interface ProviderRuntimeDescriptor { readonly api: TApi; readonly load: () => Promise; } interface BedrockProviderModule { streamBedrock: (model: Model<"bedrock-converse-stream">, context: Context, options: BedrockOptions) => AssistantMessageEventStream; } export declare function setBedrockProviderModule(module: BedrockProviderModule): void; /** * Resolves the first-event timeout fallback for the outer lazy-stream watchdog. * A configured wrapper-specific fallback (from `LazyStreamLimits`) always wins; * otherwise providers known to have slow first events use the same centralized * fallback as their inner provider-level watchdog. Returns `undefined` for * providers that should use the shared default. */ export declare function resolveLazyStreamFirstEventFallbackMs(provider: string, configuredFallbackMs?: number): number | undefined; /** * Lazy provider descriptors used by core consumers that need to inspect or * prewarm a provider without importing its implementation at startup. */ export declare const PROVIDER_RUNTIME_DESCRIPTORS: readonly ProviderRuntimeDescriptor[]; /** Return the lazy descriptor for a built-in API, if one is registered. */ export declare function getProviderRuntimeDescriptor(api: TApi): ProviderRuntimeDescriptor | undefined; export declare const streamAnthropic: (model: Model<"anthropic-messages">, context: Context, options: OptionsForApi<"anthropic-messages">) => EventStreamImpl; export declare const streamAzureOpenAIResponses: (model: Model<"azure-openai-responses">, context: Context, options: OptionsForApi<"azure-openai-responses">) => EventStreamImpl; export declare const streamGoogle: (model: Model<"google-generative-ai">, context: Context, options: OptionsForApi<"google-generative-ai">) => EventStreamImpl; export declare const streamGoogleGeminiCli: (model: Model<"google-gemini-cli">, context: Context, options: OptionsForApi<"google-gemini-cli">) => EventStreamImpl; export declare const streamGoogleVertex: (model: Model<"google-vertex">, context: Context, options: OptionsForApi<"google-vertex">) => EventStreamImpl; export declare const streamOpenAICodexResponses: (model: Model<"openai-codex-responses">, context: Context, options: OptionsForApi<"openai-codex-responses">) => EventStreamImpl; export declare const streamOpenAICompletions: (model: Model<"openai-completions">, context: Context, options: OptionsForApi<"openai-completions">) => EventStreamImpl; export declare const streamOpenAIResponses: (model: Model<"openai-responses">, context: Context, options: OptionsForApi<"openai-responses">) => EventStreamImpl; export declare const streamCursor: (model: Model<"cursor-agent">, context: Context, options: OptionsForApi<"cursor-agent">) => EventStreamImpl; export declare const streamOllama: (model: Model<"ollama-chat">, context: Context, options: OptionsForApi<"ollama-chat">) => EventStreamImpl; export declare const streamBedrock: (model: Model<"bedrock-converse-stream">, context: Context, options: OptionsForApi<"bedrock-converse-stream">) => EventStreamImpl; export declare const streamKiroCodeWhisperer: (model: Model<"kiro-codewhisperer-stream">, context: Context, options: OptionsForApi<"kiro-codewhisperer-stream">) => EventStreamImpl; export {};