realtime-avatar 0.33.0 → 0.34.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.
@@ -347,57 +347,65 @@ var renderAccessResponseSchema = z.object({
347
347
  url: z.string().url(),
348
348
  expiresAt: z.string().datetime({ offset: true })
349
349
  }).strict();
350
- var schema02 = z.enum(["s1", "s2-pro", "s2.1-pro", "drama-3"]);
351
- var schema110 = z.enum(["speech-1.6", "speech-1.5", "s1-mini"]);
352
- var schema27 = z.union([schema02, schema110]);
353
- var schema32 = z.enum(["whisper"]);
354
- var schema42 = z.null();
355
- var schema52 = z.union([schema32, schema42]);
356
- var fishTtsModelSchema = schema27;
350
+ var schema02 = z.string().min(1).max(200);
351
+ var schema110 = z.literal(1);
352
+ var schema27 = z.enum(["respond", "recovery", "initiative"]);
353
+ var schema32 = z.string().min(1).max(32);
354
+ var schema42 = z.union([schema27, schema32]);
355
+ var schema52 = z.enum(["draft", "accepted"]);
356
+ var schema62 = z.literal("external");
357
+ var schema72 = z.object({
358
+ "renderer": schema62
359
+ });
360
+ var schema82 = z.object({
361
+ "session_id": schema02,
362
+ "generation_id": schema02,
363
+ "version": schema110,
364
+ "purpose": schema42,
365
+ "admission": schema52,
366
+ "visible_character": schema72.optional()
367
+ });
368
+ var schema92 = z.string().min(1).max(200);
369
+ var schema102 = z.object({
370
+ "generation_id": schema02,
371
+ "utterance_id": schema92
372
+ });
373
+ var schema112 = z.literal("external_performance");
374
+ var schema122 = z.enum(["accepted", "dropped", "cancelled", "audio_released"]);
375
+ var schema132 = z.union([schema122, schema32]);
376
+ var schema142 = z.literal("unavailable");
377
+ var schema152 = z.literal("unavailable");
378
+ var schema162 = z.object({
379
+ "session_id": schema02,
380
+ "generation_id": schema02,
381
+ "kind": schema112,
382
+ "version": schema110,
383
+ "status": schema132,
384
+ "audible_checkpoint": schema142,
385
+ "audio_mapping": schema152
386
+ });
387
+ var externalTurnContextSchema = schema82;
388
+ var externalUtteranceSchema = schema102;
389
+ var externalPerformanceFrameSchema = schema162;
390
+ var schema03 = z.enum(["s1", "s2-pro", "s2.1-pro", "drama-3"]);
391
+ var schema111 = z.enum(["speech-1.6", "speech-1.5", "s1-mini"]);
392
+ var schema28 = z.union([schema03, schema111]);
393
+ var schema33 = z.enum(["whisper"]);
394
+ var schema43 = z.null();
395
+ var schema53 = z.union([schema33, schema43]);
396
+ var fishTtsModelSchema = schema28;
357
397
  var DEFAULT_FISH_TTS_MODEL = "s2.1-pro";
358
- var fishDeliverySchema = schema52;
398
+ var fishDeliverySchema = schema53;
359
399
  var FISH_DELIVERY_MODELS = { "whisper": ["drama-3"] };
