realtime-avatar 0.33.0 → 0.35.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,75 @@ 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("speech_segments_v1");
357
+ var schema72 = z.literal("external");
358
+ var schema82 = z.object({
359
+ "renderer": schema72
360
+ });
361
+ var schema92 = z.object({
362
+ "session_id": schema02,
363
+ "generation_id": schema02,
364
+ "version": schema110,
365
+ "purpose": schema42,
366
+ "admission": schema52,
367
+ "text_output": schema62.optional(),
368
+ "visible_character": schema82.optional()
369
+ });
370
+ var schema102 = z.string().min(1).max(200);
371
+ var schema112 = z.object({
372
+ "generation_id": schema02,
373
+ "utterance_id": schema102
374
+ });
375
+ var schema122 = z.literal("external_performance");
376
+ var schema132 = z.enum(["accepted", "dropped", "cancelled", "audio_released"]);
377
+ var schema142 = z.union([schema132, schema32]);
378
+ var schema152 = z.literal("unavailable");
379
+ var schema162 = z.literal("unavailable");
380
+ var schema172 = z.object({
381
+ "session_id": schema02,
382
+ "generation_id": schema02,
383
+ "kind": schema122,
384
+ "version": schema110,
385
+ "status": schema142,
386
+ "audible_checkpoint": schema152,
387
+ "audio_mapping": schema162
388
+ });
389
+ var schema182 = z.string().regex(new RegExp("^(?:[^\\uD800-\\uDFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])*$")).min(1).max(5e3);
390
+ var schema192 = z.strictObject({
391
+ "version": schema110,
392
+ "generation_id": schema02,
393
+ "utterance_id": schema102,
394
+ "text": schema182
395
+ });
396
+ var externalTurnContextSchema = schema92;
397
+ var externalUtteranceSchema = schema112;
398
+ var externalPerformanceFrameSchema = schema172;
399
+ var externalSpeechSegmentSchema = schema192;
400
+ var schema03 = z.enum(["s1", "s2-pro", "s2.1-pro", "drama-3"]);
401
+ var schema111 = z.enum(["speech-1.6", "speech-1.5", "s1-mini"]);
402
+ var schema28 = z.union([schema03, schema111]);
403
+ var schema33 = z.enum(["whisper"]);
404
+ var schema43 = z.null();
405
+ var schema53 = z.union([schema33, schema43]);
406
+ var fishTtsModelSchema = schema28;
357
407
  var DEFAULT_FISH_TTS_MODEL = "s2.1-pro";
358
- var fishDeliverySchema = schema52;
408
+ var fishDeliverySchema = schema53;
359
409
  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()
410
+ var schema04 = z.string().min(2).max(64);
411
+ var schema113 = z.array(schema04);
412
+ var schema29 = z.string().regex(new RegExp("\\S")).min(1).max(160);
413
+ var schema34 = z.array(schema29).max(1e3);
414
+ var schema44 = z.strictObject({
415
+ "language_codes": schema113.optional(),
416
+ "custom_vocabulary": schema34.optional()
399
417
  });
