realtime-avatar 0.3.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.
@@ -0,0 +1,103 @@
1
+ import { LiveKitRoomProps } from '@livekit/react-native';
2
+ export { AudioSession, VideoTrack, VideoTrackProps, registerGlobals } from '@livekit/react-native';
3
+ import { ReactNode, ReactElement } from 'react';
4
+ import { aK as LiveKitSessionGrant, a as AvatarVideoFit } from './proxy-client-cZyX50-O.js';
5
+ export { b as ApproachingEndEvent, c as ApproachingEndReason, A as AvatarSessionClient, B as BehaviorSnapshot, C as CallTranscript, f as CallTranscriptSegment, g as CartesiaTtsModel, h as ClipResult, i as ClosingTurnResult, j as CreditsLowEvent, D as DEFAULT_APPROACHING_END_LEAD_SECONDS, k as DEFAULT_AVATAR_PLAYOUT_DELAY_SECONDS, l as DEFAULT_CREDITS_LOW_LEAD_SECONDS, m as DEFAULT_GOVERNOR_CONFIG, n as DEFAULT_GRACE_CEILING_SECONDS, o as DEFAULT_GRACE_WINDOW_LEAD_SECONDS, p as DEFAULT_IDLE_SECONDS, q as DEFAULT_IDLE_WARN_LEAD_SECONDS, r as DEFAULT_TURN_TIMEOUT_SECONDS, E as EndReason, s as EndedEvent, t as ExtendResult, F as FishTtsModel, u as FreezeReadingFn, G as Governor, v as GovernorAction, w as GovernorConfig, x as GovernorSignal, y as GovernorState, z as GraceWindowClosedEvent, H as GraceWindowOpenEvent, I as GraceWindowState, J as IdleWarningEvent, K as KnownBehaviorState, L as LLMProvider, M as LLMSelection, N as LiveKitAvatarGrantState, O as LiveKitAvatarGrantStatus, P as LiveKitCapacityState, Q as LiveKitConnectionStatus, R as LiveKitSessionRequest, S as LiveKitSessionStartResult, U as MAX_RECONNECT_ATTEMPTS, V as MAX_SESSION_INSTRUCTIONS_CHARS, Z as ProxyClientOptions, _ as QualityCap, $ as RECONNECT_BACKOFF_MS, a3 as RealtimeAvatarRequestOptions, a4 as RealtimeSessionApi, a5 as RealtimeSessionMedia, a6 as RealtimeSessionRoomSinks, a7 as ReconnectPolicy, a8 as ReconnectingEvent, a9 as RecoveryState, aa as RetryStep, ab as SessionBehavior, ac as SessionClip, ad as SessionClocks, ae as SessionEndReason, af as SessionLifecycleApi, ag as SessionLifecyclePhase, ah as SessionLifecyclePhaseKind, ai as SessionLifecycleRoomBridge, aj as SessionLifecycleRoomBridgeProps, ak as SurfaceLayers, al as TurnState, am as TurnTimeoutEvent, an as UseAvatarQualityGovernorInput, ao as UseLiveKitAvatarGrantInput, ap as UseRealtimeSessionInput, aq as UseSessionLifecycleInput, ar as VoiceSpec, as as VoiceSpecInput, at as capacityErrorFromBusy, au as capacityStateFromGrant, av as createProxyClient, aL as isNativeLiveTrackSubscribed, aw as knownBehaviorStates, ax as mapTurnState, ay as sessionBehaviorSchema, az as sessionClipSchema, aB as splitCallTranscript, aC as useAvatarPlayoutDelay, aD as useAvatarQualityGovernor, aE as useCallTranscript, aF as useLiveKitAvatarGrant, aM as useLiveTrackProducing, aG as useMicLease, aH as useRealtimeSession, aI as useReleaseMicLeaseOnTrackEnded, aJ as useSessionLifecycle } from './proxy-client-cZyX50-O.js';
6
+ import { StyleProp, ViewStyle } from 'react-native';
7
+ export { useChat, useConnectionState, useLocalParticipant, useRoomContext, useTrackToggle, useTranscriptions, useVoiceAssistant } from '@livekit/components-react';
8
+ export { DisconnectReason, RemoteAudioTrack, RemoteTrack, RemoteVideoTrack, Room, RoomEvent, SendTextOptions, Track } from 'livekit-client';
9
+ import 'zod';
10
+
11
+ type RealtimeAvatarLiveKitRoomProps = Omit<LiveKitRoomProps, "serverUrl" | "token" | "connect" | "audio" | "video" | "options"> & {
12
+ grant: LiveKitSessionGrant | null | undefined;
13
+ connect?: boolean;
14
+ /** Native LiveKit audio publish option. Defaults to server-STT sessions only. */
15
+ audio?: LiveKitRoomProps["audio"];
16
+ /** Native LiveKit video publish option. Defaults to false for avatar calls. */
17
+ video?: LiveKitRoomProps["video"];
18
+ /** Passed directly to LiveKitRoom. */
19
+ options?: LiveKitRoomProps["options"];
20
+ /**
21
+ * Start the OS audio session while the room is connected (and stop it after).
22
+ * Default true — without an active session, iOS plays no call audio. Set false
23
+ * when the app manages `AudioSession` itself (custom category/mode).
24
+ */
25
+ manageAudioSession?: boolean;
26
+ children?: ReactNode;
27
+ };
28
+ /**
29
+ * Own the native OS audio session for the duration of `enabled`. Split out of
30
+ * the room bridge so an app that composes its own room (imperative Room, custom
31
+ * LiveKitRoom props) can still one-line the session lifecycle.
32
+ */
33
+ declare function useRealtimeAvatarAudioSession(enabled: boolean): void;
34
+ /** Thin typed bridge from a Realtime Avatar grant into the native LiveKitRoom. */
35
+ declare function RealtimeAvatarLiveKitRoom(props: RealtimeAvatarLiveKitRoomProps): ReactElement;
36
+
37
+ /** What the surface hands `renderIdleVideo` — enough to drop in any RN player. */
38
+ type IdleVideoRender = {
39
+ /** The idle clip URL (never null — the callback only runs when one exists). */
40
+ url: string;
41
+ /** Absolute-fill style for the player, matching the other layers' box. */
42
+ style: StyleProp<ViewStyle>;
43
+ /** The surface's fit, as the player's resize semantic ("cover" | "contain"). */
44
+ resizeMode: AvatarVideoFit;
45
+ };
46
+ type AvatarVideoSurfaceProps = {
47
+ /**
48
+ * The avatar's idle/ambient clip URL, layered OVER the {@link poster} floor
49
+ * via {@link renderIdleVideo}. Pass `null` for avatars with no idle clip;
50
+ * the poster floor then shows at rest.
51
+ */
52
+ idleVideoUrl: string | null;
53
+ /**
54
+ * Renders the idle clip with the APP's video player (expo-video,
55
+ * react-native-video, …) — native has no built-in <video>, and the SDK does
56
+ * not pick a player for you. Loop it and keep it muted. When omitted, the
57
+ * idle layer is skipped and the poster is the resting floor.
58
+ */
59
+ renderIdleVideo?: (idle: IdleVideoRender) => ReactNode;
60
+ /**
61
+ * The avatar's PORTRAIT (its face) — the DEEPEST floor, behind the idle clip
62
+ * and the live video. It paints immediately and is the guaranteed no-frames
63
+ * backdrop, so the surface is never a black box while connecting / listening
64
+ * / between turns. Pass `null` to fall through to the app's own floor.
65
+ */
66
+ poster?: string | null;
67
+ /**
68
+ * The caller's INTENT to show the live stream. Still gated on the LiveKit
69
+ * connection state and a subscribed, PRODUCING video track, so a stale `true`
70
+ * can never leave a frozen/black live layer up. Default true.
71
+ */
72
+ live?: boolean;
73
+ /** Enable the subscriber-side quality governor (stats + SFU-pause tiers). Default true. */
74
+ adaptiveQuality?: boolean;
75
+ /** How media fits the box — mirrors CSS object-fit. Both layers share it. Default "contain". */
76
+ fit?: AvatarVideoFit;
77
+ /** Crossfade duration (ms) between idle and live. Default 500. */
78
+ crossfadeMs?: number;
79
+ /**
80
+ * Debounce (ms) before dropping BACK to the idle/poster floor once the live
81
+ * layer stops, so back-to-back turns don't flash the floor between them.
82
+ * Default 700. A disconnect bypasses this and reverts immediately.
83
+ */
84
+ idleReturnDelayMs?: number;
85
+ /** Style for the box (the layers fill it). The CONSUMER owns the aspect box. */
86
+ style?: StyleProp<ViewStyle>;
87
+ /** Overlay content rendered above both media layers (badges, chrome, scrims). */
88
+ children?: ReactNode;
89
+ /** Surface a small "live · WxH" badge when the live layer is shown. Default true. */
90
+ showLiveBadge?: boolean;
91
+ /** Test id for the box. */
92
+ testID?: string;
93
+ };
94
+ /**
95
+ * The native avatar video surface: one box rendering the poster floor, the
96
+ * (app-injected) idle clip, and the realtime LiveKit video as pixel-aligned
97
+ * layers with a crossfade — falling back to the idle/poster floor whenever the
98
+ * realtime session is not connected or producing. Must be rendered inside a
99
+ * LiveKit room context (e.g. under the native `RealtimeAvatarLiveKitRoom`).
100
+ */
101
+ declare function AvatarVideoSurface(props: AvatarVideoSurfaceProps): ReactElement;
102
+
103
+ export { AvatarVideoFit, AvatarVideoSurface, type AvatarVideoSurfaceProps, type IdleVideoRender, RealtimeAvatarLiveKitRoom, type RealtimeAvatarLiveKitRoomProps, useRealtimeAvatarAudioSession };