import type { KaijiBotConfig, TtsAutoMode, TtsConfig, TtsMode, TtsModelOverrideConfig, TtsProvider } from "kaijibot/plugin-sdk/config-runtime";
import type { ReplyPayload } from "kaijibot/plugin-sdk/reply-runtime";
import { parseTtsDirectives, summarizeText, type SpeechModelOverridePolicy, type SpeechProviderConfig, type SpeechVoiceOption, type TtsDirectiveOverrides, type TtsDirectiveParseResult } from "../api.js";
export type { TtsDirectiveOverrides, TtsDirectiveParseResult };
export type ResolvedTtsConfig = {
    auto: TtsAutoMode;
    mode: TtsMode;
    provider: TtsProvider;
    providerSource: "config" | "default";
    summaryModel?: string;
    modelOverrides: ResolvedTtsModelOverrides;
    providerConfigs: Record<string, SpeechProviderConfig>;
    prefsPath?: string;
    maxTextLength: number;
    timeoutMs: number;
    rawConfig?: TtsConfig;
    sourceConfig?: KaijiBotConfig;
};
export type ResolvedTtsModelOverrides = SpeechModelOverridePolicy;
export type TtsAttemptReasonCode = "success" | "no_provider_registered" | "not_configured" | "unsupported_for_telephony" | "timeout" | "provider_error";
export type TtsProviderAttempt = {
    provider: string;
    outcome: "success" | "skipped" | "failed";
    reasonCode: TtsAttemptReasonCode;
    latencyMs?: number;
    error?: string;
};
export type TtsResult = {
    success: boolean;
    audioPath?: string;
    error?: string;
    latencyMs?: number;
    provider?: string;
    fallbackFrom?: string;
    attemptedProviders?: string[];
    attempts?: TtsProviderAttempt[];
    outputFormat?: string;
    voiceCompatible?: boolean;
};
export type TtsSynthesisResult = {
    success: boolean;
    audioBuffer?: Buffer;
    error?: string;
    latencyMs?: number;
    provider?: string;
    fallbackFrom?: string;
    attemptedProviders?: string[];
    attempts?: TtsProviderAttempt[];
    outputFormat?: string;
    voiceCompatible?: boolean;
    fileExtension?: string;
};
export type TtsTelephonyResult = {
    success: boolean;
    audioBuffer?: Buffer;
    error?: string;
    latencyMs?: number;
    provider?: string;
    fallbackFrom?: string;
    attemptedProviders?: string[];
    attempts?: TtsProviderAttempt[];
    outputFormat?: string;
    sampleRate?: number;
};
type TtsStatusEntry = {
    timestamp: number;
    success: boolean;
    textLength: number;
    summarized: boolean;
    provider?: string;
    fallbackFrom?: string;
    attemptedProviders?: string[];
    attempts?: TtsProviderAttempt[];
    latencyMs?: number;
    error?: string;
};
declare function resolveModelOverridePolicy(overrides: TtsModelOverrideConfig | undefined): ResolvedTtsModelOverrides;
export declare function getResolvedSpeechProviderConfig(config: ResolvedTtsConfig, providerId: string, cfg?: KaijiBotConfig): SpeechProviderConfig;
export declare function resolveTtsConfig(cfg: KaijiBotConfig): ResolvedTtsConfig;
export declare function resolveTtsPrefsPath(config: ResolvedTtsConfig): string;
export declare function resolveTtsAutoMode(params: {
    config: ResolvedTtsConfig;
    prefsPath: string;
    sessionAuto?: string;
}): TtsAutoMode;
export declare function buildTtsSystemPromptHint(cfg: KaijiBotConfig): string | undefined;
export declare function isTtsEnabled(config: ResolvedTtsConfig, prefsPath: string, sessionAuto?: string): boolean;
export declare function setTtsAutoMode(prefsPath: string, mode: TtsAutoMode): void;
export declare function setTtsEnabled(prefsPath: string, enabled: boolean): void;
export declare function getTtsProvider(config: ResolvedTtsConfig, prefsPath: string): TtsProvider;
export declare function setTtsProvider(prefsPath: string, provider: TtsProvider): void;
export declare function resolveExplicitTtsOverrides(params: {
    cfg: KaijiBotConfig;
    prefsPath?: string;
    provider?: string;
    modelId?: string;
    voiceId?: string;
}): TtsDirectiveOverrides;
export declare function getTtsMaxLength(prefsPath: string): number;
export declare function setTtsMaxLength(prefsPath: string, maxLength: number): void;
export declare function isSummarizationEnabled(prefsPath: string): boolean;
export declare function setSummarizationEnabled(prefsPath: string, enabled: boolean): void;
export declare function getLastTtsAttempt(): TtsStatusEntry | undefined;
export declare function setLastTtsAttempt(entry: TtsStatusEntry | undefined): void;
export declare function resolveTtsProviderOrder(primary: TtsProvider, cfg?: KaijiBotConfig): TtsProvider[];
export declare function isTtsProviderConfigured(config: ResolvedTtsConfig, provider: TtsProvider, cfg?: KaijiBotConfig): boolean;
declare function formatTtsProviderError(provider: TtsProvider, err: unknown): string;
declare function sanitizeTtsErrorForLog(err: unknown): string;
export declare function textToSpeech(params: {
    text: string;
    cfg: KaijiBotConfig;
    prefsPath?: string;
    channel?: string;
    overrides?: TtsDirectiveOverrides;
    disableFallback?: boolean;
}): Promise<TtsResult>;
export declare function synthesizeSpeech(params: {
    text: string;
    cfg: KaijiBotConfig;
    prefsPath?: string;
    channel?: string;
    overrides?: TtsDirectiveOverrides;
    disableFallback?: boolean;
}): Promise<TtsSynthesisResult>;
export declare function textToSpeechTelephony(params: {
    text: string;
    cfg: KaijiBotConfig;
    prefsPath?: string;
}): Promise<TtsTelephonyResult>;
export declare function listSpeechVoices(params: {
    provider: string;
    cfg?: KaijiBotConfig;
    config?: ResolvedTtsConfig;
    apiKey?: string;
    baseUrl?: string;
}): Promise<SpeechVoiceOption[]>;
export declare function maybeApplyTtsToPayload(params: {
    payload: ReplyPayload;
    cfg: KaijiBotConfig;
    channel?: string;
    kind?: "tool" | "block" | "final";
    inboundAudio?: boolean;
    ttsAuto?: string;
}): Promise<ReplyPayload>;
export declare const _test: {
    parseTtsDirectives: typeof parseTtsDirectives;
    resolveModelOverridePolicy: typeof resolveModelOverridePolicy;
    summarizeText: typeof summarizeText;
    getResolvedSpeechProviderConfig: typeof getResolvedSpeechProviderConfig;
    formatTtsProviderError: typeof formatTtsProviderError;
    sanitizeTtsErrorForLog: typeof sanitizeTtsErrorForLog;
};