400
- var transcriptionWireSchema = schema43;
418
+ var transcriptionWireSchema = schema44;
401
419
  var transcriptionOptionsSchema = z.object({
402
420
  languageCodes: transcriptionWireSchema.shape.language_codes,
403
421
  customVocabulary: transcriptionWireSchema.shape.custom_vocabulary
@@ -409,22 +427,66 @@ function transcriptionToWire(input) {
409
427
  ...options.customVocabulary !== void 0 ? { custom_vocabulary: options.customVocabulary } : {}
410
428
  };
411
429
  }
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()
430
+ var schema05 = z.enum(["minor-sexual-content-v1", "safe-content-v1"]);
431
+ var contentPolicySchema = schema05;
432
+ var schema06 = z.literal("voice_error");
433
+ 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"]);
434
+ var schema210 = z.string();
435
+ var schema35 = z.int().min(-9007199254740991).max(9007199254740991);
436
+ var schema45 = z.boolean();
437
+ var schema54 = z.object({
438
+ "kind": schema06,
439
+ "code": schema114,
440
+ "message": schema210,
441
+ "status": schema35.optional(),
442
+ "fatal": schema45,
443
+ "request_id": schema210.optional()
444
+ });
445
+ var voiceErrorFrameSchema = schema54;
446
+ var schema07 = z.string().min(1).max(200);
447
+ var schema115 = z.literal(1);
448
+ var schema211 = z.string().min(1).max(200);
449
+ var schema36 = z.int().min(1).max(9007199254740991);
450
+ var schema46 = z.literal(24e3);
451
+ var schema55 = z.literal("pcm_s16le");
452
+ z.object({
453
+ "session_id": schema07,
454
+ "generation_id": schema07,
455
+ "version": schema115,
456
+ "utterance_id": schema211,
457
+ "stream_id": schema07,
458
+ "epoch": schema36,
459
+ "sample_rate": schema46,
460
+ "channels": schema115,
461
+ "encoding": schema55
426
462
  });
427
- var voiceErrorFrameSchema = schema53;
463
+ var schema73 = z.enum(["started", "progress", "finished", "cancelled"]);
464
+ var schema83 = z.int().min(0).max(144e4);
465
+ z.strictObject({
466
+ "session_id": schema07,
467
+ "generation_id": schema07,
468
+ "utterance_id": schema211,
469
+ "stream_id": schema07,
470
+ "epoch": schema36,
471
+ "status": schema73,
472
+ "samples": schema83
473
+ });
474
+ z.object({
475
+ "version": schema115,
476
+ "session_id": schema07,
477
+ "epoch": schema36
478
+ });
479
+ var schema116 = z.literal("external_llm_error");
480
+ var schema123 = z.enum(["external_llm_refused", "external_llm_failed"]);
481
+ var schema133 = z.string();
482
+ var schema143 = z.literal(true);
483
+ var schema153 = z.object({
484
+ "kind": schema116,
485
+ "code": schema123,
486
+ "message": schema133,
487
+ "fatal": schema143
488
+ });
489
+ var externalLlmErrorFrameSchema = schema153;
428
490
 
429
491
  // ../client/src/wire.ts
430
492
  var DEFAULT_AVATAR_ID = "maria";
@@ -729,7 +791,9 @@ z.discriminatedUnion("kind", [
729
791
  endedFrameSchema,
730
792
  behaviorStateFrameSchema,
731
793
  clipAckFrameSchema,
732
- voiceErrorFrameSchema2
794
+ voiceErrorFrameSchema2,
795
+ externalPerformanceFrameSchema,
796
+ externalLlmErrorFrameSchema
733
797
  ]);
734
798
  var liveKitCapacitySnapshotSchema = z.object({
735
799
  // Placement identity + per-worker session ceiling. These are always present on the
@@ -752,7 +816,7 @@ var liveKitCapacitySnapshotSchema = z.object({
752
816
  recommended_retry_ms: z.number().int().nonnegative(),
753
817
  load: z.number().min(0).max(1)
754
818
  }).passthrough();
755
- z.object({
819
+ var capacityBusyResponseSchema = z.object({
756
820
  message: z.string().min(1),
757
821
  capacity: liveKitCapacitySnapshotSchema,
758
822
  queue_size: z.number().int().nonnegative(),
@@ -768,52 +832,151 @@ var liveKitSessionReleaseReasonSchema = z.enum([
768
832
  "manual",
769
833
  "idle_timeout"
770
834
  ]);
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()
835
+
836
+ // ../http-client/src/retry.ts
837
+ var RETRYABLE_STATUS = /* @__PURE__ */ new Set([408, 500, 502, 503, 504]);
838
+ var MUTATING = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
839
+ function newIdempotencyKey() {
840
+ const c = globalThis.crypto;
841
+ if (c?.randomUUID) return c.randomUUID();
842
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
843
+ }
844
+ function backoffMs(attempt, retryAfter) {
845
+ const server = retryAfter ? Number(retryAfter) * 1e3 : NaN;
846
+ if (Number.isFinite(server) && server >= 0) return Math.min(server, 2e4);
847
+ return Math.random() * Math.min(500 * 2 ** attempt, 8e3);
848
+ }
849
+ var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
850
+ function pollBudget(options, defaults) {
851
+ const finite = (value, fallback) => typeof value === "number" && Number.isFinite(value) ? value : fallback;
852
+ return {
853
+ timeoutMs: finite(options.timeoutMs, defaults.timeoutMs),
854
+ pollMs: Math.max(1e3, finite(options.pollMs, defaults.pollMs))
855
+ };
856
+ }
857
+ var PROXY_CLIENT_TIMEOUT_MS = 6e4;
858
+ var ROUTE_TIMEOUT_MS = PROXY_CLIENT_TIMEOUT_MS - 1e4;
859
+ function retryFits(attemptStartedAt, waitMs, deadline) {
860
+ const now = Date.now();
861
+ return now + waitMs + (now - attemptStartedAt) <= deadline;
862
+ }
863
+ function isTransient(cause) {
864
+ const name = cause?.name;
865
+ return name === "TimeoutError" || name === "TypeError" || name === "FetchError";
866
+ }
867
+ var schema08 = z.string().min(1).max(160);
868
+ var schema117 = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value));
869
+ var schema212 = z.enum(["cartesia", "fish"]);
870
+ var schema37 = z.string().min(1).max(240);
871
+ var schema47 = z.string().min(1).max(120);
872
+ var schema56 = z.number().min(0.5).max(2);
873
+ var schema64 = z.null();
874
+ var schema74 = z.union([schema56, schema64]);
875
+ var schema84 = z.string().min(1).max(80);
876
+ var schema94 = z.union([schema84, schema64]);
877
+ var schema104 = z.string().min(2).max(16);
878
+ var schema118 = z.union([schema104, schema64]);
879
+ var schema124 = z.strictObject({
880
+ "provider": schema212,
881
+ "voice_id": schema37,
882
+ "model": schema47.optional(),
883
+ "speed": schema74.optional(),
884
+ "emotion": schema94.optional(),
885
+ "language": schema118.optional()
886
+ });
887
+ var schema134 = z.string().min(8).max(80);
888
+ var schema144 = z.string();
889
+ var schema154 = z.enum(["video", "live2d"]);
890
+ var schema163 = z.enum(["image", "video"]);
891
+ var schema173 = z.enum(["realtime-avatar-live-v1", "realtime-avatar-video-v1"]);
892
+ var schema183 = z.union([schema134, schema64]);
893
+ var schema193 = z.enum(["draft", "preprocessing", "ready", "failed", "disabled", "deleted"]);
894
+ var schema202 = z.union([schema144, schema64]);
895
+ var schema213 = z.enum(["none", "queued", "generating", "ready", "failed"]);
896
+ var schema222 = z.enum(["local", "gemini", "openai"]);
897
+ var schema232 = z.string().max(200);
898
+ var schema242 = z.union([schema232, schema64]);
899
+ var schema252 = z.strictObject({
900
+ "provider": schema222,
901
+ "model": schema242.optional()
784
902
  });
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
903
+ var schema262 = z.union([schema252, schema64]);
904
+ var schema272 = z.strictObject({
905
+ "id": schema134,
906
+ "tenantId": schema134,
907
+ "displayName": schema144,
908
+ "renderer": schema154,
909
+ "sourceKind": schema163,
910
+ "modelId": schema173,
911
+ "sourceAssetId": schema183,
912
+ "status": schema193,
913
+ "error": schema202,
914
+ "idleVideoStatus": schema213,
915
+ "defaultVoiceId": schema202,
916
+ "llm": schema262,
917
+ "createdAt": schema144,
918
+ "updatedAt": schema144
801
919
  });
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
920
+ var createLive2dAvatarInputSchema = z.strictObject({
921
+ displayName: schema08,
922
+ settings: schema117.optional(),
923
+ metadata: schema117.optional(),
924
+ voice: schema124
815
925
  });
816
- var voiceWebhookWireSchema = schema62;
926
+ var avatarResponseSchema = schema272;
927
+ var schema09 = z.url().regex(new RegExp("^https:\\/\\/")).max(500);
928
+ var schema119 = z.string().min(16).max(200);
929
+ var schema214 = z.string().min(1).max(200);
930
+ var schema38 = z.string().min(2).max(35);
931
+ var schema48 = z.literal([8e3, 16e3, 22050, 24e3, 44100, 48e3]);
932
+ var schema57 = z.int().min(1e3).max(15e3);
933
+ var schema65 = z.strictObject({
934
+ "url": schema09,
935
+ "secret": schema119,
936
+ "voice_id": schema214.optional(),
937
+ "language": schema38.optional(),
938
+ "sample_rate": schema48.optional(),
939
+ "timeout_ms": schema57.optional()
940
+ });
941
+ var schema75 = z.literal("voice.synthesize");
942
+ var schema85 = z.literal(1);
943
+ var schema95 = z.string().min(1).max(200);
944
+ var schema105 = z.string().min(1).max(200);
945
+ var schema1110 = z.object({
946
+ "generation_id": schema95,
947
+ "utterance_id": schema105
948
+ });
949
+ var schema125 = z.string().min(1).max(200);
950
+ var schema135 = z.string();
951
+ var schema145 = z.string().min(1).max(5e3);
952
+ var schema155 = z.string();
953
+ var schema164 = z.null();
954
+ var schema174 = z.union([schema155, schema164]);
955
+ var schema184 = z.string();
956
+ var schema194 = z.union([schema184, schema164]);
957
+ var schema203 = z.literal("pcm_s16le");
958
+ var schema215 = z.literal([8e3, 16e3, 22050, 24e3, 44100, 48e3]);
959
+ var schema223 = z.object({
960
+ "encoding": schema203,
961
+ "sample_rate": schema215,
962
+ "channels": schema85
963
+ });
964
+ var schema233 = z.string().min(1).max(64);
965
+ var schema243 = z.string().max(200);
966
+ var schema253 = z.record(schema233, schema243).refine((value) => Object.keys(value).length <= 16, { message: "Too many keys: at most 16" });
967
+ var schema263 = z.object({
968
+ "type": schema75,
969
+ "version": schema85,
970
+ "performance": schema1110.optional(),
971
+ "request_id": schema125,
972
+ "session_id": schema135,
973
+ "text": schema145,
974
+ "voice_id": schema174,
975
+ "language": schema194,
976
+ "output": schema223,
977
+ "client_metadata": schema253
978
+ });
979
+ var voiceWebhookWireSchema = schema65;
817
980
  var voiceWebhookOptionsSchema = z.strictObject({
818
981
  url: voiceWebhookWireSchema.shape.url,
819
982
  secret: voiceWebhookWireSchema.shape.secret,
@@ -833,88 +996,151 @@ function voiceWebhookToWire(input) {
833
996
  ...options.timeoutMs !== void 0 ? { timeout_ms: options.timeoutMs } : {}
834
997
  };
835
998
  }
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
999
+ var voiceWebhookRequestSchema = schema263;
1000
+ var schema010 = z.url().regex(new RegExp("^\\s*[Hh][Tt][Tt][Pp][Ss]:\\/\\/")).max(500);
1001
+ var schema120 = z.string().min(16).max(4096);
1002
+ var schema216 = z.boolean();
1003
+ var schema39 = z.literal("external");
1004
+ var schema49 = z.strictObject({
1005
+ "renderer": schema39
1006
+ });
1007
+ var schema58 = z.literal("v1");
1008
+ var schema66 = z.literal("correlated_pcm_v1");
1009
+ var schema76 = z.literal("speech_segments_v1");
1010
+ var schema86 = z.literal("v1");
1011
+ var schema96 = z.literal(true);
1012
+ var schema106 = z.object({
1013
+ "performance": schema86,
1014
+ "fail_closed": schema96
1015
+ });
1016
+ var schema1111 = z.literal("correlated_pcm_v1");
1017
+ var schema126 = z.object({
1018
+ "performance": schema86,
1019
+ "fail_closed": schema96,
1020
+ "audio_output": schema1111
1021
+ });
1022
+ var schema136 = z.strictObject({
1023
+ "base_url": schema010,
1024
+ "token": schema120,
1025
+ "fail_closed": schema216.optional(),
1026
+ "visible_character": schema49.optional(),
1027
+ "performance": schema58.optional(),
1028
+ "audio_output": schema66.optional(),
1029
+ "text_output": schema76.optional()
1030
+ }).superRefine((value, ctx) => {
1031
+ if (value["audio_output"] !== void 0) {
1032
+ const result = schema106.safeParse(value);
1033
+ if (!result.success) for (const issue of result.error.issues) ctx.addIssue({ code: "custom", message: issue.message, path: issue.path });
1034
+ }
1035
+ }).superRefine((value, ctx) => {
1036
+ if (value["text_output"] !== void 0) {
1037
+ const result = schema126.safeParse(value);
1038
+ if (!result.success) for (const issue of result.error.issues) ctx.addIssue({ code: "custom", message: issue.message, path: issue.path });
1039
+ }
1040
+ });
1041
+ var externalLlmWireSchema = schema136;
1042
+ var externalLlmOptionsSchema = z.strictObject({
1043
+ baseUrl: externalLlmWireSchema.shape.base_url,
1044
+ token: externalLlmWireSchema.shape.token,
1045
+ failClosed: externalLlmWireSchema.shape.fail_closed,
1046
+ visibleCharacter: externalLlmWireSchema.shape.visible_character,
1047
+ performance: externalLlmWireSchema.shape.performance,
1048
+ audioOutput: externalLlmWireSchema.shape.audio_output,
1049
+ textOutput: externalLlmWireSchema.shape.text_output
1050
+ });
1051
+ function externalLlmToWire(input) {
1052
+ const options = externalLlmOptionsSchema.parse(input);
1053
+ return externalLlmWireSchema.parse({
1054
+ base_url: options.baseUrl,
1055
+ token: options.token,
1056
+ ...options.failClosed !== void 0 ? { fail_closed: options.failClosed } : {},
1057
+ ...options.visibleCharacter !== void 0 ? { visible_character: options.visibleCharacter } : {},
1058
+ ...options.performance !== void 0 ? { performance: options.performance } : {},
1059
+ ...options.audioOutput !== void 0 ? { audio_output: options.audioOutput } : {},
1060
+ ...options.textOutput !== void 0 ? { text_output: options.textOutput } : {}
1061
+ });
1062
+ }
1063
+ var schema011 = z.string().min(8).max(80);
1064
+ var schema121 = z.enum(["eou", "llm", "tts", "decision", "hold", "e2e"]);
1065
+ var schema217 = z.literal("interrupt_stop");
1066
+ var schema310 = z.union([schema121, schema217]);
1067
+ var schema410 = z.int().max(9007199254740991).gt(0);
1068
+ var schema59 = z.number().min(0);
1069
+ var schema67 = z.strictObject({
1070
+ "count": schema410,
1071
+ "max": schema59,
1072
+ "p50": schema59,
1073
+ "p90": schema59
848
1074
  });
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
1075
+ var schema77 = z.partialRecord(schema310, schema67);
1076
+ var schema87 = z.literal("available");
1077
+ var schema97 = z.literal("dialogue");
1078
+ 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+)?)?)$"));
1079
+ var schema1112 = z.null();
1080
+ var schema127 = z.union([schema107, schema1112]);
1081
+ var schema137 = z.int().min(0).max(9007199254740991);
1082
+ var schema146 = z.strictObject({
1083
+ "first_at": schema127,
1084
+ "last_at": schema127,
1085
+ "lines": schema137
860
1086
  });
861
- var schema153 = z.strictObject({
862
- "latency_ms": schema73,
863
- "status": schema83,
864
- "sourceRole": schema93,
865
- "coverage": schema143
1087
+ var schema156 = z.strictObject({
1088
+ "latency_ms": schema77,
1089
+ "status": schema87,
1090
+ "sourceRole": schema97,
1091
+ "coverage": schema146
866
1092
  });
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
1093
+ var schema165 = z.literal("unavailable");
1094
+ var schema175 = z.enum(["not_closed", "unconfigured", "missing", "invalid", "oversized", "unscorable", "no_measured_latency", "timeout", "aborted", "storage_unavailable"]);
1095
+ var schema185 = z.strictObject({
1096
+ "status": schema165,
1097
+ "reason": schema175
872
1098
  });
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]);
1099
+ var schema195 = z.union([schema156, schema185]);
1100
+ var schema204 = z.string().min(1).max(200);
1101
+ var schema218 = z.union([schema204, schema1112]);
1102
+ var schema224 = z.string().regex(new RegExp("^[0-9a-f]{40}$"));
1103
+ var schema234 = z.union([schema224, schema1112]);
1104
+ var schema244 = z.literal("cloudflare-worker-version");
1105
+ var schema254 = z.literal("authenticated-worker-heartbeat");
1106
+ var schema264 = z.union([schema254, schema1112]);
1107
+ var schema273 = z.string().min(1).max(160);
1108
+ var schema282 = z.union([schema273, schema1112]);
1109
+ var schema292 = z.union([schema137, schema1112]);
884
1110
  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]);
1111
+ var schema31 = z.union([schema30, schema1112]);
886
1112
  var schema322 = z.strictObject({
887
- "deploymentSource": schema242,
888
- "workerSource": schema262,
1113
+ "deploymentSource": schema244,
1114
+ "workerSource": schema264,
889
1115
  "workerId": schema282,
890
1116
  "podStartedAtMs": schema292,
891
1117
  "workerObservedAt": schema31
892
1118
  });
893
1119
  var schema332 = z.strictObject({
894
- "deploymentId": schema213,
895
- "workerRevision": schema233,
1120
+ "deploymentId": schema218,
1121
+ "workerRevision": schema234,
896
1122
  "provenance": schema322
897
1123
  });
898
1124
  var schema342 = z.string();
899
- var schema352 = z.union([schema342, schema116]);
1125
+ var schema352 = z.union([schema342, schema1112]);
900
1126
  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(),
1127
+ var schema372 = z.union([schema59, schema1112]);
1128
+ var schema382 = z.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value));
1129
+ var schema392 = z.strictObject({
1130
+ "sessionId": schema011,
1131
+ "speechDiagnostics": schema195.optional(),
906
1132
  "releaseIdentity": schema332.optional(),
907
1133
  "avatarId": schema352,
908
1134
  "avatarName": schema352,
909
1135
  "status": schema362,
910
1136
  "startedAt": schema352,
911
1137
  "endedAt": schema352,
912
- "activeSeconds": schema37,
1138
+ "activeSeconds": schema372,
913
1139
  "billedCreditMicros": schema292,
914
- "metadata": schema38,
1140
+ "metadata": schema382,
915
1141
  "createdAt": schema342
916
1142
  });
