import type { OpenClawConfig, ResolvedTtsPersona, TtsAutoMode, TtsModelOverrideConfig, TtsProvider } from "openclaw/plugin-sdk/config-contracts";
import { type ReplyPayload } from "openclaw/plugin-sdk/reply-payload";
import { parseTtsDirectives, type ResolvedTtsConfig, type ResolvedTtsModelOverrides, summarizeText, type SpeechProviderConfig, type SpeechVoiceOption, type TtsDirectiveOverrides, type TtsDirectiveParseResult, type TtsConfigResolutionContext } from "../api.js";
export type { ResolvedTtsConfig, ResolvedTtsModelOverrides, TtsDirectiveOverrides, TtsDirectiveParseResult, };
export type TtsAttemptReasonCode = "success" | "no_provider_registered" | "not_configured" | "unsupported_for_streaming" | "unsupported_for_telephony" | "timeout" | "provider_error";
export type TtsProviderAttempt = {
    provider: string;
    outcome: "success" | "skipped" | "failed";
    reasonCode: TtsAttemptReasonCode;
    persona?: string;
    personaBinding?: "applied" | "missing" | "none";
    latencyMs?: number;
    error?: string;
};
export type TtsResult = {
    success: boolean;
    audioPath?: string;
    error?: string;
    latencyMs?: number;
    provider?: string;
    persona?: string;
    fallbackFrom?: string;
    attemptedProviders?: string[];
    attempts?: TtsProviderAttempt[];
    outputFormat?: string;
    voiceCompatible?: boolean;
    audioAsVoice?: boolean;
    target?: "audio-file" | "voice-note";
};
export type TtsSynthesisResult = {
    success: boolean;
    audioBuffer?: Buffer;
    error?: string;
    latencyMs?: number;
    provider?: string;
    providerModel?: string;
    providerVoice?: string;
    persona?: string;
    fallbackFrom?: string;
    attemptedProviders?: string[];
    attempts?: TtsProviderAttempt[];
    outputFormat?: string;
    voiceCompatible?: boolean;
    fileExtension?: string;
    target?: "audio-file" | "voice-note";
};
export type TtsStreamResult = {
    success: boolean;
    audioStream?: ReadableStream<Uint8Array>;
    error?: string;
    latencyMs?: number;
    provider?: string;
    providerModel?: string;
    providerVoice?: string;
    persona?: string;
    fallbackFrom?: string;
    attemptedProviders?: string[];
    attempts?: TtsProviderAttempt[];
    outputFormat?: string;
    voiceCompatible?: boolean;
    fileExtension?: string;
    target?: "audio-file" | "voice-note";
    release?: () => Promise<void>;
};
export type TtsSynthesisStreamResult = TtsStreamResult;
export type TtsTelephonyResult = {
    success: boolean;
    audioBuffer?: Buffer;
    error?: string;
    latencyMs?: number;
    provider?: string;
    providerModel?: string;
    providerVoice?: string;
    persona?: string;
    fallbackFrom?: string;
    attemptedProviders?: string[];
    attempts?: TtsProviderAttempt[];
    outputFormat?: string;
    sampleRate?: number;
};
type TtsStatusEntry = {
    timestamp: number;
    success: boolean;
    textLength: number;
    summarized: boolean;
    provider?: string;
    persona?: 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?: OpenClawConfig): SpeechProviderConfig;
