import { r as KlawConfig } from "../../types.klaw-xKUw_Rz7.js"; import { Cn as TtsProvider, gn as TtsAutoMode, hn as ResolvedTtsPersona, yn as TtsModelOverrideConfig } from "../../types.channels-DdU7GqnS.js"; import { L as SpeechVoiceOption, R as TtsDirectiveOverrides, d as ResolvedTtsConfig, f as ResolvedTtsModelOverrides, p as TtsConfigResolutionContext, x as SpeechProviderConfig, z as TtsDirectiveParseResult } from "../../tts-runtime.types-ME5-eV7L.js"; import { r as ReplyPayload } from "../../reply-payload-BEbdg63T.js"; import { t as summarizeText } from "../../speech-core-BUsfal2S.js"; import { o as parseTtsDirectives } from "../../provider-registry-hLUKbIUx.js"; //#region extensions/speech-core/src/tts.d.ts type TtsAttemptReasonCode = "success" | "no_provider_registered" | "not_configured" | "unsupported_for_streaming" | "unsupported_for_telephony" | "timeout" | "provider_error"; type TtsProviderAttempt = { provider: string; outcome: "success" | "skipped" | "failed"; reasonCode: TtsAttemptReasonCode; persona?: string; personaBinding?: "applied" | "missing" | "none"; latencyMs?: number; error?: string; }; 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"; }; 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"; }; type TtsStreamResult = { success: boolean; audioStream?: ReadableStream; 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; }; type TtsSynthesisStreamResult = TtsStreamResult; 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; declare function getResolvedSpeechProviderConfig(config: ResolvedTtsConfig, providerId: string, cfg?: KlawConfig): SpeechProviderConfig; declare function resolveTtsConfig(cfg: KlawConfig, contextOrAgentId?: string | TtsConfigResolutionContext): ResolvedTtsConfig; declare function resolveTtsPrefsPath(config: ResolvedTtsConfig): string; declare function resolveTtsAutoMode(params: { config: ResolvedTtsConfig; prefsPath: string; sessionAuto?: string; }): TtsAutoMode; declare function buildTtsSystemPromptHint(cfg: KlawConfig, agentId?: string): string | undefined; declare function isTtsEnabled(config: ResolvedTtsConfig, prefsPath: string, sessionAuto?: string): boolean; declare function setTtsAutoMode(prefsPath: string, mode: TtsAutoMode): void; declare function setTtsEnabled(prefsPath: string, enabled: boolean): void; declare function getTtsProvider(config: ResolvedTtsConfig, prefsPath: string): TtsProvider; declare function getTtsPersona(config: ResolvedTtsConfig, prefsPath: string): ResolvedTtsPersona | undefined; declare function listTtsPersonas(config: ResolvedTtsConfig): ResolvedTtsPersona[]; declare function setTtsPersona(prefsPath: string, persona: string | null | undefined): void; declare function setTtsProvider(prefsPath: string, provider: TtsProvider): void; declare function resolveExplicitTtsOverrides(params: { cfg: KlawConfig; prefsPath?: string; provider?: string; modelId?: string; voiceId?: string; agentId?: string; channelId?: string; accountId?: string; }): TtsDirectiveOverrides; declare function getTtsMaxLength(prefsPath: string): number; declare function setTtsMaxLength(prefsPath: string, maxLength: number): void; declare function isSummarizationEnabled(prefsPath: string): boolean; declare function setSummarizationEnabled(prefsPath: string, enabled: boolean): void; declare function getLastTtsAttempt(): TtsStatusEntry | undefined; 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; declare function resolveTtsProviderOrder(primary: TtsProvider, cfg?: KlawConfig): TtsProvider[]; declare function isTtsProviderConfigured(config: ResolvedTtsConfig, provider: TtsProvider, cfg?: KlawConfig): boolean; declare function formatTtsProviderError(provider: TtsProvider, err: unknown): string; declare function sanitizeTtsErrorForLog(err: unknown): string; declare function textToSpeech(params: { text: string; cfg: KlawConfig; prefsPath?: string; channel?: string; overrides?: TtsDirectiveOverrides; disableFallback?: boolean; timeoutMs?: number; agentId?: string; accountId?: string; }): Promise; declare function synthesizeSpeech(params: { text: string; cfg: KlawConfig; prefsPath?: string; channel?: string; overrides?: TtsDirectiveOverrides; disableFallback?: boolean; timeoutMs?: number; agentId?: string; accountId?: string; }): Promise; declare function streamSpeech(params: { text: string; cfg: KlawConfig; prefsPath?: string; channel?: string; overrides?: TtsDirectiveOverrides; disableFallback?: boolean; timeoutMs?: number; agentId?: string; accountId?: string; }): Promise; declare function textToSpeechStream(params: { text: string; cfg: KlawConfig; prefsPath?: string; channel?: string; overrides?: TtsDirectiveOverrides; disableFallback?: boolean; timeoutMs?: number; agentId?: string; accountId?: string; }): Promise; declare function textToSpeechTelephony(params: { text: string; cfg: KlawConfig; prefsPath?: string; overrides?: TtsDirectiveOverrides; }): Promise; declare function listSpeechVoices(params: { provider: string; cfg?: KlawConfig; config?: ResolvedTtsConfig; apiKey?: string; baseUrl?: string; }): Promise; declare function maybeApplyTtsToPayload(params: { payload: ReplyPayload; cfg: KlawConfig; channel?: string; kind?: "tool" | "block" | "final"; inboundAudio?: boolean; ttsAuto?: string; agentId?: string; accountId?: string; }): Promise; 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; }; //#endregion export { type ResolvedTtsConfig, type ResolvedTtsModelOverrides, type TtsDirectiveOverrides, type TtsDirectiveParseResult, type TtsResult, type TtsStreamResult, type TtsSynthesisResult, type TtsSynthesisStreamResult, type TtsTelephonyResult, testApi as _test, testApi, buildTtsSystemPromptHint, getLastTtsAttempt, getResolvedSpeechProviderConfig, getTtsMaxLength, getTtsPersona, getTtsProvider, isSummarizationEnabled, isTtsEnabled, isTtsProviderConfigured, listSpeechVoices, listTtsPersonas, maybeApplyTtsToPayload, resolveExplicitTtsOverrides, resolveTtsAutoMode, resolveTtsConfig, resolveTtsPrefsPath, resolveTtsProviderOrder, setLastTtsAttempt, setSummarizationEnabled, setTtsAutoMode, setTtsEnabled, setTtsMaxLength, setTtsPersona, setTtsProvider, streamSpeech, synthesizeSpeech, textToSpeech, textToSpeechStream, textToSpeechTelephony };