export class StreamConfig {
    _retry;
    _provider;
    _fallback;
    _logging;
    constructor(retry, provider, fallback, logging) {
        this._retry = Object.freeze(retry);
        this._provider = Object.freeze(provider);
        this._fallback = Object.freeze(fallback);
        this._logging = Object.freeze(logging);
    }
    static create(options) {
        if (!options.provider || !options.model) {
            throw new Error("StreamConfig requires provider and model to be specified. " +
                "These values should come from the UI feature flags " +
                "(ui.clark-ai.llm-provider and superblocks.ai.core-model.name).");
        }
        const retry = {
            maxAttempts: options.retry?.maxAttempts ?? 5,
            maxTotalTimeMs: options.retry?.maxTotalTimeMs ?? 120_000,
            maxAttemptsPerProvider: options.retry?.maxAttemptsPerProvider ?? 2,
            initialDelayMs: options.retry?.initialDelayMs ?? 500,
            maxDelayMs: options.retry?.maxDelayMs ?? 10_000,
            backoffMultiplier: options.retry?.backoffMultiplier ?? 2,
        };
        const provider = {
            provider: options.provider,
            model: options.model,
        };
        const fallback = {
            enabled: options.fallback?.enabled ?? false,
            strategy: options.fallback?.strategy ?? "model-then-provider",
        };
        const logging = {
            enabled: options.logging?.enabled ?? true,
            conversationId: options.logging?.conversationId,
            saveArtifact: options.logging?.saveArtifact,
            metadata: options.logging?.metadata ?? {},
        };
        return new StreamConfig(retry, provider, fallback, logging);
    }
    get retry() {
        return this._retry;
    }
    get provider() {
        return this._provider;
    }
    get fallback() {
        return this._fallback;
    }
    get logging() {
        return this._logging;
    }
}
//# sourceMappingURL=config.js.map