realtime-avatar 0.32.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.
@@ -1,5 +1,4 @@
1
- import { sessionModeSchema, liveKitSessionReleaseReasonSchema, RealtimeAvatar, ROUTE_TIMEOUT_MS, isQueued, RealtimeAvatarHttpError, RealtimeAvatarError } from './chunk-NKS5ZIWN.js';
2
- import { z } from 'zod';
1
+ import { RealtimeAvatar, ROUTE_TIMEOUT_MS, proxyEndRequestSchema, proxyConnectRequestSchema, isQueued, RealtimeAvatarHttpError, RealtimeAvatarError } from './chunk-GPGNAQZV.js';
3
2
 
4
3
  // ../http-client/src/generated/error-semantics.ts
5
4
  var ERROR_SEMANTICS = {
@@ -43,17 +42,6 @@ var MESSAGE_SHAPE_PATTERNS = { "machine": { "source": "[_=<>{}\\[\\]|\\\\$`]|\\w
43
42
  Object.values(MESSAGE_SHAPE_PATTERNS).map(
44
43
  (pattern) => new RegExp(pattern.source, pattern.flags)
45
44
  );
46
- var proxyConnectRequestSchema = z.object({
47
- avatarId: z.string().min(1),
48
- mode: sessionModeSchema.optional()
49
- });
50
- var proxyEndRequestSchema = z.object({
51
- session_id: z.string().min(1).optional(),
52
- queue_ticket_id: z.string().min(1).optional(),
53
- reason: liveKitSessionReleaseReasonSchema.optional().catch(void 0)
54
- }).strict().refine((body) => body.session_id !== void 0 || body.queue_ticket_id !== void 0, {
55
- message: "session_id or queue_ticket_id is required"
56
- });
57
45
 
58
46
  // ../proxy/src/config.ts
59
47
  var MISCONFIGURED = "internal_error";
package/dist/express.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-su27kEw0.js';
2
- import './types-BSSqsu_Z.js';
1
+ import { P as ProxyConfig } from './types-Cdi7KWWj.js';
2
+ import './types-Cg_i1jhk.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-NDCZABOK.js';
2
- import './chunk-NKS5ZIWN.js';
1
+ import { createProxyHandler } from './chunk-OVW4N5NH.js';
2
+ import './chunk-GPGNAQZV.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-su27kEw0.js';
2
- import './types-BSSqsu_Z.js';
1
+ import { P as ProxyConfig } from './types-Cdi7KWWj.js';
2
+ import './types-Cg_i1jhk.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/hono.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-NDCZABOK.js';
2
- import './chunk-NKS5ZIWN.js';
1
+ import { createProxyHandler } from './chunk-OVW4N5NH.js';
2
+ import './chunk-GPGNAQZV.js';
3
3
  import './chunk-MCIXU6XP.js';
4
4
 
5
5
  // ../proxy/src/hono.ts
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as 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-BSSqsu_Z.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-BSSqsu_Z.js';
1
+ import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as CreateLive2dAvatarInput, R as RegisteredAvatar, c as AvatarUpdate, d as AvatarSourceSwap, e as ClipLibraryDeclaration, f as ClipLibraryUpdate, L as LoopRedirect, g as ClipLibrary, h as AssetKind, i as Asset, j as ListSessionsOptions, U as UsageSessionPage, k as UsageSession, l as ListRecordingsQuery, m as ListRecordingsResponse, n as RecordingArtifact, o as RecordingAccessResponse, p as CreateRenderInput, q as CreditBalance, T as TranscriptPayload, V as VoiceWebhookRequest } from './types-Cg_i1jhk.js';
2
+ export { r as AvatarClip, s as CallConnection, t as CallQueued, u as ClipDeclaration, v as ClipLibraryPlan, w as ClipSource, x as ContextMessage, y as EndCallReason, z as ExternalLlm, B as RecordingArtifactStatus, D as RecordingMode, F as RenderShot, G as VideoPolicy, H as VoiceWebhook, I as VoiceWebhookErrorCode, J as isQueued, K as listRecordingsResponseSchema, M as recordingAccessResponseSchema, N as recordingArtifactSchema, O as recordingModeSchema } from './types-Cg_i1jhk.js';
3
3
  import { ConnectionHistoryResponse } from './connection-history.js';
4
4
  import { z } from 'zod';
5
5
 
@@ -276,6 +276,11 @@ declare class RealtimeAvatar {
276
276
  settings?: Record<string, unknown>;
277
277
  metadata?: Record<string, unknown>;
278
278
  }): Promise<Avatar>;
279
+ /**
280
+ * Register an app-owned Live2D rig for voice sessions. No assets, motion generation or
281
+ * automatic voice casting: supply an explicit provider and voice_id, then mint with mode voice.
282
+ */
283
+ createLive2dAvatar(input: CreateLive2dAvatarInput): Promise<RegisteredAvatar>;
279
284
  createAvatar(input: {
280
285
  displayName: string;
281
286
  sourceKind: "image" | "video";
@@ -567,6 +572,30 @@ declare function verifyTranscript(rawBody: Uint8Array | string, headers: Webhook
567
572
  */
568
573
  declare function verifyVoiceWebhook(rawBody: Uint8Array | string, headers: WebhookHeaders, secret: string, options?: VerifyOptions): Promise<VoiceWebhookRequest>;
569
574
 
575
+ declare const externalTurnContextSchema: z.ZodObject<{
576
+ session_id: z.ZodString;
577
+ generation_id: z.ZodString;
578
+ version: z.ZodLiteral<1>;
579
+ purpose: z.ZodUnion<readonly [z.ZodEnum<{
580
+ respond: "respond";
581
+ recovery: "recovery";
582
+ initiative: "initiative";
583
+ }>, z.ZodString]>;
584
+ admission: z.ZodEnum<{
585
+ draft: "draft";
586
+ accepted: "accepted";
587
+ }>;
588
+ visible_character: z.ZodOptional<z.ZodObject<{
589
+ renderer: z.ZodLiteral<"external">;
590
+ }, z.core.$strip>>;
591
+ }, z.core.$strip>;
592
+ type ExternalTurnContext = z.infer<typeof externalTurnContextSchema>;
593
+ declare const externalUtteranceSchema: z.ZodObject<{
594
+ generation_id: z.ZodString;
595
+ utterance_id: z.ZodString;
596
+ }, z.core.$strip>;
597
+ type ExternalUtterance = z.infer<typeof externalUtteranceSchema>;
598
+
570
599
  declare const clipLibraryDeclarationSchema: z.ZodObject<{
571
600
  idle: z.ZodOptional<z.ZodObject<{
572
601
  clips: z.ZodArray<z.ZodString>;
@@ -605,5 +634,311 @@ declare const fishTtsModelSchema: z.ZodUnion<readonly [z.ZodEnum<{
605
634
  }>]>;
606
635
  type FishTtsModel = z.infer<typeof fishTtsModelSchema>;
607
636
  declare const DEFAULT_FISH_TTS_MODEL: "s2.1-pro";
637
+ declare const fishDeliverySchema: z.ZodUnion<readonly [z.ZodEnum<{
638
+ whisper: "whisper";
639
+ }>, z.ZodNull]>;
640
+ type FishDelivery = NonNullable<z.infer<typeof fishDeliverySchema>>;
641
+ /** The models each delivery can be heard on, from the platform's `x-fish-delivery-models`. */
642
+ declare const FISH_DELIVERY_MODELS: {
643
+ readonly whisper: readonly ["drama-3"];
644
+ };
645
+
646
+ /**
647
+ * Wire schemas for the public Realtime Avatar API.
648
+ *
649
+ * Code only, by policy: this file carries schemas and no narrative. Prose is where
650
+ * boundaries are hardest to hold, because a sentence explaining WHY a field exists tends
651
+ * to describe the thing on the other side of it.
652
+ *
653
+ * What may appear here is bounded by `public-surface.txt` and enforced by
654
+ * `npm run surface`: every export must be named on that allowlist, so a new one is
655
+ * refused until someone decides it is public. Documentation lives at
656
+ * https://realtimeavatar.ai/docs.
657
+ */
658
+
659
+ declare const liveKitSessionGrantSchema: z.ZodObject<{
660
+ recording: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
661
+ sessionId: z.ZodString;
662
+ recordingId: z.ZodString;
663
+ mode: z.ZodEnum<{
664
+ audio: "audio";
665
+ video: "video";
666
+ audio_video: "audio_video";
667
+ }>;
668
+ createdAt: z.ZodString;
669
+ retainedUntil: z.ZodString;
670
+ participant: z.ZodOptional<z.ZodObject<{
671
+ participantIdentity: z.ZodString;
672
+ role: z.ZodEnum<{
673
+ avatar: "avatar";
674
+ user: "user";
675
+ }>;
676
+ }, z.core.$strict>>;
677
+ mediaStartedAt: z.ZodOptional<z.ZodString>;
678
+ mediaEndedAt: z.ZodOptional<z.ZodString>;
679
+ mediaStartOffsetMs: z.ZodOptional<z.ZodNumber>;
680
+ mediaMutedIntervalsMs: z.ZodOptional<z.ZodArray<z.ZodObject<{
681
+ startMs: z.ZodNumber;
682
+ endMs: z.ZodNumber;
683
+ }, z.core.$strict>>>;
684
+ status: z.ZodEnum<{
685
+ pending: "pending";
686
+ recording: "recording";
687
+ processing: "processing";
688
+ expired: "expired";
689
+ }>;
690
+ }, z.core.$strict>, z.ZodObject<{
691
+ sessionId: z.ZodString;
692
+ recordingId: z.ZodString;
693
+ mode: z.ZodEnum<{
694
+ audio: "audio";
695
+ video: "video";
696
+ audio_video: "audio_video";
697
+ }>;
698
+ createdAt: z.ZodString;
699
+ retainedUntil: z.ZodString;
700
+ participant: z.ZodOptional<z.ZodObject<{
701
+ participantIdentity: z.ZodString;
702
+ role: z.ZodEnum<{
703
+ avatar: "avatar";
704
+ user: "user";
705
+ }>;
706
+ }, z.core.$strict>>;
707
+ mediaStartedAt: z.ZodOptional<z.ZodString>;
708
+ mediaEndedAt: z.ZodOptional<z.ZodString>;
709
+ mediaStartOffsetMs: z.ZodOptional<z.ZodNumber>;
710
+ mediaMutedIntervalsMs: z.ZodOptional<z.ZodArray<z.ZodObject<{
711
+ startMs: z.ZodNumber;
712
+ endMs: z.ZodNumber;
713
+ }, z.core.$strict>>>;
714
+ status: z.ZodLiteral<"ready">;
715
+ mediaType: z.ZodEnum<{
716
+ "audio/mp4": "audio/mp4";
717
+ "video/mp4": "video/mp4";
718
+ "audio/ogg": "audio/ogg";
719
+ "video/webm": "video/webm";
720
+ }>;
721
+ sizeBytes: z.ZodNumber;
722
+ durationMs: z.ZodNullable<z.ZodNumber>;
723
+ }, z.core.$strict>, z.ZodObject<{
724
+ sessionId: z.ZodString;
725
+ recordingId: z.ZodString;
726
+ mode: z.ZodEnum<{
727
+ audio: "audio";
728
+ video: "video";
729
+ audio_video: "audio_video";
730
+ }>;
731
+ createdAt: z.ZodString;
732
+ retainedUntil: z.ZodString;
733
+ participant: z.ZodOptional<z.ZodObject<{
734
+ participantIdentity: z.ZodString;
735
+ role: z.ZodEnum<{
736
+ avatar: "avatar";
737
+ user: "user";
738
+ }>;
739
+ }, z.core.$strict>>;
740
+ mediaStartedAt: z.ZodOptional<z.ZodString>;
741
+ mediaEndedAt: z.ZodOptional<z.ZodString>;
742
+ mediaStartOffsetMs: z.ZodOptional<z.ZodNumber>;
743
+ mediaMutedIntervalsMs: z.ZodOptional<z.ZodArray<z.ZodObject<{
744
+ startMs: z.ZodNumber;
745
+ endMs: z.ZodNumber;
746
+ }, z.core.$strict>>>;
747
+ status: z.ZodLiteral<"failed">;
748
+ errorCode: z.ZodEnum<{
749
+ recording_failed: "recording_failed";
750
+ recording_unavailable: "recording_unavailable";
751
+ }>;
752
+ }, z.core.$strict>], "status">>;
753
+ recording_mode: z.ZodOptional<z.ZodEnum<{
754
+ off: "off";
755
+ audio: "audio";
756
+ video: "video";
757
+ audio_video: "audio_video";
758
+ participants: "participants";
759
+ tracks: "tracks";
760
+ }>>;
761
+ recordings: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
762
+ sessionId: z.ZodString;
763
+ recordingId: z.ZodString;
764
+ mode: z.ZodEnum<{
765
+ audio: "audio";
766
+ video: "video";
767
+ audio_video: "audio_video";
768
+ }>;
769
+ createdAt: z.ZodString;
770
+ retainedUntil: z.ZodString;
771
+ participant: z.ZodOptional<z.ZodObject<{
772
+ participantIdentity: z.ZodString;
773
+ role: z.ZodEnum<{
774
+ avatar: "avatar";
775
+ user: "user";
776
+ }>;
777
+ }, z.core.$strict>>;
778
+ mediaStartedAt: z.ZodOptional<z.ZodString>;
779
+ mediaEndedAt: z.ZodOptional<z.ZodString>;
780
+ mediaStartOffsetMs: z.ZodOptional<z.ZodNumber>;
781
+ mediaMutedIntervalsMs: z.ZodOptional<z.ZodArray<z.ZodObject<{
782
+ startMs: z.ZodNumber;
783
+ endMs: z.ZodNumber;
784
+ }, z.core.$strict>>>;
785
+ status: z.ZodEnum<{
786
+ pending: "pending";
787
+ recording: "recording";
788
+ processing: "processing";
789
+ expired: "expired";
790
+ }>;
791
+ }, z.core.$strict>, z.ZodObject<{
792
+ sessionId: z.ZodString;
793
+ recordingId: z.ZodString;
794
+ mode: z.ZodEnum<{
795
+ audio: "audio";
796
+ video: "video";
797
+ audio_video: "audio_video";
798
+ }>;
799
+ createdAt: z.ZodString;
800
+ retainedUntil: z.ZodString;
801
+ participant: z.ZodOptional<z.ZodObject<{
802
+ participantIdentity: z.ZodString;
803
+ role: z.ZodEnum<{
804
+ avatar: "avatar";
805
+ user: "user";
806
+ }>;
807
+ }, z.core.$strict>>;
808
+ mediaStartedAt: z.ZodOptional<z.ZodString>;
809
+ mediaEndedAt: z.ZodOptional<z.ZodString>;
810
+ mediaStartOffsetMs: z.ZodOptional<z.ZodNumber>;
811
+ mediaMutedIntervalsMs: z.ZodOptional<z.ZodArray<z.ZodObject<{
812
+ startMs: z.ZodNumber;
813
+ endMs: z.ZodNumber;
814
+ }, z.core.$strict>>>;
815
+ status: z.ZodLiteral<"ready">;
816
+ mediaType: z.ZodEnum<{
817
+ "audio/mp4": "audio/mp4";
818
+ "video/mp4": "video/mp4";
819
+ "audio/ogg": "audio/ogg";
820
+ "video/webm": "video/webm";
821
+ }>;
822
+ sizeBytes: z.ZodNumber;
823
+ durationMs: z.ZodNullable<z.ZodNumber>;
824
+ }, z.core.$strict>, z.ZodObject<{
825
+ sessionId: z.ZodString;
826
+ recordingId: z.ZodString;
827
+ mode: z.ZodEnum<{
828
+ audio: "audio";
829
+ video: "video";
830
+ audio_video: "audio_video";
831
+ }>;
832
+ createdAt: z.ZodString;
833
+ retainedUntil: z.ZodString;
834
+ participant: z.ZodOptional<z.ZodObject<{
835
+ participantIdentity: z.ZodString;
836
+ role: z.ZodEnum<{
837
+ avatar: "avatar";
838
+ user: "user";
839
+ }>;
840
+ }, z.core.$strict>>;
841
+ mediaStartedAt: z.ZodOptional<z.ZodString>;
842
+ mediaEndedAt: z.ZodOptional<z.ZodString>;
843
+ mediaStartOffsetMs: z.ZodOptional<z.ZodNumber>;
844
+ mediaMutedIntervalsMs: z.ZodOptional<z.ZodArray<z.ZodObject<{
845
+ startMs: z.ZodNumber;
846
+ endMs: z.ZodNumber;
847
+ }, z.core.$strict>>>;
848
+ status: z.ZodLiteral<"failed">;
849
+ errorCode: z.ZodEnum<{
850
+ recording_failed: "recording_failed";
851
+ recording_unavailable: "recording_unavailable";
852
+ }>;
853
+ }, z.core.$strict>], "status">>>;
854
+ connection_history: z.ZodOptional<z.ZodObject<{
855
+ endpoint: z.ZodString;
856
+ token: z.ZodString;
857
+ expiresAt: z.ZodString;
858
+ }, z.core.$strict>>;
859
+ status: z.ZodDefault<z.ZodLiteral<"ready">>;
860
+ session_id: z.ZodString;
861
+ room_name: z.ZodString;
862
+ livekit_url: z.ZodString;
863
+ participant_token: z.ZodString;
864
+ participant_identity: z.ZodString;
865
+ reservation_expires_at: z.ZodString;
866
+ stt_mode: z.ZodDefault<z.ZodEnum<{
867
+ server: "server";
868
+ off: "off";
869
+ }>>;
870
+ camera: z.ZodOptional<z.ZodBoolean>;
871
+ room_created: z.ZodDefault<z.ZodBoolean>;
872
+ dispatch_created: z.ZodDefault<z.ZodBoolean>;
873
+ join_timeout_seconds: z.ZodDefault<z.ZodNumber>;
874
+ idle_timeout_seconds: z.ZodDefault<z.ZodNumber>;
875
+ max_session_seconds: z.ZodDefault<z.ZodNumber>;
876
+ }, z.core.$loose>;
877
+ declare const capacityBusyResponseSchema: z.ZodObject<{
878
+ message: z.ZodString;
879
+ capacity: z.ZodObject<{
880
+ capacity_pool: z.ZodOptional<z.ZodString>;
881
+ agent_name: z.ZodOptional<z.ZodString>;
882
+ max_sessions: z.ZodNumber;
883
+ max_sessions_per_gpu: z.ZodOptional<z.ZodNumber>;
884
+ worker_count: z.ZodNumber;
885
+ active_sessions: z.ZodNumber;
886
+ reserved_sessions: z.ZodNumber;
887
+ observed_worker_active_sessions: z.ZodNumber;
888
+ available_sessions: z.ZodNumber;
889
+ queue_size: z.ZodNumber;
890
+ admission_open: z.ZodBoolean;
891
+ recommended_retry_ms: z.ZodNumber;
892
+ load: z.ZodNumber;
893
+ }, z.core.$loose>;
894
+ queue_size: z.ZodNumber;
895
+ queue_ticket_id: z.ZodOptional<z.ZodString>;
896
+ queue_position: z.ZodOptional<z.ZodNumber>;
897
+ recommended_retry_ms: z.ZodNumber;
898
+ }, z.core.$strict>;
899
+
900
+ /**
901
+ * The contract between `createProxyClient` (the page) and `createProxyHandler` (your route).
902
+ *
903
+ * One declaration for both halves: the client builds its bodies from these types and the route
904
+ * validates what arrives against these schemas, once, as `unknown`. Until this existed the route
905
+ * cast `request.json()` to the shape it hoped for, so a body of literal `null` threw a TypeError
906
+ * out of the handler, and a queued release could not be told apart from a session release.
907
+ */
908
+
909
+ /**
910
+ * `POST …/connect`. The page chooses WHO to call and whether it wants video. Nothing else: a
911
+ * policy field sent here is dropped rather than refused, because the route's `session` hook is
912
+ * the only source of policy and a stale page should not lose its call over a key it no longer
913
+ * gets to set.
914
+ */
915
+ declare const proxyConnectRequestSchema: z.ZodObject<{
916
+ avatarId: z.ZodString;
917
+ mode: z.ZodOptional<z.ZodEnum<{
918
+ avatar: "avatar";
919
+ voice: "voice";
920
+ }>>;
921
+ }, z.core.$strip>;
922
+ /**
923
+ * `POST …/end`. A started call is released by its session id; a call still waiting in line has no
924
+ * session yet and is released by its queue ticket. At least one, and both are allowed, as the
925
+ * platform's release contract allows them. Lengths are the platform's to judge: the route
926
+ * forwards ids it minted and never stores what it is sent.
927
+ *
928
+ * `reason` is diagnostic. One this SDK does not know is not a reason to keep a slot held, so it
929
+ * reads as absent (released as `manual`) rather than refusing the release.
930
+ */
931
+ declare const proxyEndRequestSchema: z.ZodObject<{
932
+ session_id: z.ZodOptional<z.ZodString>;
933
+ queue_ticket_id: z.ZodOptional<z.ZodString>;
934
+ reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
935
+ page_hide: "page_hide";
936
+ disconnected: "disconnected";
937
+ superseded: "superseded";
938
+ unmount: "unmount";
939
+ manual: "manual";
940
+ idle_timeout: "idle_timeout";
941
+ }>>>;
942
+ }, z.core.$strict>;
608
943
 
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 };
944
+ export { Asset, AssetKind, Avatar, AvatarSourceSwap, AvatarUpdate, CallMode, CallPolicy, ClipLibrary, ClipLibraryDeclaration, ClipLibraryUpdate, CreateLive2dAvatarInput, CreateRenderInput, CreditBalance, DEFAULT_FISH_TTS_MODEL, EndCallOptions, type ExternalTurnContext, type ExternalUtterance, FISH_DELIVERY_MODELS, type FishDelivery, type FishTtsModel, ListRecordingsQuery, ListRecordingsResponse, type ListRendersQuery, type ListRendersResponse, ListSessionsOptions, LoopRedirect, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, type RealtimeAvatarOptions, RealtimeAvatarWebhookError, RecordingAccessResponse, RecordingArtifact, RegisteredAvatar, type Render, type RenderAccessResponse, type RenderFailureCode, type RenderPlayback, type RenderStatus, type ShotTiming, type StartCallOptions, StartCallResult, TranscriptPayload, UsageSession, UsageSessionPage, VoiceWebhookRequest, type WebhookVerificationErrorCode, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook };
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export { DEFAULT_FISH_TTS_MODEL, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-NKS5ZIWN.js';
1
+ import './chunk-6KQS7CTR.js';
2
+ export { DEFAULT_FISH_TTS_MODEL, FISH_DELIVERY_MODELS, RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, capacityBusyResponseSchema, clipLibraryDeclarationSchema, externalTurnContextSchema, externalUtteranceSchema, fishTtsModelSchema, isQueued, listRecordingsResponseSchema, listRendersResponseSchema, liveKitSessionGrantSchema, proxyConnectRequestSchema, proxyEndRequestSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, renderAccessResponseSchema, renderSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-GPGNAQZV.js';
2
3
  import './chunk-MCIXU6XP.js';
package/dist/nextjs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { P as ProxyConfig } from './types-su27kEw0.js';
2
- import './types-BSSqsu_Z.js';
1
+ import { P as ProxyConfig } from './types-Cdi7KWWj.js';
2
+ import './types-Cg_i1jhk.js';
3
3
  import 'zod';
4
4
 
5
5
  /**
package/dist/nextjs.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createProxyHandler } from './chunk-NDCZABOK.js';
2
- import './chunk-NKS5ZIWN.js';
1
+ import { createProxyHandler } from './chunk-OVW4N5NH.js';
2
+ import './chunk-GPGNAQZV.js';
3
3
  import './chunk-MCIXU6XP.js';
4
4
 
5
5
  // ../proxy/src/nextjs.ts
@@ -1,3 +1,137 @@
1
+ import { Room, ByteStreamReader } from 'livekit-client';
2
+ import { z } from 'zod';
3
+
4
+ declare const correlatedAudioHeaderSchema: z.ZodObject<{
5
+ session_id: z.ZodString;
6
+ generation_id: z.ZodString;
7
+ version: z.ZodLiteral<1>;
8
+ utterance_id: z.ZodString;
9
+ stream_id: z.ZodString;
10
+ epoch: z.ZodInt;
11
+ sample_rate: z.ZodLiteral<24000>;
12
+ channels: z.ZodLiteral<1>;
13
+ encoding: z.ZodLiteral<"pcm_s16le">;
14
+ }, z.core.$strip>;
15
+ type CorrelatedAudioHeader = z.infer<typeof correlatedAudioHeaderSchema>;
16
+
17
+ /**
18
+ * Making the character AUDIBLE — the half of "audio works" that has nothing to do with the
19
+ * microphone.
20
+ *
21
+ * WHY THIS EXISTS. Two failures here look identical to a developer ("she never speaks") and
22
+ * neither raises anything:
23
+ *
24
+ * 1. The audio element is created but never inserted into the document. `track.attach()`
25
+ * hands back a detached `<audio>`; a detached element is not reliably played by every
26
+ * engine, and there is no node on the page to fall back to. Nothing errors — the call is
27
+ * connected, the track is subscribed, the meter moves, and it is silent.
28
+ * 2. Autoplay is blocked. A page that has not yet had a user gesture may not start audio,
29
+ * so the first call a visitor makes is mute. `room.startAudio()` fixes it, but it must be
30
+ * called FROM a gesture — which means the page needs a button, which means the page has
31
+ * to know it is blocked. That signal is an event nobody subscribes to.
32
+ *
33
+ * So this owns both: it attaches into the DOM, and it tells you when a gesture is required
34
+ * and hands you the closure that spends it.
35
+ *
36
+ * Structural like its sibling — no `livekit-client` import, no version pin.
37
+ */
38
+ /** The sliver of a livekit-client `Track` this needs. */
39
+ interface AttachableTrack {
40
+ kind: string;
41
+ attach(): HTMLMediaElement;
42
+ detach(): HTMLMediaElement[];
43
+ }
44
+ /** The sliver of a livekit-client `Room` this needs. */
45
+ interface AudioCapableRoom {
46
+ canPlaybackAudio: boolean;
47
+ startAudio(): Promise<void>;
48
+ on(event: string, listener: (...args: never[]) => void): unknown;
49
+ off(event: string, listener: (...args: never[]) => void): unknown;
50
+ }
51
+ interface AttachRemoteAudioOptions {
52
+ /**
53
+ * Receiver playout cushion applied to EVERY remote track the room subscribes (video
54
+ * included, so the pair stays lip-locked) via `prepareAvatarRoom`. Default 0.5s — the
55
+ * measured freeze-free depth. `false` leaves the room untouched, for a page that owns
56
+ * its own buffering. Not undone by `detach()`: a shallower buffer mid-call only brings
57
+ * the freezes back.
58
+ */
59
+ playoutDelaySeconds?: number | false;
60
+ /**
61
+ * Where to park the audio elements. Defaults to `document.body`.
62
+ *
63
+ * They are not `display:none` — a hidden media element is still subject to the same
64
+ * autoplay rules, and hiding it only removes the browser's own affordance.
65
+ */
66
+ container?: HTMLElement;
67
+ /**
68
+ * Called when the browser refuses to start audio without a gesture, and again with `null`
69
+ * once audio is playing. Render a button from it and call `unblock` in the click handler:
70
+ *
71
+ * ```ts
72
+ * onPlaybackBlocked: (unblock) => {
73
+ * button.hidden = unblock === null;
74
+ * button.onclick = () => unblock?.();
75
+ * }
76
+ * ```
77
+ */
78
+ onPlaybackBlocked?: (unblock: (() => Promise<void>) | null) => void;
79
+ }
80
+ interface RemoteAudioAttachment {
81
+ /** Stop listening and remove every element this created. Safe to call twice. */
82
+ detach(): void;
83
+ }
84
+ /**
85
+ * Play every remote audio track the room subscribes to, and surface an autoplay block.
86
+ *
87
+ * Call it BEFORE `room.connect()` — a track subscribed during connect is missed otherwise,
88
+ * and that race is the version of this bug that only reproduces on a fast connection.
89
+ *
90
+ * ```ts
91
+ * const audio = attachRemoteAudio(room, {
92
+ * onPlaybackBlocked: (unblock) => {
93
+ * enableSound.hidden = unblock === null;
94
+ * enableSound.onclick = () => unblock?.();
95
+ * },
96
+ * });
97
+ * await room.connect(url, token);
98
+ * // …later
99
+ * audio.detach();
100
+ * ```
101
+ */
102
+ declare function attachRemoteAudio(room: AudioCapableRoom, options?: AttachRemoteAudioOptions): RemoteAudioAttachment;
103
+
104
+ /** Source PCM consumed by the AudioContext clock, not proof of physical audibility. */
105
+ type CorrelatedAudioPosition = Readonly<Pick<CorrelatedAudioHeader, "session_id" | "generation_id" | "utterance_id" | "stream_id" | "epoch"> & {
106
+ samples: number;
107
+ sampleRate: CorrelatedAudioHeader["sample_rate"];
108
+ state: "playing" | "finished";
109
+ }>;
110
+ type CorrelatedAudioInvalidation = "cancelled" | "connection_lost" | "invalid_stream" | "disposed";
111
+ type CorrelatedAudioObserver = Readonly<{
112
+ prepare?: (header: CorrelatedAudioHeader, signal: AbortSignal) => Promise<void>;
113
+ onPosition: (position: CorrelatedAudioPosition) => void;
114
+ onInvalidated: (reason: CorrelatedAudioInvalidation) => void;
115
+ onPlaybackBlocked?: AttachRemoteAudioOptions["onPlaybackBlocked"];
116
+ }>;
117
+ type AttachCorrelatedAudioOptions = CorrelatedAudioObserver & Readonly<{
118
+ sessionId: CorrelatedAudioHeader["session_id"];
119
+ agentIdentity: string;
120
+ }>;
121
+ type CorrelatedAudioAttachment = Readonly<{
122
+ startAudio(): Promise<void>;
123
+ dispose(): Promise<void>;
124
+ }>;
125
+ type AudioReader = Pick<ByteStreamReader, "info"> & {
126
+ withAbortSignal(signal: Parameters<ByteStreamReader["withAbortSignal"]>[0]): AsyncIterable<Uint8Array>;
127
+ };
128
+ type AudioRoom = Pick<Room, "state" | "on" | "off" | "unregisterByteStreamHandler"> & {
129
+ localParticipant: Pick<Room["localParticipant"], "registerRpcMethod" | "unregisterRpcMethod" | "performRpc">;
130
+ registerByteStreamHandler(topic: string, handler: (reader: AudioReader, participant: Parameters<Parameters<Room["registerByteStreamHandler"]>[1]>[1]) => void): void;
131
+ };
132
+ /** Opt-in only. Never combine with RoomAudioRenderer or attachRemoteAudio on this call. */
133
+ declare function attachCorrelatedAudio(room: AudioRoom, options: AttachCorrelatedAudioOptions): CorrelatedAudioAttachment;
134
+
1
135
  /**
2
136
  * Turning the microphone on, and saying what went wrong when it does not.
3
137
  *
@@ -165,4 +299,4 @@ declare function applyPlayoutDelay(track: unknown, delaySeconds?: number): boole
165
299
  */
166
300
  declare function applyAvatarPlayoutDelay(videoTrack: unknown, audioTrack: unknown, delaySeconds?: number): void;
167
301
 
168
- export { DEFAULT_AVATAR_PLAYOUT_DELAY_SECONDS as D, type EnableMicrophoneOptions as E, type MicrophoneCapableRoom as M, type PlayoutDelayTarget as P, type MicrophoneFailureReason as a, type MicrophoneProblem as b, type MicrophoneProblemReason as c, type MicrophoneResult as d, applyAvatarPlayoutDelay as e, applyPlayoutDelay as f, describeMicrophoneFailure as g, enableMicrophone as h };
302
+ export { type AttachCorrelatedAudioOptions as A, type CorrelatedAudioAttachment as C, DEFAULT_AVATAR_PLAYOUT_DELAY_SECONDS as D, type EnableMicrophoneOptions as E, type MicrophoneCapableRoom as M, type PlayoutDelayTarget as P, type RemoteAudioAttachment as R, type AttachRemoteAudioOptions as a, type AttachableTrack as b, type AudioCapableRoom as c, type CorrelatedAudioInvalidation as d, type CorrelatedAudioObserver as e, type CorrelatedAudioPosition as f, type MicrophoneFailureReason as g, type MicrophoneProblem as h, type MicrophoneProblemReason as i, type MicrophoneResult as j, applyAvatarPlayoutDelay as k, applyPlayoutDelay as l, attachCorrelatedAudio as m, attachRemoteAudio as n, describeMicrophoneFailure as o, enableMicrophone as p };