360
-
361
- // ../http-client/src/retry.ts
362
- var RETRYABLE_STATUS = /* @__PURE__ */ new Set([408, 500, 502, 503, 504]);
363
- var MUTATING = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
364
- function newIdempotencyKey() {
365
- const c = globalThis.crypto;
366
- if (c?.randomUUID) return c.randomUUID();
367
- return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
368
- }
369
- function backoffMs(attempt, retryAfter) {
370
- const server = retryAfter ? Number(retryAfter) * 1e3 : NaN;
371
- if (Number.isFinite(server) && server >= 0) return Math.min(server, 2e4);
372
- return Math.random() * Math.min(500 * 2 ** attempt, 8e3);
373
- }
374
- var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
375
- function pollBudget(options, defaults) {
376
- const finite = (value, fallback) => typeof value === "number" && Number.isFinite(value) ? value : fallback;
377
- return {
378
- timeoutMs: finite(options.timeoutMs, defaults.timeoutMs),
379
- pollMs: Math.max(1e3, finite(options.pollMs, defaults.pollMs))
380
- };
381
- }
382
- var PROXY_CLIENT_TIMEOUT_MS = 6e4;
383
- var ROUTE_TIMEOUT_MS = PROXY_CLIENT_TIMEOUT_MS - 1e4;
384
- function retryFits(attemptStartedAt, waitMs, deadline) {
385
- const now = Date.now();
386
- return now + waitMs + (now - attemptStartedAt) <= deadline;
387
- }
388
- function isTransient(cause) {
389
- const name = cause?.name;
390
- return name === "TimeoutError" || name === "TypeError" || name === "FetchError";
391
- }
392
- var schema03 = z.string().min(2).max(64);
393
- var schema111 = z.array(schema03);
394
- var schema28 = z.string().regex(new RegExp("\\S")).min(1).max(160);
395
- var schema33 = z.array(schema28).max(1e3);
396
- var schema43 = z.strictObject({
397
- "language_codes": schema111.optional(),
398
- "custom_vocabulary": schema33.optional()
400
+ var schema04 = z.string().min(2).max(64);
401
+ var schema113 = z.array(schema04);
402
+ var schema29 = z.string().regex(new RegExp("\\S")).min(1).max(160);
403
+ var schema34 = z.array(schema29).max(1e3);
404
+ var schema44 = z.strictObject({
405
+ "language_codes": schema113.optional(),
406
+ "custom_vocabulary": schema34.optional()
399
407
  });
400
- var transcriptionWireSchema = schema43;
408
+ var transcriptionWireSchema = schema44;
401
409
  var transcriptionOptionsSchema = z.object({
402
410
  languageCodes: transcriptionWireSchema.shape.language_codes,
403
411
  customVocabulary: transcriptionWireSchema.shape.custom_vocabulary
@@ -409,22 +417,66 @@ function transcriptionToWire(input) {
409
417
  ...options.customVocabulary !== void 0 ? { custom_vocabulary: options.customVocabulary } : {}
410
418
  };
411
419
  }
412
- var schema04 = z.enum(["minor-sexual-content-v1", "safe-content-v1"]);
413
- var contentPolicySchema = schema04;
414
- var schema05 = z.literal("voice_error");
415
- var schema112 = z.enum(["voice_webhook_url_not_allowed", "voice_webhook_unauthorized", "voice_webhook_unreachable", "voice_webhook_timeout", "voice_webhook_http_error", "voice_webhook_unsupported_audio", "voice_webhook_empty_audio"]);
416
- var schema29 = z.string();
417
- var schema34 = z.int().min(-9007199254740991).max(9007199254740991);
418
- var schema44 = z.boolean();
419
- var schema53 = z.object({
420
- "kind": schema05,
421
- "code": schema112,
422
- "message": schema29,
423
- "status": schema34.optional(),
424
- "fatal": schema44,
425
- "request_id": schema29.optional()
420
+ var schema05 = z.enum(["minor-sexual-content-v1", "safe-content-v1"]);
421
+ var contentPolicySchema = schema05;
422
+ var schema06 = z.literal("voice_error");
423
+ var schema114 = z.enum(["voice_webhook_url_not_allowed", "voice_webhook_unauthorized", "voice_webhook_unreachable", "voice_webhook_timeout", "voice_webhook_http_error", "voice_webhook_unsupported_audio", "voice_webhook_empty_audio"]);
424
+ var schema210 = z.string();
425
+ var schema35 = z.int().min(-9007199254740991).max(9007199254740991);
426
+ var schema45 = z.boolean();
427
+ var schema54 = z.object({
428
+ "kind": schema06,
429
+ "code": schema114,
430
+ "message": schema210,
431
+ "status": schema35.optional(),
432
+ "fatal": schema45,
433
+ "request_id": schema210.optional()
434
+ });
435
+ var voiceErrorFrameSchema = schema54;
436
+ var schema07 = z.string().min(1).max(200);
437
+ var schema115 = z.literal(1);
438
+ var schema211 = z.string().min(1).max(200);
439
+ var schema36 = z.int().min(1).max(9007199254740991);
440
+ var schema46 = z.literal(24e3);
441
+ var schema55 = z.literal("pcm_s16le");
442
+ z.object({
443
+ "session_id": schema07,
444
+ "generation_id": schema07,
445
+ "version": schema115,
446
+ "utterance_id": schema211,
447
+ "stream_id": schema07,
448
+ "epoch": schema36,
449
+ "sample_rate": schema46,
450
+ "channels": schema115,
451
+ "encoding": schema55
426
452
  });
427
- var voiceErrorFrameSchema = schema53;
453
+ var schema73 = z.enum(["started", "progress", "finished", "cancelled"]);
454
+ var schema83 = z.int().min(0).max(144e4);
455
+ z.strictObject({
456
+ "session_id": schema07,
457
+ "generation_id": schema07,
458
+ "utterance_id": schema211,
459
+ "stream_id": schema07,
460
+ "epoch": schema36,
461
+ "status": schema73,
462
+ "samples": schema83
463
+ });
464
+ z.object({
465
+ "version": schema115,
466
+ "session_id": schema07,
467
+ "epoch": schema36
468
+ });
469
+ var schema116 = z.literal("external_llm_error");
470
+ var schema123 = z.enum(["external_llm_refused", "external_llm_failed"]);
471
+ var schema133 = z.string();
472
+ var schema143 = z.literal(true);
473
+ var schema153 = z.object({
474
+ "kind": schema116,
475
+ "code": schema123,
476
+ "message": schema133,
477
+ "fatal": schema143
478
+ });
479
+ var externalLlmErrorFrameSchema = schema153;
428
480
 
429
481
  // ../client/src/wire.ts
430
482
  var DEFAULT_AVATAR_ID = "maria";
@@ -729,7 +781,9 @@ z.discriminatedUnion("kind", [
729
781
  endedFrameSchema,
730
782
  behaviorStateFrameSchema,
731
783
  clipAckFrameSchema,
732
- voiceErrorFrameSchema2
784
+ voiceErrorFrameSchema2,
785
+ externalPerformanceFrameSchema,
786
+ externalLlmErrorFrameSchema
733
787
  ]);
734
788
  var liveKitCapacitySnapshotSchema = z.object({
735
789
  // Placement identity + per-worker session ceiling. These are always present on the
@@ -752,7 +806,7 @@ var liveKitCapacitySnapshotSchema = z.object({
752
806
  recommended_retry_ms: z.number().int().nonnegative(),
753
807
  load: z.number().min(0).max(1)
754
808
  }).passthrough();
755
- z.object({
809
+ var capacityBusyResponseSchema = z.object({
756
810
  message: z.string().min(1),
757
811
  capacity: liveKitCapacitySnapshotSchema,
758
812
  queue_size: z.number().int().nonnegative(),
@@ -768,52 +822,151 @@ var liveKitSessionReleaseReasonSchema = z.enum([
768
822
  "manual",
769
823
  "idle_timeout"
770
824
  ]);
771
- var schema06 = z.url().regex(new RegExp("^https:\\/\\/")).max(500);
772
- var schema113 = z.string().min(16).max(200);
773
- var schema210 = z.string().min(1).max(200);
774
- var schema35 = z.string().min(2).max(35);
775
- var schema45 = z.literal([8e3, 16e3, 22050, 24e3, 44100, 48e3]);
776
- var schema54 = z.int().min(1e3).max(15e3);
777
- var schema62 = z.strictObject({
778
- "url": schema06,
779
- "secret": schema113,
780
- "voice_id": schema210.optional(),
781
- "language": schema35.optional(),
782
- "sample_rate": schema45.optional(),
783
- "timeout_ms": schema54.optional()
825
+
826
+ // ../http-client/src/retry.ts
827
+ var RETRYABLE_STATUS = /* @__PURE__ */ new Set([408, 500, 502, 503, 504]);
828
+ var MUTATING = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
829
+ function newIdempotencyKey() {
830
+ const c = globalThis.crypto;
831
+ if (c?.randomUUID) return c.randomUUID();
832
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
833
+ }
834
+ function backoffMs(attempt, retryAfter) {
835
+ const server = retryAfter ? Number(retryAfter) * 1e3 : NaN;
836
+ if (Number.isFinite(server) && server >= 0) return Math.min(server, 2e4);
837
+ return Math.random() * Math.min(500 * 2 ** attempt, 8e3);
838
+ }
839
+ var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
840
+ function pollBudget(options, defaults) {
841
+ const finite = (value, fallback) => typeof value === "number" && Number.isFinite(value) ? value : fallback;
842
+ return {
843
+ timeoutMs: finite(options.timeoutMs, defaults.timeoutMs),
844
+ pollMs: Math.max(1e3, finite(options.pollMs, defaults.pollMs))
845
+ };
846
+ }
847
+ var PROXY_CLIENT_TIMEOUT_MS = 6e4;
848
+ var ROUTE_TIMEOUT_MS = PROXY_CLIENT_TIMEOUT_MS - 1e4;
849
+ function retryFits(attemptStartedAt, waitMs, deadline) {
850
+ const now = Date.now();
851
+ return now + waitMs + (now - attemptStartedAt) <= deadline;
852
+ }
853
+ function isTransient(cause) {
854
+ const name = cause?.name;
855
+ return name === "TimeoutError" || name === "TypeError" || name === "FetchError";
856
+ }
857
+ var schema08 = z.string().min(1).max(160);
858
+ var schema117 = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value));
859
+ var schema212 = z.enum(["cartesia", "fish"]);
860
+ var schema37 = z.string().min(1).max(240);
861
+ var schema47 = z.string().min(1).max(120);
862
+ var schema56 = z.number().min(0.5).max(2);
863
+ var schema64 = z.null();
864
+ var schema74 = z.union([schema56, schema64]);
865
+ var schema84 = z.string().min(1).max(80);
866
+ var schema94 = z.union([schema84, schema64]);
867
+ var schema104 = z.string().min(2).max(16);
868
+ var schema118 = z.union([schema104, schema64]);
869
+ var schema124 = z.strictObject({
870
+ "provider": schema212,
871
+ "voice_id": schema37,
872
+ "model": schema47.optional(),
873
+ "speed": schema74.optional(),
874
+ "emotion": schema94.optional(),
875
+ "language": schema118.optional()
784
876
  });
785
- var schema72 = z.literal("voice.synthesize");
786
- var schema82 = z.literal(1);
787
- var schema92 = z.string().min(1).max(200);
788
- var schema102 = z.string();
789
- var schema114 = z.string().min(1).max(5e3);
790
- var schema122 = z.string();
791
- var schema132 = z.null();
792
- var schema142 = z.union([schema122, schema132]);
793
- var schema152 = z.string();
794
- var schema162 = z.union([schema152, schema132]);
795
- var schema172 = z.literal("pcm_s16le");
796
- var schema182 = z.literal([8e3, 16e3, 22050, 24e3, 44100, 48e3]);
797
- var schema192 = z.object({
798
- "encoding": schema172,
799
- "sample_rate": schema182,
800
- "channels": schema82
877
+ var schema134 = z.string().min(8).max(80);
878
+ var schema144 = z.string();
879
+ var schema154 = z.enum(["video", "live2d"]);
880
+ var schema163 = z.enum(["image", "video"]);
881
+ var schema172 = z.enum(["realtime-avatar-live-v1", "realtime-avatar-video-v1"]);
882
+ var schema182 = z.union([schema134, schema64]);
883
+ var schema192 = z.enum(["draft", "preprocessing", "ready", "failed", "disabled", "deleted"]);
884
+ var schema202 = z.union([schema144, schema64]);
885
+ var schema213 = z.enum(["none", "queued", "generating", "ready", "failed"]);
886
+ var schema222 = z.enum(["local", "gemini", "openai"]);
887
+ var schema232 = z.string().max(200);
888
+ var schema242 = z.union([schema232, schema64]);
889
+ var schema252 = z.strictObject({
890
+ "provider": schema222,
891
+ "model": schema242.optional()
892
+ });
893
+ var schema262 = z.union([schema252, schema64]);
894
+ var schema272 = z.strictObject({
895
+ "id": schema134,
896
+ "tenantId": schema134,
897
+ "displayName": schema144,
898
+ "renderer": schema154,
899
+ "sourceKind": schema163,
900
+ "modelId": schema172,
901
+ "sourceAssetId": schema182,
902
+ "status": schema192,
903
+ "error": schema202,
904
+ "idleVideoStatus": schema213,
905
+ "defaultVoiceId": schema202,
906
+ "llm": schema262,
907
+ "createdAt": schema144,
908
+ "updatedAt": schema144
909
+ });
910
+ var createLive2dAvatarInputSchema = z.strictObject({
911
+ displayName: schema08,
912
+ settings: schema117.optional(),
913
+ metadata: schema117.optional(),
914
+ voice: schema124
915
+ });
916
+ var avatarResponseSchema = schema272;
917
+ var schema09 = z.url().regex(new RegExp("^https:\\/\\/")).max(500);
918
+ var schema119 = z.string().min(16).max(200);
919
+ var schema214 = z.string().min(1).max(200);
920
+ var schema38 = z.string().min(2).max(35);
921
+ var schema48 = z.literal([8e3, 16e3, 22050, 24e3, 44100, 48e3]);
922
+ var schema57 = z.int().min(1e3).max(15e3);
923
+ var schema65 = z.strictObject({
924
+ "url": schema09,
925
+ "secret": schema119,
926
+ "voice_id": schema214.optional(),
927
+ "language": schema38.optional(),
928
+ "sample_rate": schema48.optional(),
929
+ "timeout_ms": schema57.optional()
801
930
  });
802
- var schema202 = z.string().min(1).max(64);
803
- var schema212 = z.string().max(200);
804
- var schema222 = z.record(schema202, schema212).refine((value) => Object.keys(value).length <= 16, { message: "Too many keys: at most 16" });
805
- var schema232 = z.object({
806
- "type": schema72,
807
- "version": schema82,
808
- "request_id": schema92,
809
- "session_id": schema102,
810
- "text": schema114,
811
- "voice_id": schema142,
812
- "language": schema162,
813
- "output": schema192,
814
- "client_metadata": schema222
931
+ var schema75 = z.literal("voice.synthesize");
932
+ var schema85 = z.literal(1);
933
+ var schema95 = z.string().min(1).max(200);
934
+ var schema105 = z.string().min(1).max(200);
935
+ var schema1110 = z.object({
936
+ "generation_id": schema95,
937
+ "utterance_id": schema105
815
938
  });
816
- var voiceWebhookWireSchema = schema62;
939
+ var schema125 = z.string().min(1).max(200);
940
+ var schema135 = z.string();
941
+ var schema145 = z.string().min(1).max(5e3);
942
+ var schema155 = z.string();
943
+ var schema164 = z.null();
944
+ var schema173 = z.union([schema155, schema164]);
945
+ var schema183 = z.string();
946
+ var schema193 = z.union([schema183, schema164]);
947
+ var schema203 = z.literal("pcm_s16le");
948
+ var schema215 = z.literal([8e3, 16e3, 22050, 24e3, 44100, 48e3]);
949
+ var schema223 = z.object({
950
+ "encoding": schema203,
951
+ "sample_rate": schema215,
952
+ "channels": schema85
953
+ });
954
+ var schema233 = z.string().min(1).max(64);
955
+ var schema243 = z.string().max(200);
956
+ var schema253 = z.record(schema233, schema243).refine((value) => Object.keys(value).length <= 16, { message: "Too many keys: at most 16" });
957
+ var schema263 = z.object({
958
+ "type": schema75,
959
+ "version": schema85,
960
+ "performance": schema1110.optional(),
961
+ "request_id": schema125,
962
+ "session_id": schema135,
963
+ "text": schema145,
964
+ "voice_id": schema173,
965
+ "language": schema193,
966
+ "output": schema223,
967
+ "client_metadata": schema253
968
+ });
969
+ var voiceWebhookWireSchema = schema65;
817
970
  var voiceWebhookOptionsSchema = z.strictObject({
818
971
  url: voiceWebhookWireSchema.shape.url,
819
972
  secret: voiceWebhookWireSchema.shape.secret,
@@ -833,88 +986,136 @@ function voiceWebhookToWire(input) {
833
986
  ...options.timeoutMs !== void 0 ? { timeout_ms: options.timeoutMs } : {}
834
987
  };
835
988
  }
836
- var voiceWebhookRequestSchema = schema232;
837
- var schema07 = z.string().min(8).max(80);
838
- var schema115 = z.enum(["eou", "llm", "tts", "decision", "hold", "e2e"]);
839
- var schema211 = z.literal("interrupt_stop");
840
- var schema36 = z.union([schema115, schema211]);
841
- var schema46 = z.int().max(9007199254740991).gt(0);
842
- var schema55 = z.number().min(0);
843
- var schema63 = z.strictObject({
844
- "count": schema46,
845
- "max": schema55,
846
- "p50": schema55,
847
- "p90": schema55
989
+ var voiceWebhookRequestSchema = schema263;
990
+ var schema010 = z.url().regex(new RegExp("^\\s*[Hh][Tt][Tt][Pp][Ss]:\\/\\/")).max(500);
991
+ var schema120 = z.string().min(16).max(4096);
992
+ var schema216 = z.boolean();
993
+ var schema39 = z.literal("external");
994
+ var schema49 = z.strictObject({
995
+ "renderer": schema39
996
+ });
997
+ var schema58 = z.literal("v1");
998
+ var schema66 = z.literal("correlated_pcm_v1");
999
+ var schema76 = z.literal("v1");
1000
+ var schema86 = z.literal(true);
1001
+ var schema96 = z.object({
1002
+ "performance": schema76,
1003
+ "fail_closed": schema86
1004
+ });
1005
+ var schema106 = z.strictObject({
1006
+ "base_url": schema010,
1007
+ "token": schema120,
1008
+ "fail_closed": schema216.optional(),
1009
+ "visible_character": schema49.optional(),
1010
+ "performance": schema58.optional(),
1011
+ "audio_output": schema66.optional()
1012
+ }).superRefine((value, ctx) => {
1013
+ if (value["audio_output"] !== void 0) {
1014
+ const result = schema96.safeParse(value);
1015
+ if (!result.success) for (const issue of result.error.issues) ctx.addIssue({ code: "custom", message: issue.message, path: issue.path });
1016
+ }
1017
+ });
1018
+ var externalLlmWireSchema = schema106;
1019
+ var externalLlmOptionsSchema = z.strictObject({
1020
+ baseUrl: externalLlmWireSchema.shape.base_url,
1021
+ token: externalLlmWireSchema.shape.token,
1022
+ failClosed: externalLlmWireSchema.shape.fail_closed,
1023
+ visibleCharacter: externalLlmWireSchema.shape.visible_character,
1024
+ performance: externalLlmWireSchema.shape.performance,
1025
+ audioOutput: externalLlmWireSchema.shape.audio_output
1026
+ });
1027
+ function externalLlmToWire(input) {
1028
+ const options = externalLlmOptionsSchema.parse(input);
1029
+ return externalLlmWireSchema.parse({
1030
+ base_url: options.baseUrl,
1031
+ token: options.token,
1032
+ ...options.failClosed !== void 0 ? { fail_closed: options.failClosed } : {},
1033
+ ...options.visibleCharacter !== void 0 ? { visible_character: options.visibleCharacter } : {},
1034
+ ...options.performance !== void 0 ? { performance: options.performance } : {},
1035
+ ...options.audioOutput !== void 0 ? { audio_output: options.audioOutput } : {}
1036
+ });
1037
+ }
1038
+ var schema011 = z.string().min(8).max(80);
1039
+ var schema121 = z.enum(["eou", "llm", "tts", "decision", "hold", "e2e"]);
1040
+ var schema217 = z.literal("interrupt_stop");
1041
+ var schema310 = z.union([schema121, schema217]);
1042
+ var schema410 = z.int().max(9007199254740991).gt(0);
1043
+ var schema59 = z.number().min(0);
1044
+ var schema67 = z.strictObject({
1045
+ "count": schema410,
1046
+ "max": schema59,
1047
+ "p50": schema59,
1048
+ "p90": schema59
848
1049
  });
849
- var schema73 = z.partialRecord(schema36, schema63);
850
- var schema83 = z.literal("available");
851
- var schema93 = z.literal("dialogue");
852
- var schema103 = z.string().regex(new RegExp("^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d))|(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?)$"));
853
- var schema116 = z.null();
854
- var schema123 = z.union([schema103, schema116]);
855
- var schema133 = z.int().min(0).max(9007199254740991);
856
- var schema143 = z.strictObject({
857
- "first_at": schema123,
858
- "last_at": schema123,
859
- "lines": schema133
1050
+ var schema77 = z.partialRecord(schema310, schema67);
1051
+ var schema87 = z.literal("available");
1052
+ var schema97 = z.literal("dialogue");
1053
+ var schema107 = z.string().regex(new RegExp("^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d))|(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?)$"));
1054
+ var schema1111 = z.null();
1055
+ var schema126 = z.union([schema107, schema1111]);
1056
+ var schema136 = z.int().min(0).max(9007199254740991);
1057
+ var schema146 = z.strictObject({
1058
+ "first_at": schema126,
1059
+ "last_at": schema126,
1060
+ "lines": schema136
860
1061
  });
861
- var schema153 = z.strictObject({
862
- "latency_ms": schema73,
863
- "status": schema83,
864
- "sourceRole": schema93,
865
- "coverage": schema143
1062
+ var schema156 = z.strictObject({
1063
+ "latency_ms": schema77,
1064
+ "status": schema87,
1065
+ "sourceRole": schema97,
1066
+ "coverage": schema146
866
1067
  });
867
- var schema163 = z.literal("unavailable");
868
- var schema173 = z.enum(["not_closed", "unconfigured", "missing", "invalid", "oversized", "unscorable", "no_measured_latency", "timeout", "aborted", "storage_unavailable"]);
869
- var schema183 = z.strictObject({
870
- "status": schema163,
871
- "reason": schema173
1068
+ var schema165 = z.literal("unavailable");
1069
+ var schema174 = z.enum(["not_closed", "unconfigured", "missing", "invalid", "oversized", "unscorable", "no_measured_latency", "timeout", "aborted", "storage_unavailable"]);
1070
+ var schema184 = z.strictObject({
1071
+ "status": schema165,
1072
+ "reason": schema174
872
1073
  });
873
- var schema193 = z.union([schema153, schema183]);
874
- var schema203 = z.string().min(1).max(200);
875
- var schema213 = z.union([schema203, schema116]);
876
- var schema223 = z.string().regex(new RegExp("^[0-9a-f]{40}$"));
877
- var schema233 = z.union([schema223, schema116]);
878
- var schema242 = z.literal("cloudflare-worker-version");
879
- var schema252 = z.literal("authenticated-worker-heartbeat");
880
- var schema262 = z.union([schema252, schema116]);
881
- var schema272 = z.string().min(1).max(160);
882
- var schema282 = z.union([schema272, schema116]);
883
- var schema292 = z.union([schema133, schema116]);
1074
+ var schema194 = z.union([schema156, schema184]);
1075
+ var schema204 = z.string().min(1).max(200);
1076
+ var schema218 = z.union([schema204, schema1111]);
1077
+ var schema224 = z.string().regex(new RegExp("^[0-9a-f]{40}$"));
1078
+ var schema234 = z.union([schema224, schema1111]);
1079
+ var schema244 = z.literal("cloudflare-worker-version");
1080
+ var schema254 = z.literal("authenticated-worker-heartbeat");
1081
+ var schema264 = z.union([schema254, schema1111]);
1082
+ var schema273 = z.string().min(1).max(160);
1083
+ var schema282 = z.union([schema273, schema1111]);
1084
+ var schema292 = z.union([schema136, schema1111]);
884
1085
  var schema30 = z.iso.datetime({ offset: true }).regex(new RegExp("^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"));
885
- var schema31 = z.union([schema30, schema116]);
1086
+ var schema31 = z.union([schema30, schema1111]);
886
1087
  var schema322 = z.strictObject({
887
- "deploymentSource": schema242,
888
- "workerSource": schema262,
1088
+ "deploymentSource": schema244,
1089
+ "workerSource": schema264,
889
1090
  "workerId": schema282,
890
1091
  "podStartedAtMs": schema292,
891
1092
  "workerObservedAt": schema31
892
1093
  });
893
1094
  var schema332 = z.strictObject({
894
- "deploymentId": schema213,
895
- "workerRevision": schema233,
1095
+ "deploymentId": schema218,
1096
+ "workerRevision": schema234,
896
1097
  "provenance": schema322
897
1098
  });
898
1099
  var schema342 = z.string();
899
- var schema352 = z.union([schema342, schema116]);
1100
+ var schema352 = z.union([schema342, schema1111]);
900
1101
  var schema362 = z.enum(["reserved", "started", "released", "failed"]);
901
- var schema37 = z.union([schema55, schema116]);
902
- var schema38 = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value));
903
- var schema39 = z.strictObject({
904
- "sessionId": schema07,
905
- "speechDiagnostics": schema193.optional(),
1102
+ var schema372 = z.union([schema59, schema1111]);
1103
+ var schema382 = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value));
1104
+ var schema392 = z.strictObject({
1105
+ "sessionId": schema011,
1106
+ "speechDiagnostics": schema194.optional(),
906
1107
  "releaseIdentity": schema332.optional(),
907
1108
  "avatarId": schema352,
908
1109
  "avatarName": schema352,
909
1110
  "status": schema362,
910
1111
  "startedAt": schema352,
911
1112
  "endedAt": schema352,
912
- "activeSeconds": schema37,
1113
+ "activeSeconds": schema372,
913
1114
  "billedCreditMicros": schema292,
914
- "metadata": schema38,
1115
+ "metadata": schema382,
915
1116
  "createdAt": schema342
916
1117
  });
917
- var schema40 = z.array(schema39);
1118
+ var schema40 = z.array(schema392);
918
1119
  var schema41 = z.iso.datetime({ offset: true }).regex(new RegExp("^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"));
919
1120
  var schema422 = z.strictObject({
920
1121
  "data": schema40,
@@ -931,7 +1132,7 @@ function toSessionsPage(page) {
931
1132
  // ../http-client/src/client.ts
932
1133
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
933
1134
  var RENDER_MISMATCH = "Render response did not match the SDK contract";
934
- var SDK_VERSION = "0.33.0";
1135
+ var SDK_VERSION = "0.34.0";
935
1136
  var RealtimeAvatar = class {
936
1137
  #apiKey;
937
1138
  #baseUrl;
@@ -986,9 +1187,9 @@ var RealtimeAvatar = class {
986
1187
  if (options.contentPolicy !== void 0) body.content_policy = contentPolicySchema.parse(options.contentPolicy);
987
1188
  if (options.clientTools) body.capabilities = ["client_tools"];
988
1189
  if (options.llm !== void 0) {
989
- const { backend, model, baseUrl, token } = options.llm;
1190
+ const { backend, model, ...endpoint } = options.llm;
990
1191
  body.llm = model === void 0 ? { backend } : { backend, model };
991
- body.external_llm = { base_url: baseUrl, token };
1192
+ body.external_llm = externalLlmToWire(endpoint);
992
1193
  }
993
1194
  if (options.transcript !== void 0) {
994
1195
  body.transcript_webhook = { url: options.transcript.url, secret: options.transcript.secret };
@@ -1133,6 +1334,24 @@ var RealtimeAvatar = class {
1133
1334
  metadata: input.metadata
1134
1335
  });
1135
1336
  }
1337
+ /**
1338
+ * Register an app-owned Live2D rig for voice sessions. No assets, motion generation or
1339
+ * automatic voice casting: supply an explicit provider and voice_id, then mint with mode voice.
1340
+ */
1341
+ async createLive2dAvatar(input) {
1342
+ const { voice, ...identity } = createLive2dAvatarInputSchema.parse(input);
1343
+ const body = {
1344
+ ...identity,
1345
+ renderer: "live2d",
1346
+ sourceKind: "image",
1347
+ voice: { voice }
1348
+ };
1349
+ return this.#contract(
1350
+ await this.#request("POST", "/avatars", { json: body }),
1351
+ avatarResponseSchema,
1352
+ "Avatar response did not match the SDK contract"
1353
+ );
1354
+ }
1136
1355
  async createAvatar(input) {
1137
1356
  const body = {
1138
1357
  displayName: input.displayName,
@@ -1570,6 +1789,7 @@ function toAvatar(raw) {
1570
1789
  return {
1571
1790
  id: String(a.id),
1572
1791
  displayName: String(a.displayName ?? ""),
1792
+ renderer: avatarResponseSchema.shape.renderer.default("video").parse(a.renderer),
1573
1793
  sourceKind: a.sourceKind === "video" ? "video" : "image",
1574
1794
  status: a.status ?? "draft",
1575
1795
  defaultVoiceId: a.defaultVoiceId ? String(a.defaultVoiceId) : null,
@@ -1670,5 +1890,16 @@ function timingSafeEqual(a, b) {
1670
1890
  function isQueued(result) {
1671
1891
  return "queued" in result;
1672
1892
  }
1893
+ var proxyConnectRequestSchema = z.object({
1894
+ avatarId: z.string().min(1),
1895
+ mode: sessionModeSchema.optional()
1896
+ });
1897
+ var proxyEndRequestSchema = z.object({
1898
+ session_id: z.string().min(1).optional(),
1899
+ queue_ticket_id: z.string().min(1).optional(),
1900
+ reason: liveKitSessionReleaseReasonSchema.optional().catch(void 0)
1901
+ }).strict().refine((body) => body.session_id !== void 0 || body.queue_ticket_id !== void 0, {
1902
+ message: "session_id or queue_ticket_id is required"
1903
+ });
1673
1904
 
1674
- export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, ROUTE_TIMEOUT_MS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionReleaseReasonSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, sessionModeSchema, verifyTranscript, verifyVoiceWebhook };
1905
+ export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, ROUTE_TIMEOUT_MS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };