agents
Version:
A home for your AI agents
46 lines (44 loc) • 1.75 kB
TypeScript
import {
F as ChannelMessageSurface,
n as Channel,
u as ChannelMessage
} from "../channel-Bnm4S7T2.js";
import { c as VoiceAudioFormat, n as TTSProvider } from "../types-_Faxb570.js";
//#region src/channels/adapters/voice.d.ts
type BrowserVoiceSurface = ChannelMessageSurface<
string,
{
connection: "current";
}
>;
/** The subset of an Agent WebSocket connection needed for audio delivery. */
type BrowserVoiceConnection = {
id: string;
send(message: string | ArrayBuffer | ArrayBufferView): void;
};
/** Configuration for an output-only browser voice channel. */
type BrowserVoiceChannelOptions = {
/** Text-to-speech provider used to synthesize each outbound message. */ tts: TTSProvider /** Return the browser voice surface to use, or undefined when unavailable. */;
getConnection: () =>
| BrowserVoiceConnection
| undefined /** Encoded audio format returned by the TTS provider. @default "mp3" */;
audioFormat?: VoiceAudioFormat /** Sample rate for raw PCM audio. Ignored by encoded formats. @default 16000 */;
sampleRate?: number /** Project the canonical Markdown message into text suitable for speech. */;
toSpeechText?: (message: ChannelMessage) => string;
};
/**
* Create an output-only channel that synthesizes one message and sends its
* encoded audio to one browser using the Cloudflare Voice wire protocol.
*
* The browser should connect with `VoiceClient` or `useVoiceAgent()`. No
* `withVoice()` mixin, microphone, or speech-to-text provider is required.
*/
declare function browserVoice(options: BrowserVoiceChannelOptions): Channel;
//#endregion
export {
BrowserVoiceChannelOptions,
BrowserVoiceConnection,
BrowserVoiceSurface,
browserVoice
};
//# sourceMappingURL=voice.d.ts.map