export declare function resolveTtsConfig(cfgInput: OpenClawConfig, contextOrAgentId?: string | TtsConfigResolutionContext): ResolvedTtsConfig;
export declare function resolveTtsPrefsPath(config: ResolvedTtsConfig): string;
export declare function resolveTtsAutoMode(params: {
    config: ResolvedTtsConfig;
    prefsPath: string;
    sessionAuto?: string;
}): TtsAutoMode;
export declare function buildTtsSystemPromptHint(cfgInput: OpenClawConfig, agentId?: string): 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 getTtsPersona(config: ResolvedTtsConfig, prefsPath: string): ResolvedTtsPersona | undefined;
export declare function listTtsPersonas(config: ResolvedTtsConfig): ResolvedTtsPersona[];
export declare function setTtsPersona(prefsPath: string, persona: string | null | undefined): void;
export declare function setTtsProvider(prefsPath: string, provider: TtsProvider): void;
export declare function resolveExplicitTtsOverrides(params: {
    cfg: OpenClawConfig;
    prefsPath?: string;
    provider?: string;
    modelId?: string;
    voiceId?: string;
    agentId?: string;
    channelId?: string;
    accountId?: 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;
declare function supportsNativeVoiceNoteTts(channel: string | undefined): boolean;
declare function supportsTranscodedVoiceNoteTts(channel: string | undefined): boolean;
declare function resolveTtsSynthesisTarget(channel: string | undefined): "audio-file" | "voice-note";
declare function shouldDeliverTtsAsVoice(params: {
    channel: string | undefined;
    target: "audio-file" | "voice-note" | undefined;
    voiceCompatible: boolean | undefined;
    fileExtension?: string;
    outputFormat?: string;
}): boolean;
export declare function resolveTtsProviderOrder(primary: TtsProvider, cfg?: OpenClawConfig): TtsProvider[];
export declare function isTtsProviderConfigured(config: ResolvedTtsConfig, provider: TtsProvider, cfg?: OpenClawConfig): boolean;
declare function formatTtsProviderError(provider: TtsProvider, err: unknown): string;
declare function sanitizeTtsErrorForLog(err: unknown): string;
export declare function textToSpeech(params: {
    text: string;
    cfg: OpenClawConfig;
    prefsPath?: string;
    channel?: string;
    overrides?: TtsDirectiveOverrides;
    disableFallback?: boolean;
    timeoutMs?: number;
    agentId?: string;
    accountId?: string;
}): Promise<TtsResult>;
export declare function synthesizeSpeech(params: {
    text: string;
    cfg: OpenClawConfig;
    prefsPath?: string;
    channel?: string;
    overrides?: TtsDirectiveOverrides;
    disableFallback?: boolean;
    timeoutMs?: number;
    agentId?: string;
    accountId?: string;
}): Promise<TtsSynthesisResult>;
export declare function streamSpeech(params: {
    text: string;
    cfg: OpenClawConfig;
    prefsPath?: string;
    channel?: string;
    overrides?: TtsDirectiveOverrides;
    disableFallback?: boolean;
    timeoutMs?: number;
    agentId?: string;
    accountId?: string;
}): Promise<TtsSynthesisStreamResult>;
export declare function textToSpeechStream(params: {
    text: string;
    cfg: OpenClawConfig;
    prefsPath?: string;
    channel?: string;
    overrides?: TtsDirectiveOverrides;
    disableFallback?: boolean;
    timeoutMs?: number;
    agentId?: string;
    accountId?: string;
}): Promise<TtsStreamResult>;
export declare function textToSpeechTelephony(params: {
    text: string;
    cfg: OpenClawConfig;
    prefsPath?: string;
    overrides?: TtsDirectiveOverrides;
    timeoutMs?: number;
}): Promise<TtsTelephonyResult>;
export declare function listSpeechVoices(params: {
    provider: string;
    cfg?: OpenClawConfig;
    config?: ResolvedTtsConfig;
    apiKey?: string;
    baseUrl?: string;
}): Promise<SpeechVoiceOption[]>;
export declare function maybeApplyTtsToPayload(params: {
    payload: ReplyPayload;
    cfg: OpenClawConfig;
    channel?: string;
    kind?: "tool" | "block" | "final";
    inboundAudio?: boolean;
    ttsAuto?: string;
    agentId?: string;
    accountId?: string;
}): Promise<ReplyPayload>;
export declare const testApi: {
    parseTtsDirectives: typeof parseTtsDirectives;
    resolveModelOverridePolicy: typeof resolveModelOverridePolicy;
    supportsNativeVoiceNoteTts: typeof supportsNativeVoiceNoteTts;
    supportsTranscodedVoiceNoteTts: typeof supportsTranscodedVoiceNoteTts;
    resolveTtsSynthesisTarget: typeof resolveTtsSynthesisTarget;
    shouldDeliverTtsAsVoice: typeof shouldDeliverTtsAsVoice;
    summarizeText: typeof summarizeText;
    getResolvedSpeechProviderConfig: typeof getResolvedSpeechProviderConfig;
    formatTtsProviderError: typeof formatTtsProviderError;
    sanitizeTtsErrorForLog: typeof sanitizeTtsErrorForLog;
};
/** @deprecated Use `testApi`. */
export { testApi as _test };
