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/dist/express.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-aQOs22YE.js';
2
- import './types-C_0GpIws.js';
1
+ import { P as ProxyConfig } from './types-RQo4LwZ3.js';
2
+ import './types-DVL5VX3N.js';
3
3
  import 'zod';
4
4
 
5
5
  type Expressish = {
package/dist/express.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-EVATXOT2.js';
2
- import './chunk-YHNBW3X6.js';
1
+ import { createProxyHandler } from './chunk-FFMZERDZ.js';
2
+ import './chunk-RBK6EHVH.js';
3
3
  import './chunk-MCIXU6XP.js';
4
4
 
5
5
  // ../proxy/src/express.ts
package/dist/hono.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-aQOs22YE.js';
2
- import './types-C_0GpIws.js';
1
+ import { P as ProxyConfig } from './types-RQo4LwZ3.js';
2
+ import './types-DVL5VX3N.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/hono.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-EVATXOT2.js';
2
- import './chunk-YHNBW3X6.js';
1
+ import { createProxyHandler } from './chunk-FFMZERDZ.js';
2
+ import './chunk-RBK6EHVH.js';
3
3
  import './chunk-MCIXU6XP.js';
4
4
 
5
5
  // ../proxy/src/hono.ts
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as CreateLive2dAvatarInput, R as RegisteredAvatar, c as AvatarUpdate, d as AvatarSourceSwap, e as ClipLibraryDeclaration, f as ClipLibraryUpdate, L as LoopRedirect, g as ClipLibrary, h as AssetKind, i as Asset, j as ListSessionsOptions, U as UsageSessionPage, k as UsageSession, l as ListRecordingsQuery, m as ListRecordingsResponse, n as RecordingArtifact, o as RecordingAccessResponse, p as CreateRenderInput, q as CreditBalance, r as operations, s as CreateSpeechInput, t as SpeechResult, T as TranscriptPayload, V as VoiceWebhookRequest } from './types-C_0GpIws.js';
2
- export { u as AvatarClip, v as CallConnection, w as CallQueued, x as ClipDeclaration, y as ClipLibraryPlan, z as ClipSource, B as ContextMessage, D as EndCallReason, F as ExternalLlm, G as RecordingArtifactStatus, H as RecordingMode, I as RenderShot, J as VideoPolicy, K as VoiceWebhook, M as VoiceWebhookErrorCode, N as createSpeechRequestSchema, O as isQueued, P as listRecordingsResponseSchema, Q as recordingAccessResponseSchema, W as recordingArtifactSchema, X as recordingModeSchema } from './types-C_0GpIws.js';
1
+ import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as CreateLive2dAvatarInput, R as RegisteredAvatar, c as AvatarUpdate, d as AvatarSourceSwap, e as ClipLibraryDeclaration, f as ClipLibraryUpdate, L as LoopRedirect, g as ClipLibrary, h as AssetKind, i as Asset, j as ListSessionsOptions, U as UsageSessionPage, k as UsageSession, l as ListRecordingsQuery, m as ListRecordingsResponse, n as RecordingArtifact, o as RecordingAccessResponse, p as CreateRenderInput, q as CreditBalance, r as operations, s as CreateSpeechInput, t as SpeechResult, u as CreateSpeechStreamRequest, v as SpeechStreamEvent, T as TranscriptPayload, V as VoiceWebhookRequest } from './types-DVL5VX3N.js';
2
+ export { w as AvatarClip, x as CallConnection, y as CallQueued, z as ClipDeclaration, B as ClipLibraryPlan, D as ClipSource, F as ContextMessage, G as EndCallReason, H as ExternalLlm, I as RecordingArtifactStatus, J as RecordingMode, K as RenderShot, M as SpeechAlignedText, N as VideoPolicy, O as VoiceWebhook, P as VoiceWebhookErrorCode, Q as createSpeechRequestSchema, W as createSpeechStreamRequestSchema, X as isQueued, Y as listRecordingsResponseSchema, Z as recordingAccessResponseSchema, _ as recordingArtifactSchema, $ as recordingModeSchema, a0 as speechAlignedTextSchema, a1 as speechStreamEventSchema } from './types-DVL5VX3N.js';
3
3
  import { ConnectionHistoryResponse } from './connection-history.js';