917
- var schema40 = z.array(schema39);
1143
+ var schema40 = z.array(schema392);
918
1144
  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
1145
  var schema422 = z.strictObject({
920
1146
  "data": schema40,
@@ -931,7 +1157,7 @@ function toSessionsPage(page) {
931
1157
  // ../http-client/src/client.ts
932
1158
  var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
933
1159
  var RENDER_MISMATCH = "Render response did not match the SDK contract";
934
- var SDK_VERSION = "0.33.0";
1160
+ var SDK_VERSION = "0.35.0";
935
1161
  var RealtimeAvatar = class {
936
1162
  #apiKey;
937
1163
  #baseUrl;
@@ -986,9 +1212,9 @@ var RealtimeAvatar = class {
986
1212
  if (options.contentPolicy !== void 0) body.content_policy = contentPolicySchema.parse(options.contentPolicy);
987
1213
  if (options.clientTools) body.capabilities = ["client_tools"];
988
1214
  if (options.llm !== void 0) {
989
- const { backend, model, baseUrl, token } = options.llm;
1215
+ const { backend, model, ...endpoint } = options.llm;
990
1216
  body.llm = model === void 0 ? { backend } : { backend, model };
991
- body.external_llm = { base_url: baseUrl, token };
1217
+ body.external_llm = externalLlmToWire(endpoint);
992
1218
  }
993
1219
  if (options.transcript !== void 0) {
994
1220
  body.transcript_webhook = { url: options.transcript.url, secret: options.transcript.secret };
@@ -1133,6 +1359,24 @@ var RealtimeAvatar = class {
1133
1359
  metadata: input.metadata
1134
1360
  });
1135
1361
  }
1362
+ /**
1363
+ * Register an app-owned Live2D rig for voice sessions. No assets, motion generation or
1364
+ * automatic voice casting: supply an explicit provider and voice_id, then mint with mode voice.
1365
+ */
1366
+ async createLive2dAvatar(input) {
1367
+ const { voice, ...identity } = createLive2dAvatarInputSchema.parse(input);
1368
+ const body = {
1369
+ ...identity,
1370
+ renderer: "live2d",
1371
+ sourceKind: "image",
1372
+ voice: { voice }
1373
+ };
1374
+ return this.#contract(
1375
+ await this.#request("POST", "/avatars", { json: body }),
1376
+ avatarResponseSchema,
1377
+ "Avatar response did not match the SDK contract"
1378
+ );
1379
+ }
1136
1380
  async createAvatar(input) {
1137
1381
  const body = {
1138
1382
  displayName: input.displayName,
@@ -1570,6 +1814,7 @@ function toAvatar(raw) {
1570
1814
  return {
1571
1815
  id: String(a.id),
1572
1816
  displayName: String(a.displayName ?? ""),
1817
+ renderer: avatarResponseSchema.shape.renderer.default("video").parse(a.renderer),
1573
1818
  sourceKind: a.sourceKind === "video" ? "video" : "image",
1574
1819
  status: a.status ?? "draft",
1575
1820
  defaultVoiceId: a.defaultVoiceId ? String(a.defaultVoiceId) : null,
@@ -1670,5 +1915,16 @@ function timingSafeEqual(a, b) {
1670
1915
  function isQueued(result) {
1671
1916
  return "queued" in result;
1672
1917
  }
1918
+ var proxyConnectRequestSchema = z.object({
1919
+ avatarId: z.string().min(1),
1920
+ mode: sessionModeSchema.optional()
1921
+ });
1922
+ var proxyEndRequestSchema = z.object({
1923
+ session_id: z.string().min(1).optional(),
1924
+ queue_ticket_id: z.string().min(1).optional(),
1925
+ reason: liveKitSessionReleaseReasonSchema.optional().catch(void 0)
1926
+ }).strict().refine((body) => body.session_id !== void 0 || body.queue_ticket_id !== void 0, {
1927
+ message: "session_id or queue_ticket_id is required"
1928
+ });
1673
1929
 
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 };
1930
+ export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, ROUTE_TIMEOUT_MS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalSpeechSegmentSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };