realtime-avatar 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -234,6 +234,31 @@ cover the request and binary body; an abort does not guarantee that upstream bil
234
234
  Caller aborts propagate, timeout aborts are `TimeoutError`, and HTTP errors use the existing
235
235
  `RealtimeAvatarHttpError` class.
236
236
 
237
+ ### Streaming speech (unreleased)
238
+
239
+ `createSpeechStream(voiceId, { text, speed?, language? }, { signal? })` returns an async generator
240
+ of `SpeechStreamEvent`, starting the paid request on first iteration. It is server-only, uses
241
+ no LiveKit, and leaves `createSpeech` unchanged. Requires platform streaming support; not yet
242
+ published. The root/server exports include canonical generated `createSpeechStreamRequestSchema`,
243
+ `speechStreamEventSchema`, `speechAlignedTextSchema`, `CreateSpeechStreamRequest`,
244
+ `SpeechStreamEvent` and `SpeechAlignedText`. There is no streaming `format` option.
245
+
246
+ Consume incrementally with `for await`. `started` declares signed 16-bit little-endian PCM,
247
+ 24 kHz mono. `audio` carries base64 PCM, contiguous zero-based `sequence` and mono-sample
248
+ `sampleOffset`; chunks contain whole samples and at most 16 KiB, with a 180-second total cap.
249
+ `alignment` carries absolute-second text segments; replace earlier segments with the same
250
+ `chunkSeq`, without inferring current-word timing. All events share one UUID `requestId`.
251
+ Exactly one terminal follows: `completed` confirms matching `totalSamples`, `billedCredits`
252
+ and `billedBytes`; `failed` yields a typed canonical API error even after partial audio.
253
+ Read through EOF to reject trailing events. Malformed or truncated streams throw
254
+ `RealtimeAvatarError`, while HTTP refusals retain `RealtimeAvatarHttpError`.
255
+
256
+ The SDK never collects all audio and bounds receive work to 24 MiB total, 256 KiB per event,
257
+ and 64 KiB for HTTP error text. `break`, iterator `return()` and caller abort cancel the reader
258
+ and fetch, including a pending `next()`. The smaller of `timeoutMs` and `totalTimeoutMs`
259
+ covers the entire request/body, including pauses between iterations. **Never automatically
260
+ retry** an ambiguous paid request. Cancellation does not prove that billing stopped.
261
+
237
262
  ## Custom voice (webhook)
238
263
 
239
264
  Speak a call in your own voice. Each sentence she is about to say is POSTed, signed, to an
@@ -455,6 +480,8 @@ rta.getConnectionHistory(sessionId) // bounded LiveKit observations; requires
455
480
 
456
481
  // completed speech audio; server only, no LiveKit, never retried; requires speech:write
457
482
  rta.createSpeech(voiceId, { text, format?, speed?, language? }, { signal? })
483
+ // unreleased streaming candidate; generated SSE events, never retried
484
+ rta.createSpeechStream(voiceId, { text, speed?, language? }, { signal? })
458
485
 
459
486
  // pre-rendered video (MP4, no live call); server only, requires renders:write / renders:read
460
487
  rta.createRender({ avatarId, voiceId? | voice?, lipGain?, shots }) // 202 queued; one Idempotency-Key across retries
@@ -1,4 +1,4 @@
1
- import { RealtimeAvatar, ROUTE_TIMEOUT_MS, proxyEndRequestSchema, proxyConnectRequestSchema, isQueued, RealtimeAvatarHttpError, RealtimeAvatarError } from './chunk-YHNBW3X6.js';
1
+ import { RealtimeAvatar, ROUTE_TIMEOUT_MS, proxyEndRequestSchema, proxyConnectRequestSchema, isQueued, RealtimeAvatarHttpError, RealtimeAvatarError } from './chunk-RBK6EHVH.js';
2
2
 
3
3
  // ../http-client/src/generated/error-semantics.ts
4
4
  var ERROR_SEMANTICS = {