4
4
  import { z } from 'zod';
5
5
 
@@ -179,9 +179,9 @@ interface StartCallOptions extends CallPolicy {
179
179
  /**
180
180
  * The server-side client.
181
181
  *
182
- * Deliberately zero-dependency and small enough to read in one sitting. It owns the two
183
- * things that are easy to get wrong and impossible to discover from a 4xx: the camelCase →
184
- * snake_case translation, and keeping the connection payload intact for relay.
182
+ * Owns authentication, retry policy and the camelCase → snake_case translation, while
183
+ * keeping connection payloads intact for relay. Streaming speech uses a maintained SSE
184
+ * parser and the same generated boundary contracts as completed requests.
185
185
  *
186
186
  * This class must only ever run on a server. A browser holding the key could start unlimited
187
187
  * calls on your account; the constructor refuses to build in a browser-like runtime so that
@@ -474,6 +474,14 @@ declare class RealtimeAvatar {
474
474
  createSpeech(voiceId: operations["createSpeech"]["parameters"]["path"]["voiceId"], input: CreateSpeechInput, options?: {
475
475
  signal?: AbortSignal;
476
476
  }): Promise<SpeechResult>;
477
+ /**
478
+ * Incremental mono PCM and absolute alignment, without a call or LiveKit. The first next()
479
+ * starts the paid request; break/return or signal abort cancels it. Never retried. A failed
480
+ * terminal is yielded, not thrown; malformed/truncated transport throws RealtimeAvatarError.
481
+ */
482
+ createSpeechStream(voiceId: operations["createSpeechStream"]["parameters"]["path"]["voiceId"], input: CreateSpeechStreamRequest, options?: {
483
+ signal?: AbortSignal;
484
+ }): AsyncGenerator<SpeechStreamEvent, void, unknown>;
477
485
  }
478
486
 
479
487
  /** Base for everything this SDK throws, so `catch (e) { if (e instanceof RealtimeAvatarError) }` works. */
@@ -953,4 +961,4 @@ declare const proxyEndRequestSchema: z.ZodObject<{
953
961
  }>>>;
954
962
  }, z.core.$strict>;
955
963
 
956
- export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreateLive2dAvatarInput, CreateRenderInput, CreateSpeechInput, CreditBalance, DEFAULT_FISH_TTS_MODEL, EndCallOptions, type ExternalSpeechSegment, type ExternalTurnContext, type ExternalUtterance, FISH_DELIVERY_MODELS, type FishDelivery, type FishTtsModel, ListRecordingsQuery, ListRecordingsResponse, type ListRendersQuery, type ListRendersResponse, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, RealtimeAvatarWebhookError, RecordingAccessResponse, RecordingArtifact, RegisteredAvatar, type Render, type RenderAccessResponse, type RenderFailureCode, type RenderPlayback, type RenderStatus, type ShotTiming, SpeechResult, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, VoiceWebhookRequest, type WebhookVerificationErrorCode, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };
964
+ export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreateLive2dAvatarInput, CreateRenderInput, CreateSpeechInput, CreateSpeechStreamRequest, CreditBalance, DEFAULT_FISH_TTS_MODEL, EndCallOptions, type ExternalSpeechSegment, type ExternalTurnContext, type ExternalUtterance, FISH_DELIVERY_MODELS, type FishDelivery, type FishTtsModel, ListRecordingsQuery, ListRecordingsResponse, type ListRendersQuery, type ListRendersResponse, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, RealtimeAvatarWebhookError, RecordingAccessResponse, RecordingArtifact, RegisteredAvatar, type Render, type RenderAccessResponse, type RenderFailureCode, type RenderPlayback, type RenderStatus, type ShotTiming, SpeechResult, SpeechStreamEvent, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, VoiceWebhookRequest, type WebhookVerificationErrorCode, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import './chunk-6KQS7CTR.js';
2
- export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, createSpeechRequestSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-YHNBW3X6.js';
2
+ export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, createSpeechRequestSchema, createSpeechStreamRequestSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, speechAlignedTextSchema, speechStreamEventSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-RBK6EHVH.js';
3
3
  import './chunk-MCIXU6XP.js';
