Skip to content

Latest commit

 

History

History
181 lines (106 loc) · 14.5 KB

File metadata and controls

181 lines (106 loc) · 14.5 KB

@cloudflare/voice

0.4.0

Minor Changes

  • #2157 f08ee06 Thanks @cjol! - Improve voice lifecycle accuracy, diagnostics, and per-turn timing visibility.

    • Clear stale interim transcripts when calls start, end, disconnect, close, or fail during startup.
    • Emit speaking only when the first server audio chunk is sent.
    • Add structured, content-free browser diagnostics and structured Worker error logging without reading arbitrary provider response bodies.
    • Report transcriber startup and runtime failures through onFatalError, structured client errors, and reliable call cleanup.
    • Preserve model finish reasons and distinguish no-output, output-limit, content-filtered, and model-error completions.
    • Add stable typed per-turn timing summaries for speech, text, terminal outcomes, model streaming, reasoning exposed by the model stream, and overlapping TTS work through VoiceClient and the React hooks.
    • Keep the existing four-field metrics wire shape compatible while making no-audio and streamed TTS accounting consistent.
    • Update the bundled voice providers to propagate lifecycle failures and log errors consistently.

0.3.6

Patch Changes

  • #2083 48eeba7 Thanks @cjol! - Define VoiceTurnContext.messages as completed history before the current transcript for both text and audio turns, preventing duplicate user messages when following the documented prompt construction.

    Existing onTurn() implementations:

    • If you pass context.messages directly as the complete LLM input, append transcript exactly once.
    • If you already append transcript to context.messages, no change is required.
    • Direct getConversationHistory() calls inside onTurn() continue to include the current transcript.
  • #2004 0efd545 Thanks @cjol! - Pass the full keyterms array to Workers AI Flux and Nova-3 STT instead of only the first term.

  • #2049 ce0e608 Thanks @cjol! - Preserve spacing between streamed text segments separated by tool calls. Think messenger delivery and Voice now share the same boundary-aware text joining logic from agents/chat.

    Existing users must:

    • Replace imports of textDeltaFromStreamChunk() from @cloudflare/think/messengers with TextStreamCallback, passing it the complete structured stream events.
    • Upgrade to agents@0.21.0 when installing @cloudflare/think@0.16.0 or @cloudflare/voice@0.3.6; both now require agents >=0.20.2.
    • Update exact-text expectations if they relied on segments around tool calls being concatenated without a space.

0.3.5

Patch Changes

  • #1912 219d59b Thanks @cjol! - Add AssemblyAI and ElevenLabs streaming STT providers for the voice pipeline.

0.3.4

Patch Changes

  • #1909 63491bd Thanks @cjol! - Honor the configured sample rate for raw pcm16 audio payloads.

    Adds a sampleRate option to VoiceAgentOptions (default 16000) that is declared in the server audio_config message. VoiceClient reads it (exposed via a new sampleRate getter) and constructs AudioBuffer instances at that rate for raw pcm16 playback, so providers with a native rate other than 16 kHz (e.g. 24 kHz Gemini TTS) play at the correct speed. Falls back to 16 kHz when the server omits the field.

  • #1891 d1cc317 Thanks @korinne! - Add transcriber readiness so voice agents wait for streaming STT startup before entering listening state or running call-start hooks.

0.3.3

Patch Changes

  • #1605 8bfebf0 Thanks @cjol! - Support AI SDK fullStream responses in voice turns and warn when textStream is used.

  • #1772 d4f27fe Thanks @mattzcarey! - Include each package's documentation in its published package.

  • #1816 f18ff01 Thanks @cjol! - Fix assistant speech playing back slow on a new turn after an idle gap. VoiceClient routes playback through a MediaStreamAudioDestinationNode -> HTMLAudioElement bridge, and reusing that element for a fresh burst after it had been idle between turns made the new turn resume at the wrong rate (audible as slow-motion that re-converges to normal over the turn). The bridge is now torn down and rebuilt once it has fully drained and been idle past a short threshold, so each turn plays through a freshly created element. Rebuilds never happen mid-turn, since chunks within a turn keep at least one source scheduled on the playback cursor.

0.3.2

Patch Changes

  • #1747 28653b3 Thanks @cjol! - Fix audible clicks at audio chunk boundaries during agent speech. VoiceClient played each response chunk by starting it at currentTime and waiting for its ended event before scheduling the next, so every chunk seam carried a few milliseconds of silence (event-loop latency plus the next chunk's setup) — audible as a periodic click, roughly one per chunk. Chunks are now scheduled back-to-back on the audio clock via a playback cursor (start(Math.max(currentTime, cursor))), so consecutive chunks butt together sample-tight. Because chunks can now be scheduled ahead of playback, the client tracks every scheduled source and stops them all on interrupt/end-call (previously only the single active source needed stopping), and playback counts as active until the last scheduled chunk finishes so barge-in detection keeps working through the scheduled tail.

0.3.1

