realtime-avatar 0.30.0 → 0.31.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
@@ -243,6 +243,98 @@ return new Response(await myTts(text, voice_id), { headers: { "content-type": "a
243
243
  Working endpoints: `apps/quickstart/nextjs-app-router/app/api/voice/route.ts` and `POST /api/voice`
244
244
  in `apps/quickstart/python-fastapi/main.py`.
245
245
 
246
+ ## Pre-rendered video
247
+
248
+ **Everything in one shot happens at the same time; shots play one after another.**
249
+
250
+ ```ts
251
+ const render = await rta.createRender({
252
+ avatarId: "ava_0123456789abcdef0123456789abcdef",
253
+ shots: [
254
+ { clipId: "gesture_send_flower", say: "你终于来了。今天……我有话想对你说。" },
255
+ { clipId: "idle_touch_collar", say: "别笑,我是认真的。", pauseAfterMs: 800 },
256
+ { say: "所以,今晚留下来。" },
257
+ ],
258
+ });
259
+ const done = await rta.waitForRender(render.id);
260
+ if (done.status === "failed") throw new Error(done.error?.message);
261
+ const { url, expiresAt } = await rta.getRenderAccess(done.id); // <video src={url}> plays it
262
+ ```
263
+
264
+ She sends the flower while she says the first line, touches her collar while she says the
265
+ second and then stays quiet for 800 ms, and says the last line without a new clip. The result is
266
+ an MP4 (H.264 + AAC, 25 fps) with the same face, clips, voice and lip-sync as a call, made
267
+ offline with no call and no LiveKit room. The avatar id is a placeholder: use your own
268
+ `avatarId`, and clip ids from `listClips(avatarId)`.
269
+
270
+ | Field | What it is |
271
+ | --- | --- |
272
+ | `avatarId` | The avatar. |
273
+ | `voiceId` | A voice from your workspace's voice library. |
274
+ | `voice` | An inline Fish voice, the same object a call takes: `{ provider: "fish", voice_id, model?, speed?, emotion?, language? }`. |
275
+ | `lipGain` | Mouth-motion amplitude, as on a call. Omit it for the default. |
276
+ | `shots` | The script: 1 to 50 shots, played one after another. |
277
+ | `shots[].clipId` | What she does: a ready clip from the avatar's clip library, or `"primary"` for the avatar's own video. Omit it to keep the current loop clip. |
278
+ | `shots[].say` | What she says, 1 to 1,000 characters after trimming whitespace; a blank `say` is refused. Speech starts when the shot starts. |
279
+ | `shots[].pauseAfterMs` | How long she stays silent after speaking, 0 to 10,000 ms. Default 0. |
280
+
281
+ **How long a shot lasts.** Its speech plus `pauseAfterMs`, or its clip's action if that is
282
+ longer, rounded up to 200 ms. A loop clip does not set a shot's length: a shot with only a loop
283
+ clip lasts 200 ms, so add `pauseAfterMs` to hold it.
284
+
285
+ **Which clips loop.** A clip loops if it is `"primary"` or in the avatar's idle pool
286
+ (`listClips(avatarId).behavior.idle.clips`); every other clip plays once, so a listening clip
287
+ or an action that is not also in the idle pool plays once. The clip list has no per-clip
288
+ `playback`; read `behavior.idle.clips` from it.
289
+
290
+ - **once**, an action: it plays exactly once from its first frame and is never cut. If the shot
291
+ runs longer, she continues on the loop clip from before the shot. The same clip in two shots
292
+ in a row plays twice.
293
+ - **loop**: it fills the shot, and the same loop clip in shots in a row continues without
294
+ restarting.
295
+
296
+ The video opens with about 400 ms and closes with about 600 ms on the current loop clip.
297
+
298
+ **Where each shot landed.** A `ready` render carries `timeline`, one entry per shot, in order.
299
+ Every time is milliseconds from the start of the video.
300
+
301
+ | Field | What it is |
302
+ | --- | --- |
303
+ | `index` | The shot's position in your `shots`, from 0. |
304
+ | `startMs` · `endMs` | When the shot starts and ends; the next shot starts at `endMs`. |
305
+ | `clipId` | The clip the shot played: the one you named, else the loop clip it kept, else `"primary"`. |
306
+ | `playback` | `"once"` or `"loop"`. |
307
+ | `speechStartMs` · `speechEndMs` | When she starts and stops speaking. `null` when the shot has no `say`. |
308
+ | `clipEndMs` | When the action finished. Once clips only, else `null`. |
309
+ | `afterClipId` | The loop clip shown after the action, when the shot outlasts it. Once clips only, else `null`. |
310
+
311
+ - **The key needs `renders:write` to create and `renders:read` to read.** Both are off on a new
312
+ key until you tick them; a key without the scope answers `403 insufficient_scope`.
313
+ - **`createRender` returns on acceptance.** A render is `queued`, then `rendering`, then `ready`
314
+ or `failed`. `waitForRender` returns a failed render rather than throwing, so `error.code`
315
+ (`asset_unavailable`, `tts_failed`, `too_long`, `render_failed`) stays a value you can branch
316
+ on. It throws only when its timeout (30 minutes by default) runs out, and that is not a
317
+ failure.
318
+ - **A `clipId` must be a READY clip of the avatar, or `"primary"`.** Otherwise the create is
319
+ refused with `422 render_clip_unavailable` before anything is charged. Run `waitForClips`
320
+ after changing the library.
321
+ - **The voice is `voiceId`, or `voice`, or neither for the avatar's own.** Sending both does not
322
+ compile, and the platform refuses it with `422`. Only a Fish voice renders: a `voiceId` the
323
+ workspace cannot see is `404 voice_not_found`, and an inline voice of another provider, a
324
+ `voiceId` that is not Fish, or, when neither was sent, an avatar whose own voice is not Fish
325
+ is `422 voice_unavailable`, refused before anything is charged. A render is never quietly
326
+ spoken in another voice. `render.voiceId` is the library voice it spoke with, `null` for an
327
+ inline `voice`.
328
+ - **Keep the render id, not the URL.** The URL is signed for an hour; ask `getRenderAccess`
329
+ again for a fresh one. The file itself is kept until you delete the account.
330
+ - **Limits.** Every shot sets at least one field (`pauseAfterMs: 0` alone does not count), at
331
+ least one shot has `say`, at most 4,000 characters of `say` in total and 16 different clips
332
+ besides `"primary"`. A script whose video would run past 180 seconds is refused with
333
+ `400 render_too_long` before any credits are held. A workspace may have 4 renders queued or rendering at once; the
334
+ next is `429 concurrency_limit_reached`, which clears when one settles.
335
+ - **Billing.** Per second of rendered video at the live per-second rate. A failed render is not
336
+ charged.
337
+
246
338
  ## Input source on room messages
247
339
 
248
340
  On React and React Native, `session.sendTurn(text)` automatically observes text.
@@ -304,6 +396,14 @@ rta.getRecording(recordingId)
304
396
  rta.getRecordingAccess(recordingId)
305
397
  rta.getConnectionHistory(sessionId) // bounded LiveKit observations; requires usage:read
306
398
 
399
+ // pre-rendered video (MP4, no live call); server only, requires renders:write / renders:read
400
+ rta.createRender({ avatarId, voiceId? | voice?, lipGain?, shots }) // 202 queued; one Idempotency-Key across retries
401
+ rta.waitForRender(renderId) // block until ready | failed; RETURNS a failed render, throws only on timeout
402
+ rta.getRender(renderId)
403
+ rta.listRenders({ limit?, cursor? })
404
+ rta.iterateRenders({ limit? }) // every render, paging handled
405
+ rta.getRenderAccess(renderId) // { id, url, expiresAt }; signed for an hour, renew when needed
406
+
307
407
  // avatars
308
408
  rta.createAvatarFromImage({ displayName, imageUrl, motionPrompt?, voice? }) // the only lane
309
409
  rta.createAvatarFromVideo({ displayName, videoUrl, voice? }) // DEPRECATED — closed, 422
@@ -297,6 +297,56 @@ var recordingAccessResponseSchema = z.object({
297
297
  url: z.string().url(),
298
298
  expiresAt: z.string().datetime({ offset: true })
299
299
  }).strict();
300
+ var RENDER_ID_PATTERN = /^rnd_[0-9a-f]{32}$/;
301
+ var renderIdSchema = z.string().regex(RENDER_ID_PATTERN, "render id must be rnd_ followed by 32 lowercase hex");
302
+ var RENDER_STATUSES = ["queued", "rendering", "ready", "failed"];
303
+ var renderStatusSchema = z.enum(RENDER_STATUSES);
304
+ var RENDER_FAILURE_CODES = ["asset_unavailable", "tts_failed", "too_long", "render_failed"];
305
+ var renderFailureCodeSchema = z.enum(RENDER_FAILURE_CODES);
306
+ var RENDER_PLAYBACKS = ["once", "loop"];
307
+ var renderPlaybackSchema = z.enum(RENDER_PLAYBACKS);
308
+ var renderErrorSchema = z.object({
309
+ code: renderFailureCodeSchema,
310
+ message: z.string().min(1)
311
+ }).strict();
312
+ var shotTimingSchema = z.object({
313
+ index: z.number().int().nonnegative().describe("The shot's position in your shots list, from 0."),
314
+ startMs: z.number().int().nonnegative().describe("When the shot starts."),
315
+ endMs: z.number().int().positive().describe("When the shot ends; the next shot starts here."),
316
+ clipId: z.string().min(1).describe('The clip the shot played: the one you named, else the loop clip it kept, else "primary".'),
317
+ playback: renderPlaybackSchema.describe("once: the clip's action played one time. loop: the clip filled the shot."),
318
+ speechStartMs: z.number().int().nonnegative().nullable().describe("When she starts speaking. Null when the shot has no say."),
319
+ speechEndMs: z.number().int().nonnegative().nullable().describe("When she stops speaking. Null when the shot has no say."),
320
+ clipEndMs: z.number().int().nonnegative().nullable().describe("When the action finished. Once clips only; null for a loop clip."),
321
+ afterClipId: z.string().min(1).nullable().describe("The loop clip shown after the action finished, when the shot outlasts it. Once clips only; otherwise null.")
322
+ }).strict();
323
+ var renderSchema = z.object({
324
+ id: renderIdSchema,
325
+ object: z.literal("render"),
326
+ status: renderStatusSchema,
327
+ avatarId: z.string().min(1),
328
+ voiceId: z.string().min(1).nullable().describe("The library voice the render speaks with: the voiceId you sent, else the avatar's own voice. Null when it speaks with the inline voice you sent."),
329
+ durationMs: z.number().int().positive().nullable().describe("Length of the rendered video. Set once status is ready."),
330
+ width: z.number().int().positive().nullable(),
331
+ height: z.number().int().positive().nullable(),
332
+ timeline: z.array(shotTimingSchema).nullable().describe("One entry per shot, in order. Set once status is ready."),
333
+ error: renderErrorSchema.nullable().describe("Set only when status is failed."),
334
+ createdAt: z.string().datetime({ offset: true }),
335
+ completedAt: z.string().datetime({ offset: true }).nullable()
336
+ }).strict();
337
+ var listRendersQuerySchema = z.object({
338
+ limit: z.coerce.number().int().min(1).max(100).default(50),
339
+ cursor: z.string().min(1).optional()
340
+ }).strict();
341
+ var listRendersResponseSchema = z.object({
342
+ data: z.array(renderSchema),
343
+ nextCursor: z.string().nullable()
344
+ }).strict();
345
+ var renderAccessResponseSchema = z.object({
346
+ id: renderIdSchema,
347
+ url: z.string().url(),
348
+ expiresAt: z.string().datetime({ offset: true })
349
+ }).strict();
300
350
  var schema02 = z.enum(["s1", "s2-pro", "s2.1-pro", "drama-3"]);
301
351
  var schema110 = z.enum(["speech-1.6", "speech-1.5", "s1-mini"]);
302
352
  var schema27 = z.union([schema02, schema110]);
@@ -317,6 +367,13 @@ function backoffMs(attempt, retryAfter) {
317
367
  return Math.random() * Math.min(500 * 2 ** attempt, 8e3);
318
368
  }
319
369
  var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
370
+ function pollBudget(options, defaults) {
371
+ const finite = (value, fallback) => typeof value === "number" && Number.isFinite(value) ? value : fallback;
372
+ return {
373
+ timeoutMs: finite(options.timeoutMs, defaults.timeoutMs),
374
+ pollMs: Math.max(1e3, finite(options.pollMs, defaults.pollMs))
375
+ };
376
+ }
320
377
  var PROXY_CLIENT_TIMEOUT_MS = 6e4;
321
378
  var ROUTE_TIMEOUT_MS = PROXY_CLIENT_TIMEOUT_MS - 1e4;
322
379
  function retryFits(attemptStartedAt, waitMs, deadline) {
@@ -861,7 +918,8 @@ function toSessionsPage(page) {
861
918
 
862
919
  // ../http-client/src/client.ts
863
920
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
864
- var SDK_VERSION = "0.30.0";
921
+ var RENDER_MISMATCH = "Render response did not match the SDK contract";
922
+ var SDK_VERSION = "0.31.0";
865
923
  var RealtimeAvatar = class {
866
924
  #apiKey;
867
925
  #baseUrl;
@@ -1186,8 +1244,7 @@ var RealtimeAvatar = class {
1186
1244
  * failed render and on timeout; a timeout is not a failure, so re-poll or call again.
1187
1245
  */
1188
1246
  async waitForLoop(avatarId, options = {}) {
1189
- const timeoutMs = options.timeoutMs ?? 20 * 6e4;
1190
- const pollMs = Math.max(1e3, options.pollMs ?? 1e4);
1247
+ const { timeoutMs, pollMs } = pollBudget(options, { timeoutMs: 20 * 6e4, pollMs: 1e4 });
1191
1248
  const deadline = Date.now() + timeoutMs;
1192
1249
  for (; ; ) {
1193
1250
  const avatar = await this.getAvatar(avatarId);
@@ -1217,8 +1274,7 @@ var RealtimeAvatar = class {
1217
1274
  * Throws only on timeout.
1218
1275
  */
1219
1276
  async waitForClips(avatarId, options = {}) {
1220
- const timeoutMs = options.timeoutMs ?? 20 * 6e4;
1221
- const pollMs = Math.max(1e3, options.pollMs ?? 1e4);
1277
+ const { timeoutMs, pollMs } = pollBudget(options, { timeoutMs: 20 * 6e4, pollMs: 1e4 });
1222
1278
  const deadline = Date.now() + timeoutMs;
1223
1279
  for (; ; ) {
1224
1280
  const library = await this.listClips(avatarId);
@@ -1284,19 +1340,11 @@ var RealtimeAvatar = class {
1284
1340
  const response = await this.#request("GET", `/usage/sessions${suffix}`, {
1285
1341
  headers: options.speechDiagnostics === true ? { "X-RTA-Speech-Diagnostics": "1" } : void 0
1286
1342
  });
1287
- const mismatch = "Usage sessions response did not match the SDK contract";
1288
- let raw;
1289
- try {
1290
- raw = await this.#json(response);
1291
- } catch (error) {
1292
- if (error instanceof SyntaxError) throw new RealtimeAvatarError(mismatch);
1293
- throw error;
1294
- }
1295
- const page = listUsageSessionsResponseSchema.safeParse(raw);
1296
- if (!page.success) {
1297
- throw new RealtimeAvatarError(mismatch);
1298
- }
1299
- return toSessionsPage(page.data);
1343
+ return toSessionsPage(await this.#contract(
1344
+ response,
1345
+ listUsageSessionsResponseSchema,
1346
+ "Usage sessions response did not match the SDK contract"
1347
+ ));
1300
1348
  }
1301
1349
  /**
1302
1350
  * Every session in a window, following the cursor for you.
@@ -1330,6 +1378,82 @@ var RealtimeAvatar = class {
1330
1378
  async getRecordingAccess(recordingId) {
1331
1379
  return recordingAccessResponseSchema.parse(await this.#json(await this.#request("GET", `/recordings/${encodeURIComponent(recordingId)}/access`)));
1332
1380
  }
1381
+ // ── renders (pre-rendered video) ─────────────────────────────────────────
1382
+ /**
1383
+ * Render an MP4 of the avatar performing a script of `shots`, offline, with no live call.
1384
+ * Everything in one shot happens at the same time; shots play one after another. Requires
1385
+ * `renders:write`, which a new key does not carry unless you tick it.
1386
+ *
1387
+ * `202` is acceptance: the render is `queued`, and `waitForRender` follows it to the end.
1388
+ * Every `clipId` must be a READY clip of this avatar or `"primary"`, or the request is refused
1389
+ * with `422 render_clip_unavailable` before anything is charged. The retry carries the same
1390
+ * `Idempotency-Key`, so a lost response never starts, or bills, a second render.
1391
+ */
1392
+ async createRender(input) {
1393
+ return this.#contract(await this.#request("POST", "/renders", { json: input }), renderSchema, RENDER_MISMATCH);
1394
+ }
1395
+ /** One render's status. Requires `renders:read`. */
1396
+ async getRender(renderId) {
1397
+ return this.#contract(await this.#request("GET", `/renders/${encodeURIComponent(renderId)}`), renderSchema, RENDER_MISMATCH);
1398
+ }
1399
+ /** This workspace's renders, newest first, one page. Requires `renders:read`. */
1400
+ async listRenders(options = {}) {
1401
+ const checked = listRendersQuerySchema.safeParse(options);
1402
+ if (!checked.success) {
1403
+ const issues = checked.error.issues.map((issue) => `${issue.path.join(".")} ${issue.message}`).join("; ");
1404
+ throw new RealtimeAvatarError(`Invalid listRenders options: ${issues}`);
1405
+ }
1406
+ const parsed = checked.data;
1407
+ const query = new URLSearchParams();
1408
+ if (options.limit !== void 0) query.set("limit", String(parsed.limit));
1409
+ if (parsed.cursor !== void 0) query.set("cursor", parsed.cursor);
1410
+ const suffix = query.size ? `?${query}` : "";
1411
+ return this.#contract(await this.#request("GET", `/renders${suffix}`), listRendersResponseSchema, RENDER_MISMATCH);
1412
+ }
1413
+ /** Every render, following `nextCursor` for you. */
1414
+ async *iterateRenders(options = {}) {
1415
+ let cursor = options.cursor;
1416
+ do {
1417
+ const page = await this.listRenders({ ...options, cursor });
1418
+ yield* page.data;
1419
+ cursor = page.nextCursor ?? void 0;
1420
+ } while (cursor);
1421
+ }
1422
+ /**
1423
+ * A signed download URL for a ready render. It expires at `expiresAt` (an hour); keep the
1424
+ * render id and ask again rather than storing the URL. `409 render_not_ready` before the
1425
+ * render is ready, `410 render_gone` if the file is no longer stored.
1426
+ */
1427
+ async getRenderAccess(renderId) {
1428
+ return this.#contract(
1429
+ await this.#request("GET", `/renders/${encodeURIComponent(renderId)}/access`),
1430
+ renderAccessResponseSchema,
1431
+ RENDER_MISMATCH
1432
+ );
1433
+ }
1434
+ /**
1435
+ * Block until a render settles, and return it: `ready` with its `timeline`, or `failed` with
1436
+ * `error.code`.
1437
+ *
1438
+ * A failed render is returned, not thrown, so its code stays a typed value you can branch on
1439
+ * (`too_long` means shorten the script; `tts_failed` and `render_failed` are worth one retry).
1440
+ * Throws only on timeout, which is not a failure: the render may still land, so poll again.
1441
+ * The default timeout is 30 minutes, the platform's own budget for one render.
1442
+ */
1443
+ async waitForRender(renderId, options = {}) {
1444
+ const { timeoutMs, pollMs } = pollBudget(options, { timeoutMs: 30 * 6e4, pollMs: 5e3 });
1445
+ const deadline = Date.now() + timeoutMs;
1446
+ for (; ; ) {
1447
+ const render = await this.getRender(renderId);
1448
+ if (render.status === "ready" || render.status === "failed") return render;
1449
+ if (Date.now() >= deadline) {
1450
+ throw new RealtimeAvatarError(
1451
+ `Render ${renderId} was still ${render.status} after ${Math.round(timeoutMs / 1e3)}s. This is a timeout, not a failure \u2014 the render may still land.`
1452
+ );
1453
+ }
1454
+ await sleep(pollMs);
1455
+ }
1456
+ }
1333
1457
  /** Read one session's bounded LiveKit connection history. Requires `usage:read`. */
1334
1458
  async getConnectionHistory(sessionId) {
1335
1459
  if (!sessionId) throw new RealtimeAvatarError("sessionId is required");
@@ -1391,6 +1515,22 @@ var RealtimeAvatar = class {
1391
1515
  }
1392
1516
  throw new RealtimeAvatarHttpError(response.status, code, text, response.headers.get("x-request-id") ?? void 0);
1393
1517
  }
1518
+ /**
1519
+ * A 2xx body validated against its contract schema. A mismatch, malformed JSON included,
1520
+ * throws one fixed message with no cause, so the rejected body never reaches a log.
1521
+ */
1522
+ async #contract(response, schema, mismatch) {
1523
+ let raw;
1524
+ try {
1525
+ raw = await this.#json(response);
1526
+ } catch (error) {
1527
+ if (error instanceof SyntaxError) throw new RealtimeAvatarError(mismatch);
1528
+ throw error;
1529
+ }
1530
+ const parsed = schema.safeParse(raw);
1531
+ if (!parsed.success) throw new RealtimeAvatarError(mismatch);
1532
+ return parsed.data;
1533
+ }
1394
1534
  };
1395
1535
  function isRecord(value) {
1396
1536
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -1519,4 +1659,4 @@ function isQueued(result) {
1519
1659
  return "queued" in result;
1520
1660
  }
1521
1661
 
1522
- export { DEFAULT_FISH_TTS_MODEL, ROUTE_TIMEOUT_MS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, liveKitSessionReleaseReasonSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, sessionModeSchema, verifyTranscript, verifyVoiceWebhook };
1662
+ export { DEFAULT_FISH_TTS_MODEL, ROUTE_TIMEOUT_MS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionReleaseReasonSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, sessionModeSchema, verifyTranscript, verifyVoiceWebhook };
@@ -1,4 +1,4 @@
1
- import { sessionModeSchema, liveKitSessionReleaseReasonSchema, RealtimeAvatar, ROUTE_TIMEOUT_MS, isQueued, RealtimeAvatarHttpError, RealtimeAvatarError } from './chunk-WXVBPMDN.js';
1
+ import { sessionModeSchema, liveKitSessionReleaseReasonSchema, RealtimeAvatar, ROUTE_TIMEOUT_MS, isQueued, RealtimeAvatarHttpError, RealtimeAvatarError } from './chunk-LRGQKZFB.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  // ../http-client/src/generated/error-semantics.ts
package/dist/express.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-CgAEmIVE.js';
2
- import './types-Bv29uEAs.js';
1
+ import { P as ProxyConfig } from './types-Du6T6XQB.js';
2
+ import './types-DOFXGl7G.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-GLIEEJMW.js';
2
- import './chunk-WXVBPMDN.js';
1
+ import { createProxyHandler } from './chunk-TJM53JXR.js';
2
+ import './chunk-LRGQKZFB.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-CgAEmIVE.js';
2
- import './types-Bv29uEAs.js';
1
+ import { P as ProxyConfig } from './types-Du6T6XQB.js';
2
+ import './types-DOFXGl7G.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/hono.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-GLIEEJMW.js';
2
- import './chunk-WXVBPMDN.js';
1
+ import { createProxyHandler } from './chunk-TJM53JXR.js';
2
+ import './chunk-LRGQKZFB.js';
3
3
  import './chunk-MCIXU6XP.js';
4
4
 
5
5
  // ../proxy/src/hono.ts
package/dist/index.d.ts CHANGED
@@ -1,8 +1,146 @@
1
- import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as AvatarUpdate, c as AvatarSourceSwap, d as ClipLibraryDeclaration, e as ClipLibraryUpdate, L as LoopRedirect, f as ClipLibrary, g as AssetKind, h as Asset, i as ListSessionsOptions, U as UsageSessionPage, j as UsageSession, k as ListRecordingsQuery, l as ListRecordingsResponse, R as RecordingArtifact, m as RecordingAccessResponse, n as CreditBalance, T as TranscriptPayload, V as VoiceWebhookRequest } from './types-Bv29uEAs.js';
2
- export { o as AvatarClip, p as CallConnection, q as CallQueued, r as ClipDeclaration, s as ClipLibraryPlan, t as ClipSource, u as ContextMessage, v as EndCallReason, w as ExternalLlm, x as RecordingArtifactStatus, y as RecordingMode, z as VideoPolicy, B as VoiceWebhook, D as VoiceWebhookErrorCode, F as isQueued, G as listRecordingsResponseSchema, H as recordingAccessResponseSchema, I as recordingArtifactSchema, J as recordingModeSchema } from './types-Bv29uEAs.js';
1
+ import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as AvatarUpdate, c as AvatarSourceSwap, d as ClipLibraryDeclaration, e as ClipLibraryUpdate, L as LoopRedirect, f as ClipLibrary, g as AssetKind, h as Asset, i as ListSessionsOptions, U as UsageSessionPage, j as UsageSession, k as ListRecordingsQuery, l as ListRecordingsResponse, R as RecordingArtifact, m as RecordingAccessResponse, n as CreateRenderInput, o as CreditBalance, T as TranscriptPayload, V as VoiceWebhookRequest } from './types-DOFXGl7G.js';
2
+ export { p as AvatarClip, q as CallConnection, r as CallQueued, s as ClipDeclaration, t as ClipLibraryPlan, u as ClipSource, v as ContextMessage, w as EndCallReason, x as ExternalLlm, y as RecordingArtifactStatus, z as RecordingMode, B as RenderShot, D as VideoPolicy, F as VoiceWebhook, G as VoiceWebhookErrorCode, H as isQueued, I as listRecordingsResponseSchema, J as recordingAccessResponseSchema, K as recordingArtifactSchema, M as recordingModeSchema } from './types-DOFXGl7G.js';
3
3
  import { ConnectionHistoryResponse } from './connection-history.js';
4
4
  import { z } from 'zod';
5
5
 
6
+ /** The caller-tunable timing of a `waitFor*` poll loop. */
7
+ type PollOptions = {
8
+ timeoutMs?: number;
9
+ pollMs?: number;
10
+ };
11
+
12
+ declare const renderStatusSchema: z.ZodEnum<{
13
+ ready: "ready";
14
+ failed: "failed";
15
+ queued: "queued";
16
+ rendering: "rendering";
17
+ }>;
18
+ type RenderStatus = z.infer<typeof renderStatusSchema>;
19
+ declare const renderFailureCodeSchema: z.ZodEnum<{
20
+ asset_unavailable: "asset_unavailable";
21
+ tts_failed: "tts_failed";
22
+ too_long: "too_long";
23
+ render_failed: "render_failed";
24
+ }>;
25
+ type RenderFailureCode = z.infer<typeof renderFailureCodeSchema>;
26
+ declare const renderPlaybackSchema: z.ZodEnum<{
27
+ once: "once";
28
+ loop: "loop";
29
+ }>;
30
+ type RenderPlayback = z.infer<typeof renderPlaybackSchema>;
31
+ /** Where one shot landed in the video. Every time is milliseconds from the start of the video. */
32
+ declare const shotTimingSchema: z.ZodObject<{
33
+ index: z.ZodNumber;
34
+ startMs: z.ZodNumber;
35
+ endMs: z.ZodNumber;
36
+ clipId: z.ZodString;
37
+ playback: z.ZodEnum<{
38
+ once: "once";
39
+ loop: "loop";
40
+ }>;
41
+ speechStartMs: z.ZodNullable<z.ZodNumber>;
42
+ speechEndMs: z.ZodNullable<z.ZodNumber>;
43
+ clipEndMs: z.ZodNullable<z.ZodNumber>;
44
+ afterClipId: z.ZodNullable<z.ZodString>;
45
+ }, z.core.$strict>;
46
+ type ShotTiming = z.infer<typeof shotTimingSchema>;
47
+ declare const renderSchema: z.ZodObject<{
48
+ id: z.ZodString;
49
+ object: z.ZodLiteral<"render">;
50
+ status: z.ZodEnum<{
51
+ ready: "ready";
52
+ failed: "failed";
53
+ queued: "queued";
54
+ rendering: "rendering";
55
+ }>;
56
+ avatarId: z.ZodString;
57
+ voiceId: z.ZodNullable<z.ZodString>;
58
+ durationMs: z.ZodNullable<z.ZodNumber>;
59
+ width: z.ZodNullable<z.ZodNumber>;
60
+ height: z.ZodNullable<z.ZodNumber>;
61
+ timeline: z.ZodNullable<z.ZodArray<z.ZodObject<{
62
+ index: z.ZodNumber;
63
+ startMs: z.ZodNumber;
64
+ endMs: z.ZodNumber;
65
+ clipId: z.ZodString;
66
+ playback: z.ZodEnum<{
67
+ once: "once";
68
+ loop: "loop";
69
+ }>;
70
+ speechStartMs: z.ZodNullable<z.ZodNumber>;
71
+ speechEndMs: z.ZodNullable<z.ZodNumber>;
72
+ clipEndMs: z.ZodNullable<z.ZodNumber>;
73
+ afterClipId: z.ZodNullable<z.ZodString>;
74
+ }, z.core.$strict>>>;
75
+ error: z.ZodNullable<z.ZodObject<{
76
+ code: z.ZodEnum<{
77
+ asset_unavailable: "asset_unavailable";
78
+ tts_failed: "tts_failed";
79
+ too_long: "too_long";
80
+ render_failed: "render_failed";
81
+ }>;
82
+ message: z.ZodString;
83
+ }, z.core.$strict>>;
84
+ createdAt: z.ZodString;
85
+ completedAt: z.ZodNullable<z.ZodString>;
86
+ }, z.core.$strict>;
87
+ type Render = z.infer<typeof renderSchema>;
88
+ declare const listRendersQuerySchema: z.ZodObject<{
89
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
90
+ cursor: z.ZodOptional<z.ZodString>;
91
+ }, z.core.$strict>;
92
+ type ListRendersQuery = Partial<z.infer<typeof listRendersQuerySchema>>;
93
+ declare const listRendersResponseSchema: z.ZodObject<{
94
+ data: z.ZodArray<z.ZodObject<{
95
+ id: z.ZodString;
96
+ object: z.ZodLiteral<"render">;
97
+ status: z.ZodEnum<{
98
+ ready: "ready";
99
+ failed: "failed";
100
+ queued: "queued";
101
+ rendering: "rendering";
102
+ }>;
103
+ avatarId: z.ZodString;
104
+ voiceId: z.ZodNullable<z.ZodString>;
105
+ durationMs: z.ZodNullable<z.ZodNumber>;
106
+ width: z.ZodNullable<z.ZodNumber>;
107
+ height: z.ZodNullable<z.ZodNumber>;
108
+ timeline: z.ZodNullable<z.ZodArray<z.ZodObject<{
109
+ index: z.ZodNumber;
110
+ startMs: z.ZodNumber;
111
+ endMs: z.ZodNumber;
112
+ clipId: z.ZodString;
113
+ playback: z.ZodEnum<{
114
+ once: "once";
115
+ loop: "loop";
116
+ }>;
117
+ speechStartMs: z.ZodNullable<z.ZodNumber>;
118
+ speechEndMs: z.ZodNullable<z.ZodNumber>;
119
+ clipEndMs: z.ZodNullable<z.ZodNumber>;
120
+ afterClipId: z.ZodNullable<z.ZodString>;
121
+ }, z.core.$strict>>>;
122
+ error: z.ZodNullable<z.ZodObject<{
123
+ code: z.ZodEnum<{
124
+ asset_unavailable: "asset_unavailable";
125
+ tts_failed: "tts_failed";
126
+ too_long: "too_long";
127
+ render_failed: "render_failed";
128
+ }>;
129
+ message: z.ZodString;
130
+ }, z.core.$strict>>;
131
+ createdAt: z.ZodString;
132
+ completedAt: z.ZodNullable<z.ZodString>;
133
+ }, z.core.$strict>>;
134
+ nextCursor: z.ZodNullable<z.ZodString>;
135
+ }, z.core.$strict>;
136
+ type ListRendersResponse = z.infer<typeof listRendersResponseSchema>;
137
+ declare const renderAccessResponseSchema: z.ZodObject<{
138
+ id: z.ZodString;
139
+ url: z.ZodString;
140
+ expiresAt: z.ZodString;
141
+ }, z.core.$strict>;
142
+ type RenderAccessResponse = z.infer<typeof renderAccessResponseSchema>;
143
+
6
144
  interface RealtimeAvatarOptions {
7
145
  /** `tic_live_…` or `tic_test_…`. Server-side only — never ship this to a browser. */
8
146
  apiKey: string;
@@ -232,10 +370,7 @@ declare class RealtimeAvatar {
232
370
  * Resolves with the settled avatar — `sourceAssetId` is now the new loop. Throws on a
233
371
  * failed render and on timeout; a timeout is not a failure, so re-poll or call again.
234
372
  */
235
- waitForLoop(avatarId: string, options?: {
236
- timeoutMs?: number;
237
- pollMs?: number;
238
- }): Promise<Avatar>;
373
+ waitForLoop(avatarId: string, options?: PollOptions): Promise<Avatar>;
239
374
  /**
240
375
  * Block until every clip in the library has stopped moving.
241
376
  *
@@ -247,10 +382,7 @@ declare class RealtimeAvatar {
247
382
  *
248
383
  * Throws only on timeout.
249
384
  */
250
- waitForClips(avatarId: string, options?: {
251
- timeoutMs?: number;
252
- pollMs?: number;
253
- }): Promise<ClipLibrary>;
385
+ waitForClips(avatarId: string, options?: PollOptions): Promise<ClipLibrary>;
254
386
  /** The avatar's clip library: every non-retired clip, plus revision, anchor and eligibility. */
255
387
  listClips(avatarId: string): Promise<ClipLibrary>;
256
388
  /** Hand us a URL and we stream it into storage. Prefer this for anything large. */
@@ -297,6 +429,39 @@ declare class RealtimeAvatar {
297
429
  getRecording(recordingId: string): Promise<RecordingArtifact>;
298
430
  /** Renewable playback access. Keep recordingId in storage; URLs expire at expiresAt. */
299
431
  getRecordingAccess(recordingId: string): Promise<RecordingAccessResponse>;
432
+ /**
433
+ * Render an MP4 of the avatar performing a script of `shots`, offline, with no live call.
434
+ * Everything in one shot happens at the same time; shots play one after another. Requires
435
+ * `renders:write`, which a new key does not carry unless you tick it.
436
+ *
437
+ * `202` is acceptance: the render is `queued`, and `waitForRender` follows it to the end.
438
+ * Every `clipId` must be a READY clip of this avatar or `"primary"`, or the request is refused
439
+ * with `422 render_clip_unavailable` before anything is charged. The retry carries the same
440
+ * `Idempotency-Key`, so a lost response never starts, or bills, a second render.
441
+ */
442
+ createRender(input: CreateRenderInput): Promise<Render>;
443
+ /** One render's status. Requires `renders:read`. */
444
+ getRender(renderId: string): Promise<Render>;
445
+ /** This workspace's renders, newest first, one page. Requires `renders:read`. */
446
+ listRenders(options?: ListRendersQuery): Promise<ListRendersResponse>;
447
+ /** Every render, following `nextCursor` for you. */
448
+ iterateRenders(options?: ListRendersQuery): AsyncGenerator<Render>;
449
+ /**
450
+ * A signed download URL for a ready render. It expires at `expiresAt` (an hour); keep the
451
+ * render id and ask again rather than storing the URL. `409 render_not_ready` before the
452
+ * render is ready, `410 render_gone` if the file is no longer stored.
453
+ */
454
+ getRenderAccess(renderId: string): Promise<RenderAccessResponse>;
455
+ /**
456
+ * Block until a render settles, and return it: `ready` with its `timeline`, or `failed` with
457
+ * `error.code`.
458
+ *
459
+ * A failed render is returned, not thrown, so its code stays a typed value you can branch on
460
+ * (`too_long` means shorten the script; `tts_failed` and `render_failed` are worth one retry).
461
+ * Throws only on timeout, which is not a failure: the render may still land, so poll again.
462
+ * The default timeout is 30 minutes, the platform's own budget for one render.
463
+ */
464
+ waitForRender(renderId: string, options?: PollOptions): Promise<Render>;
300
465
  /** Read one session's bounded LiveKit connection history. Requires `usage:read`. */
301
466
  getConnectionHistory(sessionId: string): Promise<ConnectionHistoryResponse>;
302
467
  creditBalance(): Promise<CreditBalance>;
@@ -341,8 +506,13 @@ declare class RealtimeAvatarWebhookError extends RealtimeAvatarError {
341
506
  * | `loop_pending` · `anchor_pending` | 409 | one is already in flight — wait, then retry |
342
507
  * | `revision_conflict` | 409 | someone declared first. Re-read `listClips`, re-decide, re-declare |
343
508
  * | `clip_render_limit` | 429 | a true rate limit; nothing was applied. Retry later |
344
- * | `concurrency_limit_reached` | 429 | active and starting sessions occupy the limit; release one or wait for pending starts before retrying |
509
+ * | `concurrency_limit_reached` | 429 | active and starting sessions occupy the limit; release one or wait for pending starts before retrying. From `createRender`: the workspace already has 4 renders queued or rendering; retry when one settles |
345
510
  * | `clip_screen_unavailable` | 503 | the prose screen could not run. Retry |
511
+ * | `render_clip_unavailable` | 422 | a shot's `clipId` is neither a ready clip of that avatar nor `"primary"`. `waitForClips`, then render |
512
+ * | `render_not_ready` | 409 | `getRenderAccess` before the render is `ready`. `waitForRender` first |
513
+ * | `render_too_long` | 400 | the shots are estimated to make a video longer than 180 seconds; nothing was held. Shorten the script |
514
+ * | `render_export_unavailable` | 503 | pre-rendered video is not switched on for this deployment; nothing was charged, and retrying will not help |
515
+ * | `render_start_failed` | 503 | the render was created but could not be started; retry (the SDK already has). That attempt stays in `listRenders` as a `failed` render, not charged |
346
516
  *
347
517
  * Pose validation does NOT appear here: a rejected upload is not an error response at all.
348
518
  * The declaration is accepted, and that clip settles `status: "failed"` with the verdict in
@@ -436,4 +606,4 @@ declare const fishTtsModelSchema: z.ZodUnion<readonly [z.ZodEnum<{
436
606
  type FishTtsModel = z.infer<typeof fishTtsModelSchema>;
437
607
  declare const DEFAULT_FISH_TTS_MODEL: "s2.1-pro";
438
608
 
439
- export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreditBalance, DEFAULT_FISH_TTS_MODEL, EndCallOptions, type FishTtsModel, ListRecordingsQuery, ListRecordingsResponse, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, RealtimeAvatarWebhookError, RecordingAccessResponse, RecordingArtifact, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, VoiceWebhookRequest, type WebhookVerificationErrorCode, clipLibraryDeclarationSchema, fishTtsModelSchema, verifyTranscript, verifyVoiceWebhook };
609
+ export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreateRenderInput, CreditBalance, DEFAULT_FISH_TTS_MODEL, EndCallOptions, type FishTtsModel, ListRecordingsQuery, ListRecordingsResponse, type ListRendersQuery, type ListRendersResponse, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, RealtimeAvatarWebhookError, RecordingAccessResponse, RecordingArtifact, type Render, type RenderAccessResponse, type RenderFailureCode, type RenderPlayback, type RenderStatus, type ShotTiming, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, VoiceWebhookRequest, type WebhookVerificationErrorCode, clipLibraryDeclarationSchema, fishTtsModelSchema, listRendersResponseSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { DEFAULT_FISH_TTS_MODEL, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-WXVBPMDN.js';
1
+ export { DEFAULT_FISH_TTS_MODEL, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-LRGQKZFB.js';
2
2
  import './chunk-MCIXU6XP.js';
package/dist/nextjs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-CgAEmIVE.js';
2
- import './types-Bv29uEAs.js';
1
+ import { P as ProxyConfig } from './types-Du6T6XQB.js';
2
+ import './types-DOFXGl7G.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/nextjs.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-GLIEEJMW.js';
2
- import './chunk-WXVBPMDN.js';
1
+ import { createProxyHandler } from './chunk-TJM53JXR.js';
2
+ import './chunk-LRGQKZFB.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
- export { DEFAULT_FISH_TTS_MODEL, FishTtsModel, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarOptions, RealtimeAvatarWebhookError, StartCallOptions, WebhookVerificationErrorCode, clipLibraryDeclarationSchema, fishTtsModelSchema, verifyTranscript, verifyVoiceWebhook } from './index.js';
2
- export { h as Asset, g as AssetKind, A as Avatar, o as AvatarClip, c as AvatarSourceSwap, b as AvatarUpdate, p as CallConnection, C as CallMode, a as CallPolicy, q as CallQueued, r as ClipDeclaration, f as ClipLibrary, d as ClipLibraryDeclaration, s as ClipLibraryPlan, e as ClipLibraryUpdate, t as ClipSource, u as ContextMessage, n as CreditBalance, E as EndCallOptions, v as EndCallReason, w as ExternalLlm, k as ListRecordingsQuery, l as ListRecordingsResponse, i as ListSessionsOptions, L as LoopRedirect, m as RecordingAccessResponse, R as RecordingArtifact, x as RecordingArtifactStatus, y as RecordingMode, S as StartCallResult, T as TranscriptPayload, j as UsageSession, U as UsageSessionPage, z as VideoPolicy, B as VoiceWebhook, D as VoiceWebhookErrorCode, V as VoiceWebhookRequest, F as isQueued, G as listRecordingsResponseSchema, H as recordingAccessResponseSchema, I as recordingArtifactSchema, J as recordingModeSchema } from './types-Bv29uEAs.js';
1
+ export { DEFAULT_FISH_TTS_MODEL, FishTtsModel, ListRendersQuery, ListRendersResponse, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarOptions, RealtimeAvatarWebhookError, Render, RenderAccessResponse, RenderFailureCode, RenderPlayback, RenderStatus, ShotTiming, StartCallOptions, WebhookVerificationErrorCode, clipLibraryDeclarationSchema, fishTtsModelSchema, listRendersResponseSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './index.js';
2
+ export { h as Asset, g as AssetKind, A as Avatar, p as AvatarClip, c as AvatarSourceSwap, b as AvatarUpdate, q as CallConnection, C as CallMode, a as CallPolicy, r as CallQueued, s as ClipDeclaration, f as ClipLibrary, d as ClipLibraryDeclaration, t as ClipLibraryPlan, e as ClipLibraryUpdate, u as ClipSource, v as ContextMessage, n as CreateRenderInput, o as CreditBalance, E as EndCallOptions, w as EndCallReason, x as ExternalLlm, k as ListRecordingsQuery, l as ListRecordingsResponse, i as ListSessionsOptions, L as LoopRedirect, m as RecordingAccessResponse, R as RecordingArtifact, y as RecordingArtifactStatus, z as RecordingMode, B as RenderShot, S as StartCallResult, T as TranscriptPayload, j as UsageSession, U as UsageSessionPage, D as VideoPolicy, F as VoiceWebhook, G as VoiceWebhookErrorCode, V as VoiceWebhookRequest, H as isQueued, I as listRecordingsResponseSchema, J as recordingAccessResponseSchema, K as recordingArtifactSchema, M as recordingModeSchema } from './types-DOFXGl7G.js';
3
3
  import './connection-history.js';
4
4
  import 'zod';
package/dist/server.js CHANGED
@@ -1,2 +1,2 @@
1
- export { DEFAULT_FISH_TTS_MODEL, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-WXVBPMDN.js';
1
+ export { DEFAULT_FISH_TTS_MODEL, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-LRGQKZFB.js';
2
2
  import './chunk-MCIXU6XP.js';
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-CgAEmIVE.js';
2
- import './types-Bv29uEAs.js';
1
+ import { P as ProxyConfig } from './types-Du6T6XQB.js';
2
+ import './types-DOFXGl7G.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-GLIEEJMW.js';
2
- import './chunk-WXVBPMDN.js';
1
+ import { createProxyHandler } from './chunk-TJM53JXR.js';
2
+ import './chunk-LRGQKZFB.js';
3
3
  import './chunk-MCIXU6XP.js';
4
4
 
5
5
  // src/tanstack-start.ts
@@ -217,6 +217,8 @@ interface components {
217
217
  total_frames?: number;
218
218
  /** @description Preview. Set when this scene is a first clip alone: the joined scene (the same first clip plus its continuation) that this workspace prepares after the mint may then be attached to the live call. Linking needs the first clip's md5 and bytes declared on both prepares. Absent or false plays this scene for the whole call. */
219
219
  attach_continuation?: boolean;
220
+ /** @description Preview, opt-in. Lets the minting server switch this scene session to another ready scene it owns mid-call, without a new session. Requires extend_secret to sign replace_scene commands. Absent or false plays this scene for the whole call. */
221
+ replaceable?: boolean;
220
222
  };
221
223
  };
222
224
  LiveKitSessionGrant: {
@@ -836,7 +838,7 @@ interface components {
836
838
  * "avatars:read"
837
839
  * ]
838
840
  */
839
- scopes: ("*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write")[];
841
+ scopes: ("*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write" | "renders:read" | "renders:write")[];
840
842
  spendLimitCreditMicros?: number | null;
841
843
  expiresAt?: string | null;
842
844
  };
@@ -848,7 +850,7 @@ interface components {
848
850
  redactedKey: string;
849
851
  /** @default false */
850
852
  canReveal: boolean;
851
- scopes: ("*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write")[];
853
+ scopes: ("*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write" | "renders:read" | "renders:write")[];
852
854
  /** @enum {string} */
853
855
  status: "active" | "revoked" | "expired";
854
856
  spendLimitCreditMicros: number | null;
@@ -1230,6 +1232,158 @@ interface components {
1230
1232
  /** Format: date-time */
1231
1233
  expiresAt: string;
1232
1234
  };
1235
+ CreateRenderRequest: {
1236
+ avatarId: string;
1237
+ /** @description A voice from your workspace's voice library. Omit voice and voiceId to use the avatar's own voice. */
1238
+ voiceId?: string;
1239
+ /** @description An inline Fish voice, the same object a live call takes as voice. Only a Fish voice can render; any other provider is refused with 422 voice_unavailable. Send voice or voiceId, not both. */
1240
+ voice?: {
1241
+ /** @constant */
1242
+ provider: "cartesia";
1243
+ /**
1244
+ * @default cartesia/sonic-3
1245
+ * @enum {string}
1246
+ */
1247
+ model: "cartesia/sonic-2" | "cartesia/sonic-2-latest" | "cartesia/sonic-3" | "cartesia/sonic-3-latest" | "cartesia/sonic-turbo" | "cartesia/sonic-turbo-latest";
1248
+ voice_id: string;
1249
+ speed?: number | null;
1250
+ emotion?: string | null;
1251
+ language?: string | null;
1252
+ } | {
1253
+ /** @constant */
1254
+ provider: "breezeblue";
1255
+ /** @default bluebell-v1-en */
1256
+ model: string;
1257
+ voice_id: string;
1258
+ guidance_scale?: number | null;
1259
+ instructions?: string | null;
1260
+ language?: string | null;
1261
+ } | {
1262
+ /** @constant */
1263
+ provider: "fish";
1264
+ /** @default s2.1-pro */
1265
+ model: ("s1" | "s2-pro" | "s2.1-pro" | "drama-3") | ("speech-1.6" | "speech-1.5" | "s1-mini");
1266
+ voice_id: string;
1267
+ speed?: number | null;
1268
+ emotion?: string | null;
1269
+ language?: string | null;
1270
+ };
1271
+ /** @description Mouth-motion amplitude, as on a live call (lip_gain). Omit it for the platform default. */
1272
+ lipGain?: number;
1273
+ /** @description The script: 1 to 50 shots, played one after another. At least one shot says something; at most 4,000 characters of say in total and 16 different clips besides "primary". */
1274
+ shots: {
1275
+ /** @description What she does: a ready clip from the avatar's clip library, or "primary" for the avatar's own video. Omit it to keep the current loop clip. A clip loops if it is "primary" or in the avatar's idle pool (behavior.idle.clips in the avatar's clip list); every other clip plays once. */
1276
+ clipId?: string;
1277
+ /** @description What she says, 1 to 1,000 characters. Speech starts when the shot starts. */
1278
+ say?: string;
1279
+ /** @description How long she stays silent after speaking, 0 to 10,000 ms. Default 0. */
1280
+ pauseAfterMs?: number;
1281
+ }[];
1282
+ };
1283
+ Render: {
1284
+ id: string;
1285
+ /** @constant */
1286
+ object: "render";
1287
+ /** @enum {string} */
1288
+ status: "queued" | "rendering" | "ready" | "failed";
1289
+ avatarId: string;
1290
+ /** @description The library voice the render speaks with: the voiceId you sent, else the avatar's own voice. Null when it speaks with the inline voice you sent. */
1291
+ voiceId: string | null;
1292
+ /** @description Length of the rendered video. Set once status is ready. */
1293
+ durationMs: number | null;
1294
+ width: number | null;
1295
+ height: number | null;
1296
+ /** @description One entry per shot, in order. Set once status is ready. */
1297
+ timeline: {
1298
+ /** @description The shot's position in your shots list, from 0. */
1299
+ index: number;
1300
+ /** @description When the shot starts. */
1301
+ startMs: number;
1302
+ /** @description When the shot ends; the next shot starts here. */
1303
+ endMs: number;
1304
+ /** @description The clip the shot played: the one you named, else the loop clip it kept, else "primary". */
1305
+ clipId: string;
1306
+ /**
1307
+ * @description once: the clip's action played one time. loop: the clip filled the shot.
1308
+ * @enum {string}
1309
+ */
1310
+ playback: "once" | "loop";
1311
+ /** @description When she starts speaking. Null when the shot has no say. */
1312
+ speechStartMs: number | null;
1313
+ /** @description When she stops speaking. Null when the shot has no say. */
1314
+ speechEndMs: number | null;
1315
+ /** @description When the action finished. Once clips only; null for a loop clip. */
1316
+ clipEndMs: number | null;
1317
+ /** @description The loop clip shown after the action finished, when the shot outlasts it. Once clips only; otherwise null. */
1318
+ afterClipId: string | null;
1319
+ }[] | null;
1320
+ /** @description Set only when status is failed. */
1321
+ error: {
1322
+ /** @enum {string} */
1323
+ code: "asset_unavailable" | "tts_failed" | "too_long" | "render_failed";
1324
+ message: string;
1325
+ } | null;
1326
+ /** Format: date-time */
1327
+ createdAt: string;
1328
+ completedAt: string | null;
1329
+ };
1330
+ ListRendersResponse: {
1331
+ data: {
1332
+ id: string;
1333
+ /** @constant */
1334
+ object: "render";
1335
+ /** @enum {string} */
1336
+ status: "queued" | "rendering" | "ready" | "failed";
1337
+ avatarId: string;
1338
+ /** @description The library voice the render speaks with: the voiceId you sent, else the avatar's own voice. Null when it speaks with the inline voice you sent. */
1339
+ voiceId: string | null;
1340
+ /** @description Length of the rendered video. Set once status is ready. */
1341
+ durationMs: number | null;
1342
+ width: number | null;
1343
+ height: number | null;
1344
+ /** @description One entry per shot, in order. Set once status is ready. */
1345
+ timeline: {
1346
+ /** @description The shot's position in your shots list, from 0. */
1347
+ index: number;
1348
+ /** @description When the shot starts. */
1349
+ startMs: number;
1350
+ /** @description When the shot ends; the next shot starts here. */
1351
+ endMs: number;
1352
+ /** @description The clip the shot played: the one you named, else the loop clip it kept, else "primary". */
1353
+ clipId: string;
1354
+ /**
1355
+ * @description once: the clip's action played one time. loop: the clip filled the shot.
1356
+ * @enum {string}
1357
+ */
1358
+ playback: "once" | "loop";
1359
+ /** @description When she starts speaking. Null when the shot has no say. */
1360
+ speechStartMs: number | null;
1361
+ /** @description When she stops speaking. Null when the shot has no say. */
1362
+ speechEndMs: number | null;
1363
+ /** @description When the action finished. Once clips only; null for a loop clip. */
1364
+ clipEndMs: number | null;
1365
+ /** @description The loop clip shown after the action finished, when the shot outlasts it. Once clips only; otherwise null. */
1366
+ afterClipId: string | null;
1367
+ }[] | null;
1368
+ /** @description Set only when status is failed. */
1369
+ error: {
1370
+ /** @enum {string} */
1371
+ code: "asset_unavailable" | "tts_failed" | "too_long" | "render_failed";
1372
+ message: string;
1373
+ } | null;
1374
+ /** Format: date-time */
1375
+ createdAt: string;
1376
+ completedAt: string | null;
1377
+ }[];
1378
+ nextCursor: string | null;
1379
+ };
1380
+ RenderAccessResponse: {
1381
+ id: string;
1382
+ /** Format: uri */
1383
+ url: string;
1384
+ /** Format: date-time */
1385
+ expiresAt: string;
1386
+ };
1233
1387
  ConnectionHistoryResponse: {
1234
1388
  sessionId: string;
1235
1389
  observations: {
@@ -1476,9 +1630,9 @@ interface components {
1476
1630
  * @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=`.
1477
1631
  * @enum {string}
1478
1632
  */
1479
- requiredScope?: "*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write";
1633
+ requiredScope?: "*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write" | "renders:read" | "renders:write";
1480
1634
  /** @description Present alongside `requiredScope` — the scopes the presented key does carry. */
1481
- grantedScopes?: ("*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write")[];
1635
+ grantedScopes?: ("*" | "api_keys:write" | "credits:read" | "avatars:read" | "avatars:write" | "realtime:write" | "usage:read" | "recordings:read" | "usage:write" | "speech:write" | "renders:read" | "renders:write")[];
1482
1636
  /** @description Present on 402 — where to send the user to top up. */
1483
1637
  billingUrl?: string;
1484
1638
  /** @description On concurrency_limit_reached: the workspace's concurrent session limit. */
@@ -2861,6 +3015,336 @@ interface operations {
2861
3015
  };
2862
3016
  };
2863
3017
  };
3018
+ listRenders: {
3019
+ parameters: {
3020
+ query?: {
3021
+ limit?: number;
3022
+ /** @description The previous response's nextCursor. */
3023
+ cursor?: string;
3024
+ };
3025
+ header?: never;
3026
+ path?: never;
3027
+ cookie?: never;
3028
+ };
3029
+ requestBody?: never;
3030
+ responses: {
3031
+ /** @description Renders */
3032
+ 200: {
3033
+ headers: {
3034
+ [name: string]: unknown;
3035
+ };
3036
+ content: {
3037
+ "application/json": components["schemas"]["ListRendersResponse"];
3038
+ };
3039
+ };
3040
+ /** @description Invalid query */
3041
+ 400: {
3042
+ headers: {
3043
+ [name: string]: unknown;
3044
+ };
3045
+ content: {
3046
+ "application/json": components["schemas"]["Error"];
3047
+ };
3048
+ };
3049
+ /** @description Missing, malformed, revoked, or expired key. */
3050
+ 401: {
3051
+ headers: {
3052
+ [name: string]: unknown;
3053
+ };
3054
+ content: {
3055
+ "application/json": components["schemas"]["Error"];
3056
+ };
3057
+ };
3058
+ /** @description The key lacks the scope for this operation, or the tenant is not active. */
3059
+ 403: {
3060
+ headers: {
3061
+ [name: string]: unknown;
3062
+ };
3063
+ content: {
3064
+ "application/json": components["schemas"]["Error"];
3065
+ };
3066
+ };
3067
+ /** @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`. */
3068
+ default: {
3069
+ headers: {
3070
+ [name: string]: unknown;
3071
+ };
3072
+ content: {
3073
+ "application/json": components["schemas"]["Error"];
3074
+ };
3075
+ };
3076
+ };
3077
+ };
3078
+ createRender: {
3079
+ parameters: {
3080
+ query?: never;
3081
+ header?: {
3082
+ /** @description Replays the original response byte-for-byte instead of performing the write again. Recommended on retries: a re-render is billed. Keys longer than 180 characters are IGNORED — the write proceeds without replay protection rather than failing — so keep it short. */
3083
+ "Idempotency-Key"?: string;
3084
+ };
3085
+ path?: never;
3086
+ cookie?: never;
3087
+ };
3088
+ requestBody: {
3089
+ content: {
3090
+ /**
3091
+ * @example {
3092
+ * "avatarId": "ava_0123456789abcdef0123456789abcdef",
3093
+ * "shots": [
3094
+ * {
3095
+ * "clipId": "gesture_send_flower",
3096
+ * "say": "你终于来了。今天……我有话想对你说。"
3097
+ * },
3098
+ * {
3099
+ * "clipId": "idle_touch_collar",
3100
+ * "say": "别笑,我是认真的。",
3101
+ * "pauseAfterMs": 800
3102
+ * },
3103
+ * {
3104
+ * "say": "所以,今晚留下来。"
3105
+ * }
3106
+ * ]
3107
+ * }
3108
+ */
3109
+ "application/json": components["schemas"]["CreateRenderRequest"];
3110
+ };
3111
+ };
3112
+ responses: {
3113
+ /** @description Queued */
3114
+ 202: {
3115
+ headers: {
3116
+ [name: string]: unknown;
3117
+ };
3118
+ content: {
3119
+ "application/json": components["schemas"]["Render"];
3120
+ };
3121
+ };
3122
+ /** @description The body is not JSON, or the shots' estimated video is longer than 180 seconds (render_too_long, refused before any credits are held) */
3123
+ 400: {
3124
+ headers: {
3125
+ [name: string]: unknown;
3126
+ };
3127
+ content: {
3128
+ "application/json": components["schemas"]["Error"];
3129
+ };
3130
+ };
3131
+ /** @description Missing, malformed, revoked, or expired key. */
3132
+ 401: {
3133
+ headers: {
3134
+ [name: string]: unknown;
3135
+ };
3136
+ content: {
3137
+ "application/json": components["schemas"]["Error"];
3138
+ };
3139
+ };
3140
+ /** @description Not enough credits for the estimated length, or the key's spend limit is reached */
3141
+ 402: {
3142
+ headers: {
3143
+ [name: string]: unknown;
3144
+ };
3145
+ content: {
3146
+ "application/json": components["schemas"]["Error"];
3147
+ };
3148
+ };
3149
+ /** @description The key lacks the scope for this operation, or the tenant is not active. */
3150
+ 403: {
3151
+ headers: {
3152
+ [name: string]: unknown;
3153
+ };
3154
+ content: {
3155
+ "application/json": components["schemas"]["Error"];
3156
+ };
3157
+ };
3158
+ /** @description Avatar not found in this workspace, or a voiceId it cannot see (voice_not_found) */
3159
+ 404: {
3160
+ headers: {
3161
+ [name: string]: unknown;
3162
+ };
3163
+ content: {
3164
+ "application/json": components["schemas"]["Error"];
3165
+ };
3166
+ };
3167
+ /** @description Invalid script (including voice and voiceId together), an unknown or unready clip (render_clip_unavailable), a voice that cannot be used for video, whether inline, named or the avatar's own (voice_unavailable), or an avatar with no source video */
3168
+ 422: {
3169
+ headers: {
3170
+ [name: string]: unknown;
3171
+ };
3172
+ content: {
3173
+ "application/json": components["schemas"]["Error"];
3174
+ };
3175
+ };
3176
+ /** @description This workspace already has the maximum number of renders queued or rendering (concurrency_limit_reached) */
3177
+ 429: {
3178
+ headers: {
3179
+ [name: string]: unknown;
3180
+ };
3181
+ content: {
3182
+ "application/json": components["schemas"]["Error"];
3183
+ };
3184
+ };
3185
+ /** @description Rendering is not available on this deployment (render_export_unavailable, not retryable), or this render could not be started (render_start_failed, retryable) */
3186
+ 503: {
3187
+ headers: {
3188
+ [name: string]: unknown;
3189
+ };
3190
+ content: {
3191
+ "application/json": components["schemas"]["Error"];
3192
+ };
3193
+ };
3194
+ /** @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`. */
3195
+ default: {
3196
+ headers: {
3197
+ [name: string]: unknown;
3198
+ };
3199
+ content: {
3200
+ "application/json": components["schemas"]["Error"];
3201
+ };
3202
+ };
3203
+ };
3204
+ };
3205
+ getRender: {
3206
+ parameters: {
3207
+ query?: never;
3208
+ header?: never;
3209
+ path: {
3210
+ renderId: string;
3211
+ };
3212
+ cookie?: never;
3213
+ };
3214
+ requestBody?: never;
3215
+ responses: {
3216
+ /** @description Render */
3217
+ 200: {
3218
+ headers: {
3219
+ [name: string]: unknown;
3220
+ };
3221
+ content: {
3222
+ "application/json": components["schemas"]["Render"];
3223
+ };
3224
+ };
3225
+ /** @description Missing, malformed, revoked, or expired key. */
3226
+ 401: {
3227
+ headers: {
3228
+ [name: string]: unknown;
3229
+ };
3230
+ content: {
3231
+ "application/json": components["schemas"]["Error"];
3232
+ };
3233
+ };
3234
+ /** @description The key lacks the scope for this operation, or the tenant is not active. */
3235
+ 403: {
3236
+ headers: {
3237
+ [name: string]: unknown;
3238
+ };
3239
+ content: {
3240
+ "application/json": components["schemas"]["Error"];
3241
+ };
3242
+ };
3243
+ /** @description No render with this id in this workspace (render_not_found) */
3244
+ 404: {
3245
+ headers: {
3246
+ [name: string]: unknown;
3247
+ };
3248
+ content: {
3249
+ "application/json": components["schemas"]["Error"];
3250
+ };
3251
+ };
3252
+ /** @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`. */
3253
+ default: {
3254
+ headers: {
3255
+ [name: string]: unknown;
3256
+ };
3257
+ content: {
3258
+ "application/json": components["schemas"]["Error"];
3259
+ };
3260
+ };
3261
+ };
3262
+ };
3263
+ getRenderAccess: {
3264
+ parameters: {
3265
+ query?: never;
3266
+ header?: never;
3267
+ path: {
3268
+ renderId: string;
3269
+ };
3270
+ cookie?: never;
3271
+ };
3272
+ requestBody?: never;
3273
+ responses: {
3274
+ /** @description Temporary access */
3275
+ 200: {
3276
+ headers: {
3277
+ [name: string]: unknown;
3278
+ };
3279
+ content: {
3280
+ "application/json": components["schemas"]["RenderAccessResponse"];
3281
+ };
3282
+ };
3283
+ /** @description Missing, malformed, revoked, or expired key. */
3284
+ 401: {
3285
+ headers: {
3286
+ [name: string]: unknown;
3287
+ };
3288
+ content: {
3289
+ "application/json": components["schemas"]["Error"];
3290
+ };
3291
+ };
3292
+ /** @description The key lacks the scope for this operation, or the tenant is not active. */
3293
+ 403: {
3294
+ headers: {
3295
+ [name: string]: unknown;
3296
+ };
3297
+ content: {
3298
+ "application/json": components["schemas"]["Error"];
3299
+ };
3300
+ };
3301
+ /** @description No render with this id in this workspace (render_not_found) */
3302
+ 404: {
3303
+ headers: {
3304
+ [name: string]: unknown;
3305
+ };
3306
+ content: {
3307
+ "application/json": components["schemas"]["Error"];
3308
+ };
3309
+ };
3310
+ /** @description The render is not ready (render_not_ready) */
3311
+ 409: {
3312
+ headers: {
3313
+ [name: string]: unknown;
3314
+ };
3315
+ content: {
3316
+ "application/json": components["schemas"]["Error"];
3317
+ };
3318
+ };
3319
+ /** @description The render's video is no longer stored (render_gone) */
3320
+ 410: {
3321
+ headers: {
3322
+ [name: string]: unknown;
3323
+ };
3324
+ content: {
3325
+ "application/json": components["schemas"]["Error"];
3326
+ };
3327
+ };
3328
+ /** @description Render storage temporarily unavailable */
3329
+ 503: {
3330
+ headers: {
3331
+ [name: string]: unknown;
3332
+ };
3333
+ content: {
3334
+ "application/json": components["schemas"]["Error"];
3335
+ };
3336
+ };
3337
+ /** @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`. */
3338
+ default: {
3339
+ headers: {
3340
+ [name: string]: unknown;
3341
+ };
3342
+ content: {
3343
+ "application/json": components["schemas"]["Error"];
3344
+ };
3345
+ };
3346
+ };
3347
+ };
2864
3348
  listUsageSessions: {
2865
3349
  parameters: {
2866
3350
  query?: {
@@ -3748,6 +4232,35 @@ type UsageSessionPage = ReturnType<typeof toSessionsPage>;
3748
4232
  type ListSessionsOptions = NonNullable<operations["listUsageSessions"]["parameters"]["query"]> & {
3749
4233
  speechDiagnostics?: NonNullable<operations["listUsageSessions"]["parameters"]["header"]>["X-RTA-Speech-Diagnostics"] extends "1" | undefined ? boolean : never;
3750
4234
  };
4235
+ type CreateRenderWire = Wire["CreateRenderRequest"];
4236
+ type OptionalModel<V> = V extends {
4237
+ model: unknown;
4238
+ } ? Omit<V, "model"> & Partial<Pick<V, "model">> : V;
4239
+ /**
4240
+ * A pre-rendered video request: the avatar, an optional voice, and the script as `shots`.
4241
+ * Everything in one shot happens at the same time; shots play one after another. The body is
4242
+ * camelCase on the wire too, so it is sent exactly as given, except the inline `voice`, which is
4243
+ * the live call's snake_case voice object (`voice_id`).
4244
+ *
4245
+ * The voice is `voiceId` (a voice from the workspace's voice library), or `voice` (an inline Fish
4246
+ * voice), or neither (the avatar's own). Only a Fish voice renders: an inline voice of another
4247
+ * provider, and an avatar whose own voice is not Fish when neither was sent, are
4248
+ * `422 voice_unavailable`.
4249
+ *
4250
+ * DERIVATION: every field indexes `CreateRenderRequest`; two rules the generator drops are
4251
+ * restated. The published `not: { required: ["voice", "voiceId"] }` (the platform refuses both
4252
+ * with 422) is the either/or union, so sending both fails to compile. And `voice.model` has a
4253
+ * published default that openapi-typescript renders as required; the wire accepts it omitted.
4254
+ */
4255
+ type CreateRenderInput = Omit<CreateRenderWire, "voice" | "voiceId"> & ({
4256
+ voice?: OptionalModel<NonNullable<CreateRenderWire["voice"]>>;
4257
+ voiceId?: never;
4258
+ } | {
4259
+ voice?: never;
4260
+ voiceId?: CreateRenderWire["voiceId"];
4261
+ });
4262
+ /** One shot: `clipId` is what she does, `say` what she says, `pauseAfterMs` the silence after it. */
4263
+ type RenderShot = Wire["CreateRenderRequest"]["shots"][number];
3751
4264
  type CreditBalance = Pick<Wire["CreditBalance"], "balanceCreditMicros" | "reservedCreditMicros">;
3752
4265
  /**
3753
4266
  * Complete desired sources and behavior; expectedRevision protects concurrent edits.
@@ -3833,4 +4346,4 @@ interface TranscriptPayload {
3833
4346
  client_metadata: Record<string, string>;
3834
4347
  }
3835
4348
 
3836
- export { type Avatar as A, type VoiceWebhook as B, type CallMode as C, type VoiceWebhookErrorCode as D, type EndCallOptions as E, isQueued as F, listRecordingsResponseSchema as G, recordingAccessResponseSchema as H, recordingArtifactSchema as I, recordingModeSchema as J, type LoopRedirect as L, type RecordingArtifact as R, type StartCallResult as S, type TranscriptPayload as T, type UsageSessionPage as U, type VoiceWebhookRequest as V, type CallPolicy as a, type AvatarUpdate as b, type AvatarSourceSwap as c, type ClipLibraryDeclaration as d, type ClipLibraryUpdate as e, type ClipLibrary as f, type AssetKind as g, type Asset as h, type ListSessionsOptions as i, type UsageSession as j, type ListRecordingsQuery as k, type ListRecordingsResponse as l, type RecordingAccessResponse as m, type CreditBalance as n, type AvatarClip as o, type CallConnection as p, type CallQueued as q, type ClipDeclaration as r, type ClipLibraryPlan as s, type ClipSource as t, type ContextMessage as u, type EndCallReason as v, type ExternalLlm as w, type RecordingArtifactStatus as x, type RecordingMode as y, type VideoPolicy as z };
4349
+ export { type Avatar as A, type RenderShot as B, type CallMode as C, type VideoPolicy as D, type EndCallOptions as E, type VoiceWebhook as F, type VoiceWebhookErrorCode as G, isQueued as H, listRecordingsResponseSchema as I, recordingAccessResponseSchema as J, recordingArtifactSchema as K, type LoopRedirect as L, recordingModeSchema as M, type RecordingArtifact as R, type StartCallResult as S, type TranscriptPayload as T, type UsageSessionPage as U, type VoiceWebhookRequest as V, type CallPolicy as a, type AvatarUpdate as b, type AvatarSourceSwap as c, type ClipLibraryDeclaration as d, type ClipLibraryUpdate as e, type ClipLibrary as f, type AssetKind as g, type Asset as h, type ListSessionsOptions as i, type UsageSession as j, type ListRecordingsQuery as k, type ListRecordingsResponse as l, type RecordingAccessResponse as m, type CreateRenderInput as n, type CreditBalance as o, type AvatarClip as p, type CallConnection as q, type CallQueued as r, type ClipDeclaration as s, type ClipLibraryPlan as t, type ClipSource as u, type ContextMessage as v, type EndCallReason as w, type ExternalLlm as x, type RecordingArtifactStatus as y, type RecordingMode as z };
@@ -1,4 +1,4 @@
1
- import { C as CallMode, a as CallPolicy } from './types-Bv29uEAs.js';
1
+ import { C as CallMode, a as CallPolicy } from './types-DOFXGl7G.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.30.0",
3
+ "version": "0.31.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",