package/dist/nextjs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-aQOs22YE.js';
2
- import './types-C_0GpIws.js';
1
+ import { P as ProxyConfig } from './types-RQo4LwZ3.js';
2
+ import './types-DVL5VX3N.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/nextjs.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-EVATXOT2.js';
2
- import './chunk-YHNBW3X6.js';
1
+ import { createProxyHandler } from './chunk-FFMZERDZ.js';
2
+ import './chunk-RBK6EHVH.js';
3
3
  import './chunk-MCIXU6XP.js';
4
4
 
5
5
  // ../proxy/src/nextjs.ts
package/dist/server.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { DEFAULT_FISH_TTS_MODEL, ExternalSpeechSegment, ExternalTurnContext, ExternalUtterance, FISH_DELIVERY_MODELS, FishDelivery, FishTtsModel, ListRendersQuery, ListRendersResponse, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarOptions, RealtimeAvatarWebhookError, Render, RenderAccessResponse, RenderFailureCode, RenderPlayback, RenderStatus, ShotTiming, StartCallOptions, WebhookVerificationErrorCode, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './index.js';
2
- export { i as Asset, h as AssetKind, A as Avatar, u as AvatarClip, d as AvatarSourceSwap, c as AvatarUpdate, v as CallConnection, C as CallMode, a as CallPolicy, w as CallQueued, x as ClipDeclaration, g as ClipLibrary, e as ClipLibraryDeclaration, y as ClipLibraryPlan, f as ClipLibraryUpdate, z as ClipSource, B as ContextMessage, b as CreateLive2dAvatarInput, p as CreateRenderInput, s as CreateSpeechInput, q as CreditBalance, E as EndCallOptions, D as EndCallReason, F as ExternalLlm, l as ListRecordingsQuery, m as ListRecordingsResponse, j as ListSessionsOptions, L as LoopRedirect, o as RecordingAccessResponse, n as RecordingArtifact, G as RecordingArtifactStatus, H as RecordingMode, R as RegisteredAvatar, I as RenderShot, t as SpeechResult, S as StartCallResult, T as TranscriptPayload, k as UsageSession, U as UsageSessionPage, J as VideoPolicy, K as VoiceWebhook, M as VoiceWebhookErrorCode, V as VoiceWebhookRequest, N as createSpeechRequestSchema, O as isQueued, P as listRecordingsResponseSchema, Q as recordingAccessResponseSchema, W as recordingArtifactSchema, X as recordingModeSchema } from './types-C_0GpIws.js';
2
+ export { i as Asset, h as AssetKind, A as Avatar, w as AvatarClip, d as AvatarSourceSwap, c as AvatarUpdate, x as CallConnection, C as CallMode, a as CallPolicy, y as CallQueued, z as ClipDeclaration, g as ClipLibrary, e as ClipLibraryDeclaration, B as ClipLibraryPlan, f as ClipLibraryUpdate, D as ClipSource, F as ContextMessage, b as CreateLive2dAvatarInput, p as CreateRenderInput, s as CreateSpeechInput, u as CreateSpeechStreamRequest, q as CreditBalance, E as EndCallOptions, G as EndCallReason, H as ExternalLlm, l as ListRecordingsQuery, m as ListRecordingsResponse, j as ListSessionsOptions, L as LoopRedirect, o as RecordingAccessResponse, n as RecordingArtifact, I as RecordingArtifactStatus, J as RecordingMode, R as RegisteredAvatar, K as RenderShot, M as SpeechAlignedText, t as SpeechResult, v as SpeechStreamEvent, S as StartCallResult, T as TranscriptPayload, k as UsageSession, U as UsageSessionPage, N as VideoPolicy, O as VoiceWebhook, P as VoiceWebhookErrorCode, V as VoiceWebhookRequest, Q as createSpeechRequestSchema, W as createSpeechStreamRequestSchema, X as isQueued, Y as listRecordingsResponseSchema, Z as recordingAccessResponseSchema, _ as recordingArtifactSchema, $ as recordingModeSchema, a0 as speechAlignedTextSchema, a1 as speechStreamEventSchema } from './types-DVL5VX3N.js';
3
3
  import './connection-history.js';
4
4
  import 'zod';
package/dist/server.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import './chunk-6KQS7CTR.js';
2
- export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, createSpeechRequestSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-YHNBW3X6.js';
2
+ export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, createSpeechRequestSchema, createSpeechStreamRequestSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, speechAlignedTextSchema, speechStreamEventSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-RBK6EHVH.js';
3
3
  import './chunk-MCIXU6XP.js';
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-aQOs22YE.js';
2
- import './types-C_0GpIws.js';
1
+ import { P as ProxyConfig } from './types-RQo4LwZ3.js';
2
+ import './types-DVL5VX3N.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-EVATXOT2.js';
2
- import './chunk-YHNBW3X6.js';
1
+ import { createProxyHandler } from './chunk-FFMZERDZ.js';
2
+ import './chunk-RBK6EHVH.js';
3
3
  import './chunk-MCIXU6XP.js';
4
4
 
5
5
  // src/tanstack-start.ts
@@ -1110,6 +1110,105 @@ interface components {
1110
1110
  /** @description BCP-47 tag such as en-AU. Shapes how numbers, dates and units are read; it does not change the voice. */
1111
1111
  language?: string;
1112
1112
  };
1113
+ CreateSpeechStreamRequest: {
1114
+ /** @description What to say, at most 2,000 characters after trimming. Billed per UTF-8 byte: plain English is one byte per character, accented letters and other scripts use 2 to 4. Text in [square brackets] may be performed as a delivery cue rather than spoken. */
1115
+ text: string;
1116
+ /** @description Speaking rate, 0.5 to 2. Omit for the voice's natural pace. */
1117
+ speed?: number;
1118
+ /** @description BCP-47 tag such as en-AU. Shapes how numbers, dates and units are read; it does not change the voice. */
1119
+ language?: string;
1120
+ };
1121
+ SpeechStreamEvent: {
1122
+ /** Format: uuid */
1123
+ requestId: string;
1124
+ /** @constant */
1125
+ type: "started";
1126
+ /** @constant */
1127
+ encoding: "pcm_s16le";
1128
+ /** @constant */
1129
+ sampleRate: 24000;
1130
+ /** @constant */
1131
+ channels: 1;
1132
+ } | {
1133
+ /** Format: uuid */
1134
+ requestId: string;
1135
+ /** @constant */
1136
+ type: "audio";
1137
+ sequence: number;
1138
+ sampleOffset: number;
1139
+ /** Format: base64 */
1140
+ audioBase64: string;
1141
+ } | {
1142
+ /** Format: uuid */
1143
+ requestId: string;
1144
+ /** @constant */
1145
+ type: "alignment";
1146
+ chunkSeq: number;
1147
+ segments: {
1148
+ text: string;
1149
+ start: number;
1150
+ end: number;
1151
+ }[];
1152
+ } | {
1153
+ /** Format: uuid */
1154
+ requestId: string;
1155
+ /** @constant */
1156
+ type: "completed";
1157
+ totalSamples: number;
1158
+ billedCredits: number;
1159
+ billedBytes: number;
1160
+ } | {
1161
+ /** Format: uuid */
1162
+ requestId: string;
1163
+ /** @constant */
1164
+ type: "failed";
1165
+ error: {
1166
+ /** @description Human-readable message. Not a stable contract — switch on `code` or `status`. */
1167
+ error: string;
1168
+ /** @description Repeats the HTTP status in the body. Always present. */
1169
+ status: number;
1170
+ /** @description Machine-readable discriminator. ALWAYS present: a failure that names its own — billing, clip-library and loop refusals, `insufficient_scope` — carries that, and everything else carries the status's default (`unauthorized`, `not_found`, `rate_limited`, …). Switch on this rather than on `error`, whose wording is not a contract. The set is open and grows with the API; the codes a given endpoint can return are documented with that endpoint at https://realtimeavatar.ai/docs/api-reference. */
1171
+ code: string;
1172
+ /**
1173
+ * Format: uri
1174
+ * @description Where to read how to resolve a failure of this class — the authentication guide for 401/403, the API reference otherwise. Always present.
1175
+ */
1176
+ documentation: string;
1177
+ /** @description Set when the failure is worth retrying as-is. */
1178
+ retryable?: boolean;
1179
+ /**
1180
+ * Format: uuid
1181
+ * @description Server-generated correlation ID, also returned in X-Request-ID on correlated failures. Quote this when contacting support. Detailed diagnostics require separate operational access.
1182
+ */
1183
+ requestId?: string;
1184
+ /**
1185
+ * @description Present on `403 insufficient_scope` — the one scope this operation needed and the key did not carry. Repeated in the `WWW-Authenticate` challenge as `scope=`.
1186
+ * @enum {string}
1187
+ */
1188
+ requiredScope?: "*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write" | "renders:read" | "renders:write";
1189
+ /** @description Present alongside `requiredScope` — the scopes the presented key does carry. */
1190
+ grantedScopes?: ("*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write" | "renders:read" | "renders:write")[];
1191
+ /** @description Present on 402 — where to send the user to top up. */
1192
+ billingUrl?: string;
1193
+ /** @description On concurrency_limit_reached: the workspace's concurrent session limit. */
1194
+ maxConcurrentSessions?: number;
1195
+ /** @description Legacy concurrency count: occupied reservations, including active, connecting and starting sessions. Not the number of active conversations. */
1196
+ liveSessions?: number;
1197
+ /** @description On concurrency_limit_reached: counted reservations with started media, observed at refusal. */
1198
+ activeSessions?: number;
1199
+ /** @description On concurrency_limit_reached: counted reservations with an attached session that has not started media. */
1200
+ connectingSessions?: number;
1201
+ /** @description On concurrency_limit_reached: counted in-flight starts with no attached session yet. */
1202
+ pendingSessions?: number;
1203
+ } & {
1204
+ [key: string]: unknown;
1205
+ };
1206
+ };
1207
+ SpeechAlignedText: {
1208
+ text: string;
1209
+ start: number;
1210
+ end: number;
1211
+ };
1113
1212
  CreditBalance: {
1114
1213
  tenantId: string;
1115
1214
  balanceCreditMicros: number;
@@ -2177,6 +2276,96 @@ interface operations {
2177
2276
  };
2178
2277
  };
2179
2278
  };