Patch Changes

  • #1754 151d457 Thanks @threepointone! - Stop fire-and-forget voice lifecycle handlers from leaking unhandled rejections on connection teardown. The withVoiceInput mixin dispatches start_call, end_call, interrupt, and transcript emission from the synchronous onMessage handler without awaiting them, so a client dropping mid-operation (e.g. while keepAlive()'s alarm write is still in flight) could surface a retryable "Network connection lost." rejection. These background tasks now run through a teardown-aware helper that swallows expected connection-teardown errors and logs anything unexpected.

0.3.0

Minor Changes

  • #1711 a3a8d83 Thanks @cjol! - Add outputDeviceId and setOutputDevice() for routing assistant playback to a selected audio output device when the browser supports sink selection.

0.2.1

Patch Changes

  • #1568 c7649ac Thanks @cjol! - Avoid emitting empty assistant transcript entries when a voice turn produces no response text.

0.2.0

Minor Changes

  • #1478 2c7d91b Thanks @whoiskatrin! - Add an enabled option to useVoiceAgent so React apps can delay creating and connecting a VoiceClient until async prerequisites such as capability tokens are ready.

Patch Changes

  • #1458 84cb429 Thanks @whoiskatrin! - Fix Workers AI STT session edge cases for Flux and Nova 3.

    Flux now preserves the latest non-empty turn transcript from turn lifecycle events so an EndOfTurn event with an empty transcript can still emit the completed utterance. Flux StartOfTurn also drives server-side barge-in so model-detected user speech aborts active LLM/TTS playback promptly. Nova 3 now defensively normalizes finalized segment state before reading it to avoid stale teardown messages throwing during abnormal close paths.

  • #1462 5f6214d Thanks @whoiskatrin! - Fix withVoice text streaming for AI SDK textStream responses so TTS audio is produced when onTurn() returns streamText(...).textStream directly.

0.1.3

Patch Changes

  • ca510d4 Thanks @threepointone! - Tighten the agents peer dependency floor from >=0.9.0 to >=0.11.7 to reflect the current monorepo set we actually test against. Upper bound (<1.0.0) is unchanged.

    No runtime change in @cloudflare/voice itself. The visible effect for consumers: pairing the latest @cloudflare/voice with a stale agents (<0.11.7) now produces a peer warning where it previously did not. That's the intended signal — agents versions older than 0.11.7 are no longer tested against this @cloudflare/voice.

0.1.2

Patch Changes

  • #1313 08da191 Thanks @threepointone! - Publish with correct peer dependency ranges for agents (wide ranges were being overwritten to tight ^0.x.y by the pre-publish script)

0.1.1

Patch Changes

  • #1310 bd0346e Thanks @threepointone! - Fix peer dependency ranges for agents — published packages incorrectly had tight ^0.10.x ranges instead of the intended >=0.8.7 <1.0.0 / >=0.9.0 <1.0.0, causing install warnings with agents@0.11.0. Also changed updateInternalDependencies from "patch" to "minor" in changesets config to prevent the ranges from being overwritten on future releases.

0.1.0

Minor Changes

  • #1293 16769b0 Thanks @threepointone! - Switch to per-call continuous STT sessions. Breaking API change.

    The transcriber session is now created at start_call and lives for the entire call duration. The model handles turn detection — no client-side start_of_speech/end_of_speech required for STT. Voice agents use keepAlive to prevent DO eviction during calls.

    New API:

    • transcriber property replaces stt, streamingStt, and vad
    • createTranscriber(connection) hook for runtime model switching
    • WorkersAIFluxSTT — per-call Flux sessions (recommended for withVoice)
    • WorkersAINova3STT — per-call Nova 3 streaming sessions (recommended for withVoiceInput)
    • query option on VoiceClientOptions — pass query params to the WebSocket URL (e.g. for model selection)
    • Throws at start_call if no transcriber is configured
    • Duplicate start_call is silently ignored when already in a call

    Removed:

    • stt (batch STT), streamingStt (per-utterance streaming), vad (server-side VAD)
    • WorkersAISTT, WorkersAIVAD, pcmToWav
    • prerollMs, vadThreshold, vadPushbackSeconds, vadRetryMs, minAudioBytes options
    • VoiceInputAgentOptions type
    • beforeTranscribe hook (audio is fed continuously, not in batches)
    • vad_ms and stt_ms from pipeline metrics
    • Hibernation support (withVoice and withVoiceInput now require Agent, not partyserver Server)

0.0.5

Patch Changes

  • c5ca556 Thanks @threepointone! - Replace wildcard * peer dependencies with real version ranges: agents to >=0.9.0 <1.0.0 and partysocket to ^1.0.0.

0.0.4

Patch Changes

  • #1198 dde826e Thanks @threepointone! - Fix TypeScript 6 declaration emit for withVoice and withVoiceInput mixin functions. TS6 enforces TS4094 which disallows #private members in exported anonymous class types. Added explicit return type interfaces (VoiceAgentMixinMembers, VoiceInputMixinMembers) so the generated .d.ts only exposes the public API surface.

0.0.3

Patch Changes

0.0.2

Patch Changes