2279
+ createSpeechStream: {
2280
+ parameters: {
2281
+ query?: never;
2282
+ header?: never;
2283
+ path: {
2284
+ voiceId: string;
2285
+ };
2286
+ cookie?: never;
2287
+ };
2288
+ requestBody: {
2289
+ content: {
2290
+ "application/json": components["schemas"]["CreateSpeechStreamRequest"];
2291
+ };
2292
+ };
2293
+ responses: {
2294
+ /** @description SSE frames whose JSON data follows SpeechStreamEvent. Terminal completed confirms billing; failed is an explicit failure, including after partial audio. */
2295
+ 200: {
2296
+ headers: {
2297
+ [name: string]: unknown;
2298
+ };
2299
+ content: {
2300
+ "text/event-stream": components["schemas"]["SpeechStreamEvent"];
2301
+ };
2302
+ };
2303
+ /** @description Missing, malformed, revoked, or expired key. */
2304
+ 401: {
2305
+ headers: {
2306
+ [name: string]: unknown;
2307
+ };
2308
+ content: {
2309
+ "application/json": components["schemas"]["Error"];
2310
+ };
2311
+ };
2312
+ /** @description Insufficient scope, inactive workspace, or speech_requires_purchase. */
2313
+ 403: {
2314
+ headers: {
2315
+ [name: string]: unknown;
2316
+ };
2317
+ content: {
2318
+ "application/json": components["schemas"]["Error"];
2319
+ };
2320
+ };
2321
+ /** @description voice_not_found in this workspace. */
2322
+ 404: {
2323
+ headers: {
2324
+ [name: string]: unknown;
2325
+ };
2326
+ content: {
2327
+ "application/json": components["schemas"]["Error"];
2328
+ };
2329
+ };
2330
+ /** @description voice_not_ready. */
2331
+ 409: {
2332
+ headers: {
2333
+ [name: string]: unknown;
2334
+ };
2335
+ content: {
2336
+ "application/json": components["schemas"]["Error"];
2337
+ };
2338
+ };
2339
+ /** @description Invalid request or voice_unavailable. */
2340
+ 422: {
2341
+ headers: {
2342
+ [name: string]: unknown;
2343
+ };
2344
+ content: {
2345
+ "application/json": components["schemas"]["Error"];
2346
+ };
2347
+ };
2348
+ /** @description rate_limited or speech_busy; honour Retry-After. */
2349
+ 429: {
2350
+ headers: {
2351
+ "Retry-After"?: number;
2352
+ [name: string]: unknown;
2353
+ };
2354
+ content: {
2355
+ "application/json": components["schemas"]["Error"];
2356
+ };
2357
+ };
2358
+ /** @description Error. Route-dependent: 400 (a field this route cannot honour — see `portraitUrl` on `UpdateAvatarRequest`), 402 (insufficient credits or spend limit), 404 (no such avatar, voice, or key for this tenant — the message often reads "does not belong to this tenant", which is a missing id and not a permission failure), 408 (the request was cancelled), 409 (the resource is not in a state that accepts this write — a stale `expectedRevision`, a render already in flight, or a mint that asked for a clip library still building), 411 (`POST /v1/assets/remote` only — the origin serving `remoteUrl` sent no `content-length`, so the platform will not stream it), 422 (strict schema rejection, or a motion description the safety screen refused), 429 (rate limited), 502 (upstream render failed), 503 (a dependency this route needs is unavailable — retryable, and nothing was written), 504 (the upstream request budget expired), 500 (unhandled). Switch on `code` where present, else `status`. */
2359
+ default: {
2360
+ headers: {
2361
+ [name: string]: unknown;
2362
+ };
2363
+ content: {
2364
+ "application/json": components["schemas"]["Error"];
2365
+ };
2366
+ };
2367
+ };
2368
+ };
2180
2369
  listAvatars: {
2181
2370
  parameters: {
2182
2371
  query?: never;
@@ -4083,6 +4272,11 @@ declare const externalLlmOptionsSchema: z.ZodObject<{
4083
4272
  }, z.core.$strict>;
4084
4273
  declare function externalLlmToWire(input: z.input<typeof externalLlmOptionsSchema>): z.output<typeof externalLlmWireSchema>;
4085
4274
 
4275
+ declare const speechAlignedTextSchema: z.ZodObject<{
4276
+ text: z.ZodString;
4277
+ start: z.ZodNumber;
4278
+ end: z.ZodNumber;
4279
+ }, z.core.$strict>;
4086
4280
  declare const createSpeechRequestSchema: z.ZodObject<{
4087
4281
  text: z.ZodPipe<z.ZodString, z.ZodString>;
4088
4282
  speed: z.ZodOptional<z.ZodNumber>;
@@ -4093,6 +4287,87 @@ declare const createSpeechRequestSchema: z.ZodObject<{
4093
4287
  }>>;
4094
4288
  }, z.core.$strict>;
4095
4289
  type CreateSpeechInput = z.input<typeof createSpeechRequestSchema>;
4290
+ declare const createSpeechStreamRequestSchema: z.ZodObject<{
4291
+ text: z.ZodPipe<z.ZodString, z.ZodString>;
4292
+ speed: z.ZodOptional<z.ZodNumber>;
4293
+ language: z.ZodOptional<z.ZodString>;
4294
+ }, z.core.$strict>;
4295
+ type CreateSpeechStreamRequest = z.infer<typeof createSpeechStreamRequestSchema>;
4296
+ type SpeechAlignedText = z.infer<typeof speechAlignedTextSchema>;
4297
+ declare const speechStreamEventSchema: z.ZodUnion<readonly [z.ZodObject<{
4298
+ requestId: z.ZodUUID;
4299
+ type: z.ZodLiteral<"started">;
4300
+ encoding: z.ZodLiteral<"pcm_s16le">;
4301
+ sampleRate: z.ZodLiteral<24000>;
4302
+ channels: z.ZodLiteral<1>;
4303
+ }, z.core.$strict>, z.ZodObject<{
4304
+ requestId: z.ZodUUID;
4305
+ type: z.ZodLiteral<"audio">;
4306
+ sequence: z.ZodInt;
4307
+ sampleOffset: z.ZodInt;
4308
+ audioBase64: z.ZodBase64;
4309
+ }, z.core.$strict>, z.ZodObject<{
4310
+ requestId: z.ZodUUID;
4311
+ type: z.ZodLiteral<"alignment">;
4312
+ chunkSeq: z.ZodInt;
4313
+ segments: z.ZodArray<z.ZodObject<{
4314
+ text: z.ZodString;
4315
+ start: z.ZodNumber;
4316
+ end: z.ZodNumber;
4317
+ }, z.core.$strict>>;
4318
+ }, z.core.$strict>, z.ZodObject<{
4319
+ requestId: z.ZodUUID;
4320
+ type: z.ZodLiteral<"completed">;
4321
+ totalSamples: z.ZodInt;
4322
+ billedCredits: z.ZodNumber;
4323
+ billedBytes: z.ZodInt;
4324
+ }, z.core.$strict>, z.ZodObject<{
4325
+ requestId: z.ZodUUID;
4326
+ type: z.ZodLiteral<"failed">;
4327
+ error: z.ZodObject<{
4328
+ error: z.ZodString;
4329
+ status: z.ZodInt;
4330
+ code: z.ZodString;
4331
+ documentation: z.ZodURL;
4332
+ retryable: z.ZodOptional<z.ZodBoolean>;
4333
+ requestId: z.ZodOptional<z.ZodUUID>;
4334
+ requiredScope: z.ZodOptional<z.ZodEnum<{
4335
+ "*": "*";
4336
+ "api_keys:write": "api_keys:write";
4337
+ "credits:read": "credits:read";
4338
+ "avatars:read": "avatars:read";
4339
+ "avatars:write": "avatars:write";
4340
+ "realtime:write": "realtime:write";
4341
+ "usage:read": "usage:read";
4342
+ "recordings:read": "recordings:read";
4343
+ "usage:write": "usage:write";
4344
+ "speech:write": "speech:write";
4345
+ "renders:read": "renders:read";
4346
+ "renders:write": "renders:write";
4347
+ }>>;
4348
+ grantedScopes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
4349
+ "*": "*";
4350
+ "api_keys:write": "api_keys:write";
4351
+ "credits:read": "credits:read";
4352
+ "avatars:read": "avatars:read";
4353
+ "avatars:write": "avatars:write";
4354
+ "realtime:write": "realtime:write";
4355
+ "usage:read": "usage:read";
4356
+ "recordings:read": "recordings:read";
4357
+ "usage:write": "usage:write";
4358
+ "speech:write": "speech:write";
4359
+ "renders:read": "renders:read";
4360
+ "renders:write": "renders:write";
4361
+ }>>>;
4362
+ billingUrl: z.ZodOptional<z.ZodString>;
4363
+ maxConcurrentSessions: z.ZodOptional<z.ZodInt>;
4364
+ liveSessions: z.ZodOptional<z.ZodInt>;
4365
+ activeSessions: z.ZodOptional<z.ZodInt>;
4366
+ connectingSessions: z.ZodOptional<z.ZodInt>;
4367
+ pendingSessions: z.ZodOptional<z.ZodInt>;
4368
+ }, z.core.$loose>;
4369
+ }, z.core.$strict>]>;
4370
+ type SpeechStreamEvent = z.infer<typeof speechStreamEventSchema>;
4096
4371
  declare const speechContentTypeSchema: z.ZodEnum<{
4097
4372
  "audio/mpeg": "audio/mpeg";
4098
4373
  "audio/wav": "audio/wav";
@@ -4607,4 +4882,4 @@ interface TranscriptPayload {
4607
4882
  client_metadata: Record<string, string>;
4608
4883
  }
4609
4884
 
4610
- export { type Avatar as A, type ContextMessage as B, type CallMode as C, type EndCallReason as D, type EndCallOptions as E, type ExternalLlm as F, type RecordingArtifactStatus as G, type RecordingMode as H, type RenderShot as I, type VideoPolicy as J, type VoiceWebhook as K, type LoopRedirect as L, type VoiceWebhookErrorCode as M, createSpeechRequestSchema as N, isQueued as O, listRecordingsResponseSchema as P, recordingAccessResponseSchema as Q, type RegisteredAvatar as R, type StartCallResult as S, type TranscriptPayload as T, type UsageSessionPage as U, type VoiceWebhookRequest as V, recordingArtifactSchema as W, recordingModeSchema as X, type CallPolicy as a, type CreateLive2dAvatarInput as b, type AvatarUpdate as c, type AvatarSourceSwap as d, type ClipLibraryDeclaration as e, type ClipLibraryUpdate as f, type ClipLibrary as g, type AssetKind as h, type Asset as i, type ListSessionsOptions as j, type UsageSession as k, type ListRecordingsQuery as l, type ListRecordingsResponse as m, type RecordingArtifact as n, type RecordingAccessResponse as o, type CreateRenderInput as p, type CreditBalance as q, type operations as r, type CreateSpeechInput as s, type SpeechResult as t, type AvatarClip as u, type CallConnection as v, type CallQueued as w, type ClipDeclaration as x, type ClipLibraryPlan as y, type ClipSource as z };
4885
+ export { recordingModeSchema as $, type Avatar as A, type ClipLibraryPlan as B, type CallMode as C, type ClipSource as D, type EndCallOptions as E, type ContextMessage as F, type EndCallReason as G, type ExternalLlm as H, type RecordingArtifactStatus as I, type RecordingMode as J, type RenderShot as K, type LoopRedirect as L, type SpeechAlignedText as M, type VideoPolicy as N, type VoiceWebhook as O, type VoiceWebhookErrorCode as P, createSpeechRequestSchema as Q, type RegisteredAvatar as R, type StartCallResult as S, type TranscriptPayload as T, type UsageSessionPage as U, type VoiceWebhookRequest as V, createSpeechStreamRequestSchema as W, isQueued as X, listRecordingsResponseSchema as Y, recordingAccessResponseSchema as Z, recordingArtifactSchema as _, type CallPolicy as a, speechAlignedTextSchema as a0, speechStreamEventSchema as a1, type CreateLive2dAvatarInput as b, type AvatarUpdate as c, type AvatarSourceSwap as d, type ClipLibraryDeclaration as e, type ClipLibraryUpdate as f, type ClipLibrary as g, type AssetKind as h, type Asset as i, type ListSessionsOptions as j, type UsageSession as k, type ListRecordingsQuery as l, type ListRecordingsResponse as m, type RecordingArtifact as n, type RecordingAccessResponse as o, type CreateRenderInput as p, type CreditBalance as q, type operations as r, type CreateSpeechInput as s, type SpeechResult as t, type CreateSpeechStreamRequest as u, type SpeechStreamEvent as v, type AvatarClip as w, type CallConnection as x, type CallQueued as y, type ClipDeclaration as z };
@@ -1,4 +1,4 @@
1
- import { C as CallMode, a as CallPolicy } from './types-C_0GpIws.js';
1
+ import { C as CallMode, a as CallPolicy } from './types-DVL5VX3N.js';
2
2
 
3
3
  /** The three things a caller can ask the proxy to do. Gate on these, not on URLs. */
4
4
  type ProxyOperation = "connect" | "end" | "avatars" | "credits";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "realtime-avatar",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "description": "Realtime Avatar SDK. `realtime-avatar` and the route adapters hold your API key and are server-only; `realtime-avatar/react`, `/browser` and `/tools` never can — importing a server entry into a browser build throws at bundle time.",
5
5
  "license": "MIT",
6
6
  "author": "The Influence Company",